/* Crack the Code - a Bulls & Cows logic game.
   Mobile-first. Uses the Game On Family brand palette (green / yellow). */

:root {
  --green-dark: #157623;
  --green: #9bca3e;
  --green-olive: #83a83d;
  --bg: #dde5ed;
  --accent: #ffb920;
  --rust: #de6739;
  --teal: #3abbc0;
  --ink: #2f2c28;
  --ink-soft: #5e5c5e;
  --card: #ffffff;
  --line: #d7dde4;
  --exact: #157623;   /* right spot */
  --close: #ffb920;   /* right symbol, wrong spot */
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.10);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Arimo', system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}

#app {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 1rem 2rem;
  min-height: 100vh;
}

.hidden { display: none !important; }

/* ---------- Header ---------- */
.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.85rem 0 0.35rem;
}
.game-title-wrap { position: relative; }
.game-title-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  user-select: none;
}
.game-title-heading {
  margin: 0;
  font-family: 'League Spartan', sans-serif;
  font-weight: 800;
  font-size: 1.6rem;
  letter-spacing: -0.01em;
  color: var(--green-dark);
}
.game-title-chevron { color: var(--ink-soft); font-size: 0.8rem; }
.game-title-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 0.35rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  min-width: 190px;
  padding: 0.35rem;
  z-index: 30;
}
.game-title-dropdown[aria-hidden="true"] { display: none; }
.game-nav-link {
  display: block;
  padding: 0.55rem 0.7rem;
  border-radius: 7px;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.95rem;
}
.game-nav-link:hover { background: var(--bg); }
.header-right { display: flex; align-items: center; }

