/* croquis — design system ported from El Organillero's editorial visual
   language. Light only: no dark theme, no theme toggle. */

:root {
  --bg: #f8f8f8;
  --bg-edge: #f0f0f0;
  --bg-card: #ffffff;
  --map-fill: #eeeeee;
  --line-stroke: #969696;
  --alc-stroke: rgba(120, 100, 80, 0.16);

  --ink-1: rgba(0, 0, 0, 0.92);
  --ink-2: rgba(0, 0, 0, 0.78);
  --ink-3: rgba(0, 0, 0, 0.55);
  --ink-4: rgba(0, 0, 0, 0.42);
  --ink-5: rgba(0, 0, 0, 0.45);
  --ink-border: rgba(0, 0, 0, 0.18);
  --ink-border-soft: rgba(0, 0, 0, 0.08);
  --ink-rule: rgba(0, 0, 0, 0.05);

  --live: #e63946;
  --live-glow: rgba(230, 57, 70, 0.35);
  --ready: #4f9e5b;
  --hard-accent: #e63946;

  --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;

  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-7: 28px; --sp-8: 32px; --sp-9: 36px;

  --rad-sm: 4px; --rad-md: 6px; --rad-lg: 8px; --rad-pill: 999px;

  --shadow-tooltip: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 14px rgba(0, 0, 0, 0.08);
  --shadow-button:  0 1px 3px rgba(0, 0, 0, 0.05), 0 4px 12px rgba(0, 0, 0, 0.05);
  --shadow-panel:   0 1px 3px rgba(0, 0, 0, 0.05), 0 12px 32px rgba(0, 0, 0, 0.10);
  --shadow-medallion: 0 1px 2px rgba(0, 0, 0, 0.08);

  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-in-out: cubic-bezier(0.45, 0.05, 0.55, 0.95);
  --dur-fast: 150ms;
  --dur-base: 220ms;
  --dur-slow: 700ms;

  --focus-ring: rgba(0, 0, 0, 0.08);
  --focus-ring-strong: rgba(0, 0, 0, 0.10);

  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--ink-2);
  font-family: var(--font-stack);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

body {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

body[data-difficulty="hard"] {
  --bg: #f3efe6;
  --bg-edge: #e8e0d3;
  --bg-card: #fffaf2;
  --map-fill: #ddd6ca;
  --alc-stroke: rgba(32, 24, 18, 0.22);
  --ink-border: rgba(0, 0, 0, 0.28);
  --ink-border-soft: rgba(0, 0, 0, 0.13);
  --ink-rule: rgba(0, 0, 0, 0.09);
}

button {
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring-strong);
  border-radius: var(--rad-sm);
}

/* ---------- editorial vocabulary ---------- */

.kicker {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 10.5px;
  font-weight: var(--fw-semibold);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-4);
}
.kicker.live::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: var(--rad-pill);
  background: var(--live);
  box-shadow: 0 0 0 2px rgba(230, 57, 70, 0.10), 0 0 4px 0 var(--live-glow);
  flex: none;
}

.hairline {
  width: 36px;
  height: 1px;
  background: var(--line-stroke);
  opacity: 0.5;
  margin: var(--sp-4) auto var(--sp-5);
}

.signature {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  font-size: 10.5px;
  font-weight: var(--fw-semibold);
  letter-spacing: 0.18em;
  color: var(--ink-3);
  text-transform: lowercase;
}
.signature::before,
.signature::after {
  content: "";
  width: 18px; height: 1px;
  background: var(--line-stroke);
  opacity: 0.5;
  flex: none;
}

.medallion {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: var(--rad-pill);
  background: var(--line-color, #1a1a1a);
  color: var(--medallion-text, #ffffff);
  font-size: 13px;
  font-weight: var(--fw-bold);
  letter-spacing: 0.01em;
  font-feature-settings: "tnum" 1;
  flex: none;
  box-shadow: var(--shadow-medallion);
}
.medallion.sm { width: 26px; height: 26px; font-size: 10.5px; }

.pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  font-size: 13.5px;
  font-weight: var(--fw-medium);
  border: 1px solid transparent;
  background: var(--ink-rule);
  color: var(--ink-4);
  border-radius: var(--rad-pill);
  cursor: not-allowed;
  transition:
    background var(--dur-base) var(--ease-out),
    color var(--dur-base) var(--ease-out),
    border-color var(--dur-base) var(--ease-out),
    transform var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-base) var(--ease-out);
}
.pill-btn:not([disabled]) {
  background: #1a1a1a;
  color: #ffffff;
  border-color: #1a1a1a;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 6px 16px rgba(0, 0, 0, 0.10);
}
.pill-btn:not([disabled]):hover {
  background: #000000;
  transform: translateY(-1px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 10px 22px rgba(0, 0, 0, 0.14);
}
.pill-btn:not([disabled]):active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 4px 10px rgba(0, 0, 0, 0.10);
}
.pill-btn:focus-visible {
  outline: none;
  border-color: var(--ink-1);
  box-shadow: 0 0 0 3px var(--focus-ring-strong), 0 6px 16px rgba(0, 0, 0, 0.10);
}

