/* ── Design tokens ── */
:root {
  --bg:            #c7ebff;
  --bg-soft:       #d8f1ff;
  --surface:       rgba(255, 255, 255, 0.58);
  --surface-hover: rgba(255, 255, 255, 0.78);
  --text:          #06263d;
  --muted:         #3f6f8f;
  --line:          rgba(6, 38, 61, 0.08);
  --primary:       #2f9fe8;
  --primary-dark:  #1f86cc;
  --primary-soft:  rgba(47, 159, 232, 0.12);
  --nav-bg:        #06263d;
  --shadow-sm:     0 4px 16px rgba(16, 79, 120, 0.07);
  --shadow-md:     0 8px 28px rgba(16, 79, 120, 0.12);
  --shadow-lg:     0 20px 50px rgba(16, 79, 120, 0.12);
  --radius-lg:     18px;
  --radius-xl:     28px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  background: #bfe7fb;
}

html, body {
  margin: 0;
  padding: 0;
  color: var(--text);
  font-family: "Source Sans 3", "Nunito", sans-serif;
}

body {
  min-height: 100vh;
  background: linear-gradient(to bottom, #bfe7fb 0%, #d8f2ff 100%);
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ── Page shell ── */
.page-shell {
  width: calc(100% - 24px);
  max-width: 1840px;
  min-height: calc(100vh - 24px);
  margin: 12px auto;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.38) 0, rgba(255, 255, 255, 0) 28%),
    linear-gradient(to bottom, var(--bg-soft) 0%, var(--bg) 100%);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}

/* Soft cloud blobs — hidden on game views */
.page-shell::before,
.page-shell::after {
  content: "";
  position: absolute;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  pointer-events: none;
}

.page-shell:has(.game)::before,
.page-shell:has(.game)::after { display: none; }

.page-shell::before {
  width: 420px;
  height: 120px;
  top: 100px;
  left: -80px;
}

.page-shell::after {
  width: 520px;
  height: 140px;
  top: 130px;
  right: -60px;
}

/* ── Header ── */
.site-header {
  height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 56px;
  padding-top: env(safe-area-inset-top);
  background: var(--nav-bg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
  z-index: 10;
}

.logo-wrap {
  display: flex;
  align-items: center;
  min-width: 180px;
  flex: 1;
}

.logo-full {
  height: 44px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  display: block;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 40px;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.main-nav a {
  font-size: 1rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.88);
  position: relative;
  transition: color 0.15s;
}

.main-nav a::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary);
  border-radius: 2px;
  transition: width 0.2s ease;
}

.main-nav a:hover { color: #fff; }
.main-nav a:hover::after,
.main-nav a[aria-current]::after { width: 100%; }

.header-actions {
  display: flex;
  align-items: stretch;
  gap: 14px;
  min-width: 180px;
  justify-content: flex-end;
  flex: 1;
}

.download-btn {
  display: inline-flex;
  align-items: center;
  background: var(--primary);
  color: #fff;
  padding: 0 24px;
  border-radius: 18px;
  font-size: 1rem;
  font-weight: 700;
  font-family: "Source Sans 3", "Nunito", sans-serif;
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(47, 159, 232, 0.25);
  transition: background 0.2s, transform 0.2s;
  white-space: nowrap;
}

.download-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

/* ── Lang dropdown ── */
.lang { position: relative; }

.lang-trigger {
  height: 54px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: "Source Sans 3", "Nunito", sans-serif;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  white-space: nowrap;
  outline: none;
}

.lang-trigger:hover {
  border-color: rgba(47, 159, 232, 0.8);
  background: rgba(255, 255, 255, 0.14);
}

.lang-trigger[aria-expanded="true"] {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 159, 232, 0.18);
  background: rgba(255, 255, 255, 0.14);
}

.lang-flag {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.lang-label { min-width: 76px; }

.lang-caret {
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4.5px solid currentColor;
  opacity: 0.7;
  transition: transform 0.2s;
}

.lang-trigger[aria-expanded="true"] .lang-caret {
  transform: rotate(180deg);
}

.lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 164px;
  padding: 6px;
  background: var(--nav-bg);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 100;
  opacity: 0;
  transform: translateY(-8px) scale(0.96);
  transform-origin: top right;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}

