/* ===========================================================================
   Rovásírás — oktatójáték · mobil-első, sztyeppe/tábortűz hangulat
   =========================================================================== */

:root {
  --bg-0: #160f24;
  --bg-1: #241634;
  --bg-2: #321d3f;
  --ember: #ff9d4d;
  --ember-deep: #e8742a;
  --gold: #ffce6b;
  --gold-soft: #f6e4b0;
  --parchment: #f4e8cf;
  --parchment-2: #ecdcba;
  --ink: #3a2c1a;
  --ink-soft: #6a5640;
  --rune: #c9b6f0;
  --rune-ink: #2a2018;
  --heart: #ff6f91;
  --star: #ffd27a;
  --good: #7bd88f;
  --bad: #ff8b6b;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 10px;
  --tap: 48px;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; margin: 0; }

body {
  font-family: var(--font);
  color: var(--parchment);
  background:
    radial-gradient(1200px 600px at 50% -10%, #3a2350 0%, transparent 60%),
    radial-gradient(900px 500px at 50% 120%, #4a2a2a 0%, transparent 55%),
    linear-gradient(160deg, var(--bg-0), var(--bg-1) 55%, var(--bg-2));
  background-attachment: fixed;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  line-height: 1.5;
}

/* Telefon-keret, középre igazítva nagyobb képernyőn */
#app {
  position: relative;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  isolation: isolate;
}
@media (min-width: 540px) {
  #app {
    margin: 18px auto;
    min-height: calc(100dvh - 36px);
    min-height: calc(100vh - 36px);
    border-radius: 28px;
    box-shadow: var(--shadow), 0 0 0 1px rgba(255, 255, 255, .04);
    overflow: hidden;
  }
}

/* parázs-pislákolás a háttérben */
.embers { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.ember {
  position: absolute; bottom: -10px; width: 5px; height: 5px; border-radius: 50%;
  background: radial-gradient(circle, var(--gold) 0%, var(--ember) 60%, transparent 70%);
  opacity: 0; animation: rise linear infinite;
}
@keyframes rise {
  0% { transform: translateY(0) scale(1); opacity: 0; }
  10% { opacity: .9; }
  100% { transform: translateY(-105vh) translateX(var(--dx, 0)) scale(.4); opacity: 0; }
}

/* ── Általános elemek ─────────────────────────────────────────── */
.screen {
  position: relative; z-index: 1;
  flex: 1; display: flex; flex-direction: column;
  padding: 18px 18px 26px;
  animation: screen-in .42s var(--ease) both;
}
@keyframes screen-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

h1, h2, h3 { margin: 0 0 .35em; line-height: 1.15; font-weight: 800; letter-spacing: .01em; }
p { margin: 0 0 .8em; }

.muted { color: var(--gold-soft); opacity: .8; }
.center { text-align: center; }
.grow { flex: 1; }
.stack > * + * { margin-top: 14px; }

/* Gombok */
.btn {
  appearance: none; border: 0; cursor: pointer;
  font-family: inherit; font-size: 1.05rem; font-weight: 700;
  min-height: var(--tap); padding: 13px 22px; border-radius: var(--r-md);
  color: #2a1a08;
  background: linear-gradient(180deg, var(--gold), var(--ember));
  box-shadow: 0 6px 16px rgba(232, 116, 42, .35), inset 0 1px 0 rgba(255, 255, 255, .4);
  transition: transform .12s var(--ease), box-shadow .2s var(--ease), filter .2s;
  width: 100%;
}
.btn:active { transform: translateY(2px) scale(.99); box-shadow: 0 3px 8px rgba(232, 116, 42, .3); }
.btn:focus-visible { outline: 3px solid var(--gold-soft); outline-offset: 3px; }
.btn.ghost {
  background: rgba(255, 255, 255, .07); color: var(--parchment);
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .18);
}
.btn.small { width: auto; min-height: 40px; padding: 8px 16px; font-size: .95rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; filter: grayscale(.3); }

.iconbtn {
  appearance: none; border: 0; cursor: pointer; background: rgba(255, 255, 255, .08);
  color: var(--parchment); width: var(--tap); height: var(--tap); min-width: var(--tap);
  border-radius: 50%; font-size: 1.3rem; display: grid; place-items: center;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .14);
}
.iconbtn:focus-visible { outline: 3px solid var(--gold-soft); outline-offset: 2px; }

/* Kártya / parchment */
.card {
  background: linear-gradient(180deg, var(--parchment), var(--parchment-2));
  color: var(--ink); border-radius: var(--r-lg);
  padding: 18px; box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .5);
  position: relative;
}
.card.dim { background: rgba(255, 255, 255, .06); color: var(--parchment); box-shadow: none; border: 1.5px solid rgba(255,255,255,.1); }