.pill-btn.secondary {
  background: transparent;
  color: var(--ink-3);
  border-color: var(--ink-border);
  box-shadow: none;
  cursor: pointer;
}
.pill-btn.secondary:hover {
  color: var(--ink-1);
  border-color: var(--ink-1);
  transform: none;
  box-shadow: none;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border-radius: var(--rad-pill);
  border: 1px solid var(--ink-border-soft);
  background: var(--bg-card);
  color: var(--ink-3);
  cursor: pointer;
  box-shadow: var(--shadow-button);
  transition: color var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out);
}
.icon-btn:hover { color: var(--ink-1); border-color: var(--ink-border); }
.icon-btn:focus-visible {
  outline: none;
  color: var(--ink-1);
  border-color: var(--ink-border);
  box-shadow: 0 0 0 2px var(--focus-ring), var(--shadow-button);
}

/* ---------- app shell ---------- */

#app {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
}

/* top strip */
#top-strip {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: max(var(--sp-3), env(safe-area-inset-top)) var(--sp-4) var(--sp-3);
  z-index: 20;
  background: linear-gradient(to bottom, var(--bg) 65%, rgba(248, 248, 248, 0));
}

/* progress row — a glanceable dot track, not a fraction to parse */
#progress-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
#progress-dots {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
}
.progress-dot {
  width: 6px; height: 6px;
  border-radius: var(--rad-pill);
  background: var(--ink-border-soft);
  flex: none;
}
.progress-dot.filled { background: var(--ink-3); }
#progress-indicator {
  font-size: 10.5px;
  font-weight: var(--fw-semibold);
  color: var(--ink-4);
  font-feature-settings: "tnum" 1;
  letter-spacing: 0.02em;
  white-space: nowrap;
  flex: none;
}

/* line header — the masthead: this is the line you're drawing */
#line-header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
#line-header .medallion {
  width: 44px; height: 44px;
  font-size: 17px;
}
#line-header .line-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.line-kicker { font-size: 9.5px; }
#line-header .line-name {
  font-size: 19px;
  font-weight: var(--fw-bold);
  color: var(--ink-1);
  line-height: 1.15;
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* utility row — secondary actions, demoted below the masthead */
#utility-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}
.hard-mode-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  padding: 5px 17px 5px 9px;
  color: var(--ink-3);
  background: var(--bg-card);
  border: 1px solid var(--ink-border-soft);
  border-radius: 2px;
  box-shadow: var(--shadow-button);
  cursor: pointer;
  overflow: hidden;
  text-align: left;
  transition:
    color var(--dur-base) var(--ease-out),
    background var(--dur-base) var(--ease-out),
    border-color var(--dur-base) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
}
.hard-mode-toggle::after {
  content: "";
  position: absolute;
  top: -1px;
  right: -1px;
  width: 10px;
  height: 10px;
  background: linear-gradient(225deg, var(--hard-accent) 0 48%, transparent 50%);
  opacity: 0.42;
  transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
}
.hard-mode-toggle:hover { color: var(--ink-1); border-color: var(--ink-border); }
.hard-mode-toggle:active { transform: translateY(1px); }
.hard-mode-toggle[disabled] { opacity: 0.5; cursor: default; transform: none; }
.hard-toggle-stripes {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  width: 25px;
  height: 22px;
  flex: none;
  padding: 2px 1px;
  border-bottom: 1px solid var(--ink-border);
  transform: skewX(-11deg);
}
.hard-toggle-stripes span {
  width: 5px;
  background: var(--ink-3);
  border-radius: 1px 1px 0 0;
  transition: height var(--dur-base) var(--ease-out), background var(--dur-base) var(--ease-out);
}
.hard-toggle-stripes span:nth-child(1) { height: 7px; }
.hard-toggle-stripes span:nth-child(2) { height: 12px; }
.hard-toggle-stripes span:nth-child(3) { height: 18px; }
.hard-toggle-copy { display: flex; flex-direction: column; gap: 1px; }
.hard-toggle-main {
  color: var(--ink-1);
  font-size: 11px;
  font-weight: var(--fw-semibold);
  line-height: 1.1;
}
.hard-mode-toggle.active {
  color: var(--hard-accent);
  background: color-mix(in srgb, var(--hard-accent) 5%, var(--bg-card));
  border-color: var(--hard-accent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--hard-accent) 18%, transparent);
}
.hard-mode-toggle.active::after { opacity: 1; transform: scale(1.35); }
.hard-mode-toggle.active .hard-toggle-stripes { border-bottom-color: var(--hard-accent); }
.hard-mode-toggle.active .hard-toggle-stripes span { background: var(--hard-accent); }
body[data-difficulty="hard"] #top-strip {
  background: linear-gradient(to bottom, var(--bg) 72%, color-mix(in srgb, var(--bg) 0%, transparent));
}
body[data-difficulty="hard"] .line-kicker {
  color: var(--hard-accent);
  text-transform: none;
}
body[data-difficulty="hard"] #line-header .medallion {
  outline: 1px solid rgba(0, 0, 0, 0.58);
  outline-offset: 3px;
}
body[data-difficulty="hard"] .progress-dot {
  border-radius: 1px;
  border: 1px solid var(--ink-border);
  background: transparent;
}
body[data-difficulty="hard"] .progress-dot.filled {
  background: var(--hard-accent);
  border-color: var(--hard-accent);
}

