/* sunkencity64: clean, bright, built for a phone held in one hand. */
:root {
  --ink: #0a1226;
  --muted: #5b6475;
  --line: #e3e8f0;
  --bg: #ffffff;
  --soft: #f4f7fb;
  --blue: #2465ff;
  --blue-deep: #1a4fd6;
  --orange: #ff881a;
  --red: #d92d20;
  --green: #1a7f45;
  --radius: 14px;
  --tap: 48px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html { scroll-padding-top: 72px; }
body { margin: 0; min-height: 100dvh; display: flex; flex-direction: column; font-size: 16px; line-height: 1.45; }
h1 { font-size: 1.6rem; line-height: 1.15; margin: 20px 0 10px; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; margin: 0 0 6px; }
h1 small, .h-name small { display: block; font-size: 0.9rem; font-weight: 400; color: var(--muted); margin-top: 4px; letter-spacing: 0; }
p { margin: 0 0 12px; }
a { color: var(--blue-deep); }
code { font-size: 0.82em; word-break: break-all; }
.muted { color: var(--muted); }
.small { font-size: 0.86rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px; }

/* Top bar on wide screens; tabs move to the bottom edge on phones, under the thumb. */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 800; font-size: 1.1rem; letter-spacing: -0.02em; color: var(--ink); text-decoration: none; }
.tabs { display: flex; gap: 4px; }
.tabs a { padding: 8px 12px; border-radius: 999px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.95rem; }
.tabs a.on { color: var(--ink); background: var(--soft); }
@media (max-width: 640px) {
  .top { justify-content: center; }
  .tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--bg); border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; gap: 0; }
  .tabs a { flex: 1; text-align: center; padding: 12px 4px; font-size: 0.86rem; border-radius: 10px; }
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
}

main { width: 100%; max-width: 680px; margin: 0 auto; padding: 0 16px 32px; flex: 1; }
main.wide { max-width: none; padding: 0 0 32px; }
main:not(.wide) > :first-child { margin-top: 16px; }
.col { max-width: 680px; margin: 0 auto; padding: 0 16px; }
.foot { display: flex; gap: 16px; justify-content: center; padding: 20px 16px; color: var(--muted); font-size: 0.85rem; border-top: 1px solid var(--line); }

/* The home page's marble. The sky shows before (and without) the 3D scene. */
.hero { background: linear-gradient(#3f8fe0, #8cc4f2 70%, #cfe7fb); height: min(46vh, 420px); min-height: 240px; margin-bottom: 16px; }
.hero canvas { display: block; width: 100%; height: 100%; }
#marble { display: block; width: 100%; height: 240px; border-radius: var(--radius); background: linear-gradient(#3f8fe0, #a9d3f5); margin-bottom: 16px; }

.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 14px; background: var(--bg); }
.card.center { text-align: center; padding: 24px 16px; }
.card.narrow { max-width: 440px; margin: 24px auto; }
.card.danger summary { cursor: pointer; font-weight: 600; color: var(--red); min-height: 28px; }
.card.danger[open] summary { margin-bottom: 10px; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: var(--tap); padding: 0 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn:focus-visible, input:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.actions .btn { flex: 1 1 auto; }

input[type=text], input[type=email], input[type=search] { width: 100%; min-height: var(--tap); padding: 0 14px; border-radius: 12px; border: 1px solid #c5cedd; font: inherit; font-size: 16px; color: var(--ink); background: var(--bg); }
input.code { font-size: 1.6rem; letter-spacing: 0.3em; text-align: center; font-variant-numeric: tabular-nums; }
label, legend { font-weight: 600; }
.stack { display: grid; gap: 10px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }

.search { display: grid; gap: 10px; }
.search .row { display: flex; gap: 8px; }
.search .row input { flex: 1; min-width: 0; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--soft); border-radius: 12px; padding: 4px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; }
.seg span { display: flex; align-items: center; justify-content: center; min-height: 40px; border-radius: 9px; color: var(--muted); cursor: pointer; }
.seg input:checked + span { background: var(--bg); color: var(--ink); box-shadow: 0 1px 3px rgb(10 18 38 / 0.15); }
.seg input:focus-visible + span { outline: 3px solid var(--orange); }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 0 0 20px; }
.tiles a { display: block; padding: 16px; border-radius: var(--radius); background: var(--soft); color: var(--ink); text-decoration: none; }
.tiles small, .list small, .result-head small { display: block; color: var(--muted); font-size: 0.86rem; font-weight: 400; }

.list, .results { list-style: none; padding: 0; margin: 0; }
.list li { border-bottom: 1px solid var(--line); }
.list .line { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 2px; color: var(--ink); text-decoration: none; min-height: var(--tap); }
.num { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.result-head { display: flex; justify-content: space-between; gap: 12px; }
.place { text-align: right; white-space: nowrap; }
.place b { font-size: 1.5rem; line-height: 1; font-variant-numeric: tabular-nums; }
.outcome { margin: 8px 0 0; color: var(--muted); }
.h-name { overflow-wrap: anywhere; }

.table { width: 100%; border-collapse: collapse; margin: 8px 0 16px; font-variant-numeric: tabular-nums; }
.table th { text-align: left; font-size: 0.8rem; color: var(--muted); font-weight: 600; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.table td { padding: 11px 6px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.table .n { width: 3.2em; color: var(--muted); }
.table .r { text-align: right; white-space: nowrap; }
.table tr.me td { background: #fff4e5; font-weight: 600; }
@media (max-width: 480px) { .hide-s { display: none; } }
.tag { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px; background: var(--soft); color: var(--muted); font-size: 0.72rem; font-weight: 600; vertical-align: middle; white-space: nowrap; }
.tag.member { background: #e6eeff; color: var(--blue-deep); }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.you { padding: 14px 16px; border-radius: var(--radius); background: #fff4e5; }

.notice { padding: 12px 14px; border-radius: 12px; background: var(--soft); }
.notice.error { background: #fdecea; color: #8a1c13; }
.notice.ok { background: #e7f6ec; color: var(--green); }
.prose p { margin-bottom: 16px; }

/* Marble colours: a fixed list, so they are classes (the site allows no inline styles). */
.dot { display: inline-block; width: 0.85em; height: 0.85em; border-radius: 50%; margin-right: 8px; vertical-align: -0.05em; border: 1px solid rgb(10 18 38 / 0.25); background: #fff; }
.swatches { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.swatches legend { margin-bottom: 8px; }
.swatches label { position: relative; display: block; aspect-ratio: 1; }
.swatches input { position: absolute; opacity: 0; inset: 0; }
.swatch { display: block; width: 100%; height: 100%; border-radius: 50%; border: 1px solid rgb(10 18 38 / 0.25); cursor: pointer; }
.swatches input:checked + .swatch { box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--ink); }
.swatches input:focus-visible + .swatch { outline: 3px solid var(--orange); outline-offset: 7px; }
.c-FFFFFF { background: #ffffff; } .c-FF3B30 { background: #ff3b30; } .c-FF9500 { background: #ff9500; } .c-FFD60A { background: #ffd60a; }
.c-34C759 { background: #34c759; } .c-00C7BE { background: #00c7be; } .c-32ADE6 { background: #32ade6; } .c-0A84FF { background: #0a84ff; }
.c-5E5CE6 { background: #5e5ce6; } .c-BF5AF2 { background: #bf5af2; } .c-FF2D55 { background: #ff2d55; } .c-48484A { background: #48484a; }

@media (prefers-reduced-motion: no-preference) { .btn, .tabs a { transition: background-color 0.15s; } }
