:root {
  color-scheme: light;
  --bg: #f5f7f3;
  --surface: #ffffff;
  --surface-soft: #edf4ef;
  --text: #17211d;
  --muted: #65716c;
  --border: #d9e1dc;
  --accent: #356657;
  --accent-strong: #244b40;
  --accent-soft: #dcece5;
  --success: #2e735b;
  --warning: #b87822;
  --danger: #b34a4a;
  --focus: #cf8c2e;
  --radius-sm: 10px;
  --radius: 18px;
  --radius-lg: 30px;
  --shadow: 0 18px 50px rgba(29, 55, 46, .1);
  --shadow-sm: 0 8px 24px rgba(29, 55, 46, .08);
  --container: 1180px;
  --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111815;
  --surface: #19231f;
  --surface-soft: #202f29;
  --text: #f1f6f3;
  --muted: #a8b6b0;
  --border: #33453e;
  --accent: #8bc3ac;
  --accent-strong: #c8eadb;
  --accent-soft: #263f35;
  --success: #7fc9a9;
  --warning: #e4b466;
  --danger: #ef9292;
  --shadow: 0 20px 56px rgba(0, 0, 0, .28);
  --shadow-sm: 0 8px 26px rgba(0, 0, 0, .2);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; overflow-x: hidden; background: var(--bg); color: var(--text); font-family: var(--font); line-height: 1.6; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--accent-strong); text-decoration-thickness: .08em; text-underline-offset: .18em; }
