:root {
  color-scheme: dark;
  --bg: #0d1412;
  --panel: rgba(23, 34, 30, 0.91);
  --panel-2: #1b2823;
  --ink: #f1f4ed;
  --muted: #9ca9a2;
  --line: rgba(230, 247, 237, 0.1);
  --accent: #9ce1bf;
  --accent-2: #d6ee91;
  --orange: #f5b875;
  --red: #f09686;
  --radius: 22px;
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.2);
}

* { box-sizing: border-box; }

html { background: var(--bg); scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% -5%, rgba(93, 163, 128, 0.2), transparent 32rem),
    radial-gradient(circle at 95% 34%, rgba(197, 218, 120, 0.1), transparent 28rem),
    var(--bg);
  font: 15px/1.55 "Manrope", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { color: inherit; }

.ambient {
  position: fixed;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.08;
  pointer-events: none;
}
.ambient-a { background: #a9f2ce; top: 20%; left: -170px; }
.ambient-b { background: #e5f08c; right: -180px; bottom: 18%; }

.app-shell { width: min(100%, 780px); margin: 0 auto; padding: 0 18px 112px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 78px;
  padding: max(12px, env(safe-area-inset-top)) 0 10px;
  background: linear-gradient(var(--bg) 62%, transparent);
}

.brand { display: flex; align-items: center; gap: 11px; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; }
.brand-mark { display: grid; place-items: center; width: 39px; height: 39px; border: 1px solid rgba(156, 225, 191, .3); border-radius: 13px; color: var(--accent); background: rgba(156, 225, 191, .08); font-size: 24px; }
.brand small { display: block; color: var(--muted); font-size: 10px; line-height: 1.2; letter-spacing: .13em; text-transform: uppercase; }
.brand strong { display: block; font-family: "Unbounded", sans-serif; font-size: 15px; letter-spacing: -.035em; }

.icon-button { display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); cursor: pointer; }
.icon-button svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }

.screen { animation: enter .28s ease both; }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } }

.hero { position: relative; overflow: hidden; margin-top: 10px; padding: 26px; border: 1px solid rgba(156, 225, 191, .14); border-radius: 30px; background: linear-gradient(140deg, rgba(38, 64, 53, .98), rgba(20, 31, 27, .96)); box-shadow: var(--shadow); }
.hero::after { content: ""; position: absolute; right: -55px; top: -70px; width: 220px; height: 220px; border: 1px solid rgba(156, 225, 191, .12); border-radius: 42% 58% 52% 48%; transform: rotate(24deg); box-shadow: inset 0 0 0 24px rgba(156,225,191,.025), inset 0 0 0 48px rgba(156,225,191,.02); }
.eyebrow { color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.hero h1, .page-title h1 { margin: 9px 0 10px; font-family: "Unbounded", sans-serif; letter-spacing: -.055em; line-height: 1.17; }
.hero h1 { position: relative; z-index: 1; max-width: 510px; font-size: clamp(27px, 8vw, 46px); }
.hero p { position: relative; z-index: 1; max-width: 560px; margin: 0; color: #c3ccc7; }

.countdown { display: flex; gap: 12px; margin-top: 25px; }
.countdown div { min-width: 72px; padding: 10px 12px; border: 1px solid rgba(255,255,255,.08); border-radius: 15px; background: rgba(0,0,0,.17); }
.countdown strong { display: block; font: 700 22px/1 "Unbounded", sans-serif; color: var(--accent-2); }
.countdown small { color: var(--muted); font-size: 10px; text-transform: uppercase; }

.section-head { display: flex; align-items: end; justify-content: space-between; gap: 14px; margin: 27px 2px 13px; }
.section-head h2 { margin: 0; font-family: "Unbounded", sans-serif; font-size: 17px; letter-spacing: -.04em; }
.section-head p, .section-head small { margin: 0; color: var(--muted); }
.section-head button { padding: 0; border: 0; color: var(--accent); background: none; font-size: 12px; cursor: pointer; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-top: 12px; }
.stat { padding: 15px 13px; border: 1px solid var(--line); border-radius: 17px; background: var(--panel); }
.stat strong { display: block; font: 650 21px/1.2 "Unbounded", sans-serif; }
.stat small { color: var(--muted); font-size: 11px; }

.routes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 11px; }
.route-card { position: relative; min-height: 152px; padding: 18px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); text-align: left; cursor: pointer; transition: transform .18s ease, border-color .18s ease; }
.route-card:active { transform: scale(.985); }
.route-card.wide { grid-column: 1 / -1; min-height: 118px; }
.route-card .route-icon { display: grid; place-items: center; width: 39px; height: 39px; margin-bottom: 20px; border-radius: 12px; color: #15221d; background: var(--accent); font-weight: 800; }
.route-card:nth-child(2) .route-icon { background: var(--accent-2); }
.route-card:nth-child(3) .route-icon { background: var(--orange); }
.route-card strong { display: block; font-family: "Unbounded", sans-serif; font-size: 14px; letter-spacing: -.035em; }
.route-card small { display: block; margin-top: 5px; color: var(--muted); line-height: 1.4; }

.plan-list, .list { display: grid; gap: 9px; }
.plan-day { display: grid; grid-template-columns: 50px 1fr auto; gap: 13px; align-items: center; padding: 15px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); }
.plan-day.active { border-color: rgba(156,225,191,.42); background: linear-gradient(110deg, rgba(35,58,49,.98), var(--panel)); }
.day-num { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 15px; background: rgba(255,255,255,.055); font: 700 18px "Unbounded"; }
.plan-day strong { display: block; font-size: 13px; }
.plan-day small { color: var(--muted); font-size: 11px; }
.plan-day input { width: 19px; height: 19px; accent-color: var(--accent); }