/* ---------- Mode pills ---------- */
.mode-row {
  display: flex;
  gap: 8px;
  margin: 0.25rem 0 0.85rem;
}
.mode-pill {
  flex: 1 1 0;
  padding: 8px 12px;
  border: 2px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  font-family: 'League Spartan', sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.mode-pill:hover { border-color: var(--green); }
.mode-pill.is-active {
  background: var(--green);
  border-color: var(--green);
  color: var(--green-dark);
}

/* ---------- Setup ---------- */
.setup-tagline {
  font-size: 1rem;
  line-height: 1.45;
  color: var(--ink);
  margin: 0.2rem 0 1rem;
  text-align: center;
}
.preset-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.preset-btn {
  padding: 0.65rem 0.5rem;
  border: 2px solid var(--line);
  background: var(--card);
  border-radius: var(--radius-sm);
  font-family: 'Arimo', sans-serif;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s ease;
}
.preset-btn.is-active {
  border-color: var(--green);
  background: #f2f8e6;
  color: var(--green-dark);
}

.custom-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.5rem 1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}
.cfg-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
}
.cfg-field:last-of-type { border-bottom: none; }
.cfg-field--toggle { align-items: center; }
.cfg-label {
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.cfg-hint {
  font-weight: 400;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.style-choices { display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: flex-end; }
.style-choice {
  padding: 0.4rem 0.7rem;
  border: 2px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink-soft);
  cursor: pointer;
}
.style-choice.is-active {
  border-color: var(--green-dark);
  color: var(--green-dark);
  background: #f2f8e6;
}

.stepper { display: flex; align-items: center; gap: 0.6rem; }
.stepper-value {
  min-width: 1.8rem;
  text-align: center;
  font-weight: 800;
  font-size: 1.15rem;
  font-family: 'League Spartan', sans-serif;
}
.step-btn {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  border: 2px solid var(--green-dark);
  background: var(--card);
  color: var(--green-dark);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.step-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.toggle {
  width: 3.2rem;
  height: 1.85rem;
  border-radius: 999px;
  border: none;
  background: var(--line);
  position: relative;
  cursor: pointer;
  transition: background 0.15s ease;
  flex-shrink: 0;
}
.toggle[aria-checked="true"] { background: var(--green-dark); }
.toggle-knob {
  position: absolute;
  top: 0.2rem;
  left: 0.2rem;
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s ease;
}
.toggle[aria-checked="true"] .toggle-knob { transform: translateX(1.35rem); }

.difficulty-readout {
  margin: 0.25rem 0 0;
  padding-top: 0.7rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
  text-align: center;
}

/* ---------- Buttons ---------- */
.primary-btn {
  display: block;
  width: 100%;
  padding: 0.95rem 1rem;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--green);
  color: var(--green-dark);
  font-family: 'League Spartan', sans-serif;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(21, 118, 35, 0.35);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.primary-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(21, 118, 35, 0.35); }
.primary-btn:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.ghost-btn {
  display: block;
  width: 100%;
  margin-top: 0.6rem;
  padding: 0.6rem;
  border: none;
  background: none;
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: underline;
}

/* ---------- Setter / guess shared ---------- */
.setter-title, .setter-sub { text-align: center; }
.setter-title {
  font-family: 'League Spartan', sans-serif;
  font-size: 1.4rem;
  color: var(--green-dark);
  margin: 0.5rem 0 0.3rem;
}
.setter-sub { color: var(--ink-soft); margin: 0 0 1.1rem; font-size: 0.95rem; }

.code-slots {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.slot {
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-sm);
  border: 2px dashed var(--line);
  background: var(--card);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  cursor: pointer;
  transition: border-color 0.12s ease;
}
.slot.is-active { border-style: solid; border-color: var(--green-dark); }
.slot.is-filled { border-style: solid; border-color: var(--line); }

/* Symbol faces */
.sym {
  width: 2.3rem;
  height: 2.3rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  font-weight: 800;
  font-family: 'League Spartan', sans-serif;
  line-height: 1;
}
.sym--color { border: 2px solid rgba(0,0,0,0.12); }
.sym--glyph { color: var(--ink); }

.palette {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem;
  margin-bottom: 1.1rem;
  padding: 0.85rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.palette-btn {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  border: 2px solid transparent;
  background: none;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.palette-btn:active { transform: scale(0.92); }
/* Exactly 10 keys (the digits): one row instead of two. */
.palette:has(> .palette-btn:nth-child(10):last-child) {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 0.15rem;
}
.palette:has(> .palette-btn:nth-child(10):last-child) .palette-btn { width: 100%; height: 2.6rem; }
.palette:has(> .palette-btn:nth-child(10):last-child) .sym { width: 100%; }

/* ---------- Game ---------- */
.game-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.status-mode {
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
  background: var(--green-dark);
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
}
.status-count {
  font-family: 'League Spartan', sans-serif;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--ink);
}

.current-guess {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 0.85rem 0.85rem;
  box-shadow: var(--shadow);
  margin-bottom: 0.85rem;
}
.current-guess .palette { box-shadow: none; border: none; padding: 0.6rem 0 0.2rem; margin-bottom: 0.6rem; }
.current-guess .code-slots { margin-bottom: 0.2rem; }

.legend {
  display: flex;
  justify-content: center;
  gap: 1.1rem;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin-bottom: 0.85rem;
}
.legend-item { display: inline-flex; align-items: center; gap: 0.35rem; }

/* Feedback shown as two labeled COUNT CHIPS, never a row of position-ordered
   pegs (which falsely implied "peg 1 = slot 1"). Green check = right spot;
   amber half = right color, wrong spot. */
.tally {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  justify-content: center;
  padding: 0.24rem 0.5rem;
  border-radius: 999px;
  font-family: 'League Spartan', sans-serif;
  font-weight: 800;
  font-size: 1rem;
  line-height: 1;
}
.tally--spot { background: var(--green-dark); color: #fff; }
.tally--color { background: var(--accent); color: var(--ink); }
.tally.is-zero { background: #eef1f4; color: #aeb4bc; }
.tally-ico { font-size: 0.95rem; }

/* History rows (newest on top) */
.history { display: flex; flex-direction: column; gap: 0.5rem; }
.hrow {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.65rem;
  animation: pop 0.18s ease;
}
@keyframes pop { from { transform: scale(0.96); opacity: 0.4; } to { transform: scale(1); opacity: 1; } }
.hrow-num {
  font-family: 'League Spartan', sans-serif;
  font-weight: 800;
  color: var(--ink-soft);
  font-size: 0.85rem;
  min-width: 1.4rem;
  text-align: center;
}
.hrow-guess { display: flex; gap: 0.3rem; flex: 1; flex-wrap: wrap; }
.hrow-guess .sym { width: 1.9rem; height: 1.9rem; font-size: 1.05rem; }
.hrow-tallies { display: inline-flex; gap: 0.4rem; flex-shrink: 0; }
.hrow-tallies .tally { min-width: 2.9rem; }

/* ---------- Overlays ---------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(47, 44, 40, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  z-index: 50;
}
.overlay-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.5rem 1.25rem;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
}
.overlay-emoji { font-size: 3rem; line-height: 1; }
.overlay-title {
  font-family: 'League Spartan', sans-serif;
  font-size: 1.6rem;
  color: var(--green-dark);
  margin: 0.4rem 0 0.3rem;
}
.overlay-detail { color: var(--ink); margin: 0 0 1rem; line-height: 1.4; }
.reveal-code { display: flex; justify-content: center; gap: 0.4rem; margin-bottom: 1.1rem; flex-wrap: wrap; }

/* ---------- About ---------- */
.about { margin-top: 1.5rem; }
.about-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: none;
  border: none;
  border-top: 1px solid var(--line);
  padding: 1rem 0.2rem;
  font-family: 'League Spartan', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink);
  cursor: pointer;
}
.about-chevron { transition: transform 0.15s ease; }
.about-toggle[aria-expanded="true"] .about-chevron { transform: rotate(180deg); }
.about-content { display: none; padding: 0 0.2rem 0.5rem; }
.about-content.is-open { display: block; }
.about-content p { line-height: 1.55; color: var(--ink); font-size: 0.95rem; }

/* ---------- Footer ---------- */
.footer {
  max-width: 560px;
  margin: 1rem auto 0;
  padding: 1rem;
  text-align: center;
}
.footer-links { display: flex; justify-content: center; gap: 1.25rem; flex-wrap: wrap; }
.footer-links a { color: var(--green-dark); font-weight: 700; text-decoration: none; font-size: 0.9rem; }
.footer-links a:hover { text-decoration: underline; }

/* ---------- Robot commentary ---------- */
.commentary {
  display: flex;
  align-items: flex-end;
  gap: 0.6rem;
  margin: 0.2rem 0 1rem;
}
.cpu-character {
  font-size: 2.5rem;
  line-height: 1;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}
.cpu-character.is-talking { transform: translateY(-3px) scale(1.12) rotate(-4deg); }
.cpu-bubble {
  position: relative;
  background: var(--card);
  border: 2px solid var(--green-dark);
  border-radius: 14px;
  padding: 0.6rem 0.85rem;
  flex: 1;
  box-shadow: var(--shadow);
}
.cpu-bubble::before {
  content: '';
  position: absolute;
  left: -9px;
  bottom: 12px;
  width: 0; height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-right: 9px solid var(--green-dark);
}
.cpu-bubble p {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.35;
}
.cpu-bubble.is-pop { animation: bubblePop 0.25s ease; }
@keyframes bubblePop {
  0% { transform: scale(0.96); }
  60% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

/* ---------- Board panel: covered code + your guess, same boxes, in line ---------- */
.board-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 0.85rem 0.85rem;
  box-shadow: var(--shadow);
  margin-bottom: 0.85rem;
}
.row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.row-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.board-sep { height: 1px; background: var(--line); margin: 0.9rem 0; }
.board-panel .palette { box-shadow: none; border: none; padding: 0.7rem 0 0.2rem; margin-bottom: 0.6rem; }

/* Covered secret slots share the EXACT dimensions of the guess slots. */
.secret-slot {
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-sm);
  background: var(--green-dark);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'League Spartan', sans-serif;
  font-weight: 800;
  font-size: 1.4rem;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18);
}
.secret-slot.is-revealed {
  background: #f2f8e6;
  box-shadow: none;
  border: 2px solid var(--green);
  animation: flipIn 0.4s ease;
}
@keyframes flipIn {
  from { transform: rotateY(90deg); }
  to { transform: rotateY(0); }
}
.secret-slot.is-revealed .sym { width: 2.3rem; height: 2.3rem; font-size: 1.35rem; }

