/* Kaagaz /play — the game stylesheet.
   Design intent: the game is played with the app's own materials. Every piece
   below is a real component of the page (not a picture of one), so the concept
   boards and the shipped page share one stylesheet and cannot drift.

   The file has two layers:
     1. THE GAME KIT — the desk, the paper, the folders, the clock, the score and
        the one button. Used verbatim by kaagaz.net/play and by the boards.
     2. THE PAGE — the small amount of glue the shipped page needs on top: a card
        that is a real button, the round's states, and the type the page adds.

   Tokens come from home.css (cobalt accent, cool greys, five category washes).
   Shape rule follows home.css: cards and frames 24px, papers and rows 14px,
   chips and buttons full pill. */

/* ==========================================================================
   THE DESK — the one play surface all four acts sit on
   ========================================================================== */
.desk {
  position: relative;
  border-radius: 32px;
  background: var(--card);
  border: 1px solid var(--hair);
  box-shadow: var(--shadow);
  padding: 28px;
  overflow: hidden;
  isolation: isolate;
}
/* Paper grain. A static background image, not a filter, so it costs nothing to
   paint and never touches a scrolling container. */
.desk::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: .035;
  pointer-events: none;
}
.desk-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.desk-title { font-weight: 700; font-size: 1.05rem; }
.desk-note { color: var(--faint); font-size: .92rem; }

/* ==========================================================================
   THE PAPER — the unit of the game
   ========================================================================== */
.paper {
  --pw: 172px;
  --rot: 0deg;
  --tint: var(--hair);
  --tint-ink: var(--muted);
  position: relative;
  width: var(--pw);
  flex: none;
  aspect-ratio: 3 / 4;
  padding: 14px 14px 12px;
  background: var(--card);
  border: 1px solid var(--hair);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgb(14 16 20 / .05), 0 14px 26px -16px rgb(28 47 176 / .45);
  transform: rotate(var(--rot));
  display: flex;
  flex-direction: column;
  gap: 8px;
  /* A paper is a fixed-format token: it truncates like a real app thumbnail
     rather than growing or spilling. */
  overflow: hidden;
  transition: transform .45s var(--ease), box-shadow .45s var(--ease), opacity .3s;
}
/* A faint ruled surface, so a token reads as a sheet of paper. */
.paper::before {
  content: "";
  position: absolute;
  inset: 44px 12px 34px;
  background-image: repeating-linear-gradient(
    to bottom,
    var(--hair) 0 1px,
    transparent 1px 12px
  );
  opacity: .5;
  pointer-events: none;
}
.paper > * { position: relative; }

