/* assets/css/daily.css — Daily Tiebreak (/daily-tiebreak/). Loaded by daily-tiebreak/index.php
 * and daily-tiebreak/archive.php.
 *
 * The signature is the court scoreboard: each clue is a flap card that drops into place,
 * and the streak is set like a scoreboard numeral (it was the puzzle number until 2026-10-21). (A seam line across each card was
 * tried and removed 2026-10-19 because it made the values harder to read.)
 * --theme-* tokens only, so both themes come from the same rules.
 */

.dg {
  --dg-scoreboard: 'Barlow Condensed', 'Arial Narrow', Arial, sans-serif;
  --dg-gap: 4px;
  max-width: 660px;
  margin: 0 auto;
  padding: 0 0 24px;  /* the site's .container gives the side gutter */
  color: var(--theme-text);
}

/* ── Game bar: the page title and the game's tools, under the site navbar ── */
.dg-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--theme-border-subtle);
}
.dg .dg-bar__title {
  margin: 0;
  font-family: var(--dg-scoreboard);
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.dg-bar__tools { margin-left: auto; display: flex; gap: 2px; }

.dg .dg-icon {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--theme-text-muted);
  font-size: 1.05rem;
  text-decoration: none;  /* the past-puzzles icon is a link */
}
.dg .dg-icon:hover { background: var(--theme-surface-2); color: var(--theme-text); }
/* ── Challenge / archive banner ───────────────────────────────────────── */
.dg-challenge {
  margin: 16px 0 0;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--theme-accent-soft-border);
  background: var(--theme-accent-soft);
  color: var(--theme-text);
  font-size: 0.93rem;
  font-weight: 600;
}
.dg-challenge[hidden] { display: none; }
.dg .dg-challenge a { color: var(--theme-text); font-weight: 400; text-decoration: underline; text-underline-offset: 3px; }
.dg .dg-challenge a:hover { color: var(--theme-link-hover); }

/* ── Scoreboard plate ─────────────────────────────────────────────────── */
.dg-plate {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 0 18px;
}
/* The streak at stake, set like a scoreboard numeral. The flame lights (ball yellow) once it's live. */
.dg-streak { display: flex; flex-direction: column; gap: 6px; }
.dg-streak__num {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--dg-scoreboard);
  font-size: 4.6rem;
  font-weight: 800;
  line-height: 0.82;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.dg-streak__flame {
  font-size: 2.1rem;
  color: var(--theme-text-muted);
  transition: color 0.3s;
}
.dg-streak.is-live .dg-streak__flame { color: var(--accent-amber); }
.dg-streak__hash { font-size: 2.2rem; color: var(--theme-text-muted); }
.dg-streak__label {
  font-family: var(--dg-scoreboard);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--theme-text-muted);
}
.dg-plate__meta { text-align: right; padding-bottom: 4px; }
.dg-plate__left { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.dg-plate__count {
  font-family: var(--dg-scoreboard);
  font-size: 0.95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--theme-text);
}
.dg-plate__label {
  display: block;
  font-family: var(--dg-scoreboard);
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--theme-text-muted);
  margin-bottom: 8px;
}

/* Ten balls, one per guess left. The amber is the ball in the wordmark. */
.dg-balls {
  display: flex;
  gap: 5px;
  justify-content: flex-end;
  list-style: none;
  margin: 0;
  padding: 0;
}
.dg-ball {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--accent-amber);
  box-shadow: inset -2px -2px 0 rgba(var(--theme-shadow-rgb), 0.18);
  transition: background 0.3s, transform 0.3s;
}
.dg-ball.is-used {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--theme-border-strong);
  transform: scale(0.82);
}