/* HUD */
.hud {
  position: relative; z-index: 2;
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px;
}
.hud .scores { display: flex; gap: 12px; flex: 1; font-weight: 800; font-size: .98rem; }
.hud .scores span { display: inline-flex; align-items: center; gap: 5px; }
.hud .s-star { color: var(--star); }
.hud .s-heart { color: var(--heart); }
.hud .s-rune { color: var(--rune); }

/* ── Cím / intró ──────────────────────────────────────────────── */
.title-wrap { text-align: center; margin-top: 6vh; }
.title-rovas { display: flex; justify-content: center; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.title-rovas svg { width: 38px; height: 38px; filter: drop-shadow(0 2px 6px rgba(255, 157, 77, .5)); }
.bigtitle {
  font-size: clamp(2.1rem, 11vw, 3rem); letter-spacing: .14em;
  background: linear-gradient(180deg, var(--gold-soft), var(--gold) 50%, var(--ember));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 2px 30px rgba(255, 157, 77, .25);
}
.subtitle { color: var(--gold); font-weight: 700; letter-spacing: .04em; margin-bottom: 1.4em; }
.intro-lines { max-width: 30ch; margin: 0 auto 1.6em; color: var(--parchment); opacity: .92; }
.flame { font-size: 2.6rem; animation: flicker 2.4s ease-in-out infinite; filter: drop-shadow(0 0 16px rgba(255, 157, 77, .6)); }
@keyframes flicker { 0%, 100% { transform: scale(1) rotate(-1deg); } 50% { transform: scale(1.08) rotate(1deg); } }

/* ── Karakterválasztás ────────────────────────────────────────── */
.chars { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.char {
  appearance: none; border: 0; cursor: pointer; text-align: center;
  background: rgba(255, 255, 255, .06); color: var(--parchment);
  border-radius: var(--r-lg); padding: 18px 12px; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .12);
  transition: transform .15s var(--ease), box-shadow .2s, background .2s;
}
.char:active { transform: scale(.97); }
.char:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.char .face { font-size: 3.2rem; display: block; margin-bottom: 6px; }
.char .cname { font-weight: 800; font-size: 1.15rem; color: var(--gold); }
.char .crole { font-size: .82rem; opacity: .8; margin-top: 2px; }
.char .cdesc { font-size: .8rem; opacity: .85; margin-top: 8px; line-height: 1.4; }

/* ── Falu / leckék térképe ────────────────────────────────────── */
.village-head { text-align: center; margin-bottom: 6px; }
.progress-ring { font-size: .9rem; color: var(--gold-soft); }
.lessons {
  display: grid; grid-template-columns: 1fr; gap: 12px; padding-bottom: 8px;
}
.lesson {
  appearance: none; border: 0; cursor: pointer; text-align: left; width: 100%;
  display: flex; align-items: center; gap: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,.09), rgba(255,255,255,.05));
  color: var(--parchment); border-radius: var(--r-md); padding: 14px;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .1);
  transition: transform .14s var(--ease), box-shadow .2s;
}
.lesson:active { transform: scale(.99); }
.lesson:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.lesson .badge {
  width: 52px; height: 52px; min-width: 52px; border-radius: 14px; display: grid; place-items: center;
  font-size: 1.8rem; background: rgba(0, 0, 0, .2); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.1);
}
.lesson .meta { flex: 1; min-width: 0; }
.lesson .meta > span { display: block; }
.lesson .meta .lnum { font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; color: var(--gold); opacity: .9; margin-bottom: 2px; }
.lesson .meta .ltitle { font-weight: 800; font-size: 1.05rem; line-height: 1.2; }
.lesson .meta .lteacher { font-size: .8rem; opacity: .78; margin-top: 2px; }
.lesson .state { font-size: 1.4rem; }
.lesson.locked { opacity: .55; cursor: not-allowed; filter: grayscale(.4); }
.lesson.current { box-shadow: inset 0 0 0 2px var(--gold), 0 0 22px rgba(255, 206, 107, .22); }
.lesson.done .badge { background: rgba(123, 216, 143, .18); }

.decode-cta {
  margin-top: 6px; text-align: center;
  background: linear-gradient(180deg, rgba(201,182,240,.18), rgba(201,182,240,.08));
  border-radius: var(--r-md); padding: 16px; box-shadow: inset 0 0 0 2px rgba(201,182,240,.4);
}

