@font-face {
  font-family: Manrope;
  src: url('../assets/fonts/manrope-latin-wght-normal.woff2') format('woff2');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --green-deep: #082a1f;
  --green: #0b3d2c;
  --green-mid: #126b4a;
  --lemon: #ffd93b;
  --lemon-soft: #fff2a8;
  --text: #f6fbf8;
  --muted: rgba(246, 251, 248, 0.72);
  --glass: rgba(10, 36, 27, 0.55);
  --glass-line: rgba(255, 255, 255, 0.16);
  --radius: 22px;
  --font: Manrope, ui-rounded, 'SF Pro Rounded', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--green-deep);
  overflow: hidden;
  overscroll-behavior: none;
}
[hidden] { display: none !important; }

/* Full-screen background: the learner's photo, or a deep green gradient. */
#bg {
  position: fixed; inset: 0;
  background: radial-gradient(120% 80% at 50% 0%, var(--green-mid) 0%, var(--green) 45%, var(--green-deep) 100%);
  background-size: cover;
  background-position: center;
  transition: opacity 0.4s ease;
}
/* Dark gradient from below keeps text readable on any photo. */
#shade {
  position: fixed; inset: 0; pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(4, 20, 14, 0.55) 0%, rgba(4, 20, 14, 0) 22%),
    linear-gradient(to top, rgba(4, 20, 14, 0.88) 0%, rgba(4, 20, 14, 0.55) 30%, rgba(4, 20, 14, 0) 62%);
}