/* ── Entry ────────────────────────────────────────────────────────────── */
.dg-entry {
  display: flex;
  gap: 8px;
}
.dg-entry[hidden] { display: none; }
.dg-entry__field { position: relative; flex: 1; min-width: 0; }
.dg .dg-entry__input {
  width: 100%;
  height: 54px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid var(--theme-input-border);
  background: var(--theme-input-bg);
  color: var(--theme-input-text);
  font-size: 1.05rem;
  font-family: var(--font-body);
}
.dg .dg-entry__input::placeholder { color: var(--theme-text-subtle); }
.dg .dg-entry__input:focus {
  outline: 2px solid var(--theme-accent-solid);
  outline-offset: 1px;
  border-color: transparent;
}
.dg .dg-entry__go {
  height: 54px;
  padding: 0 22px;
  border: 0;
  border-radius: 12px;
  background: var(--theme-accent-solid);
  color: var(--theme-on-accent);
  font-family: var(--dg-scoreboard);
  font-size: 1.15rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.dg .dg-entry__go:hover { background: var(--theme-accent-solid-hover); }

.dg-entry__input.is-shake { animation: dg-shake 0.42s cubic-bezier(.36,.07,.19,.97); }
@keyframes dg-shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-7px); }
  40%, 60% { transform: translateX(7px); }
}

.dg-hint {
  min-height: 2.6rem;
  padding: 8px 2px 0;
  font-size: 0.92rem;
  color: var(--theme-text-muted);
}
.dg-hint.is-error { color: var(--theme-danger); }
.dg .dg-chip {
  border: 1px solid var(--theme-accent-soft-border);
  background: var(--theme-accent-soft);
  color: var(--theme-text);
  border-radius: 999px;
  padding: 3px 12px;
  font-weight: 600;
  font-size: 0.92rem;
}
.dg .dg-chip:hover { border-color: var(--theme-accent-solid); }

/* Typeahead: matching names under the input. Tap, or arrow keys + Enter, makes the guess. */
.dg-suggest {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 20;
  list-style: none;
  margin: 0;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--theme-border-default);
  background: var(--theme-modal-bg);
  box-shadow: 0 12px 32px rgba(var(--theme-shadow-rgb), 0.35);
}
.dg-suggest[hidden] { display: none; }
.dg-suggest__item {
  padding: 11px 12px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--theme-text);
  cursor: pointer;
}
.dg-suggest__item:hover,
.dg-suggest__item[aria-selected="true"] { background: var(--theme-surface-hover); }

/* "Stuck?" is a quiet way out to the Pro Database once a few guesses are in. */
.dg-scout { margin: -4px 0 14px; font-size: 0.92rem; }
.dg-scout[hidden] { display: none; }
.dg .dg-scout a { color: var(--theme-text-muted); text-decoration: underline; text-underline-offset: 3px; }
.dg .dg-scout a:hover { color: var(--theme-link-hover); }

/* ── Board ────────────────────────────────────────────────────────────── */
.dg-head,
.dg-row__tiles {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: var(--dg-gap);
}
.dg-head {
  padding: 6px 0 8px;
  border-bottom: 1px solid var(--theme-border-subtle);
  margin-bottom: 10px;
}
.dg-head span {
  font-family: var(--dg-scoreboard);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--theme-text-subtle);
  text-align: center;
}
.dg-empty {
  margin: 18px 0 0;
  text-align: center;
  font-size: 0.92rem;
  color: var(--theme-text-subtle);
}
.dg-empty[hidden] { display: none; }

.dg-row { margin-bottom: 12px; }
.dg-row__name {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--theme-text-muted);
  margin: 0 0 4px 2px;
}

.dg-tile {
  aspect-ratio: 1 / 1.05;
  perspective: 500px;
}
.dg-tile__back { display: none; }
.dg-tile__inner {
  position: relative;
  height: 100%;
  border-radius: 8px;
  display: grid;
  place-items: center;
  transform-origin: 50% 0;
  overflow: hidden;
}
.dg-tile.is-hit  .dg-tile__inner { background: var(--theme-accent-green); color: var(--theme-on-accent); }
.dg-tile.is-near .dg-tile__inner { background: var(--accent-amber);       color: var(--theme-on-accent); }
.dg-tile.is-miss .dg-tile__inner {
  background: var(--theme-surface-2);
  color: var(--theme-text);
  box-shadow: inset 0 0 0 1px var(--theme-border-default);
}

