* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font-family: var(--font-display); }
body { touch-action: none; user-select: none; -webkit-user-select: none; }
.hidden { display: none !important; }
.grad { background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
.glass { background: var(--surface); border: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: var(--shadow); }

#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

/* top bar */
#top { position: fixed; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: max(10px, env(safe-area-inset-top)) 14px 10px; pointer-events: none; z-index: 5; }
#top > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); }
.brand img { border-radius: 50%; }
.brand b { font-weight: 700; font-size: 15px; display: block; line-height: 1.05; }
.brand i { font-style: normal; color: var(--brand); }
.brand small { font: 500 8px/1 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .18em; color: var(--muted); }
.tools { display: flex; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 600 13px var(--font-display); border-radius: 999px; padding: 7px 12px; cursor: pointer; }
.chip:hover { border-color: var(--brand); }

.hud { display: none; gap: 8px; align-items: stretch; }
body.playing .hud { display: flex; }
body.playing .brand span { display: none; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 5px 12px; text-align: center; min-width: 58px; backdrop-filter: blur(10px); }
.stat small { display: block; font: 500 9px/1.2 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .12em; color: var(--muted); text-transform: uppercase; }
.stat b { font-size: 20px; font-weight: 800; }
.stat.lives { display: flex; align-items: center; font-size: 15px; letter-spacing: 1px; }
#speedV { font-size: 11px; color: var(--brand); }

/* camera preview */
#camBox { position: fixed; right: 12px; bottom: 12px; width: min(190px, 34vw); aspect-ratio: 4/3; border-radius: 14px; overflow: hidden; z-index: 4; }
#camBox video, #camBox canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
#camState { position: absolute; left: 8px; top: 6px; font: 700 12px ui-monospace, Menlo, Consolas, monospace; color: var(--ok); text-shadow: 0 1px 3px #000; }

#hint { position: fixed; left: 50%; top: 22%; transform: translateX(-50%); padding: 10px 18px; border-radius: 999px; background: rgba(239, 68, 68, .88); font-weight: 700; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 6; text-align: center; }
#hint.on { opacity: 1; }

#countWrap { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; z-index: 6; }
#count { font-size: min(26vw, 220px); font-weight: 800; background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; text-shadow: 0 0 40px var(--glow); }
#count.pop { animation: pop .5s ease-out; }
@keyframes pop { from { transform: scale(1.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
#countHint { max-width: 520px; padding: 8px 18px; text-align: center; color: var(--ink); background: var(--surface); border-radius: 14px; font-size: 15px; }

/* touch pads (μόνο σε mode πληκτρολόγιο/αφή, όταν παίζεις) */
.pad { display: none; position: fixed; bottom: 0; top: 18%; width: 50%; border: 0; background: transparent; color: rgba(248, 250, 252, .35); font-size: 42px; z-index: 3; align-items: flex-end; padding-bottom: 14px; }
#padL { left: 0; justify-content: flex-start; padding-left: 22px; }
#padR { right: 0; justify-content: flex-end; padding-right: 22px; }
body.m-keys.playing .pad { display: flex; }

#wrdebug { position: fixed; left: 10px; bottom: 10px; margin: 0; padding: 6px 10px; font: 11px/1.4 ui-monospace, Menlo, Consolas, monospace; background: rgba(0, 0, 0, .7); color: #A7F3D0; border-radius: 8px; z-index: 9; pointer-events: none; white-space: pre; }

/* screens */
.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 70px 14px 14px; z-index: 7; background: radial-gradient(ellipse at 50% 35%, rgba(6, 9, 14, .35), rgba(6, 9, 14, .78)); overflow: auto; }
.card { width: min(560px, 100%); border-radius: var(--radius); padding: 26px 24px; text-align: center; }
.card h1 { margin: 0 0 6px; font-size: clamp(36px, 8vw, 54px); font-weight: 800; letter-spacing: -.02em; }
.card h2 { margin: 0 0 10px; font-size: 30px; font-weight: 800; }
.tag { margin: 0 0 18px; color: var(--muted); line-height: 1.45; }
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 10px; }
.mode { border: 1px solid var(--line); background: rgba(30, 41, 59, .6); color: var(--ink); border-radius: 16px; padding: 12px 6px; cursor: pointer; font-family: inherit; display: flex; flex-direction: column; gap: 4px; align-items: center; transition: border-color .15s, background .15s, transform .15s; }
.mode:hover { transform: translateY(-2px); }
.mode.sel { border-color: var(--brand); background: rgba(56, 189, 248, .14); box-shadow: 0 0 0 1px var(--brand), 0 8px 24px var(--glow); }
.mode .ico { font-size: 28px; }
.mode b { font-size: 13px; font-weight: 700; }
.mode small { font-size: 11px; color: var(--muted); line-height: 1.25; }
.mhint { min-height: 2.6em; margin: 8px 0 14px; font-size: 13px; color: var(--brand); }
.err { margin: 0 0 14px; padding: 10px 12px; border-radius: 12px; background: rgba(239, 68, 68, .14); border: 1px solid rgba(239, 68, 68, .45); font-size: 13px; text-align: left; }
.err code { display: block; margin-top: 6px; font: 11px ui-monospace, Menlo, Consolas, monospace; color: #FCA5A5; word-break: break-word; }
.btn { display: block; width: 100%; border: 0; border-radius: 999px; padding: 15px 22px; font: 700 17px var(--font-display); color: #fff; background: var(--grad-btn); cursor: pointer; box-shadow: 0 10px 28px var(--glow); }
.btn:hover:not(:disabled) { filter: brightness(1.1); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn.ghost { margin-top: 10px; background: transparent; border: 1px solid var(--line); box-shadow: none; font-size: 14px; color: var(--ink); }
.priv { margin: 14px 0 0; font-size: 11px; color: var(--muted); }

/* χειρονομίες μενού (εμφανίζονται μόνο όταν η κάμερα «ακούει» χειρονομίες: body.gest) */
.gbar { display: none; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
body.gest .gbar { display: block; }
.gbar p { margin: 0 0 10px; font: 500 10px/1.3 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.gchips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.gchip { --p: 0%; position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border-radius: 14px; border: 1px solid var(--line); background: rgba(30, 41, 59, .6); transition: border-color .15s, transform .15s; }
.gchip::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: var(--p); background: rgba(56, 189, 248, .35); transition: width .08s linear; }
.gchip > * { position: relative; }
.gchip i { font-style: normal; font-size: 30px; line-height: 1.1; }
.gchip b { font-size: 12px; font-weight: 700; }
.gchip.main { border-color: rgba(56, 189, 248, .55); }
.gchip.on { border-color: var(--brand); transform: scale(1.05); }
.gchip.done::before { background: rgba(16, 185, 129, .5); }
/* στα μενού η προεπισκόπηση κάμερας ανεβαίνει πάνω από την κάρτα και μεγαλώνει, για να βλέπει ο παίκτης το χέρι του */
body.gest:not(.playing) #camBox { z-index: 8; width: min(260px, 30vw); border-color: var(--brand); }
.big b { display: block; font-size: 64px; font-weight: 800; background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1; }
.big small { font: 500 11px ui-monospace, Menlo, Consolas, monospace; letter-spacing: .15em; color: var(--muted); text-transform: uppercase; }
.row { display: flex; justify-content: center; gap: 26px; margin: 14px 0; color: var(--muted); }
.row b { color: var(--ink); }
.newbest { margin: 0 0 14px; font-weight: 700; color: var(--accent); }

@media (max-width: 520px) {
  .stat { padding: 4px 8px; min-width: 46px; } .stat b { font-size: 16px; }
  .brand span { display: none; }
  #top { flex-wrap: wrap; }
  .modes { grid-template-columns: 1fr; } .mode { flex-direction: row; text-align: left; gap: 10px; padding: 10px 12px; }
  .mode small { display: none; }
}
