/* Rae's House of Games — one stylesheet, no build step. */

:root {
  /* Colours all live in themes.css — this is just the geometry. */
  --radius: 12px;
}

/* One dial for the whole app: every rem below hangs off this. Inputs are
   pinned to 16px further down, because anything smaller makes iOS Safari
   zoom in when you tap into a field. */
html { font-size: 15px; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-grad), var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  font: 1rem/1.45 ui-rounded, "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-text-size-adjust: 100%;
  min-height: 100dvh;
}

.hidden { display: none !important; }
.muted { color: var(--ink-dim); }
.tiny { font-size: .76rem; }
h1, h2, h3 { line-height: 1.2; margin: 0; }

/* textarea belongs here too — without it the chat box renders black text
   on a black background in every dark theme. */
button, input, select, textarea { font: inherit; color: inherit; }

/* ------------------------------------------------------------ buttons */
.btn {
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--ink);
  padding: .48rem .8rem;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: .9rem;
  transition: transform .08s ease, filter .15s ease;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(180deg, var(--btn-a), var(--btn-b)); border-color: var(--btn-line); color: var(--btn-ink); }
.btn-ghost { background: transparent; }
.btn-danger { background: transparent; border-color: color-mix(in srgb, var(--red) 45%, var(--line)); color: var(--red); }
.btn-row { display: flex; gap: .4rem; flex-wrap: wrap; }
.btn.tiny { padding: .25rem .5rem; border-radius: 8px; font-size: .74rem; }
.btn.block { width: 100%; }

/* ------------------------------------------------------------- login */
.login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.2rem .9rem;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.2rem;
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: .7rem; }
.brand h1 { font-size: 1.3rem; letter-spacing: .2px; }
.brand h1 em { color: var(--accent-2); font-style: normal; }
.brand-dice { font-size: 2rem; filter: drop-shadow(0 4px 10px color-mix(in srgb, var(--accent-2) 40%, transparent)); }
.login-blurb { color: var(--ink-dim); font-size: .85rem; margin: .7rem 0 .9rem; }

.player-tiles { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .8rem; }
.ptile {
  display: flex; align-items: center; gap: .35rem;
  border: 1px solid var(--line); background: var(--card);
  border-radius: 999px; padding: .3rem .65rem; cursor: pointer; font-size: .88rem;
}
.ptile.is-active { border-color: var(--accent-2); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-2) 25%, transparent); }
.ptile span.emoji { font-size: 1rem; }

.login-form, .form-grid { display: grid; gap: .6rem; }
.field { display: grid; gap: .22rem; }
.field > span { font-size: .72rem; color: var(--ink-dim); text-transform: uppercase; letter-spacing: .06em; }
.field input, .field select {
  background: var(--input-bg); color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px; padding: .55rem .7rem; width: 100%;
  font-size: 16px;   /* keeps iOS from zooming on focus — don't shrink this */
}
.field input:focus, .field select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.field.check { display: flex; align-items: center; gap: .5rem; }
.field.check input { width: auto; }
.field.wide { grid-column: 1 / -1; }
.form-error { color: var(--red); font-size: .82rem; min-height: 1.1rem; margin: .2rem 0 0; }

/* -------------------------------------------------------------- shell */
.app {
  max-width: 560px; margin: 0 auto; overflow-x: clip;
  padding: 0 .75rem calc(4.6rem + env(safe-area-inset-bottom));
}

