/* Layout: one screen. Header with view switch, cube stage fills the middle, footer pinned below.
   Door, My December and How it works are scrollable pages below the header (see js/app.js routes). */
:root {
  color-scheme: dark;
  --bg: #0b1113;
  --bg-glow: #14211f;
  --ink: #ece7dc;
  --ink-dim: #8d968f;
  --line: #26322f;
  --panel: #121a1b;
  --panel-2: #18221f;
  --accent: #d9a441;
  --good: #4fae6f;
  --bad: #c9545c;
  --gold: #e2b347;
  --silver: #b9c2c6;
  --bronze: #c3804a;
  --cube-body: #07090a;
  --font-display: "Bricolage Grotesque", "Trebuchet MS", system-ui, sans-serif;
  --font-body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --s: 200px;
  --hold-ms: 1000ms;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: radial-gradient(120% 80% at 50% 35%, var(--bg-glow), var(--bg) 70%) var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  overflow: hidden;
  overscroll-behavior: none;
}
#ornaments { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
img { max-width: 100%; }
.muted { color: var(--ink-dim); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.page {
  position: relative;
  height: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.page > header {
  position: relative;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
}
h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
}
h1 .year { color: var(--accent); }

.views {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
}
.views a {
  padding: 7px 14px;
  border: 0;
  text-decoration: none;
  white-space: nowrap;
  border-radius: 999px;
  background: none;
  font: 600 0.875rem var(--font-body);
  color: var(--ink-dim);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.views a:hover { color: var(--ink); }
.views a[aria-current="page"] { background: var(--accent); color: #111; }
.views a:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---------------------------------------------------------------- cube */
.stage {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  perspective: calc(var(--s) * 4);
  touch-action: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
.stage.dragging { cursor: grabbing; }

.cube {
  position: relative;
  width: var(--s);
  height: var(--s);
  transform-style: preserve-3d;
}
.face {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template: 1fr 1fr / 1fr 1fr;
  gap: 3%;
  padding: 3%;
  background: var(--cube-body);
  border-radius: 4%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.face[data-f="0"] { transform: translateZ(calc(var(--s) / 2)); }
.face[data-f="1"] { transform: rotateY(180deg) translateZ(calc(var(--s) / 2)); }
.face[data-f="2"] { transform: rotateY(90deg) translateZ(calc(var(--s) / 2)); }
.face[data-f="3"] { transform: rotateY(-90deg) translateZ(calc(var(--s) / 2)); }
.face[data-f="4"] { transform: rotateX(90deg) translateZ(calc(var(--s) / 2)); }
.face[data-f="5"] { transform: rotateX(-90deg) translateZ(calc(var(--s) / 2)); }

.sq {
  position: relative;
  appearance: none;
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
  min-height: 0;
  border-radius: 10%;
  background: var(--c);
  color: var(--t);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: calc(var(--s) * 0.2);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  box-shadow: inset 0 0 0 calc(var(--s) * 0.006) rgba(255, 255, 255, 0.18),
              inset 0 calc(var(--s) * -0.03) calc(var(--s) * 0.05) rgba(0, 0, 0, 0.22);
  transition: filter 0.15s;
  -webkit-touch-callout: none;
}
.sq:hover { filter: brightness(1.1); }
.sq:focus-visible { outline: calc(var(--s) * 0.015) solid var(--ink); outline-offset: calc(var(--s) * -0.03); }

.sq .cap { position: absolute; inset: 0; display: grid; place-items: center; }
.sq .num, .sq .let, .sq .sub { grid-area: 1 / 1; }
.sq .let { opacity: 0; font-size: 1.15em; }
.sq .sub {
  opacity: 0;
  align-self: end;
  margin-bottom: 12%;
  font: 600 calc(var(--s) * 0.05) var(--font-body);
  font-variant-numeric: tabular-nums;
}
.sq.reveal .num { opacity: 0; }
.sq.reveal .let, .sq.reveal .sub { opacity: 1; }
.sq.locked-peek .let { font-size: 0.7em; margin-bottom: 15%; }
.sq.reveal .cap { animation: flip 0.22s ease-out; }
@keyframes flip { 0% { transform: rotateY(90deg); } 100% { transform: rotateY(0deg); } }

/* Charge ring: fills while held, glows when ready to open */
.sq .ring { position: absolute; inset: 6%; width: 88%; height: 88%; pointer-events: none; transform: rotate(-90deg); }
.sq .ring circle {
  fill: none;
  stroke: var(--t);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  opacity: 0;
}
.sq.charging .ring circle { opacity: 0.85; stroke-dashoffset: 0; transition: stroke-dashoffset var(--hold-ms) linear; }
.sq.armed { filter: brightness(1.18); }
.sq.armed .ring circle { stroke-width: 7; opacity: 1; }
.sq.armed .cap { animation: pop 0.25s ease-out; }
@keyframes pop { 50% { transform: scale(1.12); } }

/* Medal marks in the corner of finished doors */
.sq::after {
  content: "";
  position: absolute;
  top: 9%;
  right: 9%;
  width: 13%;
  height: 13%;
  border-radius: 50%;
  display: none;
  box-shadow: 0 0 0 calc(var(--s) * 0.006) rgba(0, 0, 0, 0.35);
}
.sq[data-medal="gold"]::after { display: block; background: var(--gold); }
.sq[data-medal="silver"]::after { display: block; background: var(--silver); }
.sq[data-medal="bronze"]::after { display: block; background: var(--bronze); }
.sq[data-medal="floppy"]::after { display: block; background: #39424a; }
.sq[data-medal="progress"]::after { display: block; background: transparent; box-shadow: inset 0 0 0 calc(var(--s) * 0.008) var(--t); }

footer {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding-bottom: 4px;
  text-align: center;
}
.next {
  margin: 0;
  padding: 8px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}
.hint { margin: 0; font-size: 0.8125rem; color: var(--ink-dim); max-width: 60ch; }
.hint span { font-variant-numeric: tabular-nums; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 88px;
  z-index: 50;
  transform: translate(-50%, 12px);
  max-width: calc(100% - 32px);
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: #111;
  font-weight: 600;
  font-size: 0.9375rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------------------------------------------------------- shared bits */
.btn {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 16px;
  background: var(--panel-2);
  color: var(--ink);
  font: 600 0.9375rem var(--font-body);
  cursor: pointer;
}
.btn:hover { border-color: var(--ink-dim); }
.btn:disabled { color: var(--ink-dim); border-color: var(--line); filter: grayscale(1); opacity: 0.55; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #111; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.small { padding: 6px 12px; font-size: 0.875rem; }
a.btn { display: inline-block; text-decoration: none; }
.btn:focus-visible, .choice:focus-visible, .linkish:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.linkish {
  appearance: none; border: 0; background: none; padding: 4px 0; margin-top: 10px;
  color: var(--ink-dim); font: inherit; font-size: 0.875rem; text-decoration: underline; cursor: pointer;
}
.linkish:hover { color: var(--ink); }

/* Anagram strip */
.strip { display: flex; flex-wrap: wrap; gap: 6px 12px; margin: 10px 0; }
.strip .word { display: flex; gap: 3px; }
.tile {
  width: 28px;
  display: flex; flex-direction: column; align-items: center;
}
.tile b {
  display: grid; place-items: center;
  width: 28px; height: 34px;
  border-radius: 6px;
  background: var(--panel-2);
  border: 1px dashed var(--line);
  font: 700 1.1rem var(--font-display);
}
.tile.got b { background: var(--ink); color: #111; border: 0; }
.tile.hl b { background: var(--accent); }
.tile small { font-size: 0.625rem; color: var(--ink-dim); margin-top: 2px; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- door page */
.door-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.door-step { min-width: 90px; color: var(--ink-dim); font-weight: 600; font-size: 0.9375rem; text-decoration: none; padding: 6px 0; }
.door-step.fwd { text-align: right; }
a.door-step:hover { color: var(--ink); }
.door-step.locked { opacity: 0.6; }
.door-of { color: var(--ink-dim); font-size: 0.875rem; }
.door-card {
  display: block;
  padding: 22px 24px 26px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
}
.locked-door { text-align: center; padding: 24px 0; }
.locked-door .lock-icon { font-size: 3rem; margin: 0; }
.locked-door h2 { font: 700 1.5rem var(--font-display); margin: 8px 0; }
.locked-door b { font-variant-numeric: tabular-nums; color: var(--accent); }
.door-head { display: flex; align-items: center; gap: 16px; }
.door-head > div:first-child { flex: 1; }
.eyebrow { margin: 0 0 2px; color: var(--accent); font-weight: 600; font-size: 0.875rem; letter-spacing: 0.02em; }
.door-head h2 { margin: 0; font: 700 1.6rem var(--font-display); letter-spacing: -0.01em; }
.lede { margin: 12px 0 14px; color: var(--ink-dim); }
.lede q { color: var(--ink); }

.player-inner { display: flex; align-items: center; gap: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel-2); }
.play {
  flex: none;
  width: 56px; height: 56px;
  border: 0; border-radius: 50%;
  background: var(--accent); color: #111;
  cursor: pointer;
  display: grid; place-items: center;
}
.play svg { width: 26px; height: 26px; fill: currentColor; }
.play .i-stop, .play.playing .i-play { display: none; }
.play.playing .i-stop { display: inline; }
.play:disabled { opacity: 0.4; cursor: default; }
.play:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.wave-wrap { position: relative; flex: 1; min-width: 0; }
.wave { display: block; width: 100%; height: 56px; }
.wave-msg { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-dim); font-size: 0.875rem; }

.guess { margin-top: 18px; }
.worth { margin: 0 0 10px; }
.worth b { color: var(--accent); }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(125px, 1fr)); gap: 8px; }
.choice {
  appearance: none;
  padding: 12px 10px;
  line-height: 1.25;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
  color: var(--ink);
  font: 600 1rem var(--font-body);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}
.choice:hover:not(:disabled) { border-color: var(--accent); }
.choice:active:not(:disabled) { transform: translateY(1px); }
.choices.locked .choice { opacity: 0.32; cursor: not-allowed; filter: grayscale(1); border-style: dashed; }
.choice.wrong { opacity: 0.45; text-decoration: line-through; cursor: default; }
.choice.wrong span { color: var(--bad); text-decoration: none; }
.choice.shake { animation: shake 0.28s; border-color: var(--bad); }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

.clues { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 12px; margin-top: 18px; }
.clue { margin: 0; animation: rise 0.3s ease-out; }
.clue:only-child { grid-column: 1 / -1; max-width: 280px; }
.clue img { display: block; width: 100%; height: auto; aspect-ratio: auto; border-radius: 12px; border: 1px solid var(--line); }
.clue:not(.wide) img { aspect-ratio: 1; object-fit: cover; }
.clue.wide img { aspect-ratio: 4 / 3; object-fit: cover; }
.clue figcaption { margin-top: 6px; font-size: 0.875rem; color: var(--ink-dim); }
.clue figcaption b { color: var(--ink); }

.door-reveal { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.medal { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line); }
.medal-icon { font-size: 2.6rem; line-height: 1; }
.medal b { font: 700 1.25rem var(--font-display); }
.medal .pts { color: var(--accent); font-weight: 700; margin-left: 6px; }
.medal span:last-child { color: var(--ink-dim); font-size: 0.9375rem; }
.medal-gold { border-color: color-mix(in oklab, var(--gold), transparent 40%); }
.medal-silver { border-color: color-mix(in oklab, var(--silver), transparent 50%); }
.medal-bronze { border-color: color-mix(in oklab, var(--bronze), transparent 40%); }
.celebrate .medal-icon { animation: medal 0.7s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes medal { 0% { transform: scale(0.2) rotate(-30deg); opacity: 0; } 100% { transform: none; opacity: 1; } }

.machine { margin: 16px 0 0; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.machine .photo { display: block; width: 100%; border-radius: 12px; border: 1px solid var(--line); }
.machine .logo { display: block; width: 100%; max-width: 260px; border-radius: 8px; margin-bottom: 10px; }
.machine h3 { margin: 0; font: 700 1.35rem var(--font-display); }
.machine .meta { margin: 2px 0 8px; color: var(--accent); font-weight: 600; font-size: 0.875rem; }
.machine p { margin: 0 0 8px; line-height: 1.5; }

.keyrow { display: flex; gap: 14px; align-items: center; margin-top: 16px; }
.keyrow > img { flex: none; width: 96px; height: 96px; border-radius: 10px; border: 1px solid var(--line); object-fit: cover; }
.keyrow p { margin: 0; }
.keyrow .big { font: 700 1.3rem var(--font-display); color: var(--accent); }
.keyrow .strip { margin-bottom: 0; }
.keyrow .tile, .keyrow .tile b { width: 22px; }
.keyrow .tile b { height: 26px; font-size: 0.875rem; border-radius: 4px; }
.keyrow .tile small { display: none; }

.fact { margin: 16px 0 0; padding: 12px 14px; border-left: 3px solid var(--accent); background: var(--panel-2); border-radius: 0 10px 10px 0; line-height: 1.5; }

.typing { margin-top: 18px; padding: 14px 16px 6px; border: 1px solid var(--line); border-radius: 14px; }
.typing h3 { margin: 0; font: 700 1.1rem var(--font-display); }
.typing > p { margin: 4px 0 10px; font-size: 0.9375rem; }
.typing-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 8px; font-size: 0.9375rem; }
.typing select {
  margin-left: 6px; padding: 6px 8px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--ink); font: inherit;
}
.typing textarea {
  display: block; width: 100%; resize: vertical;
  padding: 12px; border-radius: 10px; border: 1px solid var(--line);
  background: #0a0f10; color: #9fe29f; caret-color: #9fe29f;
  font: 0.9375rem/1.35 var(--font-mono); white-space: pre-wrap;
}
.typing textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.download { color: var(--accent); font-weight: 600; }
.door-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* ---------------------------------------------------------------- My December, How it works */
.view {
  position: fixed;
  inset: 0;
  z-index: 2;
  overflow-y: auto;
  overscroll-behavior: contain;
  top: 72px;
  padding: 10px 16px 40px;
  background: color-mix(in oklab, var(--bg), transparent 6%);
}
.view[hidden] { display: none; }
body[data-view]:not([data-view="calendar"]) .stage, body[data-view]:not([data-view="calendar"]) footer { visibility: hidden; }
.view-inner { max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
#view-door .view-inner { max-width: 760px; gap: 0; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.view-inner > h2 { margin: 0; font: 700 1.6rem var(--font-display); }
.view-inner h2:focus { outline: none; }
.card { padding: 18px 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.card h3 { margin: 0 0 4px; font: 700 1.2rem var(--font-display); }
.prose p { margin: 8px 0 0; line-height: 1.55; }
.prose a, .small-print a { color: var(--accent); }
.points-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.points-list span { display: inline-block; width: 1.8em; }
.card > p { margin: 0; }
.summary { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 28px; }
.big-pts { margin: 0; font: 700 1.7rem/1.1 var(--font-display); color: var(--accent); font-variant-numeric: tabular-nums; }
.big-pts small { font-size: 1rem; color: var(--ink-dim); font-weight: 600; }
.summary .muted { margin: 4px 0 0; }
.medal-counts { display: flex; flex-wrap: wrap; gap: 8px 22px; list-style: none; margin: 0; padding: 0; font-size: 2.4rem; line-height: 1; }
.medal-counts li { display: flex; align-items: center; gap: 6px; }
.medal-counts b { font: 700 1.6rem var(--font-display); font-variant-numeric: tabular-nums; }
.share-box { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.grid-share { margin: 0; font-size: 0.875rem; line-height: 1.15; letter-spacing: 1px; font-family: inherit; }
.friend { border-color: color-mix(in oklab, var(--accent), transparent 45%); }
.friend-row { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; margin: 8px 0; }
.friend-row p { margin: 0 0 4px; }
.anagram-solved { margin: 6px 0 0; font: 700 1.35rem var(--font-display); letter-spacing: 0.04em; color: var(--accent); cursor: default; user-select: none; -webkit-user-select: none; }
/* letters that rearrange themselves (see magicWord in app.js) */
.magic { position: relative; display: inline-block; white-space: nowrap; }
.magic .l { display: inline-block; transform: none; pointer-events: none;
  transition: transform 0.9s cubic-bezier(0.55, -0.25, 0.3, 1.3); transition-delay: calc(var(--i) * var(--step, 30ms)); }
.magic.on .l { transform: translateX(var(--dx)); }
.magic .l i { display: inline-block; font-style: normal; }
.magic.played .l i { animation: magic-back 0.9s ease-in-out both; animation-delay: calc(var(--i) * var(--step, 30ms)); }
.magic.on .l i { animation-name: magic-there; }
@keyframes magic-there { 50% { transform: translateY(var(--lift)) rotate(var(--spin)) scale(1.15); text-shadow: 0 0 10px #ffe9a8, 0 0 2px #fff; } }
@keyframes magic-back  { 50% { transform: translateY(calc(var(--lift) * -1)) rotate(calc(var(--spin) * -1)) scale(1.15); text-shadow: 0 0 10px #ffe9a8, 0 0 2px #fff; } }
@media (prefers-reduced-motion: reduce) {
  .magic .l, .magic .l i { transition: none; animation: none !important; }
}

.solve { margin-top: 8px; }
.solve label { font-weight: 600; font-size: 0.9375rem; }
.solve-row { display: flex; gap: 8px; margin-top: 6px; }
.solve input {
  flex: 1; min-width: 0;
  padding: 9px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--ink);
  font: 600 1rem var(--font-mono); text-transform: uppercase;
}
.solve input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.solve .muted { margin: 6px 0 0; min-height: 1.2em; }
.solved { margin: 10px 0 0; text-align: center; }
.solved p { margin: 0; }
.solved-head { font-size: 1.05rem; }
.solved-answer { margin-top: 4px !important; white-space: nowrap; font-size: 1.15rem; }
.solved-answer b { color: var(--accent); font-family: var(--font-display); letter-spacing: 0.04em; }
@media (min-width: 640px) {
  .solved-head { font-size: 1.35rem; }
  .solved-answer { font-size: 1.6rem; margin-top: 8px !important; }
}


.table-wrap { overflow-x: auto; margin-top: 8px; }
table.days { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.days th, .days td { padding: 4px 10px; height: 46px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.days thead th { font-size: 0.75rem; font-weight: 600; color: var(--ink-dim); text-transform: uppercase; letter-spacing: 0.06em; }
.days tbody th { font: 700 1.1rem var(--font-display); white-space: nowrap; font-variant-numeric: tabular-nums; }
.days .num { text-align: right; font-variant-numeric: tabular-nums; }
.days tr > :first-child { width: 56px; }
.days .key { width: 52px; }
.machine-cell { display: flex; align-items: center; gap: 8px; }
.machine-cell .machine-link { flex: 1; min-width: 0; }
.dl-icon { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; color: var(--ink-dim); }
.dl-icon:hover { color: var(--accent); background: var(--panel-2); }
.dl-icon:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.dl-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.days tr.locked th { opacity: 0.45; }
.days .opens-in { display: inline-block; margin-left: 6px; color: var(--ink-dim); font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.days tfoot th, .days tfoot td { border-bottom: 0; font-weight: 700; padding-top: 12px; }
.days tfoot td { font: 700 1.2rem var(--font-display); color: var(--accent); }
.thumb { display: block; flex: none; width: 36px; height: 36px; border-radius: 8px; object-fit: cover; }
.machine-link {
  color: inherit; text-decoration: none;
  display: flex; align-items: center; gap: 10px; text-align: left;
}
.machine-link:hover span { text-decoration: underline; }
.logo-thumb { width: 104px; height: 20px; object-fit: contain; object-position: left center; border-radius: 3px; flex: none; }
.medal-cell { white-space: nowrap; }
.small-print { text-align: center; font-size: 0.8125rem; }

/* ---------------------------------------------------------------- small screens */
@media (max-width: 640px) {
  .page { padding: 12px; }
  header { justify-content: center; }
  h1 { width: 100%; text-align: center; }
  .door-card { padding: 18px 16px 22px; }
  .views a { padding: 7px 11px; }
  .door-head h2 { font-size: 1.3rem; }
  .clues, .machine { grid-template-columns: 1fr; }
  .clue:only-child { max-width: none; }
  .share-box { margin-left: 0; align-items: flex-start; }
  .medal-counts { font-size: 2rem; gap: 8px 16px; }
  .medal-counts b { font-size: 1.35rem; }
  .card { padding: 14px 12px; }
  .days th, .days td { padding: 6px 4px; }
  .days { font-size: 0.875rem; }
  .days thead th { letter-spacing: 0; font-size: 0.6875rem; }
  .logo-thumb, .medal-title { display: none; }
  .medal-cell { font-size: 1.3rem; }
  .keyrow { flex-wrap: wrap; }
  .toast { bottom: 110px; }
}

@media (prefers-reduced-motion: reduce) {
  .sq, .sq.reveal .cap, .sq.armed .cap, .clue, .celebrate .medal-icon, .choice.shake { animation: none; transition: none; }
  .sq.charging .ring circle { transition: stroke-dashoffset var(--hold-ms) linear; }
}

/* ---------------------------------------------------------------- placeholders (machines not yet photographed) */
.keycap-ph {
  display: grid; place-items: center; align-content: center; gap: 6px;
  width: 100%; aspect-ratio: 1;
  border-radius: 12px; border: 1px dashed var(--line);
  background: radial-gradient(circle at 50% 40%, #2a3130, #141a1a 70%);
}
.keycap-ph span {
  display: grid; place-items: center;
  width: 44%; aspect-ratio: 1;
  border-radius: 14%;
  background: #3a3f3d; color: #f1ece0;
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.35), 0 4px 10px rgba(0, 0, 0, 0.4);
  font: 700 clamp(1.4rem, 6vw, 3rem) var(--font-display);
}
.keycap-ph small { color: var(--ink-dim); font-size: 0.75rem; }
.keycap-ph.small { flex: none; width: 96px; }
.keycap-ph.small small, .keycap-ph.thumb small { display: none; }
.keycap-ph.small span { font-size: 1.6rem; }
.keycap-ph.thumb { width: 36px; border-radius: 7px; }
.keycap-ph.thumb span { width: 66%; font-size: 0.8125rem; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.35); }
.photo-ph {
  display: grid; place-items: center;
  width: 100%; aspect-ratio: 4 / 3;
  border-radius: 12px; border: 1px dashed var(--line);
  background: var(--panel-2); color: var(--ink-dim); font-size: 0.9375rem;
}
.machine .photo-ph { display: grid; }
.teaser { margin: 10px 0 0; color: var(--accent); font-weight: 600; }
.kbd-hint { color: var(--ink-dim); font-size: 0.8125rem; white-space: nowrap; }
.kbd-hint kbd {
  display: inline-block; min-width: 1.6em; padding: 1px 5px; margin-right: 2px;
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px;
  background: var(--panel-2); color: var(--ink); font: 600 0.75rem var(--font-body); text-align: center;
}
.mail { appearance: none; border: 0; background: none; padding: 0; cursor: copy; color: var(--accent); }
.mail code { font: 600 0.9375rem var(--font-mono); }
.mail:hover code { text-decoration: underline; }
.mail:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 4px; }
.big-pts + .big-pts { margin-top: 6px; }
.home { color: inherit; text-decoration: none; }
.home:hover .year { text-decoration: underline; }
.home:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 4px; }

/* very narrow phones: four tabs must still fit next to each other */
@media (max-width: 420px) {
  .views { gap: 0; padding: 3px; }
  .views a { padding: 6px 7px; font-size: 0.8125rem; }
}

.nowrap { white-space: nowrap; }