img, svg, canvas { display: block; max-width: 100%; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { line-height: 1.1; letter-spacing: -.035em; }
h1 { margin-bottom: 20px; font-size: clamp(2.35rem, 8vw, 5.7rem); }
h2 { font-size: clamp(1.7rem, 4vw, 2.6rem); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.container { width: min(calc(100% - 32px), var(--container)); margin-inline: auto; }
.skip-link { position: fixed; z-index: 1000; top: 10px; left: 10px; padding: 10px 14px; transform: translateY(-160%); background: var(--surface); border-radius: 8px; }
.skip-link:focus { transform: none; }
.eyebrow { margin-bottom: 10px; color: var(--accent); font-size: .75rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }

.site-header { position: sticky; z-index: 100; top: 0; border-bottom: 1px solid color-mix(in srgb, var(--border) 75%, transparent); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(14px); }
.header-inner { min-height: 68px; display: flex; align-items: center; gap: 18px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-size: .95rem; text-decoration: none; }
.brand b { color: var(--accent); }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; background: var(--accent); color: var(--bg); font-size: 1.4rem; }
.primary-nav { display: none; margin-left: auto; gap: 24px; }
.primary-nav a { color: var(--muted); font-size: .9rem; font-weight: 650; text-decoration: none; }
.icon-button { width: 44px; height: 44px; margin-left: auto; border: 1px solid var(--border); border-radius: 50%; background: var(--surface); color: var(--text); cursor: pointer; }

.hero { min-height: 620px; display: grid; align-items: center; gap: 24px; padding-block: 72px; }
.hero-copy { position: relative; z-index: 2; max-width: 780px; }
.hero h1 { max-width: 900px; }
.hero-lead { max-width: 680px; color: var(--muted); font-size: clamp(1.05rem, 2vw, 1.25rem); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.button { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border: 1px solid transparent; border-radius: 999px; font-weight: 760; text-decoration: none; cursor: pointer; transition: transform .18s ease, background .18s ease, border-color .18s ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { background: var(--accent-strong); color: var(--bg); }
.button-secondary { border-color: var(--border); background: var(--surface); color: var(--text); }
.button-quiet { min-height: 42px; padding: 8px 14px; border-color: var(--border); background: transparent; color: var(--text); font-size: .86rem; }
.button[disabled] { opacity: .45; pointer-events: none; }
.trust-row { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 32px; color: var(--muted); font-size: .85rem; }
.trust-row span::before { content: "✓"; margin-right: 7px; color: var(--success); font-weight: 800; }
.hero-art { position: absolute; right: -10vw; top: 150px; width: min(46vw, 600px); aspect-ratio: 1; opacity: .72; pointer-events: none; }
.orbit { position: absolute; inset: 7%; border: 1px solid var(--border); border-radius: 50%; }
.orbit-two { inset: 24%; border-style: dashed; }
.hero-tile { position: absolute; width: clamp(62px, 8vw, 100px); aspect-ratio: 1; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 24px; background: var(--surface); box-shadow: var(--shadow); color: var(--accent-strong); font-size: clamp(1.5rem, 4vw, 2.7rem); font-weight: 800; }
.tile-a { top: 3%; left: 38%; transform: rotate(-7deg); }.tile-b { right: 4%; top: 42%; transform: rotate(8deg); }.tile-c { bottom: 4%; left: 43%; }.tile-d { left: 3%; top: 40%; transform: rotate(-4deg); }

.section { padding-block: 68px; }
.section-soft { background: var(--surface-soft); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.section-heading h2 { margin-bottom: 0; }
.search-box { max-width: 520px; margin-bottom: 28px; }
.search-box label { display: block; margin-bottom: 7px; color: var(--muted); font-size: .82rem; font-weight: 700; }
.search-box input { width: 100%; min-height: 52px; padding: 0 18px; border: 1px solid var(--border); border-radius: 15px; background: var(--surface); color: var(--text); }
.empty-state { padding: 24px; border: 1px dashed var(--border); border-radius: var(--radius); color: var(--muted); }
.game-grid { display: grid; gap: 18px; }
.game-card { overflow: hidden; display: grid; grid-template-rows: 190px 1fr; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.game-card-visual { position: relative; overflow: hidden; display: block; background: var(--accent-soft); }
.game-card-visual::before, .game-card-visual::after, .game-card-visual span { content: ""; position: absolute; }
.visual-sudoku { background: #dcebe4; }
.visual-sudoku::before { inset: 30px 70px; border: 3px solid #315b4e; border-radius: 8px; background: repeating-linear-gradient(90deg, transparent 0 29px, #88a99d 30px 31px), repeating-linear-gradient(0deg, transparent 0 29px, #88a99d 30px 31px); }
.visual-sudoku::after { content: "7  3  9"; inset: 70px 77px auto; color: #244b40; font-weight: 800; letter-spacing: 16px; }
.visual-minesweeper { background: #efe6d3; }
.visual-minesweeper::before { width: 120px; height: 120px; left: calc(50% - 60px); top: 35px; background: repeating-linear-gradient(90deg, transparent 0 29px, #bba77d 30px 31px), repeating-linear-gradient(0deg, transparent 0 29px, #bba77d 30px 31px); border: 2px solid #8e7444; }
.visual-minesweeper::after { content: "2  ⚑"; left: calc(50% - 35px); top: 78px; color: #7b492c; font-size: 1.6rem; font-weight: 900; letter-spacing: 17px; }
.visual-2048 { background: #eee0d0; }
.visual-2048::before { content: "2"; width: 76px; height: 76px; left: calc(50% - 87px); top: 57px; display: grid; place-items: center; border-radius: 15px; background: #f5efe5; color: #765b45; font-size: 2rem; font-weight: 800; box-shadow: 90px 0 #d89c59; }
.visual-2048::after { content: "8"; left: calc(50% + 22px); top: 76px; color: white; font-size: 2rem; font-weight: 800; }
.visual-maze { background: #dce8ee; }
.visual-maze::before { inset: 28px 54px; border: 4px solid #405e6a; background: repeating-linear-gradient(90deg, transparent 0 28px, #6d8791 29px 31px), repeating-linear-gradient(0deg, transparent 0 28px, #6d8791 29px 31px); }
.visual-maze::after { width: 18px; height: 18px; left: 74px; bottom: 42px; border-radius: 50%; background: #39735e; box-shadow: 126px -94px #c77d24; }
.visual-memory { background: #e8e1ef; }
.visual-memory::before { content: "◆"; width: 68px; height: 84px; left: calc(50% - 78px); top: 52px; display: grid; place-items: center; border-radius: 14px; background: #6f5a88; color: #fff; font-size: 2rem; box-shadow: 88px 0 #6f5a88; }
.visual-memory::after { content: "◆"; left: calc(50% + 30px); top: 72px; color: #fff; font-size: 2rem; }
.visual-word-search { background: #e7edd8; }
.visual-word-search::before { inset: 34px 68px; background: repeating-linear-gradient(90deg, transparent 0 31px, #9aa887 32px 33px), repeating-linear-gradient(0deg, transparent 0 31px, #9aa887 32px 33px); border: 2px solid #71805f; }
.visual-word-search::after { content: "С Л О В О"; left: calc(50% - 80px); top: 80px; color: #435735; font-weight: 900; letter-spacing: 8px; }
.visual-fifteen { background: #e8e2d8; }
.visual-fifteen::before { content: "1  2  3\A 5  6  7\A 9 10 11"; white-space: pre; left: calc(50% - 78px); top: 36px; padding: 15px 18px; border-radius: 13px; background: #9b7657; color: #fff; font-size: 1.15rem; font-weight: 900; line-height: 2.2; letter-spacing: 5px; }
.visual-hanoi { background: #dfe9e5; }
.visual-hanoi::before { width: 4px; height: 110px; left: 50%; bottom: 32px; background: #527166; box-shadow: -90px 0 #527166, 90px 0 #527166; }
.visual-hanoi::after { width: 120px; height: 18px; left: calc(50% - 60px); bottom: 34px; border-radius: 10px; background: #c9822d; box-shadow: 0 -22px 0 -2px #d99b50, 0 -42px 0 -4px #e2b66f; }
.game-card-visual[class*="visual-mode-"]:not(.visual-sudoku):not(.visual-minesweeper):not(.visual-2048):not(.visual-maze):not(.visual-memory):not(.visual-word-search):not(.visual-fifteen):not(.visual-hanoi)::before { width: 104px; height: 104px; left: calc(50% - 52px); top: 42px; display: grid; place-items: center; border: 2px solid rgba(30,67,55,.34); border-radius: 24px; color: #264f42; background: rgba(255,255,255,.36); font-size: 2.2rem; font-weight: 900; box-shadow: 42px 30px 0 -22px rgba(35,83,67,.25), -42px -28px 0 -24px rgba(35,83,67,.2); }
.visual-mode-latin::before { content: "1 4\A 3 2"; white-space: pre; line-height: 1.35; }
.visual-mode-paint::before { content: "▦"; }.visual-mode-binary::before { content: "01"; }.visual-mode-route::before { content: "1→2"; }.visual-mode-tile::before { content: "⌁"; }
.visual-mode-choice::before { content: "?"; }.visual-mode-word::before { content: "АЯ"; }.visual-mode-number-match::before { content: "1+9"; }.visual-mode-make24::before { content: "24"; }.visual-mode-code::before { content: "•••"; }
.visual-mode-sort::before { content: "◫"; }.visual-mode-merge::before { content: "2→4"; }.visual-mode-sliding::before { content: "▦"; }.visual-mode-shape::before { content: "◇"; }.visual-mode-sequence::before { content: "1·3·2"; }
.visual-mode-board::before { content: "○×"; }.visual-mode-sokoban::before { content: "□→·"; }.visual-mode-transport::before { content: "⇄"; }
.game-card-body { display: flex; flex-direction: column; align-items: flex-start; padding: 24px; }
.game-card h2 { margin-bottom: 12px; font-size: 1.55rem; }
.game-card h2 a { color: var(--text); text-decoration: none; }
.game-card p { color: var(--muted); }
.card-link { margin-top: auto; font-weight: 800; text-decoration: none; }
.feature-grid { display: grid; gap: 26px; }
.feature-grid article { padding: 10px 0; }
.feature-grid h2 { font-size: 1.3rem; }
.feature-grid p { color: var(--muted); }
.feature-number { display: block; margin-bottom: 28px; color: var(--accent); font-size: .8rem; font-weight: 900; }
.prose-block { max-width: 820px; }
.prose-block p:last-child { color: var(--muted); font-size: 1.05rem; }

.page-hero { padding-block: 52px 18px; }
.page-hero h1 { max-width: 900px; font-size: clamp(2.5rem, 7vw, 4.8rem); }
.page-hero > p:not(.eyebrow) { max-width: 680px; color: var(--muted); }
.breadcrumbs { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 38px; color: var(--muted); font-size: .82rem; }
.breadcrumbs a { color: inherit; }
.error-page { min-height: 58vh; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; }
.author-hero .button { margin-top: 16px; }
.author-grid { display: grid; gap: 18px; }
.author-card { padding: clamp(24px, 4vw, 38px); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.author-card h2 { font-size: clamp(1.45rem, 3vw, 2rem); }
.author-card p:last-child, .author-note p:last-child { color: var(--muted); }
.author-note { display: flex; flex-direction: column; align-items: flex-start; gap: 24px; padding: clamp(26px, 5vw, 52px); border-radius: var(--radius-lg); background: var(--accent-soft); }

.game-page { padding-block: 36px 10px; }
.game-heading { display: flex; flex-direction: column; gap: 18px; margin-bottom: 26px; }
.game-heading h1 { margin-bottom: 14px; font-size: clamp(2.5rem, 7vw, 4.4rem); }
.game-heading p:last-child { max-width: 760px; color: var(--muted); }
.favorite-button { min-height: 44px; align-self: flex-start; padding: 8px 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); cursor: pointer; }
.favorite-button[aria-pressed="true"] { border-color: var(--warning); color: var(--warning); }
.game-shell { overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); }
.game-toolbar { display: flex; overflow-x: auto; align-items: center; gap: 8px; padding: 14px; border-bottom: 1px solid var(--border); scrollbar-width: thin; }
.game-toolbar .button { white-space: nowrap; }
.difficulty-control { min-height: 42px; display: flex; align-items: center; gap: 8px; padding: 5px 8px 5px 12px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); font-size: .8rem; font-weight: 700; white-space: nowrap; }
.difficulty-control select { min-height: 32px; border: 0; background: transparent; color: var(--text); font-weight: 700; }
.game-meta { display: flex; justify-content: space-between; gap: 16px; padding: 12px 18px; border-bottom: 1px solid var(--border); color: var(--muted); font-size: .82rem; }
.game-stage { min-height: 420px; display: grid; place-items: center; padding: clamp(12px, 4vw, 34px); background: color-mix(in srgb, var(--surface-soft) 62%, var(--surface)); touch-action: none; }
.game-message { min-height: 50px; margin: 0; padding: 13px 18px; color: var(--muted); text-align: center; }
.game-message.is-success { color: var(--success); font-weight: 800; }
.game-message.is-error { color: var(--danger); font-weight: 800; }
.loader { color: var(--muted); text-align: center; }
.loader span { width: 32px; height: 32px; display: inline-block; margin-bottom: 8px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.content-grid { display: grid; gap: 18px; }
.content-card { padding: clamp(24px, 5vw, 46px); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.content-card-accent { background: var(--accent-soft); }
.content-card li + li { margin-top: 10px; }

/* Sudoku */
.sudoku-app { width: min(100%, 620px); display: grid; gap: 18px; }
.sudoku-grid { width: min(100%, 540px); aspect-ratio: 1; display: grid; grid-template-columns: repeat(9, 1fr); justify-self: center; border: 3px solid var(--text); background: var(--text); gap: 1px; }
.sudoku-cell { position: relative; min-width: 0; border: 0; background: var(--surface); color: var(--accent-strong); font-size: clamp(1rem, 5vw, 1.8rem); font-weight: 650; cursor: pointer; }
.sudoku-cell:nth-child(3n):not(:nth-child(9n)) { border-right: 2px solid var(--text); }
.sudoku-cell:nth-child(n+19):nth-child(-n+27), .sudoku-cell:nth-child(n+46):nth-child(-n+54) { border-bottom: 2px solid var(--text); }
.sudoku-cell.is-given { background: color-mix(in srgb, var(--surface-soft) 78%, var(--surface)); color: var(--text); font-weight: 850; }
.sudoku-cell.is-selected { background: var(--accent-soft); }
.sudoku-cell.is-peer { background: color-mix(in srgb, var(--accent-soft) 48%, var(--surface)); }
.sudoku-cell.is-error { color: var(--danger); }
.sudoku-notes { position: absolute; inset: 2px; display: grid; grid-template-columns: repeat(3, 1fr); align-items: center; color: var(--muted); font-size: clamp(.42rem, 1.6vw, .68rem); line-height: 1; }
.sudoku-keypad { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 7px; }
.sudoku-keypad button { min-height: 46px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); font-weight: 800; cursor: pointer; }
.sudoku-keypad button[data-note="true"] { grid-column: span 2; }
.sudoku-keypad .is-active { background: var(--accent); color: var(--bg); }

/* Minesweeper */
.minesweeper-app { width: min(100%, 610px); display: grid; gap: 14px; }
.mine-controls { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.mine-mode { min-height: 44px; padding: 8px 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); cursor: pointer; }
.mine-mode.is-active { background: var(--accent); color: var(--bg); }
.mine-grid { width: 100%; aspect-ratio: 1; display: grid; gap: 2px; padding: 3px; border-radius: 12px; background: var(--border); touch-action: none; }
.mine-cell { min-width: 0; min-height: 0; display: grid; place-items: center; padding: 0; border: 0; border-radius: 3px; background: color-mix(in srgb, var(--accent-soft) 70%, var(--surface)); color: var(--text); font-size: clamp(.62rem, 2.4vw, 1rem); font-weight: 900; cursor: pointer; }
.mine-cell.is-open { background: var(--surface); }.mine-cell.is-mine { background: color-mix(in srgb, var(--danger) 30%, var(--surface)); }.mine-cell.is-flagged { color: var(--warning); }
.mine-cell[data-count="1"] { color: #3070b8; }.mine-cell[data-count="2"] { color: #2f7f55; }.mine-cell[data-count="3"] { color: #b34a4a; }.mine-cell[data-count="4"], .mine-cell[data-count="5"] { color: #7b4da1; }

/* 2048 */
.game-2048 { width: min(100%, 530px); display: grid; gap: 16px; }
.score-row { display: flex; justify-content: center; gap: 10px; }
.score-box { min-width: 110px; padding: 9px 14px; border-radius: 12px; background: var(--accent-soft); text-align: center; }.score-box span { display: block; color: var(--muted); font-size: .7rem; text-transform: uppercase; }.score-box strong { font-size: 1.25rem; }
.board-2048 { width: 100%; aspect-ratio: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(5px, 1.6vw, 12px); padding: clamp(6px, 1.8vw, 13px); border-radius: 20px; background: #9e8d7c; touch-action: none; }
.tile-2048 { display: grid; place-items: center; border-radius: 13px; background: #c9bbaa; color: #5e5348; font-size: clamp(1.25rem, 7vw, 2.6rem); font-weight: 900; animation: tile-in .14s ease-out; }
@keyframes tile-in { from { transform: scale(.94); opacity: .72; } to { transform: scale(1); opacity: 1; } }
.tile-2048[data-value="2"] { background:#eee8dd }.tile-2048[data-value="4"] { background:#e8ddc9 }.tile-2048[data-value="8"] { background:#dfad6e;color:#fff }.tile-2048[data-value="16"] { background:#d88c51;color:#fff }.tile-2048[data-value="32"] { background:#d2694b;color:#fff }.tile-2048[data-value="64"] { background:#bd4b3c;color:#fff }.tile-2048[data-value="128"] { background:#cfb24f;color:#fff;font-size:clamp(1rem,6vw,2.2rem) }.tile-2048[data-value="256"], .tile-2048[data-value="512"] { background:#b79734;color:#fff;font-size:clamp(1rem,6vw,2.1rem) }.tile-2048[data-value="1024"], .tile-2048[data-value="2048"] { background:#356657;color:#fff;font-size:clamp(.8rem,5vw,1.75rem) }

/* Maze */
.maze-app { width: min(100%, 720px); display: grid; gap: 16px; }
.maze-board { width: 100%; aspect-ratio: 1; border-radius: 14px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); touch-action: none; }
.maze-controls { width: 190px; display: grid; grid-template-columns: repeat(3, 54px); grid-template-rows: repeat(2, 54px); gap: 7px; justify-self: center; }
.maze-controls button { border: 1px solid var(--border); border-radius: 15px; background: var(--surface); color: var(--text); font-size: 1.25rem; cursor: pointer; }.maze-controls [data-direction="up"] { grid-column: 2; }.maze-controls [data-direction="left"] { grid-row: 2; grid-column: 1; }.maze-controls [data-direction="down"] { grid-row: 2; grid-column: 2; }.maze-controls [data-direction="right"] { grid-row: 2; grid-column: 3; }

/* Memory */
.memory-app { width: min(100%, 680px); display: grid; gap: 14px; }
.memory-stats { display: flex; justify-content: center; gap: 22px; color: var(--muted); }
.memory-grid { display: grid; gap: clamp(7px, 2vw, 12px); }
.memory-card { min-width: 0; min-height: 66px; aspect-ratio: 4 / 5; border: 1px solid var(--border); border-radius: 15px; background: var(--accent-strong); color: var(--bg); font-size: clamp(1.4rem, 6vw, 2.5rem); font-weight: 900; cursor: pointer; transform-style: preserve-3d; transition: transform .18s ease, background .18s ease; }
.memory-card.is-open { background: var(--surface); color: var(--accent-strong); transform: rotateY(180deg); }
.memory-card.is-open span { display: inline-block; transform: rotateY(180deg); }
.memory-card.is-matched { border-color: var(--success); background: var(--accent-soft); color: var(--success); }

/* Word search */
.word-search-app { width: min(100%, 760px); display: grid; gap: 16px; }
.word-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; }
.word-chip { padding: 5px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: .76rem; font-weight: 800; }
.word-chip.is-found { border-color: var(--success); background: var(--accent-soft); color: var(--success); text-decoration: line-through; }
.word-grid { width: 100%; aspect-ratio: 1; display: grid; gap: 2px; padding: 4px; border-radius: 16px; background: var(--border); touch-action: none; user-select: none; }
.word-cell { min-width: 0; min-height: 0; display: grid; place-items: center; padding: 0; border: 0; border-radius: 4px; background: var(--surface); color: var(--text); font-size: clamp(.72rem, 3vw, 1.25rem); font-weight: 850; cursor: pointer; }
.word-cell.is-selected { background: color-mix(in srgb, var(--warning) 28%, var(--surface)); }
.word-cell.is-found { background: var(--accent-soft); color: var(--accent-strong); }
.word-cell.is-hint { box-shadow: inset 0 0 0 3px var(--warning); }

/* Fifteen */
.fifteen-app { width: min(100%, 560px); display: grid; gap: 12px; }
.fifteen-stats { color: var(--muted); text-align: center; }
.fifteen-board { width: 100%; aspect-ratio: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(6px, 2vw, 12px); padding: clamp(7px, 2vw, 14px); border-radius: 20px; background: color-mix(in srgb, var(--accent) 40%, var(--border)); touch-action: none; }
.fifteen-tile { border: 0; border-radius: 15px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); font-size: clamp(1.35rem, 8vw, 2.6rem); font-weight: 900; cursor: pointer; }
.fifteen-tile.is-correct { background: var(--accent-soft); color: var(--accent-strong); }
.fifteen-space { border-radius: 15px; background: color-mix(in srgb, var(--bg) 44%, transparent); }

/* Hanoi */
.hanoi-app { width: min(100%, 820px); display: grid; gap: 12px; }
.hanoi-stats { display: flex; justify-content: center; gap: 24px; color: var(--muted); }
.hanoi-board { min-height: 330px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 14px; border-radius: 20px; background: var(--surface); }
.hanoi-peg { position: relative; min-width: 0; overflow: hidden; border: 1px solid transparent; border-radius: 16px; background: transparent; color: var(--text); cursor: pointer; }
.hanoi-peg::after { content: ""; position: absolute; left: 5%; right: 5%; bottom: 12px; height: 10px; border-radius: 8px; background: var(--text); opacity: .72; }
.hanoi-peg.is-selected { border-color: var(--warning); background: color-mix(in srgb, var(--warning) 9%, transparent); }
.hanoi-post { position: absolute; left: calc(50% - 4px); bottom: 18px; width: 8px; height: 80%; border-radius: 8px; background: var(--border); }
.hanoi-stack { position: absolute; z-index: 2; left: 2%; right: 2%; bottom: 22px; display: flex; flex-direction: column-reverse; align-items: center; gap: 3px; }
.hanoi-disk { width: calc(28% + var(--disk) * 10%); height: clamp(24px, 5vw, 34px); border-radius: 999px; background: var(--accent); box-shadow: inset 0 -4px 0 rgba(0,0,0,.1); }
.hanoi-disk:nth-child(2n) { background: #c9822d; }
.hanoi-disk.is-top { cursor: grab; }

.author-message { padding-block: 42px 4px; }
.author-message-card { position: relative; overflow: hidden; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: clamp(18px, 4vw, 34px); align-items: center; padding: clamp(26px, 5vw, 48px); border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--border)); border-radius: var(--radius-lg); background: linear-gradient(135deg, color-mix(in srgb, var(--accent-soft) 84%, var(--surface)), var(--surface)); box-shadow: var(--shadow-sm); }
.author-message-card::after { content: ""; position: absolute; width: 190px; height: 190px; right: -74px; top: -92px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 12%, transparent); pointer-events: none; }
.author-message-mark { position: relative; z-index: 1; width: clamp(58px, 8vw, 78px); aspect-ratio: 1; display: grid; place-items: center; border-radius: 22px; background: var(--accent-strong); color: var(--bg); box-shadow: var(--shadow-sm); font-size: clamp(1.5rem, 4vw, 2.2rem); }
.author-message-copy { position: relative; z-index: 1; }
.author-message-copy h2 { margin-bottom: 10px; font-size: clamp(1.65rem, 4vw, 2.5rem); }
.author-message-copy p { max-width: 760px; margin-bottom: 8px; color: var(--muted); }
.author-message-copy .author-message-lead { color: var(--text); font-size: clamp(1.05rem, 2.5vw, 1.25rem); font-weight: 760; }
.author-message-copy .author-message-signature { margin-top: 16px; margin-bottom: 0; color: var(--accent-strong); }

.site-footer { margin-top: 64px; padding-block: 58px 24px; background: #15221d; color: #e9f2ed; }
.site-footer h2 { font-size: 1.5rem; }.site-footer p { max-width: 590px; color: #aebeb6; }
.footer-grid { display: grid; gap: 30px; }
.footer-grid nav { display: grid; gap: 9px; }.footer-grid a { color: #d9e8e0; }
.footer-cookie-settings { width: fit-content; padding: 0; border: 0; background: transparent; color: #d9e8e0; font: inherit; text-align: left; text-decoration: underline; cursor: pointer; }
.footer-author-link { display: inline-block; margin-top: 8px; font-weight: 800; }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-top: 44px; padding-top: 20px; border-top: 1px solid #33433c; color: #95a9a0; font-size: .8rem; }

.cookie-consent { position: fixed; z-index: 1200; right: 12px; bottom: 12px; left: 12px; color: var(--text); }
.cookie-consent-card { width: min(100%, 920px); display: grid; gap: 20px; margin-inline: auto; padding: clamp(20px, 4vw, 28px); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: 0 20px 60px rgba(15, 30, 24, .26); }
.cookie-consent-copy h2 { margin-bottom: 8px; font-size: clamp(1.35rem, 3vw, 1.75rem); }
.cookie-consent-copy p:not(.eyebrow) { max-width: 680px; margin-bottom: 8px; color: var(--muted); }
.cookie-consent-copy a { font-weight: 760; }
.cookie-consent-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.cookie-consent-actions .button { flex: 1 1 140px; }

@media (min-width: 680px) {
  .primary-nav { display: flex; }
  .icon-button { margin-left: 0; }
  .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .feature-grid { grid-template-columns: repeat(3, 1fr); }
  .content-grid { grid-template-columns: 1fr 1fr; }
  .author-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .author-note { flex-direction: row; align-items: center; justify-content: space-between; }
  .game-heading { flex-direction: row; align-items: end; justify-content: space-between; }
  .footer-grid { grid-template-columns: 1.5fr 1fr; }
  .cookie-consent-card { grid-template-columns: 1fr auto; align-items: end; }
  .cookie-consent-actions { flex-wrap: nowrap; }
  .cookie-consent-actions .button { flex: none; }
  .sudoku-keypad { grid-template-columns: repeat(11, minmax(0, 1fr)); }
  .sudoku-keypad button[data-note="true"] { grid-column: span 1; }
}

@media (min-width: 980px) {
  .hero { grid-template-columns: minmax(0, 1.2fr) .8fr; padding-block: 100px; }
  .game-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .game-grid-compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .game-card { grid-template-rows: 210px 1fr; }
}

@media (max-width: 520px) {
  .hero { min-height: 590px; padding-block: 58px; }
  .hero-art { right: -160px; top: 360px; width: 420px; opacity: .32; }
  .game-stage { min-height: 360px; padding: 10px; }
  .game-meta { padding-inline: 12px; }
  .sudoku-cell { font-size: clamp(.95rem, 5.3vw, 1.4rem); }
  .sudoku-keypad button { min-height: 44px; }
  .author-message-card { grid-template-columns: 1fr; }
  .author-message-mark { width: 58px; border-radius: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media print {
  .site-header, .site-footer, .author-message, .cookie-consent, .breadcrumbs, .game-toolbar, .game-meta, .game-message, .favorite-button, .content-grid, .section { display: none !important; }
  body { background: #fff; color: #000; }
  .game-page { width: 100%; padding: 0; }
  .game-heading p, .eyebrow { display: none; }
  .game-heading h1 { font-size: 22pt; }
  .game-shell { border: 0; box-shadow: none; }
  .game-stage { min-height: 0; background: #fff; }
}

/* Reusable collection engines (games 2–120). */
.collection-app { width: min(100%, 760px); margin-inline: auto; display: grid; gap: 18px; justify-items: center; }
.category-link-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.category-link { display: grid; gap: 4px; padding: 18px; border: 1px solid var(--border); border-radius: 16px; color: var(--text); background: var(--surface); text-decoration: none; }
.category-link:hover { border-color: var(--accent); transform: translateY(-2px); }
.category-link span { color: var(--muted); font-size: .9rem; }
.game-guide .prose-block { max-width: none; }
.game-guide h3 { margin-top: 22px; }
.inline-links { display: flex; flex-wrap: wrap; gap: 8px; }
.inline-links a { padding: 8px 12px; border: 1px solid var(--border); border-radius: 999px; font-weight: 740; text-decoration: none; }
.faq-section > h2 { margin-bottom: 18px; }
.faq-list { display: grid; gap: 10px; }
.faq-list details { padding: 16px 18px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.faq-list summary { cursor: pointer; font-weight: 780; }
.faq-list p { margin: 12px 0 0; color: var(--muted); }
.collection-clue { width: 100%; margin: 0; padding: 12px 16px; border: 1px solid var(--border); border-radius: 14px; background: color-mix(in srgb, var(--surface) 82%, var(--accent) 18%); color: var(--muted); text-align: center; }
.collection-progress { margin: 0; color: var(--muted); font-weight: 750; }
.collection-button, .latin-cell, .paint-cell, .binary-cell, .route-node, .rotation-tile, .choice-button, .number-match-cell, .compact-merge-cell, .small-sliding-tile, .shape-piece, .sequence-pad, .strategy-cell, .sort-tube, .transport-item { border: 1px solid var(--border); color: var(--text); background: var(--surface); font: inherit; cursor: pointer; }
.collection-button:hover, .latin-cell:hover:not(:disabled), .choice-button:hover, .route-node:hover:not(:disabled) { border-color: var(--accent); }
.collection-button:focus-visible, .latin-cell:focus-visible, .paint-cell:focus-visible, .binary-cell:focus-visible, .route-node:focus-visible, .rotation-tile:focus-visible, .choice-button:focus-visible, .number-match-cell:focus-visible, .compact-merge-cell:focus-visible, .small-sliding-tile:focus-visible, .shape-piece:focus-visible, .sequence-pad:focus-visible, .strategy-cell:focus-visible, .sort-tube:focus-visible, .transport-item:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }

.latin-grid { width: min(100%, 560px); display: grid; grid-template-columns: repeat(var(--collection-size), minmax(0, 1fr)); border: 2px solid var(--text); border-radius: 12px; overflow: hidden; background: var(--border); gap: 1px; }
.latin-cell { position: relative; aspect-ratio: 1; min-width: 0; min-height: 32px; border: 0; background: var(--surface); font-weight: 820; font-size: clamp(.78rem, calc(4rem / var(--collection-size)), 1.3rem); }
.latin-cell.is-given { background: color-mix(in srgb, var(--surface) 72%, var(--border)); color: var(--muted); cursor: default; }
.latin-cell.is-selected { box-shadow: inset 0 0 0 3px var(--accent); }
.latin-cell.is-special { background: color-mix(in srgb, var(--surface) 82%, var(--accent) 18%); }
.latin-cell[data-constraint]::after { content: attr(data-constraint); position: absolute; right: 3px; bottom: 1px; color: var(--accent); font-size: .62em; }
.collection-keypad { width: min(100%, 620px); display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.collection-keypad .collection-button { min-width: 44px; min-height: 44px; padding: 8px 12px; border-radius: 10px; font-weight: 800; }

.paint-top-clues { width: min(72vw, 420px); margin-left: 54px; display: grid; grid-template-columns: repeat(var(--collection-size), minmax(0, 1fr)); gap: 1px; }
.paint-top-clues span, .paint-side-clues span { display: grid; place-items: center; min-width: 0; color: var(--muted); font-size: .73rem; font-weight: 750; }
.paint-body { display: flex; align-items: stretch; }
.paint-side-clues { width: 54px; display: grid; grid-template-rows: repeat(var(--collection-size), minmax(0, 1fr)); }
.paint-grid { width: min(72vw, 420px); display: grid; grid-template-columns: repeat(var(--collection-size), minmax(0, 1fr)); gap: 1px; padding: 2px; border-radius: 10px; background: var(--text); }
.paint-cell { aspect-ratio: 1; min-width: 0; border: 0; background: var(--surface); font-size: clamp(.65rem, 2vw, 1rem); }
.paint-cell.is-filled { background: var(--accent); color: #fff; }
.paint-cell.is-color-two { background: #e6a23c; }
.paint-cell.is-marked { color: var(--muted); background: color-mix(in srgb, var(--surface) 70%, var(--border)); }

.binary-grid { width: min(100%, 430px); display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.binary-cell { aspect-ratio: 1; min-width: 0; border-radius: 10px; font-size: clamp(1rem, 5vw, 1.5rem); font-weight: 850; }
.binary-cell.is-empty { background: color-mix(in srgb, var(--surface) 76%, var(--accent) 24%); }

.route-grid { width: min(100%, 500px); display: grid; grid-template-columns: repeat(var(--collection-size), minmax(0, 1fr)); gap: 10px; }
.route-node { aspect-ratio: 1; min-width: 0; border-radius: 50%; font-weight: 850; background: color-mix(in srgb, var(--surface) 84%, var(--accent) 16%); }
.route-node.is-visited { color: #fff; background: var(--success); border-color: var(--success); }

.tile-grid { width: min(100%, 450px); display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.rotation-tile { aspect-ratio: 1; min-width: 0; border-radius: 12px; overflow: hidden; background: color-mix(in srgb, var(--surface) 82%, var(--accent) 18%); }
.rotation-tile span { display: block; width: 62%; height: 62%; margin: 19%; border-top: 7px solid var(--accent); border-right: 7px solid var(--accent); border-radius: 0 16px 0 0; transform: rotate(var(--tile-rotation)); transition: transform .16s ease; }

.challenge-prompt { max-width: 680px; margin: 0; text-align: center; font-size: clamp(1.2rem, 3.6vw, 1.75rem); }
.choice-grid { width: min(100%, 640px); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.choice-button { min-height: 58px; padding: 12px 16px; border-radius: 14px; font-weight: 780; }
.choice-button.is-wrong { border-color: var(--danger); }
.word-letters { max-width: 100%; padding: 18px 24px; border-radius: 18px; background: color-mix(in srgb, var(--surface) 72%, var(--accent) 28%); font-size: clamp(1.35rem, 6vw, 2.3rem); font-weight: 900; letter-spacing: .14em; text-align: center; overflow-wrap: anywhere; }
.word-form, .code-form { width: min(100%, 620px); display: flex; gap: 10px; }
.word-form input, .code-form input { min-width: 0; flex: 1; min-height: 48px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 12px; color: var(--text); background: var(--surface); font: inherit; }
.number-match-grid { width: min(100%, 520px); display: grid; grid-template-columns: repeat(5, 1fr); gap: 9px; }
.number-match-cell { aspect-ratio: 1; min-width: 0; border-radius: 12px; font-weight: 850; font-size: 1.2rem; }
.number-match-cell.is-selected { background: var(--accent); color: #fff; }
.number-match-cell:disabled { opacity: .18; }
.make24-numbers { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.make24-numbers span { display: grid; place-items: center; width: 64px; aspect-ratio: 1; border-radius: 16px; color: #fff; background: var(--accent); font-size: 1.65rem; font-weight: 900; }
.code-guesses { width: min(100%, 520px); margin: 0; display: grid; gap: 6px; color: var(--muted); }

.sort-board { width: min(100%, 600px); display: flex; flex-wrap: wrap; align-items: end; justify-content: center; gap: 14px; }
.sort-tube { width: clamp(48px, 14vw, 72px); min-height: 176px; padding: 8px; border-width: 2px; border-radius: 10px 10px 26px 26px; background: color-mix(in srgb, var(--surface) 86%, transparent); }
.sort-tube.is-selected { border-color: var(--accent); transform: translateY(-5px); }
.sort-well { height: 154px; display: flex; flex-direction: column-reverse; justify-content: flex-start; gap: 4px; }
.sort-well i { display: block; height: 45px; border-radius: 9px; background: var(--sort-color); box-shadow: inset 0 5px 12px rgba(255,255,255,.22); }
.compact-merge-grid { width: min(100%, 480px); display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.compact-merge-cell { aspect-ratio: 1; min-width: 0; border-radius: 14px; font-size: clamp(1rem, 5vw, 1.45rem); font-weight: 900; background: hsl(calc(174deg + var(--merge-level) * 16deg) 50% 74%); color: #13231d; }
.compact-merge-cell.is-selected { box-shadow: inset 0 0 0 4px var(--accent); }
.compact-merge-cell:disabled { background: color-mix(in srgb, var(--surface) 82%, var(--border)); }
.small-sliding-grid { width: min(100%, 430px); display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.small-sliding-tile { aspect-ratio: 1; min-width: 0; border-radius: 14px; color: #fff; background: hsl(var(--picture-hue, 164) 50% 43%); font-size: clamp(1.2rem, 8vw, 2rem); font-weight: 900; }
.small-sliding-tile.is-empty { visibility: hidden; }
.shape-target { display: grid; place-items: center; width: 150px; height: 112px; border: 3px dashed var(--muted); border-radius: 36% 62% 42% 58%; color: var(--muted); font-size: 4rem; }
.shape-pieces { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.shape-piece { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 14px; color: var(--accent); font-size: 2.5rem; transform: rotate(var(--shape-rotation)); transition: transform .16s ease; }
.sequence-preview { width: min(100%, 500px); min-height: 78px; display: grid; place-items: center; border: 1px dashed var(--border); border-radius: 16px; font-size: clamp(1.4rem, 7vw, 2.2rem); font-weight: 900; letter-spacing: .18em; }
.sequence-pads { width: min(100%, 430px); display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.sequence-pad { min-height: 90px; border-radius: 18px; color: #fff; font-size: 1.6rem; font-weight: 900; }
.sequence-pad:nth-child(1) { background: #3b82f6; }.sequence-pad:nth-child(2) { background: #f59e0b; }.sequence-pad:nth-child(3) { background: #10b981; }.sequence-pad:nth-child(4) { background: #ec4899; }
.strategy-board { width: min(100%, 520px); display: grid; grid-template-columns: repeat(var(--collection-size), 1fr); gap: 3px; padding: 5px; border-radius: 12px; background: #345d47; }
.strategy-cell { aspect-ratio: 1; min-width: 0; min-height: 0; border: 0; border-radius: 6px; background: #b9d6c6; font-size: clamp(.6rem, calc(7rem / var(--collection-size)), 1.7rem); font-weight: 900; }
.strategy-cell.is-x { color: #fff; }.strategy-cell.is-o { color: #14251d; }.strategy-cell.is-legal { box-shadow: inset 0 0 0 3px rgba(255,255,255,.5); }
.sokoban-grid { width: min(100%, 460px); display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; padding: 4px; background: #746655; border-radius: 10px; }
.sokoban-cell { aspect-ratio: 1; display: grid; place-items: center; min-width: 0; border-radius: 4px; background: #e8dcc7; color: #254538; font-size: clamp(.8rem, 5vw, 1.6rem); font-weight: 900; }
.sokoban-cell.is-wall { background: #66594a; }.sokoban-cell.is-goal { box-shadow: inset 0 0 0 4px #dc9f3a; }.sokoban-cell.is-box { color: #fff; background: #b77b38; }.sokoban-cell.is-player { color: #fff; background: var(--accent); }
.sokoban-controls { display: grid; grid-template-columns: repeat(4, 52px); gap: 8px; }
.sokoban-controls .collection-button { min-height: 48px; border-radius: 10px; font-weight: 900; }
.transport-river { width: min(100%, 680px); display: grid; grid-template-columns: 1fr 1fr; gap: 36px; padding: 14px; border-radius: 18px; background: linear-gradient(90deg, transparent 43%, #67b7d1 43% 57%, transparent 57%); }
.transport-bank { min-height: 210px; display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 14px; background: color-mix(in srgb, var(--surface) 82%, #7fa35a 18%); }
.transport-bank h3 { margin: 0 0 6px; font-size: 1rem; }
.transport-item { min-height: 44px; padding: 8px 10px; border-radius: 10px; }
.transport-item.is-selected { color: #fff; background: var(--accent); }

@media (max-width: 520px) {
  .choice-grid { grid-template-columns: 1fr; }
  .word-form, .code-form { flex-direction: column; }
  .paint-top-clues { margin-left: 42px; width: min(72vw, 360px); }
  .paint-side-clues { width: 42px; }
  .paint-grid { width: min(72vw, 360px); }
  .transport-river { gap: 18px; background: linear-gradient(90deg, transparent 45%, #67b7d1 45% 55%, transparent 55%); }
  .transport-bank { padding: 9px; }
}
