:root {
  color-scheme: dark;
  --bg: #1b241c;
  --moss: #9fb08a;
  --leaf: #a6d86e;
  --gold: #e9c77b;
  --ink: #eef3e6;
  --muted: #b9c4ad;
  --glass: rgba(18, 26, 20, .62);
  --card: #1e2a20;
  --card2: #263428;
  --bad: #ff8a7a;
  --display: "Cinzel Decorative", "Cinzel", Georgia, serif;
  --ui: "Nunito", system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; overflow: hidden; background: var(--bg); }
body { color: var(--ink); font-family: var(--ui); user-select: none; -webkit-user-select: none; }
#app { position: fixed; inset: 0; }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:focus-visible { outline: 2px solid var(--leaf); outline-offset: 3px; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* HUD */
#hud { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 12px); left: 12px; right: 12px; display: flex; justify-content: space-between; align-items: center; pointer-events: none; }
#hud > * { pointer-events: auto; }
#hud .right { display: flex; gap: 8px; }
.icon { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--glass); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); box-shadow: inset 0 0 0 1px rgba(159,176,138,.35); transition: color .15s, box-shadow .15s, opacity .15s; }
.icon:hover { box-shadow: inset 0 0 0 1px var(--leaf); color: var(--leaf); }
.icon:disabled { opacity: .35; cursor: default; }
.pill { height: 46px; padding: 0 16px 0 12px; border-radius: 23px; display: flex; align-items: center; gap: 8px; background: var(--glass); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); box-shadow: inset 0 0 0 1px rgba(166,216,110,.5); color: var(--leaf); font-weight: 800; font-size: 17px; font-variant-numeric: tabular-nums; }
.pill:hover { box-shadow: inset 0 0 0 2px var(--leaf); }
.pill.bump { animation: bump .6s ease; }
@keyframes bump { 40% { transform: scale(1.15); box-shadow: inset 0 0 0 2px var(--gold), 0 0 22px rgba(233,199,123,.6); color: var(--gold); } }
#btnSound .mute { display: none; }
#btnSound[aria-pressed="false"] .wave { display: none; }
#btnSound[aria-pressed="false"] .mute { display: inline; }
#btnGfx[aria-pressed="true"] { color: var(--gold); }
#camCtl { position: absolute; right: 12px; bottom: calc(env(safe-area-inset-bottom, 0px) + 14px); display: flex; flex-direction: column; gap: 8px; }

/* zónanév-szalag */
#zoneBanner { position: absolute; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 72px); transform: translate(-50%, -8px); display: flex; flex-direction: column; align-items: center; gap: 2px; opacity: 0; transition: opacity .8s, transform .8s; pointer-events: none; text-align: center; }
#zoneBanner.on { opacity: 1; transform: translate(-50%, 0); }
#zoneBanner b { font: 700 clamp(26px, 6vw, 44px)/1.1 var(--display); color: var(--ink); text-shadow: 0 2px 12px rgba(0,0,0,.7); letter-spacing: .04em; }
#zoneBanner span { font-weight: 700; color: var(--gold); text-shadow: 0 1px 6px rgba(0,0,0,.8); }

