:root {
  --bg: #2b2420;
  --ink: #fffaf0;
  --wood: #8a5a36;
  --wood-d: #5e3a20;
  --cream: #fff4dc;
  --red: #e2483b;
  --green: #3fb36a;
  --yellow: #ffd23a;
  --blue: #3a7bd5;
  --glass: rgba(255, 250, 240, .9);
  --ui: "Fredoka", "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: #3a2a1e; 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: 3px solid var(--blue); outline-offset: 3px; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.icon { width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; background: var(--glass); color: #4a3626; box-shadow: 0 3px 0 rgba(0,0,0,.18), 0 6px 14px rgba(0,0,0,.18); transition: transform .12s, opacity .15s; }
.icon:hover { transform: translateY(-1px); }
.icon:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,.18); }
.icon:disabled { opacity: .4; cursor: default; transform: none; }
#hud { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 12px); right: 12px; }
#hud .right { display: flex; gap: 8px; }
#btnSound .mute { display: none; }
#btnSound[aria-pressed="false"] .wave { display: none; }
#btnSound[aria-pressed="false"] .mute { display: inline; }
#btnNight .moon { display: none; }
#btnNight[aria-pressed="true"] .sun { display: none; }
#btnNight[aria-pressed="true"] .moon { display: inline; }
#btnNight[aria-pressed="true"] { background: #2a3150; color: var(--yellow); }
#camCtl { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 8px; }

/* alsó dokk: főkapcsoló + eszköztár */
#dock { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 12px calc(env(safe-area-inset-bottom, 0px) + 10px); display: flex; align-items: flex-end; gap: 10px; pointer-events: none; }
#dock > * { pointer-events: auto; }
#tools { flex: 1; min-width: 0; display: flex; gap: 8px; overflow-x: auto; padding: 8px; border-radius: 22px; background: linear-gradient(#a06a40, #7a4c2a); box-shadow: inset 0 2px 0 rgba(255,255,255,.2), 0 6px 18px rgba(0,0,0,.3); scrollbar-width: none; }
#tools::-webkit-scrollbar { display: none; }
.tool { flex: none; width: 58px; height: 58px; border-radius: 16px; display: grid; place-items: center; background: var(--cream); color: #5a3e28; box-shadow: 0 3px 0 rgba(0,0,0,.25); transition: transform .12s, background .15s; }
.tool svg { width: 30px; height: 30px; }
.tool:active { transform: translateY(2px); }
.tool[aria-pressed="true"] { background: var(--yellow); color: #3a2a1e; transform: translateY(-4px); box-shadow: 0 6px 0 rgba(0,0,0,.25), 0 0 0 3px #fff; }
.tool .dot { position: absolute; }
.tool[data-tool="eraser"][aria-pressed="true"] { background: #ffb3a8; }

/* főkapcsoló */
.power { flex: none; width: 86px; height: 86px; border-radius: 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; background: linear-gradient(#5a5f68, #3a3e46); box-shadow: inset 0 2px 0 rgba(255,255,255,.2), 0 6px 18px rgba(0,0,0,.35); }
.power .lamp { width: 18px; height: 18px; border-radius: 50%; background: #8a1a14; box-shadow: inset 0 -2px 3px rgba(0,0,0,.4); transition: background .2s, box-shadow .2s; }
.power[aria-pressed="true"] .lamp { background: #4dff7a; box-shadow: 0 0 14px #4dff7a, inset 0 -2px 3px rgba(0,0,0,.2); }
.power[aria-pressed="false"] .lamp { background: #ff4a3a; box-shadow: 0 0 10px rgba(255,74,58,.7); }
.power .slot { position: relative; width: 54px; height: 24px; border-radius: 12px; background: #1e2026; box-shadow: inset 0 2px 4px rgba(0,0,0,.6); }
.power .lever { position: absolute; top: -5px; left: 2px; width: 26px; height: 34px; border-radius: 10px; background: linear-gradient(#ffe066, #e6a91e); box-shadow: 0 3px 0 #a87412; transition: left .25s cubic-bezier(.4,1.6,.5,1); }
.power[aria-pressed="true"] .lever { left: 26px; }

/* rétegek */
.overlay { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; z-index: 5; background: radial-gradient(ellipse at 50% 45%, rgba(30,20,12,.05), rgba(30,20,12,.7)); }
.overlay.dim { background: rgba(30, 20, 12, .45); }
.titlebox { display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; animation: rise 1s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.emblem svg { width: 86px; height: 86px; stroke: var(--yellow); stroke-width: 3; filter: drop-shadow(0 3px 0 rgba(0,0,0,.35)); }
h1 { margin: 0; font: 700 clamp(46px, 11vw, 96px)/1 var(--ui); color: var(--cream); letter-spacing: .02em; text-shadow: 0 4px 0 #a0522d, 0 8px 18px rgba(0,0,0,.4); }
.row { display: flex; gap: 14px; align-items: center; }
.big { width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; background: var(--green); color: #fff; box-shadow: 0 5px 0 #23784a, 0 10px 24px rgba(0,0,0,.35); transition: transform .15s; }
.big:hover { transform: scale(1.06); }
.big svg { width: 38px; height: 38px; fill: currentColor; }
.big.ghost { width: 62px; height: 62px; background: var(--cream); color: #6a4a30; box-shadow: 0 4px 0 #b89a70; }
.big.ghost svg { width: 28px; height: 28px; fill: none; }
.ask { background: var(--cream); border-radius: 26px; padding: 22px 28px; display: flex; flex-direction: column; align-items: center; gap: 18px; box-shadow: 0 8px 0 #b89a70, 0 18px 40px rgba(0,0,0,.4); animation: pop .3s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes pop { from { opacity: 0; transform: scale(.85); } }
.big-ic { width: 56px; height: 56px; color: var(--red); }
.round { width: 70px; height: 70px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.round svg { width: 34px; height: 34px; stroke-width: 3; }
.round.yes { background: var(--green); box-shadow: 0 5px 0 #23784a; }
.round.no { background: var(--red); box-shadow: 0 5px 0 #a0281e; }

#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%, #4a3a2c, #1e1712); transition: opacity .6s; }
#loader img { width: min(180px, 40vw); height: auto; }
#loader .bar { width: min(220px, 60vw); height: 6px; border-radius: 3px; background: rgba(255,255,255,.12); overflow: hidden; }
#loader .bar i { display: block; height: 100%; width: 0; background: var(--yellow); transition: width .3s; }
#loader.out { opacity: 0; pointer-events: none; }
@media (max-width: 560px) {
  .tool { width: 50px; height: 50px; border-radius: 14px; } .tool svg { width: 26px; height: 26px; }
  .power { width: 70px; height: 70px; border-radius: 20px; } .power .slot { width: 46px; height: 20px; } .power .lever { width: 22px; height: 28px; } .power[aria-pressed="true"] .lever { left: 22px; }
  .icon { width: 42px; height: 42px; border-radius: 14px; }
  #camCtl { top: auto; bottom: calc(env(safe-area-inset-bottom, 0px) + 96px); transform: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