.paper .p-top { display: flex; align-items: flex-start; gap: 8px; }
.paper .p-chip {
  width: 30px; height: 30px; flex: none;
  border-radius: 9px;
  display: grid; place-items: center;
  font-size: 17px;
  background: var(--tint);
  color: var(--tint-ink);
}
.paper .p-kind {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--tint-ink);
  text-transform: none;
  padding-top: 2px;
}
.paper .p-name {
  margin-top: auto;
  font-size: .94rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.paper .p-meta {
  font-family: var(--mono);
  font-size: .74rem;
  color: var(--muted);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.paper .p-tick {
  position: absolute;
  top: 12px; right: 12px;
  font-size: 15px;
  color: var(--ink-green);
  opacity: 0;
  transform: scale(.6);
  transition: opacity .3s, transform .4s var(--ease);
}

/* Before the app has read it: a camera file name, nothing else. */
.paper.raw .p-name {
  font-family: var(--mono);
  font-size: .76rem;
  font-weight: 500;
  color: var(--faint);
}
.paper.raw .p-chip { background: var(--ground); color: var(--outline); }
.paper.raw .p-kind { color: var(--outline); }

/* After it has read it. */
.paper.named .p-tick { opacity: 1; transform: none; }

/* Papers in a heap: overlapped, tilted, quietly stacked. */
.pile { position: relative; }
.pile .paper { position: absolute; }

/* A tiny paper, for the "40 papers behind the answer" texture. */
.paper.mini { --pw: 62px; padding: 0; aspect-ratio: 3 / 4; border-radius: 7px; box-shadow: 0 1px 2px rgb(14 16 20 / .06), 0 8px 16px -12px rgb(28 47 176 / .5); }
.paper.mini::before { inset: 7px; opacity: .35; }

/* While being carried. */
.paper.carried {
  box-shadow: 0 2px 4px rgb(14 16 20 / .06), 0 30px 50px -20px rgb(28 47 176 / .55);
  z-index: 5;
}
/* The one the app has just pulled out of the pile. */
.paper.found {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash), 0 30px 50px -20px rgb(28 47 176 / .5);
}

/* --------------------------------------------------------------------------
   CATEGORY COLOUR ON THE TOKEN ITSELF
   home.css defines .t-purple/.t-blue/… as background+colour pairs, which is
   right for an avatar but wrong for a paper: .paper already owns `background`,
   and .paper's own `--tint`/`--tint-ink` defaults are what the chip and label
   read. So the tint classes have to be re-mapped to the custom properties the
   paper actually consumes, or every paper renders grey.
   -------------------------------------------------------------------------- */
.home.t-purple, .paper.t-purple, .folder.t-purple, .solverow.t-purple { --tint: var(--wash-purple); --tint-ink: var(--ink-purple); }
.home.t-blue,   .paper.t-blue,   .folder.t-blue,   .solverow.t-blue   { --tint: var(--wash-blue);   --tint-ink: var(--ink-blue); }
.home.t-green,  .paper.t-green,  .folder.t-green,  .solverow.t-green  { --tint: var(--wash-green);  --tint-ink: var(--ink-green); }
.home.t-pink,   .paper.t-pink,   .folder.t-pink,   .solverow.t-pink   { --tint: var(--wash-pink);   --tint-ink: var(--ink-pink); }
.home.t-amber,  .paper.t-amber,  .folder.t-amber,  .solverow.t-amber  { --tint: var(--wash-amber);  --tint-ink: var(--ink-amber); }
.home.t-teal,   .paper.t-teal,   .folder.t-teal,   .solverow.t-teal   { --tint: var(--wash-teal);   --tint-ink: var(--ink-teal); }

/* A named paper carries its home on its edge, so a misfiled one is spottable
   from across the desk without anybody having to say the word "wrong". */
.paper.named { border-top: 3px solid var(--tint-ink); }

/* A mini paper is a colour swatch of its home: that is how a folder stack
   reads at a glance. */
.paper.mini.named { background: var(--tint); border-color: transparent; border-top-width: 0; }

/* ==========================================================================
   THE HOMES — the atlas types a paper can belong to
   ========================================================================== */
.homes { display: flex; flex-wrap: wrap; gap: 10px; }
.home {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px 10px 12px;
  border-radius: 999px;
  background: var(--card);
  border: 1.5px solid var(--hair);
  font-weight: 600;
  font-size: .92rem;
  white-space: nowrap;
}
.home i { font-size: 18px; color: var(--tint-ink, var(--muted)); }
.home .hi { font-weight: 500; color: var(--muted); }
.home.over { border-color: var(--accent); background: var(--accent-wash); }
.home.filled { border-style: solid; border-color: transparent; background: var(--tint); color: var(--tint-ink); }
.home.filled .hi { color: var(--tint-ink); opacity: .75; }
.home.filled i { color: var(--tint-ink); }

/* ==========================================================================
   THE CHAPTER RAIL — four rounds, one game
   ========================================================================== */
.rail { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.rail li {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 18px 8px 8px;
  border-radius: 999px;
  background: var(--card);
  border: 1.5px solid var(--hair);
  font-weight: 600;
  font-size: .92rem;
  color: var(--muted);
}
.rail .n {
  width: 28px; height: 28px; flex: none;
  border-radius: 999px;
  display: grid; place-items: center;
  background: var(--ground);
  font-family: var(--mono);
  font-size: .82rem;
  color: var(--faint);
}
.rail li.done { color: var(--ink); }
.rail li.done .n { background: var(--wash-green); color: var(--ink-green); }
.rail li.now { color: var(--ink); border-color: var(--accent); background: var(--accent-wash); }
.rail li.now .n { background: var(--accent); color: var(--on-accent); }

/* ==========================================================================
   ACT 1 — the drop line
   ========================================================================== */
.dropstrip {
  display: grid;
  gap: 18px;
  align-items: end;
}
@media (min-width: 860px) { .dropstrip { grid-template-columns: 1fr auto; } }
.drop-slots { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; }
.slot {
  width: 132px;
  min-height: 150px;
  border-radius: 16px;
  border: 1.5px dashed var(--outline);
  background: color-mix(in srgb, var(--card) 60%, transparent);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color .2s, background .2s;
}
.slot.over { border-color: var(--accent); background: var(--accent-wash); }
.slot-head { display: flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 600; }
.slot-head i { font-size: 15px; color: var(--tint-ink); }
.slot-count { margin-top: auto; font-family: var(--mono); font-size: .74rem; color: var(--faint); }

/* Names flipping from file name to real title. */
.flip { perspective: 900px; }
.flip span { display: block; transition: transform .5s var(--ease), opacity .3s; }
.flip .after { position: absolute; inset: 0; opacity: 0; transform: rotateX(-90deg); }
.flip.done span { transform: rotateX(90deg); opacity: 0; }
.flip.done .after { transform: none; opacity: 1; }

/* ==========================================================================
   THE TALLY — the running "here is what that was worth" counter
   ========================================================================== */
.tally { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; margin: 0; padding: 0; }
.tally li {
  display: flex; align-items: baseline; gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--ground);
  border: 1px solid var(--hair);
  font-size: .9rem;
  color: var(--muted);
}
.tally b { font-family: var(--mono); font-size: 1.15rem; color: var(--ink); font-weight: 600; }
.tally li[data-zero] { opacity: .55; }

/* ==========================================================================
   ACT 2 — the question bar (mirrors the app's Ask field)
   ========================================================================== */
.askbar {
  display: flex; align-items: center; gap: 10px;
  background: var(--card);
  border: 1.5px solid var(--hair);
  border-radius: 999px;
  padding: 12px 18px;
  box-shadow: var(--shadow);
}
.askbar i { font-size: 19px; color: var(--accent); flex: none; }
.askbar .q { flex: 1; font-weight: 500; }
.askbar .q.typed::after {
  content: ""; display: inline-block;
  width: 2px; height: 1.05em; margin-left: 3px; vertical-align: -3px;
  background: var(--accent);
  animation: k-blink 1.1s steps(2) infinite;
}
@keyframes k-blink { 50% { opacity: 0; } }

/* Answer bubbles, borrowed wholesale from home.css so the game and the real
   Ask screen are visibly the same object. */
.k-answer { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.k-answer .k-q {
  align-self: flex-end;
  background: var(--accent); color: var(--on-accent);
  padding: 10px 16px; border-radius: 18px 18px 4px 18px;
  max-width: 85%; font-weight: 500;
}
.k-answer .k-a {
  background: var(--ground); color: var(--ink);
  padding: 12px 16px; border-radius: 18px 18px 18px 4px;
  max-width: 92%;
}
.k-answer .k-a .mono { font-weight: 600; }

/* ==========================================================================
   ACT 3 — the date ruler and the nudge ladder
   ========================================================================== */
.ruler {
  position: relative;
  height: 210px;
  border-radius: 20px;
  background: var(--ground);
  border: 1px solid var(--hair);
  overflow: hidden;
}
.ruler .tick { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--hair); }
.ruler .tick.today { width: 2px; background: var(--amber); }
.ruler .tick-cap {
  position: absolute; top: 12px;
  font-family: var(--mono); font-size: .72rem; color: var(--faint);
}
.ruler .tick-cap.today { color: var(--amber); font-weight: 600; }
.rider { position: absolute; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.rider .paper { --pw: 74px; padding: 8px; gap: 4px; border-radius: 9px; }
.rider .paper::before { display: none; }
.rider .paper .p-name { font-size: .52rem; line-height: 1.15; }
.rider .paper .p-chip { width: 18px; height: 18px; font-size: 11px; border-radius: 5px; }
.rider .paper .p-meta { font-size: .5rem; }
.rider .when { font-family: var(--mono); font-size: .72rem; font-weight: 600; color: var(--amber); }
.rider.late .when { color: var(--ink-pink); }
.rider.late .paper { border-color: var(--ink-pink); }

/* ==========================================================================
   ACT 4 — sharing, and the warning
   ========================================================================== */
.k-warn {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--wash-amber);
  border-radius: 18px;
  padding: 18px;
  color: var(--ink);
}
.k-warn i { font-size: 24px; color: var(--ink-amber); flex: none; }
.k-warn b { display: block; font-size: 1.05rem; }
.k-warn p { color: var(--ink); opacity: .82; font-size: .95rem; }
.k-warn.plain { background: var(--wash-green); }
.k-warn.plain i { color: var(--ink-green); }

.stamp {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1.5px solid var(--accent);
  color: var(--accent);
  border-radius: 8px;
  padding: 6px 12px;
  font-family: var(--mono);
  font-size: .78rem;
  transform: rotate(-4deg);
  background: color-mix(in srgb, var(--accent-wash) 70%, transparent);
}

/* ==========================================================================
   ACT 1 — the buckets, the same 12 papers grouped two ways
   ========================================================================== */
.buckets { display: grid; gap: 10px; }
.buckets.kind { grid-template-columns: repeat(6, 1fr); }
.buckets.person { grid-template-columns: repeat(4, 1fr); }
.bucket {
  background: var(--ground);
  border-radius: 14px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-height: 158px;
}
.b-head { display: flex; align-items: flex-start; gap: 6px; }
.b-head i { font-size: 16px; margin-top: 1px; }
.b-head span { display: flex; flex-direction: column; line-height: 1.15; font-weight: 700; font-size: .78rem; }
.b-head small { font-weight: 500; color: var(--muted); font-size: .68rem; }
.b-head .pa { width: 26px; height: 26px; font-size: 12px; }
.b-item { border-top: 1px solid var(--hair); padding-top: 6px; font-size: .76rem; font-weight: 600; line-height: 1.25; }
.b-item span { display: block; font-family: var(--mono); font-size: .66rem; font-weight: 500; color: var(--muted); letter-spacing: -0.01em; }
.b-count { margin-top: auto; font-family: var(--mono); font-size: .68rem; color: var(--faint); }

/* The drag itself: a paper in the air with a target underneath. */
.dragline { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--accent); }
.dragline i { font-size: 22px; }