/* rétegek */
.overlay { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; background: radial-gradient(ellipse at 50% 50%, rgba(10,16,12,.1), rgba(8,12,9,.85)); z-index: 5; }
.overlay.dim { background: rgba(8, 12, 9, .55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.titlebox { display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; max-width: 520px; animation: rise 1.2s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.emblem svg { width: 80px; height: 80px; stroke: var(--leaf); stroke-width: 2.2; filter: drop-shadow(0 0 10px rgba(166,216,110,.5)); }
.emblem.sun svg { stroke: var(--gold); filter: drop-shadow(0 0 14px rgba(233,199,123,.7)); width: 100px; height: 100px; animation: spin 20s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
h1 { margin: 0; font: 700 clamp(42px, 10vw, 88px)/1 var(--display); letter-spacing: .05em; text-shadow: 0 0 30px rgba(166,216,110,.3), 0 3px 0 rgba(0,0,0,.5); }
.endT { margin: 0; font: 700 clamp(24px, 5vw, 36px)/1.2 var(--display); color: var(--gold); }
.sub { margin: 0; color: var(--muted); font-size: 18px; line-height: 1.45; text-wrap: balance; }
.row { display: flex; gap: 14px; margin-top: 6px; }
.big { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; background: rgba(166,216,110,.14); box-shadow: inset 0 0 0 2px var(--leaf), 0 0 24px rgba(166,216,110,.3); color: var(--leaf); transition: transform .2s; }
.big:hover { transform: scale(1.06); }
.big svg { width: 34px; height: 34px; }
#btnPlay svg, #btnContinue svg { fill: currentColor; }
.big.ghost { background: transparent; box-shadow: inset 0 0 0 2px rgba(159,176,138,.5); color: var(--moss); width: 60px; height: 60px; align-self: center; }

/* karakterválasztó */
.pick { display: flex; gap: 12px; }
.ch { min-width: 116px; padding: 10px 16px; border-radius: 16px; display: flex; flex-direction: column; align-items: center; gap: 6px; font-weight: 800; font-size: 16px; color: var(--moss); background: rgba(18,26,20,.55); box-shadow: inset 0 0 0 2px rgba(159,176,138,.35); transition: transform .15s, color .15s, box-shadow .15s, background .15s; }
.ch svg { width: 34px; height: 34px; }
.ch:hover { transform: translateY(-2px); }
.ch[aria-checked="true"] { color: var(--gold); background: rgba(233,199,123,.14); box-shadow: inset 0 0 0 2px var(--gold), 0 0 18px rgba(233,199,123,.3); }

/* állatkártya */
.card { position: relative; width: min(440px, 100%); max-height: calc(100% - 8px); overflow: auto; background: var(--card); border-radius: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.55), inset 0 0 0 1px rgba(166,216,110,.25); animation: pop .35s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes pop { from { opacity: 0; transform: scale(.9) translateY(10px); } }
.close { position: absolute; top: 10px; right: 10px; z-index: 2; }
.pic { aspect-ratio: 4 / 3; background: linear-gradient(160deg, #2e4430, #1a2519); border-radius: 22px 22px 0 0; overflow: hidden; }
.pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cbody { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 10px; }
.tag { align-self: flex-start; font-size: 13px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--gold); background: rgba(233,199,123,.12); padding: 4px 10px; border-radius: 999px; }
.card h2 { margin: 0; font: 700 28px/1.15 var(--display); color: var(--ink); }
.card p { margin: 0; font-size: 17px; line-height: 1.5; color: #dbe4d0; user-select: text; -webkit-user-select: text; }
.acts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.act { position: relative; min-height: 54px; border-radius: 14px; display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 800; font-size: 17px; background: rgba(166,216,110,.14); color: var(--leaf); box-shadow: inset 0 0 0 2px rgba(166,216,110,.6); transition: transform .12s, background .15s; }
.act:hover { background: rgba(166,216,110,.24); }
.act:active { transform: scale(.97); }
.act.on { background: rgba(166,216,110,.3); }
.act .chk { display: none; position: absolute; top: -7px; right: -7px; width: 24px; height: 24px; border-radius: 50%; background: var(--gold); color: #1e2a20; font-style: normal; font-size: 15px; line-height: 24px; text-align: center; }
.act.done .chk { display: block; }
.hint { color: var(--gold) !important; font-weight: 700; font-size: 16px !important; text-align: center; min-height: 0; }
.hint:empty { display: none; }
.foods { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.food { border-radius: 14px; padding: 10px 4px 8px; background: var(--card2); box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 13px; font-weight: 700; color: var(--muted); line-height: 1.15; text-align: center; transition: transform .12s, background .2s, opacity .2s; }
.food .em { font-size: 34px; line-height: 1.1; }
.food:hover { background: #2f402f; }
.food.ok { background: rgba(166,216,110,.35); color: var(--ink); box-shadow: inset 0 0 0 2px var(--leaf); transform: scale(1.06); }
.food.bad { opacity: .45; box-shadow: inset 0 0 0 2px var(--bad); animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* album */
.sheet { width: min(760px, 100%); max-height: calc(100% - 8px); display: flex; flex-direction: column; background: var(--card); border-radius: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.55), inset 0 0 0 1px rgba(166,216,110,.25); overflow: hidden; animation: pop .35s ease both; }
.sheet header { position: relative; display: flex; align-items: baseline; gap: 12px; padding: 18px 70px 12px 20px; border-bottom: 1px solid rgba(255,255,255,.07); }
.sheet header h2 { margin: 0; font: 700 26px/1.1 var(--display); }
#alCount { color: var(--leaf); font-weight: 800; font-size: 18px; font-variant-numeric: tabular-nums; }
.sheet header .close { top: 10px; }
#alBody { overflow: auto; padding: 8px 20px 20px; }
.zone h3 { margin: 16px 0 10px; font-size: 15px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--gold); display: flex; justify-content: space-between; }
.zone h3 span { color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: 10px; }
.acard { border-radius: 14px; overflow: hidden; background: var(--card2); box-shadow: inset 0 0 0 1px rgba(255,255,255,.07); text-align: left; display: flex; flex-direction: column; transition: transform .12s; }
.acard:hover { transform: translateY(-2px); }
.acard .th { aspect-ratio: 4 / 3; background: #1a2519; overflow: hidden; display: grid; place-items: center; }
.acard .th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.acard .nm { padding: 7px 9px 2px; font-weight: 800; font-size: 14px; line-height: 1.2; }
.acard .st { padding: 0 9px 8px; display: flex; gap: 6px; color: rgba(255,255,255,.25); }
.acard .st svg { width: 16px; height: 16px; }
.acard .st .on { color: var(--gold); }
.acard.locked { cursor: default; }
.acard.locked .th { color: rgba(255,255,255,.18); font: 700 40px/1 var(--display); }
.acard.locked .nm { color: rgba(255,255,255,.35); font-weight: 700; }

#loader { position: absolute; inset: 0; z-index: 10; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; background: radial-gradient(ellipse at 50% 40%, #243226, #0f150f); transition: opacity .6s; }
#loader img { width: min(180px, 40vw); height: auto; }
#loader .bar { width: min(220px, 60vw); height: 4px; background: rgba(255,255,255,.1); overflow: hidden; }
#loader .bar i { display: block; height: 100%; width: 0; background: var(--leaf); transition: width .3s; }
#loader.out { opacity: 0; pointer-events: none; }
@media (max-width: 420px) { .card h2 { font-size: 24px; } .card p { font-size: 16px; } .food .em { font-size: 30px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