/* borrar — a ghost icon-button until there's a stroke worth erasing,
   then it comes alive: solid, dark, unmistakable. Visible exactly when
   it matters, quiet the rest of the time. */
#borrar-btn {
  width: 30px; height: 30px;
  opacity: 0.4;
  transition:
    opacity var(--dur-base) var(--ease-out),
    background var(--dur-base) var(--ease-out),
    color var(--dur-base) var(--ease-out),
    border-color var(--dur-base) var(--ease-out),
    transform var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-base) var(--ease-out);
}
#borrar-btn[disabled] { cursor: default; pointer-events: none; }
#borrar-btn.active {
  opacity: 1;
  background: #1a1a1a;
  color: #ffffff;
  border-color: #1a1a1a;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 4px 10px rgba(0, 0, 0, 0.10);
}
#borrar-btn.active:hover {
  background: #000000;
  transform: translateY(-1px);
}

/* map */
#map-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
#map {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}
#map path, #map circle, #map line {
  vector-effect: non-scaling-stroke;
}
.valle-fill { fill: var(--map-fill); stroke: none; }
/* Alcaldía boundaries — present, but quiet. A subtle memory hint, not a giveaway. */
.alc-border {
  fill: none;
  stroke: var(--alc-stroke);
  stroke-width: 0.5;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}
.anchor-dot { fill: var(--ink-4); }
.anchor-label {
  font-size: 9.5px;
  font-weight: var(--fw-medium);
  fill: var(--ink-4);
  letter-spacing: 0.02em;
}
.truth-path {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.drawn-path {
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.userdraw-path {
  fill: none;
  stroke-width: 2.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* bottom cta */
#bottom-cta {
  flex: none;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5) max(var(--sp-5), env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 65%, rgba(248, 248, 248, 0));
}
body[data-difficulty="hard"] #bottom-cta {
  background: linear-gradient(to top, var(--bg) 72%, color-mix(in srgb, var(--bg) 0%, transparent));
}
#bottom-cta .cta-row {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  width: 100%;
  justify-content: center;
}
#listo-btn { min-width: 168px; }

/* per-line reveal */
#reveal-banner {
  position: absolute;
  top: var(--sp-4);
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-4);
  background: var(--bg-card);
  border: 1px solid var(--ink-border-soft);
  border-radius: var(--rad-pill);
  box-shadow: var(--shadow-tooltip);
  font-size: 13px;
  color: var(--ink-2);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
  z-index: 30;
}
#reveal-banner.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
#reveal-score {
  font-weight: var(--fw-bold);
  font-feature-settings: "tnum" 1;
  color: var(--ink-1);
}
#reveal-score.good { color: var(--ready); }
.reveal-hard-label {
  padding-right: var(--sp-3);
  border-right: 1px solid var(--hard-accent);
  color: var(--hard-accent);
  font-size: 9px;
  font-weight: var(--fw-bold);
  letter-spacing: 0.12em;
  text-transform: none;
}
#reveal-next {
  border: none;
  background: none;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: var(--fw-semibold);
  letter-spacing: 0.04em;
  text-transform: lowercase;
  cursor: pointer;
  padding: 4px 8px;
}
#reveal-next:hover { color: var(--ink-1); }

