:root {
  color-scheme: dark;
  --page: #0b0a0e;
  --text: #f3f0f6;
  --muted: #a5a0ae;
  --accent: #c7b4ff;
  --rule: #ffffff18;
  font-family: system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--page);
}
* { box-sizing: border-box; }
body { min-width: 280px; margin: 0; min-height: 100svh; position: relative; isolation: isolate; }
body::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  content: "";
  pointer-events: none;
  background: radial-gradient(ellipse at 78% 20%, #21192e 0%, transparent 52%),
    linear-gradient(135deg, transparent 34%, #b1a0df0b 47%, transparent 61%);
  mask-image: linear-gradient(#000, #000 65%, transparent);
}
button, a { color: inherit; }
button { font: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible, .board:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
a { text-decoration: none; }
.shell { width: min(1120px, calc(100% - 72px)); margin-inline: auto; }
.header { height: 78px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--rule); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 650; letter-spacing: -.04em; }
.quiet { display: inline-flex; gap: 12px; align-items: center; border: 1px solid var(--rule); background: #ffffff06; padding: 9px 13px; border-radius: 8px; font-size: 13px; color: #ded8e7; }
.quiet:hover, .restart:hover { background: #ffffff12; }
.quiet span { color: var(--accent); }
.hero { min-height: 610px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 466px); gap: clamp(32px, 8vw, 118px); align-items: center; padding: 60px 0; }
.intro { padding-bottom: 20px; }
.eyebrow, .readouts span, .dimensions { font: 500 11px/1.5 ui-monospace, Consolas, monospace; letter-spacing: .14em; }
.eyebrow { color: #bcb1cc; display: flex; align-items: center; gap: 9px; margin: 0 0 20px; }
.eyebrow i, .console-foot i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); display: inline-block; box-shadow: 0 0 12px #b59aff66; }
h1 { font: 400 clamp(70px, 9.4vw, 130px)/.82 Georgia, serif; letter-spacing: -.085em; margin: 0 0 30px; }
h1 em { font-style: normal; color: #d3c3f6; }
.lede { color: #bab4c4; font-size: 16px; line-height: 1.7; max-width: 340px; margin: 0; }
.instructions { display: flex; align-items: center; flex-wrap: wrap; gap: 11px; color: var(--muted); font-size: 12px; margin-top: 24px; }
.keycaps { display: flex; gap: 4px; }
kbd { min-width: 25px; display: inline-grid; place-items: center; height: 25px; border: 1px solid #ffffff20; border-bottom-width: 2px; border-radius: 5px; background: #ffffff06; font: 14px ui-monospace, monospace; color: #ded6ee; }
.console { min-width: 0; padding: 17px; border: 1px solid #ffffff24; border-radius: 17px; background: linear-gradient(145deg,#211c2a,#15121c 57%); box-shadow: 0 22px 64px #0007, inset 0 1px #ffffff09; }
.console-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 1px 1px 15px; }
.readouts { display: flex; gap: clamp(14px, 3vw, 32px); min-width: 0; }
.readouts div { min-width: 52px; }
.readouts span { display: block; color: #b4a9c4; font-size: 9px; margin-bottom: 3px; }
.readouts strong { font-size: 23px; line-height: 1.15; font-weight: 600; font-variant-numeric: tabular-nums; }
.restart, .primary { border: 1px solid #ffffff24; border-radius: 8px; padding: 9px 12px; background: #ffffff0a; font-size: 12px; white-space: nowrap; }
.restart { display: flex; align-items: center; gap: 6px; }
.primary { color: #1b1326; border: 0; background: #dfd1ff; font-weight: 650; padding: 10px 16px; }
.primary:hover { background: #eee5ff; }
.board { --gap: 8px; position: relative; isolation: isolate; aspect-ratio: 1; touch-action: none; user-select: none; border-radius: 12px; background: #100e16; border: 1px solid #ffffff10; }
.cells, .tiles { position: absolute; inset: 9px; }
.cells { display: grid; grid-template: repeat(4,1fr) / repeat(4,1fr); gap: var(--gap); }
.cell { border: 1px solid #ffffff09; background: #201b2a; border-radius: 8px; }
.tile { width: calc((100% - 3 * var(--gap)) / 4); height: calc((100% - 3 * var(--gap)) / 4); position: absolute; top: 0; left: 0; transform: translate(calc(var(--col) * (100% + var(--gap))), calc(var(--row) * (100% + var(--gap)))); transition: transform 115ms ease-out; }
.tile span { display: grid; place-items: center; width: 100%; height: 100%; border-radius: 8px; border: 1px solid #ffffff22; background: var(--tile-bg, #d9c7ff); color: var(--tile-ink, #201530); font-size: clamp(18px, 3.4vw, 42px); line-height: 1; letter-spacing: -.05em; font-weight: 650; font-variant-numeric: tabular-nums; }
.tile[data-value="2"] { --tile-bg: #332c40; --tile-ink: #f0eaf9; }
.tile[data-value="4"] { --tile-bg: #443852; --tile-ink: #f5edff; }
.tile[data-value="8"] { --tile-bg: #544166; --tile-ink: #f5edff; }
.tile[data-value="16"] { --tile-bg: #66517a; --tile-ink: #f7efff; }
.tile[data-value="32"] { --tile-bg: #7b6097; --tile-ink: #fff6ff; }
.tile[data-value="64"] { --tile-bg: #a78ac9; }
.tile[data-value="128"], .tile[data-value="256"] { --tile-bg: #c0a6e7; }
.tile[data-digits="4"] span { font-size: clamp(17px, 2.7vw, 34px); }
.tile[data-digits="5"] span, .tile[data-digits="6"] span { font-size: clamp(14px, 2.25vw, 28px); }
.console-foot { display: flex; justify-content: space-between; align-items: center; margin: 13px 1px 0; font-size: 11px; color: #b1a8be; }
.console-foot i { width: 5px; height: 5px; margin-right: 4px; }
.dimensions { font-size: 10px; }
.result { position: absolute; inset: 0; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 18px; background: #14101be8; border-radius: 12px; backdrop-filter: blur(6px); }
.result[hidden] { display: none; }
.result h2, dialog h2 { font: 400 clamp(30px, 4vw, 48px)/1 Georgia, serif; letter-spacing: -.04em; margin: 0; }
.result .eyebrow { margin-bottom: 10px; }
.result p:not(.eyebrow) { color: var(--muted); font-size: 13px; margin: 12px 0 18px; }
.footer { display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid var(--rule); padding-block: 23px; font-size: 11px; color: #a09aaa; }
.footer span:first-child { font-family: ui-monospace, Consolas, monospace; color: #d2c9de; }
dialog { width: min(480px,calc(100% - 32px)); max-height: calc(100% - 36px); padding: 29px; border: 1px solid #ffffff27; background: #1d1826; border-radius: 17px; color: var(--text); }
dialog::backdrop { background: #08070cbe; backdrop-filter: blur(4px); }
dialog p:not(.eyebrow) { font-size: 14px; line-height: 1.65; color: #cbc2d6; }
.close { position: absolute; top: 12px; right: 14px; padding: 3px 8px; border: 0; background: transparent; font-size: 25px; color: var(--muted); }
.example { display: flex; align-items: center; gap: 11px; }
.example span { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 7px; background: #443852; font-size: 24px; }
.example .example-result { background: #66517a; }
.example b { font-weight: 500; color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 760px) {
  .shell { width: min(480px, calc(100% - 36px)); }
  .header { height: 60px; }
  .hero { grid-template-columns: minmax(0, 1fr); min-height: auto; gap: 22px; padding-block: 30px 34px; }
  .intro { padding: 0; }
  .intro .eyebrow { margin-bottom: 14px; font-size: 9px; }
  h1 { font-size: clamp(48px, 11vw, 70px); margin-bottom: 14px; line-height: 1; }
  h1 br { display: none; }
  h1 em { margin-left: .22em; }
  .lede { font-size: 14px; }
  .instructions { margin-top: 12px; }
  .keycaps { display: none; }
  .console { padding: 12px; }
  .tile span { font-size: clamp(19px, 7vw, 36px); }
  .tile[data-digits="4"] span { font-size: clamp(16px, 5.4vw, 28px); }
  .tile[data-digits="5"] span, .tile[data-digits="6"] span { font-size: clamp(13px, 4.4vw, 23px); }
  .footer { flex-wrap: wrap; padding-block: 16px; }
}
@media (max-width: 360px) {
  .shell { width: calc(100% - 24px); }
  .board { --gap: 5px; }
  .cells, .tiles { inset: 6px; }
  .readouts { gap: 10px; }
  .readouts strong { font-size: 19px; }
  .restart { padding-inline: 8px; }
}
@media (prefers-reduced-motion: reduce) { .tile { transition: none; } }
