body {
  background: #000;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.navbar {
  background: linear-gradient(135deg, #00b33c, #009930) !important;
  border-bottom: 3px solid #e60000;
}

.navbar-brand {
  color: #fff !important;
  font-size: 1.1rem;
}

.navbar-brand img {
  height: 36px;
  margin-right: 8px;
  border-radius: 50%;
  border: none;
  background: transparent;
}

.container {
  max-width: 600px;
}

.hero-banner {
  background: linear-gradient(135deg, #e60000, #cc0000);
  border-radius: 14px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  text-align: center;
  color: #fff;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  border: 3px solid #d4a800;
}

.hero-banner h1 {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.hero-banner .subtitle {
  font-size: 0.9rem;
  opacity: 0.9;
}

.hero-banner .crest {
  width: 110px;
  height: 110px;
  margin-bottom: 10px;
  border-radius: 50%;
  border: none;
  background: transparent;
  object-fit: contain;
  padding: 0;
}

.card {
  border: none;
  border-radius: 12px;
  box-shadow: 0 3px 12px rgba(0,0,0,0.2);
  overflow: hidden;
  background: #fff;
  color: #333;
}

.card-header {
  font-weight: 700;
  font-size: 0.95rem;
  padding: 12px 16px;
}

.hdr-gold,
.hdr-green,
.hdr-red,
.hdr-blue,
.hdr-default {
  background: linear-gradient(90deg, #00cc44, #00b33c);
  color: #fff;
}

.form-select, .form-control {
  border-radius: 8px;
  border: 2px solid #ddd;
}

.form-select:focus, .form-control:focus {
  border-color: #28a745;
  box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.2);
}

.btn-submit {
  padding: 14px;
  font-size: 1.05rem;
  font-weight: 700;
  background: linear-gradient(90deg, #e60000, #cc0000);
  border: 2px solid #ffcc00;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.btn-submit:hover {
  background: linear-gradient(90deg, #006600, #004d00);
  border-color: #ffcc00;
  color: #fff;
}

.badge {
  font-size: 0.8rem;
  padding: 5px 8px;
}

.group-teams .badge {
  background: #f0f0f0 !important;
  color: #333 !important;
  border: 1px solid #ccc !important;
}

.group-pick {
  font-size: 0.85rem;
  padding: 6px 12px;
  border-radius: 20px;
  transition: all 0.15s ease;
}

.group-pick.btn-success {
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(40, 167, 69, 0.4);
}

.flag-icon {
  width: 20px;
  height: 15px;
  object-fit: cover;
  border-radius: 2px;
  vertical-align: middle;
  margin-right: 2px;
}

/* Custom select dropdown */
.custom-select-wrapper {
  position: relative;
}

.custom-select-display {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0.375rem 0.75rem;
  border: 1px solid #ced4da;
  border-radius: 0.375rem;
  background: #fff;
  cursor: pointer;
  min-height: 38px;
  font-size: 1rem;
}

.custom-select-display .caret {
  margin-left: auto;
  color: #666;
  font-size: 0.8em;
}

.custom-select-display .placeholder-text {
  color: #6c757d;
}

.custom-select-display.has-value {
  color: #212529;
}

.custom-select-dropdown {
  display: none;
  position: fixed;
  z-index: 1050;
  background: #fff;
  border: 1px solid #ced4da;
  border-radius: 0.375rem;
  max-height: 250px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.custom-select-wrapper.open .custom-select-display {
  border-color: #006600;
  box-shadow: 0 0 0 0.2rem rgba(0,102,0,0.15);
}

.custom-select-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.95rem;
}

.custom-select-item:hover {
  background: #e8f5e9;
}

.custom-select-item img {
  width: 24px;
  height: 18px;
  object-fit: cover;
  border-radius: 2px;
}

.tick {
  color: #28a745;
  font-weight: 700;
  font-size: 0.85em;
  margin-left: 4px;
}

#successMsg {
  border-radius: 12px;
  background: #d4edda;
  border: 2px solid #28a745;
  padding: 2rem;
}

.text-muted {
  color: #777 !important;
}

.points-tag {
  display: inline-block;
  background: #ffcc00;
  color: #333;
  font-weight: 700;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 4px;
}

/* Rules page */
.rules-card .table {
  margin-bottom: 0;
}

.rules-card .fw-bold.text-success {
  color: #006600 !important;
}

@media (max-width: 576px) {
  .container {
    padding-left: 10px;
    padding-right: 10px;
  }

  .hero-banner h1 {
    font-size: 1.3rem;
  }

  .hero-banner .crest {
    width: 85px;
    height: 85px;
  }
}

/* Modern flip countdown */
.countdown-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  max-width: 380px;
  margin: 0 auto;
  perspective: 800px;
}
.countdown-cell {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1.15;
  transform-style: preserve-3d;
}
.cd-inner {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(.4,.2,.2,1);
}
.cd-front, .cd-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.cd-front {
  background: linear-gradient(160deg, #1a1a1a, #000);
  color: #fff;
  border: 2px solid #00cc44;
  box-shadow: 0 4px 12px rgba(0,204,68,0.25), inset 0 1px 0 rgba(255,255,255,0.08);
  padding: 6px 4px;
}
.cd-front::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(255,255,255,0.08);
}
.cd-back {
  background: linear-gradient(135deg, #cc0000, #8b0000);
  border: 2px solid #ffcc00;
  transform: rotateY(180deg);
  padding: 8px;
}
.cd-back img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 50%;
}
.countdown-cell.initial-flip .cd-inner {
  transform: rotateY(180deg);
  animation: dealAndFlip 1.2s cubic-bezier(.4,.2,.2,1) forwards;
}
@keyframes dealAndFlip {
  0% { transform: translateY(-200px) rotateY(180deg) rotateZ(-15deg); opacity: 0; }
  30% { transform: translateY(0) rotateY(180deg) rotateZ(0); opacity: 1; }
  100% { transform: translateY(0) rotateY(0) rotateZ(0); opacity: 1; }
}
.countdown-value {
  display: block;
  font-family: 'Courier New', monospace;
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1;
  text-shadow: 0 0 10px rgba(0,204,68,0.6);
  letter-spacing: 1px;
}
.countdown-label {
  display: block;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #00cc44;
  margin-top: 6px;
  font-weight: 700;
}
.countdown-cell.tick .countdown-value {
  animation: tickPulse 0.45s ease-out;
}
@keyframes tickPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); text-shadow: 0 0 18px rgba(0,204,68,0.95); }
  100% { transform: scale(1); }
}
.countdown-done {
  font-size: 1.2rem;
  font-weight: 700;
  color: #00cc44;
  padding: 12px;
  grid-column: 1 / -1;
}
@media (max-width: 380px) {
  .countdown-value { font-size: 1.4rem; }
  .countdown-label { font-size: 0.55rem; letter-spacing: 1px; }
}