/* ---------- final flip card ---------- */

#final-sheet {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  background: var(--bg);
}
#final-sheet[hidden] { display: none; }
body[data-difficulty="hard"] #final-sheet {
  background:
    linear-gradient(var(--hard-accent), var(--hard-accent)) top / 100% 4px no-repeat,
    var(--bg);
}

.flip-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  height: min(88dvh, 720px);
  perspective: 1400px;
}
.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform var(--dur-slow) var(--ease-in-out);
  transform-style: preserve-3d;
}
.flip-card.flipped .flip-card-inner {
  transform: rotateY(180deg);
}
.flip-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  backface-visibility: hidden;
  background: var(--bg-card);
  border: 1px solid var(--ink-border-soft);
  border-radius: var(--rad-lg);
  box-shadow: var(--shadow-panel);
  overflow: hidden;
}
.flip-face-back { transform: rotateY(180deg); }

.flip-face-front {
  padding: var(--sp-6) var(--sp-5) var(--sp-5);
  display: flex;
  flex-direction: column;
  text-align: center;
}

/* the share card itself — brand, map, score, url. this is the whole point:
   it's designed to be screenshotted or exported as-is, so nothing here is
   UI chrome (buttons live in .flip-face-actions, outside it). */
.share-card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.share-card-brand {
  font-size: 25px;
  font-weight: var(--fw-bold);
  letter-spacing: 0.01em;
  color: var(--ink-1);
  margin-bottom: var(--sp-3);
}
.hard-mode-seal {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  min-width: 148px;
  margin: -2px 0 var(--sp-3);
  padding: 5px 14px 4px;
  color: var(--hard-accent);
  border: 1.5px solid currentColor;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--hard-accent) 12%, transparent);
  transform: rotate(-1deg);
  text-transform: none;
}
.hard-mode-seal[hidden] { display: none; }
.hard-mode-seal span {
  font-size: 11px;
  font-weight: var(--fw-bold);
  letter-spacing: 0.12em;
}
body[data-difficulty="hard"] .flip-face {
  border-color: rgba(0, 0, 0, 0.34);
  box-shadow:
    0 0 0 3px var(--bg),
    0 0 0 4px var(--hard-accent),
    var(--shadow-panel);
}
body[data-difficulty="hard"] .flip-face-front::before,
body[data-difficulty="hard"] .flip-face-back::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid var(--ink-border-soft);
  pointer-events: none;
}
body[data-difficulty="hard"] .share-card,
body[data-difficulty="hard"] .flip-face-actions,
body[data-difficulty="hard"] .results-table,
body[data-difficulty="hard"] .flip-face-back > .kicker,
body[data-difficulty="hard"] .flip-face-back > .flip-hint {
  position: relative;
  z-index: 1;
}

/* Each medallion is a clock face: the branded sector is the line score and
   the remaining sector stays neutral gray. */
.share-card-medallions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-bottom: var(--sp-3);
}
.share-card-medallions .medallion {
  border: 0;
  background: conic-gradient(
    from -90deg,
    var(--line-color) 0 var(--line-score),
    #d4d4d4 var(--line-score) 100%
  );
  box-shadow: var(--shadow-medallion);
  text-shadow: var(--medallion-text-shadow, none);
}
.share-card-medallions .medallion.undrawn {
  --line-color: #d4d4d4;
  --line-score: 0%;
  --medallion-text: var(--ink-4);
  color: var(--medallion-text);
}

#final-map-wrap {
  flex: 1;
  min-height: 0;
  width: 100%;
  margin: 0 calc(-1 * var(--sp-5));
  background: var(--bg);
}
body[data-difficulty="hard"] #final-map-wrap {
  border-top: 1px solid var(--hard-accent);
  border-bottom: 1px solid rgba(0, 0, 0, 0.52);
}
#final-map { width: 100%; height: 100%; display: block; }
#final-map path.final-line {
  vector-effect: non-scaling-stroke;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.share-card-score {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  width: 100%;
  margin-top: var(--sp-3);
  line-height: 1;
}
.share-card-score span:first-child {
  font-size: 50px;
  font-weight: var(--fw-bold);
  color: var(--ink-1);
  font-feature-settings: "tnum" 1;
}
.share-card-score-den {
  font-size: 21px;
  font-weight: var(--fw-semibold);
  color: var(--ink-4);
  margin-left: 1px;
}
.share-card-score::after {
  content: attr(data-tier);
  flex-basis: 100%;
  margin-top: var(--sp-1);
  font-size: 12px;
  font-weight: var(--fw-semibold);
  line-height: 1.2;
  color: var(--ink-4);
}
.share-card-url {
  margin-top: var(--sp-1);
  font-size: 10px;
  letter-spacing: 0.03em;
  color: var(--ink-4);
}

