/* ============================================================
   AIWORKS Játéktér – stílusok
   ============================================================ */
:root {
  --navy: #1b2638;
  --bg: #0b1220;
  --bg-2: #111b2e;
  --surface: rgba(255, 255, 255, 0.06);
  --surface-2: rgba(255, 255, 255, 0.1);
  --stroke: rgba(255, 255, 255, 0.12);
  --text: #eef3fb;
  --muted: #9aa8c0;
  --cyan: #4de1ff;
  --violet: #8b7bff;
  --amber: #ffc857;
  --pink: #ff6b9a;
  --mint: #3ee6a8;
  --danger: #ff5d73;
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.6);
  --font-head: 'Fredoka', 'Inter', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
input { user-select: text; -webkit-user-select: text; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: var(--cyan); text-decoration: none; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }

/* ---------- Eredeti logó (assets/logo.webp) – torzításmentes maszk, 3 kivágott darab ---------- */
.logo { position: relative; display: inline-block; flex: none; aspect-ratio: 1; color: #fff; }
.logo .lp {
  position: absolute; inset: 0; background: currentColor; visibility: hidden;
  -webkit-mask: var(--logo-mask) center / contain no-repeat; mask: var(--logo-mask) center / contain no-repeat;
}
.logo-ready .logo .lp { visibility: inherit; }
.logo-raw .logo .lp { background: url(../assets/logo.webp) center / contain no-repeat; -webkit-mask: none; mask: none; }
/* A vágóvonalak a logó fehér hézagaiban futnak, így a darabok pontosan az eredeti formát adják ki */
.lp-a { clip-path: polygon(0 0, 100% 0, 100% 100%, 95.2% 100%, 66.9% 71.8%, 66.9% 30.3%, 25.6% 30.3%, 0 4.7%); transform-origin: 62% 38%; }
.lp-b { clip-path: polygon(0 4.7%, 25.6% 30.3%, 25.6% 51.8%, 44.4% 51.8%, 44.4% 71.8%, 66.9% 71.8%, 95.2% 100%, 0 100%); transform-origin: 32% 68%; }
.lp-c { clip-path: polygon(25.6% 30.3%, 66.9% 30.3%, 66.9% 71.8%, 44.4% 71.8%, 44.4% 51.8%, 25.6% 51.8%); transform-origin: 46% 50%; }

/* ---------- Élő háttér ---------- */
#bg { position: fixed; inset: 0; overflow: hidden; z-index: 0; pointer-events: none;
  background: radial-gradient(1200px 800px at 50% -10%, #1a2a47 0%, var(--bg) 60%); }
.aurora { position: absolute; width: 70vmax; height: 70vmax; border-radius: 50%; opacity: .5; } /* elmosás és keverési mód nélkül: kevés GPU-memória */
.aurora.a1 { background: radial-gradient(circle, var(--violet) 0%, transparent 68%); top: -30vmax; left: -20vmax; animation: drift1 22s ease-in-out infinite alternate; }
.aurora.a2 { background: radial-gradient(circle, var(--cyan) 0%, transparent 68%); bottom: -35vmax; right: -25vmax; opacity: .25; animation: drift2 26s ease-in-out infinite alternate; }
.aurora.a3 { background: radial-gradient(circle, var(--pink) 0%, transparent 68%); top: 40%; left: 50%; width: 40vmax; height: 40vmax; opacity: .12; animation: drift1 30s ease-in-out infinite alternate-reverse; }
@keyframes drift1 { to { transform: translate(15vmax, 10vmax) scale(1.15); } }
@keyframes drift2 { to { transform: translate(-12vmax, -8vmax) scale(.9); } }
#floaters .logo { position: absolute; color: rgba(255, 255, 255, 0.06); }

/* ---------- Váz ---------- */
#app { position: relative; z-index: 1; height: 100%; display: flex; flex-direction: column; }
#topbar {
  display: flex; align-items: center; gap: 12px;
  padding: calc(10px + var(--safe-t)) 16px 10px;
  position: relative; z-index: 5;
  background: linear-gradient(to bottom, rgba(11,18,32,.85) 60%, rgba(11,18,32,0));
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-head); font-size: 20px; letter-spacing: .5px; flex: 1; }
.brand b { font-weight: 700; background: linear-gradient(90deg, var(--cyan), var(--violet)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-logo { width: 32px; height: 32px; filter: drop-shadow(0 0 10px rgba(77,225,255,.45)); }
.icon-btn { width: 42px; height: 42px; border-radius: 14px; background: var(--surface); border: 1px solid var(--stroke); display: grid; place-items: center; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); transition: transform .15s, background .2s; }
.icon-btn:active { transform: scale(.92); }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

.net { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; padding: 6px 11px; border-radius: 99px; background: var(--surface); border: 1px solid var(--stroke); }
.net i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.net.on i { background: var(--mint); box-shadow: 0 0 0 0 rgba(62,230,168,.7); animation: pulse 2s infinite; }
.net.off { color: #ffd0d6; border-color: rgba(255,93,115,.45); background: rgba(255,93,115,.12); }
.net.off i { background: var(--danger); }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(62,230,168,0); } 100% { box-shadow: 0 0 0 0 rgba(62,230,168,0); } }

.screen {
  position: absolute; inset: 0; top: calc(62px + var(--safe-t));
  padding: 8px 16px calc(24px + var(--safe-b));
  overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch;
  display: none; flex-direction: column; align-items: center;
}
.screen.active { display: flex; }
.screen > * { width: 100%; max-width: 760px; flex-shrink: 0; }
#scr-splash { top: 0; justify-content: center; }

.glass { background: linear-gradient(160deg, rgba(255,255,255,.09), rgba(255,255,255,.03)); border: 1px solid var(--stroke); backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%); box-shadow: var(--shadow); }
.card { border-radius: var(--radius); padding: 24px; }

/* ---------- Gombok ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 20px; border-radius: 16px; font-weight: 600; font-size: 15px; transition: transform .15s ease, box-shadow .25s, background .25s; position: relative; overflow: hidden; }
.btn:active { transform: scale(.95); }
.btn.primary { background: linear-gradient(135deg, var(--cyan), var(--violet)); color: #0b1220; box-shadow: 0 10px 30px -10px rgba(77,225,255,.7); }
@media (hover: hover) and (pointer: fine) { .btn.primary:hover { box-shadow: 0 14px 40px -10px rgba(139,123,255,.9); } }
.btn.ghost { background: var(--surface); border: 1px solid var(--stroke); }
@media (hover: hover) and (pointer: fine) { .btn.ghost:hover { background: var(--surface-2); } }
.btn.danger { background: rgba(255,93,115,.14); border: 1px solid rgba(255,93,115,.45); color: #ffd6dc; }
.btn.big { padding: 16px 26px; font-size: 17px; }
.btn.small { padding: 9px 14px; font-size: 13px; border-radius: 12px; }
.btn .ic { width: 18px; height: 18px; }
.btn::after { content: ''; position: absolute; inset: 0; background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,.35) 50%, transparent 70%); transform: translateX(-120%); transition: transform .6s; }
@media (hover: hover) and (pointer: fine) { .btn:hover::after { transform: translateX(120%); } }
.link { color: var(--cyan); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; padding: 0 4px; }

/* ---------- Splash ---------- */
.splash-stage { position: relative; width: min(52vw, 240px); aspect-ratio: 1; margin-bottom: 18px; }
.splash-logo { width: 100%; height: 100%; position: relative; z-index: 2; display: block; }
.splash-glow { position: absolute; inset: 10%; border-radius: 30%; background: radial-gradient(circle, rgba(77,225,255,.55), rgba(139,123,255,.2) 50%, transparent 70%); filter: blur(30px); opacity: 0; }
.splash-title { font-family: var(--font-head); font-size: clamp(38px, 10vw, 64px); margin: 0; letter-spacing: 6px; text-align: center; }
.splash-sub { font-family: var(--font-head); color: var(--cyan); letter-spacing: 10px; text-transform: uppercase; margin: 6px 0 28px; opacity: 0; text-align: center; }
.split .ch { display: inline-block; white-space: pre; }

/* ---------- Név ---------- */
#scr-name { justify-content: center; }
.name-card { text-align: center; max-width: 420px; }
.name-logo .logo { width: 70px; height: 70px; }
.name-card h2 { font-family: var(--font-head); font-size: 28px; margin: 10px 0 4px; }
#name-form { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }
#name-input { width: 100%; padding: 16px 18px; font-size: 18px; border-radius: 16px; border: 1px solid var(--stroke); background: rgba(0,0,0,.25); color: var(--text); outline: none; text-align: center; font-weight: 600; transition: border-color .2s, box-shadow .2s; }
#name-input:focus { border-color: var(--cyan); box-shadow: 0 0 0 4px rgba(77,225,255,.15); }
.form-err { color: var(--danger); min-height: 1.2em; font-size: 14px; margin: 10px 0 0; }