/* ── Lecke-bevezető ───────────────────────────────────────────── */
.teacher-hero { text-align: center; }
.teacher-hero .tface { font-size: 4rem; filter: drop-shadow(0 4px 14px rgba(0,0,0,.4)); }
.teacher-hero .tname { color: var(--gold); font-weight: 800; font-size: 1.3rem; }
.teacher-hero .trole { opacity: .8; font-size: .9rem; }
.place { font-style: italic; opacity: .9; }
.letter-preview { display: flex; justify-content: center; gap: 10px; margin: 8px 0; flex-wrap: wrap; }
.letter-preview .chip {
  background: rgba(255,255,255,.08); border-radius: 12px; padding: 8px 12px; text-align: center;
  box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.12); min-width: 64px;
}
.letter-preview .chip svg { width: 40px; height: 40px; }
.letter-preview .chip .cl { font-weight: 800; color: var(--gold); font-size: .9rem; }

/* ── Betűlecke ────────────────────────────────────────────────── */
.beatbar { display: flex; gap: 6px; margin-bottom: 12px; }
.beatbar .dot { flex: 1; height: 5px; border-radius: 4px; background: rgba(255,255,255,.16); transition: background .3s; }
.beatbar .dot.active { background: var(--gold); }
.beatbar .dot.done { background: var(--ember-deep); }

.letter-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.letter-head .lbig { font-size: 2rem; font-weight: 900; color: var(--gold); }
.letter-head .lword { font-size: 1.1rem; opacity: .9; }
.letter-emoji { font-size: 1.5rem; }

.rune-stage {
  display: grid; place-items: center; padding: 10px; margin: 6px 0 14px;
}
/* Alap rovás-vonás: minden jel körvonalas marad, scope-tól függetlenül.
   (A részletesebb szabályok csak a vonal SZÍNÉT írják felül.) Enélkül a
   nem-scope-olt helyeken — pl. a leckekártya chipjein — a path fill:black /
   stroke:none lenne, így az egyenes vonalú jelek (Dz, Dzs, E, U…) eltűnnének. */
.rune-path { stroke: none; fill: var(--gold); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; }
.letter-preview .chip .rune-path { fill: var(--rune); }

.rune-frame {
  width: min(58vw, 230px); aspect-ratio: 1; border-radius: 24px;
  background: radial-gradient(circle at 50% 40%, rgba(255, 206, 107, .14), rgba(0,0,0,.18));
  display: grid; place-items: center; box-shadow: inset 0 0 0 2px rgba(255, 206, 107, .25), var(--shadow);
  position: relative;
}
.rune-frame svg { width: 78%; height: 78%; }
.rune-frame .rune-path { stroke: none; fill: var(--gold); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 8px rgba(255, 157, 77, .45)); }

.beat-text { font-size: 1.05rem; }
.beat-text.story p:first-child { font-size: 1.08rem; }
.fact {
  background: rgba(201, 182, 240, .12); border-radius: var(--r-md); padding: 14px;
  box-shadow: inset 0 0 0 1.5px rgba(201, 182, 240, .3); font-size: .96rem;
}
.fact .tag { color: var(--rune); font-weight: 800; font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; display: block; margin-bottom: 4px; }

.hint-card { text-align: center; }
.hint-card .hint-emoji { font-size: 2.4rem; }
.hint-card .hint-word { color: var(--ink); font-weight: 800; font-size: 1.3rem; margin: 4px 0; }

/* ── Érzelmi pillanat ─────────────────────────────────────────── */
.emo .prompt { font-size: 1.1rem; font-style: italic; }
.emo .choices { display: grid; gap: 12px; margin-top: 8px; }
.choice {
  appearance: none; border: 0; cursor: pointer; text-align: left; width: 100%;
  background: rgba(255,255,255,.07); color: var(--parchment); border-radius: var(--r-md);
  padding: 15px; box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.14); font-size: 1.02rem; font-weight: 600;
  transition: transform .12s var(--ease), box-shadow .2s;
}
.choice:active { transform: scale(.99); }
.choice:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.choice .lead { font-size: 1.2rem; margin-right: 6px; }
.emo-result { animation: screen-in .4s var(--ease) both; }
.heart-pop { font-size: 2.2rem; animation: pop .5s var(--ease) both; }
@keyframes pop { 0% { transform: scale(0); } 70% { transform: scale(1.25); } 100% { transform: scale(1); } }

/* ── Minijáték ────────────────────────────────────────────────── */
.mg-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.mg-progress { font-size: .85rem; color: var(--gold-soft); }
.mg-instr { text-align: center; font-weight: 700; margin: 4px 0 12px; }
.mg-stim { display: grid; place-items: center; margin-bottom: 14px; }
.mg-stim .rune-frame { width: min(44vw, 170px); }
.mg-stim .word-stim { text-align: center; }
.mg-stim .word-stim .we { font-size: 3.4rem; display: block; }
.mg-stim .word-stim .ww { font-size: 1.5rem; font-weight: 800; color: var(--gold); }
.mg-stim .clue-stim { text-align: center; font-size: 1.12rem; font-style: italic; max-width: 28ch; }
.mg-stim .clue-stim .ce { font-size: 2.4rem; display: block; margin-bottom: 6px; }