/* ==========================================================================
   THE ROUND — twenty seconds, twenty-four papers, four folders
   The whole game is one round in four beats: sort it, read the score, press
   the button, then ask. Everything below serves one of those four beats.
   ========================================================================== */

/* The clock. Monospace, because a countdown is a fact, not a mood. */
.clock { display: flex; align-items: center; gap: 16px; }
.clock b {
  font-family: var(--mono); font-weight: 600;
  font-size: 2.6rem; line-height: 1; letter-spacing: -0.04em;
}
.clock .unit { font-size: .84rem; color: var(--muted); }
.clockbar {
  flex: 1; height: 12px; border-radius: 999px;
  background: var(--ground); border: 1px solid var(--hair);
  position: relative; overflow: hidden;
}
.clockbar span {
  position: absolute; top: 0; bottom: 0; left: 0;
  border-radius: 999px; background: var(--accent);
}
/* Under five seconds the clock turns amber. No flashing, no shaking, no
   sound: it is information, not a threat. */
.clock.low b { color: var(--ink-amber); }
.clock.low .clockbar span { background: var(--ink-amber); }

/* The running count of what you have got in. */
.count { display: flex; align-items: baseline; gap: 10px; }
.count b { font-family: var(--mono); font-size: 2rem; font-weight: 600; letter-spacing: -0.03em; line-height: 1; }
.count span { color: var(--muted); font-size: .92rem; }

/* The four folders. A folder is a place a paper goes, not a button you press,
   so it is drawn as a drop target and it holds what you have put in it. */