.dg-tile__face {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
  gap: 2px;
}
.dg-tile__val {
  font-family: var(--dg-scoreboard);
  font-weight: 800;
  font-size: clamp(0.95rem, 4.6vw, 1.45rem);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}
.dg-tile--hand .dg-tile__val,
.dg-tile--brand .dg-tile__val { font-size: clamp(0.78rem, 3.6vw, 1.05rem); text-transform: uppercase; }
.dg-tile__val--long { display: none; }
.dg-tile__dir { font-size: 0.62rem; line-height: 1; }
.dg-tile__sub {
  font-family: var(--dg-scoreboard);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
}
.dg-flag {
  width: 1.55em;
  line-height: 1.1em;
  border-radius: 2px;
  font-size: clamp(0.9rem, 4vw, 1.2rem);
  box-shadow: 0 0 0 1px rgba(var(--theme-shadow-rgb), 0.15);
}

@media (min-width: 560px) {
  .dg-tile { aspect-ratio: 1 / 0.86; }
  .dg-tile__val--long { display: inline; }
  .dg-tile__val--short { display: none; }
}

/* The drop: each card swings down from its top hinge, one after another. */
.dg-row.is-new .dg-tile__inner {
  animation: dg-flap 0.46s cubic-bezier(.3, 1.35, .5, 1) both;
  animation-delay: calc(var(--i) * 95ms);
}
@keyframes dg-flap {
  0%   { transform: rotateX(-92deg); filter: brightness(0.55); }
  70%  { filter: brightness(1.08); }
  100% { transform: rotateX(0); filter: none; }
}
.dg-row.is-new .dg-row__name { animation: dg-fade 0.3s both; }
@keyframes dg-fade { from { opacity: 0; transform: translateY(-3px); } }

.dg-row.is-new.is-win .dg-tile { animation: dg-hop 0.42s ease-out both; animation-delay: calc(700ms + var(--i) * 70ms); }
@keyframes dg-hop {
  40% { transform: translateY(-9px); }
  70% { transform: translateY(1px); }
}

/* ── Result ───────────────────────────────────────────────────────────── */
.dg-result {
  margin: 4px 0 22px;
  padding: 22px 20px 20px;
  border-radius: 16px;
  background: var(--theme-surface-raised);
  border: 1px solid var(--theme-border-default);
  animation: dg-fade 0.4s both;
}
.dg-result[hidden] { display: none; }
.dg-result.is-won { box-shadow: inset 0 3px 0 var(--theme-accent-green); }
.dg-result__kicker {
  margin: 0 0 6px;
  font-family: var(--dg-scoreboard);
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--theme-text-muted);
}
.dg .dg-result__name {
  display: inline-block;
  font-family: var(--dg-scoreboard);
  font-size: clamp(2rem, 9vw, 2.8rem);
  font-weight: 800;
  line-height: 1.02;
  color: var(--theme-text);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
  text-decoration-color: var(--theme-border-strong);
}
.dg .dg-result__name:hover { color: var(--theme-link-hover); text-decoration-color: currentColor; }
.dg-result__name .dg-flag { font-size: 1.4rem; vertical-align: 0.15em; }
.dg-result__facts { margin: 10px 0 18px; color: var(--theme-text-muted); font-size: 0.95rem; }
.dg-result__streak {
  margin: -6px 0 16px;
  font-family: var(--dg-scoreboard);
  font-size: 1.3rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.dg-result__streak .fa-fire { color: var(--accent-amber); }
.dg-result__vs { margin: -6px 0 16px; font-weight: 600; }
.dg-result__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.dg-result__meta {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--theme-border-subtle);
  font-size: 0.92rem;
  color: var(--theme-text-muted);
}
.dg-result__meta p { margin: 0 0 6px; }
.dg-clock { font-family: var(--font-mono); color: var(--theme-text); font-weight: 700; }
.dg-result__tip { margin-top: 10px; }
.dg .dg-result__explore a,
.dg .dg-result__tip a,
.dg .dg-sheet a:not(.dg-btn) { color: var(--theme-text); text-decoration: underline; text-underline-offset: 3px; }
.dg .dg-result__explore a:hover,
.dg .dg-result__tip a:hover,
.dg .dg-sheet a:not(.dg-btn):hover { color: var(--theme-link-hover); }