/* ---------- Settings summary + panel ---------- */
.settings-summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.55rem 0.85rem;
  margin-bottom: 0.85rem;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  cursor: pointer;
  font-family: 'Arimo', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--ink);
}
.settings-summary .gear { font-size: 1rem; }
.settings-summary #settingsSummaryText { flex: 1; text-align: left; color: var(--ink-soft); }
.settings-chevron { transition: transform 0.15s ease; color: var(--ink-soft); }
.settings-summary[aria-expanded="true"] .settings-chevron { transform: rotate(180deg); }
.settings-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem 1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}
.settings-panel .preset-row { margin-bottom: 0.5rem; }
.settings-panel .custom-panel { box-shadow: none; border: none; padding: 0; margin-bottom: 0.5rem; }

/* ---------- 2 Players history: a column per player, a row per round ---------- */
.duel-history {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.dh-row {
  display: grid;
  grid-template-columns: 1.6rem 1fr 1fr;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
.dh-row:last-child { border-bottom: none; }
.dh-head { background: #f6f8fa; padding: 0.35rem 0; }
.dh-round {
  font-family: 'League Spartan', sans-serif;
  font-weight: 800;
  font-size: 0.8rem;
  color: var(--ink-soft);
  text-align: center;
}
.dh-name {
  justify-self: center;
  max-width: 92%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: 'League Spartan', sans-serif;
  font-weight: 800;
  font-size: 0.8rem;
  color: #fff;
  background: #1f8a8f;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
}
.dh-name--p1 { background: #c4532a; }
.dh-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.45rem 0.2rem;
  min-width: 0;
  border-left: 1px solid var(--line);
  animation: pop 0.18s ease;
}
.dh-cell--empty { align-self: stretch; animation: none; }
.dh-guess { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.1rem; }
.dh-guess .sym { width: 1.45rem; height: 1.45rem; font-size: 0.95rem; }
.dh-tallies { display: flex; gap: 0.25rem; }
.dh-tallies .tally { font-size: 0.8rem; padding: 0.15rem 0.38rem; }

/* ---------- Play with: one-tap style picker ---------- */
.quick-wrap { margin: 1.1rem 0 0.85rem; }
.daily-cta { text-align: center; margin: 0 0 0.85rem; }
.daily-cta .ghost-pill { margin: 0; text-decoration: none; }
.quick-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.4rem;
  text-align: center;
}
.quick-lead {
  display: block;
  font-size: 0.88rem;
  color: var(--ink-soft);
  margin-bottom: 0.45rem;
  text-align: center;
}
.quick-lead a { color: var(--green-dark); font-weight: 700; }
.quick-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.4rem; }
a.quick-btn { text-decoration: none; display: inline-block; }
.quick-btn {
  padding: 0.45rem 0.75rem;
  border: 2px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  font-family: 'Arimo', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
}
.quick-btn.is-active { border-color: var(--green-dark); color: var(--green-dark); background: #f2f8e6; }
.quick-btn--surprise { border-style: dashed; border-color: var(--accent); }
.preset-btn--wide { grid-column: 1 / -1; }

/* ---------- How to play extras ---------- */
.about-h {
  font-family: 'League Spartan', sans-serif;
  font-size: 1.15rem;
  color: var(--green-dark);
  margin: 1.3rem 0 0.2rem;
}
.about-h:first-child { margin-top: 0.2rem; }
.about-h3 { font-size: 0.98rem; margin: 1rem 0 0.1rem; color: var(--ink); }
.ghost-pill {
  display: inline-block;
  margin: 0 0 0.6rem;
  padding: 0.5rem 0.95rem;
  border: 2px solid var(--green-dark);
  border-radius: 999px;
  background: var(--card);
  color: var(--green-dark);
  font-family: 'Arimo', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
}
/* Paper scoresheet: lined notebook look */
.paper {
  width: 100%;
  max-width: 320px;
  margin: 0.3rem 0 0.6rem;
  border-collapse: collapse;
  background: #fffdf5;
  border: 1px solid #e6dfc8;
  border-left: 3px solid #f2a1a1;
  font-family: 'Trocchi', Georgia, serif;
  font-size: 1rem;
}
.paper th, .paper td { padding: 0.4rem 0.7rem; border-bottom: 1px solid #c9dbef; text-align: center; }
.paper th { font-family: 'Arimo', sans-serif; font-size: 0.8rem; color: var(--ink-soft); }
.paper td:first-child, .paper th:first-child { text-align: left; letter-spacing: 0.08em; }
.paper-win td { font-weight: 700; color: var(--green-dark); }

/* ---------- Clues setting ---------- */
.cfg-field--clues {
  flex-direction: column;
  align-items: stretch;
  padding-top: 0;
  margin-bottom: 0.75rem;
}
.cfg-field--clues .style-choices { justify-content: flex-start; }

/* ---------- 2 Players: name on the setter screen ---------- */
.setter-name-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 1rem;
}
.setter-name-label { font-weight: 700; font-size: 0.95rem; flex-shrink: 0; }
.setter-name {
  flex: 1;
  min-width: 0;
  padding: 0.6rem 0.75rem;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: 'Arimo', sans-serif;
  font-size: 1rem;
  color: var(--ink);
  background: var(--card);
}
.setter-name:focus { outline: none; border-color: var(--green-dark); }

/* ---------- 2 Players scoreboard (after the TikTok overlay) ---------- */
.duel-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}
.duel-board[hidden],
.legend-item[hidden] { display: none; }
.duel-card {
  --p: #1f8a8f;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 0.6rem 0.45rem;
  text-align: center;
  min-width: 0;
}
.duel-card--p1 { --p: #c4532a; }
.duel-card.is-target { border-color: var(--p); box-shadow: var(--shadow); }
.duel-name {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: var(--p);
  color: #fff;
  font-family: 'League Spartan', sans-serif;
  font-weight: 800;
  font-size: 0.9rem;
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  margin-bottom: 0.45rem;
}
.duel-lock { display: flex; justify-content: center; flex-wrap: wrap; gap: 0.25rem; margin-bottom: 0.5rem; }
.duel-lock .secret-slot { width: 1.9rem; height: 1.9rem; font-size: 1rem; background: var(--p); }
.duel-lock .secret-slot.is-revealed { background: #f2f8e6; }
.duel-lock .secret-slot.is-revealed .sym { width: 1.5rem; height: 1.5rem; font-size: 0.95rem; }
.duel-last-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.3rem;
}
.duel-last-guess { display: flex; justify-content: center; flex-wrap: wrap; gap: 0.15rem; margin-bottom: 0.35rem; }
.duel-last-guess .sym { width: 1.5rem; height: 1.5rem; font-size: 1rem; }
.duel-last-tallies { display: flex; justify-content: center; gap: 0.3rem; }
.duel-last-tallies .tally { font-size: 0.85rem; padding: 0.2rem 0.4rem; }
.duel-last-empty { font-size: 0.82rem; color: #aeb4bc; padding: 0.3rem 0; }

.hrow-who {
  font-family: 'League Spartan', sans-serif;
  font-weight: 800;
  font-size: 0.78rem;
  color: #fff;
  background: #1f8a8f;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  max-width: 5.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 0;
}
.hrow-who--p1 { background: #c4532a; }

@media (min-width: 480px) {
  .game-title-heading { font-size: 1.85rem; }
  .slot,
  .secret-slot { width: 3.4rem; height: 3.4rem; }
}

/* ---------- End screen extras (main game and /daily/) ---------- */
.result-vs {
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.75rem;
  margin: 0 0 0.6rem;
  font-weight: 700;
}
/* Reserved height: the line arrives from the server after the result shows. */
.result-rank {
  min-height: 1.4em;
  margin: 0 0 0.9rem;
  font-weight: 700;
  color: var(--ink);
}
.result-stats { margin: 0.9rem 0 0; font-size: 0.9rem; color: var(--ink-soft); font-weight: 700; }
.result-next { margin: 0.5rem 0 0; font-size: 0.85rem; color: var(--ink-soft); }
/* The long daily result card scrolls inside the overlay on short phones. */
#resultOverlay .overlay-card { max-height: 92vh; overflow-y: auto; }

/* Comparison: crowd line (30+ finishers), robot headline, robot chips */
.result-compare { margin: 0 0 1rem; }
.cmp-crowd { margin: 0 0 0.35rem; font-weight: 700; color: var(--ink); }
.cmp-head {
  margin: 0 0 0.5rem;
  font-family: 'League Spartan', sans-serif;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--ink);
}
.bot-row { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0.35rem; }
.bot-label { width: 100%; font-size: 0.78rem; font-weight: 700; color: var(--ink-soft); }
.bot-chip {
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f6f8fa;
  font-weight: 800;
  font-size: 0.92rem;
  color: var(--ink);
}
.bot-chip .bot-name { font-weight: 600; color: var(--ink-soft); }
.bot-chip.is-beaten { background: var(--accent); border-color: var(--accent); }
.bot-chip.is-beaten .bot-name, .bot-chip.is-tied .bot-name { color: var(--ink); }
.bot-chip.is-tied { border-color: var(--ink); }

/* Your record: tiles, how today compares, guess-count bars */
.result-mine { margin: 1rem 0 0; }
.stat-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.3rem; }
.stat-tile { display: flex; flex-direction: column; align-items: center; }
.stat-v { font-family: 'League Spartan', sans-serif; font-weight: 800; font-size: 1.35rem; color: var(--ink); line-height: 1.1; }
.stat-l { font-size: 0.72rem; color: var(--ink-soft); font-weight: 700; }
.stat-personal { margin: 0.6rem 0 0; font-weight: 700; font-size: 0.92rem; color: var(--ink); }
.guess-dist { margin: 0.7rem 0 0; display: grid; gap: 3px; }
.dist-row { display: flex; align-items: center; gap: 0.4rem; }
.dist-k { width: 2.6rem; flex-shrink: 0; text-align: right; font-size: 0.78rem; font-weight: 700; color: var(--ink-soft); }
.dist-bar {
  min-width: 1.3rem;
  padding: 0.05rem 0.4rem;
  border-radius: 4px;
  background: #c9d1da;
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 800;
  text-align: right;
}
.dist-bar.is-today { background: var(--ink); color: #fff; }

.result-compare[hidden], .result-mine[hidden], .cmp-crowd[hidden],
.result-vs[hidden], .result-rank[hidden], .result-stats[hidden], .result-next[hidden],
.primary-btn[hidden], .ghost-btn[hidden], .daily-cta[hidden] { display: none; }

/* ---------- Sheets (share, settings) ---------- */
.sheet { text-align: left; max-height: 92vh; overflow-y: auto; }
.sheet .overlay-title { text-align: center; }
.sheet-field { display: block; margin-bottom: 0.9rem; }
.sheet-field .setter-name { width: 100%; margin-top: 0.3rem; }
.sheet-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.share-preview {
  margin: 0.3rem 0 0.8rem;
  padding: 0.7rem 0.8rem;
  background: #f6f8fa;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: 'Arimo', system-ui, sans-serif;
  font-size: 0.95rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}
.share-link-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}
.share-link {
  flex: 1;
  min-width: 0;
  font-size: 0.82rem;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.secondary-btn {
  flex-shrink: 0;
  padding: 0.5rem 0.8rem;
  border: 2px solid var(--green-dark);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--green-dark);
  font-family: 'Arimo', sans-serif;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
}
