/* Colour Recall: the same frame as Hue Hunt (the strip along the top, a big panel, a side column), on the game's
   site look (app.css + site.css) and demos.css's column. */

/* The game fills the screen: the column (already the body's height less the bar) is a stack of the strip and the
   game, the game takes what's left, and the big panel grows into it. */
.demo-page.rc-page { display: flex; flex-direction: column; padding: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- Along the top: which colour, a pip per colour (its colour once it's out), the total ---------- */
.rc-top { position: sticky; top: 0; z-index: 10; display: flex; align-items: stretch; height: 64px; background: var(--bg); border-bottom: 1px solid var(--line); }
.rc-title { display: flex; align-items: center; flex: none; margin: 0; padding: 0 20px; border-right: 1px solid var(--line); font: 600 16px/1 Geist; letter-spacing: -0.01em; }
.rc-pips { flex: 1; display: flex; align-items: center; gap: 6px; padding: 0 20px; }
.rc-pips i { flex: 1; height: 10px; border-radius: 3px; background: var(--surface-2); }
.rc-pips i.now { background: color-mix(in oklab, var(--text) 45%, var(--surface-2)); }
.rc-total { display: grid; place-items: center; flex: none; min-width: 64px; padding: 0 16px; border-left: 1px solid var(--line); color: var(--text-muted); font: 500 14px/1 var(--mono); font-variant-numeric: tabular-nums; }

/* ---------- The frame ---------- */
.rc-game { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 316px; min-height: 0; }
.rc-stage { display: flex; flex-direction: column; padding: 24px; border-right: 1px solid var(--line); }
.rc-side { padding: 24px; }

/* The big panel: the colour to remember, then yours, then the two side by side. */
.rc-panel { position: relative; flex: 1; min-height: 340px; overflow: hidden; background: var(--surface); }

/* ---------- The start: Design IQ's first screen. One centred column, 560px like its showcase: the title, one line,
   the game playing itself, the levels, Play. Centred in the height the screen has, so a tall one has no gap below. */
/* min-height auto: on a screen shorter than the column, the page scrolls instead of the centred column spilling
   off the top, out of reach. */
.rc-game.home { display: flex; justify-content: center; min-height: auto; }
.rc-home { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; padding: 20px 24px; box-sizing: border-box; text-align: center; }
.rc-name { margin: 0; font: 700 clamp(40px, 11vw, 56px)/1 Geist; letter-spacing: -0.045em; }
.rc-lede { margin: 10px 0 0; color: var(--text-muted); font-size: 16px; line-height: 1.5; text-wrap: balance; }
.rc-show-wrap { width: 100%; max-width: 560px; margin-top: 24px; }
.rc-show-cap { height: 20px; margin: 10px 0 0; color: var(--text-muted); font-size: 14px; line-height: 20px; }
.rc-home .rc-levels { flex: none; width: 100%; max-width: 560px; margin-top: 20px; grid-auto-rows: 50px; }
.rc-home .rc-level { grid-template-columns: 48px minmax(0, 1fr) auto minmax(96px, 30%); }
.rc-home .rc-level .txt { gap: 2px; }
.rc-home .rc-level .txt small { max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.rc-home .rc-go { width: auto; min-width: 200px; margin-top: 20px; }
.rc-home .rc-go .ic { width: 18px; height: 18px; }
/* A laptop's browser is often 650–750px tall: there the showcase is a wider strip and everything sits a bit
   closer, so the first screen still fits without scrolling. */
@media (min-width: 721px) and (max-height: 850px) {
  .rc-name { font-size: 42px; }
  .rc-lede { margin-top: 6px; }
  .rc-show-wrap { margin-top: 16px; }
  .rc-show-wrap .rc-show { aspect-ratio: 560 / 180; }
  .rc-show-cap { margin-top: 8px; }
  .rc-home .rc-levels { margin-top: 14px; grid-auto-rows: 44px; }
  .rc-home .rc-go { margin-top: 16px; }
}

/* The showcase: a round playing itself (recall.js showcase()), the game's own panel, picker and labels in small. */
.rc-show { position: relative; aspect-ratio: 560 / 252; overflow: hidden; container-type: size; border-radius: 16px; background: var(--surface); }
.rc-show .rc-clock { animation: none; transform-origin: left; }
.rc-show-real { position: absolute; inset: 0; }
.rc-show-real .rc-label { left: calc(50% + 16px); }
/* The picker slides in as a small card inside the colour, clear of its edges, so the panel stays one rectangle. */
.rc-mini {
  position: absolute; top: 14px; right: 14px; bottom: 14px; display: flex; flex-direction: column; gap: 9px; width: clamp(120px, 26cqw, 190px);
  box-sizing: border-box; padding: 10px; border-radius: 12px; background: var(--bg); opacity: 0;
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.06), 0 12px 28px -12px rgb(0 0 0 / 0.55);
}
.rc-mini .rc-sb { flex: 1; min-height: 0; aspect-ratio: auto; border-radius: 6px; cursor: default; }
.rc-mini .rc-hue { flex: none; height: 12px; margin: 0 6px; cursor: default; }
.rc-mini .rc-hue::before { inset: 0 -6px; }
.rc-mini .rc-dot { width: 16px; height: 16px; border-width: 2px; }
.rc-mini .rc-mini-done { flex: none; height: 32px; padding: 0 12px; font-size: 13px; pointer-events: none; }
.rc-chip {
  position: absolute; left: 50%; top: 50%; display: inline-flex; align-items: baseline; gap: 3px; padding: 9px 15px; border-radius: 99px;
  background: #fff; color: #0e1012; font: 600 18px/1 Geist; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; opacity: 0;
  box-shadow: 0 8px 22px -8px rgb(0 0 0 / 0.45);
}
.rc-chip span { color: #6b6f76; font-size: 13px; font-weight: 500; }
@container (max-height: 190px) {
  .rc-mini-done { display: none; }
}

/* The levels, as rows of hairline cells, each with five of its colours. */
.rc-levels { flex: 1; display: grid; grid-auto-rows: minmax(76px, 1fr); gap: 1px; border: 1px solid var(--line); background: var(--line); }
.rc-level {
  display: grid; grid-template-columns: 56px minmax(0, 1fr) auto minmax(120px, 38%); align-items: stretch; padding: 0; border: 0; border-radius: 0;
  background: var(--bg); color: var(--text); text-align: left; cursor: pointer; transition: background 0.12s;
}
.rc-level:hover:not(:disabled) { background: var(--surface); }
.rc-level.on { background: var(--surface-2); }
.rc-level > span { display: flex; align-items: center; }
.rc-level .n { justify-content: center; border-right: 1px solid var(--line); color: var(--text-muted); font: 600 16px/1 Geist; }
.rc-level.on .n { background: var(--text); color: var(--bg); }
.rc-level .n .ic { width: 18px; height: 18px; }
.rc-level .txt { flex-direction: column; align-items: flex-start; justify-content: center; gap: 4px; padding: 0 16px; }
.rc-level .txt b { font: 600 16px/1.2 Geist; letter-spacing: -0.01em; }
.rc-level .txt small { color: var(--text-muted); font-size: 13px; line-height: 1.35; }
.rc-level .best { padding: 0 16px; color: var(--text); font: 500 14px/1 var(--mono); }
.rc-level .sw { display: grid; grid-template-columns: repeat(5, 1fr); align-items: stretch; }
.rc-level .sw i { display: block; }
.rc-level:disabled { cursor: default; }
.rc-level.locked .n, .rc-level.locked .txt b { color: var(--text-faint); }
.rc-level.locked .sw { opacity: 0.18; filter: grayscale(1); }
.rc-panel.hatch { display: grid; place-items: center; border: 1px solid var(--line); box-sizing: border-box; background: repeating-linear-gradient(135deg, var(--bg) 0 9px, var(--line) 9px 10px); }
.rc-panel.hatch b { color: var(--text-faint); font: 600 56px/1 Geist; }
/* Three seconds, running out along the bottom. */
.rc-clock { position: absolute; left: 0; bottom: 0; height: 6px; width: 100%; background: rgb(255 255 255 / 0.85); box-shadow: 0 0 0 1px rgb(0 0 0 / 0.15); transform-origin: left; animation: rc-clock linear both; }
@keyframes rc-clock { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.rc-label { position: absolute; left: 16px; bottom: 14px; display: grid; gap: 4px; font: 600 14px/1 Geist; }
.rc-label code { font: 500 12px/1 var(--mono); opacity: 0.75; }
.rc-panel.split { display: grid; grid-template-columns: 1fr 1fr; }
.rc-panel.split > div { position: relative; }
.rc-panel.split .real { animation: rc-wipe 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes rc-wipe { from { clip-path: inset(0 0 0 100%); } to { clip-path: inset(0); } }
/* The end: five columns, the colour over yours, the score between. */
.rc-panel.all { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); box-sizing: border-box; }
.rc-panel.all div { display: grid; grid-template-rows: 1fr auto 1fr; background: var(--bg); }
.rc-panel.all i { position: relative; display: block; }
.rc-panel.all i span { position: absolute; left: 10px; bottom: 10px; font: 600 13px/1 Geist; font-style: normal; white-space: nowrap; }
.rc-panel.all b { padding: 10px 0; text-align: center; font: 600 15px/1 var(--mono); }

/* ---------- The side ---------- */
.rc-copy { display: grid; gap: 14px; }
.rc-copy h2 { margin: 0; font: 600 24px/1.15 Geist; letter-spacing: -0.03em; text-wrap: balance; }
.rc-copy p { margin: 0; color: var(--text-muted); font-size: 14.5px; line-height: 1.5; }
.rc-go { width: 100%; }
.rc-best b { color: var(--text); font-family: var(--mono); font-weight: 500; }
.rc-score { display: flex; align-items: baseline; gap: 6px; }
.rc-copy .rc-score { color: var(--text); }
.rc-score b { font: 600 56px/1 Geist; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.rc-score span { color: var(--text-faint); font: 500 18px/1 Geist; }
.rc-keys { display: grid; gap: 8px; }
.rc-keys .key { width: 100%; }
.rc-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rc-link { justify-self: center; padding: 6px 10px; color: var(--text-muted); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); }
.rc-link:hover { color: var(--text); }

/* The picker: Rive's and Figma's square and hue strip, big, with no numbers. */
.rc-picker { display: grid; gap: 16px; }
.rc-sb {
  position: relative; aspect-ratio: 1; border-radius: 8px; cursor: crosshair; touch-action: none; outline: none;
  background: linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, var(--hue, red));
}
.rc-hue { position: relative; isolation: isolate; height: 16px; margin: 0 8px; border-radius: 99px; cursor: pointer; touch-action: none; outline: none; background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00); }
.rc-hue::before { content: ""; position: absolute; inset: 0 -8px; z-index: -1; border-radius: 99px; background: inherit; }
.rc-dot {
  position: absolute; top: 50%; width: 20px; height: 20px; box-sizing: border-box; border: 2.5px solid #fff; border-radius: 50%; pointer-events: none;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.3), 0 1px 4px rgb(0 0 0 / 0.4); translate: -50% -50%;
}
.rc-sb:focus-visible .rc-dot, .rc-hue:focus-visible .rc-dot { box-shadow: 0 0 0 1px rgb(0 0 0 / 0.3), 0 0 0 4px color-mix(in oklab, var(--ink) 70%, transparent); }

@media (prefers-reduced-motion: reduce) {
  .rc-panel.split .real { animation: none; }
}

/* ---------- Phones: the panel on top, the side under it ---------- */
@media (max-width: 720px) {

  .rc-top { height: 52px; }
  .rc-title { padding: 0 16px; font-size: 15px; }
  .rc-pips { gap: 4px; padding: 0 14px; }
  .rc-total { min-width: 56px; padding: 0 12px; }
  /* One column: the panel takes the height the side leaves. */
  .rc-game { display: flex; flex-direction: column; }
  .rc-stage { flex: 1; }
  .rc-stage { padding: 16px 16px 0; border-right: 0; }
  .rc-side { padding: 16px; }
  .rc-home { flex: 1; padding: 16px; }
  .rc-show-wrap { margin-top: 18px; }
  .rc-home .rc-levels { margin-top: 16px; grid-auto-rows: minmax(50px, auto); }
  .rc-home .rc-level { grid-template-columns: 44px minmax(0, 1fr) auto 64px; }
  .rc-home .rc-level .txt { padding-block: 7px; }
  .rc-home .rc-level .txt small { white-space: normal; }
  .rc-home .rc-go { margin-top: 16px; }
  .rc-panel { min-height: 200px; }
  .rc-levels { grid-auto-rows: minmax(64px, 1fr); }
  .rc-level { grid-template-columns: 44px minmax(0, 1fr) auto 72px; }
  .rc-level .txt { padding: 0 12px; }
  .rc-level .txt b { font-size: 15px; }
  .rc-level .txt small { font-size: 12px; }
  .rc-level .best { padding: 0 10px; font-size: 13px; }
  .rc-copy h2 { font-size: 21px; }
  .rc-score b { font-size: 44px; }
  .rc-picker { gap: 14px; }
  .rc-sb { aspect-ratio: 2 / 1; }
}