.options { display: grid; gap: 12px; }
.options.runes { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
.opt {
  appearance: none; border: 0; cursor: pointer; font-family: inherit;
  background: rgba(255,255,255,.07); color: var(--parchment); border-radius: var(--r-md);
  box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.14);
  padding: 14px; min-height: var(--tap); font-size: 1.05rem; font-weight: 700;
  display: grid; place-items: center; gap: 4px;
  transition: transform .12s var(--ease), box-shadow .2s, background .2s;
}
.opt:active { transform: scale(.97); }
.opt:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.opt.rune svg { width: 64px; height: 64px; }
.opt.rune .rune-path { stroke: none; fill: var(--parchment); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; }
.opt.word .oe { font-size: 1.6rem; }
.opt.correct { background: rgba(123, 216, 143, .22); box-shadow: inset 0 0 0 2px var(--good); }
.opt.correct .rune-path { fill: var(--good); }
.opt.wrong { background: rgba(255, 139, 107, .2); box-shadow: inset 0 0 0 2px var(--bad); animation: shake .35s; }
.opt.wrong .rune-path { fill: var(--bad); }
.opt[disabled] { cursor: default; }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-6px)} 75%{transform:translateX(6px)} }

.mg-feedback { text-align: center; min-height: 1.6em; margin-top: 12px; font-weight: 700; }
.mg-feedback.good { color: var(--good); }
.mg-feedback.bad { color: var(--gold-soft); font-weight: 600; font-style: italic; }

/* ── Lecke kész / végjáték ────────────────────────────────────── */
.celebrate { text-align: center; margin-top: 4vh; }
.celebrate .big { font-size: 3.4rem; animation: pop .6s var(--ease) both; }
.summary-row { display: flex; justify-content: center; gap: 18px; font-weight: 800; font-size: 1.2rem; margin: 12px 0; }
.summary-row .s-star { color: var(--star); }
.summary-row .s-heart { color: var(--heart); }
.summary-row .s-rune { color: var(--rune); }

/* Megfejtés */
.dir-hint { display: flex; justify-content: center; align-items: center; gap: 10px; font-size: .82rem; margin-bottom: 8px; opacity: .75; }
.dir-rtl { color: var(--gold-soft); font-style: italic; }
.dir-sep { opacity: .4; }
.dir-ltr { color: var(--good); }

/* Right-to-left reading reminder on practice screens (rovás reads ← unlike Latin).
   Anchored to the right edge of the (position:relative) .screen; non-interactive. */
.rtl-side { position: absolute; right: 2px; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--gold-soft); opacity: .65; pointer-events: none; z-index: 2;
  font-style: italic; text-align: center; }
.rtl-side .rtl-arrow { font-size: 1.5rem; line-height: 1; font-style: normal; }
.rtl-side .rtl-cap { font-size: .64rem; line-height: 1.05; letter-spacing: .02em; }
@media (max-width: 380px) { .rtl-side .rtl-cap { display: none; } .rtl-side { opacity: .55; } }
/* Small build/version label, bottom-right of the home + profile screens. Lets the player
   (and us) tell at a glance whether github.io is serving the latest deploy. Non-interactive. */
.version-badge { position: absolute; right: 8px; bottom: 6px; z-index: 2;
  font-size: .62rem; letter-spacing: .02em; color: var(--gold-soft);
  opacity: .5; pointer-events: none; user-select: none; }
.decode-row { display: flex; justify-content: center; gap: 8px; margin: 16px 0; flex-wrap: wrap; }
.decode-cell { text-align: center; opacity: .25; transition: opacity .5s var(--ease), transform .5s var(--ease); transform: translateY(8px); }
.decode-cell.on { opacity: 1; transform: none; }
.decode-cell svg { width: 46px; height: 46px; }
.decode-cell .rune-path { stroke: none; fill: var(--gold); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; }
.decode-cell .dl { font-weight: 900; font-size: 1.2rem; color: var(--gold); }
.decode-cell .dw { font-size: .7rem; opacity: .8; }
.isten-word { font-size: clamp(2.6rem, 16vw, 4rem); letter-spacing: .22em; font-weight: 900; color: var(--gold); text-align: center; }