.rack { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.folder {
  display: flex; flex-direction: column; gap: 10px;
  min-height: 186px; padding: 12px;
  border-radius: 16px;
  border: 1.5px dashed var(--outline);
  background: color-mix(in srgb, var(--card) 62%, transparent);
  transition: border-color .2s, background .2s;
}
.folder.over { border-color: var(--accent); background: var(--accent-wash); }
.folder-head { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: .88rem; }
.folder-head i { font-size: 17px; color: var(--tint-ink, var(--muted)); }
.folder .stack { display: flex; flex-wrap: wrap; gap: 7px; }
.folder-count { margin-top: auto; font-family: var(--mono); font-size: .72rem; color: var(--faint); }

/* The tray: the papers that are still coming. */
.tray { display: flex; flex-wrap: wrap; gap: 10px; align-content: flex-start; }
.tray-cap { width: 100%; display: flex; align-items: center; gap: 10px; }

/* ==========================================================================
   THE SCORE — what twenty seconds were worth, told straight
   ========================================================================== */
.scorelead { font-size: 1.28rem; font-weight: 700; letter-spacing: -0.02em; }
.scorelead .huge {
  font-family: var(--mono); font-size: 3.4rem; font-weight: 600;
  letter-spacing: -0.05em; line-height: 1;
}
.scores { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.scores li {
  display: flex; align-items: baseline; gap: 14px;
  padding: 13px 18px; border-radius: 14px;
  background: var(--ground); border: 1px solid var(--hair);
}
.scores .n { font-family: var(--mono); font-size: 1.25rem; font-weight: 600; min-width: 2.4ch; }
.scores li.landed .n { color: var(--ink-green); }
.scores li.misfiled .n { color: var(--ink-amber); }
.scores li.left .n { color: var(--faint); }
.scores .what { color: var(--muted); }
.scores .eg { display: block; font-size: .84rem; color: var(--faint); }
.scores li b { margin-left: auto; font-weight: 600; }

/* ==========================================================================
   THE BUTTON — the one press the whole game is built around
   It has a physical bottom edge, because the promise being sold is that
   pressing it is the easy part.
   ========================================================================== */
.aibtn {
  display: inline-flex; align-items: center; gap: 16px;
  padding: 20px 32px 20px 24px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 1.3rem; font-weight: 700; letter-spacing: -0.01em;
  box-shadow: 0 12px 0 var(--accent-deep), 0 30px 46px -20px var(--accent);
}
.aibtn i { font-size: 30px; }
.aibtn .sub { display: block; font-size: .8rem; font-weight: 500; opacity: .82; letter-spacing: 0; }
.presshint { display: flex; align-items: center; gap: 10px; color: var(--accent); font-weight: 600; }
.presshint i { font-size: 26px; }

/* How long the machine took. The number is the argument. */
.race { display: flex; align-items: baseline; gap: 12px; }
.race b { font-family: var(--mono); font-size: 3.6rem; font-weight: 600; letter-spacing: -0.05em; line-height: 1; }
.race span { color: var(--muted); }

/* Before → after, side by side. */
.solvepair { display: grid; grid-template-columns: 1fr 40px 1fr; gap: 14px; align-items: center; }
.solvepair .arrow { color: var(--faint); font-size: 26px; text-align: center; }
.solvebox {
  border-radius: 18px; border: 1px solid var(--hair);
  background: var(--ground); padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.solvebox .cap {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: .72rem;
  text-transform: uppercase; letter-spacing: .05em; color: var(--faint);
}

/* One folder's worth of contents, compact — for showing 11 → 24 twice. */
.solverows { display: flex; flex-direction: column; gap: 6px; }
.solverow {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--hair);
}
.solverow .rname { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: .82rem; width: 98px; flex: none; }
.solverow .rname i { font-size: 15px; color: var(--tint-ink, var(--muted)); }
.solverow .rstk { display: flex; flex-wrap: wrap; gap: 5px; min-width: 0; }
.solverow .rct { margin-left: auto; font-family: var(--mono); font-size: .74rem; color: var(--faint); }

/* ==========================================================================
   Between the acts
   ========================================================================== */
.beat {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 0;
  border-top: 1px solid var(--hair);
  border-bottom: 1px solid var(--hair);
}
.beat i { font-size: 22px; color: var(--accent); flex: none; }
.beat p { font-size: 1.06rem; font-weight: 600; letter-spacing: -0.01em; }
.beat small { display: block; color: var(--muted); font-weight: 400; font-size: .92rem; }

/* ==========================================================================
   2. THE PAGE — everything below is the shipped page only. It is scoped to
   .playpage so the boards, which load this same file, are untouched.
   ========================================================================== */

/* A card that is a real control. Everything in the game is a button, so the
   whole round is reachable by Tab and playable without a drag. */
button.paper, button.folder, button.home, button.aibtn {
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
button.paper { -webkit-appearance: none; appearance: none; }
button.home { align-items: center; }
button.home:hover { border-color: var(--outline); }
button.aibtn { border: 0; }
button.aibtn:hover {
  box-shadow: 0 14px 0 var(--accent-deep), 0 34px 50px -20px var(--accent);
  transform: translateY(-2px);
}
button.aibtn:active {
  box-shadow: 0 4px 0 var(--accent-deep), 0 18px 30px -20px var(--accent);
  transform: translateY(8px);
}
.aibtn:disabled { opacity: .55; cursor: default; }

/* The paper you are carrying, and the folders that will take it. */
.paper.held {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash), 0 18px 30px -18px var(--accent);
  transform: translateY(-3px);
}
.folder.armed { border-color: var(--accent); background: var(--accent-wash); }
.folder.armed .folder-head i { color: var(--accent); }
.folder:disabled { opacity: .5; cursor: default; }

/* A paper landing in a folder. 24 papers at 30ms apart land inside 0.8s — the
   number on the page is the animation, not a claim about it. */
@keyframes k-land {
  from { opacity: 0; transform: translateY(16px) scale(.8); }
  to   { opacity: 1; transform: none; }
}
.folder.landing .stack .paper.mini {
  animation: k-land .34s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 30ms);
}

.playpage { display: block; }

/* `hidden` has to beat the layout rules below, or a hidden panel keeps its own
   display value and stays on screen. */
[hidden] { display: none !important; }

/* ---------- The round's row of controls ---------- */
.gamerow { display: flex; align-items: center; gap: 16px 22px; flex-wrap: wrap; margin-bottom: 18px; }
.gamerow .clock { flex: 1 1 260px; max-width: 440px; }
.gamerow .count { flex: none; }
.gamerow .gamerow-cta { margin-left: auto; }

/* The tray is the pile: every paper you have not filed yet. */
.playpage .tray .paper { --pw: 5rem; }
.playpage .tray .paper .p-name { font-size: .68rem; -webkit-line-clamp: 3; }
.playpage .tray .paper .p-meta { font-size: .66rem; }
.playpage .tray .paper .p-chip { width: 24px; height: 24px; font-size: 14px; border-radius: 8px; }
.playpage .tray .paper .p-kind { font-size: .64rem; }
.playpage .tray .paper::before { inset: 36px 10px 26px; opacity: .45; }
.playpage .tray-cap { margin-bottom: 4px; justify-content: space-between; }

/* Six papers per folder, small enough to sit in a row. */
.playpage .folder { min-height: 172px; }
.playpage .folder .stack .paper.mini { --pw: 2.4rem; }

.playpage .rack { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 760px) { .playpage .rack { grid-template-columns: repeat(4, 1fr); } }

.playpage .clockbar span { width: 0; }
.playpage .clock.done b { color: var(--faint); }

/* Screen-reader play-by-play. The clock is visible; the round's state changes
   are not, so they are announced here instead of being seen. */
.live {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- The score, and the one button ---------- */
.stage { display: grid; gap: 18px; }
@media (min-width: 900px) { .stage { grid-template-columns: 1fr minmax(300px, 360px); align-items: start; } }
.stage-side { display: flex; flex-direction: column; gap: 14px; }
.playarea {
  border-radius: 20px;
  background: var(--ground);
  border: 1px solid var(--hair);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.playpage .scorelead { font-size: 1.1rem; font-weight: 600; }
.playpage .scorelead .huge { font-size: clamp(2.6rem, 7vw, 3.4rem); }

/* The answer to the press, in the largest type on the page. */
.playpage .race { flex-wrap: wrap; }
.playpage .race b { font-size: clamp(2.4rem, 8vw, 3.6rem); }

/* ---------- Beat 4: the ask ---------- */
.askpanel { display: flex; flex-direction: column; gap: 16px; }
.askpanel .askbar { box-shadow: none; background: var(--ground); }
.askpanel .k-a { min-height: 3em; }

/* A question is a sentence, not a chip label, so these pills wrap. */
.askpanel .home {
  white-space: normal;
  border-radius: 16px;
  padding: 12px 18px 12px 14px;
  line-height: 1.3;
  max-width: 44ch;
}
.askpanel .home i { flex: none; margin-top: 2px; }
.askpanel .home[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-wash); }
.askpanel .k-a.typing::after {
  content: ""; display: inline-block;
  width: 8px; height: 1em; margin-left: 3px; vertical-align: -2px;
  background: var(--accent);
  animation: k-blink 1s steps(2) infinite;
}

/* The line that names the paper you just filed, beside the folder it went into.
   Same colour on both sides = right place. Different colours = you can see it,
   and nobody has said the word "wrong". */
.justfiled {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  min-height: 44px; margin: 16px 0 0;
}
.jf-arrow { color: var(--outline); font-size: 18px; }

/* ---------- Primitives the page shares with the boards ---------- */
.playpage .label {
  font-family: var(--mono); font-size: .74rem; letter-spacing: .05em;
  text-transform: uppercase; color: var(--faint); margin: 0;
}
.playpage .hr { height: 1px; background: var(--hair); }
.playpage .row { display: flex; gap: 22px; align-items: flex-start; }
.playpage .row.wrap { flex-wrap: wrap; }
.playpage .col { display: flex; flex-direction: column; gap: 22px; }
.playpage .grow { flex: 1; min-width: 0; }
.playpage .spacer { margin-top: auto; }
.playpage .hand-note {
  border-left: 3px solid var(--accent);
  padding: 4px 0 4px 16px;
  color: var(--muted); font-size: .95rem; max-width: 78ch; margin: 0;
}
.playpage .hand-note b { color: var(--ink); }

.playpage .legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.playpage .legend li { display: grid; grid-template-columns: 26px 1fr; gap: 12px; font-size: .95rem; }
.playpage .legend .n {
  width: 26px; height: 26px; border-radius: 999px;
  background: var(--accent-wash); color: var(--accent-deep);
  font-family: var(--mono); font-size: .76rem;
  display: grid; place-items: center; font-weight: 600;
}
.playpage .legend b { display: block; }
.playpage .legend span { color: var(--muted); }

.playpage .nrows { display: flex; flex-direction: column; gap: 8px; }
.playpage .nrow {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--hair);
  font-size: .95rem;
}
.playpage .nrow i { font-size: 19px; color: var(--ink-amber); flex: none; }
.playpage .nrow .when { margin-left: auto; font-family: var(--mono); font-size: .82rem; color: var(--ink-amber); font-weight: 600; }
.playpage .nrow.ok i, .playpage .nrow.ok .when { color: var(--ink-green); }
.playpage .nrow.act i { color: var(--accent); }
.playpage .nrow.act .when { color: var(--muted); font-weight: 500; }
button.nrow { font: inherit; color: inherit; text-align: left; cursor: pointer; width: 100%; }
button.nrow:hover { border-color: var(--outline); }

.playpage .proves {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--accent-wash); border-radius: 16px;
  padding: 14px 16px; color: var(--accent-deep);
  font-size: .95rem; font-weight: 600;
}
.playpage .proves i { font-size: 20px; flex: none; margin-top: 1px; }

