/* =============================================================================
   Last Row — page-specific styles
   Reuses the shared design tokens and the site's replay-tile color contract
   from styles.css. Only the board layout, the live consistency indicator, the
   result panel and the technique list are defined here.
   ============================================================================= */

.lr-game {
  margin: var(--space-6) 0;
  padding: var(--space-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.lr-status {
  margin: 0;
  color: var(--muted);
  text-align: center;
}

.lr-title {
  margin: 0 0 var(--space-4);
  text-align: center;
  font-size: var(--text-lg, 1.25rem);
}

.lr-board {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  margin: var(--space-4) 0;
}

/* The pending last row: typed letters before commit, deliberately unscored. */
.lr-tile-pending {
  background: var(--surface);
  color: var(--fg);
  border: 2px dashed var(--border);
}

@keyframes lr-flip {
  from {
    transform: rotateX(90deg);
  }
  to {
    transform: none;
  }
}

.lr-flip {
  animation: lr-flip var(--transition-fast, 150ms) ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .lr-flip {
    animation: none;
  }
}

.lr-evidence {
  margin: var(--space-4) auto;
  max-width: 460px;
  text-align: center;
  color: var(--muted);
  font-size: var(--text-sm);
}

.lr-label {
  display: block;
  margin-bottom: var(--space-2);
  font-weight: 600;
}

.lr-input-line {
  display: flex;
  gap: var(--space-2);
  /* Stop the input+button min-content width propagating through the
     flex-item <main> and panning the page on phones (verified at 390px:
     the pair's 367px min-content inflated main to 399px). */
  contain: inline-size;
}

.lr-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--fg);
  font-size: 16px; /* prevents iOS zoom-on-focus */
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.lr-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* The live "consistent with the evidence?" readout. Color alone never carries
   the verdict — the text names the row and the clue. */
.lr-indicator {
  margin: var(--space-3) 0 0;
  min-height: 1.2em;
  font-size: var(--text-sm);
  color: var(--muted);
}

.lr-indicator.is-consistent {
  color: var(--success, var(--green));
  font-weight: 600;
}

.lr-indicator.is-contradiction {
  color: var(--accent-text);
}

.lr-hint {
  margin: var(--space-2) 0 0;
  min-height: 1.2em;
  font-size: var(--text-sm);
  color: var(--muted);
}

.lr-attempt {
  margin: var(--space-2) 0 0;
  font-size: var(--text-sm);
  color: var(--muted);
}

/* --- result panel --- */

.lr-result {
  margin-top: var(--space-6);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-1);
  text-align: center;
  animation: lr-reveal var(--transition-fast, 150ms) ease-out;
}

@keyframes lr-reveal {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lr-result {
    animation: none;
  }
}

.lr-outcome {
  margin: 0 0 var(--space-2);
}

.lr-reveal {
  margin: 0 0 var(--space-3);
}

.lr-badge {
  margin: 0 0 var(--space-2);
  font-weight: 700;
}

.lr-explain {
  max-width: 460px;
  margin: 0 auto var(--space-4);
}

.lr-score-box {
  margin: 0 auto var(--space-3);
}

.lr-score-meaning {
  max-width: 460px;
  margin: 0 auto var(--space-4);
  font-size: var(--text-sm);
}

.lr-share-actions {
  margin-bottom: var(--space-4);
}

.lr-share-hint {
  margin: var(--space-2) 0 0;
  min-height: 1.2em;
  font-size: var(--text-sm);
  color: var(--muted);
  overflow-wrap: anywhere;
}

.lr-history-title {
  margin: 0 0 var(--space-2);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.lr-streak {
  margin: 0 0 var(--space-2);
  font-weight: 600;
}

.lr-tallies {
  max-width: 460px;
  margin: 0 auto var(--space-2);
  font-size: var(--text-sm);
}

.lr-history-note {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--muted);
}

/* --- explainer sections --- */

.lr-table-wrap {
  overflow-x: auto;
  margin: var(--space-4) 0;
  /* Stop the table's min-content width propagating through the flex-item
     <main> (the solver-says.css precedent, verified on mobile). */
  contain: inline-size;
}

.lr-score-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

@media (max-width: 767px) {
  /* Old-browser fallback for the containment above. */
  .lr-score-table {
    min-width: 0;
  }
}

.lr-score-table th,
.lr-score-table td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.lr-score-table thead th {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.lr-techniques {
  margin: var(--space-3) 0;
}

.lr-techniques dt {
  font-weight: 700;
  margin-top: var(--space-3);
}

.lr-techniques dd {
  margin: var(--space-1) 0 0;
  color: var(--muted);
}

.lr-method-note {
  font-size: var(--text-sm);
  color: var(--muted);
}

@media (max-width: 480px) {
  .lr-game {
    padding: var(--space-4);
  }
}