/* Záró rovás-rács */
.rune-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 10px; }
.rune-grid .gcell { background: rgba(255,255,255,.06); border-radius: 10px; padding: 6px; text-align: center; box-shadow: inset 0 0 0 1px rgba(255,255,255,.1); }
.rune-grid .gcell svg { width: 100%; height: 38px; }
.rune-grid .gcell .gl { font-size: .7rem; color: var(--gold); font-weight: 700; }
.rune-grid .rune-path { stroke: none; fill: var(--rune); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; }
.rank-badge {
  text-align: center; background: linear-gradient(180deg, rgba(255,206,107,.2), rgba(255,157,77,.08));
  border-radius: var(--r-lg); padding: 18px; box-shadow: inset 0 0 0 2px rgba(255,206,107,.4); margin: 8px 0;
}
.rank-badge .rk { font-size: 1.5rem; font-weight: 900; color: var(--gold); }

/* ── Súgó / onboarding overlay ───────────────────────────────── */
.overlay {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px;
  background: rgba(10, 6, 18, .72); backdrop-filter: blur(4px);
  animation: fade .3s ease both;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%; max-width: 420px; background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border-radius: var(--r-lg); padding: 22px; box-shadow: var(--shadow); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.1), var(--shadow);
  max-height: 86dvh; overflow-y: auto;
}
.modal h2 { color: var(--gold); }
.help-item { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.help-item .hi { font-size: 1.6rem; line-height: 1; }
.help-item .ht { font-size: .95rem; }
.help-item .ht b { color: var(--gold); }

.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(20px);
  z-index: 60; background: rgba(20, 12, 30, .94); color: var(--parchment);
  padding: 12px 18px; border-radius: 999px; box-shadow: var(--shadow); font-weight: 700;
  opacity: 0; transition: opacity .3s, transform .3s var(--ease); max-width: 90%; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.coach {
  position: fixed; z-index: 55; max-width: 280px; background: var(--gold); color: #2a1a08;
  padding: 12px 14px; border-radius: 14px; font-weight: 700; font-size: .95rem; box-shadow: var(--shadow);
  animation: pop .3s var(--ease) both;
}

.footer-actions { margin-top: auto; padding-top: 16px; }
.footer-actions.stack > * + * { margin-top: 10px; }

.skiplink { position: absolute; left: -999px; }
.skiplink:focus { left: 8px; top: 8px; z-index: 80; background: var(--gold); color: #000; padding: 8px 12px; border-radius: 8px; }

/* Háttérzene-vezérlő (music.js) — úszó, képernyőtől független panel */
.musicbar {
  position: fixed; left: 14px; bottom: 14px; z-index: 58;
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  max-width: min(74vw, 250px);
}
/* „Most szól" felirat — apró, visszafogott; csak kinyitva látható */
.music-now {
  max-width: 100%; font-size: .72rem; font-weight: 700; line-height: 1.25;
  color: var(--gold-soft); padding: 4px 10px; border-radius: 999px;
  background: rgba(20, 12, 30, .82); box-shadow: inset 0 0 0 1px rgba(255, 206, 107, .22);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: opacity .3s;
  display: none;
}
.music-expanded .music-now { display: block; }
.music-now.paused { opacity: .55; }
.music-ctrls { display: flex; align-items: center; gap: 8px; }
.musicbtn, .music-skip, .music-expand {
  border: 0; cursor: pointer; border-radius: 50%; line-height: 1;
  display: grid; place-items: center; color: var(--parchment);
  background: rgba(20, 12, 30, .82);
  box-shadow: var(--shadow), inset 0 0 0 1.5px rgba(255, 206, 107, .28);
  -webkit-tap-highlight-color: transparent;
}
/* Előző/következő gombok csak kinyitva láthatók */
.musicbar:not(.music-expanded) .music-skip { display: none; }
.musicbtn { width: 46px; height: 46px; font-size: 1.2rem; }
.music-skip { width: 38px; height: 38px; font-size: .95rem; }
.music-expand { width: 28px; height: 28px; font-size: .85rem; opacity: .7; }
.musicbtn:hover, .music-skip:hover, .music-expand:hover { background: rgba(35, 22, 48, .92); }
.music-expand:hover { opacity: 1; }
.musicbtn:focus-visible, .music-skip:focus-visible, .music-expand:focus-visible { outline: 3px solid var(--gold-soft); outline-offset: 2px; }
.musicbtn.playing { box-shadow: var(--shadow), inset 0 0 0 1.5px rgba(255, 206, 107, .6); }
@media (prefers-reduced-motion: no-preference) {
  .musicbtn.playing { animation: musicPulse 2.6s ease-in-out infinite; }
}
@keyframes musicPulse {
  0%, 100% { box-shadow: var(--shadow), inset 0 0 0 1.5px rgba(255, 206, 107, .6), 0 0 0 0 rgba(255, 157, 77, .35); }
  50%      { box-shadow: var(--shadow), inset 0 0 0 1.5px rgba(255, 206, 107, .8), 0 0 0 7px rgba(255, 157, 77, 0); }
}

/* ── Profilok ──────────────────────────────────────────────────── */
.profiles { display: flex; flex-direction: column; gap: 12px; justify-content: center; }
.profile-row { display: flex; gap: 8px; align-items: stretch; }
.profile {
  appearance: none; border: 0; cursor: pointer; flex: 1; text-align: left;
  display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: var(--r-md);
  background: linear-gradient(180deg, rgba(255,255,255,.09), rgba(255,255,255,.05)); color: var(--parchment);
  box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.12);
}
.profile:active { transform: scale(.99); }
.profile:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.profile .pavatar { font-size: 2.2rem; }
.profile .pname { font-weight: 800; font-size: 1.15rem; flex: 1; }
.profile .parrow { font-size: .85rem; color: var(--gold-soft); }
.small-del { width: 44px; height: auto; min-width: 44px; font-size: 1.05rem; border-radius: var(--r-md); }
.newprofile { margin-top: 6px; }

/* Űrlapmezők */
.pf-form { justify-content: center; display: flex; flex-direction: column; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: .9rem; color: var(--gold-soft); font-weight: 700; }
.txt {
  font-family: inherit; font-size: 1.1rem; padding: 13px 14px; border-radius: var(--r-md);
  border: 0; box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.18); background: rgba(255,255,255,.95);
  color: #2a2018; width: 100%;
}
.txt:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.chars2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.char.mini { padding: 12px 8px; }
.char.mini .face { font-size: 2.4rem; margin-bottom: 2px; }
.char.mini.sel { box-shadow: inset 0 0 0 2.5px var(--gold), 0 0 16px rgba(255,206,107,.25); background: rgba(255,206,107,.12); }
.form-error { color: var(--bad); font-weight: 700; min-height: 1.2em; font-size: .92rem; }