.playpage .round {
  display: inline-flex; align-items: center; gap: 9px;
  align-self: flex-start;
  font-family: var(--mono); font-size: .72rem; letter-spacing: .04em;
  text-transform: uppercase; color: var(--faint);
}
.playpage .round .n {
  width: 24px; height: 24px; border-radius: 999px;
  background: var(--accent); color: var(--on-accent);
  display: grid; place-items: center; font-size: .74rem;
}

.playpage .rawpair { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.playpage .rawpair .arrow { color: var(--faint); font-size: 22px; }

.playpage .bento { display: grid; grid-template-columns: 1fr; gap: 18px; margin-top: 40px; }
@media (min-width: 720px) { .playpage .bento { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .playpage .bento { grid-template-columns: repeat(3, 1fr); gap: 20px; } }
.playpage .bcell {
  background: var(--card);
  border: 1px solid var(--hair);
  border-radius: 24px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow);
}
.playpage .bcell.tint { background: var(--ground); box-shadow: none; }
.playpage .bcell .btitle { font-size: 1.24rem; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.playpage .bcell p { color: var(--muted); font-size: .95rem; }
.playpage .bcell p b { color: var(--ink); }
@media (min-width: 720px) { .playpage .bcell.span2, .playpage .bcell.span3 { grid-column: span 2; } }
@media (min-width: 1000px) {
  .playpage .bcell.span3 { grid-column: span 3; }
  .playpage .bcell.tall { grid-row: span 2; }
}
.playpage .bcell .inner3 { display: grid; gap: 22px; }
@media (min-width: 720px) { .playpage .bcell .inner3 { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1000px) { .playpage .bcell .inner3 { grid-template-columns: 1.05fr 1fr 1fr; } }
.playpage .bcell .inner3 > div { display: flex; flex-direction: column; gap: 12px; }

/* The blue note, used once: the clock's own verdict. */
.playpage .k-warn.info { background: var(--wash-blue); }
.playpage .k-warn.info i, .playpage .k-warn.info b { color: var(--ink-blue); }

/* ---------- Page furniture ---------- */
.play .hero-visual .desk { width: 100%; max-width: 560px; padding: 22px; }
/* The pile gets the same room as the copy: it is the argument, not decoration. */
@media (min-width: 900px) { .playpage .hero-grid { grid-template-columns: 1fr 1fr; } }
.playpage .hero .lead { max-width: 40ch; }
.hero-pile { position: relative; width: 100%; height: 262px; }
.hero-pile .paper { --pw: 5.6rem; position: absolute; }
.play-note { max-width: 62ch; }

/* Copying the number is the one thing here that touches the clipboard, so it
   says so out loud and then gets out of the way. */
.play-toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 60;
  transform: translate(-50%, 20px);
  background: var(--ink); color: var(--raised);
  padding: 12px 22px; border-radius: 999px;
  font-size: .92rem; font-weight: 600;
  box-shadow: 0 20px 40px -18px rgb(14 16 20 / .5);
  opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s;
}
.play-toast.show { opacity: 1; transform: translate(-50%, 0); }

.play .section + .section { border-top: 1px solid var(--hair); }

@media (max-width: 560px) {
  .desk { padding: 16px; border-radius: 24px; }
  .gamerow { gap: 12px 16px; }
  .gamerow .clock { flex-basis: 100%; max-width: none; }
  .gamerow .gamerow-cta { margin-left: 0; width: 100%; }
  .playarea { padding: 14px; }
}

/* ==========================================================================
   Reduced motion: the game still plays, it just stops performing
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .paper, .paper .p-tick, .flip span { transition-duration: .01ms !important; }
  .askbar .q.typed::after { animation: none; }
  .folder.landing .stack .paper.mini { animation: none !important; opacity: 1; }
  .askpanel .k-a.typing::after { animation: none; }
  button.aibtn:hover, button.aibtn:active { transform: none; }
}

/* ==========================================================================
   3. PREMIUM VISUAL LAYER — desk texture, paper grain, atmospheric shadows
   These are the things that make it feel hand-crafted, not templated.
   ========================================================================== */

/* The desk: warm paper grain, subtle vignette, feels like a real surface */
.playpage .desk {
  position: relative;
  background:
    radial-gradient(ellipse at center, transparent 40%, rgba(14,16,20,.06) 100%),
    linear-gradient(180deg, var(--ground) 0%, color-mix(in srgb, var(--ground) 94%, var(--ink) 6%) 100%);
}
.playpage .desk::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(43,68,224,.03) 0 80px, transparent 120px),
    radial-gradient(circle at 80% 70%, rgba(255,200,100,.02) 0 100px, transparent 160px),
    url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.015'/%3E%3C/svg%3E");
  pointer-events: none;
  border-radius: inherit;
  opacity: .6;
}

