:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --light: #f8fafc;
  --dark: #111827;
  --gray: #64748b;
  --border: #dbe3ee;
  --radius: 8px;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.10);
  --shadow-hover: 0 22px 60px rgba(15, 23, 42, 0.14);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--dark);
  background:
    radial-gradient(circle at 0 0, rgba(37, 99, 235, 0.12), transparent 28rem),
    linear-gradient(135deg, #f8fafc 0%, #eef6f1 46%, #fff7ed 100%);
  line-height: 1.55;
}

.modern-shell { min-height: 100vh; }

.modern-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem clamp(1rem, 4vw, 3.5rem);
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid rgba(148, 163, 184, 0.26);
  backdrop-filter: blur(16px);
}

.navbar-brand {
  color: #0f172a;
  font-size: 1rem;
  font-weight: 900;
  text-decoration: none;
}

.navbar-links {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.navbar-links a,
.classic-link {
  color: #334155;
  text-decoration: none;
  font-weight: 800;
  font-size: 0.88rem;
  padding: 0.5rem 0.7rem;
  border-radius: 999px;
}

.navbar-links a:hover,
.classic-link:hover {
  color: var(--primary);
  background: #eff6ff;
}

.classic-link {
  border: 1px solid var(--border);
  background: white;
}

.loading-state,
.error-state {
  text-align: center;
  padding: 4rem 1rem;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(300px, 0.88fr);
  gap: clamp(1rem, 4vw, 3rem);
  align-items: center;
  padding: clamp(2rem, 6vw, 4.5rem) clamp(1rem, 4vw, 3.5rem) 1.5rem;
}

.hero-copy {
  max-width: 760px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: #0f766e;
  background: rgba(20, 184, 166, 0.12);
  border: 1px solid rgba(20, 184, 166, 0.24);
  border-radius: 999px;
  padding: 0.42rem 0.72rem;
  font-size: 0.82rem;
  font-weight: 900;
  margin-bottom: 1rem;
}

.hero h1 {
  font-size: clamp(2.1rem, 5vw, 5rem);
  line-height: 0.98;
  letter-spacing: 0;
  max-width: 850px;
}

.hero p {
  color: #475569;
  font-size: clamp(1rem, 2vw, 1.22rem);
  max-width: 680px;
  margin-top: 1rem;
}

.hero-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.hero-panel {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(148, 163, 184, 0.25);
  box-shadow: var(--shadow);
  border-radius: 8px;
  padding: 1rem;
}

.raffle-banner {
  width: 100%;
  aspect-ratio: 16 / 10;
  max-height: 340px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}

.hero-panel-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
  margin-top: 0.9rem;
}

.container {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1rem 0 3rem;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.info-item {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 8px;
  padding: 1rem;
  min-height: 96px;
}

.info-item .value {
  color: #0f172a;
  font-size: clamp(1.35rem, 2vw, 2rem);
  line-height: 1.05;
  font-weight: 950;
}

.info-item .label {
  color: var(--gray);
  font-size: 0.78rem;
  font-weight: 800;
  margin-top: 0.3rem;
  text-transform: uppercase;
}

.card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: clamp(1rem, 2vw, 1.5rem);
  margin-bottom: 1rem;
}

.progress-card {
  display: grid;
  gap: 0.7rem;
}

.progress-card-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-weight: 900;
}

.progress { height: 12px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, #16a34a, #2563eb); border-radius: 999px; transition: width 0.5s; }

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(310px, 0.48fr);
  gap: 1rem;
  align-items: start;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tab-btn {
  min-height: 48px;
  padding: 0.65rem;
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  color: #475569;
  font-weight: 900;
  transition: all 0.2s;
}

.tab-btn:hover,
.tab-btn.active {
  color: white;
  border-color: var(--primary);
  background: var(--primary);
}

.tab-pane { display: none; }
.tab-pane.active { display: block; }

.section-title {
  font-size: 1.22rem;
  font-weight: 950;
  margin-bottom: 1rem;
}

.form-group { margin-bottom: 1rem; }
.form-label { display: block; color: #334155; font-size: 0.9rem; font-weight: 850; margin-bottom: 0.38rem; }

.form-control {
  width: 100%;
  min-height: 46px;
  padding: 0.72rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
  color: #111827;
  font-size: 0.98rem;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 44px;
  padding: 0.7rem 1.05rem;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 900;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}

.btn:hover { transform: translateY(-1px); }
.btn-primary { color: white; background: var(--primary); box-shadow: 0 12px 28px rgba(37, 99, 235, 0.24); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { color: var(--primary); background: white; border-color: #bfdbfe; }
.btn-outline:hover { background: #eff6ff; }
.btn-lg { min-height: 52px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.total-amount {
  color: #0f766e;
  text-align: center;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 950;
  margin: 1rem 0;
}

.student-selected {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.6rem;
  padding: 0.85rem;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
}

.autocomplete-wrapper { position: relative; }
.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 240px;
  overflow-y: auto;
  z-index: 30;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.autocomplete-item {
  padding: 0.75rem 0.9rem;
  cursor: pointer;
  border-bottom: 1px solid #eef2f7;
}

.autocomplete-item:hover { background: #eff6ff; }

.alert {
  padding: 0.9rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-weight: 850;
}
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

.pix-box {
  text-align: center;
  background: linear-gradient(180deg, #eff6ff, white);
  border-color: #bfdbfe;
}

.pix-qr {
  width: min(230px, 80vw);
  margin: 1rem auto;
  border-radius: 8px;
  border: 8px solid white;
  box-shadow: var(--shadow);
}

.pix-code {
  background: #f8fafc;
  border: 1px dashed #94a3b8;
  border-radius: 8px;
  padding: 0.85rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  word-break: break-all;
  text-align: left;
  margin: 1rem 0;
}

.copy-btn {
  cursor: pointer;
  background: #0f766e;
  color: white;
  border: 0;
  border-radius: 8px;
  padding: 0.72rem 1rem;
  font-weight: 900;
}
.copy-btn.copied { background: var(--success); }

.number-grid { display: flex; flex-wrap: wrap; gap: 0.45rem; justify-content: center; margin-top: 1rem; }
.number-chip {
  color: #1d4ed8;
  background: #dbeafe;
  border: 1px solid #93c5fd;
  border-radius: 8px;
  padding: 0.42rem 0.7rem;
  font-weight: 950;
}

.prize-card,
.ranking-item {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.9rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  margin-bottom: 0.65rem;
}

.prize-position {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #92400e;
  background: #fef3c7;
  font-weight: 950;
  flex: 0 0 auto;
}

.rank-position { min-width: 42px; color: var(--primary); font-size: 1.3rem; font-weight: 950; }
.rank-info { flex: 1; min-width: 0; }
.rank-name { font-weight: 950; }
.rank-class { color: var(--gray); font-size: 0.86rem; }
.rank-count { color: #0f766e; font-size: 1rem; font-weight: 950; white-space: nowrap; }
.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  background: #0f766e;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 900;
}

.quick-card {
  position: sticky;
  top: 5.6rem;
}

.quick-card h3 { font-size: 1rem; margin-bottom: 0.55rem; }
.quick-card p { color: var(--gray); font-size: 0.9rem; margin-bottom: 0.75rem; }

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #dbe3ee;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 2rem auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .hero,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .quick-card {
    position: static;
  }

  .info-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .modern-nav {
    align-items: flex-start;
    flex-direction: column;
  }

  .navbar-links {
    width: 100%;
    justify-content: flex-start;
  }

  .tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero {
    padding-top: 1.5rem;
  }

  .hero-actions .btn {
    width: 100%;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }
}
