/* T-0077 · Stand Firm · the shared layout: score, start, Bismillah, story card, street board. T-0078: the playtest additions at the end.
   Each look sets its colours and fonts in its own CSS (the tokens at the top of a-sign/sign.css and the others).
   Motion: feedback 0.18 s, one easing family (STANDARD 15). With motion off, nothing loops or slides (STANDARD 16). */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); overflow: hidden; overscroll-behavior: none; }
body { -webkit-text-size-adjust: 100%; }
:root { --ease: cubic-bezier(.2, 0, 0, 1); --annot-ui: #7fd3e6; }

.sf {
  position: fixed; inset: 0; overflow: hidden;
  color: var(--ink); font-family: var(--f-text);
  -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
:where(.sf) button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.sf [hidden] { display: none !important; }
.sf-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.sf-stage { position: absolute; inset: 0; touch-action: none; outline: none; }
.sf-vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; margin: 0; }
.sf :focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 8px; }
.sf .sf-board-title:focus-visible, .sf .sf-card:focus-visible, .sf .sf-stage:focus-visible { outline: none; }   /* focused by script for screen readers only */

/* ---------- the score: big, top middle, nothing else to read ---------- */
.sf-hud { position: absolute; left: 0; right: 0; top: max(8px, env(safe-area-inset-top)); display: grid; justify-items: center; pointer-events: none; text-align: center; }
.sf-score { margin: 0; font-family: var(--f-display); font-weight: var(--display-weight, 400); font-size: var(--score-size, clamp(76px, 23vw, 110px)); line-height: 1; color: var(--hud); text-shadow: var(--hud-shadow, none); font-variant-numeric: tabular-nums; letter-spacing: var(--score-track, 0); }
.sf-score-n { display: inline-block; }
.sf-hud-best { margin: 0; font: 600 15px/1.2 var(--f-text); color: var(--hud-2); text-shadow: var(--hud-shadow-small, none); }
.sf-hud-best b { font-weight: 800; }
.sf-pop { margin: 8px 0 0; min-height: 28px; font: 800 22px/1.2 var(--f-text); color: var(--pop); opacity: 0; text-shadow: var(--pop-shadow, none); }

.sf-hint { position: absolute; left: 50%; bottom: calc(max(16px, env(safe-area-inset-bottom)) + 18px); transform: translateX(-50%); display: flex; align-items: center; gap: 12px; opacity: 0; transition: opacity .25s var(--ease); pointer-events: none; color: var(--hint); font: 800 22px/1 var(--f-text); }
.sf-hint.on { opacity: 1; }
.sf-hint-ring { position: relative; width: 34px; height: 34px; border-radius: 50%; border: 3px solid currentColor; }
.sf-hint-ring::after { content: ''; position: absolute; inset: 7px; border-radius: 50%; background: currentColor; }
.sf-hint.on .sf-hint-ring { animation: sf-tap 1.1s var(--ease) infinite; }
@keyframes sf-tap { 0%, 100% { transform: scale(1); } 35% { transform: scale(.78); } }

.sf-sound { position: absolute; z-index: 20; top: max(8px, env(safe-area-inset-top)); right: 8px; width: 48px; height: 48px; padding: 0; border: 0; border-radius: 50%; display: grid; place-items: center; background: var(--quiet-bg); color: var(--quiet-ink); transition: transform .18s var(--ease); }
.sf-sound:active { transform: scale(.92); }

/* ---------- buttons ---------- */
.sf-btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 56px; padding: 0 24px;
  border: var(--btn-border, 0); border-radius: var(--btn-radius, 14px);
  background: var(--accent); color: var(--on-accent); font: 800 21px/1 var(--f-text); letter-spacing: .01em;
  box-shadow: var(--btn-shadow, none);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), background-color .18s var(--ease);
}
@media (hover: hover) { .sf-btn:hover { background: var(--accent-hover, var(--accent)); } }
.sf-btn:active { transform: translateY(var(--btn-sink, 3px)); box-shadow: var(--btn-shadow-press, none); }
.sf-btn:focus-visible { border-radius: var(--btn-radius, 14px); }
.sf-link { min-height: 48px; padding: 0 16px; border: 0; background: none; color: var(--link); font: 700 18px/1 var(--f-text); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px; }