/* ── Falu-eszközök (gyakorlás / vizsga) ───────────────────────── */
.village-tools { display: flex; gap: 10px; margin: 4px 0 2px; }
.vtool {
  appearance: none; border: 0; cursor: pointer; flex: 1; display: flex; align-items: center; gap: 8px;
  justify-content: center; padding: 13px; border-radius: var(--r-md); font-weight: 800; font-size: 1rem;
  color: var(--parchment); background: linear-gradient(180deg, rgba(201,182,240,.16), rgba(201,182,240,.07));
  box-shadow: inset 0 0 0 1.5px rgba(201,182,240,.3);
}
.vtool:active { transform: scale(.98); }
.vtool:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.vtool .vt-ic { font-size: 1.3rem; }

/* ── Rajzfelület ──────────────────────────────────────────────── */
.draw-wrap { display: grid; place-items: center; margin: 8px 0; }
.drawpad {
  border-radius: var(--r-lg); touch-action: none; cursor: crosshair;
  background: radial-gradient(circle at 50% 42%, rgba(255,206,107,.10), rgba(0,0,0,.22));
  box-shadow: inset 0 0 0 2px rgba(255,206,107,.28), var(--shadow);
}
.draw-controls { display: flex; gap: 10px; justify-content: center; margin-top: 4px; }
.draw-controls .btn { width: auto; }

/* ── Vizsga-csempék ───────────────────────────────────────────── */
.exam-tests { display: flex; flex-direction: column; gap: 12px; }
.exam-test {
  appearance: none; border: 0; cursor: pointer; text-align: left; display: flex; align-items: center; gap: 14px;
  padding: 14px; border-radius: var(--r-md); color: var(--parchment);
  background: linear-gradient(180deg, rgba(255,255,255,.09), rgba(255,255,255,.05)); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.12);
}
.exam-test:active { transform: scale(.99); }
.exam-test:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.exam-test[disabled] { opacity: .5; filter: grayscale(.4); cursor: not-allowed; }
.exam-test .et-ic { font-size: 1.9rem; }
.exam-test .et-meta { flex: 1; display: flex; flex-direction: column; }
.exam-test .et-title { font-weight: 800; font-size: 1.05rem; }
.exam-test .et-desc { font-size: .82rem; opacity: .8; }
.exam-test .et-best { font-weight: 800; color: var(--gold); }
.final-exam { margin-top: 4px; }
.big-score { font-size: 3rem; font-weight: 900; color: var(--gold); margin: 6px 0; }

