:root {
  --bg: #f6f8f6;
  --card: #ffffff;
  --primary: #0c9c5f;
  --primary-dark: #087a4a;
  --primary-soft: #e7f7ef;
  --gold: #f2b705;
  --gold-deep: #d99e00;
  --gold-soft: #fdf3d7;
  --success: #18b368;
  --danger: #e0453d;
  --text: #16271f;
  --muted: #5f7370;
  --line: #e3ebe7;
  --shadow: 0 20px 50px rgba(13, 60, 40, 0.09);
  --radius-lg: 24px;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  background:
    radial-gradient(600px 320px at 10% -5%, rgba(12, 156, 95, 0.12), transparent 60%),
    radial-gradient(700px 380px at 95% 0%, rgba(242, 183, 5, 0.10), transparent 55%),
    linear-gradient(180deg, #f2f7f3 0%, var(--bg) 100%);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img {
  max-width: 100%;
  display: block;
}

a {
  text-decoration: none;
  color: inherit;
}

button,
input,
textarea {
  font: inherit;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
}

.site-header {
  background: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(12px);
}

.nav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 74px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--primary-dark);
}

.brand-logo {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
}

.nav-links {
  display: flex;
  gap: 10px;
  align-items: center;
  font-weight: 600;
  color: var(--muted);
}

.nav-links a {
  padding: 8px 14px;
  border-radius: 999px;
  transition: background 0.16s ease, color 0.16s ease;
}

