@font-face { font-family: 'Nunito Sans'; font-weight: 400; font-display: swap; src: url(../fonts/nunito-sans-latin-ext-400-normal.woff2) format('woff2'); unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Nunito Sans'; font-weight: 400; font-display: swap; src: url(../fonts/nunito-sans-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Nunito Sans'; font-weight: 700; font-display: swap; src: url(../fonts/nunito-sans-latin-ext-700-normal.woff2) format('woff2'); unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Nunito Sans'; font-weight: 700; font-display: swap; src: url(../fonts/nunito-sans-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Nunito Sans'; font-weight: 900; font-display: swap; src: url(../fonts/nunito-sans-latin-ext-900-normal.woff2) format('woff2'); unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Nunito Sans'; font-weight: 900; font-display: swap; src: url(../fonts/nunito-sans-latin-900-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --primary: #00573f;
  --primary-dark: #003d2c;
  --accent: #43b02a;
  --gold: #c9a227;
  --cream: #faf5ea;
  --lime: #d4e36e;
  --red: #ee3124;
  --ink: #222;
  --muted: #5d6b64;
  --card: #fff;
  --line: #e6dfcf;
  --radius: 18px;
  --font: 'Nunito Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --shadow: 0 2px 10px rgba(0, 61, 44, .08), 0 1px 2px rgba(0, 61, 44, .06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); color: var(--ink); background: var(--cream);
  font-size: 17px; line-height: 1.5; min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}
#app { max-width: 560px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
main { flex: 1; min-width: 0; padding: 18px 18px 28px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; font-weight: 900; color: var(--primary-dark); }
h1 { font-size: 30px; }
h2 { font-size: 24px; }
h3 { font-size: 19px; }
p { margin: 0 0 .9em; }
a { color: var(--primary); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 10px; align-items: center; }
.grow { flex: 1; }
.hidden { display: none !important; }

