/* Shared look for applets.co.uk: Countdown-board navy, blue tiles, gridded whiteboard. */

:root {
  --navy: #0a1a45;
  --navy-2: #12265e;
  --frame: #5d8fd8;
  --tile: #1d4fb0;
  --tile-hover: #2862d1;
  --tile-edge: #9cc0ff;
  --target: #0b2c8c;
  --board: #f6f6fa;
  --grid: #d7d9e6;
  --ink: #1b2a6b;
  --muted: #6b7bb5;
  --gold: #f2b705;
  --gold-hover: #ffcf3a;
  --bad: #c0392b;
  --soft: #b9c9ee;

  --heavy: "Archivo Black", "Arial Black", "Helvetica Neue", Arial, sans-serif;
  --body: "Inter", "Segoe UI", system-ui, sans-serif;
  --marker: "Kalam", "Segoe Print", "Comic Sans MS", cursive;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--navy);
  color: white;
  font-family: var(--body);
  line-height: 1.5;
  display: flex;
  flex-direction: column;
}

a { color: var(--tile-edge); }

.wrap {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ── header / footer ─────────────────────────────────────────── */

.site-head {
  padding: 18px 0;
}
.site-head .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand {
  font-family: var(--heavy);
  font-size: 1.35rem;
  color: white;
  text-decoration: none;
  letter-spacing: 0.02em;
}
.brand span { color: var(--gold); }
/* App pages: "applets. / App Name" breadcrumb, the app name is the page's h1. */
.crumbs {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0 10px;
  min-width: 0;
}
.crumbs .sep { color: var(--muted); font-size: 1.2rem; }
.crumbs h1 {
  margin: 0;
  font-family: var(--heavy);
  font-size: 1.35rem;
  font-weight: 400;
  color: white;
  letter-spacing: 0.02em;
  line-height: 1.2;
}
/* :where keeps the specificity of plain .back, so pages' own .back colours still win;
   the header scope stops a card's "back" class (Blackjack, Poker) picking these up */
:where(.site-head) .back {
  color: var(--soft);
  text-decoration: none;
  font-size: 0.95rem;
  white-space: nowrap;
}
@media (max-width: 480px) {
  .crumbs h1 { font-size: 1.1rem; }
  /* on a phone the title and its (i) stay on one line: the back link shrinks to just its arrow
     (its full text stays as the link's name) */
  .crumbs { flex-wrap: nowrap; gap: 0 7px; }
  .site-head .brand { font-size: 1.12rem; }
  .crumbs .sep { font-size: 1rem; }
  .crumbs h1 { font-size: 0.97rem; letter-spacing: 0; }
  .site-head .wrap { gap: 8px; }
  /* a long title takes two lines rather than losing its end to "…" */
  .crumbs { align-items: center; }
  .crumbs h1 { min-width: 0; line-height: 1.15; }
  :where(.site-head) .back { font-size: 0; padding: 9px 4px 9px 12px; margin: -9px -4px -9px 0; }
  :where(.site-head) .back::before { content: "←"; font-size: 1.4rem; line-height: 1; }
}
:where(.site-head) .back:hover { color: white; }

.site-foot {
  margin-top: auto;
  padding: 28px 0;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}
/* footer links (the Discord invite, word-list credits): the footer's own colour, underlined */
.site-foot a { color: inherit; text-underline-offset: 2px; }
.site-foot a:hover, .site-foot a:focus-visible { color: var(--info-accent, var(--gold)); }

/* ── the blue board frame ────────────────────────────────────── */

.board-frame {
  background: var(--frame);
  padding: 14px;
  border-radius: 4px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.target-box {
  display: block;
  margin: 0 auto;
  background: var(--target);
  color: white;
  border: 3px solid var(--tile-edge);
  font-family: var(--heavy);
  text-align: center;
}

.tile {
  background: var(--tile);
  color: white;
  border: 3px solid var(--tile-edge);
  font-family: var(--heavy);
  text-align: center;
}

/* ── gridded whiteboard ──────────────────────────────────────── */

.whiteboard {
  background-color: var(--board);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  border: 4px solid var(--frame);
  color: var(--ink);
  font-family: var(--marker);
}

/* ── buttons ─────────────────────────────────────────────────── */

.btn {
  font-family: var(--heavy);
  font-size: 1rem;
  letter-spacing: 0.04em;
  border: 0;
  padding: 10px 24px;
  cursor: pointer;
  border-radius: 2px;
}
.btn-gold { background: var(--gold); color: var(--navy); }
.btn-gold:hover { background: var(--gold-hover); }
.btn-blue { background: var(--tile); color: white; }
.btn-blue:hover { background: var(--tile-hover); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid white;
  outline-offset: 2px;
}

/* ── "About this app": the (i) button by the title and its overlay ──
   Colours come from the page: --info-bg, --info-fg, --info-muted, --info-accent, --info-edge
   (the defaults are the site's navy and gold). Behaviour is in assets/info.js. */
.info-btn {
  align-self: center;
  flex: none;
  width: 26px;
  height: 26px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  border: 2px solid var(--info-accent, var(--gold));
  background: transparent;
  color: var(--info-accent, var(--gold));
  font: italic 700 0.95rem/1 Georgia, "Times New Roman", serif;
  cursor: pointer;
}
/* a bigger invisible tap area than the 26px circle you see (fingers need ~40px) */
.info-btn { position: relative; }
.info-btn::after { content: ""; position: absolute; inset: -10px; }
.info-btn:hover, .info-btn:focus-visible { background: var(--info-accent, var(--gold)); color: var(--info-bg, var(--navy)); outline: none; }
/* first visit only (assets/info.js): the (i) pulses three times, with a small tag beside it */
.info-btn.story-new { animation: story-pulse 1.3s ease-out 0.6s 3; }
/* keyboard focus on the pulsing (i): stop the pulse (its glow hid the focus) and show a clear ring */
.info-btn.story-new:focus-visible { animation: none; outline: 2px solid var(--info-accent, var(--gold)); outline-offset: 3px; }
@keyframes story-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--info-accent, var(--gold)) 70%, transparent); }
  100% { box-shadow: 0 0 0 12px color-mix(in srgb, var(--info-accent, var(--gold)) 0%, transparent); }
}
.story-tag {
  align-self: center;
  flex: none;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--info-accent, var(--gold));
  color: var(--info-accent, var(--gold));
  font-size: 0.8rem;
  line-height: 1.4;
  white-space: nowrap;
  cursor: pointer;
  animation: story-in 0.4s ease-out both;
}
@keyframes story-in { from { opacity: 0; transform: translateX(-6px); } }
@media (prefers-reduced-motion: reduce) { .info-btn.story-new, .story-tag { animation: none; } }
@media (max-width: 480px) { .story-tag { display: none; } }
dialog.info {
  width: min(660px, calc(100% - 32px));
  max-height: calc(100% - 48px);
  padding: 0;
  border: 1px solid var(--info-edge, var(--frame));
  border-radius: 14px;
  background: var(--info-bg, var(--navy-2));
  color: var(--info-fg, white);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
dialog.info::backdrop { background: rgba(0, 0, 0, 0.6); }
.info-body { position: relative; padding: 22px 24px 20px; }
.info h2 {
  margin: 0 44px 12px 0;
  font-family: var(--heavy);
  font-weight: 400;
  font-size: 1.3rem;
  line-height: 1.25;
  color: var(--info-accent, var(--gold));
}
.info h3 {
  margin: 18px 0 6px;
  font-family: var(--heavy);
  font-weight: 400;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  color: var(--info-muted, var(--soft));
}
.info p, .info li { margin: 0 0 10px; line-height: 1.55; }
.info ul { margin: 0 0 10px; padding-left: 1.2em; }
.info .more li { margin-bottom: 7px; line-height: 1.45; }
.info .more a { color: var(--info-accent, var(--gold)); text-underline-offset: 2px; }
.info .more a:hover, .info .more a:focus-visible { color: var(--info-fg, white); }
/* focus rings inside the About follow the dialog's own colours (white vanished on cream dialogs) */
.info :focus-visible { outline: 3px solid var(--info-accent, var(--info-fg, white)); outline-offset: 2px; }
.info .info-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--info-muted, var(--soft));
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
}
.info .info-close:hover { color: var(--info-fg, white); background: rgba(127, 127, 127, 0.18); }

/* ── auto-pause note (assets/idle.js) ── in the page's About colours, bottom centre */
.idle-note {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 50;
  width: min(560px, calc(100% - 32px));
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--info-edge, var(--frame));
  background: var(--info-bg, var(--navy-2));
  color: var(--info-fg, white);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  font-size: 0.95rem;
  line-height: 1.45;
}
.idle-note b { color: var(--info-accent, var(--gold)); font-family: var(--heavy); font-weight: 400; }

/* ── a result that no longer matches the settings (changed since its run) ── shown faded until RUN */
.stale { opacity: 0.4; transition: opacity 0.2s; }
.stale-note { color: var(--info-accent, var(--gold)); }