/* ---------- start ---------- */
.sf-start { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; padding: calc(max(8px, env(safe-area-inset-top)) + 64px) 20px calc(max(12px, env(safe-area-inset-bottom)) + 8px); pointer-events: none; text-align: center; }
.sf-start-foot { pointer-events: auto; }
.sf-by { margin: 0 0 8px; font: 700 17px/1.2 var(--f-text); color: var(--by-color); letter-spacing: .01em; }
.sf-title { margin: 0; font-family: var(--f-title, var(--f-display)); font-weight: var(--title-weight, 400); font-size: var(--title-size, clamp(64px, 19vw, 104px)); line-height: var(--title-lh, .92); color: var(--title-color); text-shadow: var(--title-shadow, none); letter-spacing: var(--title-track, 0); }
.sf-line { margin: 14px 0 0; font: 700 20px/1.3 var(--f-text); color: var(--line-color); }
.sf-tags { margin: 8px 0 0; }
.sf-start-foot { display: grid; justify-items: center; gap: 4px; width: 100%; max-width: 380px; margin: 0 auto; }
.sf-start-best { margin: 0 0 6px; font: 700 17px/1.2 var(--f-text); color: var(--line-color); }
.sf-play { width: 100%; min-height: 64px; font-size: 25px; }

/* ---------- the Bismillah ---------- */
.sf-intro { position: absolute; inset: 0; pointer-events: none; }
.sf-intro-bg { position: absolute; inset: 0; background: var(--intro-bg, transparent); }
.sf-intro-mid { position: absolute; left: 0; right: 0; top: var(--intro-top, 22%); display: grid; justify-items: center; gap: 34px; padding: 0 16px; text-align: center; }
.sf-bism { display: block; width: var(--bism-w, min(92vw, 500px)); height: auto; overflow: visible; filter: var(--bism-glow, none); }
.sf-intro[data-lang='en'] .sf-bism { width: var(--bism-w-en, min(78vw, 380px)); }
.sf-bism-fill { fill: var(--fill); }
.sf-bism-trace { fill: none; stroke: var(--trace); stroke-linejoin: round; }
.sf-meaning { margin: 0; max-width: 21em; font: 700 18px/1.35 var(--f-text); color: var(--meaning); text-wrap: balance; text-shadow: var(--meaning-shadow, none); }
.sf-pen { position: absolute; left: 0; top: 0; width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle, #fff 0 28%, var(--pen, #fff) 52%, transparent 72%); box-shadow: 0 0 24px 10px var(--pen-glow, rgba(255, 255, 255, .5)); opacity: 0; }
.sf-stroke { position: absolute; left: 0; top: 0; border-radius: var(--stroke-radius, 4px); background: var(--stroke); box-shadow: var(--stroke-glow, none); }

/* ---------- the story card ---------- */
.sf-end { position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: center; pointer-events: none; }
.sf-card {
  pointer-events: auto; position: relative; width: min(100%, 480px); max-height: calc(100% - 140px); overflow-y: auto; outline: none; user-select: text; -webkit-user-select: text;
  background: var(--card-bg); color: var(--card-ink); border-radius: var(--card-radius, 26px 26px 0 0);
  padding: 20px 22px calc(max(14px, env(safe-area-inset-bottom)) + 8px); box-shadow: var(--card-shadow, none); border: var(--card-border, 0);
}
.sf-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sf-theme { display: inline-flex; align-items: center; min-height: 32px; padding: 0 14px; border-radius: 999px; background: var(--chip-bg); color: var(--chip-ink); font: 800 16px/1 var(--f-text); letter-spacing: .02em; }
.sf-result { margin: 10px 0 0; display: flex; align-items: baseline; gap: 10px; font-family: var(--f-display); font-weight: var(--display-weight, 400); color: var(--card-ink); }
.sf-result-n { font-size: var(--result-size, 76px); line-height: .9; letter-spacing: var(--score-track, 0); }
.sf-result-u { font: 700 21px/1 var(--f-text); color: var(--card-muted); }
.sf-result-sub { margin: 4px 0 0; font: 700 18px/1.2 var(--f-text); color: var(--card-muted); }
.sf-result-sub.is-best { color: var(--best-ink, var(--card-ink)); }
.sf-story { margin: 14px 0 0; font-family: var(--f-story, var(--f-text)); font-weight: var(--story-weight, 500); font-size: var(--story-size, 19px); line-height: 1.45; color: var(--card-ink); text-wrap: pretty; }
.sf-deen { margin: 16px 0 0; padding-top: 14px; border-top: 2px solid var(--card-line); font: var(--deen-font, 800 20px/1.3 var(--f-text)); color: var(--deen-color, var(--card-ink)); text-wrap: balance; }
.sf-actions { display: grid; gap: 4px; margin-top: 18px; }
.sf-again { width: 100%; min-height: 60px; font-size: 22px; }
.sf-card .sf-link { justify-self: center; color: var(--card-link, var(--card-ink)); }

/* ---------- the street board ---------- */
.sf-board { position: absolute; inset: 0; z-index: 10; overflow-y: auto; background: var(--board-bg); color: var(--board-ink); user-select: text; -webkit-user-select: text; }
.sf-board-in { max-width: 480px; margin: 0 auto; padding: calc(max(8px, env(safe-area-inset-top)) + 64px) 20px 36px; }
.sf-board-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sf-back { min-height: 48px; padding: 0 16px 0 10px; border: 0; border-radius: 12px; background: var(--back-bg); color: var(--back-ink); font: 700 18px/1 var(--f-text); display: inline-flex; gap: 8px; align-items: center; transition: transform .18s var(--ease); }
.sf-back:active { transform: translateY(2px); }
.sf-board-title { outline: none; margin: 20px 0 0; font-family: var(--f-display); font-weight: var(--display-weight, 400); font-size: var(--board-title-size, 44px); line-height: 1; color: var(--board-title, var(--board-ink)); letter-spacing: var(--title-track, 0); text-wrap: balance; }
.sf-board-week { margin: 10px 0 0; font: 600 17px/1.3 var(--f-text); color: var(--board-muted); }
.sf-rows { list-style: none; margin: 20px 0 0; padding: 0; display: grid; gap: 6px; }
.sf-rows li { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 10px; min-height: 52px; padding: 0 16px; border-radius: var(--row-radius, 12px); background: var(--row-bg); color: var(--row-ink); font: 700 18px/1.2 var(--f-text); border: var(--row-border, 0); }
.sf-rows li.is-top { min-height: 62px; font-size: 21px; background: var(--row-top-bg, var(--row-bg)); color: var(--row-top-ink, var(--row-ink)); }
.sf-rows li.is-you { background: var(--you-bg); color: var(--you-ink); box-shadow: inset 0 0 0 3px var(--you-line, transparent); }
.sf-r { font-family: var(--f-display); font-weight: var(--display-weight, 400); font-size: 22px; }
.sf-h { font-family: var(--f-display); font-weight: var(--display-weight, 400); font-size: 28px; font-variant-numeric: tabular-nums; }
.sf-you { margin: 16px 0 0; font: 700 18px/1.4 var(--f-text); color: var(--board-ink); }
.sf-nick { margin-top: 20px; padding: 16px; border-radius: 16px; background: var(--nick-bg); border: var(--nick-border, 0); }
.sf-nick label { display: block; margin-bottom: 10px; font: 800 17px/1.2 var(--f-text); color: var(--board-ink); }
.sf-nick-row { display: flex; gap: 8px; }
.sf-nick input { flex: 1; min-width: 0; min-height: 52px; padding: 0 14px; border-radius: 12px; border: 2px solid var(--field-line); background: var(--field-bg); color: var(--field-ink); font: 700 18px/1 var(--f-text); user-select: text; -webkit-user-select: text; transition: border-color .18s var(--ease); }
.sf-nick input:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-color: var(--field-ink); border-radius: 12px; }
.sf-btn-s { min-height: 52px; padding: 0 20px; font-size: 18px; }
.sf-nick-help { margin: 10px 0 0; font: 600 15px/1.45 var(--f-text); color: var(--board-muted); }
.sf-board-note { margin: 20px 0 0; font: 700 16px/1.4 var(--f-text); color: var(--board-muted); }