.lang-menu.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  visibility: visible;
}

.lang-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.92rem;
  font-weight: 600;
  font-family: "Source Sans 3", "Nunito", sans-serif;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.lang-item:hover,
.lang-item.active {
  background: rgba(47, 159, 232, 0.18);
  color: #fff;
}

/* ── Footer ── */
.site-footer {
  background: #1f1f21;
  color: rgba(255, 255, 255, 0.88);
}

.footer-skyline {
  line-height: 0;
  overflow: hidden;
}

.footer-skyline img {
  width: 100%;
  height: auto;
  display: block;
}

.footer-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 56px 48px 28px;
}

.footer-top {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 56px;
  align-items: start;
}

.footer-brand .logo-text {
  font-size: 1.8rem;
  font-weight: 900;
  color: #fff;
  margin-bottom: 14px;
  font-family: "Nunito", sans-serif;
}

.footer-desc {
  font-size: 0.95rem;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.55);
  margin: 0 0 24px;
  max-width: 300px;
  font-weight: 600;
}

.footer-badges .store-badge {
  height: 40px;
  width: auto;
}

.footer-heading {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  margin-bottom: 18px;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links li { margin-bottom: 12px; }

.footer-links a {
  font-size: 0.93rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.6);
  transition: color 0.2s;
}

.footer-links a:hover { color: #fff; }

.footer-bottom {
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.38);
  text-align: center;
}

/* ── Responsive ── */
@media (max-width: 840px) {
  .site-header { padding: 0 20px; height: 64px; }
  .footer-wrap { padding: 40px 24px 20px; }
  .footer-top { grid-template-columns: 1fr; gap: 32px; }
  .footer-desc { max-width: 100%; }
}

@media (max-width: 640px) {
  .logo-full { height: 28px; }
  .game-wrap, .listen-wrap { padding: 20px 12px 60px; }
  .game-card, .listen-card { padding: 24px 20px; border-radius: 16px; }
  .game-title, .listen-title { font-size: 1.3rem; margin: 0 0 18px; }
  .nav-btn { padding: 10px 18px; font-size: 0.88rem; }
}

@media (max-width: 480px) {
  .lang-label { display: none; }
}

@media (max-width: 640px) {
  .page-shell { width: 100%; margin: 0; border-radius: 0; min-height: 100vh; border: none; }
}