/* The account offer: in the result for anonymous players, and over the locked stats. */
.dg-nudge {
  margin: 18px 0 0;
  padding: 16px;
  border-radius: 14px;
  background: var(--theme-surface-2);
  box-shadow: inset 0 0 0 1px var(--theme-border-subtle);
}
.dg .dg-nudge__title { margin: 0 0 4px; font-weight: 700; color: var(--theme-text); font-size: 0.98rem; }
.dg .dg-nudge__body { margin: 0 0 12px; color: var(--theme-text-muted); font-size: 0.92rem; }
.dg-nudge__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; }
.dg .dg-nudge__actions .dg-btn--primary { width: auto; margin: 0; }
.dg .dg-nudge__login { color: var(--theme-text); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.dg .dg-nudge__login:hover { color: var(--theme-link-hover); }

.dg-lock { position: relative; min-height: 250px; }
.dg-dist--ghost { filter: blur(5px); user-select: none; }
.dg-lock__offer {
  position: absolute;
  inset: 8px 0 auto;
  padding: 16px;
  border-radius: 14px;
  background: var(--theme-modal-bg);
  box-shadow: 0 0 0 1px var(--theme-border-default), 0 10px 30px rgba(var(--theme-shadow-rgb), 0.3);
}

.dg .dg-btn {
  display: inline-flex;
  align-items: center;
  height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--theme-border-strong);
  background: transparent;
  color: var(--theme-text);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
}
.dg .dg-btn:hover { background: var(--theme-surface-hover); color: var(--theme-text); }
.dg .dg-btn--primary {
  background: var(--theme-accent-solid);
  border-color: var(--theme-accent-solid);
  color: var(--theme-on-accent);
}
.dg .dg-btn--primary:hover { background: var(--theme-accent-solid-hover); color: var(--theme-on-accent); }

/* ── Sheets ───────────────────────────────────────────────────────────── */
.dg-sheet {
  width: min(460px, 100%);
  max-height: 88dvh;
  margin: auto auto 0;
  padding: 20px 20px 24px;
  border: 1px solid var(--theme-border-default);
  border-radius: 20px 20px 0 0;
  background: var(--theme-modal-bg);
  color: var(--theme-text);
}
@media (min-width: 560px) {
  .dg-sheet { margin: auto; border-radius: 20px; }
}
.dg-sheet::backdrop { background: rgba(var(--theme-shadow-rgb), 0.6); }
.dg-sheet[open] { animation: dg-rise 0.25s ease-out; }
@keyframes dg-rise { from { transform: translateY(24px); opacity: 0; } }
.dg-sheet__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.dg-sheet__title {
  margin: 0;
  font-family: var(--dg-scoreboard);
  font-size: 1.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.dg-sheet__sub {
  margin: 20px 0 10px;
  font-family: var(--dg-scoreboard);
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--theme-text-muted);
}
.dg-sheet p { color: var(--theme-text-muted); font-size: 0.95rem; }
.dg-sheet .dg-sheet__small { font-size: 0.86rem; color: var(--theme-text-subtle); margin: 14px 0; }
.dg-sheet .dg-btn--primary { width: 100%; justify-content: center; margin-top: 6px; }