/* ---------- prototype only: stand-in tags and the review controls (never in the real game) ---------- */
.tag { display: inline-block; vertical-align: middle; padding: 2px 7px; border: 1.5px dashed var(--annot); border-radius: 6px; color: var(--annot); font: 600 12px/1.3 var(--f-text); letter-spacing: 0; text-transform: none; white-space: nowrap; text-shadow: none; }
.sf[data-marks='0'] .tag, .sf[data-marks='0'] .sf-ctl-btn { display: none; }
.sf[data-ctl='0'] .sf-ctl-btn { display: none; }
.sf-ctl-btn { position: absolute; z-index: 20; top: max(8px, env(safe-area-inset-top)); left: 8px; min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1.5px dashed var(--annot-ui); background: rgba(11, 11, 11, .55); color: var(--annot-ui); font: 700 13px/1 var(--f-text); }
.sf-ctl { position: absolute; z-index: 30; top: calc(max(8px, env(safe-area-inset-top)) + 54px); left: 8px; right: 8px; max-width: 470px; max-height: calc(100% - 80px); overflow-y: auto; padding: 12px 12px 14px; border-radius: 14px; border: 1.5px dashed var(--annot-ui); background: #0e1316; color: #e8f4f7; font: 600 14px/1.3 'Barlow', system-ui, sans-serif; user-select: none; }
.sf-ctl-h { margin: 0; color: var(--annot-ui); font-weight: 700; }
.sf-ctl-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.sf-ctl-row > span { width: 100%; color: #a9c9d1; font-weight: 700; }
.sf-ctl button, .sf-ctl a { min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid #2e4a52; background: #16242a; color: #e8f4f7; text-decoration: none; display: inline-flex; align-items: center; font: 600 14px/1 'Barlow', system-ui, sans-serif; }
.sf-ctl [aria-pressed='true'] { background: var(--annot-ui); color: #0b0b0b; border-color: var(--annot-ui); }

/* ---------- T-0078, the playtest build: New player, the log, one tag, no board ---------- */
.sf-ctl-btn { min-height: 48px; }
.sf-ctl button, .sf-ctl a { min-height: 48px; }
.sf-ctl .sf-ctl-new { width: 100%; min-height: 56px; margin-top: 12px; justify-content: center; border: 0; background: var(--annot-ui); color: #0b0b0b; font: 800 19px/1 'Barlow', system-ui, sans-serif; transition: transform .18s var(--ease); }
.sf-ctl .sf-ctl-new:active { transform: translateY(2px); }
.sf-ctl-note { margin: 8px 0 0; color: #a9c9d1; font-weight: 600; }
.sf-log { margin-top: 16px; padding-top: 12px; border-top: 1px solid #2e4a52; user-select: text; -webkit-user-select: text; }
.sf-log-h { margin: 0; color: #e8f4f7; font-weight: 800; }
.sf-log-h span { color: #a9c9d1; font-weight: 600; }
.sf-log-rows { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.sf-log-rows li { padding: 10px 12px; border-radius: 10px; background: #16242a; }
.sf-log-rows p { margin: 2px 0 0; color: #e8f4f7; font-variant-numeric: tabular-nums; }
.sf-log-rows p.sf-log-p { margin: 0 0 4px; color: #a9c9d1; }
.sf-log-rows b { color: #ffffff; font-weight: 800; }
.sf-ctl .sf-log-clear { margin-top: 12px; }
.sf[data-board='0'] .sf-open-board { display: none; }
.sf[data-marks='story'] .tag:not(.tag-story):not(.tag-board) { display: none; }

/* ---------- motion off: nothing loops, nothing slides (the block itself still moves: it is the game) ---------- */
.sf[data-still='1'] *, .sf[data-still='1'] *::before, .sf[data-still='1'] *::after { animation: none !important; transition: none !important; }
/* T-0080: the phone's setting holds until the game has decided (data-still), so Controls › Full motion can turn it on */
@media (prefers-reduced-motion: reduce) {
  .sf:not([data-still='0']) *, .sf:not([data-still='0']) *::before, .sf:not([data-still='0']) *::after { animation: none !important; transition: none !important; }
}

/* ---------- T-0087, the demo build (D-118): one line of hope, "Back to my order", the board as an example ---------- */
/* the end card: no story chip, no story, no deen line (Ibrah, 10-13); one line of hope and courage instead */
.sf-hope { margin: 14px 0 0; padding-top: 14px; border-top: 2px solid var(--card-line); font: 800 26px/1.25 var(--f-text); color: var(--card-ink); text-wrap: balance; text-shadow: 0 0 18px rgba(253, 181, 21, .3); }
/* "Back to my order": only with ?via=order. A real link (it leaves the game), the second button under Play */
.sf-order { display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 56px; margin-top: 6px; padding: 0 20px; border: 2px solid #8a8a8a; border-radius: var(--btn-radius, 14px); background: var(--bg); color: #ffffff; font: 800 20px/1 var(--f-text); text-decoration: none; transition: transform .18s var(--ease), border-color .18s var(--ease); }
.sf-card .sf-order { background: var(--card-bg); }
@media (hover: hover) { .sf-order:hover { border-color: #ffffff; } }
.sf-order:active { transform: translateY(2px); }
.sf-order:focus-visible { border-radius: var(--btn-radius, 14px); }
/* the street board as an example: a stamp a stranger reads at once, then one plain line. Not a stand-in tag: it always shows */
.sf-example { margin: 0 4px 0 0; padding: 6px 12px 4px; border: 2.5px dashed var(--annot); border-radius: 8px; color: var(--annot); font-family: var(--f-display); font-weight: var(--display-weight, 400); font-size: 28px; line-height: 1; letter-spacing: .06em; text-transform: uppercase; transform: rotate(-4deg); }
.sf-example-note { margin: 12px 0 0; font: 700 17px/1.4 var(--f-text); color: var(--annot); }