/* ------------------------------------------------------- hello header */
.hello {
  /* Deliberately not sticky: it would sit on top of the word search grid. */
  display: flex; align-items: center; gap: .55rem;
  padding: .6rem 0 .5rem; margin-bottom: .5rem;
}
.hello-avatar {
  flex: 0 0 auto; width: 2.35rem; height: 2.35rem; border-radius: 999px;
  display: grid; place-items: center; font-size: 1.15rem; cursor: pointer;
  background: var(--card-2); border: 1.5px solid var(--accent); padding: 0;
}
.hello-text { flex: 1 1 auto; min-width: 0; }
.hello-name {
  font-size: 1.15rem; font-weight: 800; letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hello-sub {
  margin: 0; font-size: .74rem; color: var(--ink-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hello-sub span + span::before { content: ' · '; }
.hello-side { flex: 0 0 auto; display: flex; gap: .3rem; }
.hello-chip {
  background: var(--card); border: 1px solid var(--line); border-radius: 9px;
  padding: .2rem .4rem; text-align: center; line-height: 1.1;
}
.hello-chip strong { display: block; font-size: .82rem; color: var(--accent-2); font-variant-numeric: tabular-nums; }
.hello-chip span { display: block; font-size: .56rem; color: var(--ink-dim); text-transform: uppercase; letter-spacing: .04em; }

/* ---------------------------------------------------------- bottom nav */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, var(--card));
  backdrop-filter: blur(10px);
  padding: .25rem .25rem calc(.3rem + env(safe-area-inset-bottom));
}
.nav-btn {
  display: grid; justify-items: center; gap: .1rem;
  background: none; border: 0; cursor: pointer; padding: .3rem .2rem;
  color: var(--ink-dim); border-radius: 10px;
}
.nav-btn svg { width: 20px; height: 20px; }
.nav-btn span { font-size: .66rem; }
.nav-btn.is-active { color: var(--ink); background: var(--card); }
.nav-btn.is-active span { font-weight: 700; }

.view { display: grid; gap: .7rem; grid-template-columns: minmax(0, 1fr); }
.card, .panel { min-width: 0; }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .75rem; box-shadow: var(--shadow);
}
.card-title { font-size: .95rem; letter-spacing: .01em; margin-bottom: .5rem; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }

/* -------------------------------------------------------- game switch */
.play-head { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; margin-bottom: -.3rem; }
.play-title { font-size: .98rem; font-weight: 800; }

/* Four small tiles, one row, always. */
.game-switch { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .35rem; }
.gswitch {
  border: 1px solid var(--line); background: var(--card);
  border-radius: 11px; padding: .4rem .2rem; cursor: pointer; text-align: center;
  display: grid; gap: .05rem; justify-items: center; align-content: start; min-width: 0;
}
.gswitch-icon { font-size: 1rem; line-height: 1.1; }
/* "Word search" wraps to two lines; the grid keeps every tile the same height. */
.gswitch-name { font-weight: 700; font-size: .68rem; line-height: 1.1; max-width: 100%; }
.gswitch-state {
  font-size: .64rem; color: var(--ink-dim);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gswitch.is-active { border-color: var(--accent); background: var(--card-2); }
.gswitch.is-done { border-color: color-mix(in srgb, var(--green) 55%, var(--line)); background: color-mix(in srgb, var(--green) 10%, transparent); }
.gswitch.is-done .gswitch-state { color: var(--green); font-weight: 700; }
.gswitch.is-todo .gswitch-state { color: var(--accent-2); font-weight: 700; }

/* ------------------------------------------------------------- the CTA */
.cta {
  width: 100%; border: 1px solid var(--btn-line); cursor: pointer;
  background: linear-gradient(180deg, var(--btn-a), var(--btn-b)); color: var(--btn-ink);
  border-radius: 12px; padding: .6rem; font-size: .98rem; font-weight: 700;
  transition: transform .08s ease, filter .15s ease;
}
.cta:active { transform: translateY(1px); }
.cta.is-done {
  background: color-mix(in srgb, var(--green) 14%, transparent);
  border-color: color-mix(in srgb, var(--green) 50%, var(--line));
  color: var(--ink); cursor: default;
}

.fair {
  display: flex; align-items: center; gap: .5rem;
  background: color-mix(in srgb, var(--green) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--green) 45%, var(--line));
  border-radius: 10px; padding: .45rem .6rem; font-size: .78rem;
}
.fair p { margin: 0; }
.fair strong { color: var(--green); }