/* Help sheet: one worked example row, drawn by the same renderer as the board. */
.dg-example { margin: 4px 0 0; }
.dg-example .dg-row { margin-bottom: 0; }
.dg-sheet .dg-example__caption { margin: 8px 0 16px; }

.dg-legend { list-style: none; padding: 0; margin: 0 0 6px; }
.dg-legend li { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; font-size: 0.93rem; }
.dg-swatch {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: 0.62rem;
}
.dg-swatch.is-hit  { background: var(--theme-accent-green); }
.dg-swatch.is-near { background: var(--accent-amber); }
.dg-swatch.is-miss { background: var(--theme-surface-2); box-shadow: inset 0 0 0 1px var(--theme-border-default); color: var(--theme-text); }

.dg-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.dg-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 4px;
  border-radius: 12px;
  background: var(--theme-surface-2);
}
.dg-stat__num { font-family: var(--dg-scoreboard); font-size: 2rem; font-weight: 800; line-height: 1; }
.dg-stat__label { font-size: 0.74rem; color: var(--theme-text-muted); text-align: center; margin-top: 4px; }

.dg-dist { list-style: none; padding: 0; margin: 0; }
.dg-dist__row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.dg-dist__label { width: 1.2em; font-family: var(--dg-scoreboard); font-weight: 700; color: var(--theme-text-muted); text-align: right; }
.dg-dist__bar {
  width: var(--w);
  min-width: 1.8em;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--theme-surface-2);
  color: var(--theme-text);
  font-family: var(--dg-scoreboard);
  font-weight: 700;
  font-size: 0.85rem;
  text-align: right;
}
.dg-dist__row.is-today .dg-dist__bar { background: var(--theme-accent-solid); color: var(--theme-on-accent); }

/* ── Toast ────────────────────────────────────────────────────────────── */
.dg-toast {
  position: fixed;
  left: 50%;
  top: 88px;  /* clear of the sticky site navbar (73px) */
  transform: translate(-50%, -8px);
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--theme-text);
  color: var(--theme-bg);
  font-weight: 600;
  font-size: 0.92rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 1100;
}
.dg-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* Yellow is the ball yellow from the wordmark, matching the 🟨 in the share grid. Its label
   is dark ink in both themes, so light mode swaps --theme-on-accent (white there) for text. */
[data-theme="light"] .dg-tile.is-near .dg-tile__inner { color: var(--theme-text); }

@media (prefers-reduced-motion: reduce) {
  .dg-row.is-new .dg-tile__inner,
  .dg-row.is-new.is-win .dg-tile,
  .dg-entry__input.is-shake,
  .dg-sheet[open] { animation: dg-fade 0.2s both; }
}

/* ── Archive (daily-tiebreak/archive.php, a normal site page) ─────────── */
.dg-archive { padding-top: 8px; }
.dg-archive__title {
  margin: 0 0 6px;
  font-family: var(--dg-scoreboard);
  font-size: 2.4rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.dg-archive__lede { color: var(--theme-text-muted); }
.dg .dg-archive__lede a { color: var(--theme-text); text-decoration: underline; text-underline-offset: 3px; }
.dg .dg-archive__lede a:hover { color: var(--theme-link-hover); }
.dg-archive .dg-nudge { margin: 0 0 20px; }
.dg-archive__list { list-style: none; margin: 8px 0 0; padding: 0; }
.dg-archive__item {
  display: grid;
  grid-template-columns: 3.4rem 1fr auto;
  grid-template-areas: "no date action" "no result action";
  align-items: center;
  column-gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--theme-border-subtle);
}
.dg-archive__no {
  grid-area: no;
  font-family: var(--dg-scoreboard);
  font-size: 1.6rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.dg-archive__date { grid-area: date; font-weight: 600; }
.dg-archive__result { grid-area: result; font-size: 0.9rem; color: var(--theme-text-muted); }
.dg-archive__result.is-won { color: var(--theme-text); }
.dg-archive__item .dg-btn { grid-area: action; height: 38px; }