.page-title { padding: 22px 3px 11px; }
.page-title h1 { font-size: clamp(25px, 7vw, 38px); }
.page-title p { max-width: 590px; margin: 0; color: var(--muted); }

.toolbar { position: sticky; top: 71px; z-index: 10; display: flex; gap: 8px; padding: 9px 0 12px; overflow-x: auto; background: linear-gradient(var(--bg) 78%, transparent); scrollbar-width: none; }
.toolbar::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; padding: 8px 13px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: var(--panel); font-size: 12px; cursor: pointer; }
.chip.active { border-color: transparent; color: #102019; background: var(--accent); font-weight: 700; }

.formula-card { position: relative; padding: 18px; border: 1px solid var(--line); border-radius: 19px; background: var(--panel); }
.formula-card header { display: flex; justify-content: space-between; gap: 12px; }
.formula-card h3 { margin: 0; font-size: 15px; }
.formula-card .class-label { color: var(--muted); font-size: 11px; }
.formula { margin: 18px 0 7px; color: var(--accent-2); font: 600 clamp(19px, 6vw, 27px) "Unbounded", sans-serif; letter-spacing: -.04em; }
.formula sub { font-size: .58em; }
.formula sup { font-size: .5em; }
.formula-cover { display: grid; place-items: center; min-height: 47px; margin-top: 15px; border: 1px dashed rgba(156,225,191,.2); border-radius: 13px; color: var(--muted); background: rgba(0,0,0,.15); cursor: pointer; }
.formula-card .meta { display: flex; gap: 7px; flex-wrap: wrap; color: var(--muted); font-size: 11px; }
.tag { padding: 4px 8px; border-radius: 8px; background: rgba(255,255,255,.05); }

.question-list { gap: 7px; }
.question-card { overflow: hidden; border: 1px solid var(--line); border-radius: 17px; background: var(--panel); transition: border-color .18s, transform .18s; }
.question-card:active { transform: scale(.992); }
.question-head { display: grid; grid-template-columns: 42px 1fr 24px; gap: 12px; align-items: center; width: 100%; min-height: 76px; padding: 14px 15px; border: 0; background: none; text-align: left; cursor: pointer; }
.question-number { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 13px; color: #102019; background: var(--accent); font: 700 12px "Unbounded"; }
.question-name { min-width: 0; }
.question-name strong { display: block; font-size: 13px; line-height: 1.42; }
.question-name small { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; }
.question-arrow { color: var(--accent); font-size: 20px; text-align: right; }

.question-reader { width: min(100%, 700px); margin: 9px auto 0; }
.reader-back { margin: 0 0 14px; padding: 8px 0; border: 0; color: var(--accent); background: none; font-size: 13px; font-weight: 700; cursor: pointer; }
.reader-progress { height: 3px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.08); }
.reader-progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.reader-title { padding: 22px 2px 19px; }
.reader-title > span { color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.reader-title h1 { max-width: 660px; margin: 9px 0 0; font: 600 clamp(23px, 6vw, 34px)/1.24 "Unbounded", sans-serif; letter-spacing: -.045em; }
.reader-summary { margin-bottom: 13px; padding: 18px 19px; border: 1px solid rgba(156,225,191,.2); border-radius: 18px; background: linear-gradient(135deg, rgba(42,69,58,.92), rgba(24,38,33,.94)); }
.reader-summary small { color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.reader-summary p { margin: 8px 0 0; color: #ecf5ef; font-size: 14px; line-height: 1.65; }
.reader-theory { overflow: hidden; border-radius: 21px; color: #17201c; background: #f1f3ed; box-shadow: 0 18px 55px rgba(0,0,0,.2); }
.reader-theory > header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 17px 22px; border-bottom: 1px solid rgba(22,35,29,.1); background: #e4eadf; }
.reader-theory > header span { font: 700 13px "Unbounded", sans-serif; letter-spacing: -.025em; }
.reader-theory > header small { color: #607068; font-size: 10px; }
.theory-content { padding: 24px 24px 29px; font-size: 16px; font-weight: 500; line-height: 1.78; overflow-wrap: anywhere; }
.theory-content p { margin: 0 0 1.15em; }
.theory-content p:last-child { margin-bottom: 0; }
.theory-content strong { color: #0b6647; font-weight: 800; }
.theory-content h3 { margin: 1.7em 0 .65em; color: #0b6647; font: 700 17px/1.35 "Manrope", sans-serif; }
.theory-content h3:first-child { margin-top: 0; }
.theory-point { display: grid; grid-template-columns: 29px 1fr; gap: 11px; align-items: start; margin: 0 0 1.15em; }
.theory-point > span { display: grid; place-items: center; width: 28px; height: 28px; margin-top: 1px; border-radius: 9px; color: #0f513a; background: #ccebdc; font-size: 12px; font-weight: 800; }
.theory-point p { margin: 0; }
.reader-check { margin-top: 13px; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); }
.reader-check > strong { display: block; font-size: 13px; }
.answer-actions { display: flex; gap: 7px; margin-top: 14px; }
.answer-actions button { flex: 1; padding: 11px 6px; border: 1px solid var(--line); border-radius: 11px; color: var(--muted); background: rgba(255,255,255,.035); font-size: 11px; cursor: pointer; }
.answer-actions button.done { color: #102019; background: var(--accent); }
.reader-nav { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; margin-top: 13px; }
.reader-nav button { min-height: 67px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); cursor: pointer; }
.reader-nav button:first-of-type { text-align: left; }
.reader-nav button:last-of-type { text-align: right; }
.reader-nav small { display: block; color: var(--muted); font-size: 10px; }
.reader-nav strong { display: block; margin-top: 3px; color: var(--accent); font-size: 12px; }

.ticket { padding: 20px; border: 1px solid rgba(214,238,145,.2); border-radius: 23px; background: linear-gradient(145deg, rgba(54,63,36,.55), var(--panel)); }
.ticket small { color: var(--accent-2); font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }
.ticket ol { margin: 17px 0 0; padding-left: 21px; }
.ticket li { padding: 7px 0; }
.primary { width: 100%; margin-top: 11px; padding: 13px 18px; border: 0; border-radius: 14px; color: #0d1a14; background: var(--accent); font-weight: 800; cursor: pointer; }
.secondary { padding: 9px 13px; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); background: var(--panel); cursor: pointer; }

.mineral-hero { overflow: hidden; border: 1px solid var(--line); border-radius: 25px; background: var(--panel); }
.cover { position: relative; aspect-ratio: 16 / 11; overflow: hidden; background: #1c2824; }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover::after { content: ""; position: absolute; inset: 45% 0 0; background: linear-gradient(transparent, rgba(8,13,11,.82)); }
.cover-label { position: absolute; z-index: 2; left: 18px; right: 18px; bottom: 15px; }
.cover-label h2 { margin: 3px 0 0; font: 600 25px "Unbounded", sans-serif; letter-spacing: -.05em; }
.cover-label small { color: var(--accent); }
.mineral-body { padding: 18px; }
.properties { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 15px 0; }
.property { padding: 11px; border-radius: 12px; background: rgba(255,255,255,.045); }
.property small { display: block; color: var(--muted); font-size: 10px; }
.property strong { font-size: 12px; }
.diagnostic { padding: 14px; border-radius: 14px; color: #dce8e1; background: rgba(245,184,117,.08); font-size: 12px; }
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 14px; }
.gallery button { padding: 0; overflow: hidden; border: 0; border-radius: 11px; background: #111; aspect-ratio: 3 / 4; cursor: zoom-in; }
.gallery img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.gallery button:active img { transform: scale(.97); }

.quiz { padding: 17px; border: 1px solid var(--line); border-radius: 21px; background: var(--panel); }
.quiz-frame { width: 100%; overflow: hidden; border-radius: 15px; aspect-ratio: 4 / 3; background: #0b100e; }
.quiz-photo { width: 142%; max-width: none; height: 100%; object-fit: cover; object-position: left center; }
.quiz-options { display: grid; gap: 8px; margin-top: 13px; }
.quiz-options button { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.035); text-align: left; cursor: pointer; }
.quiz-options button.correct { border-color: var(--accent); color: #13231b; background: var(--accent); }
.quiz-options button.wrong { border-color: var(--red); color: var(--red); }

.empty { padding: 35px 20px; color: var(--muted); text-align: center; }
.empty strong { display: block; color: var(--ink); }

.bottom-nav { position: fixed; z-index: 30; left: 50%; bottom: max(10px, env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(4, 1fr); width: min(calc(100% - 22px), 520px); padding: 7px; transform: translateX(-50%); border: 1px solid rgba(255,255,255,.1); border-radius: 23px; background: rgba(20, 30, 26, .9); box-shadow: 0 18px 55px rgba(0,0,0,.4); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); }
.bottom-nav button { min-width: 0; padding: 7px 2px; border: 0; border-radius: 16px; color: var(--muted); background: none; cursor: pointer; }
.bottom-nav button span { display: block; height: 23px; font: 600 13px/23px "Unbounded"; }
.bottom-nav button small { display: block; overflow: hidden; font-size: 9px; text-overflow: ellipsis; }
.bottom-nav button.active { color: #102019; background: var(--accent); }

dialog { color: var(--ink); border: 1px solid var(--line); background: var(--panel-2); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(0,0,0,.72); -webkit-backdrop-filter: blur(7px); backdrop-filter: blur(7px); }
.search-dialog { width: min(calc(100% - 24px), 680px); max-height: min(80vh, 720px); padding: 13px; border-radius: 24px; }
.search-head { display: grid; grid-template-columns: 1fr 42px; gap: 8px; }
.search-head input { min-width: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 13px; outline: 0; color: var(--ink); background: rgba(0,0,0,.18); }
.search-head input:focus { border-color: var(--accent); }
.search-head button, .photo-dialog form button { border: 0; border-radius: 12px; color: var(--muted); background: rgba(255,255,255,.05); font-size: 25px; cursor: pointer; }
.search-results { display: grid; gap: 7px; max-height: 60vh; margin-top: 11px; overflow: auto; }
.search-result { padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.03); cursor: pointer; }
.search-result small { color: var(--accent); }
.search-result strong { display: block; margin-top: 2px; font-size: 12px; }
.photo-dialog { width: min(calc(100% - 18px), 900px); padding: 8px; border-radius: 18px; }
.photo-dialog form { position: absolute; z-index: 2; top: 15px; right: 15px; }
.photo-dialog form button { width: 42px; height: 42px; background: rgba(0,0,0,.62); }
.photo-dialog img { display: block; width: 100%; max-height: 84vh; border-radius: 12px; object-fit: contain; }

@media (min-width: 660px) {
  .routes { grid-template-columns: repeat(3, 1fr); }
  .route-card.wide { grid-column: auto; min-height: 152px; }
  .list.formula-list { grid-template-columns: repeat(2, 1fr); }
  .gallery { grid-template-columns: repeat(5, 1fr); }
  .mineral-body { padding: 22px; }
}

@media (max-width: 420px) {
  .app-shell { padding-inline: 13px; }
  .hero { padding: 22px 19px; }
  .stats { gap: 6px; }
  .stat { padding: 12px 9px; }
  .question-head { grid-template-columns: 40px 1fr 20px; padding-inline: 13px; }
  .reader-title { padding-top: 18px; }
  .reader-title h1 { font-size: 22px; }
  .reader-summary { padding: 16px; }
  .reader-theory > header { padding-inline: 18px; }
  .theory-content { padding: 21px 18px 25px; font-size: 15.5px; line-height: 1.75; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; } }