/* Paper cards: real paper feel — subtle grain, ink texture, lifted shadow */
.playpage .paper {
  background:
    linear-gradient(180deg, rgba(255,255,255,.95) 0%, rgba(245,246,248,.9) 100%),
    url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.2' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)' opacity='.012'/%3E%3C/svg%3E");
  box-shadow:
    0 1px 2px rgba(14,16,20,.06),
    0 4px 12px -6px rgba(14,16,20,.12),
    0 0 0 1px rgba(14,16,20,.03);
  transition: transform .3s cubic-bezier(.2,.6,.2,1), box-shadow .3s cubic-bezier(.2,.6,.2,1), opacity .2s;
}
.playpage .paper:hover {
  transform: translateY(-2px);
  box-shadow:
    0 4px 16px -4px rgba(14,16,20,.15),
    0 8px 24px -8px rgba(14,16,20,.1),
    0 0 0 1px rgba(14,16,20,.04);
}
.playpage .paper.held {
  transform: translateY(-4px) scale(1.01);
  box-shadow:
    0 0 0 3px var(--accent-wash),
    0 12px 32px -8px var(--accent),
    0 0 0 1px var(--accent);
  z-index: 10;
}
.playpage .paper .p-hint {
  display: block;
  font-size: .68rem;
  color: var(--muted);
  font-style: italic;
  line-height: 1.3;
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px dashed var(--hair);
}

/* Folder: leather/manila feel, magnetic glow when armed */
.playpage .folder {
  background:
    linear-gradient(180deg, rgba(255,255,255,.7) 0%, rgba(242,243,245,.85) 100%),
    url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='fg'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23fg)' opacity='.01'/%3E%3C/svg%3E");
  border: 1px solid var(--hair);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.4),
    0 2px 8px -2px rgba(14,16,20,.06),
    0 0 0 1px rgba(14,16,20,.02);
  transition: all .25s cubic-bezier(.2,.6,.2,1);
}
.playpage .folder.armed {
  background:
    linear-gradient(180deg, var(--accent-wash) 0%, color-mix(in srgb, var(--accent-wash) 85%, transparent) 100%);
  border-color: var(--accent);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.3),
    0 0 0 2px var(--accent-wash),
    0 8px 32px -8px var(--accent),
    0 0 0 1px var(--accent);
}
.playpage .folder.landing .stack {
  background: radial-gradient(ellipse at center, var(--accent-wash) 0%, transparent 70%);
  border-radius: 14px;
  padding: 8px 4px 4px;
  margin: 0 -4px 4px;
}

/* Mini papers landing: magnetic snap, staggered delight */
@keyframes k-land {
  from { opacity: 0; transform: translateY(20px) scale(.75) rotate(-3deg); }
  60% { transform: translateY(-3px) scale(1.05) rotate(1deg); }
  to   { opacity: 1; transform: none; }
}
.playpage .folder.landing .stack .paper.mini {
  animation: k-land .42s cubic-bezier(.2,.7,.2,1) both;
  animation-delay: calc(var(--i, 0) * 30ms);
}
.playpage .folder.landing .stack .paper.mini:nth-child(odd) {
  animation-timing-function: cubic-bezier(.2,.8,.2,1);
}

/* Clock bar: physical timer feel */
.playpage .clockbar {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--hair) 0%, color-mix(in srgb, var(--hair) 60%, transparent) 100%);
  box-shadow: inset 0 1px 2px rgba(14,16,20,.08);
  overflow: hidden;
}
.playpage .clockbar span {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) 0%, color-mix(in srgb, var(--accent) 75%, var(--ink)) 100%);
  box-shadow: 0 0 8px var(--accent-wash), inset 0 -1px 2px rgba(0,0,0,.1);
  transition: width .04s linear; /* matches 40ms tick */
}

/* Score list: each row is a card */
.playpage .scores { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.playpage .scores li {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--hair);
  box-shadow: var(--shadow-sm);
  transition: transform .2s, box-shadow .2s;
}
.playpage .scores li:hover { transform: translateX(4px); box-shadow: var(--shadow); }
.playpage .scores .n {
  font-family: var(--mono); font-size: 1.6rem; font-weight: 700;
  color: var(--ink); width: 48px; text-align: right;
}
.playpage .scores .what { flex: 1; font-size: .98rem; color: var(--muted); }
.playpage .scores .what b { color: var(--ink); }
.playpage .scores .eg { display: block; font-size: .78rem; color: var(--faint); margin-top: 3px; }
.playpage .scores .landed .n { color: var(--ink-green); }
.playpage .scores .misfiled .n { color: var(--ink-amber); }
.playpage .scores .left .n { color: var(--faint); }

/* Just filed strip: the colour tell */
.playpage .justfiled .home {
  padding: 8px 14px; border-radius: 999px;
  font-size: .86rem; font-weight: 600;
  box-shadow: 0 2px 8px -2px rgba(14,16,20,.1);
}
.playpage .jf-arrow { color: var(--outline); font-size: 20px; animation: k-arrow-pulse 1.5s ease-in-out infinite; }
@keyframes k-arrow-pulse { 0%,100% { transform: translateX(0); } 50% { transform: translateX(3px); } }

/* Free-text ask input: clean, prominent, inviting */
.playpage .askbar {
  display: flex; align-items: center; gap: 12px;
  background: var(--ground);
  border: 1px solid var(--hair);
  border-radius: 16px;
  padding: 6px 6px 6px 16px;
  box-shadow: var(--shadow-sm);
  transition: border-color .2s, box-shadow .2s;
}
.playpage .askbar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash), var(--shadow);
}
.playpage .askbar .q {
  flex: 1; border: 0; background: transparent;
  font: inherit; font-size: 1.02rem; color: var(--ink);
  padding: 14px 0; outline: none;
  min-width: 0;
}
.playpage .askbar .q::placeholder { color: var(--faint); }
.playpage .askbar button.icon-btn {
  flex: none; width: 48px; height: 48px; border-radius: 12px;
  background: var(--accent); color: var(--on-accent);
  display: grid; place-items: center;
  transition: transform .15s, box-shadow .15s, background .15s;
}
.playpage .askbar button.icon-btn:hover { transform: scale(1.05); box-shadow: 0 6px 20px -4px var(--accent); }
.playpage .askbar button.icon-btn:active { transform: scale(.98); }