/* ------------------------------------------------- friendly score list */
.score-list { display: grid; gap: .3rem; }
.score-row { display: flex; align-items: center; gap: .45rem; padding: .1rem; }
.score-row .rank { width: 1.3rem; text-align: center; font-size: .85rem; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.score-row .emoji { font-size: 1.05rem; }
.score-row .namebox { flex: 1 1 auto; min-width: 0; display: grid; }
.score-row .name { font-weight: 700; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score-row .pts { font-weight: 800; font-size: .95rem; font-variant-numeric: tabular-nums; }
.score-row .done { font-size: .68rem; color: var(--ink-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score-row.is-me { background: color-mix(in srgb, var(--accent) 14%, transparent); border-radius: 9px; margin: 0 -.3rem; padding: .1rem .4rem; }

/* ------------------------------------------------------------- wordle */
.wgrid { display: grid; gap: 5px; justify-content: center; margin: .2rem 0 .4rem; }
.wrow { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.wtile {
  width: min(14vw, 50px); height: min(14vw, 50px);
  display: grid; place-items: center;
  border: 2px solid var(--line); border-radius: 8px;
  font-size: clamp(1rem, 4.6vw, 1.5rem); font-weight: 800; text-transform: uppercase;
  background: var(--tile-bg);
  transition: transform .12s ease, background .2s ease, border-color .2s ease;
}
.wtile.filled { border-color: var(--slate); transform: scale(1.03); }
.wtile.correct { background: var(--green); border-color: var(--green); color: var(--tile-ink); }
.wtile.present { background: var(--amber); border-color: var(--amber); color: var(--tile-ink); }
.wtile.absent  { background: var(--slate); border-color: var(--slate); color: var(--slate-ink); }

.keyboard { display: grid; gap: 5px; margin-top: .3rem; max-width: 100%; }
.krow { display: flex; gap: 4px; justify-content: center; width: 100%; }
.key {
  flex: 1 1 0; min-width: 0; padding: .62rem .1rem;
  border-radius: 7px; border: 1px solid var(--line); background: var(--card-2);
  font-weight: 700; text-transform: uppercase; cursor: pointer;
  font-size: clamp(.7rem, 3.4vw, .9rem);
}
.key.wide { flex: 1.6 1 0; font-size: clamp(.58rem, 2.6vw, .75rem); }
.key.correct { background: var(--green); border-color: var(--green); color: var(--tile-ink); }
.key.present { background: var(--amber); border-color: var(--amber); color: var(--tile-ink); }
.key.absent  { background: var(--key-dead-bg); border-color: var(--key-dead-bg); color: var(--key-dead-ink); }

.game-msg { min-height: 1.2rem; text-align: center; font-size: .84rem; color: var(--accent-2); margin: .3rem 0; }
.done-box { border-top: 1px dashed var(--line); margin-top: .6rem; padding-top: .7rem; text-align: center; }
.done-box h3 { font-size: 1rem; }
.share-grid { font-size: 1rem; line-height: 1.15; letter-spacing: 2px; margin: .5rem 0; }

/* --------------------------------------------------------------- quiz */
.quiz-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .6rem; }
.dots { display: flex; gap: .3rem; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--slate); }
.dot.right { background: var(--green); }
.dot.wrong { background: var(--red); }
.dot.now { background: var(--accent-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-2) 25%, transparent); }
.pill {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .06em;
  border: 1px solid var(--line); border-radius: 999px; padding: .15rem .5rem; color: var(--ink-dim);
}
.quiz-question { font-size: 1rem; margin-bottom: .7rem; }
.options { display: grid; gap: .35rem; }
.opt {
  text-align: left; border: 1px solid var(--line); background: var(--card-2);
  border-radius: 10px; padding: .55rem .7rem; cursor: pointer; font-size: .92rem;
  display: flex; gap: .5rem; align-items: baseline;
}
.opt .letter { color: var(--ink-dim); font-weight: 700; }
.opt:disabled { cursor: default; }
.opt.right { background: color-mix(in srgb, var(--green) 20%, transparent); border-color: var(--green); }
.opt.wrong { background: color-mix(in srgb, var(--red) 18%, transparent); border-color: var(--red); }
.review { display: grid; gap: .5rem; text-align: left; padding-left: 1rem; }
.review li { font-size: .84rem; }
.review .r-ans { color: var(--green); }
.review .r-bad { color: var(--red); text-decoration: line-through; }

/* ------------------------------------------------------------- tables */
.narrow-only { display: none; }
.table-wrap { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th, td { padding: .4rem .35rem; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
@media (max-width: 460px) {
  table { font-size: .8rem; }
  th, td { padding: .38rem .25rem; }
  .hide-narrow, .wide-only { display: none; }
  .narrow-only { display: inline; }
  /* Long names give way so the points column always stays on screen. */
  .who span:last-child {
    display: inline-block; max-width: 4.6rem; vertical-align: bottom;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
}
th { font-size: .66rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-dim); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.me td { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.pos { width: 2rem; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.who { display: flex; align-items: center; gap: .4rem; }
.who .emoji { font-size: 1rem; }
.dash { color: color-mix(in srgb, var(--ink-dim) 55%, transparent); }
.zero { color: var(--ink-dim); }
.crown { color: var(--accent-2); }

.week-list { display: grid; gap: .35rem; }
.week-row { display: flex; justify-content: space-between; gap: .5rem; padding: .4rem 0; border-bottom: 1px solid var(--line); font-size: .85rem; }

.rules { display: grid; gap: .35rem; font-size: .84rem; }
.rules b { color: var(--accent-2); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: .45rem; }
.stat { background: var(--card-2); border: 1px solid var(--line); border-radius: 10px; padding: .5rem; }
.stat .v { font-size: 1.1rem; font-weight: 800; }
.stat .k { font-size: .66rem; color: var(--ink-dim); text-transform: uppercase; letter-spacing: .05em; }
.stat.warn { border-color: color-mix(in srgb, var(--accent-2) 45%, var(--line)); background: color-mix(in srgb, var(--accent-2) 12%, transparent); }

.cat-grid { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .5rem; }
.cat { font-size: .72rem; border: 1px solid var(--line); border-radius: 999px; padding: .2rem .5rem; color: var(--ink-dim); }
.adder { margin-top: .6rem; }
.adder summary { cursor: pointer; color: var(--accent); font-size: .85rem; }
.adder .form-grid { grid-template-columns: 1fr 1fr; margin-top: .6rem; }
@media (max-width: 460px) { .adder .form-grid { grid-template-columns: 1fr; } }

/* ----------------------------------------------------------------- me */
.me-head { display: flex; align-items: center; gap: .6rem; }
.me-avatar {
  width: 2.2rem; height: 2.2rem; border-radius: 999px; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 1.1rem;
  background: var(--card-2); border: 1.5px solid var(--accent);
}
.me-head .card-title { margin-bottom: .1rem; }
.admin-block { display: grid; gap: .7rem; }
.field-label { font-size: .72rem; color: var(--ink-dim); text-transform: uppercase; letter-spacing: .06em; }

.toast {
  position: fixed; left: 50%; bottom: calc(4.4rem + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--card-2); border: 1px solid var(--line); color: var(--ink);
  padding: .45rem .8rem; border-radius: 999px; z-index: 60; box-shadow: var(--shadow);
  font-size: .85rem; max-width: 90vw; text-align: center;
}

/* --------------------------------------------------------- word search */
/* The grid reads as one sheet of paper: no per-cell boxes, just letters,
   so a 10x10 stays legible on a phone. Highlights are washes of colour
   behind the letter rather than solid blocks over it. */
.ws-head { margin-bottom: .4rem; }
.ws-sheet {
  background: var(--card-2); border: 1px solid var(--line);
  border-radius: 10px; padding: .3rem;
  margin: 0 auto .45rem; max-width: min(100%, 23rem);
}
.ws-grid {
  --ws-size: 10;
  display: grid; grid-template-columns: repeat(var(--ws-size), minmax(0, 1fr));
  gap: 1px;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.ws-cell {
  aspect-ratio: 1; display: grid; place-items: center;
  border-radius: 5px; background: transparent; color: var(--ink);
  font-weight: 700; font-size: clamp(.85rem, 3.9vw, 1.15rem);
  line-height: 1; text-transform: uppercase;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.ws-cell.is-found {
  background: color-mix(in srgb, var(--green) 32%, transparent);
  color: var(--ink); font-weight: 800;
}
.ws-cell.is-missed { background: color-mix(in srgb, var(--amber) 30%, transparent); }
.ws-cell.is-pick { background: var(--accent); color: var(--btn-ink); font-weight: 800; }

.ws-words { display: flex; flex-wrap: wrap; gap: .28rem; justify-content: center; }
.ws-word {
  font-size: .72rem; font-weight: 700; letter-spacing: .03em;
  border: 1px solid var(--line); border-radius: 999px; padding: .15rem .5rem;
  background: var(--card-2);
}
.ws-word.is-found { color: var(--green); border-color: var(--green); text-decoration: line-through; opacity: .7; }
.ws-finish-row { margin-top: .6rem; text-align: center; }

.game-msg.is-bad { color: var(--red); }
.game-msg.is-good { color: var(--green); }

/* -------------------------------------------------------------- nerdle */
.eqrow { grid-template-columns: repeat(8, 1fr); gap: 4px; }
.wtile.ntile-eq { width: min(9.6vw, 40px); height: min(9.6vw, 40px); font-size: clamp(.85rem, 3.8vw, 1.15rem); border-radius: 7px; }

/* --------------------------------------------------------------- house */
.chat-card { display: grid; gap: .5rem; }
.chat-card .card-head { flex-wrap: nowrap; align-items: center; }
.chat-log {
  display: grid; gap: .45rem; align-content: start;
  height: min(56vh, 420px); overflow-y: auto; padding: .15rem;
  scrollbar-width: thin;
}
.msg { display: flex; }
.msg.is-mine { justify-content: flex-end; }
.msg-inner {
  max-width: 82%; background: var(--card-2); border: 1px solid var(--line);
  border-radius: 12px; padding: .4rem .55rem; display: grid; gap: .22rem;
}
.msg.is-mine .msg-inner { background: color-mix(in srgb, var(--accent) 22%, var(--card-2)); }
.msg-who { font-size: .7rem; font-weight: 700; display: flex; gap: .3rem; align-items: center; }
.msg-body { white-space: pre-wrap; word-break: break-word; font-size: .9rem; }
.msg-photo { width: 100%; max-height: 60vh; object-fit: cover; border-radius: 9px; cursor: zoom-in; background: var(--slate); }
.msg-time { font-size: .64rem; color: var(--ink-dim); display: flex; gap: .35rem; align-items: center; justify-content: flex-end; }
.msg-del { background: none; border: 0; color: var(--ink-dim); cursor: pointer; font-size: .9rem; line-height: 1; padding: 0 .1rem; }
.msg-del:hover { color: var(--red); }

.chat-preview { display: flex; gap: .5rem; align-items: center; border: 1px dashed var(--line); border-radius: 10px; padding: .4rem; }
.chat-preview img { width: 52px; height: 52px; object-fit: cover; border-radius: 7px; }

.chat-form { display: grid; grid-template-columns: auto 1fr auto; gap: .35rem; align-items: end; }
.chat-form textarea {
  background: var(--input-bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px;
  padding: .5rem .6rem; resize: none; max-height: 7rem; min-height: 2.4rem;
  font-size: 16px;   /* same reason as the other inputs: no iOS zoom */
  line-height: 1.35;
}
.chat-form textarea::placeholder { color: var(--ink-dim); opacity: 1; }
.chat-form textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.photo-btn {
  display: grid; place-items: center; width: 2.4rem; height: 2.4rem;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card-2);
  cursor: pointer; font-size: 1.05rem;
}
.lightbox { position: fixed; inset: 0; background: rgba(0, 0, 0, .88); display: grid; place-items: center; z-index: 70; padding: 1rem; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; }

.streak { color: var(--accent-2); font-weight: 700; }

/* ------------------------------------------------- add to home screen */
.install {
  position: fixed; inset: 0; z-index: 80;
  background: var(--overlay); backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 1rem;
  overflow-y: auto;
}
.install-card {
  width: 100%; max-width: 360px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; padding: 1.1rem; box-shadow: var(--shadow);
  display: grid; gap: .7rem;
}
.install-card h2 { font-size: 1.15rem; }
.install-lead { margin: 0; font-size: .85rem; color: var(--ink-dim); }
.install-steps { display: grid; gap: .5rem; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.install-steps li {
  display: grid; grid-template-columns: 1.5rem 1fr; gap: .55rem;
  align-items: start; font-size: .88rem;
}
.install-steps li::before {
  counter-increment: step; content: counter(step);
  width: 1.5rem; height: 1.5rem; border-radius: 999px;
  display: grid; place-items: center;
  background: var(--accent); color: var(--btn-ink);
  font-size: .76rem; font-weight: 800;
}
.install-steps .ios-share {
  display: inline-grid; place-items: center; vertical-align: -.2em;
  width: 1.15rem; height: 1.15rem; border-radius: 4px;
  border: 1px solid var(--accent); color: var(--accent);
  font-size: .8rem; line-height: 1;
}
.install-note {
  margin: 0; font-size: .76rem; color: var(--ink-dim);
  border-top: 1px dashed var(--line); padding-top: .6rem;
}

@media (max-width: 360px) {
  html { font-size: 14px; }
  .hello-chip span { font-size: .55rem; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* -------------------------------------------------------------- badges */
.badge-shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: .4rem; }
.badge {
  border: 1px solid var(--line); background: var(--card-2);
  border-radius: 11px; padding: .45rem .3rem; text-align: center;
  display: grid; gap: .1rem; justify-items: center; opacity: .45;
}
.badge.is-earned {
  opacity: 1;
  border-color: color-mix(in srgb, var(--accent-2) 60%, var(--line));
  background: color-mix(in srgb, var(--accent-2) 12%, var(--card-2));
}
.badge-emoji { font-size: 1.3rem; line-height: 1.1; filter: grayscale(1); }
.badge.is-earned .badge-emoji { filter: none; }
.badge-name { font-size: .66rem; font-weight: 700; line-height: 1.1; }
.badge-when { font-size: .58rem; color: var(--ink-dim); line-height: 1.1; }
.badge.is-earned .badge-when { color: var(--accent-2); text-transform: uppercase; letter-spacing: .05em; }

.badge-row { display: flex; gap: .1rem; }
.badge-mini { font-size: .95rem; }

/* A dropdown small enough to live in a table cell. */
.mini-select {
  background: var(--card-2); border: 1px solid var(--line); color: var(--ink);
  border-radius: 8px; padding: .2rem .3rem; font-size: .74rem;
}
.cat.is-head { color: var(--ink); font-weight: 700; border-color: var(--accent); }

/* --------------------------------------------------------- code breaker */
.cb-rows { display: grid; gap: .3rem; margin-bottom: .2rem; }
.cb-row {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  border: 1px solid var(--line); border-radius: 10px;
  padding: .3rem .45rem; background: var(--card-2);
}
.cb-row.is-live { border-color: var(--accent); background: var(--card); }
.cb-digits { display: flex; gap: .3rem; }
.cb-digit {
  width: 2rem; height: 2.3rem; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 7px; background: var(--tile-bg);
  font-weight: 800; font-size: 1.1rem; font-variant-numeric: tabular-nums;
}
.cb-digit.filled { border-color: var(--accent); }
.cb-marks { display: flex; gap: .45rem; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.cb-exact { color: var(--green); }
.cb-close { color: var(--amber); }

.cb-pad { margin-top: .4rem; }
.cb-keys { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.cb-keys .key.wide { grid-column: span 2; }

/* ------------------------------------------------------------ follow me */
.fm-progress { display: flex; gap: 3px; justify-content: center; margin-bottom: .6rem; }
.fm-pip { width: 100%; max-width: 1.4rem; height: 5px; border-radius: 3px; background: var(--slate); }
.fm-pip.is-done { background: var(--green); }
.fm-pip.is-now { background: var(--accent-2); }

.fm-pads {
  display: grid; grid-template-columns: 1fr 1fr; gap: .5rem;
  max-width: min(100%, 17rem); margin: 0 auto;
}
.fm-pad {
  aspect-ratio: 1; border-radius: 16px; cursor: pointer;
  border: 2px solid var(--line); background: var(--card-2);
  display: grid; place-items: center;
  -webkit-tap-highlight-color: transparent;
  transition: transform .08s ease, filter .12s ease, box-shadow .12s ease;
}
.fm-shape { font-size: 2rem; line-height: 1; }
.fm-pad:active { transform: scale(.97); }
/* The pads keep their own four colours in every theme, the same way the
   Wordle tiles stay green and amber: drawn from the palette, two of them
   would come out the same green in the green theme. The shape is what
   actually identifies a pad — the colour is just a hand up. */
.fm-a { --pad: #22c55e; }   /* circle   */
.fm-b { --pad: #3b82f6; }   /* square   */
.fm-c { --pad: #f0a92b; }   /* triangle */
.fm-d { --pad: #ef4444; }   /* diamond  */
.fm-pad { border-color: var(--pad); color: var(--pad); }
.fm-pad.is-lit {
  background: color-mix(in srgb, var(--pad) 38%, var(--card-2));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--pad) 35%, transparent);
  filter: brightness(1.15);
}

.fm-controls { display: grid; gap: .4rem; margin-top: .5rem; }

@media (prefers-reduced-motion: reduce) {
  .fm-pad { transition: none; }
}

/* -------------------------------------------------------- line them up */
.lu-list { display: grid; gap: .3rem; }
.lu-row {
  display: flex; align-items: center; gap: .5rem;
  border: 1px solid var(--line); border-radius: 10px;
  padding: .35rem .5rem; background: var(--card-2);
}
.lu-pos {
  flex: 0 0 auto; width: 1.4rem; height: 1.4rem; border-radius: 999px;
  display: grid; place-items: center; font-size: .72rem; font-weight: 800;
  background: var(--slate); color: var(--slate-ink);
}
.lu-label { flex: 1 1 auto; min-width: 0; font-size: .92rem; }
.lu-value { color: var(--ink-dim); font-size: .8rem; font-variant-numeric: tabular-nums; }
.lu-moves { display: flex; gap: .2rem; flex: 0 0 auto; }
.lu-move {
  width: 2rem; height: 2rem; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font-size: .8rem; line-height: 1;
}
.lu-move:disabled { opacity: .3; cursor: default; }
.lu-mark { flex: 0 0 auto; font-weight: 800; }
.lu-row.is-right { border-color: var(--green); background: color-mix(in srgb, var(--green) 14%, transparent); }
.lu-row.is-right .lu-mark { color: var(--green); }
.lu-row.is-wrong { border-color: color-mix(in srgb, var(--red) 45%, var(--line)); }
.lu-row.is-wrong .lu-mark { color: var(--red); }

/* -------------------------------------------------------------- riddle */
.rd-text {
  font-size: 1.02rem; line-height: 1.45; margin: .2rem 0 .6rem;
  /* A riddle is the thing you're reading, so give it room to breathe. */
  padding: .6rem .7rem; border-radius: 10px;
  background: var(--card-2); border: 1px solid var(--line);
}
.rd-hints { display: grid; gap: .3rem; margin-bottom: .5rem; }
.rd-hint {
  display: flex; gap: .45rem; align-items: baseline; font-size: .85rem;
  border-left: 3px solid var(--accent-2); padding: .2rem .5rem;
  background: color-mix(in srgb, var(--accent-2) 10%, transparent);
  border-radius: 0 8px 8px 0;
}
.rd-hint-label {
  flex: 0 0 auto; font-size: .64rem; font-weight: 800; letter-spacing: .05em;
  text-transform: uppercase; color: var(--accent-2);
}
.rd-guesses { display: grid; gap: .25rem; }
.rd-guess {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  border: 1px solid var(--line); border-radius: 9px; padding: .3rem .55rem;
  font-size: .9rem; background: var(--card-2);
}
.rd-guess.is-right { border-color: var(--green); background: color-mix(in srgb, var(--green) 16%, transparent); }
.rd-guess.is-right .rd-mark { color: var(--green); }
.rd-guess.is-wrong .rd-mark { color: var(--red); }
.rd-mark { font-weight: 800; }
.rd-form { display: grid; grid-template-columns: 1fr auto; gap: .4rem; }
.rd-form input {
  background: var(--input-bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px;
  padding: .55rem .7rem; font-size: 16px;   /* no iOS zoom */
}
.rd-form input::placeholder { color: var(--ink-dim); opacity: 1; }
.rd-form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
