:root { --bg: #eef2f8; --card: #ffffff; --text: #22304a; --muted: #6b7a90; --accent: #2f6fdb; --accent-2: #e6eef7; --border: #d9e0ea; --chip: #f1f5fa; --danger: #d63a4c; --ok: #2fa66a; --shadow: 0 10px 30px rgba(20, 40, 80, .10); --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; --radius: 16px; --head: #1f4fa3; }
:root[data-theme="dark"] { --bg: #0f131b; --card: #151a24; --text: #e9eef6; --muted: #97a4b8; --accent: #7fb2ff; --accent-2: #1f2a3d; --border: #2a3344; --chip: #1c2331; --danger: #ff7d8a; --ok: #4fd08a; --shadow: 0 10px 30px rgba(0, 0, 0, .45); --head: #0f131b; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); }
body { margin: 0; font: 15px/1.5 var(--font); color: var(--text); background: var(--bg); min-height: 100vh; -webkit-tap-highlight-color: transparent; }
.page { max-width: 1040px; margin: 0 auto; padding: 18px 12px 40px; }
.page-head { text-align: center; margin-bottom: 14px; }
.page-head .eyebrow { margin: 0; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.page-head h1 { margin: 2px 0 6px; font-size: 42px; letter-spacing: -.01em; color: var(--text); }
.page-head .lede { margin: 0 auto; max-width: 620px; font-size: 15px; color: var(--muted); }
/* the game card */
.app { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; max-width: 960px; margin: 0 auto; user-select: none; }
.topbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.spacer { flex: 1; }
.chip { display: inline-block; background: var(--chip); border-radius: 999px; padding: 5px 12px; font-size: 14px; font-weight: 600; color: var(--text); white-space: nowrap; }
.chip-btn { border: 0; cursor: pointer; color: var(--accent); font: 600 14px var(--font); }
.chip-btn:hover { background: var(--accent-2); }
.chip-muted { color: var(--muted); }
.chip-time { font-variant-numeric: tabular-nums; min-width: 64px; text-align: center; }
.icon-btn { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border); background: var(--chip); cursor: pointer; display: grid; place-items: center; color: var(--text); padding: 0; }
.icon-btn:hover { background: var(--accent-2); }
.ico-pause { width: 12px; height: 14px; border-left: 4px solid currentColor; border-right: 4px solid currentColor; display: block; }
.ico-pause.playing { width: 0; height: 0; border: 0; border-left: 12px solid currentColor; border-top: 7px solid transparent; border-bottom: 7px solid transparent; margin-left: 3px; }
.ico-theme { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; background: linear-gradient(90deg, currentColor 50%, transparent 50%); display: block; }
.playfield { display: grid; grid-template-columns: 1fr; gap: 14px; }
.board-wrap { position: relative; width: 100%; max-width: 552px; margin: 0 auto; }
#board { display: block; width: 100%; height: auto; touch-action: manipulation; border-radius: 8px; outline: none; cursor: pointer; }
#board:focus-visible { box-shadow: 0 0 0 3px var(--accent); }
.pause-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.resume { font: 700 18px var(--font); padding: 12px 30px; border-radius: 999px; border: 0; background: var(--accent); color: #fff; cursor: pointer; box-shadow: var(--shadow); }
.side { display: flex; flex-direction: column; }
.controls { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ctl { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px 8px; border: 0; background: var(--chip); border-radius: 12px; color: var(--muted); font: 600 12px var(--font); cursor: pointer; }
.ctl:hover { color: var(--accent); background: var(--accent-2); }
.ctl:disabled { opacity: .45; cursor: default; }
.ctl[aria-pressed="true"] { color: var(--accent); background: var(--accent-2); box-shadow: inset 0 0 0 2px var(--accent); }
.ctl-ico { width: 26px; height: 26px; display: block; background-repeat: no-repeat; background-position: center; background-size: 26px 26px; }
.ico-undo { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7a90' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 14 4 9l5-5'/%3E%3Cpath d='M4 9h10a6 6 0 0 1 0 12h-3'/%3E%3C/svg%3E"); }
.ico-erase { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7a90' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 21-4-4a2 2 0 0 1 0-2.8L14.2 3a2 2 0 0 1 2.8 0l4 4a2 2 0 0 1 0 2.8L11 20'/%3E%3Cpath d='M6.5 11.5 12.5 17.5'/%3E%3Cpath d='M7 21h13'/%3E%3C/svg%3E"); }
.ico-notes { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7a90' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 20h4l11-11-4-4L4 16z'/%3E%3Cpath d='m13 7 4 4'/%3E%3C/svg%3E"); }
.ico-hint { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7a90' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 18h6'/%3E%3Cpath d='M10 21h4'/%3E%3Cpath d='M8.5 15a6 6 0 1 1 7 0c-.7.5-1.5 1.5-1.5 3h-4c0-1.5-.8-2.5-1.5-3z'/%3E%3C/svg%3E"); }
:root[data-theme="dark"] .ctl-ico { filter: brightness(1.6); }
.badge { position: absolute; top: 4px; right: 8px; background: var(--accent); color: #fff; font-size: 11px; line-height: 1.4; border-radius: 999px; padding: 0 6px; min-width: 18px; text-align: center; }
.badge-off { background: var(--muted); }
.pad { display: grid; grid-template-columns: repeat(9, 1fr); gap: 6px; margin-top: 10px; }
.key { position: relative; border: 1px solid var(--border); background: var(--chip); border-radius: 10px; color: var(--accent); font: 500 26px/1 var(--font); padding: 10px 0 14px; cursor: pointer; }
.key:hover { background: var(--accent-2); }
.key .num { display: block; }
.key .count { position: absolute; right: 5px; bottom: 2px; font-size: 11px; line-height: 1; color: var(--muted); }
.key.done { opacity: .3; }
.key.active { box-shadow: inset 0 0 0 2px var(--accent); }
.primary { margin-top: 12px; width: 100%; padding: 13px; border: 0; border-radius: 12px; background: var(--accent); color: #fff; font: 700 16px var(--font); cursor: pointer; }
.primary:hover { filter: brightness(1.08); }
.links { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 10px; justify-content: center; }
.link-btn { border: 0; background: none; color: var(--accent); font: 600 14px var(--font); cursor: pointer; padding: 4px 2px; }
.link-btn:hover { text-decoration: underline; }
.status { min-height: 1.5em; margin: 10px 4px 0; color: var(--muted); font-size: 14px; text-align: center; }
.noscript { text-align: center; color: var(--muted); }
@media (min-width: 900px) {
  .playfield { grid-template-columns: minmax(0, 552px) minmax(280px, 340px); align-items: start; }
  .pad { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .key { font-size: 32px; padding: 0; aspect-ratio: 1.35; }
  .key .count { font-size: 12px; right: 7px; bottom: 5px; }
  .ctl { font-size: 13px; padding: 12px 4px 10px; }
}
/* content panels */
.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 20px; margin: 18px auto 0; max-width: 960px; }
.panel h2 { font-size: 18px; margin: 6px 0 8px; }
.panel h3 { font-size: 15px; margin: 14px 0 2px; }
.panel p { margin: 4px 0 8px; }
.steps { padding-left: 22px; margin: 0 0 10px; }
.steps li { margin: 0 0 8px; }
.cols { columns: 2 280px; column-gap: 24px; padding-left: 20px; margin: 0 0 10px; }
.cols li { margin-bottom: 5px; break-inside: avoid; }
.keys { border-collapse: collapse; width: 100%; font-size: 14px; }
.keys th { text-align: left; white-space: nowrap; padding: 4px 12px 4px 0; font-weight: 700; vertical-align: top; }
.keys td { padding: 4px 18px 4px 0; vertical-align: top; }
.note { font-size: 14px; color: var(--muted); }
.foot { color: var(--muted); text-align: center; font-size: 13px; margin-top: 22px; }
.foot a { color: var(--accent); }
/* dialogs */
.modal { position: fixed; inset: 0; z-index: 100; background: rgba(10, 20, 40, .45); display: flex; align-items: center; justify-content: center; padding: 12px; }
.dialog { background: var(--card); color: var(--text); border-radius: 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); min-width: 280px; max-width: min(94vw, 440px); width: 100%; font-size: 14px; max-height: 92vh; overflow: auto; }
.dialog.wide { max-width: min(94vw, 600px); }
.dlg-title { font-weight: 700; padding: 14px 18px 0; font-size: 18px; }
.dlg-body { padding: 10px 18px 4px; }
.dlg-body label { display: block; margin-bottom: 8px; }
.dlg-body input[type="number"], .dlg-body select { width: 100%; font: 15px var(--font); padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--chip); color: var(--text); margin-bottom: 10px; }
.dlg-note { color: var(--muted); margin: 6px 0 0; font-size: 13px; }
.opts label { margin: 0 0 9px; }
.dlg-body.msg p { margin: 4px 0; white-space: pre-line; }
.dlg-buttons { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding: 12px 18px 16px; }
.dlg-buttons button { min-width: 88px; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--chip); color: var(--text); font: 600 14px var(--font); cursor: pointer; }
.dlg-buttons button.default { background: var(--accent); border-color: var(--accent); color: #fff; }
.dlg-buttons button:hover { filter: brightness(1.05); }
.dlg-buttons button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.level-list { display: grid; gap: 8px; margin: 8px 0; }
.level-pick { text-align: left; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--chip); color: var(--text); font: 600 15px var(--font); cursor: pointer; }
.level-pick:hover, .level-pick:focus-visible { border-color: var(--accent); background: var(--accent-2); outline: none; }
.level-pick.current { box-shadow: inset 0 0 0 2px var(--accent); }
.level-pick.alt { width: 100%; color: var(--accent); }
.win-body { text-align: center; }
.win-level { font-size: 15px; color: var(--muted); margin: 0 0 8px; }
.stats { border-collapse: collapse; margin: 0 auto; }
.stats th { text-align: left; padding: 4px 14px 4px 0; color: var(--muted); font-weight: 600; }
.stats td { padding: 4px 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; }
.stats.grid { width: 100%; }
.stats.grid th, .stats.grid td { text-align: right; padding: 5px 8px; white-space: nowrap; }
.stats.grid th:first-child, .stats.grid td:first-child { text-align: left; }
.stats.grid thead th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.stats.grid tbody th { font-weight: 700; color: var(--text); }
.radios { border: 1px solid var(--border); border-radius: 10px; padding: 6px 12px 4px; margin: 10px 0 0; }
.radios legend { padding: 0 4px; color: var(--muted); }
.radios label { margin: 4px 0; display: inline-block; margin-right: 16px; }
.tabs { display: flex; gap: 4px; margin-bottom: 8px; flex-wrap: wrap; }
.tab { font: 600 13px var(--font); padding: 6px 12px; background: var(--chip); border: 1px solid var(--border); border-radius: 999px; cursor: pointer; color: var(--muted); }
.tab[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.tab-panel { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; min-height: 120px; background: var(--card); }
.tab-panel p { margin: 4px 0 8px; }
.about-body a { color: var(--accent); }
/* calendar */
.cal-head { display: flex; align-items: center; justify-content: space-between; font-weight: 700; margin: 4px 0 8px; }
.cal-nav { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border); background: var(--chip); color: var(--text); font: 700 18px/1 var(--font); cursor: pointer; }
.cal-days, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.cal-days span { font-size: 11px; color: var(--muted); text-transform: uppercase; }
.cal-grid button { aspect-ratio: 1; border-radius: 10px; border: 1px solid var(--border); background: var(--chip); color: var(--text); font: 600 14px var(--font); cursor: pointer; position: relative; padding: 0; }
.cal-grid button:disabled { opacity: .3; cursor: default; }
.cal-grid button.today { border-color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
.cal-grid button.done { background: var(--ok); border-color: var(--ok); color: #fff; }
.cal-grid button.done::after { content: "\2713"; position: absolute; right: 3px; top: 1px; font-size: 10px; }
.cal-grid .pad-day { visibility: hidden; }
/* toast */
#toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 20px); background: #222; color: #fff; padding: 8px 14px; font-size: 14px; border-radius: 10px; opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; z-index: 200; max-width: 92vw; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 520px) { .keys th { white-space: normal; padding-right: 8px; } .keys td { padding-right: 10px; } .page { padding: 10px 8px 30px; } .page-head h1 { font-size: 32px; } .app { padding: 10px; border-radius: 12px; } .panel { padding: 12px 14px; } .chip { padding: 4px 10px; font-size: 13px; } .key { font-size: 22px; padding: 8px 0 12px; } .ctl span:not(.badge):not(.ctl-ico) { font-size: 11px; } .lede { font-size: 14px; } }
@media (max-width: 520px) { .stats.grid thead { display: none; } .stats.grid tbody tr { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px 8px; padding: 8px 0; border-bottom: 1px solid var(--border); } .stats.grid tbody tr:last-child { border-bottom: 0; } .stats.grid tbody th { grid-column: 1 / -1; padding: 0 0 2px; } .stats.grid tbody td { text-align: left; padding: 0; white-space: normal; } .stats.grid tbody td::before { content: attr(data-label); display: block; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); } }
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }
