/* =====================================================================
   UNASSISTED — base
   The whole look is "printed matter from an old athletic club":
   two-colour riso ink on warm paper, stamps, tickets, tape, crop marks.
   Nothing here should look machine-made.
   ===================================================================== */

:root {
  --paper: #F2EADA;
  --paper-hi: #FBF6EA;
  --paper-lo: #E5D9C0;
  --ink: #17130F;
  --ink-2: #4A4238;
  --ink-3: #85796A;
  --red: #F2452E;
  --blue: #2749E6;
  --yellow: #FFC42E;
  --pink: #FF6BAA;
  --green: #0E9F6A;
  --slate: #1E2A28;
  --chalk: #EFEBDF;
  --dark: #17130F;   /* fixed: text on yellow / pink */
  --light: #FBF6EA;  /* fixed: text on red / blue / slate */
  --blend: multiply;
  --line: 3px;
  --shadow: 5px 5px 0 var(--ink);
  --shadow-lg: 9px 9px 0 var(--ink);
  --f-fat: "Bowlby One", "Arial Black", Impact, sans-serif;
  --f-cond: "Big Shoulders Display", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --f-body: "Fraunces", Georgia, "Times New Roman", serif;
  --f-type: "Special Elite", "Courier New", Courier, monospace;
  --f-hand: "Kalam", "Segoe Print", "Bradley Hand", cursive;
  --ease-out: cubic-bezier(.2, .9, .25, 1);
  --ease-thud: cubic-bezier(.2, 1.7, .4, 1);
  --wrap: 1120px;
  color-scheme: light;
}

/* Lights off: pull the cord top right. */
[data-theme="night"] {
  --paper: #14110E;
  --paper-hi: #1E1A15;
  --paper-lo: #0D0B09;
  --ink: #F2EADA;
  --ink-2: #CEC4B1;
  --ink-3: #91877A;
  --red: #FF5B45;
  --blue: #7E98FF;
  --yellow: #FFCF4A;
  --pink: #FF85BA;
  --green: #3CC892;
  --slate: #0E1615;
  --blend: screen;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100dvh; display: flex; flex-direction: column;
  background: var(--paper); color: var(--ink);
  font-family: var(--f-body); font-size: 17px; line-height: 1.5; font-optical-sizing: auto;
  overflow-x: hidden; -webkit-font-smoothing: antialiased;
  transition: background-color .35s ease, color .35s ease;
}
/* Paper grain over everything, like ink soaking into stock. */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 9000; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .2 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply; opacity: .9;
}
[data-theme="night"] body::after { filter: invert(1); mix-blend-mode: screen; opacity: .5; }

img, svg { display: block; max-width: 100%; }
.defs { position: absolute; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration-thickness: 2px; text-underline-offset: 3px; }
p { margin: 0 0 1em; }
::selection { background: var(--yellow); color: var(--dark); }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; border-radius: 2px; }
[hidden] { display: none !important; }

.skip { position: absolute; left: -999px; top: 0; z-index: 9999; background: var(--yellow); color: var(--dark); padding: .6rem 1rem; font: 900 1rem var(--f-cond); }
.skip:focus { left: .5rem; top: .5rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.noscript { max-width: 40rem; margin: 4rem auto; padding: 1rem; font-family: var(--f-type); text-align: center; }

/* ---------- type ---------- */
h1, h2, h3, h4 { font-family: var(--f-cond); font-weight: 900; text-transform: uppercase; line-height: .92; letter-spacing: .005em; margin: 0; }
.fat { font-family: var(--f-fat); font-weight: 400; text-transform: uppercase; line-height: .9; letter-spacing: -.012em; }
.cond { font-family: var(--f-cond); font-weight: 900; text-transform: uppercase; letter-spacing: .02em; line-height: 1; }
.kicker { font-family: var(--f-cond); font-weight: 700; text-transform: uppercase; letter-spacing: .2em; font-size: .8rem; line-height: 1.2; }
.type { font-family: var(--f-type); letter-spacing: -.01em; }
.hand { font-family: var(--f-hand); line-height: 1.25; }
.small { font-size: .86rem; }
.muted { color: var(--ink-2); }
.red { color: var(--red); } .blue { color: var(--blue); }
.center { text-align: center; }
.rough { filter: url(#rough); }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 1.25rem; }

/* Hand-printed things "boil": the outline redraws a few times a second. */
.boil { animation: boil .5s steps(1) infinite; }
@keyframes boil { 0% { filter: url(#rough); } 34% { filter: url(#rough-b); } 67% { filter: url(#rough-c); } }

/* ---------- the wordmark: UNDO, a small THE, and ROT struck out ---------- */
.wm { font-family: var(--f-fat); line-height: 1; text-decoration: none; letter-spacing: -.012em; display: inline-flex; align-items: baseline; white-space: nowrap; }
.wm .the { font: 900 .4em/1 var(--f-cond); letter-spacing: .14em; margin: 0 .5em 0 .55em; transform: translateY(-.62em); }
.wm .x { position: relative; }
.wm .x::after {
  content: ""; position: absolute; left: -7%; right: -7%; top: 44%; height: .135em;
  background: var(--red); border-radius: 3px; transform: rotate(-8deg); mix-blend-mode: var(--blend);
}

/* ---------- the wire (ticker) ---------- */
.wire { background: var(--dark); color: var(--light); overflow: hidden; white-space: nowrap; font: 700 .8rem/1 var(--f-cond); letter-spacing: .17em; text-transform: uppercase; }
.wire-track { display: inline-flex; padding: .58rem 0 .5rem; animation: wire 70s linear infinite; }
body:not([data-route="home"]):not([data-route="poster"]) .wire { display: none; }
.wire-track > span { padding: 0 1.4rem; }
.wire:hover .wire-track { animation-play-state: paused; }
.wire b { color: var(--yellow); font-weight: 900; }
.wire i { color: var(--red); font-style: normal; }
@keyframes wire { to { transform: translateX(-50%); } }

/* ---------- masthead + folder tabs ---------- */
.mast { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 1.1rem 1.25rem 0; display: flex; align-items: flex-end; gap: 1rem; position: relative; }
.mast .wm { font-size: clamp(1.45rem, 4.6vw, 2.2rem); padding-bottom: .55rem; }
.mast-club { font: 700 .62rem/1.1 var(--f-cond); letter-spacing: .22em; text-transform: uppercase; color: var(--ink-2); padding-bottom: .8rem; display: none; }
@media (min-width: 900px) { .mast-club { display: block; } }
.tabs { display: flex; gap: .3rem; margin-left: auto; padding-right: 5.4rem; }   /* room for the sound button and the cord */
.tab {
  font: 900 1.02rem/1 var(--f-cond); letter-spacing: .09em; text-transform: uppercase; text-decoration: none;
  padding: .62rem .95rem .5rem; border: var(--line) solid var(--ink); border-bottom: 0; border-radius: 10px 10px 0 0;
  background: var(--paper-lo); position: relative; top: var(--line); transition: transform .12s var(--ease-out), background-color .12s;
}
.tab:hover { background: var(--yellow); color: var(--dark); transform: translateY(-3px); }
.tab[aria-current="page"] { background: var(--paper); z-index: 2; }
.tab[aria-current="page"]::before { content: ""; position: absolute; left: 8px; right: 8px; top: 5px; height: 4px; border-radius: 2px; background: var(--red); }
.mast-rule { border: 0; border-top: var(--line) solid var(--ink); margin: 0; }
/* Below this the wordmark, four tabs and the tools no longer fit on one line, so the tabs take their own row. */
@media (max-width: 760px) {
  .mast { flex-wrap: wrap; padding-top: .8rem; gap: .2rem .6rem; }
  .tabs { width: 100%; margin-left: 0; padding-right: 0; }
  .tab { flex: 1; text-align: center; padding: .55rem .2rem .45rem; font-size: .9rem; letter-spacing: .05em; }
}

/* sound toggle + the light cord */
.tools { position: absolute; right: 1.25rem; top: 0; display: flex; align-items: flex-start; gap: .7rem; z-index: 30; }
.snd { margin-top: .85rem; width: 2.3rem; height: 2.3rem; border: var(--line) solid var(--ink); border-radius: 50%; background: var(--paper-hi); display: grid; place-items: center; transition: transform .1s; }
.snd:hover { transform: rotate(-12deg) scale(1.06); background: var(--yellow); color: var(--dark); }
.snd svg { width: 1.15rem; height: 1.15rem; }
.snd[aria-pressed="false"] .snd-on { display: none; }
.snd[aria-pressed="true"] .snd-off { display: none; }
.cord { --pull: 0px; width: 1.6rem; display: flex; flex-direction: column; align-items: center; touch-action: none; cursor: grab; position: relative; }
.cord::after { content: ""; position: absolute; inset: 0 -.55rem -.5rem; }     /* easier to catch with a thumb */
.cord:active { cursor: grabbing; }
.cord-line { width: 2px; height: calc(2.3rem + var(--pull)); background: var(--ink); }
.cord-knob { width: 1.05rem; height: 1.45rem; border: var(--line) solid var(--ink); border-radius: 40% 40% 50% 50%; background: var(--yellow); transition: background-color .2s; }
.cord:hover .cord-knob { background: var(--red); }
.cord.back .cord-line { transition: height .45s var(--ease-thud); }
[data-theme="night"] .cord-knob { box-shadow: 0 0 18px 4px color-mix(in srgb, var(--yellow) 55%, transparent); }

/* ---------- buttons: chunky blocks you press like a stamp ---------- */
.btn {
  --bg: var(--yellow); --fg: var(--dark);
  display: inline-flex; align-items: center; justify-content: center; gap: .55em;
  font: 900 1.25rem/1 var(--f-cond); letter-spacing: .07em; text-transform: uppercase; text-decoration: none;
  padding: .78em 1.15em .68em; color: var(--fg); background: var(--bg);
  border: var(--line) solid var(--ink); border-radius: 4px; box-shadow: var(--shadow);
  transition: transform .07s ease-out, box-shadow .07s ease-out; user-select: none; -webkit-tap-highlight-color: transparent;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 6px 6px 0 var(--ink); }
.btn:active { transform: translate(4px, 4px); box-shadow: 1px 1px 0 var(--ink); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.red { --bg: var(--red); --fg: var(--light); }
.btn.blue { --bg: var(--blue); --fg: var(--light); }
.btn.pink { --bg: var(--pink); }
.btn.inkbtn { --bg: var(--ink); --fg: var(--paper); }
.btn.plain { --bg: var(--paper-hi); --fg: var(--ink); }
.btn.sm { font-size: 1rem; padding: .6em .85em .5em; box-shadow: 3px 3px 0 var(--ink); }
.btn.big { font-size: clamp(1.5rem, 4.4vw, 2rem); padding: .7em 1.1em .6em; box-shadow: var(--shadow-lg); }
.btn.big:hover { box-shadow: 10px 10px 0 var(--ink); }
.btn.big:active { transform: translate(7px, 7px); box-shadow: 2px 2px 0 var(--ink); }
.link { font: 700 .95rem var(--f-cond); letter-spacing: .1em; text-transform: uppercase; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.link:hover { color: var(--red); }
/* Small text links get a thumb-sized target without moving anything on the page. */
.link, .foot a, .board-foot a { position: relative; }
.link::after, .foot a::after, .board-foot a::after { content: ""; position: absolute; inset: -.75rem -.3rem; }

/* ---------- sheets, slips, tape, stamps, tickets ---------- */
.sheet { background: var(--paper-hi); border: var(--line) solid var(--ink); box-shadow: var(--shadow); position: relative; }
.slip { background: var(--paper-hi); border: 2px solid var(--ink); padding: .9rem 1.1rem; position: relative; }
.tape { position: absolute; width: 5.2rem; height: 1.5rem; background: color-mix(in srgb, var(--yellow) 72%, transparent); mix-blend-mode: var(--blend); transform: rotate(-4deg); top: -.8rem; left: 50%; margin-left: -2.6rem; pointer-events: none; }
.tape.r { transform: rotate(5deg); left: auto; right: 1.2rem; margin: 0; }
.tape.l { transform: rotate(-7deg); left: 1.2rem; margin: 0; }

.stamp {
  --rot: -7deg;
  display: inline-block; font: 900 1.3rem/1 var(--f-cond); letter-spacing: .1em; text-transform: uppercase; white-space: nowrap;
  color: var(--red); border: 4px solid currentColor; border-radius: 7px; padding: .3em .55em .2em;
  transform: rotate(var(--rot)); filter: url(#inky); mix-blend-mode: var(--blend); opacity: .93;
}
.stamp.blue { color: var(--blue); } .stamp.ink { color: var(--ink); } .stamp.green { color: var(--green); }
.stamp.round { border-radius: 999px; padding: .5em .8em .4em; }
.stamp.thud { animation: thud .36s var(--ease-thud) both; }
@keyframes thud { 0% { transform: rotate(var(--rot)) scale(2.8); opacity: 0; } 60% { opacity: 1; } 100% { transform: rotate(var(--rot)) scale(1); opacity: .93; } }

.shake { animation: shake .28s linear; }
@keyframes shake { 20% { transform: translate(-4px, 2px) rotate(-.4deg); } 40% { transform: translate(4px, -2px) rotate(.4deg); } 60% { transform: translate(-3px, -1px); } 80% { transform: translate(2px, 1px); } }

.pill { display: inline-block; font: 900 .78rem/1 var(--f-cond); letter-spacing: .14em; text-transform: uppercase; padding: .35em .6em .25em; border: 2px solid var(--ink); border-radius: 999px; background: var(--paper-hi); white-space: nowrap; }
.pill.y { background: var(--yellow); color: var(--dark); } .pill.r { background: var(--red); color: var(--light); }
.pill.b { background: var(--blue); color: var(--light); } .pill.p { background: var(--pink); color: var(--dark); }
.pill.k { background: var(--ink); color: var(--paper); }

.halftone { background-image: radial-gradient(circle, currentColor 0 1.5px, transparent 1.7px); background-size: 8px 8px; }
.stripes { background-image: repeating-linear-gradient(-45deg, currentColor 0 6px, transparent 6px 14px); }

/* printer's crop marks on the corners of a block */
.crop::before, .crop::after { content: ""; position: absolute; width: 18px; height: 18px; pointer-events: none; opacity: .55; }
.crop::before { left: 8px; top: 8px; border-left: 1.5px solid var(--ink); border-top: 1.5px solid var(--ink); }
.crop::after { right: 8px; bottom: 8px; border-right: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink); }

/* ---------- toasts ---------- */
#toasts { position: fixed; left: 0; right: 0; bottom: 1.2rem; z-index: 9500; display: flex; flex-direction: column; align-items: center; gap: .5rem; pointer-events: none; padding: 0 1rem; }
.toast { background: var(--ink); color: var(--paper); font: 400 .98rem/1.3 var(--f-type); padding: .7rem 1rem .6rem; border: 2px solid var(--paper); box-shadow: 4px 4px 0 var(--red); max-width: 30rem; animation: toast-in .25s var(--ease-thud) both; }
.toast.out { animation: toast-out .2s ease-in both; }
@keyframes toast-in { from { transform: translateY(1.4rem) rotate(-1.5deg); opacity: 0; } }
@keyframes toast-out { to { transform: translateY(1rem); opacity: 0; } }

/* ---------- fx layer ---------- */
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 9400; overflow: hidden; }
.fx-dot { position: absolute; width: 10px; height: 10px; border-radius: 50%; background: var(--red); mix-blend-mode: var(--blend); }
.fx-stamp { position: absolute; }
.ink-ring { position: absolute; border: 3px solid var(--ink); border-radius: 6px; pointer-events: none; animation: ink-ring .4s ease-out both; }
@keyframes ink-ring { from { opacity: .5; transform: scale(1); } to { opacity: 0; transform: scale(1.12); } }

/* ---------- screens mount ---------- */
#app { flex: 1; outline: none; }
.screen { animation: sheet-in .34s var(--ease-out) both; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(14px) rotate(.25deg); } }

/* ---------- footer ---------- */
.foot { border-top: var(--line) solid var(--ink); margin-top: 4rem; padding: 1.4rem 0 2rem; font: 400 .82rem/1.5 var(--f-type); color: var(--ink-2); }
.foot .wrap { display: flex; flex-wrap: wrap; gap: .4rem 1.6rem; justify-content: space-between; }
.foot a { text-decoration: underline; }

/* ---------- play mode: everything but the round goes away ---------- */
body[data-mode="play"] .wire, body[data-mode="play"] .tabs, body[data-mode="play"] .foot, body[data-mode="play"] .mast-club { display: none; }
body[data-mode="play"] .mast { padding-top: .7rem; }
body[data-mode="play"] .mast .wm { font-size: 1.25rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .boil { animation: none; filter: url(#rough); }
}

@media (max-width: 760px) {
  .tools { right: .9rem; gap: .5rem; }
  .cord-line { height: calc(1.1rem + var(--pull)); }
  .snd { margin-top: .55rem; }
}
