:root {
  --ice: #dff5ff;
  --ice-deep: #147a9f;
  --ice-dark: #0b4056;
  --andes: #e78a55;
  --andes-deep: #9f3f27;
  --ink: #183039;
  --muted: #62757b;
  --paper: rgba(255,255,255,.94);
  --good: #16734b;
  --bad: #a52d2d;
  --shadow: 0 18px 50px rgba(11,49,63,.18);
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 12%, rgba(255,255,255,.82) 0 2px, transparent 3px),
    radial-gradient(circle at 82% 17%, rgba(255,255,255,.55) 0 2px, transparent 3px),
    linear-gradient(118deg, #cfefff 0%, #e9f9ff 44%, #f4d6ae 56%, #cf6845 100%);
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .14;
  background:
    repeating-radial-gradient(ellipse at 15% 45%, transparent 0 24px, #0b607a 25px 26px, transparent 27px 42px),
    repeating-radial-gradient(ellipse at 88% 58%, transparent 0 28px, #74321f 29px 30px, transparent 31px 49px);
  mix-blend-mode: multiply;
}

header {
  position: relative;
  overflow: hidden;
  color: white;
  text-align: center;
  padding: 28px 16px 24px;
  background: linear-gradient(110deg, rgba(10,83,111,.97) 0 49.5%, rgba(157,60,35,.97) 50.5% 100%);
  box-shadow: 0 4px 18px rgba(0,0,0,.2);
}

header h1 {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: clamp(1.8rem, 5vw, 3rem);
  letter-spacing: .02em;
  text-shadow: 0 2px 8px rgba(0,0,0,.28);
}

header p {
  position: relative;
  z-index: 1;
  margin: 7px 0 0;
  opacity: .92;
  font-weight: 700;
}

.site-nav {
  position: relative;
  z-index: 3;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 10px 12px;
  background: rgba(9,50,65,.94);
  box-shadow: 0 3px 10px rgba(0,0,0,.16);
}

.site-nav a {
  color: white;
  text-decoration: none;
  font-size: .9rem;
  font-weight: 800;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.11);
  border: 1px solid rgba(255,255,255,.12);
}

.site-nav a:hover,
.site-nav a.active {
  background: rgba(255,255,255,.23);
}

.wrap {
  position: relative;
  z-index: 1;
  width: min(900px, calc(100% - 24px));
  margin: 24px auto 48px;
}

.card {
  background: var(--paper);
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: clamp(18px, 4vw, 30px);
  backdrop-filter: blur(8px);
}

.card + .card { margin-top: 16px; }

.hero {
  text-align: center;
  padding: clamp(22px, 5vw, 44px);
}

.hero h2 {
  margin: 0 0 12px;
  font-size: clamp(1.45rem, 4vw, 2.15rem);
}

.hero p {
  max-width: 700px;
  margin: 0 auto;
  line-height: 1.55;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 24px;
}

.big-link {
  min-height: 132px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 18px;
  text-decoration: none;
  color: white;
  border-radius: 18px;
  text-align: center;
  font-weight: 900;
  box-shadow: 0 9px 22px rgba(0,0,0,.14);
  transition: transform .18s ease, filter .18s ease;
}

.big-link:hover { transform: translateY(-3px); filter: brightness(1.06); }
.big-link .icon { font-size: 2.3rem; line-height: 1; }
.big-link .small { font-size: .82rem; opacity: .88; font-weight: 700; }

.big-link.quiz { background: linear-gradient(135deg, var(--andes-deep), var(--andes), #e8b56f); }
.big-link.highscore { background: linear-gradient(135deg, #8b4aaf, #5a6eb8, #3e95a8); }
.big-link.stats { background: linear-gradient(135deg, var(--ice-deep), #4b9eae, #6e82a8); }
.big-link.faq { background: linear-gradient(135deg, #3c626e, #2b8a76, #8a9f4d); }

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-title h2 { margin: 0; }
.section-title span { color: var(--muted); font-size: .85rem; }

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}

.info-box {
  padding: 15px;
  border-radius: 15px;
  line-height: 1.5;
}

.info-box.ice { background: linear-gradient(135deg, #eafaff, #c9eaf5); }
.info-box.andes { background: linear-gradient(135deg, #fce8cc, #efb38d); }

.muted { color: var(--muted); }

.table-wrap {
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid #dce5e8;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(255,255,255,.78);
  min-width: 640px;
}

th, td {
  padding: 10px 11px;
  border-bottom: 1px solid #e2eaec;
  text-align: left;
  vertical-align: middle;
}

th {
  background: #edf4f6;
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .03em;
}

tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #f8fbfc; }

.rank {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e8f0f2;
  font-weight: 900;
}

.rank.gold { background: #f6e5a8; }
.rank.silver { background: #e3e5e8; }
.rank.bronze { background: #e6c1a7; }

.score { font-weight: 900; font-variant-numeric: tabular-nums; }
.score.positive { color: var(--good); }
.score.negative { color: var(--bad); }

.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 16px 0 20px;
}

.stat-card {
  text-align: center;
  padding: 15px 10px;
  border-radius: 15px;
  background: #edf5f7;
}

.stat-card .number { font-size: 1.6rem; font-weight: 900; }
.stat-card .label { margin-top: 3px; color: var(--muted); font-size: .79rem; font-weight: 700; }

.notice {
  padding: 13px 15px;
  border-left: 5px solid var(--ice-deep);
  border-radius: 7px;
  background: #eef8fb;
  line-height: 1.5;
}

.error {
  padding: 16px;
  border-radius: 14px;
  background: #fff0eb;
  border: 1px solid #e9b7a8;
  color: #7f2f22;
  font-weight: 800;
}

.faq-item {
  padding: 14px 0;
  border-bottom: 1px solid #e0e8ea;
}

.faq-item:last-child { border-bottom: 0; }
.faq-item h3 { margin: 0 0 7px; font-size: 1.02rem; }
.faq-item p, .faq-item li { line-height: 1.55; }

.math-box {
  padding: 14px;
  border-radius: 13px;
  background: #f3f7f8;
  border: 1px solid #dce5e8;
  font-family: Georgia, serif;
  line-height: 1.55;
}

.footer {
  text-align: center;
  margin-top: 20px;
  color: rgba(255,255,255,.92);
  font-size: .84rem;
}

.footer a { color: white; }

@media (max-width: 700px) {
  .choice-grid { grid-template-columns: 1fr 1fr; }
  .stat-cards { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 520px) {
  header { padding-top: 22px; }
  header h1 { font-size: 1.7rem; }
  .wrap { width: min(100% - 14px, 900px); margin-top: 11px; }
  .card { border-radius: 17px; padding: 15px; }
  .choice-grid, .info-grid { grid-template-columns: 1fr; }
  .site-nav { gap: 5px; padding: 8px 6px; }
  .site-nav a { font-size: .78rem; padding: 7px 9px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .big-link { transition: none; }
}
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 4px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
}

.site-nav .lang-link {
  min-width: 38px;
  text-align: center;
  font-size: 1.08rem;
  line-height: 1;
  padding: 6px 8px;
  background: transparent;
  border: 0;
}

.site-nav .lang-link.selected {
  background: rgba(255,255,255,.22);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.14);
}

.site-nav .lang-link:hover {
  background: rgba(255,255,255,.16);
}