/* Suggestion chips: pill buttons that wrap nicely */
.playpage .suggestions {
  display: flex; flex-wrap: wrap; gap: 10px;
  padding: 4px 0;
}
.playpage .suggestion {
  border: 1px solid var(--hair);
  background: var(--ground);
  color: var(--ink);
  padding: 10px 16px; border-radius: 999px;
  font-size: .9rem; font-weight: 500;
  cursor: pointer; white-space: nowrap;
  transition: all .18s cubic-bezier(.2,.6,.2,1);
}
.playpage .suggestion:hover {
  border-color: var(--accent);
  background: var(--accent-wash);
  color: var(--accent-deep);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px -4px var(--accent);
}
.playpage .suggestion[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 2px 8px -2px var(--accent);
}

/* Answer panel: the paper it came from, cited */
.playpage .k-answer { display: flex; flex-direction: column; gap: 14px; }
.playpage .k-q { margin: 0; font-size: 1.04rem; font-weight: 600; color: var(--ink); }
.playpage .k-a { margin: 0; font-size: 1rem; line-height: 1.6; color: var(--muted); }
.playpage .k-a b { color: var(--ink); }
.playpage .k-a.typing::after {
  content: ""; display: inline-block;
  width: 8px; height: 1em; margin-left: 3px; vertical-align: -2px;
  background: var(--accent);
  animation: k-blink 1s steps(2) infinite;
}
@keyframes k-blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }
.playpage .ask-cite {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--hair);
  transition: opacity .2s, transform .2s;
}
.playpage .ask-cite { opacity: 0; transform: translateY(8px); }
.playpage .ask-cite.show { opacity: 1; transform: none; transition: opacity .3s cubic-bezier(.2,.6,.2,1), transform .3s cubic-bezier(.2,.6,.2,1); }
.playpage .ask-cite .doc { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.playpage .ask-cite small { color: var(--faint); font-size: .8rem; }

/* Race number: the dramatic count-up */
.playpage .race { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.playpage .race b {
  font-family: var(--mono); font-weight: 700;
  font-size: clamp(2.8rem, 10vw, 4.5rem);
  color: var(--accent);
  line-height: 1;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.playpage .race span { color: var(--muted); font-size: 1.05rem; max-width: 40ch; }

/* CTA row at end */
.playpage .cta-row { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 24px; }
.playpage .cta-row .btn { flex: 1 1 200px; }

/* Hero pile papers: more dramatic, with depth */
.playpage .hero-pile .paper {
  box-shadow:
    0 2px 8px -2px rgba(14,16,20,.15),
    0 8px 24px -8px rgba(14,16,20,.1),
    0 0 0 1px rgba(14,16,20,.04);
}
.playpage .hero-pile .paper.found {
  box-shadow:
    0 0 0 3px var(--accent-wash),
    0 12px 32px -8px var(--accent),
    0 0 0 1px var(--accent);
  z-index: 5;
}

/* Toast: more premium */
.play-toast {
  box-shadow: 0 16px 48px -12px rgba(14,16,20,.35);
  border: 1px solid rgba(255,255,255,.1);
  backdrop-filter: blur(8px);
}

/* Tally area */
.playpage .tally { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 16px; }
.playpage .tally li { text-align: center; padding: 16px; border-radius: 16px; background: var(--ground); border: 1px solid var(--hair); }
.playpage .tally b { display: block; font-size: 2.2rem; font-weight: 700; color: var(--ink); font-family: var(--mono); }
.playpage .tally span { font-size: .8rem; color: var(--faint); text-transform: uppercase; letter-spacing: .04em; }

/* Legend in bento */
.playpage .legend li { display: grid; grid-template-columns: 28px 1fr; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--hair); }
.playpage .legend li:last-child { border-bottom: 0; }
.playpage .legend .n { width: 28px; height: 28px; }

/* Copy button in answer */
.playpage .ask-copy { gap: 10px; }
.playpage .ask-copy .when { font-family: var(--mono); font-size: .72rem; opacity: .7; }

/* ==========================================================================
   CONNECT PANEL — 12 source cards
   ========================================================================== */
.playpage .connect-panel {
  background: var(--ground);
  border: 1px solid var(--hair);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 20px;
}
.playpage .connect-header {
  text-align: center;
  margin-bottom: 20px;
}
.playpage .connect-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 8px;
}
.playpage .connect-sub {
  color: var(--muted);
  font-size: .95rem;
  margin: 0;
}
.playpage .connect-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (min-width: 600px) { .playpage .connect-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .playpage .connect-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1200px) { .playpage .connect-grid { grid-template-columns: repeat(6, 1fr); } }

.playpage .source-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 16px;
  border-radius: 16px;
  background: var(--card);
  border: 2px solid var(--hair);
  cursor: pointer;
  transition: all .2s cubic-bezier(.2,.6,.2,1);
  text-align: left;
}
.playpage .source-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px -8px var(--accent);
}
.playpage .source-card.connected {
  border-color: var(--accent);
  background: var(--accent-wash);
}
.playpage .source-card.connected:hover {
  box-shadow: 0 12px 32px -10px var(--accent);
}
.playpage .source-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: grid; place-items: center;
  font-size: 20px;
  color: var(--tint-ink);
}
.playpage .source-info { display: flex; flex-direction: column; gap: 4px; width: 100%; }
.playpage .source-name { font-weight: 700; font-size: .9rem; color: var(--ink); }
.playpage .source-desc { font-size: .75rem; color: var(--muted); }
.playpage .source-count { font-size: .7rem; color: var(--faint); }
.playpage .source-status {
  margin-top: auto;
  width: 28px; height: 28px;
  border-radius: 999px;
  display: grid; place-items: center;
  background: var(--ground);
  color: var(--muted);
  font-size: 14px;
  transition: all .2s;
}
.playpage .source-card.connected .source-status {
  background: var(--accent);
  color: var(--on-accent);
}
.playpage .connect-status {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--hair);
}
.playpage .connect-status .status-item {
  display: flex; align-items: center; gap: 8px;
  color: var(--ink-green);
  font-weight: 600;
}
.playpage .connect-status .status-item i { font-size: 20px; }

/* ==========================================================================
   GRADE CARD — shown after the round
   ========================================================================== */