/* ── Game shared ── */
body { background: linear-gradient(to bottom, #bfe7fb 0%, #d8f2ff 100%); min-height: 100vh; }

.game-wrap, .listen-wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

.game-card, .listen-card {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 24px;
  box-shadow: 0 8px 28px rgba(16, 79, 120, 0.1);
  padding: 40px;
}

.game-title, .listen-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 24px;
  font-family: "Nunito", sans-serif;
  letter-spacing: -0.03em;
  text-align: center;
  width: 100%;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.toolbar-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.trans-pills {
  display: flex;
  gap: 4px;
  background: rgba(6, 38, 61, 0.06);
  border-radius: 999px;
  padding: 3px;
}

.trans-pill {
  padding: 5px 14px;
  border-radius: 999px;
  border: none;
  background: transparent;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  font-family: "Nunito", sans-serif;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
  letter-spacing: 0.03em;
}

.trans-pill:hover {
  color: var(--text);
}

.trans-pill--active {
  background: #ffffff;
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.10);
}


/* ── Report button (desktop only) ── */
.report-btn {
  position: fixed;
  bottom: 28px;
  left: 28px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(6, 38, 61, 0.1);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  font-family: "Nunito", sans-serif;
  text-decoration: none;
  box-shadow: 0 4px 16px rgba(6, 38, 61, 0.1);
  backdrop-filter: blur(8px);
  transition: background 0.15s, color 0.15s, transform 0.15s, box-shadow 0.15s;
  z-index: 50;
}

.report-btn:hover {
  background: #fff;
  color: var(--text);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(6, 38, 61, 0.14);
}

@media (max-width: 840px) {
  .report-btn { display: none; }
}

/* ── Report modal ── */
.report-modal {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: flex-end; justify-content: flex-start;
  padding: 0 0 88px 28px;
  pointer-events: none;
}

.report-modal[aria-hidden="true"] { display: none; }

.report-modal__card {
  pointer-events: all;
  background: #fff;
  border: 1px solid rgba(6, 38, 61, 0.1);
  border-radius: 20px;
  padding: 24px;
  width: 320px;
  box-shadow: 0 12px 48px rgba(6, 38, 61, 0.16);
}

.report-modal__title {
  font-size: 1rem;
  font-weight: 900;
  color: var(--text);
  font-family: "Nunito", sans-serif;
  margin: 0 0 4px;
}

.report-modal__sub {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  font-family: "Source Sans 3", sans-serif;
  margin: 0 0 16px;
}

.report-modal__label {
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  font-family: "Source Sans 3", sans-serif;
  margin-bottom: 6px;
}

.report-modal__select,
.report-modal__textarea {
  width: 100%;
  border: 1.5px solid rgba(6, 38, 61, 0.12);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: "Source Sans 3", sans-serif;
  color: var(--text);
  background: rgba(47, 159, 232, 0.04);
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.15s;
  margin-bottom: 14px;
}

.report-modal__select:focus,
.report-modal__textarea:focus { border-color: var(--primary); }

.report-modal__textarea {
  resize: none;
  height: 90px;
  line-height: 1.55;
}

.report-modal__actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.report-modal__cancel {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  border: 1.5px solid rgba(6, 38, 61, 0.12);
  background: transparent;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
  font-family: "Nunito", sans-serif;
  cursor: pointer;
}

.report-modal__submit {
  flex: 2;
  padding: 10px;
  border-radius: 10px;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 800;
  font-family: "Nunito", sans-serif;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(47, 159, 232, 0.3);
  transition: background 0.15s;
}

.report-modal__submit:hover { background: var(--primary-dark); }

.progress-row {
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.progress-track {
  flex: 1;
  height: 14px;
  border-radius: 999px;
  background: rgba(47, 159, 232, 0.12);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--primary);
  width: 0%;
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 2px 8px rgba(47, 159, 232, 0.35);
}
.progress-meta {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--primary);
  white-space: nowrap;
  font-family: "Nunito", sans-serif;
}

.pager { display: flex; gap: 8px; justify-content: center; margin: 24px 0; flex-wrap: wrap; }
.dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: rgba(6, 38, 61, 0.15); border: none; cursor: pointer;
  padding: 0; transition: background 0.2s, transform 0.2s;
}
.dot--active  { background: var(--primary); transform: scale(1.3); }
.dot--correct { background: #34c989; }
.dot--wrong   { background: #f05c5c; }

.footer-actions, .nav {
  display: flex; gap: 12px; justify-content: space-between; margin-top: 24px;
}
.nav-btn {
  padding: 12px 24px; border-radius: 14px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8); color: var(--text);
  font-size: 0.95rem; font-weight: 700; font-family: "Nunito", sans-serif;
  cursor: pointer; transition: background 0.15s, transform 0.15s;
}
.nav-btn:hover:not(:disabled) { background: #fff; transform: translateY(-1px); }
.nav-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.nav-btn--primary {
  background: var(--primary); color: #fff; border-color: transparent;
  box-shadow: 0 4px 14px rgba(47, 159, 232, 0.3);
}
.nav-btn--primary:hover:not(:disabled) { background: var(--primary-dark); }

.score-modal {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
}
.score-modal[aria-hidden="true"] { display: none; }
.score-backdrop { position: absolute; inset: 0; background: rgba(6, 38, 61, 0.45); backdrop-filter: blur(6px); }
.score-card {
  position: relative;
  z-index: 1;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 28px;
  padding: 44px 40px 36px;
  text-align: center;
  box-shadow: 0 32px 80px rgba(6, 38, 61, 0.18);
  width: 100%;
  max-width: 380px;
  margin: 0 20px;
}
.score-title {
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--text);
  margin: 0 0 10px;
  font-family: "Nunito", sans-serif;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.score-meta {
  font-size: 1rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 32px;
  line-height: 1.6;
  font-family: "Source Sans 3", sans-serif;
}
.score-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.score-actions .nav-btn { width: 100%; justify-content: center; }