/* ---------- Ikonok és jelvények (egységes vizuális nyelv) ---------- */
.ic { width: 1.2em; height: 1.2em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: middle; }
.badge {
  --c1: var(--cyan); --c2: var(--violet);
  width: 52px; height: 52px; border-radius: 16px; display: inline-grid; place-items: center; flex: none; color: #fff;
  background: linear-gradient(140deg, var(--c1), var(--c2));
  box-shadow: 0 10px 24px -8px var(--c1), inset 0 1px 0 rgba(255,255,255,.35);
}
.badge .ic { width: 58%; height: 58%; stroke-width: 1.9; }
.badge.sm { width: 34px; height: 34px; border-radius: 11px; }
.badge.lg { width: 76px; height: 76px; border-radius: 24px; }
.badge.danger { --c1: #ff7a8c; --c2: #ff4d6a; }
.badge.warn { --c1: #ffd27a; --c2: #ff9f5a; }
.badge.ok { --c1: #5cf0b8; --c2: #2cc7a0; }

/* ---------- Menü ---------- */
.menu-head { text-align: center; margin: 6px 0 16px; }
.hello { color: var(--muted); margin: 0 0 6px; font-size: 15px; }
.hello b { color: var(--text); }
.menu-title, .page-title { font-family: var(--font-head); font-size: clamp(30px, 8vw, 44px); margin: 0; text-align: center; font-weight: 700; }
.page-title { margin: 6px 0 18px; }
.offline-banner { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius-sm); background: rgba(255,93,115,.12); border: 1px solid rgba(255,93,115,.4); margin-bottom: 16px; font-size: 14px; line-height: 1.45; color: #ffe1e5; }
.offline-banner .ic { width: 22px; height: 22px; color: var(--danger); }

.game-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.game-card {
  --c1: var(--cyan); --c2: var(--violet);
  position: relative; border-radius: var(--radius); padding: 16px; min-height: 176px;
  display: flex; flex-direction: column; align-items: flex-start; text-align: left; overflow: hidden;
  /* A színátmenetes keret maszk helyett két háttérréteg (belső kitöltés + keret): nincs GPU-maszkkompozíció,
     ami Androidon görgetés közben szétesett (zajcsíkok, eltűnő tartalom) */
  border: 1px solid transparent; box-shadow: var(--shadow);
  background: linear-gradient(155deg, #212b42, #121b2d) padding-box, linear-gradient(135deg, var(--c1), rgba(255,255,255,.1) 40%, rgba(255,255,255,.1) 60%, var(--c2)) border-box;
  background: linear-gradient(155deg, #212b42, #121b2d) padding-box, linear-gradient(135deg, color-mix(in srgb, var(--c1) 60%, rgba(255,255,255,.12)), rgba(255,255,255,.1) 40%, rgba(255,255,255,.1) 60%, color-mix(in srgb, var(--c2) 60%, rgba(255,255,255,.12))) border-box;
  transition: box-shadow .3s;
}
.game-card::before { content: ''; position: absolute; inset: -40% -40% auto auto; width: 180px; height: 180px; border-radius: 50%; background: radial-gradient(circle, var(--c1), transparent 70%); opacity: .35; transition: transform .5s, opacity .3s; }
@media (hover: hover) and (pointer: fine) { .game-card:hover { box-shadow: 0 25px 60px -20px var(--c1); } }
@media (hover: hover) and (pointer: fine) { .game-card:hover::before { transform: scale(1.3); opacity: .6; } }
.game-card .badge { margin-bottom: auto; }
.game-card .gc-best { position: absolute; top: 16px; right: 14px; display: flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; padding: 4px 8px; border-radius: 99px; background: rgba(0,0,0,.3); color: var(--amber); border: 1px solid rgba(255,200,87,.3); }
.game-card .gc-best .ic { width: 12px; height: 12px; }
.game-card h3 { font-family: var(--font-head); margin: 14px 0 0; font-size: 20px; }
.game-card p { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.menu-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 18px; }
.menu-actions .btn { flex: 1 1 calc(50% - 6px); }
@media (min-width: 640px) {
  .game-grid { grid-template-columns: repeat(3, 1fr); }
  .menu-actions .btn { flex: 1 1 0; }
}

/* ---------- Szintválasztó ---------- */
.level-cta { color: var(--text); font-weight: 600; }
.level-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.level-btn {
  display: grid; grid-template-columns: 40px 1fr 48px; align-items: center; gap: 12px; width: 100%;
  text-align: left; padding: 12px 12px 12px 14px; border-radius: 18px; cursor: pointer;
  color: var(--text); -webkit-appearance: none; appearance: none;
  background: linear-gradient(135deg, rgba(255,255,255,.1), rgba(255,255,255,.04));
  background: linear-gradient(135deg, color-mix(in srgb, var(--c1, #4de1ff) 20%, transparent), rgba(255,255,255,.04));
  border: 1px solid rgba(255,255,255,.22);
  border: 1px solid color-mix(in srgb, var(--c1, #4de1ff) 55%, transparent);
  box-shadow: 0 10px 24px -16px var(--c1, #4de1ff);
  transition: background .2s, border-color .2s, transform .15s, box-shadow .2s;
}
.level-btn:focus-visible { background: rgba(77,225,255,.16); box-shadow: 0 14px 30px -14px var(--c1, #4de1ff); outline: none; }
@media (hover: hover) and (pointer: fine) { .level-btn:hover { background: rgba(77,225,255,.16); box-shadow: 0 14px 30px -14px var(--c1, #4de1ff); } }
.level-btn:focus-visible { background: linear-gradient(135deg, color-mix(in srgb, var(--c1, #4de1ff) 32%, transparent), rgba(255,255,255,.06)); box-shadow: 0 14px 30px -14px var(--c1, #4de1ff); outline: none; }
.level-btn:active { transform: scale(.97); }
.level-btn.last { border-width: 2px; padding: 11px 11px 11px 13px; }
.level-info { min-width: 0; }
.level-info b { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; font-family: var(--font-head); font-size: 19px; }
.level-info em { font-style: normal; font-family: var(--font-body); font-size: 11.5px; font-weight: 700; color: var(--amber); padding: 2px 7px; border-radius: 99px; background: rgba(255,200,87,.14); }
.level-tag { font-family: var(--font-body); font-size: 10.5px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: #0b1220; padding: 2px 7px; border-radius: 99px; background: var(--c1, var(--cyan)); }
.level-info small { color: #b8c4d8; font-size: 12.5px; line-height: 1.35; display: block; margin-top: 2px; }
.level-go {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; justify-self: end;
  color: #0b1220; background: linear-gradient(135deg, var(--c1, var(--cyan)), var(--c2, var(--violet)));
  box-shadow: 0 8px 20px -6px var(--c1, var(--cyan)), inset 0 1px 0 rgba(255,255,255,.45); transition: transform .2s;
}
.level-go .ic { width: 20px; height: 20px; margin-left: 3px; fill: currentColor; stroke-width: 1.5; }
@media (hover: hover) and (pointer: fine) { .level-btn:hover .level-go { transform: scale(1.1); } }
.level-bars { display: flex; align-items: flex-end; gap: 3px; height: 26px; justify-self: center; }
.level-bars i { width: 7px; border-radius: 3px; background: rgba(255,255,255,.2); }
.level-bars i:nth-child(1) { height: 40%; } .level-bars i:nth-child(2) { height: 70%; } .level-bars i:nth-child(3) { height: 100%; }
.level-bars i.on { background: linear-gradient(180deg, var(--c1, var(--cyan)), var(--c2, var(--violet))); }
.modal-note { display: flex; gap: 8px; align-items: flex-start; text-align: left; font-size: 13px; line-height: 1.45; padding: 10px 12px; border-radius: 12px; background: rgba(255,93,115,.12); color: #ffd6dc; margin-top: 12px; }
.modal-note .ic { color: var(--danger); margin-top: 1px; }

/* ---------- Játék képernyő: közös keret ---------- */
#scr-game { padding-top: 0; --g1: var(--cyan); --g2: var(--violet); --off: 330px; --bs: max(240px, min(92vw, 520px, calc(var(--app-h, 100dvh) - var(--off)))); }
@supports (height: 100dvh) { #scr-game { --bs: max(240px, min(92vw, 520px, calc(var(--app-h, 100dvh) - var(--off)))); } }
.game-head { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 12px; }
.game-title { display: flex; align-items: center; gap: 10px; }
.game-title .badge { width: 38px; height: 38px; border-radius: 12px; --c1: var(--g1); --c2: var(--g2); }
.game-title h2 { font-family: var(--font-head); margin: 0; font-size: 24px; }
.lvl-chip { font-size: 11px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; padding: 5px 9px; border-radius: 99px; color: #0b1220; background: linear-gradient(135deg, var(--g1), var(--g2)); }
.hud { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.hud .pill { padding: 7px 12px; border-radius: 99px; background: var(--surface); border: 1px solid var(--stroke); font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 6px; }
.hud .pill .ic { width: 15px; height: 15px; color: var(--g1); }
.hud .pill small { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; }
.game-stage { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.status-line { font-size: 12.5px; letter-spacing: 1.4px; text-transform: uppercase; font-weight: 700; color: var(--g1); text-align: center; min-height: 1.3em; display: flex; align-items: center; gap: 6px; justify-content: center; }
.status-line .ic { width: 15px; height: 15px; }
.hint-text { color: var(--muted); font-size: 13px; text-align: center; margin: 0; max-width: 460px; line-height: 1.45; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.toolbar .btn .ic { width: 16px; height: 16px; }
.toolbar .btn.on { border-color: var(--g1); color: var(--g1); }
.progress { width: var(--bs); min-width: 260px; height: 6px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--g1), var(--g2)); transform-origin: left; }

/* A játéktábla – minden játék ugyanazt a keretet használja */
.board {
  position: relative; width: var(--bs); min-width: 260px; aspect-ratio: 1; border-radius: 22px;
  background: linear-gradient(160deg, rgba(255,255,255,.07), rgba(255,255,255,.015));
  border: 1px solid var(--stroke);
  box-shadow: inset 0 0 40px rgba(0,0,0,.35), var(--shadow);
  touch-action: none;
}
.board.clip { overflow: hidden; }
.board.free { aspect-ratio: auto; padding: 18px 12px; display: flex; flex-direction: column; align-items: center; gap: 16px; width: min(92vw, 560px); touch-action: manipulation; }
.board canvas, .board > svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.board-overlay { position: absolute; inset: 0; border-radius: inherit; display: grid; place-items: center; text-align: center; background: rgba(11,18,32,.6); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); font-family: var(--font-head); font-size: 22px; z-index: 5; }

/* Csempe – közös megjelenés (betűk, kártyák, blokkok) */
.tile {
  border-radius: 12px; font-family: var(--font-head); font-weight: 700; color: var(--navy);
  background: linear-gradient(160deg, #ffffff, #dde7f5);
  box-shadow: 0 4px 0 #9aabc8, 0 10px 18px rgba(0,0,0,.3);
}
.tile.dark { color: #fff; background: linear-gradient(150deg, #24365a, #172238); box-shadow: 0 4px 0 #0c1424, 0 10px 18px rgba(0,0,0,.3); border: 1px solid rgba(255,255,255,.08); }
.tile.accent { color: #0b1220; background: linear-gradient(150deg, var(--g1), var(--g2)); box-shadow: 0 4px 0 rgba(0,0,0,.35), 0 10px 18px rgba(0,0,0,.3); }

/* D-pad (labirintus) – ugyanaz a gombstílus */
.dpad { display: grid; grid-template-columns: repeat(3, 56px); grid-template-rows: repeat(2, 48px); gap: 8px; }
.dpad .btn { padding: 0; }
.dpad .btn .ic { width: 22px; height: 22px; }
.dpad .up { grid-column: 2; grid-row: 1; } .dpad .left { grid-column: 1; grid-row: 2; }
.dpad .down { grid-column: 2; grid-row: 2; } .dpad .right { grid-column: 3; grid-row: 2; }
/* a d-pad minden eszközön látható – egységes vezérlés weben, Androidon és iOS-en */

/* Kirakó */
.pz-tile { position: absolute; border-radius: 10px; background-repeat: no-repeat; box-shadow: inset 0 0 0 1px rgba(255,255,255,.2), 0 4px 10px rgba(0,0,0,.35); cursor: pointer; }
.pz-tile span { position: absolute; left: 6px; top: 4px; font-size: 11px; font-weight: 700; color: #fff; text-shadow: 0 1px 3px #000; opacity: 0; transition: opacity .2s; }
.board.nums .pz-tile span { opacity: .95; }
.pz-preview { position: absolute; inset: 0; border-radius: inherit; background-size: cover; opacity: 0; pointer-events: none; z-index: 4; }
.board.solved .pz-tile { box-shadow: none; border-radius: 0; }

/* Szókirakó */
.wd-slots, .wd-letters { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.wd-slot { width: var(--t, 44px); height: calc(var(--t, 44px) * 1.15); border-radius: 12px; border: 2px dashed rgba(255,255,255,.22); display: grid; place-items: center; font-family: var(--font-head); font-size: calc(var(--t, 44px) * .52); font-weight: 700; background: rgba(0,0,0,.2); }
.wd-slot.filled { border-style: solid; border-color: var(--g1); background: rgba(255,255,255,.08); cursor: pointer; }
.wd-slot.hint { border-color: var(--amber); color: var(--amber); }
.wd-letters { min-height: 60px; }
.wd-letter { width: calc(var(--t, 44px) + 4px); height: calc(var(--t, 44px) * 1.2); font-size: calc(var(--t, 44px) * .56); transition: transform .1s; }
.wd-letter:active { transform: translateY(3px); }
.wd-letter.used { visibility: hidden; }
.wd-slots.ok .wd-slot { border-color: var(--mint); background: rgba(62,230,168,.2); color: var(--mint); }
.wd-slots.bad .wd-slot { border-color: var(--danger); background: rgba(255,93,115,.15); }

/* Memória */
.mem-grid { position: absolute; inset: 10px; display: grid; gap: 8px; align-content: center; }
.mem-card { position: relative; cursor: pointer; } /* 2D-s fordítás: nincs tartós 3D-réteg */
.mem-face { position: absolute; inset: 0; border-radius: 12px; display: grid; place-items: center; }
.mem-back .logo { width: 50%; color: rgba(255,255,255,.85); }
.mem-front { visibility: hidden; }
.mem-card.up .mem-front { visibility: visible; }
.mem-card.up .mem-back { visibility: hidden; }
.mem-front .ic { width: 52%; height: 52%; stroke-width: 2.1; }
.mem-card.matched .mem-front { background: linear-gradient(160deg, #e6fff5, #b9f5dc); box-shadow: 0 4px 0 #6fcfa6, 0 10px 18px rgba(0,0,0,.3); }

/* Malom */
.ml-line { stroke: rgba(238,243,251,.55); stroke-width: 5; fill: none; stroke-linecap: round; }
.ml-point { fill: rgba(238,243,251,.7); }
.ml-hit { fill: transparent; cursor: pointer; }
.ml-target { fill: none; stroke: var(--g1); stroke-width: 4; opacity: 0; pointer-events: none; }
.ml-piece { pointer-events: none; }
.ml-piece .pi { transform-box: fill-box; transform-origin: center; }
.ml-piece .ring { fill: none; stroke-width: 5; opacity: 0; }
.ml-piece.sel .ring { stroke: var(--amber); opacity: 1; }
.ml-piece.rem .ring { stroke: var(--danger); opacity: 1; }
.ml-hands { display: flex; justify-content: space-between; width: var(--bs); min-width: 260px; gap: 12px; }
.ml-hand { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.ml-hand.on { color: var(--text); }
.ml-hand .dots { display: flex; gap: 3px; flex-wrap: wrap; max-width: 110px; }
.ml-hand .dots i { width: 9px; height: 9px; border-radius: 50%; }
.ml-hand.me .dots i { background: #fff; }
.ml-hand.ai .dots i { background: linear-gradient(135deg, var(--g1), var(--g2)); }

/* Blokkmester */
.bk-grid { position: absolute; inset: 10px; display: grid; gap: 3px; }
.bk-cell { border-radius: 6px; background: rgba(255,255,255,.05); box-shadow: inset 0 0 0 1px rgba(255,255,255,.04); }
.bk-cell.full, .bk-float i, .bk-piece i { border-radius: 6px; background: linear-gradient(150deg, var(--bc1), var(--bc2)); box-shadow: inset 0 1px 0 rgba(255,255,255,.45), inset 0 -3px 0 rgba(0,0,0,.18); }
.bk-cell.stone { background: linear-gradient(150deg, #3b4a66, #283550); box-shadow: inset 0 1px 0 rgba(255,255,255,.15), inset 0 -3px 0 rgba(0,0,0,.3); }
.bk-cell.preview { background: rgba(255,255,255,.22); box-shadow: inset 0 0 0 2px rgba(255,255,255,.5); }
.bk-cell.preview.bad { background: rgba(255,93,115,.2); box-shadow: inset 0 0 0 2px rgba(255,93,115,.6); }
.bk-cell.glow { box-shadow: 0 0 0 2px #fff, 0 0 18px var(--g1); }
.bk-tray { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: var(--bs); min-width: 260px; height: calc(var(--bs) * .3); min-height: 90px; }
.bk-slot { border-radius: 18px; background: rgba(255,255,255,.04); border: 1px solid var(--stroke); display: grid; place-items: center; position: relative; }
.bk-piece { display: grid; gap: 2px; touch-action: none; cursor: grab; transition: opacity .2s; }
.bk-piece.dead { opacity: .3; }
.bk-float { position: fixed; display: grid; z-index: 65; pointer-events: none; filter: drop-shadow(0 12px 20px rgba(0,0,0,.45)); }

/* ---------- Toplista ---------- */
.tabs { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 12px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: none; display: flex; align-items: center; gap: 6px; padding: 9px 14px; border-radius: 99px; background: var(--surface); border: 1px solid var(--stroke); font-weight: 600; font-size: 14px; white-space: nowrap; transition: background .2s, color .2s; }
.tabs button .ic { width: 16px; height: 16px; }
.tabs button.on { background: linear-gradient(135deg, var(--cyan), var(--violet)); color: #0b1220; border-color: transparent; }
.lb-card { padding: 10px; margin-bottom: 14px; }
.lb-list { display: flex; flex-direction: column; gap: 6px; min-height: 120px; }
.lb-row { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 14px; background: rgba(255,255,255,.04); }
.lb-row.me { background: rgba(77,225,255,.12); box-shadow: inset 0 0 0 1px rgba(77,225,255,.4); }
.lb-rank { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-head); font-size: 16px; color: var(--muted); background: rgba(255,255,255,.06); }
.lb-rank.r1 { color: #3a2a00; background: linear-gradient(140deg, #ffe08a, #f5b82e); box-shadow: 0 4px 14px -4px #f5b82e; }
.lb-rank.r2 { color: #1e2633; background: linear-gradient(140deg, #f1f5fb, #aab6c8); }
.lb-rank.r3 { color: #3a1d08; background: linear-gradient(140deg, #f5c29a, #c77a45); }
.lb-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-name small { display: block; color: var(--muted); font-weight: 500; font-size: 11.5px; }
.lb-score { font-family: var(--font-head); font-size: 20px; color: var(--amber); font-variant-numeric: tabular-nums; }
.lb-empty { text-align: center; color: var(--muted); padding: 30px 10px; line-height: 1.5; }
.lb-empty .ic { width: 30px; height: 30px; display: block; margin: 0 auto 8px; color: var(--muted); }
.lb-card.mine { padding: 16px; }
.lb-card.mine h3 { margin: 0 0 12px; font-size: 15px; color: var(--muted); font-weight: 600; }
.mine-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.mine-grid div { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: center; padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,.04); font-size: 13px; }
.mine-grid .badge { grid-row: span 2; }
.mine-grid b { font-family: var(--font-head); color: var(--amber); font-size: 18px; }
.spinner { width: 34px; height: 34px; margin: 40px auto; border-radius: 50%; border: 3px solid var(--surface-2); border-top-color: var(--cyan); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Impresszum ---------- */
.imp-card { text-align: center; }
.imp-logo { width: 110px; height: 110px; margin: 0 auto 8px; border-radius: 26px; background: #fff; padding: 12px; box-shadow: 0 16px 40px -10px rgba(77,225,255,.5); }
.imp-logo img { width: 100%; height: 100%; object-fit: contain; }
.imp-card h2 { font-family: var(--font-head); margin: 10px 0 4px; font-size: 26px; }
.tagline { font-family: var(--font-head); color: var(--cyan); letter-spacing: 1px; margin: 8px 0 18px; }
.imp-list { text-align: left; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.imp-list div { display: grid; grid-template-columns: 120px 1fr; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--stroke); font-size: 14px; }
.imp-list dt { color: var(--muted); }
.imp-list dd { margin: 0; line-height: 1.45; }
@media (max-width: 420px) { .imp-list div { grid-template-columns: 1fr; gap: 2px; } }
.socials { display: flex; gap: 10px; justify-content: center; margin: 20px 0 10px; flex-wrap: wrap; }
.copy { color: var(--muted); font-size: 12px; margin: 10px 0 0; }

/* ---------- Viszlát ---------- */
#scr-bye { justify-content: center; }
.bye { text-align: center; }
.bye-logo { width: 110px; height: 110px; margin-bottom: 10px; }
.bye h1 { font-family: var(--font-head); font-size: clamp(28px, 8vw, 42px); margin: 0 0 8px; }

/* ---------- Modális ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(5,10,20,.7); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.modal-box { position: relative; width: 100%; max-width: 420px; max-height: calc(var(--app-h, 100dvh) - 32px); max-height: calc(var(--app-h, 100dvh) - 32px); overflow-y: auto; overscroll-behavior: contain; border-radius: 26px; padding: 28px 22px 22px; text-align: center; background: linear-gradient(160deg, rgba(34,48,77,.95), rgba(17,27,46,.95)); }
.modal-box h2 { font-family: var(--font-head); margin: 6px 0 8px; font-size: 28px; }
.modal-box p { color: var(--muted); line-height: 1.5; margin: 0 0 8px; }
.modal-icon { font-size: 56px; line-height: 1; display: flex; justify-content: center; }
.modal-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.modal-actions.row { flex-direction: row; }
.modal-actions.row .btn { flex: 1; }
.big-score { font-family: var(--font-head); font-size: 64px; font-weight: 700; line-height: 1; margin: 8px 0 4px; background: linear-gradient(90deg, var(--amber), var(--pink)); -webkit-background-clip: text; background-clip: text; color: transparent; font-variant-numeric: tabular-nums; }
.stats { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.stats span { font-size: 13px; padding: 6px 10px; border-radius: 99px; background: rgba(255,255,255,.07); }
.submit-state { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 14px; padding: 10px 12px; border-radius: 12px; margin-top: 10px; }
.submit-state.ok { background: rgba(62,230,168,.14); color: #bff7e2; }
.submit-state.warn { background: rgba(255,93,115,.14); color: #ffd6dc; }
.submit-state.wait { background: rgba(255,255,255,.06); color: var(--muted); }
.new-best { display: inline-block; font-weight: 700; font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: #0b1220; background: var(--amber); padding: 5px 10px; border-radius: 99px; }

/* ---------- Effektek ---------- */
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.confetti { position: absolute; width: 10px; height: 14px; border-radius: 3px; }
.ripple { position: absolute; border-radius: 50%; pointer-events: none; background: rgba(255,255,255,.35); transform: translate(-50%, -50%); }
.toast { position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%); z-index: 70; padding: 12px 18px; border-radius: 14px; background: rgba(20,30,50,.95); border: 1px solid var(--stroke); box-shadow: var(--shadow); font-size: 14px; font-weight: 600; max-width: 90vw; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  .aurora { animation: none; }
}

/* ============================================================
   Telepítőlap (közös: nyitóoldal + app)
   ============================================================ */
.ins { position: fixed; inset: 0; z-index: 90; display: flex; align-items: flex-end; justify-content: center; }
.ins-bd { position: absolute; inset: 0; background: rgba(5,10,20,.72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.ins-box {
  position: relative; width: 100%; max-width: 480px; max-height: calc(var(--app-h, 100dvh) - 24px); max-height: calc(var(--app-h, 100dvh) - 24px); overflow-y: auto; overscroll-behavior: contain;
  border-radius: 26px 26px 0 0; padding: 22px 18px calc(22px + var(--safe-b));
  background: linear-gradient(160deg, rgba(34,48,77,.98), rgba(17,27,46,.98)); border: 1px solid var(--stroke); box-shadow: var(--shadow);
  text-align: left; color: var(--text); font-family: var(--font-body);
}
@media (min-width: 640px) { .ins { align-items: center; padding: 20px; } .ins-box { border-radius: 26px; padding-bottom: 22px; } }
.ins-x { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--stroke); }
.ins-x .ic { width: 18px; height: 18px; }
.ins-head { display: flex; align-items: center; gap: 12px; margin: 0 44px 16px 0; }
.ins-head img { width: 56px; height: 56px; border-radius: 14px; background: #fff; box-shadow: 0 8px 20px -8px rgba(77,225,255,.6); }
.ins-head b { display: block; font-family: var(--font-head); font-size: 20px; }
.ins-head small { color: var(--muted); font-size: 12.5px; }
.ins-opt { border-radius: 18px; padding: 14px; background: rgba(255,255,255,.04); border: 1px solid var(--stroke); margin-bottom: 12px; display: flex; flex-direction: column; gap: 10px; }
.ins-opt.rec { border-color: rgba(77,225,255,.45); background: rgba(77,225,255,.06); }
.ins-tag { font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--cyan); }
.ins-tag.muted { color: var(--muted); }
.ins-main { width: 100%; }
.ins-steps { list-style: none; counter-reset: s; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ins-steps li { counter-increment: s; display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: start; font-size: 14px; line-height: 1.45; color: #d6deeb; }
.ins-steps li::before { content: counter(s); width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #0b1220; background: linear-gradient(135deg, var(--cyan), var(--violet)); }
.ins-steps .ic { width: 16px; height: 16px; color: var(--cyan); vertical-align: -3px; }
.ins-note { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.5; padding: 12px; border-radius: 14px; background: rgba(255,200,87,.1); color: #ffe9bf; margin-bottom: 12px; }
.ins-note .ic { color: var(--amber); margin-top: 2px; }
.ins-small { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.ins-arrow { position: fixed; left: 50%; z-index: 95; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 4px; color: #0b1220; pointer-events: none; }
.ins-arrow span { display: flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 99px; font-weight: 700; font-size: 14px; background: linear-gradient(135deg, var(--cyan), var(--violet)); box-shadow: 0 10px 30px -8px rgba(77,225,255,.8); }
.ins-arrow > .ic { width: 38px; height: 38px; color: var(--cyan); stroke-width: 3; filter: drop-shadow(0 4px 10px rgba(0,0,0,.5)); }
.ins-arrow.bottom { bottom: calc(10px + var(--safe-b)); }
.ins-arrow.top { top: calc(10px + var(--safe-t)); left: auto; right: 90px; transform: none; }
html.ins-open, html.ins-open body { overflow: hidden; }
html.ins-arrowing .ln-installbar, html.ins-arrowing .toast { visibility: hidden; }

/* ---------- Apró elemek ---------- */
.icon-btn .ic { width: 20px; height: 20px; }
.icon-btn.off { color: var(--muted); }
.icon-btn.sm { width: 34px; height: 34px; border-radius: 11px; }
.float-pts { position: fixed; z-index: 66; transform: translate(-50%, -50%); font-family: var(--font-head); font-weight: 700; font-size: 26px; color: var(--amber); text-shadow: 0 4px 14px rgba(0,0,0,.55); pointer-events: none; white-space: nowrap; }

/* ============================================================
   Reszponzivitás
   ============================================================ */
/* Játékonkénti függőleges helyigény (a tábla mérete ehhez igazodik) */
#scr-game[data-game="maze"] { --off: 350px; }
@media (pointer: coarse) { #scr-game[data-game="maze"] { --off: 440px; } }
#scr-game[data-game="mill"] { --off: 370px; }
#scr-game[data-game="memory"] { --off: 300px; }
#scr-game[data-game="blocks"] { --bs: max(240px, min(92vw, 520px, calc((var(--app-h, 100dvh) - 340px) / 1.32))); }
@supports (height: 100dvh) { #scr-game[data-game="blocks"] { --bs: max(240px, min(92vw, 520px, calc((var(--app-h, 100dvh) - 340px) / 1.32))); } }

/* Alacsony képernyő: a súgószövegek helyett nagyobb tábla */
@media (max-height: 720px) {
  #scr-game .hint-text { display: none; }
  #scr-game { --off: 280px; }
  #scr-game[data-game="maze"] { --off: 300px; }
  #scr-game[data-game="mill"] { --off: 320px; }
  .game-head { gap: 6px; margin-bottom: 8px; }
}
@media (max-height: 720px) and (pointer: coarse) { #scr-game[data-game="maze"] { --off: 390px; } }

/* Kis telefonok (≤ 360 px) */
@media (max-width: 360px) {
  .screen { padding-left: 12px; padding-right: 12px; }
  #topbar { padding-left: 12px; padding-right: 12px; gap: 8px; }
  .brand { font-size: 18px; }
  .net span { display: none; }
  .net { padding: 8px; }
  .game-grid { gap: 10px; }
  .game-card { padding: 13px; min-height: 158px; }
  .game-card .badge { width: 44px; height: 44px; border-radius: 14px; }
  .game-card h3 { font-size: 17px; margin-top: 10px; }
  .game-card p { font-size: 11.5px; }
  .game-title h2 { font-size: 20px; }
  .hud .pill { padding: 6px 9px; font-size: 13px; }
  .hud .pill small { display: none; }
  .toolbar .btn.small { padding: 8px 10px; font-size: 12px; }
  .btn.big { padding: 14px 18px; font-size: 16px; }
  .modal-box { padding: 22px 16px 16px; }
  .big-score { font-size: 52px; }
  .level-btn { grid-template-columns: 30px 1fr 42px; padding: 10px; gap: 10px; }
  .level-go { width: 42px; height: 42px; }
  .level-info b { font-size: 17px; }
  .dpad { grid-template-columns: repeat(3, 50px); grid-template-rows: repeat(2, 44px); }
}

/* Tablet és asztal: nagyobb tábla, ha van hely */
@media (min-width: 768px) and (min-height: 860px) {
  #scr-game { --bs: max(240px, min(600px, calc(var(--app-h, 100dvh) - var(--off)))); }
  @supports (height: 100dvh) { #scr-game { --bs: max(240px, min(600px, calc(var(--app-h, 100dvh) - var(--off)))); } }
}

/* Fekvő telefon: tábla balra, vezérlők jobbra */
@media (orientation: landscape) and (max-height: 560px) {
  #topbar { padding-top: calc(6px + var(--safe-t)); padding-bottom: 6px; }
  .icon-btn { width: 36px; height: 36px; border-radius: 12px; }
  .screen { top: calc(48px + var(--safe-t)); padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .menu-head { margin: 0 0 10px; }
  .game-grid { grid-template-columns: repeat(3, 1fr); }
  .game-card { min-height: 140px; }
  #scr-game, #scr-game[data-game] { --bs: max(180px, min(46vw, calc(var(--app-h, 100dvh) - 134px))); }
  @supports (height: 100dvh) { #scr-game, #scr-game[data-game] { --bs: max(180px, min(46vw, calc(var(--app-h, 100dvh) - 134px))); } }
  #scr-game .board:not(.free) { min-width: 0; }
  #scr-game { padding-bottom: calc(10px + var(--safe-b)); }
  .game-head { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 6px 14px; margin-bottom: 8px; }
  .game-title .badge { width: 30px; height: 30px; border-radius: 10px; }
  .game-title h2 { font-size: 19px; }
  .hud .pill { padding: 4px 10px; font-size: 13px; }
  .game-stage { display: grid; grid-template-columns: auto minmax(180px, 300px); grid-auto-flow: row dense; gap: 10px 22px; align-items: center; justify-content: center; }
  .game-stage > .board { grid-column: 1; grid-row: 1 / span 8; }
  .game-stage > :not(.board) { grid-column: 2; }
  .game-stage .hint-text { display: none; }
  .game-stage .progress { width: 100%; min-width: 0; }
  .game-stage .board.free { width: min(56vw, 560px); }
  .ml-hands { width: 100%; min-width: 0; flex-direction: column; gap: 10px; }
  .bk-tray { width: 100%; min-width: 0; height: auto; grid-template-columns: repeat(3, 1fr); aspect-ratio: 3 / 1.1; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .modal-box { padding: 18px 18px 16px; }
  .modal-icon .badge.lg { width: 56px; height: 56px; border-radius: 18px; }
  .big-score { font-size: 46px; }
  .splash-stage { width: min(calc(var(--app-h, 100vh) * .34), 180px); margin-bottom: 8px; }
  .splash-sub { margin-bottom: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .net.on i { animation: none; }
}

/* Szintválasztó: alacsony és fekvő képernyők */
@media (max-height: 640px) {
  .modal-box:has(.level-list) { padding-top: 18px; }
  .modal-box:has(.level-list) .modal-icon .badge.lg { width: 54px; height: 54px; border-radius: 17px; }
  .modal-box:has(.level-list) h2 { font-size: 24px; margin: 4px 0 4px; }
  .level-list { gap: 8px; margin-top: 10px; }
}
@media (orientation: landscape) and (max-height: 560px) {
  .modal-box:has(.level-list) { max-width: 720px; }
  .modal-box:has(.level-list) .modal-icon { display: none; }
  .level-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .level-btn { grid-template-columns: 1fr 40px; grid-template-rows: auto auto; align-items: start; padding: 10px; gap: 6px 8px; }
  .level-btn.last { padding: 9px; }
  .level-bars { grid-column: 1; grid-row: 1; justify-self: start; height: 18px; }
  .level-bars i { width: 5px; }
  .level-info { grid-column: 1 / -1; grid-row: 2; }
  .level-info b { font-size: 16px; }
  .level-info small { font-size: 11.5px; }
  .level-go { grid-column: 2; grid-row: 1; width: 38px; height: 38px; }
  .level-go .ic { width: 16px; height: 16px; }
}

/* ============================================================
   Használhatóság (UX-audit alapján)
   ============================================================ */
/* Látható fókusz billentyűzetes használathoz */
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; border-radius: 12px; }
.game-card:focus-visible, .level-btn:focus-visible { outline-offset: 2px; }

/* Érintési célok: legalább 40 px, érintőképernyőn 44 px */
.btn.small { min-height: 40px; }
.icon-btn.sm { width: 40px; height: 40px; }
.ins-x { width: 40px; height: 40px; }
.tabs button { min-height: 40px; }
@media (pointer: coarse) {
  .btn.small, .tabs button { min-height: 44px; }
  .icon-btn, .icon-btn.sm, .ins-x { width: 44px; height: 44px; }
}
/* Szöveges linkek: nagyobb érintési felület, elmozdulás nélkül */
.imp-list a, .ln-imp a, .ln-foot a { display: inline-block; padding: 12px 0; margin: -12px 0; }

/* Olvashatóság: 12 px alatti szöveg nincs */
.hud .pill small, .lvl-chip, .game-card .gc-best, .ins-tag, .level-tag, .ln-plat.mine::after { font-size: 12px; }

/* Görgethető fülsor jelzése elhalványuló szélekkel */
.tabs { -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 28px), transparent); padding-left: 8px; padding-right: 20px; }

/* Szókirakó: a kirakó betűk mindig kényelmesen koppinthatók maradnak */
.wd-letter { width: max(40px, calc(var(--t, 44px) + 4px)); height: max(46px, calc(var(--t, 44px) * 1.2)); font-size: max(22px, calc(var(--t, 44px) * .56)); }
.wd-letters { gap: 8px; }

/* Blokkmester: az egész rekesz megfogható */
.bk-slot { touch-action: none; cursor: grab; }
.bk-slot:active { cursor: grabbing; background: rgba(255,255,255,.08); }

/* Menü fejléc: névváltás rendes gombként */
.hello-row { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.hello-row .hello { margin: 0; }

/* Keskeny kijelző: a felső sávban a logó elég, a gomboknak kell a hely */
@media (max-width: 380px) { #topbar .brand > span:not(.logo) { display: none; } }
#topbar .icon-btn, #topbar .net { flex: none; }
#topbar .brand { min-width: 0; }

/* ============================================================
   Teljes képernyő, fejléc nélkül
   ============================================================ */
html, body { background: var(--bg); }
#app { min-height: var(--app-h, 100vh); }
/* A felső sáv nem fejléc többé: nincs háttér, nincs logó – csak lebegő, áttetsző gombok a sarkokban */
#topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 30;
  background: none; pointer-events: none;
  padding: calc(8px + var(--safe-t)) max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
}
#topbar > * { pointer-events: auto; }
#topbar .brand { visibility: hidden; pointer-events: none; }
#topbar .icon-btn, #topbar .net {
  background: rgba(11, 18, 32, .55); border-color: rgba(255, 255, 255, .14);
  backdrop-filter: blur(12px) saturate(140%); -webkit-backdrop-filter: blur(12px) saturate(140%);
  box-shadow: 0 6px 18px -8px rgba(0, 0, 0, .6);
}
#topbar .net span { display: none; }
#topbar .net { padding: 9px; }
.screen { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
/* Teljes képernyős módban (Android-app, böngésző-teljesképernyő) is minden a biztonságos területen belül marad */
@media (display-mode: fullscreen) {
  .screen { top: calc(58px + var(--safe-t)); }
}

/* ============================================================
   Stabil elrendezés – semmi sem ugrik (billentyűzet, üzenetek, számváltozás)
   ============================================================ */
html, body { height: var(--app-h, 100%); overflow: hidden; }
#app { height: var(--app-h, 100%); }
.screen { scrollbar-gutter: stable; overscroll-behavior: contain; }
/* Névképernyő: a mező a képernyő felső részén van, így a felnyíló billentyűzet sosem takarja el és nem tolja el */
#scr-name { justify-content: flex-start; padding-top: calc(var(--app-h, 100vh) * .04 + 8px); }
/* Az offline jelzés nem foglal helyet a menüben: lebegő címke alul */
.offline-banner {
  position: fixed; left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right));
  bottom: calc(12px + var(--safe-b)); z-index: 25; margin: 0; max-width: 560px; margin-inline: auto;
  background: rgba(60, 14, 26, .92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 12px 30px -10px rgba(0,0,0,.6); pointer-events: none;
}
/* Állapotsor: mindig pontosan két sor magas – a hosszabb üzenet sem mozdítja el a táblát */
.status-line { height: 2.7em; min-height: 0; line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; text-align: center; }
.status-line .ic { vertical-align: -3px; margin-right: 4px; }
/* Kijelzők: fix szélesség, egyenlő szélességű számjegyek – a számok változása nem tördeli át a sort */
.hud .pill { min-width: 84px; justify-content: center; font-variant-numeric: tabular-nums; }
.hud .pill span[data-hud] { display: inline-block; min-width: 3.2ch; text-align: center; }
@media (max-width: 360px) { .hud .pill { min-width: 64px; } }
/* Eredmény-ablak feltöltési sora: fix magasság, az állapotváltás nem mozgatja az ablakot */
.submit-state { min-height: 46px; }
/* Szókirakó: a betűk és a helyek sávja mindig két sornyi helyet foglal – szóváltáskor nincs ugrás */
.wd-letters { min-height: 108px; align-content: flex-start; }
.wd-slots { min-height: calc(var(--t, 44px) * 1.15); }
/* Játék fejléce: fix magasság */
.game-head { min-height: 92px; justify-content: flex-start; }

/* ============================================================
   AIWORKS logó minden játékban: halvány vízjel a tábla közepén
   ============================================================ */
.board::before {
  content: ''; position: absolute; left: 50%; top: 50%; width: 46%; aspect-ratio: 1; transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, .045); pointer-events: none; z-index: 0;
  -webkit-mask: var(--logo-mask) center / contain no-repeat; mask: var(--logo-mask) center / contain no-repeat;
}
.board.free::before { width: min(40%, 160px); }
.board > * { position: relative; z-index: 1; }
.board > canvas, .board > svg, .board > .bk-grid, .board > .mem-grid, .board > .pz-preview { position: absolute; }
.board > .pz-tile { position: absolute; }
/* aláírás a játék alatt */
.aiw-sign { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 11px; letter-spacing: 1.6px; text-transform: uppercase; color: rgba(255,255,255,.32); font-weight: 700; }
.aiw-sign .logo { width: 14px; height: 14px; color: rgba(255,255,255,.4); }

/* ============================================================
   Alvó képernyő (kilépés iOS-en és ahol a bezárás nem engedélyezett)
   ============================================================ */
#sleep { position: fixed; inset: 0; z-index: 200; background: #05080f; display: grid; place-items: center; align-content: center; gap: 18px; text-align: center; padding: 24px; cursor: pointer; }
#sleep .sleep-logo { width: 72px; height: 72px; color: rgba(255,255,255,.14); }
#sleep-note { margin: 0; max-width: 300px; color: rgba(255,255,255,.45); font-size: 14px; line-height: 1.5; }
html.sleeping #app, html.sleeping #bg, html.sleeping #modal, html.sleeping #toast, html.sleeping .ins { visibility: hidden; }


/* ============================================================
   Új játékok (Logóépítő, Neuronháló, Kódfejtő, Szekvencia, Bitvadász, Fúzió)
   ============================================================ */
.board > .lb-piece, .board > .lb-target, .board > .nw-grid, .board > .sq-grid, .board > .sq-core,
.board > .rx-grid, .board > .fu-bg, .board > .fu-layer, .board > .board-overlay { position: absolute; }

/* Logóépítő */
.board > .lb-target { left: 0; top: 0; color: rgba(255,255,255,.14); z-index: 1; filter: drop-shadow(0 0 1px rgba(255,255,255,.35)); }
.board > .lb-piece { left: 0; top: 0; z-index: 3; pointer-events: none; transition: filter .2s; }
.lb-piece .lp { pointer-events: auto; cursor: grab; touch-action: none; background: linear-gradient(135deg, var(--g1), var(--g2)); }
.lb-piece.drag { filter: drop-shadow(0 14px 22px rgba(0,0,0,.55)); }
.lb-piece.drag .lp { cursor: grabbing; }
.lb-piece.locked .lp { background: #fff; pointer-events: none; }
.lb-piece.locked { filter: drop-shadow(0 0 16px rgba(77,225,255,.55)); }

/* Neuronháló */
.nw-grid { inset: 10px; display: grid; gap: 4px; }
.nw-cell { position: relative; padding: 0; border-radius: 10px; overflow: hidden; }
.nw-cell svg { width: 100%; height: 100%; display: block; transition: transform .18s ease-out; fill: none; stroke: rgba(255,255,255,.26); stroke-width: 13; stroke-linecap: round; }
.nw-cell .nw-node, .nw-cell .nw-joint { fill: rgba(255,255,255,.3); stroke: none; }
.nw-cell.on svg { stroke: var(--g1); filter: drop-shadow(0 0 5px var(--g1)); }
.nw-cell.on .nw-node { fill: var(--g1); }
.nw-cell.on .nw-joint { fill: var(--g1); }
.nw-cell.core { background: linear-gradient(145deg, var(--g1), var(--g2)); }
.nw-cell.core svg { stroke: rgba(255,255,255,.9); filter: none; }
.nw-core { position: absolute; left: 22%; top: 22%; width: 56%; color: #fff; filter: drop-shadow(0 2px 6px rgba(0,0,0,.35)); }

/* Kódfejtő */
.cd-board { gap: 8px; --peg: clamp(17px, calc((var(--app-h, 100dvh) - 470px) / (var(--tries) * 1.32)), 28px); }
.cd-row { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 3px 8px; border-radius: 12px; transition: background .2s; }
.cd-row.active { background: rgba(255,255,255,.07); box-shadow: inset 0 0 0 1px var(--g1); }
.cd-rows { display: flex; flex-direction: column; gap: 3px; }
.cd-num { width: 18px; text-align: right; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.cd-peg { width: var(--peg, 26px); height: var(--peg, 26px); border-radius: 50%; border: 2px dashed rgba(255,255,255,.2); display: grid; place-items: center; flex: none; }
.cd-peg.full { border: 2px solid rgba(0,0,0,.25); background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.55), transparent 45%), var(--pc); box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.cd-peg.shield { border: 2px solid rgba(255,255,255,.18); background: #16223a; }
.cd-peg.shield .logo { width: 62%; color: rgba(255,255,255,.75); }
.cd-secret { background: rgba(0,0,0,.28); padding: 8px 12px; }
.cd-fb { display: grid; grid-template-columns: repeat(3, 8px); gap: 3px; margin-left: 6px; min-width: 30px; }
.cd-fb i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.12); }
.cd-fb i.b { background: #0b1220; box-shadow: 0 0 0 1.5px #fff; }
.cd-fb i.w { background: #fff; }
.cd-lock { display: grid; place-items: center; color: var(--g1); grid-template-columns: 1fr; }
.cd-lock .ic { width: 18px; height: 18px; }
.cd-palette { display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; padding-top: 4px; }
.cd-color { width: 42px; height: 42px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.55), transparent 45%), var(--pc); box-shadow: 0 4px 0 rgba(0,0,0,.35), 0 8px 16px rgba(0,0,0,.3); transition: transform .1s; }
.cd-color:active { transform: translateY(3px); }
@media (max-width: 360px) { .cd-color { width: 38px; height: 38px; } }
/* fekvő / alacsony képernyőn a próbasorok két oszlopba rendeződnek */
@media (min-aspect-ratio: 1/1) and (max-height: 820px) {
  .cd-board { --peg: clamp(18px, calc((var(--app-h, 100dvh) - 420px) / (var(--half) * 1.32)), 28px); }
  .cd-rows { display: grid; grid-template-columns: 1fr 1fr; grid-auto-flow: column; grid-template-rows: repeat(var(--half), auto); gap: 3px 10px; }
}

/* Szekvencia */
.sq-grid { inset: 10px; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 12px; }
.sq-pad { border-radius: 28px; background: linear-gradient(145deg, var(--p1), var(--p2)); opacity: .42; filter: saturate(.75); transition: opacity .12s, filter .12s, box-shadow .12s; box-shadow: inset 0 2px 0 rgba(255,255,255,.3); }
.sq-pad:nth-child(1) { border-top-left-radius: 50%; } .sq-pad:nth-child(2) { border-top-right-radius: 50%; }
.sq-pad:nth-child(3) { border-bottom-left-radius: 50%; } .sq-pad:nth-child(4) { border-bottom-right-radius: 50%; }
.sq-pad.lit { opacity: 1; filter: brightness(1.2) saturate(1.1); box-shadow: 0 0 44px var(--p1), inset 0 2px 0 rgba(255,255,255,.5); }
.sq-core { left: 50%; top: 50%; width: 34%; aspect-ratio: 1; margin: -17% 0 0 -17%; border-radius: 50%; background: #0b1220; border: 4px solid rgba(255,255,255,.12); display: grid; place-items: center; align-content: center; gap: 2px; pointer-events: none; z-index: 2; }
.sq-core .logo { width: 44%; color: #fff; }
.sq-core b { font-family: var(--font-head); font-size: 20px; color: var(--g1); line-height: 1; font-variant-numeric: tabular-nums; }

/* Bitvadász */
.rx-grid { inset: 10px; display: grid; gap: 10px; }
.rx-hole { position: relative; border-radius: 18px; display: grid; place-items: center; overflow: hidden; }
.rx-item { width: 74%; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; padding: 0; touch-action: manipulation; }
.rx-item.bit { background: linear-gradient(145deg, #4de1ff, #8b7bff); box-shadow: 0 6px 18px -4px rgba(77,225,255,.8); }
.rx-item.gold { background: linear-gradient(145deg, #ffe08a, #ff9f5a); box-shadow: 0 6px 22px -4px rgba(255,200,87,.9); }
.rx-item.bug { background: linear-gradient(145deg, #ff7a8c, #d4203c); box-shadow: 0 6px 18px -4px rgba(255,93,115,.8); color: #fff; }
.rx-item .logo { width: 56%; color: #fff; }
.rx-item.gold .logo { color: #3a2a00; }
.rx-item .ic { width: 56%; height: 56%; }

/* Fúzió */
.fu-bg { inset: 10px; display: grid; gap: max(6px, 2.2%); }
.fu-bg i { border-radius: 12px; background: rgba(255,255,255,.05); box-shadow: inset 0 0 0 1px rgba(255,255,255,.04); }
.fu-layer { inset: 10px; }
.fu-tile { position: absolute; left: 0; top: 0; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-family: var(--font-head); font-weight: 700; line-height: 1.05; box-shadow: inset 0 2px 0 rgba(255,255,255,.25), 0 6px 14px -6px rgba(0,0,0,.6); }
.fu-tile b { font-size: 1em; }
.fu-tile small { font-size: .5em; opacity: .75; font-family: var(--font-body); font-weight: 700; }
.fu-tile.ai { background: linear-gradient(145deg, #ffffff, #cfe3ff) !important; color: #0b1220 !important; box-shadow: 0 0 26px rgba(77,225,255,.85); }
.fu-tile.ai .logo { width: 46%; color: #1b2638; }
.fu-wall { background: repeating-linear-gradient(45deg, #3a1320 0 8px, #5a1a2c 8px 16px); color: #ffb3c0; font-size: 12px; }
.fu-wall .ic { width: 36%; height: 36%; }

#lb-board::before { display: none; }
/* Kódfejtő alacsony álló képernyőn (pl. 360×640): tömörebb sorok, hogy az Ellenőrzés gomb görgetés nélkül látsszon */
@media (max-height: 740px) and (max-aspect-ratio: 1/1), (max-height: 500px) {
  .cd-board { gap: 5px; --peg: clamp(15px, calc((var(--app-h, 100dvh) - 470px) / (var(--tries) * 1.1)), 26px); }
  .cd-rows { gap: 2px; }
  .cd-row { padding: 1px 6px; }
  .cd-secret { padding: 4px 10px; }
  .cd-color { width: 36px; height: 36px; }
  .cd-palette { gap: 7px; padding-top: 2px; }
}
@media (max-height: 420px) {
  .cd-color { width: 30px; height: 30px; }
  .cd-board { gap: 3px; }
  .cd-secret { padding: 2px 8px; }
}

/* === 1.7: kategóriák, vezérlőpult, szimulátorok, retro 3D, C64, kártyák === */

/* Főmenü kategóriaszűrő – vízszintesen görgethető, fix magasságú sáv (nem ugrik) */
.cat-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 12px; margin: 0 0 4px; scrollbar-width: none; min-height: 52px; -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 10px, #000 calc(100% - 24px), transparent); mask-image: linear-gradient(90deg, transparent 0, #000 10px, #000 calc(100% - 24px), transparent); padding-left: 6px; padding-right: 20px; }
.cat-row::-webkit-scrollbar { display: none; }
.cat-chip { flex: none; display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 8px 14px; border-radius: 99px; background: var(--surface); border: 1px solid var(--stroke); font-weight: 700; font-size: 14px; white-space: nowrap; color: inherit; transition: background .2s, color .2s, border-color .2s; }
.cat-chip .ic { width: 16px; height: 16px; }
.cat-chip small { font-size: 12px; font-weight: 700; opacity: .7; min-width: 1.4em; padding: 1px 6px; border-radius: 99px; background: rgba(255,255,255,.1); text-align: center; }
.cat-chip.on { background: linear-gradient(135deg, var(--cyan), var(--violet)); color: #0b1220; border-color: transparent; }
.cat-chip.on small { background: rgba(11,18,32,.18); opacity: 1; }

/* Érintős vezérlőpult (valós idejű játékok) */
.kit-pad { display: flex; align-items: stretch; justify-content: center; gap: 16px; width: var(--bs); min-width: 260px; user-select: none; -webkit-user-select: none; touch-action: none; -webkit-touch-callout: none; }
.kit-dpad { display: grid; grid-template-columns: repeat(3, 58px); grid-template-rows: repeat(2, 50px); gap: 6px; }
.kit-dpad.flat { grid-template-columns: repeat(2, 66px); grid-template-rows: 56px; }
.kit-btn { padding: 0; touch-action: none; -webkit-tap-highlight-color: transparent; }
.kit-btn .ic { width: 22px; height: 22px; }
.kit-btn.on { background: rgba(255,255,255,.16); border-color: var(--g1); color: var(--g1); transform: scale(.95); }
.kit-dpad .d-up { grid-column: 2; grid-row: 1; } .kit-dpad .d-left { grid-column: 1; grid-row: 2; }
.kit-dpad .d-down { grid-column: 2; grid-row: 2; } .kit-dpad .d-right { grid-column: 3; grid-row: 2; }
.kit-dpad.flat .d-left { grid-column: 1; grid-row: 1; } .kit-dpad.flat .d-right { grid-column: 2; grid-row: 1; }
.kit-actions { display: flex; gap: 8px; }
.kit-actions .act { min-width: 96px; flex-direction: column; gap: 3px; font-size: 13px; font-weight: 800; background: linear-gradient(150deg, rgba(255,255,255,.1), rgba(255,255,255,.03)); border-color: var(--g1); color: var(--g1); }
.kit-pad.flat .kit-actions .act { flex-direction: row; gap: 8px; min-width: 128px; }
.kit-actions .act.on { background: linear-gradient(135deg, var(--g1), var(--g2)); color: #0b1220; }
@media (max-width: 360px) { .kit-dpad { grid-template-columns: repeat(3, 52px); grid-template-rows: repeat(2, 46px); } .kit-actions .act { min-width: 80px; } }

/* Valós idejű játékok: több hely a vezérlőknek, a tábla ehhez igazodik */
#scr-game[data-kind="action"] { --off: 400px; }
#scr-game[data-kind="fps"] { --off: 390px; }
#scr-game[data-kind="fps"] .board { aspect-ratio: 4 / 3; }
@media (max-height: 720px) {
  #scr-game[data-kind="action"] { --off: 330px; }
  #scr-game[data-kind="fps"] { --off: 300px; }
}
@media (min-width: 640px) { #scr-game[data-kind="fps"] { --bs: max(260px, min(92vw, 640px, calc((var(--app-h, 100dvh) - var(--off)) * 4 / 3))); } }
.board canvas { touch-action: none; }
.fps-board canvas { image-rendering: pixelated; image-rendering: crisp-edges; cursor: crosshair; }

/* C64 képernyő: jellegzetes világoskék keret, CRT-pásztázás */
.board.c64 { background: #6c5eb5; border-radius: 18px; border-color: rgba(0,0,0,.35); box-shadow: inset 0 0 0 3px rgba(255,255,255,.08), inset 0 0 40px rgba(0,0,0,.35), var(--shadow); }
.board.c64::before { background: rgba(255,255,255,.6); width: 18%; height: 5%; aspect-ratio: auto; top: auto; bottom: .8%; transform: translateX(-50%); } /* AIWORKS „gyártói” jelvény a C64 keretén */
.board.c64 > canvas { inset: 7%; width: 86%; height: 86%; border-radius: 6px; image-rendering: pixelated; image-rendering: crisp-edges; box-shadow: 0 0 0 2px rgba(0,0,0,.25); }
.board.c64::after { content: ''; position: absolute; inset: 7%; border-radius: 6px; pointer-events: none; z-index: 2; background: repeating-linear-gradient(180deg, rgba(0,0,0,.18) 0 1px, transparent 1px 3px), radial-gradient(ellipse at center, transparent 60%, rgba(0,0,0,.35)); mix-blend-mode: multiply; }

/* Kártyák */
.card-table { position: relative; display: block !important; padding: 0 !important; height: max(360px, calc(var(--app-h, 100dvh) - 300px)); max-height: 760px; width: min(96vw, 640px) !important; background: radial-gradient(ellipse at 50% 40%, rgba(62,230,168,.10), rgba(255,255,255,.02) 70%); overflow: hidden; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
@media (max-height: 720px) { .card-table { height: max(330px, calc(var(--app-h, 100dvh) - 250px)); } }
.pcard, .pslot { position: absolute; width: var(--cw, 60px); height: calc(var(--cw, 60px) * 1.4); border-radius: calc(var(--cw, 60px) * .1); }
.pcard { background: linear-gradient(160deg, #ffffff, #e9eef7); color: #1b2638; box-shadow: 0 1px 0 rgba(0,0,0,.25), 0 4px 10px rgba(0,0,0,.3); cursor: pointer; overflow: hidden; transition: box-shadow .15s, filter .15s; -webkit-tap-highlight-color: transparent; }
.pcard.red { color: #d72d4b; }
.pcard svg { fill: currentColor; display: block; }
.pc-corner { position: absolute; left: 7%; top: 5%; display: flex; flex-direction: column; align-items: center; line-height: 1; }
.pc-corner b { font-family: var(--font-head); font-size: calc(var(--cw, 60px) * .3); font-weight: 700; letter-spacing: -.5px; }
.pc-corner svg { width: calc(var(--cw, 60px) * .22); height: calc(var(--cw, 60px) * .22); margin-top: 1px; }
.pc-corner.br { left: auto; top: auto; right: 7%; bottom: 5%; transform: rotate(180deg); }
.pc-mid { position: absolute; left: 50%; top: 52%; width: 44%; height: 44%; transform: translate(-50%, -50%); }
.pc-face { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -58%); font-family: var(--font-head); font-size: calc(var(--cw, 60px) * .52); font-weight: 700; opacity: .9; }
.pc-face-s { position: absolute; left: 50%; bottom: 16%; width: 26%; height: 26%; transform: translateX(-50%); }
.pcard.down { background: linear-gradient(145deg, #1c2c4c, #2d4a7a); border: 2px solid rgba(255,255,255,.85); display: grid; place-items: center; }
.pcard.down::before { content: ''; position: absolute; inset: 5%; border-radius: inherit; border: 1px solid rgba(77,225,255,.45); background: repeating-linear-gradient(45deg, rgba(255,255,255,.04) 0 4px, transparent 4px 8px); }
.pcard.down .logo { position: relative; width: 52%; color: #fff; opacity: .92; }
.pcard.sel { box-shadow: 0 0 0 3px var(--g1), 0 0 18px var(--g1); transform: translateY(-4px); }
.pcard.hint, .pslot.hint { animation: pc-hint .45s ease-in-out 3; }
@keyframes pc-hint { 50% { box-shadow: 0 0 0 3px #ffd27a, 0 0 22px #ffd27a; } }
.pcard.blocked { filter: brightness(.82); cursor: default; }
.pslot { border: 2px dashed rgba(255,255,255,.22); display: grid; place-items: center; color: rgba(255,255,255,.4); font-family: var(--font-head); font-size: calc(var(--cw, 60px) * .35); cursor: pointer; }
.pslot .ic { width: 40%; height: 40%; }

/* Huszonegy asztal */
.bj-table { display: flex !important; flex-direction: column; justify-content: space-between; padding: 14px 12px !important; --cw: clamp(48px, 15vw, 74px); background: radial-gradient(ellipse at 50% 50%, rgba(62,230,168,.16), rgba(20,60,50,.12) 60%, rgba(255,255,255,.02)); }
.bj-row { display: flex; flex-direction: column; gap: 8px; min-height: calc(var(--cw) * 1.4 + 34px); }
.bj-label { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--muted); font-size: 14px; min-height: 26px; }
.bj-val { color: #fff; font-family: var(--font-head); font-size: 20px; min-width: 3ch; font-variant-numeric: tabular-nums; }
.bj-bet { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; color: var(--amber); font-weight: 800; }
.bj-bet .ic { width: 16px; height: 16px; }
.bj-hand { position: relative; display: flex; min-height: calc(var(--cw) * 1.4); }
.bj-hand .pcard { position: relative; flex: none; margin-right: calc(var(--cw) * -.42); }
.bj-mid { position: relative; display: grid; place-items: center; min-height: 64px; }
.bj-logo { position: absolute; width: min(34%, 120px); color: rgba(255,255,255,.07); }
.bj-msg { position: relative; font-family: var(--font-head); font-size: 20px; text-align: center; min-height: 1.3em; text-shadow: 0 2px 10px rgba(0,0,0,.5); }
.bj-shoe { position: absolute; right: 12px; top: 12px; width: var(--cw); height: calc(var(--cw) * 1.4); pointer-events: none; opacity: .85; }
.bj-shoe .pcard { transform: rotate(8deg); }
.bj-controls { min-height: 48px; }
.bj-chip .ic { color: var(--amber); }

/* Fekvő telefon: a kártyaasztal is a bal oszlopba kerül */
@media (orientation: landscape) and (max-height: 560px) {
  .game-stage > .card-table { grid-column: 1; grid-row: 1 / span 8; height: calc(var(--app-h, 100dvh) - 120px); width: min(58vw, 640px) !important; }
  .kit-pad { width: 100%; min-width: 0; flex-wrap: wrap; }
}

/* Keskeny kijelzőn a HUD egy sorban marad (nem tolja le a táblát): a címke rövidül, nem a tördelés nő */
@media (max-width: 440px) {
  .hud { flex-wrap: nowrap; gap: 6px; max-width: 100%; }
  .hud .pill { min-width: 0; padding: 7px 9px; gap: 5px; overflow: hidden; flex: 0 1 auto; }
  .hud .pill small { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: .2px; }
  .hud .pill span[data-hud] { flex: none; }
}
.card-table { height: max(340px, calc(var(--app-h, 100dvh) - 322px)); }
@media (max-height: 720px) { .card-table { height: max(320px, calc(var(--app-h, 100dvh) - 262px)); } }

/* Fekvő telefon (pl. 844×390): egysoros játékfej, a tábla felülre igazítva – semmi nem lóg ki, nincs görgetés */
@media (orientation: landscape) and (max-height: 560px) {
  .game-head { flex-wrap: nowrap; min-height: 0; height: 40px; gap: 6px 12px; margin-bottom: 6px; }
  .game-head .hud { flex-wrap: nowrap; gap: 6px; }
  .hud .pill { padding: 4px 9px; min-width: 0; }
  #scr-game, #scr-game[data-game], #scr-game[data-kind] { --bs: max(170px, min(46vw, calc(var(--app-h, 100dvh) - 118px))); }
  #scr-game[data-kind="fps"] .board { width: min(calc((var(--app-h, 100dvh) - 118px) * 4 / 3), 52vw); }
  .game-stage { align-items: start; }
  .game-stage > .board, .game-stage > .card-table { align-self: start; }
  .game-stage > .card-table { height: calc(var(--app-h, 100dvh) - 118px); }
  .game-stage > .board.free:not(.card-table) { max-height: calc(var(--app-h, 100dvh) - 118px); overflow: auto; }
}@media (orientation: landscape) and (max-height: 560px) {
  .bj-table { padding: 8px 12px !important; --cw: clamp(34px, calc((var(--app-h, 100dvh) - 118px - 150px) / 2.8), 64px); }
  .bj-mid { min-height: 30px; }
  .bj-row { gap: 4px; min-height: calc(var(--cw) * 1.4 + 28px); }
  .bj-msg { font-size: 16px; }
}@media (max-height: 720px) { .card-table { height: max(300px, calc(var(--app-h, 100dvh) - 284px)); } }
@media (max-height: 720px) and (orientation: portrait), (max-height: 720px) and (min-height: 561px) { #scr-game[data-kind="fps"] { --off: 345px; } }

/* Érintőképernyő: nincs szövegkijelölés, hosszú nyomásra felugró menü vagy nagyítás a játéktéren */
#game-stage, #game-stage canvas, .kit-pad, .card-table { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
#game-stage input, #game-stage textarea { -webkit-user-select: text; user-select: text; }

/* Súgó (szintválasztó ablakban és a játék közbeni „?” gombbal) */
.help { text-align: left; display: flex; flex-direction: column; gap: 12px; margin: 4px 0 2px; }
.help-goal { display: flex; gap: 10px; align-items: flex-start; margin: 0; font-weight: 600; line-height: 1.45; color: #eef3fb; }
.help-goal .ic { flex: none; width: 20px; height: 20px; color: var(--g1, var(--cyan)); margin-top: 1px; }
.help-sec h4 { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 13px; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); }
.help-sec h4 .ic { width: 16px; height: 16px; color: var(--g1, var(--cyan)); }
.help-sec ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 5px; }
.help-sec li { line-height: 1.45; font-size: 14.5px; }
.help-box { margin: 14px 0 4px; border: 1px solid var(--stroke); border-radius: 16px; background: rgba(255,255,255,.04); text-align: left; }
.help-box summary { list-style: none; display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 14px; cursor: pointer; font-weight: 700; }
.help-box summary::-webkit-details-marker { display: none; }
.help-box summary .ic { width: 18px; height: 18px; color: var(--cyan); }
.help-box summary .chev { margin-left: auto; transition: transform .2s; color: var(--muted); }
.help-box[open] summary .chev { transform: rotate(180deg); }
.help-box .help { padding: 0 14px 14px; }
/* Egységes érintési visszajelzés (iOS, Android, asztal): lenyomáskor világosodik a gomb */
.btn.ghost:active, .kit-btn:active { background: var(--surface-2); }
.level-btn:active { background: rgba(77,225,255,.16); }
.game-card:active { box-shadow: 0 18px 40px -20px var(--c1); }

/* Betöltésjelző (induláskor, toplista, eredményfeltöltés, képbetöltés, játék-előkészítés, frissítés).
   A felirat rendszer-betűtípussal jelenik meg, hogy lassú hálózaton is azonnal olvasható legyen. */
.loadbar { width: 100%; max-width: 280px; margin: 0 auto; font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
.ldb-track { position: relative; height: 6px; border-radius: 6px; background: rgba(255,255,255,.12); overflow: hidden; }
.ldb-track i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: inherit; background: linear-gradient(90deg, #4de1ff, #8b7bff, #ff6b9a); transition: width .25s ease-out; }
.loadbar.ind .ldb-track i { width: 35% !important; animation: lb-ind 1.1s ease-in-out infinite; }
@keyframes lb-ind { 0% { left: -35%; } 100% { left: 100%; } }
.ldb-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-top: 8px; min-height: 18px; }
.ldb-label { font-size: 13px; color: #b8c4d8; }
.ldb-pct { font-size: 13px; color: #eef3fb; font-variant-numeric: tabular-nums; min-width: 4ch; text-align: right; }
.splash-load { width: min(280px, 72vw); min-height: 40px; }
.splash-note { width: min(320px, 86vw); margin-top: 14px; text-align: center; font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
.splash-note p { margin: 0 0 12px; color: #ffd6dc; font-size: 14px; line-height: 1.45; }
.splash-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.stage-loading { position: absolute; inset: 0; display: grid; place-items: center; z-index: 6; pointer-events: none; }
.board .loadbar { max-width: 70%; }
.ldb-box { padding: 36px 12px; }
.submit-state .loadbar { max-width: 220px; margin: 0; }
.stage-prep { display: grid; place-items: center; width: var(--bs); min-width: 260px; aspect-ratio: 1; }
@media (pointer: coarse) { .aurora { animation: none; } } /* telefonon álló fényfoltok: nem külön, képernyőnyi GPU-rétegek */

/* Érintős eszközök (telefon, tablet): GPU-kímélő megjelenés – ugyanaz a kinézet, jóval kevesebb grafikus munka.
   A görgő tartalom feletti elmosás (backdrop-filter) minden görgetési képkockában újrarajzolást kér, a görgő sávok
   maszkja pedig külön renderelési felületet – Androidon ezek okozták a menü szétesését. */
@media (pointer: coarse) {
  .game-card { box-shadow: 0 10px 22px -14px rgba(0, 0, 0, .7); }
  .badge { box-shadow: inset 0 1px 0 rgba(255,255,255,.35); }
  .icon-btn, #topbar .icon-btn, #topbar .net { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(11, 18, 32, .86); }
  .cat-row, .tabs { -webkit-mask-image: none; mask-image: none; }
}

/* Telefonon a háttér (fényfoltok) közvetlenül a body háttérképébe van festve, külön rögzített réteg (#bg) nélkül:
   így a görgő menü alatt nincs összetett réteg, amelyet a böngészőnek „át kellene fednie” – nincs rétegrobbanás. */
@media (pointer: coarse) {
  #bg { display: none; }
  body {
    background:
      radial-gradient(60vmax 60vmax at 5% 0%, rgba(139, 123, 255, .30), transparent 70%),
      radial-gradient(65vmax 65vmax at 100% 100%, rgba(77, 225, 255, .20), transparent 70%),
      radial-gradient(35vmax 35vmax at 70% 55%, rgba(255, 107, 154, .07), transparent 70%),
      radial-gradient(1200px 800px at 50% -10%, #1a2a47 0%, var(--bg) 60%);
    background-color: var(--bg);
  }
}

/* Telefonon az üvegkártyák (toplista, névmegadás, impresszum) és a rögzített sávok görgő tartalom felett
   elmosás helyett tömör színátmenetet kapnak – ugyanaz a hatás, GPU-renderelési hiba kockázata nélkül */
@media (pointer: coarse) {
  .glass { -webkit-backdrop-filter: none; backdrop-filter: none; background: linear-gradient(160deg, #1f2940, #131b2d); }
  .offline-banner { -webkit-backdrop-filter: none; backdrop-filter: none; }
}