#app { position: fixed; inset: 0; }
.view {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  padding: max(16px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom));
  animation: fade-in 0.45s ease both;
}
@keyframes fade-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.glass {
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid var(--glass-line);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

/* Buttons */
.btn {
  font: inherit; font-weight: 700; color: var(--text);
  border: 0; border-radius: 18px; padding: 15px 20px;
  cursor: pointer; line-height: 1.2;
  transition: transform 0.15s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.btn:active { transform: scale(0.97); }
.btn:focus-visible, .field:focus-visible, .lang-btn:focus-visible { outline: 3px solid var(--lemon); outline-offset: 2px; }
.btn-primary { background: linear-gradient(135deg, var(--lemon) 0%, #ffc400 100%); color: #1a2a00; box-shadow: 0 8px 24px rgba(255, 217, 59, 0.35); }
.btn-ghost { background: rgba(255, 255, 255, 0.12); border: 1px solid var(--glass-line); width: 100%; }
.btn-quiet { background: transparent; color: var(--muted); }
.btn-glass {
  background: rgba(10, 36, 27, 0.6);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--glass-line);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  flex: 1; min-height: 64px; font-size: 0.98rem; overflow-wrap: anywhere; hyphens: auto;
}

/* Onboarding */
#view-onboarding { justify-content: center; }
.ob-card {
  border-radius: 28px; padding: 28px 22px 20px;
  width: 100%; max-width: 460px; margin: 0 auto;
  max-height: 100%; overflow-y: auto;
}
.step { display: none; flex-direction: column; gap: 14px; min-height: 300px; }
.step.active { display: flex; animation: fade-in 0.35s ease both; }
.step h1 { margin: 0; font-size: 1.65rem; line-height: 1.2; letter-spacing: -0.01em; }
.step p { margin: 0; line-height: 1.55; }
.muted { color: var(--muted); }
.note { background: rgba(255, 255, 255, 0.08); border: 1px solid var(--glass-line); border-radius: 16px; padding: 14px 16px; }
.error { color: #ffb4a8; }
.logo-dot { width: 56px; height: 56px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, var(--lemon-soft), var(--lemon) 55%, #e0a800); box-shadow: 0 8px 30px rgba(255, 217, 59, 0.45); }

.field {
  width: 100%; font: inherit; color: var(--text);
  background: rgba(255, 255, 255, 0.1); border: 1px solid var(--glass-line);
  border-radius: 16px; padding: 14px 16px; resize: none;
}
.field::placeholder { color: rgba(246, 251, 248, 0.45); }

.lang-list { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.lang-btn {
  font: inherit; font-weight: 700; font-size: 1.1rem; color: var(--text); text-align: left;
  background: rgba(255, 255, 255, 0.1); border: 1px solid var(--glass-line);
  border-radius: 16px; padding: 16px 18px; cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.lang-btn[aria-pressed="true"] { background: rgba(255, 217, 59, 0.18); border-color: var(--lemon); }

.ob-nav { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; gap: 8px; }
.dots { display: flex; gap: 6px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, 0.25); transition: all 0.25s ease; }
.dots i.on { background: var(--lemon); width: 20px; border-radius: 4px; }

/* Home */
#view-home { justify-content: space-between; }
.home-bottom { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 520px; margin: 0 auto; }
.motto {
  margin: 0 4px 2px; text-align: center;
  font-size: 1.35rem; font-weight: 700; line-height: 1.3; letter-spacing: -0.01em;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.6);
  overflow-wrap: anywhere;
}
.counter {
  background: linear-gradient(135deg, var(--lemon) 0%, #ffc400 100%);
  color: #1a2a00;
  font-size: 3.4rem; font-weight: 800; letter-spacing: -0.02em;
  border-radius: 26px; padding: 14px 20px; min-height: 96px;
  box-shadow: 0 14px 40px rgba(255, 196, 0, 0.35), inset 0 2px 0 rgba(255, 255, 255, 0.5);
  font-variant-numeric: tabular-nums;
}
.counter .hint { font-size: 1.2rem; font-weight: 800; letter-spacing: 0; line-height: 1.25; display: block; }
.counter-sub { display: block; margin-top: 2px; font-size: 0.82rem; font-weight: 700; letter-spacing: 0.01em; opacity: 0.75; }
.row { display: flex; gap: 12px; }

/* Menu and settings */
.home-top { position: relative; display: flex; justify-content: flex-end; }
.menu-btn { width: 46px; height: 46px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; cursor: pointer; padding: 0; }
.menu-btn span { width: 18px; height: 2px; border-radius: 2px; background: var(--text); }
.menu { position: absolute; top: 54px; right: 0; border-radius: 18px; padding: 6px; min-width: 190px; z-index: 3; animation: fade-in 0.2s ease both; }
.menu-btn, .menu { background: rgba(6, 26, 19, 0.82); }
.menu-item { display: block; width: 100%; font: inherit; font-weight: 700; color: var(--text); background: transparent; border: 0; text-align: left; padding: 12px 14px; border-radius: 12px; cursor: pointer; }
.menu-item:hover, .menu-item:focus-visible { background: rgba(255, 255, 255, 0.12); outline: none; }
#view-settings, #view-hof, #view-legal { z-index: 4; justify-content: center; background: rgba(4, 20, 14, 0.9); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.settings-wrap { width: 100%; max-width: 480px; margin: 0 auto; border-radius: 28px; padding: 24px 20px 20px; max-height: 100%; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; }
.settings-wrap { background: rgba(7, 30, 22, 0.96); }
.settings-wrap h1 { margin: 0; font-size: 1.6rem; }
.set-group { display: flex; flex-direction: column; gap: 8px; }
.set-label { margin: 0; color: var(--muted); font-size: 0.9rem; font-weight: 700; }
.settings-wrap .lang-btn { padding: 12px 16px; font-size: 1rem; }
.legal-body { display: flex; flex-direction: column; gap: 6px; line-height: 1.55; font-size: 0.95rem; }
.legal-body h2 { margin: 16px 0 2px; font-size: 1.05rem; color: var(--lemon); }
.legal-body p { margin: 0 0 6px; overflow-wrap: anywhere; }
.legal-body a { color: var(--lemon); }
.splash-hi { margin: 0; color: var(--muted); font-size: 1.1rem; font-weight: 700; }

/* Badges */
.medal { width: 100%; height: auto; display: block; filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.4)); }
.medal-ring { fill: url(#g-ring); }
.medal-face { fill: url(#g-face); }
.medal-shine { fill: rgba(255, 255, 255, 0.16); }
.medal-num { fill: var(--lemon); font-family: var(--font); font-weight: 800; }
.medal.locked { filter: grayscale(1) brightness(0.7); opacity: 0.55; }
.medal.locked .medal-ring { fill: url(#g-ring-locked); }
.medal.locked .medal-num { fill: #9aa5a0; }
.hof-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.hof-item { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 14px 8px; border-radius: 18px; background: rgba(255, 255, 255, 0.07); border: 1px solid var(--glass-line); }
.hof-item .medal { width: 84px; }
.hof-item strong { font-size: 0.95rem; }
.hof-item small { color: var(--muted); }
.hof-item.is-locked strong { color: var(--muted); }
#view-badge { z-index: 6; align-items: center; justify-content: center; text-align: center; background: rgba(2, 14, 9, 0.8); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.badge-inner { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 24px; max-width: 460px; }
.badge-rays { position: absolute; top: -70px; width: 360px; height: 360px; border-radius: 50%; background: repeating-conic-gradient(rgba(255, 217, 59, 0.2) 0deg 8deg, transparent 8deg 24deg); -webkit-mask-image: radial-gradient(circle, #000 25%, transparent 70%); mask-image: radial-gradient(circle, #000 25%, transparent 70%); animation: spin 14s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.badge-medal { position: relative; width: 200px; animation: medal-in 0.9s cubic-bezier(.2, 1.5, .4, 1) both; }
.badge-medal .medal { filter: drop-shadow(0 0 40px rgba(255, 217, 59, 0.6)); }
@keyframes medal-in { from { opacity: 0; transform: scale(0.3) rotate(-25deg); } to { opacity: 1; transform: none; } }
.badge-kicker { position: relative; margin: 14px 0 0; color: var(--lemon); font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.85rem; }
.badge-inner h1 { position: relative; margin: 0; font-size: 2rem; }
.badge-inner p, .badge-inner button { position: relative; }
.badge-inner button { margin-top: 18px; min-width: 170px; }

/* Convictions */
#view-conviction { z-index: 4; justify-content: center; background: rgba(4, 20, 14, 0.5); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.conv-wrap { width: 100%; max-width: 480px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; max-height: 100%; overflow-y: auto; }
.conv-panel { display: flex; flex-direction: column; gap: 14px; }
.conv-panel h1 { margin: 0 0 4px; font-size: 1.6rem; line-height: 1.2; }
.conv-choice { font: inherit; color: var(--text); text-align: left; border-radius: 22px; padding: 20px; cursor: pointer; display: flex; flex-direction: column; gap: 6px; transition: transform 0.15s ease, border-color 0.2s ease; }
.conv-choice:active { transform: scale(0.98); }
.conv-choice strong { font-size: 1.2rem; }
.conv-kind { margin: 0; color: var(--lemon); font-weight: 700; letter-spacing: 0.02em; }
.conv-text { margin: 0; border-radius: 24px; padding: 24px 22px; font-size: 1.25rem; line-height: 1.5; font-weight: 600; animation: fade-in 0.35s ease both; overflow-wrap: anywhere; }
.conv-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; }

/* Splash */
#view-splash { align-items: center; justify-content: center; text-align: center; background: rgba(4, 20, 14, 0.62); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); z-index: 5; cursor: pointer; transition: opacity 0.5s ease; }
#view-splash.leaving { opacity: 0; }
.splash-inner { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 0 24px; max-width: 520px; }
.splash-number { font-size: clamp(6rem, 32vw, 10rem); font-weight: 800; line-height: 1; letter-spacing: -0.04em; color: var(--lemon); text-shadow: 0 0 60px rgba(255, 217, 59, 0.45); font-variant-numeric: tabular-nums; animation: pop 0.8s cubic-bezier(.2, 1.4, .4, 1) both; }
.splash-text { margin: 0; font-size: 1.3rem; font-weight: 700; line-height: 1.35; }
@keyframes pop { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: none; } }

/* Dialog */
.dlg { color: var(--text); border-radius: 26px; padding: 24px 22px 18px; width: min(92vw, 420px); }
.dlg::backdrop { background: rgba(2, 12, 8, 0.7); backdrop-filter: blur(4px); }
.dlg h2 { margin: 0 0 8px; font-size: 1.35rem; }
.dlg p { margin: 0 0 14px; line-height: 1.5; }
.dlg label { display: block; margin-bottom: 6px; font-size: 0.9rem; }
.dlg .note { margin-bottom: 12px; }
.dlg { max-height: 90vh; overflow-y: auto; }
.howto-toggle { border-radius: 16px; background: rgba(255, 255, 255, 0.08); border: 1px solid var(--glass-line); padding: 0 16px; }
.howto-toggle summary { cursor: pointer; font-weight: 800; padding: 14px 0; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--lemon); }
.howto-toggle summary::-webkit-details-marker { display: none; }
.howto-toggle summary::after { content: ''; width: 9px; height: 9px; border-right: 2.5px solid var(--lemon); border-bottom: 2.5px solid var(--lemon); transform: rotate(45deg) translateY(-2px); transition: transform 0.25s ease; flex: none; }
.howto-toggle[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
.howto-toggle[open] { padding-bottom: 14px; }
.howto-toggle .howto:first-child h3 { margin-top: 0; }
.howto { margin-top: 6px; }
.howto h3 { margin: 14px 0 8px; font-size: 1rem; color: var(--lemon); }
.howto ol { list-style: none; margin: 0; padding: 0; counter-reset: s; display: flex; flex-direction: column; gap: 10px; }
.howto li { counter-increment: s; display: flex; align-items: flex-start; gap: 12px; line-height: 1.45; }
.howto li::before { content: counter(s); flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--lemon); color: #1a2a00; font-weight: 800; font-size: 0.85rem; display: flex; align-items: center; justify-content: center; margin-top: 1px; }
.howto li span { flex: 1; }
.howto .ico { flex: none; width: 24px; height: 24px; color: var(--lemon); margin-top: 1px; }
.install-now { margin-top: 12px; }
.dlg-actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 18px; }

.counter.pulse { animation: pulse 0.45s ease; }
@keyframes pulse { 0% { transform: scale(1); } 40% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(255, 217, 59, 0.25); } 100% { transform: scale(1); } }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
