/* games.chinthanrkunder.com — two skins: "comic" (Comic Blast, default) and "synth" (Synthwave).
   The active skin is data-skin on <html>, set before paint by the head snippet, toggled in the header. */

/* Self-hosted fonts (latin subsets, ~53KB total) — no third-party requests. */
@font-face { font-family: "Bangers"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/bangers.woff2") format("woff2"); }
@font-face { font-family: "Monoton"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/monoton.woff2") format("woff2"); }
@font-face { font-family: "Press Start 2P"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/press-start-2p.woff2") format("woff2"); }

* { box-sizing: border-box; }

/* ---------- comic tokens (default) ---------- */
:root {
  --bg: #fdf3e0;
  --ink: #16130e;
  --text: #16130e;
  --muted: #6f6650;
  --panel: #ffffff;
  --panel-alt: #cfefff;
  --accent: #d63c3c;
  --gold: #ffd23e;
  --correct: #2ecc40;
  --present: #ffdc00;
  --absent: #d5cfc2;
  --absent-text: #8d8676;
  --tile-text: #16130e;
  --state-text: #16130e;
  --key-bg: #ffffff;
  --key-text: #16130e;
  --chip-bg: #ffd23e;
  --chip-done: #79dd8b;
  --overlay: rgba(22, 19, 14, 0.55);
  --font-display: "Bangers", "Arial Black", cursive;
}

/* ---------- synth tokens ---------- */
:root[data-skin="synth"] {
  --bg: #0a0118;
  --ink: #22e6ff;
  --text: #eae6ff;
  --muted: #b9aee0;
  --panel: rgba(16, 4, 38, 0.85);
  --panel-alt: rgba(16, 4, 38, 0.85);
  --accent: #ff3ec8;
  --gold: #ffd23e;
  --correct: #39ff88;
  --present: #ffd23e;
  --absent: #14102a;
  --absent-text: #55497e;
  --tile-text: #eae6ff;
  --state-text: #0a0118;
  --key-bg: #180533;
  --key-text: #22e6ff;
  --chip-bg: #180533;
  --chip-done: #180533;
  --overlay: rgba(4, 0, 12, 0.75);
  --font-display: "Monoton", "Arial Black", cursive;
  --font-hud: "Press Start 2P", monospace;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  margin: 0;
  min-height: 100vh;
}
:root[data-skin="comic"] body {
  background-image: radial-gradient(circle, rgba(214, 60, 60, 0.16) 1.5px, transparent 1.5px);
  background-size: 9px 9px;
}
:root[data-skin="synth"] body {
  background-image:
    radial-gradient(ellipse 120% 60% at 50% -10%, #2a0a4a 0%, transparent 60%),
    radial-gradient(ellipse 80% 40% at 80% 110%, #3d0a3d 0%, transparent 55%);
  background-attachment: fixed;
}
/* synth scanlines */
:root[data-skin="synth"] body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 50;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.20) 0 1px, transparent 1px 3px);
}

.wrap { max-width: 520px; margin: 0 auto; padding: 10px 12px 34px; position: relative; }

/* ---------- header ---------- */
header { display: flex; align-items: center; gap: 10px; padding-bottom: 8px; margin-bottom: 14px; }
:root[data-skin="comic"] header { border-bottom: 3px solid var(--ink); }
:root[data-skin="synth"] header { border-bottom: 2px solid #33285c; }
header h1 { font-family: var(--font-display); font-weight: 400; font-size: 26px; margin: 0; flex: 1; letter-spacing: 2px; }
:root[data-skin="comic"] header h1 { color: var(--accent); -webkit-text-stroke: 1px var(--ink); text-shadow: 2px 2px 0 var(--gold); transform: rotate(-1deg); }
:root[data-skin="synth"] header h1 { font-family: var(--font-hud); color: var(--accent); font-size: 14px; padding-top: 4px; letter-spacing: 1px; text-shadow: 0 0 8px rgba(255, 62, 200, 0.8), 0 0 20px rgba(255, 62, 200, 0.45); }
.backlink { text-decoration: none; font-size: 14px; font-weight: 700; }
:root[data-skin="comic"] .backlink { color: var(--ink); background: var(--gold); border: 2px solid var(--ink); padding: 2px 8px; border-radius: 4px; box-shadow: 2px 2px 0 var(--ink); }
:root[data-skin="synth"] .backlink { font-family: var(--font-hud); font-size: 9px; letter-spacing: 1px; padding-top: 6px; color: #22e6ff; text-shadow: 0 0 8px rgba(34, 230, 255, 0.7); text-transform: uppercase; }
.helpbtn { width: 30px; height: 30px; font-size: 15px; font-weight: 700; cursor: pointer; border-radius: 50%; }
:root[data-skin="comic"] .helpbtn { background: var(--panel); color: var(--ink); border: 2.5px solid var(--ink); box-shadow: 2px 2px 0 var(--ink); }
:root[data-skin="synth"] .helpbtn { background: var(--key-bg); color: #22e6ff; border: 1.5px solid #22e6ff; box-shadow: 0 0 8px rgba(34, 230, 255, 0.4); }
.skinbtn { font-size: 10px; font-weight: 700; cursor: pointer; letter-spacing: 1px; padding: 6px 8px; }
:root[data-skin="comic"] .skinbtn { background: #b39ddb; color: var(--ink); border: 2.5px solid var(--ink); border-radius: 4px; box-shadow: 2px 2px 0 var(--ink); transform: rotate(1deg); }
:root[data-skin="synth"] .skinbtn { font-family: var(--font-hud); font-size: 8px; background: var(--key-bg); color: var(--gold); border: 1.5px solid var(--gold); border-radius: 4px; box-shadow: 0 0 8px rgba(255, 210, 62, 0.4); text-shadow: 0 0 8px rgba(255, 210, 62, 0.7); }
a:focus-visible, button:focus-visible, select:focus-visible { outline: 3px solid #2f9dff; outline-offset: 2px; }
.hidden { display: none !important; }

/* ---------- hub ---------- */
.masthead { text-align: center; margin: 6px 0 0; }
.masthead .site-title { font-family: var(--font-display); font-weight: 400; margin: 0; }
:root[data-skin="comic"] .masthead .site-title { font-size: 52px; color: var(--accent); -webkit-text-stroke: 1.5px var(--ink); text-shadow: 3px 3px 0 var(--gold), 6px 6px 0 var(--ink); letter-spacing: 3px; transform: rotate(-2deg); }
:root[data-skin="synth"] .masthead .site-title { font-size: 42px; color: var(--accent); letter-spacing: 3px; text-shadow: 0 0 6px rgba(255, 62, 200, 0.9), 0 0 24px rgba(255, 62, 200, 0.6), 0 0 60px rgba(255, 62, 200, 0.4), 2px 2px 0 rgba(34, 230, 255, 0.55); }
.masthead .site-sub { display: table; margin: 12px auto 22px; }
:root[data-skin="comic"] .masthead .site-sub { font-size: 12px; font-weight: 700; color: var(--ink); background: var(--gold); border: 2px solid var(--ink); padding: 3px 12px; transform: rotate(1deg); box-shadow: 3px 3px 0 var(--ink); }
:root[data-skin="synth"] .masthead .site-sub { font-family: var(--font-hud); font-size: 8px; color: #22e6ff; text-shadow: 0 0 10px rgba(34, 230, 255, 0.8); letter-spacing: 1px; }
.cards { display: flex; flex-direction: column; gap: 14px; }
.gamecard { display: block; width: 100%; text-align: left; cursor: pointer; text-decoration: none; padding: 14px 16px; color: var(--text); }
:root[data-skin="comic"] .gamecard { background: var(--panel); border: 3px solid var(--ink); border-radius: 4px; box-shadow: 6px 6px 0 var(--ink); transform: rotate(-1deg); }
:root[data-skin="comic"] .gamecard:nth-child(even) { background: var(--panel-alt); transform: rotate(1deg); }
:root[data-skin="comic"] .gamecard:active { transform: translate(3px, 3px) rotate(-1deg); box-shadow: 2px 2px 0 var(--ink); }
:root[data-skin="synth"] .gamecard { background: var(--panel); border: 2px solid #22e6ff; border-radius: 10px; box-shadow: 0 0 14px rgba(34, 230, 255, 0.35), inset 0 0 22px rgba(34, 230, 255, 0.08); }
:root[data-skin="synth"] .gamecard:nth-child(even) { border-color: var(--accent); box-shadow: 0 0 14px rgba(255, 62, 200, 0.35), inset 0 0 22px rgba(255, 62, 200, 0.08); }
.gamecard b { display: block; margin-bottom: 4px; font-family: var(--font-display); font-weight: 400; }
:root[data-skin="comic"] .gamecard b { font-size: 24px; letter-spacing: 1.5px; color: var(--ink); }
:root[data-skin="synth"] .gamecard b { font-family: var(--font-hud); font-size: 13px; color: #22e6ff; text-shadow: 0 0 10px rgba(34, 230, 255, 0.8); }
:root[data-skin="synth"] .gamecard:nth-child(even) b { color: var(--accent); text-shadow: 0 0 10px rgba(255, 62, 200, 0.8); }
.gamecard span { font-size: 13px; color: var(--muted); }
.chip { display: inline-block; margin-top: 9px; font-size: 11px; font-weight: 700; }
:root[data-skin="comic"] .chip { background: var(--chip-bg); border: 2px solid var(--ink); border-radius: 999px; padding: 3px 10px; color: var(--ink); }
:root[data-skin="comic"] .chip.done { background: var(--chip-done); }
:root[data-skin="synth"] .chip { font-family: var(--font-hud); font-size: 7.5px; padding: 5px 8px; border-radius: 4px; background: var(--chip-bg); border: 1px solid var(--gold); color: var(--gold); text-shadow: 0 0 8px rgba(255, 210, 62, 0.7); letter-spacing: 0.5px; }
:root[data-skin="synth"] .chip.done { border-color: #39ff88; color: #39ff88; text-shadow: 0 0 8px rgba(57, 255, 136, 0.7); }

/* ---------- tabs + controls ---------- */
.tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tabs button { flex: 1; padding: 8px 0; font-size: 14px; font-weight: 700; cursor: pointer; }
:root[data-skin="comic"] .tabs button { background: var(--panel); color: var(--ink); border: 2.5px solid var(--ink); border-radius: 5px; box-shadow: 3px 3px 0 var(--ink); }
:root[data-skin="comic"] .tabs button[aria-selected="true"] { background: var(--gold); }
:root[data-skin="synth"] .tabs button { font-family: var(--font-hud); font-size: 9px; letter-spacing: 1px; text-transform: uppercase; background: var(--key-bg); color: var(--muted); border: 1.5px solid #33285c; border-radius: 6px; }
:root[data-skin="synth"] .tabs button[aria-selected="true"] { color: #22e6ff; border-color: #22e6ff; box-shadow: 0 0 10px rgba(34, 230, 255, 0.4); text-shadow: 0 0 8px rgba(34, 230, 255, 0.7); }
.controls { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.topics { display: flex; gap: 6px; flex-wrap: wrap; }
.topics button { font-size: 12.5px; font-weight: 700; padding: 7px 11px; cursor: pointer; }
:root[data-skin="comic"] .topics button { background: var(--panel); color: var(--ink); border: 2.5px solid var(--ink); border-radius: 999px; box-shadow: 2px 2px 0 var(--ink); }
:root[data-skin="comic"] .topics button[aria-checked="true"] { background: var(--gold); }
:root[data-skin="comic"] .topics button:active { transform: translate(2px, 2px); box-shadow: none; }
:root[data-skin="synth"] .topics button { font-family: var(--font-hud); font-size: 8px; letter-spacing: 0.5px; text-transform: uppercase; background: var(--key-bg); color: var(--muted); border: 1.5px solid #33285c; border-radius: 999px; padding: 9px 11px; }
:root[data-skin="synth"] .topics button[aria-checked="true"] { color: #22e6ff; border-color: #22e6ff; box-shadow: 0 0 10px rgba(34, 230, 255, 0.4); text-shadow: 0 0 8px rgba(34, 230, 255, 0.7); }
.controls label { font-size: 14px; font-weight: 700; }
.controls select, .controls button { font-size: 14px; padding: 7px 10px; cursor: pointer; }
:root[data-skin="comic"] .controls select, :root[data-skin="comic"] .controls button { background: var(--panel); color: var(--ink); border: 2.5px solid var(--ink); border-radius: 5px; box-shadow: 2px 2px 0 var(--ink); }
:root[data-skin="synth"] .controls label { font-family: var(--font-hud); font-size: 8.5px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
:root[data-skin="synth"] .controls select, :root[data-skin="synth"] .controls button { font-family: var(--font-hud); font-size: 8.5px; letter-spacing: 0.5px; text-transform: uppercase; background: var(--key-bg); color: var(--text); border: 1.5px solid #33285c; border-radius: 6px; padding: 9px 10px; }

/* ---------- messages ---------- */
.msg { min-height: 26px; text-align: center; margin: 6px 0; }
:root[data-skin="comic"] .msg { font-family: var(--font-display); font-size: 19px; letter-spacing: 1.5px; color: var(--accent); transform: rotate(-1deg); }
:root[data-skin="synth"] .msg { font-family: var(--font-hud); font-size: 9px; color: var(--gold); text-shadow: 0 0 10px rgba(255, 210, 62, 0.8); letter-spacing: 1px; padding-top: 6px; }
.subline { text-align: center; font-size: 13px; color: var(--muted); margin: 2px 0 8px; }
:root[data-skin="synth"] .subline { font-family: var(--font-hud); font-size: 8px; letter-spacing: 1px; }

/* ---------- board tiles ---------- */
.board { display: flex; flex-direction: column; gap: 6px; align-items: center; margin: 8px 0; }
.row { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.tile {
  width: min(15vw, 56px); height: min(15vw, 56px);
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(18px, 6vw, 27px); font-weight: 700; text-transform: uppercase;
  color: var(--tile-text);
}
:root[data-skin="comic"] .tile { background: rgba(255, 255, 255, 0.6); border: 3px solid #b8ac8d; border-radius: 4px; }
:root[data-skin="comic"] .tile.filled { background: var(--panel); border-color: var(--ink); box-shadow: 3px 3px 0 var(--ink); }
:root[data-skin="comic"] .tile.correct { background: var(--correct); border-color: var(--ink); box-shadow: 3px 3px 0 var(--ink); }
:root[data-skin="comic"] .tile.present { background: var(--present); border-color: var(--ink); box-shadow: 3px 3px 0 var(--ink); }
:root[data-skin="comic"] .tile.absent { background: var(--absent); border-color: var(--absent); color: var(--absent-text); }
:root[data-skin="synth"] .tile { background: transparent; border: 2px solid #33285c; border-radius: 6px; text-shadow: 0 0 8px rgba(234, 230, 255, 0.5); }
:root[data-skin="synth"] .tile.filled { background: rgba(16, 4, 38, 0.9); border-color: #4a3a7a; }
:root[data-skin="synth"] .tile.correct { background: #0d3521; border-color: var(--correct); color: var(--correct); box-shadow: 0 0 12px rgba(57, 255, 136, 0.55), inset 0 0 10px rgba(57, 255, 136, 0.25); text-shadow: 0 0 10px rgba(57, 255, 136, 0.9); }
:root[data-skin="synth"] .tile.present { background: #3a2c07; border-color: var(--present); color: var(--present); box-shadow: 0 0 12px rgba(255, 210, 62, 0.5), inset 0 0 10px rgba(255, 210, 62, 0.22); text-shadow: 0 0 10px rgba(255, 210, 62, 0.9); }
:root[data-skin="synth"] .tile.absent { background: var(--absent); border-color: #241d44; color: var(--absent-text); text-shadow: none; }
.row.small .tile { width: min(9.5vw, 40px); height: min(9.5vw, 40px); font-size: clamp(14px, 4vw, 20px); }

/* ---------- hangman figure ---------- */
.figure { display: flex; justify-content: center; margin: 4px 0; }
.figure svg { width: min(36vw, 140px); height: auto; }
.figure line, .figure circle { fill: none; stroke-linecap: round; }
:root[data-skin="comic"] .figure line, :root[data-skin="comic"] .figure circle { stroke: var(--ink); stroke-width: 5; }
:root[data-skin="synth"] .figure line, :root[data-skin="synth"] .figure circle { stroke: var(--accent); stroke-width: 4; filter: drop-shadow(0 0 6px rgba(255, 62, 200, 0.8)); }
.figure .part { visibility: hidden; }
.figure .part.show { visibility: visible; }

/* ---------- keyboard ---------- */
.kb { user-select: none; margin-top: 12px; }
.kb-row { display: flex; gap: 5px; justify-content: center; margin-bottom: 7px; }
.kb button {
  flex: 1; max-width: 42px; min-width: 0; height: 54px; padding: 0;
  font-size: 15px; font-weight: 700; text-transform: uppercase; cursor: pointer;
  background: var(--key-bg); color: var(--key-text);
}
.kb button.wide { max-width: 64px; flex: 1.6; font-size: 11px; }
:root[data-skin="comic"] .kb button { border: 2.5px solid var(--ink); border-radius: 5px; box-shadow: 2.5px 2.5px 0 var(--ink); }
:root[data-skin="comic"] .kb button:active { transform: translate(2px, 2px); box-shadow: none; }
:root[data-skin="comic"] .kb button.correct { background: var(--correct); }
:root[data-skin="comic"] .kb button.present { background: var(--present); }
:root[data-skin="comic"] .kb button.absent { background: var(--absent); color: var(--absent-text); box-shadow: none; }
:root[data-skin="synth"] .kb button { border: 1.5px solid #22e6ff; border-radius: 6px; text-shadow: 0 0 8px rgba(34, 230, 255, 0.7); box-shadow: 0 0 8px rgba(34, 230, 255, 0.25); }
:root[data-skin="synth"] .kb button:active { box-shadow: 0 0 18px rgba(34, 230, 255, 0.8); }
:root[data-skin="synth"] .kb button.correct { background: #0d3521; border-color: var(--correct); color: var(--correct); text-shadow: 0 0 8px rgba(57, 255, 136, 0.8); box-shadow: 0 0 10px rgba(57, 255, 136, 0.5); }
:root[data-skin="synth"] .kb button.present { background: #3a2c07; border-color: var(--present); color: var(--present); text-shadow: 0 0 8px rgba(255, 210, 62, 0.8); box-shadow: 0 0 10px rgba(255, 210, 62, 0.5); }
:root[data-skin="synth"] .kb button.absent { background: #100b22; border-color: #241d44; color: var(--absent-text); text-shadow: none; box-shadow: none; }

/* ---------- stats ---------- */
.statsrow { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.stat { flex: 1 1 0; max-width: 100px; text-align: center; padding: 9px 4px 7px; }
.stat b { display: block; font-family: var(--font-display); font-weight: 400; line-height: 1; }
.stat span { display: block; margin-top: 4px; font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted); }
.statcap { flex-basis: 100%; text-align: center; font-size: 10.5px; color: var(--muted); margin-top: 4px; letter-spacing: 0.5px; }
:root[data-skin="comic"] .stat { background: var(--panel); border: 2.5px solid var(--ink); border-radius: 5px; box-shadow: 3px 3px 0 var(--ink); }
:root[data-skin="comic"] .stat:nth-child(odd) { transform: rotate(-1deg); }
:root[data-skin="comic"] .stat:nth-child(even) { transform: rotate(1deg); }
:root[data-skin="comic"] .stat b { font-size: 26px; letter-spacing: 1px; color: var(--ink); }
:root[data-skin="comic"] .stat.hot { background: var(--gold); }
:root[data-skin="synth"] .stat { background: var(--panel); border: 1.5px solid #33285c; border-radius: 8px; }
:root[data-skin="synth"] .stat b { font-family: var(--font-hud); font-size: 17px; padding-top: 3px; color: #22e6ff; text-shadow: 0 0 10px rgba(34, 230, 255, 0.7); }
:root[data-skin="synth"] .stat span { font-family: var(--font-hud); font-size: 6.5px; letter-spacing: 1px; }
:root[data-skin="synth"] .stat.hot { border-color: var(--gold); box-shadow: 0 0 10px rgba(255, 210, 62, 0.4); }
:root[data-skin="synth"] .stat.hot b { color: var(--gold); text-shadow: 0 0 10px rgba(255, 210, 62, 0.8); }
:root[data-skin="synth"] .statcap { font-family: var(--font-hud); font-size: 6.5px; letter-spacing: 1px; }

/* ---------- help modal ---------- */
.help-overlay { position: fixed; inset: 0; background: var(--overlay); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 60; }
.help-card { max-width: 420px; padding: 18px; font-size: 14px; line-height: 1.55; background: var(--panel); color: var(--text); }
:root[data-skin="comic"] .help-card { border: 3px solid var(--ink); border-radius: 6px; box-shadow: 8px 8px 0 var(--ink); transform: rotate(-0.5deg); }
:root[data-skin="synth"] .help-card { background: #12042a; border: 2px solid #22e6ff; border-radius: 10px; box-shadow: 0 0 24px rgba(34, 230, 255, 0.4); }
.help-card h2 { margin: 0 0 8px; font-family: var(--font-display); font-weight: 400; letter-spacing: 1px; }
:root[data-skin="comic"] .help-card h2 { font-size: 24px; color: var(--accent); }
:root[data-skin="synth"] .help-card h2 { font-family: var(--font-hud); font-size: 12px; color: #22e6ff; text-shadow: 0 0 10px rgba(34, 230, 255, 0.8); line-height: 1.6; }
.help-card p { margin: 0 0 10px; }
.help-close { font-size: 14px; font-weight: 700; padding: 7px 14px; cursor: pointer; background: var(--key-bg); color: var(--key-text); }
:root[data-skin="comic"] .help-close { border: 2.5px solid var(--ink); border-radius: 5px; box-shadow: 2.5px 2.5px 0 var(--ink); background: var(--gold); color: var(--ink); }
:root[data-skin="synth"] .help-close { font-family: var(--font-hud); font-size: 9px; letter-spacing: 1px; text-transform: uppercase; border: 1.5px solid #22e6ff; border-radius: 6px; padding: 9px 14px; }
.demo-tiles { display: flex; gap: 4px; margin: 6px 0 10px; }
.demo-tiles .tile { width: 30px; height: 30px; font-size: 15px; }

/* ---------- motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  .shake { animation: shake 0.18s 2; }
  @keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
  :root[data-skin="synth"] .masthead .site-title { animation: neonflicker 4.5s infinite; }
  @keyframes neonflicker {
    0%, 100% { opacity: 1; }
    3% { opacity: 0.75; } 4% { opacity: 1; }
    52% { opacity: 1; } 53% { opacity: 0.6; } 54% { opacity: 1; } 55% { opacity: 0.85; } 56% { opacity: 1; }
  }
}