/* ── Rovás-szó sorok (szófelismerés) ──────────────────────────── */
.runerow { display: inline-flex; gap: 4px; align-items: center; flex-wrap: wrap; justify-content: center; }
.runerow .rr { width: 34px; height: 34px; }
.runerow .rr svg { width: 100%; height: 100%; }
.runerow .rune-path, .word-runes .rune-path, .wordrow-opt .rune-path { fill: var(--parchment); }
.word-runes { padding: 10px; }
.word-runes .rr { width: 46px; height: 46px; }
.word-runes .rune-path { fill: var(--gold); }
.options.wordrows { grid-template-columns: 1fr; }
.opt.wordrow-opt { padding: 12px; }
.opt.wordrow-opt.correct .rune-path { fill: var(--good); }
.opt.wordrow-opt.wrong .rune-path { fill: var(--bad); }

/* ── Szó-cellák (szórajzolás) ─────────────────────────────────── */
.wordcells { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 8px 0; }
.wordcell { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.wordcell .drawpad { border-radius: 12px; }
.wc-target { font-weight: 800; font-size: 1.05rem; color: var(--gold); line-height: 1; }
.wc-lbl { font-weight: 800; min-height: 1.2em; }
.wc-lbl.good { color: var(--good); }
.wc-lbl.bad { color: var(--bad); }
/* Per-cell clear button under each word-draw cell (a child fixes one cell without
   wiping the others). Compact so 6-cell words (Dzsungel) still fit on a phone. */
.wc-clear { width: auto; min-height: 30px; padding: 4px 12px; font-size: .78rem; font-weight: 700; }

/* A háttérzene-sáv (music.js) úszó eleme ne fogja el a kattintást az üres
   területén — csak a tényleges vezérlői legyenek interaktívak. Így nem takarja
   ki a képernyők alsó gombjait. (A megjelenés változatlan.) */
.musicbar { pointer-events: none; }
.musicbar > * { pointer-events: auto; }
/* Keskeny (mobil) nézetben az úszó zenevezérlő a képernyő bal alsó sarkában ül,
   ezért az alsó tartalom kapjon helyet, hogy a gombok a sáv FÖLÉ kerüljenek.
   Szélesebb, keretezett nézetben a sáv az #app-on kívülre esik — ott nem kell. */
@media (max-width: 539px) {
  .screen { padding-bottom: 96px; }
}

/* ── Rovásemlék-kártya (lecke végén) ──────────────────────────── */
.relic-card {
  margin: 6px 0 2px; padding: 14px; border-radius: var(--r-lg); text-align: center;
  background: linear-gradient(180deg, rgba(201, 182, 240, .12), rgba(255, 206, 107, .06));
  box-shadow: inset 0 0 0 1.5px rgba(201, 182, 240, .3);
}
.relic-tag { color: var(--rune); font-weight: 800; font-size: .76rem; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 8px; }
.relic-img {
  max-width: 100%; max-height: 260px; border-radius: var(--r-md); display: block; margin: 0 auto;
  box-shadow: var(--shadow), 0 0 0 4px rgba(244, 232, 207, .9); background: #f4e8cf;
}
.relic-runes { display: flex; justify-content: center; padding: 14px 6px; }
.relic-runes .rr { width: 40px; height: 46px; }
.relic-runes .rune-path { fill: var(--gold); }
.relic-cap { font-size: .92rem; margin-top: 10px; line-height: 1.45; }
.relic-cap b { color: var(--gold); }
.relic-cap .muted { font-size: .85rem; margin: 2px 0 4px; }

/* ── Számrovás (overlay) ──────────────────────────────────────── */
.numsigns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 10px 0; }
.numsign { text-align: center; background: rgba(255, 255, 255, .06); border-radius: 12px; padding: 8px 4px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1); }
.numsvg { width: 40px; height: 40px; }
.numsvg path { fill: none; stroke: var(--gold); stroke-width: 8; stroke-linecap: round; stroke-linejoin: round; }
.numsign .nv { font-weight: 800; color: var(--gold); }
.numsign .nd { font-size: .72rem; opacity: .8; }
.numexamples { display: flex; flex-direction: column; gap: 8px; }
.numex { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.numex .ne-n { font-weight: 800; font-size: 1.1rem; min-width: 3ch; }
.numex .ne-eq { opacity: .7; }
.numex .ne-r { display: inline-flex; gap: 2px; }
.numex .ne-r .numsvg { width: 26px; height: 30px; }
.numex .muted { font-size: .8rem; width: 100%; }

/* ── Rovás ábécék bemutató ────────────────────────────────────── */
.village-tools { flex-wrap: wrap; }
.village-tools .vtool { flex: 1 1 44%; }
.abc-block { margin: 14px 0; }
.abc-block h3 { color: var(--gold); margin-bottom: 6px; }
.abc-img { width: 100%; border-radius: var(--r-md); background: #f4e8cf; box-shadow: var(--shadow), 0 0 0 4px rgba(244, 232, 207, .8); display: block; }
.abc-grid { grid-template-columns: repeat(8, 1fr); gap: 6px; }
.abc-grid .gcell { padding: 4px; }
.abc-grid .gl { font-size: .6rem; }
.style-toggle { margin: 12px 0 18px; }
.style-toggle h3 { color: var(--gold); }
.seg { display: flex; gap: 0; border-radius: var(--r-md); overflow: hidden; box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.18); }
.seg-btn {
  flex: 1; min-height: var(--tap); padding: 10px 12px; border: 0; cursor: pointer;
  font: inherit; font-weight: 700; color: var(--parchment);
  background: rgba(255,255,255,.04); transition: background .15s, color .15s;
}
.seg-btn + .seg-btn { box-shadow: inset 1.5px 0 0 rgba(255,255,255,.18); }
.seg-btn.on { background: linear-gradient(180deg, var(--gold), var(--ember)); color: var(--ink); }
.seg-btn:focus-visible { outline: 3px solid var(--gold-soft); outline-offset: -3px; }
/* Difficulty: reuses .card.dim + .seg on the village hub; full-description picker after creation */
.difficulty-toggle { margin: 18px 0 4px; }
.difficulty-toggle h3 { color: var(--gold); }
.diff-opts { gap: 12px; margin-top: 8px; }
.diff-opt {
  display: flex; flex-direction: column; gap: 4px; text-align: left;
  padding: 14px 16px; border: 0; cursor: pointer; border-radius: var(--r-md);
  font: inherit; color: var(--parchment);
  background: rgba(255,255,255,.05); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.18);
  transition: background .15s, box-shadow .15s;
}
.diff-opt.sel { box-shadow: inset 0 0 0 2.5px var(--gold), 0 0 16px rgba(255,206,107,.25); background: rgba(255,206,107,.12); }
.diff-opt:focus-visible { outline: 3px solid var(--gold-soft); outline-offset: 2px; }
.diff-name { font-weight: 800; font-size: 1.1rem; color: var(--gold); }
.diff-desc { font-size: .85rem; }
/* Language switcher (intro + profiles screens) — flag + native-name dropdown.
   With 15 locales a flat row no longer fits a phone, so it's a <details> popover. */