.nav-links a:hover {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.btn-link {
  background: var(--primary);
  color: #fff !important;
  border-radius: 999px;
  padding: 8px 16px !important;
}

.btn-link:hover {
  background: var(--primary-dark) !important;
  color: #fff !important;
}

.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  padding: 22px 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.page-wrap {
  padding-top: 34px;
  padding-bottom: 56px;
  flex: 1;
  width: 100%;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.hero {
  display: grid;
  grid-template-columns: 1.25fr 0.85fr;
  align-items: center;
  gap: 28px;
  padding: 44px 42px;
  overflow: hidden;
  position: relative;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -60px -80px auto;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(242, 183, 5, 0.14), transparent 65%);
}

.hero-illustration {
  display: flex;
  justify-content: center;
  align-items: center;
}

.hero-illustration svg {
  width: 100%;
  max-width: 300px;
  filter: drop-shadow(0 18px 30px rgba(13, 60, 40, 0.12));
}

.eyebrow {
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.74rem;
  font-weight: 800;
  margin: 0 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.eyebrow::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
}

h1,
h2,
h3,
h4 {
  margin-top: 0;
  letter-spacing: -0.015em;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.12;
  margin-bottom: 18px;
  color: var(--text);
}

.lead {
  color: var(--muted);
  font-size: 1.06rem;
  max-width: 640px;
  line-height: 1.6;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 26px;
}

.primary-btn,
.secondary-btn,
.small-btn,
.danger-btn,
.answer-button {
  border: none;
  border-radius: 12px;
  padding: 12px 20px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.primary-btn {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  box-shadow: 0 10px 24px rgba(12, 156, 95, 0.26);
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(12, 156, 95, 0.32);
}

.secondary-btn,
.small-btn {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.secondary-btn:hover,
.small-btn:hover {
  background: #d6efde;
  transform: translateY(-1px);
}

.danger-btn {
  background: #ffe8e4;
  color: #a02418;
}

.danger-btn:hover {
  background: #ffd9d3;
  transform: translateY(-1px);
}

.primary-btn:disabled,
.secondary-btn:disabled,
.small-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.primary-btn:disabled:hover,
.secondary-btn:disabled:hover {
  transform: none;
  box-shadow: none;
}

.feature-grid,
.results-grid,
.admin-grid {
  display: grid;
  gap: 20px;
  margin-top: 24px;
}

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

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

.feature {
  padding: 26px 24px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.feature:hover {
  transform: translateY(-4px);
  box-shadow: 0 26px 60px rgba(13, 60, 40, 0.12);
}

.icon-badge {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-soft);
  margin-bottom: 16px;
}

.icon-badge svg {
  width: 26px;
  height: 26px;
}

.feature h3 {
  margin-bottom: 10px;
  font-size: 1.12rem;
}

.feature p,
.auth-card p,
.form-card p {
  color: var(--muted);
  margin-bottom: 0;
  line-height: 1.55;
}

.auth-card,
.form-card {
  max-width: 520px;
  margin: 0 auto;
  padding: 32px;
  position: relative;
  overflow: hidden;
}

.auth-card::before,
.form-card::before {
  content: "";
  position: absolute;
  top: -70px;
  right: -70px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(12, 156, 95, 0.12), transparent 65%);
}

.auth-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.auth-head .icon-badge {
  margin-bottom: 0;
  flex: 0 0 auto;
}

.auth-head h2 {
  margin: 0;
}

.auth-form,
.question-form {
  display: grid;
  gap: 16px;
  margin-top: 20px;
}

label {
  font-weight: 700;
  color: var(--text);
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fbfdfb;
  border-radius: 12px;
  padding: 12px 14px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(12, 156, 95, 0.12);
  background: #fff;
}

textarea {
  resize: vertical;
}

.quiz-shell {
  display: grid;
  gap: 22px;
}

.quiz-header {
  padding: 24px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.quiz-header h2 {
  margin-bottom: 4px;
}

.score-box {
  background: linear-gradient(135deg, #fff7d9 0%, #ffe9a8 100%);
  border: 1px solid #f0d367;
  border-radius: 16px;
  padding: 12px 20px;
  text-align: center;
  min-width: 130px;
  position: relative;
}

.score-box span {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: #8a6d00;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.score-box strong {
  font-size: 1.9rem;
  color: #6b5400;
  background: none;
}

.quiz-progress {
  padding: 18px 28px;
  display: grid;
  gap: 10px;
}

.progress-track {
  height: 10px;
  border-radius: 999px;
  background: #edf2ee;
  overflow: hidden;
  border: 1px solid var(--line);
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), #16c46f);
  transition: width 0.3s ease;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
}

.question-card {
  padding: 28px;
  scroll-margin-top: 96px;
  transition: border-color 0.2s ease;
}

.question-card.answered {
  border-color: #cfe6d8;
}

.question-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.badge,
.coin-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 0.78rem;
  font-weight: 800;
}

.badge {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.coin-tag {
  background: var(--gold-soft);
  color: #8a6d00;
  border: 1px solid #f2d98a;
}

.coin-tag svg {
  width: 14px;
  height: 14px;
}

.question-card h3 {
  margin-bottom: 18px;
  line-height: 1.45;
}

.answer-button {
  width: 100%;
  margin-top: 12px;
  text-align: left;
  justify-content: flex-start;
  background: #f6f9f7;
  color: var(--text);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 15px 18px;
  font-weight: 600;
}

.answer-button:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--primary-soft);
  transform: translateX(2px);
}

.answer-button .answer-letter {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border-radius: 9px;
  background: #e4ede7;
  color: var(--primary-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
}

.answer-button.correct {
  background: linear-gradient(135deg, #d9f8e6 0%, #b9f1cf 100%);
  border-color: #6fdba0;
  color: #087a4a;
  animation: pop-success 0.35s ease;
}

.answer-button.correct .answer-letter {
  background: #6fdba0;
  color: #fff;
}

.answer-button.incorrect {
  background: linear-gradient(135deg, #ffe8e4 0%, #ffd9d3 100%);
  border-color: #f0a79d;
  color: #a02418;
  animation: shake 0.35s ease;
}

.answer-button.incorrect .answer-letter {
  background: #f0a79d;
  color: #fff;
}

.answer-button:disabled {
  cursor: not-allowed;
  opacity: 0.95;
}

.feedback {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 12px;
  font-weight: 700;
  animation: fadeIn 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.feedback.success {
  background: #def7e8;
  color: #117b4d;
}

.feedback.error {
  background: #ffe7e2;
  color: #ab2d23;
}

@keyframes pop-success {
  0% { transform: scale(1); }
  50% { transform: scale(1.025); }
  100% { transform: scale(1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse-gold {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.feedback.hidden,
.hidden {
  display: none !important;
}

.finish-panel {
  padding: 30px;
  text-align: center;
  background: linear-gradient(135deg, #fdf7e3 0%, #ffffff 100%);
  border: 1px dashed #e8d07a;
}

.finish-panel h3 {
  margin-bottom: 8px;
}

.finish-panel p {
  color: var(--muted);
  margin-bottom: 20px;
}

.results-grid {
  grid-template-columns: 0.9fr 1.1fr;
}

.summary-card,
.leaderboard-card {
  padding: 28px;
}

.result-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin: 20px 0;
}

.result-metrics div {
  background: linear-gradient(135deg, #f6f9f7 0%, #e9f5ee 100%);
  border-radius: 16px;
  padding: 22px;
  border: 1px solid var(--line);
  text-align: center;
}

.result-metrics span {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
  font-weight: 600;
}

.result-metrics strong {
  font-size: 2.2rem;
  color: var(--primary-dark);
}

.leaderboard-list {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.leaderboard-list li {
  display: grid;
  grid-template-columns: 54px 1.2fr 1fr auto;
  align-items: center;
  gap: 10px;
  background: #f6f9f7;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 16px;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.leaderboard-list li:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(13, 60, 40, 0.08);
}

.leaderboard-list.compact li {
  grid-template-columns: 1fr auto;
}

.rank {
  font-weight: 800;
  color: var(--primary-dark);
}

.rank.rank-1 { color: #b8860b; }
.rank.rank-2 { color: #7a8a99; }
.rank.rank-3 { color: #b56b3a; }

.medal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 800;
  color: #fff;
  flex: 0 0 auto;
}

.medal.gold { background: linear-gradient(135deg, #f2c94c, #d99e00); box-shadow: 0 4px 14px rgba(217, 158, 0, 0.4); }
.medal.silver { background: linear-gradient(135deg, #b9c4cc, #8a99a6); box-shadow: 0 4px 14px rgba(138, 153, 166, 0.4); }
.medal.bronze { background: linear-gradient(135deg, #d29062, #a9652f); box-shadow: 0 4px 14px rgba(169, 101, 47, 0.4); }

.player-name {
  font-weight: 700;
}

.player-meta,
.small-muted {
  color: var(--muted);
  font-size: 0.85rem;
}

.score-pill {
  background: var(--gold-soft);
  border: 1px solid #f2d98a;
  color: #8a6d00;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 800;
  text-align: center;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.score-pill svg {
  width: 13px;
  height: 13px;
}

.admin-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 24px 28px;
  flex-wrap: wrap;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 22px;
}

.stat-card {
  padding: 20px 22px;
  display: grid;
  gap: 4px;
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: "";
  position: absolute;
  inset: 0 0 auto auto;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(12, 156, 95, 0.1), transparent 70%);
  transform: translate(20px, -20px);
}

.stat-label {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--primary-dark);
}

.stat-sub {
  color: var(--muted);
  font-size: 0.82rem;
}

.cycle-banner {
  padding: 16px 20px;
  border-radius: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
}

.cycle-banner.active {
  background: linear-gradient(135deg, #d9f8e6, #c2f2d7);
  border: 1px solid #6fdba0;
  color: #087a4a;
}

.cycle-banner.inactive {
  background: #f3f6f4;
  border: 1px solid var(--line);
  color: var(--muted);
}

.toolbar-actions,
.row-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.question-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.question-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  background: #fafcfa;
  border-radius: 14px;
  padding: 16px;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.question-row:hover {
  border-color: #cfe6d8;
  background: #f4faf6;
}

.options-block {
  display: grid;
  gap: 12px;
  background: #f7faf8;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
}

.options-block h3 {
  margin-bottom: 6px;
}

.option-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  font-weight: 600;
  cursor: pointer;
}

.checkbox-label input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.flash-container {
  margin-bottom: 18px;
}

.flash-message {
  background: #eef8f2;
  border-left: 4px solid var(--primary);
  color: var(--text);
  padding: 13px 16px;
  border-radius: 12px;
  margin-bottom: 10px;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(13, 60, 40, 0.06);
  animation: fadeIn 0.25s ease;
}

.empty-state {
  text-align: center;
  padding: 26px 20px;
  color: var(--muted);
  background: #f7faf8;
  border: 1px dashed var(--line);
  border-radius: 14px;
}

@media (max-width: 860px) {
  .hero,
  .feature-grid,
  .results-grid,
  .admin-grid,
  .admin-stats {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 34px 26px;
  }

  .nav-bar,
  .quiz-header,
  .admin-topbar,
  .question-row {
    display: grid;
    gap: 14px;
  }

  .nav-links {
    justify-content: space-between;
    width: 100%;
  }

  .leaderboard-list li {
    grid-template-columns: 1fr 1fr;
  }

  .option-row {
    grid-template-columns: 1fr;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
    gap: 6px;
  }
}