.playpage .grade-card {
  border-radius: 18px;
  padding: 20px 24px;
  margin: 16px 0;
  background: var(--card);
  border: 1px solid var(--hair);
  box-shadow: var(--shadow);
}
.playpage .grade-card.ink-green { border-color: var(--ink-green); background: linear-gradient(180deg, var(--wash-green) 0%, var(--card) 100%); }
.playpage .grade-card.ink-blue { border-color: var(--ink-blue); background: linear-gradient(180deg, var(--wash-blue) 0%, var(--card) 100%); }
.playpage .grade-card.ink-amber { border-color: var(--ink-amber); background: linear-gradient(180deg, var(--wash-amber) 0%, var(--card) 100%); }
.playpage .grade-card.ink-pink { border-color: var(--ink-pink); background: linear-gradient(180deg, var(--wash-pink) 0%, var(--card) 100%); }
.playpage .grade-main { display: flex; align-items: center; gap: 16px; }
.playpage .grade-letter {
  font-family: var(--mono); font-size: 4rem; font-weight: 800; line-height: 1;
  letter-spacing: -0.05em;
  color: var(--ink);
}
.playpage .grade-info { display: flex; flex-direction: column; gap: 4px; }
.playpage .grade-label { font-size: 1.1rem; font-weight: 700; color: var(--ink); }
.playpage .grade-detail { font-size: .85rem; color: var(--muted); font-family: var(--mono); }
.playpage .grade-bar { height: 8px; border-radius: 999px; background: var(--hair); margin-top: 16px; overflow: hidden; }
.playpage .grade-fill { height: 100%; border-radius: 999px; background: var(--accent); transition: width .6s cubic-bezier(.2,.6,.2,1); }
.playpage .grade-note { margin: 12px 0 0; font-size: .85rem; color: var(--faint); text-align: center; }

/* ==========================================================================
   SEARCH PANEL — cross-source search
   ========================================================================== */
.playpage .search-panel {
  background: var(--ground);
  border: 1px solid var(--hair);
  border-radius: 20px;
  padding: 24px;
  margin-top: 20px;
}
.playpage .search-header { margin-bottom: 20px; }
.playpage .search-header h3 { font-size: 1.15rem; font-weight: 700; margin: 0 0 6px; }
.playpage .search-sub { color: var(--muted); font-size: .9rem; margin: 0; }
.playpage .connected-sources {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--hair);
}
.playpage .source-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px 8px 10px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--hair);
  font-size: .8rem; font-weight: 600;
  color: var(--tint-ink);
}
.playpage .source-chip i { font-size: 14px; }
.playpage .source-chip-count { font-size: .65rem; opacity: .7; }

.playpage .search-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--card);
  border: 1.5px solid var(--hair);
  border-radius: 16px;
  padding: 6px 6px 6px 16px;
  margin-bottom: 16px;
  transition: border-color .2s, box-shadow .2s;
}
.playpage .search-bar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash), var(--shadow);
}
.playpage .search-bar i { font-size: 20px; color: var(--accent); flex: none; }
.playpage .search-bar .q {
  flex: 1; border: 0; background: transparent;
  font: inherit; font-size: 1.02rem; color: var(--ink);
  padding: 14px 0; outline: none; min-width: 0;
}
.playpage .search-bar .q::placeholder { color: var(--faint); }
.playpage .search-bar button.icon-btn {
  flex: none; width: 48px; height: 48px; border-radius: 12px;
  background: var(--accent); color: var(--on-accent);
  display: grid; place-items: center;
  transition: transform .15s, box-shadow .15s, background .15s;
}
.playpage .search-bar button.icon-btn:hover { transform: scale(1.05); box-shadow: 0 6px 20px -4px var(--accent); }
.playpage .search-bar button.icon-btn:active { transform: scale(.98); }

.playpage .search-suggestions {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 20px;
}
.playpage .search-suggestions .suggestion {
  border: 1px solid var(--hair);
  background: var(--ground);
  color: var(--ink);
  padding: 10px 16px; border-radius: 999px;
  font-size: .9rem; font-weight: 500;
  cursor: pointer; white-space: nowrap;
  transition: all .18s cubic-bezier(.2,.6,.2,1);
}
.playpage .search-suggestions .suggestion:hover {
  border-color: var(--accent);
  background: var(--accent-wash);
  color: var(--accent-deep);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px -4px var(--accent);
}

.playpage .search-results { display: flex; flex-direction: column; gap: 10px; }
.playpage .search-loading {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 40px; color: var(--muted);
}
.playpage .search-loading i { font-size: 24px; color: var(--accent); animation: k-spin 1s linear infinite; }
@keyframes k-spin { to { transform: rotate(360deg); } }

.playpage .search-empty {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 40px; text-align: center; color: var(--muted);
}
.playpage .search-empty i { font-size: 48px; opacity: .4; }
.playpage .search-empty .hint { font-size: .9rem; max-width: 60ch; }

.playpage .search-result {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--hair);
  transition: transform .2s, box-shadow .2s;
}
.playpage .search-result:hover { transform: translateX(4px); box-shadow: var(--shadow); }
.playpage .result-source {
  font-family: var(--mono); font-size: .65rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--faint); white-space: nowrap; flex: none;
}
.playpage .result-content { display: flex; align-items: flex-start; gap: 10px; flex: 1; min-width: 0; }
.playpage .result-icon {
  width: 36px; height: 36px; flex: none;
  border-radius: 10px; display: grid; place-items: center;
  font-size: 16px; color: var(--tint-ink);
}
.playpage .result-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.playpage .result-title { font-weight: 600; font-size: .95rem; color: var(--ink); }
.playpage .result-snippet { font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.playpage .result-action {
  flex: none; width: 36px; height: 36px; border-radius: 10px;
  background: var(--ground); border: 1px solid var(--hair);
  display: grid; place-items: center; color: var(--muted);
  transition: all .2s;
}
.playpage .result-action:hover { background: var(--accent-wash); border-color: var(--accent); color: var(--accent-deep); }

/* Auto-search demo */
.playpage .search-demo {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--hair);
}
.playpage .demo-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px;
  color: var(--accent); font-weight: 600;
}
.playpage .demo-header i { font-size: 20px; }
.playpage .demo-results { display: flex; flex-direction: column; gap: 10px; }

/* Rail update for 5 steps */
.playpage .rail li { flex: 1 1 auto; }
@media (max-width: 560px) { .playpage .rail li .n { width: 24px; height: 24px; font-size: .7rem; } }