.lang-dd { position: relative; width: max-content; max-width: 100%; margin: 14px auto 4px; }
.flag { width: 22px; height: 15px; border-radius: 2px; flex: 0 0 auto;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.25); display: block; }
.lang-current {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: 8px;
  min-height: 36px; padding: 6px 12px; border-radius: var(--r-md);
  font: inherit; font-size: .9rem; font-weight: 700; color: var(--parchment);
  background: rgba(255,255,255,.05); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.18);
  transition: background .15s;
}
.lang-current::-webkit-details-marker { display: none; }
.lang-current:hover { background: rgba(255,255,255,.1); }
.lang-dd[open] .lang-current { background: rgba(255,255,255,.12); }
.lang-dd > summary:focus-visible { outline: 3px solid var(--gold-soft); outline-offset: 2px; }
.lang-caret { width: 10px; height: 6px; margin-left: 2px; opacity: .7; transition: transform .15s; }
.lang-dd[open] .lang-caret { transform: rotate(180deg); }
.lang-menu {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: calc(100% + 6px);            /* opens UPWARD — the switcher sits low on the screen */
  width: 230px; max-width: 86vw; max-height: 50vh; overflow-y: auto;
  padding: 6px; border-radius: var(--r-md); z-index: 40;
  background: #20140c; box-shadow: 0 10px 30px rgba(0,0,0,.5), inset 0 0 0 1.5px rgba(255,255,255,.14);
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
}
.lang-opt {
  display: flex; align-items: center; gap: 8px; cursor: pointer; text-align: left;
  padding: 7px 9px; border-radius: var(--r-sm); border: 0;
  font: inherit; font-size: .86rem; font-weight: 600; color: var(--parchment);
  background: transparent; transition: background .12s;
}
.lang-opt:hover { background: rgba(255,255,255,.08); }
.lang-opt.on { background: rgba(212,160,68,.18); color: var(--gold); }
.lang-opt:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: 1px; }
.lang-name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lang-tick { flex: 0 0 auto; color: var(--gold); font-weight: 800; }
@media (max-width: 360px) { .lang-menu { grid-template-columns: 1fr; width: 200px; } }

.why-list { margin: 6px 0 0; padding-left: 18px; }
.why-list li { margin-bottom: 6px; font-size: .92rem; line-height: 1.4; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .ember { display: none; }
}