/* Fejléc */
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--primary); color: #fff;
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; min-height: 56px;
  padding-top: max(10px, env(safe-area-inset-top));
}
.topbar .brand { font-weight: 900; letter-spacing: .02em; font-size: 15px; line-height: 1.15; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .brand small { display: block; font-weight: 700; opacity: .8; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 6px 12px;
  background: rgba(255, 255, 255, .14); color: #fff; font-weight: 800; font-size: 15px; border: 0; font-family: inherit;
  min-height: 38px; cursor: pointer;
}
.chip.flag-chip { padding: 6px 8px; }
.iconbtn { background: rgba(255, 255, 255, .14); border: 0; color: #fff; width: 40px; height: 40px; border-radius: 12px; font-size: 20px; cursor: pointer; }

/* Zászlók */
.flag { width: 28px; height: 20px; border-radius: 4px; display: block; box-shadow: 0 0 0 1px rgba(0, 0, 0, .12); overflow: hidden; flex: none; }
.flags { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.flags button {
  display: flex; align-items: center; gap: 6px; border: 2px solid transparent; background: #fff; border-radius: 999px;
  padding: 6px 11px 6px 7px; font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; box-shadow: var(--shadow); color: var(--ink);
  min-height: 44px;
}
.flags .flag { width: 24px; height: 17px; }
.flags button[aria-pressed='true'] { border-color: var(--primary); color: var(--primary-dark); }
.flags.compact button span { display: none; }
.flags.compact button { padding: 8px 10px; }

/* Gombok */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  min-height: 56px; padding: 14px 20px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--primary); color: #fff; font: inherit; font-weight: 900; font-size: 18px; text-decoration: none;
  box-shadow: 0 3px 0 var(--primary-dark);
}
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--primary-dark); }
.btn.secondary { background: #fff; color: var(--primary-dark); box-shadow: 0 0 0 2px var(--primary) inset; }
.btn.accent { background: var(--accent); box-shadow: 0 3px 0 #2f8a1c; }
.btn.ghost { background: transparent; color: var(--primary); box-shadow: none; min-height: 48px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.small { min-height: 44px; font-size: 16px; padding: 10px 16px; width: auto; }
.link { background: none; border: 0; padding: 10px 4px; color: var(--primary); text-decoration: underline; font: inherit; font-size: 15px; cursor: pointer; display: block; margin: 6px auto 0; text-underline-offset: 3px; }
.link.thin { font-weight: 400; color: var(--muted); }

/* Kártyák */
.card { background: var(--card); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card.tinted { background: #fff8e6; box-shadow: 0 0 0 1px #f1e2b8 inset; }
.card.clue { background: var(--primary); color: #fff; }
.card.clue h3 { color: var(--lime); display: flex; align-items: center; gap: 8px; }
.card.clue p { margin: 0; }
.dyk h3 { color: var(--primary); }
.notice { border-radius: 14px; padding: 12px 14px; background: #eef6ea; color: #24461b; font-size: 15px; }
.notice.warn { background: #fdecea; color: #7a1d16; }

/* Hero */
.hero { background: var(--primary); color: #fff; border-radius: 0 0 28px 28px; padding: 28px 22px 30px; margin: -18px -18px 20px; position: relative; overflow: hidden; }
.hero h1 { color: #fff; font-size: 34px; margin-bottom: 8px; }
.hero p { color: #e4efe9; margin: 0; }
.hero .wordmark { font-weight: 900; letter-spacing: .14em; color: var(--lime); font-size: 18px; margin-bottom: 18px; display: flex; align-items: center; gap: 10px; }
.hero .wordmark::after { content: ''; flex: 1; height: 2px; background: linear-gradient(90deg, var(--gold), transparent); }
.hero-art { position: absolute; right: -20px; bottom: -14px; width: 150px; opacity: .22; pointer-events: none; }

/* Űrlap */
label.field { display: block; font-weight: 800; color: var(--primary-dark); margin-bottom: 6px; }
input[type=text], input[type=password], input[type=number], select {
  width: 100%; font: inherit; font-size: 18px; padding: 14px 16px; border-radius: 14px; border: 2px solid var(--line); background: #fff; color: var(--ink); min-height: 54px;
}
input:focus, select:focus { outline: none; border-color: var(--primary); }
.err { color: #b3261e; font-weight: 700; font-size: 15px; margin-top: 6px; min-height: 1em; }

.mascots { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.mascots button {
  aspect-ratio: 1; min-height: 84px; border-radius: 16px; border: 2px solid var(--line); background: #fff; font-size: 34px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 4px;
}
.mascots button small { font-size: 11px; font-weight: 700; color: var(--muted); line-height: 1.1; text-align: center; overflow-wrap: anywhere; hyphens: auto; max-width: 100%; }
.mascots button { min-width: 0; }
.mascots button[aria-pressed='true'] { border-color: var(--primary); background: #eaf4ee; box-shadow: 0 0 0 2px var(--primary) inset; }

/* Mesélő */
.narrator { display: flex; gap: 14px; align-items: flex-start; }
.narrator img { width: 76px; height: 76px; border-radius: 50%; flex: none; background: #fff; box-shadow: var(--shadow); }
.bubble { background: #fff; border-radius: 4px 18px 18px 18px; padding: 14px 16px; box-shadow: var(--shadow); }
.bubble p:last-child { margin: 0; }
.narrator-name { font-weight: 900; color: var(--primary); margin-bottom: 4px; }

/* Útvonal */
.map { background: #fff; border-radius: var(--radius); padding: 8px; box-shadow: var(--shadow); }
.map svg { width: 100%; height: auto; display: block; }
.map .pin circle { fill: #fff; stroke: var(--primary); stroke-width: 3; }
.map .pin text { fill: var(--primary); font: 900 15px var(--font); }
.map .pin.done circle { fill: var(--accent); stroke: var(--accent); }
.map .pin.done text { fill: #fff; }
.map .pin.current circle { fill: var(--primary); stroke: var(--lime); stroke-width: 5; }
.map .pin.current text { fill: #fff; }
.stlist { list-style: none; padding: 0; margin: 0; }
.stlist li { display: flex; gap: 12px; align-items: center; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.stlist li:last-child { border-bottom: 0; }
.num { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; flex: none; background: #fff; color: var(--primary); box-shadow: 0 0 0 2px var(--primary) inset; font-size: 15px; }
.stlist li.done .num { background: var(--accent); color: #fff; box-shadow: none; }
.stlist li.current .num { background: var(--primary); color: #fff; box-shadow: 0 0 0 3px var(--lime); }
.stlist li.done .name { color: var(--muted); }
.stlist .pts { font-weight: 800; color: var(--primary); font-size: 15px; white-space: nowrap; }
.station-head { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.station-head h2 { margin: 0; }
.station-img { width: 100%; border-radius: var(--radius); display: block; background: #fff; box-shadow: var(--shadow); }
.station-img.big { aspect-ratio: 4/3; object-fit: cover; }
.progress { height: 8px; background: #e5dccb; border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

/* Feladatok */
.options { display: grid; gap: 10px; }
.option {
  text-align: left; font: inherit; font-weight: 700; font-size: 18px; padding: 14px 16px; min-height: 56px; border-radius: 14px;
  border: 2px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; display: flex; align-items: center; gap: 12px;
}
.option .letter { width: 30px; height: 30px; border-radius: 50%; background: var(--cream); display: grid; place-items: center; font-weight: 900; color: var(--primary); flex: none; font-size: 15px; }
.option[aria-pressed='true'] { border-color: var(--primary); background: #eaf4ee; }
.option.is-right { border-color: var(--accent); background: #e9f6e4; }
.option.is-wrong { border-color: #d64b3f; background: #fdecea; }
.option[disabled] { cursor: default; }
.timer { display: flex; align-items: center; gap: 10px; font-weight: 900; color: var(--primary-dark); }
.timer .bar { flex: 1; height: 12px; background: #e5dccb; border-radius: 99px; overflow: hidden; }
.timer .bar i { display: block; height: 100%; background: var(--accent); transition: width .25s linear; }
.timer.low .bar i { background: var(--red); }
.cipher-key { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.cipher-key div { background: #fff; border-radius: 12px; padding: 8px 4px; text-align: center; box-shadow: var(--shadow); font-weight: 900; color: var(--primary-dark); }
.cipher-key div span { display: block; font-size: 26px; line-height: 1.2; }
.cipher-msg { font-size: 34px; letter-spacing: 4px; text-align: center; background: #fff; border-radius: 14px; padding: 14px 8px; box-shadow: var(--shadow); word-break: break-all; line-height: 1.4; }
.cipher-input { text-transform: uppercase; letter-spacing: .18em; font-weight: 900; text-align: center; }
.estimate-val { font-size: 44px; font-weight: 900; text-align: center; color: var(--primary); }
input[type=range] { width: 100%; height: 44px; accent-color: var(--primary); }
.order-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.order-list li { display: flex; align-items: center; gap: 8px; background: #fff; border-radius: 14px; padding: 8px 8px 8px 14px; box-shadow: var(--shadow); font-weight: 700; min-height: 60px; touch-action: none; user-select: none; }
.order-list li.dragging { opacity: .7; box-shadow: 0 6px 20px rgba(0, 0, 0, .2); }
.order-list li .txt { flex: 1; }
.order-list li .yr { font-weight: 900; color: var(--primary); }
.order-list li.ok { box-shadow: 0 0 0 2px var(--accent) inset; }
.order-list li.bad { box-shadow: 0 0 0 2px #d64b3f inset; }
.order-list .arrows { display: flex; flex-direction: column; gap: 4px; }
.order-list .arrows button { width: 44px; height: 30px; border: 0; border-radius: 8px; background: var(--cream); color: var(--primary-dark); font-size: 16px; cursor: pointer; }
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.match .col { display: grid; gap: 8px; align-content: start; }
.match button { font: inherit; font-size: 15px; font-weight: 700; text-align: left; padding: 10px 12px; border-radius: 12px; border: 2px solid var(--line); background: #fff; color: var(--ink); min-height: 58px; cursor: pointer; line-height: 1.25; }
.match button.sel { border-color: var(--primary); background: #eaf4ee; }
.match button.paired { border-style: solid; }
.match button .tag { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: #fff; font-size: 12px; font-weight: 900; margin-right: 6px; vertical-align: 1px; }
.match button.ok { border-color: var(--accent); }
.match button.bad { border-color: #d64b3f; }
.result { text-align: center; }
.result .big { font-size: 40px; font-weight: 900; color: var(--primary); }
.result .verdict { font-size: 22px; font-weight: 900; }
.result .verdict.bad { color: #b3261e; }

/* Jegyzetfüzet */
.nb-group h3 { margin-top: 4px; }
.nb-items { display: grid; gap: 8px; }
.nb-item { display: flex; gap: 12px; align-items: flex-start; text-align: left; font: inherit; padding: 12px 14px; border-radius: 14px; border: 2px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; width: 100%; }
.nb-item .em { font-size: 24px; line-height: 1.2; }
.nb-item .nm { font-weight: 800; }
.nb-item .ds { font-size: 14px; color: var(--muted); display: block; margin-top: 2px; }
.nb-item.out { opacity: .45; }
.nb-item.out .nm { text-decoration: line-through; text-decoration-thickness: 2px; }
.nb-item.sel { border-color: var(--primary); background: #eaf4ee; opacity: 1; }
.nb-item.sel .nm { text-decoration: none; }
.clue-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.clue-list li { background: #fff; border-left: 5px solid var(--accent); border-radius: 10px; padding: 10px 12px; font-size: 15px; box-shadow: var(--shadow); }
.clue-list li b { color: var(--primary); display: block; font-size: 14px; }

/* Fotó */
.cam { position: relative; background: #111; border-radius: var(--radius); overflow: hidden; aspect-ratio: 3/4; }
.cam video, .cam canvas, .cam img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam video.mirror, .cam canvas.mirror { transform: scaleX(-1); }
.bgs { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; scrollbar-width: none; }
.bgs button { flex: none; border: 2px solid var(--line); background: #fff; border-radius: 12px; padding: 4px; width: 86px; font: inherit; font-size: 12px; font-weight: 700; color: var(--ink); cursor: pointer; }
.bgs button img, .bgs button .real { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: grid; place-items: center; background: var(--cream); font-size: 26px; }
.bgs button[aria-pressed='true'] { border-color: var(--primary); }
.shutter { width: 76px; height: 76px; border-radius: 50%; border: 6px solid #fff; background: var(--accent); box-shadow: 0 0 0 3px var(--primary); margin: 0 auto; display: block; cursor: pointer; }
.share-preview { width: 100%; display: block; border-radius: 28px; box-shadow: var(--shadow); }

/* Kupon */
.coupon { background: #fff; border-radius: 22px; padding: 22px; text-align: center; box-shadow: var(--shadow); border: 2px dashed var(--gold); }
.coupon .code { font-size: 32px; font-weight: 900; letter-spacing: .08em; color: var(--primary-dark); margin: 8px 0; word-break: break-all; }
.hl { background: linear-gradient(transparent 52%, var(--lime) 52%); font-weight: 900; color: var(--primary-dark); padding: 0 .08em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.stamp { display: inline-block; border: 3px solid var(--red); color: var(--red); font-weight: 900; border-radius: 10px; padding: 4px 12px; transform: rotate(-4deg); font-size: 20px; }

/* Ranglista */
.tabs { display: flex; background: #fff; border-radius: 999px; padding: 4px; box-shadow: var(--shadow); }
.tabs button { flex: 1; border: 0; background: transparent; font: inherit; font-weight: 800; padding: 10px; border-radius: 999px; min-height: 44px; color: var(--muted); cursor: pointer; }
.tabs button[aria-selected='true'] { background: var(--primary); color: #fff; }
.lb { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.lb li { min-width: 0; display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 14px; padding: 10px 12px; box-shadow: var(--shadow); }
.lb li.me { box-shadow: 0 0 0 2px var(--primary) inset; background: #f0f8f3; }
.lb .rank { width: 30px; text-align: center; font-weight: 900; color: var(--primary); }
.lb .masc { font-size: 24px; }
.lb .who { flex: 1; min-width: 0; }
.lb .who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb .who small { color: var(--muted); font-size: 13px; }
.lb .sc { font-weight: 900; color: var(--primary-dark); font-size: 18px; white-space: nowrap; }
.tag { display: inline-block; font-size: 12px; font-weight: 800; background: var(--cream); color: var(--muted); border-radius: 6px; padding: 0 6px; margin-left: 4px; vertical-align: 1px; }

/* Lap alja / lapok */
.sheet-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--cream); width: 100%; max-width: 560px; border-radius: 24px 24px 0 0; padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); max-height: 92dvh; overflow: auto; }
.footer-actions { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--cream) 30%); padding: 18px 0 max(6px, env(safe-area-inset-bottom)); margin-top: 8px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--primary-dark); color: #fff; padding: 12px 18px; border-radius: 14px; z-index: 60; font-weight: 700; max-width: 90vw; text-align: center; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 14px; border-radius: 2px; animation: fall 2.4s ease-in forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }
@media (prefers-reduced-motion: reduce) { .confetti { display: none; } }