.flip-face-actions {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  margin-top: var(--sp-4);
  flex: none;
}
.flip-hint {
  font-size: 11px;
  color: var(--ink-4);
  text-transform: lowercase;
  cursor: pointer;
  border: none;
  background: none;
  padding: var(--sp-1);
}

/* results table (flip back) */
.flip-face-back {
  padding: var(--sp-6) var(--sp-5) var(--sp-5);
  text-align: left;
}
body[data-difficulty="hard"] .flip-face-back > .kicker {
  color: var(--hard-accent);
  text-transform: none;
}
.results-table {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: var(--sp-3);
}
.results-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-1);
  border-bottom: 1px solid var(--ink-rule);
}
.results-row.undrawn { opacity: 0.55; }
.results-row .line-name {
  flex: 1;
  font-size: 12.5px;
  font-weight: var(--fw-medium);
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.results-row.undrawn .line-name { color: var(--ink-4); }
.results-row .line-score {
  font-size: 14px;
  font-weight: var(--fw-bold);
  font-feature-settings: "tnum" 1;
  min-width: 30px;
  text-align: right;
}
.results-row.undrawn .line-score { color: var(--ink-4); font-weight: var(--fw-regular); }

/* ---------- welcome modal ---------- */

#about-modal, #confirm-end-modal, #confirm-mode-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 150;
  padding: var(--sp-4);
}
#about-modal[hidden], #confirm-end-modal[hidden], #confirm-mode-modal[hidden] { display: none; }
.about-backdrop {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease-out);
}
#about-modal.visible .about-backdrop,
#confirm-end-modal.visible .about-backdrop,
#confirm-mode-modal.visible .about-backdrop { opacity: 1; }
.about-content {
  position: relative;
  max-width: 440px;
  width: 100%;
  max-height: calc(100vh - 2 * var(--sp-4));
  overflow-y: auto;
  padding: 32px 32px 26px;
  background: var(--bg-card);
  border: 1px solid var(--ink-border-soft);
  border-radius: var(--rad-md);
  box-shadow: var(--shadow-panel);
  text-align: center;
  opacity: 0;
  transform: translateY(8px) scale(0.985);
  transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
}
#about-modal.visible .about-content,
#confirm-end-modal.visible .about-content,
#confirm-mode-modal.visible .about-content {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.about-title {
  font-size: 26px;
  font-weight: var(--fw-bold);
  color: var(--ink-1);
  text-transform: lowercase;
  margin-bottom: var(--sp-3);
}
.about-body {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-2);
  margin: 0 0 var(--sp-2);
}
.about-body a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
.about-body a:hover { color: var(--ink-1); }
.about-body + .about-body { padding-top: var(--sp-2); }
.about-start-btn { width: 100%; margin-top: var(--sp-2); }

.confirm-end-actions {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
}
.confirm-end-actions .pill-btn { width: 100%; }
#confirm-end-body strong,
#confirm-mode-body strong { color: var(--ink-1); font-weight: var(--fw-semibold); }
.about-author {
  margin-top: var(--sp-6);
}
.about-author-name {
  font-size: 12.5px;
  font-weight: var(--fw-semibold);
  color: var(--ink-1);
  text-transform: lowercase;
}
.about-author-links {
  margin-top: var(--sp-1);
  font-size: 11.5px;
  color: var(--ink-3);
}
.about-author-links a { color: inherit; text-decoration: none; }
.about-author-links a:hover { color: var(--ink-1); }

/* ---------- misc ---------- */

noscript {
  display: block;
  padding: var(--sp-6);
  text-align: center;
  font-size: 14px;
  color: var(--ink-2);
}

@media (max-width: 380px) {
  .global-score { font-size: 44px; }
  #listo-btn { min-width: 140px; }
  #line-header .medallion { width: 38px; height: 38px; font-size: 15px; }
  #line-header .line-name { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  * , *::before, *::after {
    transition-duration: 80ms !important;
    animation-duration: 80ms !important;
  }
  .flip-card-inner { transition: none !important; }
  .flip-card.flipped .flip-card-inner { transform: rotateY(180deg); }
}
