/**
 * game.css — Board layout, cards, loom matrix, operation tray, hints, replay, and arcade views.
 *
 * Implements Direction A: "Draft Marks" design tokens and textile geometry.
 */

/* --- Main Layout Grid --- */
.game-container {
  width: 100%;
}

.puzzle-banner {
  background: var(--paper-light);
  border: 1px solid var(--draft-grid);
  border-left: 4px solid var(--iron-gall);
  padding: var(--space-s) var(--space-m);
  margin-bottom: var(--space-m);
  border-radius: var(--radius-subtle);
}

.puzzle-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chapter-tag {
  font-family: var(--font-ui);
  font-size: var(--step--1);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-clue);
}

.puzzle-heading {
  font-size: var(--step-2);
  color: var(--iron-gall);
}

.puzzle-subtext {
  font-size: var(--step-0);
  color: var(--slate-neutral);
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(360px, 1.4fr);
  gap: var(--space-m);
  align-items: start;
}

@media (max-width: 900px) {
  .game-layout {
    grid-template-columns: 1fr;
  }
}

/* --- Columns --- */
.inspection-column,
.workbench-column {
  display: flex;
  flex-direction: column;
  gap: var(--space-m);
}

/* --- Panel Cards --- */
.panel-card,
.matrix-card,
.tray-card,
.hint-card {
  background: var(--grad-surface);
  border: 1px solid var(--draft-grid);
  border-radius: var(--radius-card);
  padding: var(--space-m);
  box-shadow: 0 1px 3px rgba(24, 29, 32, 0.05);
}

.panel-title-strip,
.matrix-header,
.tray-header,
.hint-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-xs);
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--draft-grid);
}

.panel-title,
.matrix-title,
.tray-title,
.hint-title {
  font-size: var(--step-0);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--iron-gall);
}

.panel-subtext,
.tray-instructions {
  font-size: var(--step--1);
  color: var(--slate-neutral);
  margin-bottom: var(--space-xs);
}

/* --- Machine Clues List --- */
.clues-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.clue-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-xs) var(--space-s);
  background: rgba(24, 29, 32, 0.02);
  border: 1px solid var(--draft-grid);
  border-radius: var(--radius-subtle);
}

.clue-label {
  font-family: var(--font-ui);
  font-size: var(--step--1);
  font-weight: 700;
  color: var(--accent-clue);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.transformation-pair {
  display: flex;
  align-items: center;
  gap: var(--space-s);
}

.transform-arrow {
  font-size: var(--step-1);
  color: var(--iron-gall);
  user-select: none;
}

/* --- Task Stage --- */
.task-heading-badge {
  font-size: var(--step--1);
  font-weight: 700;
  color: var(--spruce-green);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #EFF7F4;
  padding: 2px 8px;
  border-radius: var(--radius-chip);
  border: 1px solid var(--spruce-green);
}

.task-stage {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: var(--space-m) var(--space-s);
  background: rgba(24, 29, 32, 0.02);
  border: 1px dashed var(--iron-gall);
  border-radius: var(--radius-card);
}

.object-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
}

.object-cell-caption {
  font-size: var(--step--1);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--slate-neutral);
}

.target-cell .object-cell-caption {
  color: var(--spruce-green);
}

/* --- SVG Game Object Rendering --- */
.game-object-svg {
  width: 64px;
  height: 64px;
  display: block;
  overflow: visible;
}

.game-object-svg.size-0 {
  transform: scale(0.75);
}

.game-object-svg.size-1 {
  transform: scale(1);
}

.game-object-svg.size-2 {
  transform: scale(1.25);
}

/* --- Loom Program Matrix --- */
.matrix-par-badge {
  font-size: var(--step--1);
  font-weight: 700;
  background: rgba(30, 76, 161, 0.08);
  color: var(--cobalt-yarn);
  padding: 2px 8px;
  border-radius: var(--radius-chip);
  border: 1px solid var(--cobalt-yarn);
}

.matrix-slots-container {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-s);
  background: rgba(24, 29, 32, 0.02);
  border: 1px solid var(--draft-grid);
  border-radius: var(--radius-card);
  overflow-x: auto;
}

.matrix-slot {
  min-width: 84px;
  height: 84px;
  background: var(--paper-light);
  border: 2px dashed var(--draft-grid);
  border-radius: var(--radius-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 6px;
  position: relative;
  transition: all var(--trans-fast);
}

.matrix-slot:hover {
  border-color: var(--cobalt-yarn);
}

.matrix-slot.slot-selected {
  border-color: var(--cobalt-yarn);
  border-style: solid;
  background: rgba(30, 76, 161, 0.04);
  box-shadow: 0 0 0 3px rgba(30, 76, 161, 0.25);
}

.matrix-slot.slot-occupied {
  border-style: solid;
  border-color: var(--iron-gall);
  background: var(--paper-light);
}

.matrix-slot.slot-active-eval {
  background: rgba(23, 99, 79, 0.12);
  border-color: var(--spruce-green);
  border-style: solid;
  transform: scale(1.04);
}

.slot-step-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--slate-neutral);
  align-self: flex-start;
}

.slot-empty-label {
  font-size: var(--step--1);
  color: var(--slate-neutral);
  margin-bottom: auto;
  margin-top: auto;
}

.placed-op-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  gap: 2px;
}

.op-chip-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--iron-gall);
  text-align: center;
  line-height: 1.1;
}

.op-chip-remove-btn {
  font-size: 11px;
  color: var(--cinnabar);
  padding: 2px 6px;
  border-radius: var(--radius-chip);
}

.op-chip-remove-btn:hover {
  background: rgba(169, 37, 35, 0.1);
}

.slot-flow-arrow {
  color: var(--draft-grid);
  font-size: var(--step-0);
  user-select: none;
}

/* --- Operation Tray --- */
.operations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: var(--space-xs);
}

.op-card-btn {
  background: var(--paper-light);
  border: 1px solid var(--iron-gall);
  border-radius: var(--radius-subtle);
  padding: var(--space-xs) var(--space-s);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: 52px;
  box-shadow: 1px 1px 0 var(--iron-gall);
  transition: all var(--trans-fast);
}

.op-card-btn:hover {
  background: rgba(30, 76, 161, 0.05);
  border-color: var(--cobalt-yarn);
  transform: translateY(-1px);
  box-shadow: 2px 2px 0 var(--cobalt-yarn);
}

.op-card-btn.op-selected {
  background: rgba(30, 76, 161, 0.12);
  border-color: var(--cobalt-yarn);
  border-width: 2px;
  box-shadow: 0 0 0 2px var(--cobalt-yarn);
}

.op-name {
  font-weight: 700;
  font-size: var(--step-0);
  color: var(--iron-gall);
}

.op-channel-tag {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-clue);
  font-weight: 600;
}

/* --- Control Bar --- */
.control-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-xs);
  padding: var(--space-s) var(--space-m);
  background: var(--paper-light);
  border: 1px solid var(--draft-grid);
  border-radius: var(--radius-subtle);
}

.history-controls {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.tool-btn {
  background: var(--paper-light);
  color: var(--iron-gall);
  border: 1px solid var(--iron-gall);
  padding: var(--space-xs) var(--space-s);
  font-size: var(--step--1);
  font-weight: 600;
  border-radius: var(--radius-chip);
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--trans-fast);
}

.tool-btn:hover:not(:disabled) {
  background: var(--iron-gall);
  color: var(--paper-light);
}

/* RUN Action Button (Prominent in Cobalt Yarn) */
.btn-run {
  background: var(--grad-run-btn);
  color: #FFFFFF;
  border: 2px solid var(--iron-gall);
  font-family: var(--font-display);
  font-size: var(--step-1);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: var(--space-xs) var(--space-xl);
  border-radius: var(--radius-chip);
  box-shadow: 2px 2px 0 var(--iron-gall);
  min-height: 48px;
  transition: all var(--trans-fast);
}

.btn-run:hover:not(:disabled) {
  background: var(--grad-run-btn-hover);
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--iron-gall);
}

.btn-run:active:not(:disabled) {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--iron-gall);
}

/* --- Three-Tier Hints Card & Drawer --- */
.hint-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.hint-title-group {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.hint-count-pill {
  font-size: var(--step--1);
  font-weight: 600;
  color: var(--slate-neutral);
  background: rgba(24, 29, 32, 0.06);
  padding: 2px 8px;
  border-radius: var(--radius-chip);
}

.hint-trigger-btn {
  background: rgba(135, 80, 0, 0.08);
  color: var(--accent-clue);
  border-color: var(--accent-clue);
}

.hint-trigger-btn:hover:not(:disabled) {
  background: var(--accent-clue);
  color: #FFFFFF;
}

.hint-drawer {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.hint-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: var(--space-xs) var(--space-s);
  background: rgba(135, 80, 0, 0.04);
  border-left: 3px solid var(--accent-clue);
  border-radius: 0 var(--radius-subtle) var(--radius-subtle) 0;
}

.hint-tier-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-clue);
}

.hint-tier-text {
  font-size: var(--step--1);
  line-height: 1.4;
  color: var(--iron-gall);
}

/* --- Feedback & Execution Trace Panel --- */
.feedback-banner {
  padding: var(--space-s) var(--space-m);
  border: 2px solid var(--iron-gall);
  border-radius: var(--radius-subtle);
  font-size: var(--step-0);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-s);
  transition: all var(--trans-base);
}

.feedback-banner.status-idle {
  background: var(--paper-light);
  color: var(--iron-gall);
  border-color: var(--draft-grid);
}

.feedback-banner.status-wrong {
  background: var(--grad-error);
  color: var(--cinnabar);
  border-color: var(--cinnabar);
}

.feedback-banner.status-solved {
  background: var(--grad-solved);
  color: var(--spruce-green);
  border-color: var(--spruce-green);
}

.feedback-banner.status-running {
  background: rgba(30, 76, 161, 0.08);
  color: var(--cobalt-yarn);
  border-color: var(--cobalt-yarn);
}

.feedback-icon-text {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.badge-status {
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 700;
  border-radius: var(--radius-chip);
  border: 1px solid currentColor;
}

.feedback-actions-strip {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.replay-launch-btn {
  background: rgba(30, 76, 161, 0.08);
  color: var(--cobalt-yarn);
  border-color: var(--cobalt-yarn);
  font-weight: 700;
}

.replay-launch-btn:hover:not(:disabled) {
  background: var(--cobalt-yarn);
  color: #FFFFFF;
}

.next-puzzle-btn {
  background: var(--spruce-green);
  color: #FFFFFF;
  border: 1px solid var(--iron-gall);
  padding: var(--space-xs) var(--space-m);
  font-weight: 700;
  font-size: var(--step-0);
  border-radius: var(--radius-chip);
  min-height: 44px;
}

.next-puzzle-btn:hover {
  background: #0E4435;
}

/* --- Aha Replay Overlay Modal --- */
.replay-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(24, 29, 32, 0.65);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1050;
  padding: var(--space-m);
}

.replay-modal {
  background: var(--paper-light);
  border: 2px solid var(--iron-gall);
  border-radius: var(--radius-card);
  max-width: 680px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  padding: var(--space-m);
  display: flex;
  flex-direction: column;
  gap: var(--space-m);
  box-shadow: 0 12px 40px rgba(24, 29, 32, 0.25);
}

.replay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--draft-grid);
  padding-bottom: var(--space-xs);
  gap: var(--space-xs);
}

.replay-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--cobalt-yarn);
  letter-spacing: 0.08em;
}

.replay-title {
  font-size: var(--step-1);
}

.replay-close-btn {
  font-size: var(--step--1);
  font-weight: 700;
  padding: 6px 12px;
  border-radius: var(--radius-chip);
  border: 1px solid var(--draft-grid);
  color: var(--iron-gall);
}

.replay-close-btn:hover {
  background: var(--iron-gall);
  color: var(--paper-light);
}

.replay-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-s);
}

.replay-step-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.replay-step-number {
  font-size: var(--step--1);
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-clue);
  letter-spacing: 0.06em;
}

.replay-op-heading {
  font-size: var(--step-1);
  color: var(--iron-gall);
}

.replay-desc {
  font-size: var(--step-0);
  color: var(--slate-neutral);
}

.replay-stage {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: var(--space-m);
  background: rgba(24, 29, 32, 0.03);
  border: 1px dashed var(--draft-grid);
  border-radius: var(--radius-card);
}

.replay-clues-row {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.replay-clues-label {
  font-size: var(--step--1);
  font-weight: 700;
  color: var(--slate-neutral);
}

.replay-clues-badges {
  display: flex;
  gap: 4px;
}

.clue-evidence-pill {
  font-size: 11px;
  font-weight: 700;
  background: #EFF7F4;
  color: var(--spruce-green);
  border: 1px solid var(--spruce-green);
  padding: 2px 8px;
  border-radius: var(--radius-chip);
}

.replay-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xs);
  padding-top: var(--space-xs);
  border-top: 1px solid var(--draft-grid);
}

.replay-scrubber {
  flex: 1;
  height: 6px;
  accent-color: var(--cobalt-yarn);
  cursor: pointer;
}

.replay-transcript-details {
  border: 1px solid var(--draft-grid);
  border-radius: var(--radius-subtle);
  padding: var(--space-xs) var(--space-s);
  background: rgba(24, 29, 32, 0.02);
}

.replay-transcript-summary {
  font-size: var(--step--1);
  font-weight: 700;
  cursor: pointer;
  color: var(--iron-gall);
}

.replay-transcript-text {
  font-family: var(--font-ui);
  font-size: var(--step--1);
  line-height: 1.5;
  white-space: pre-wrap;
  margin-top: var(--space-xs);
  color: var(--iron-gall);
}

/* --- Archive View Styles --- */
.archive-summary-badge {
  font-size: var(--step-0);
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-chip);
  background: #EFF7F4;
  color: var(--spruce-green);
  border: 1px solid var(--spruce-green);
}

.archive-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-l);
}

.archive-chapter-card {
  background: var(--paper-light);
  border: 1px solid var(--draft-grid);
  border-radius: var(--radius-card);
  padding: var(--space-m);
}

.archive-chapter-title {
  font-size: var(--step-1);
  margin-bottom: var(--space-s);
  border-bottom: 1px solid var(--draft-grid);
  padding-bottom: var(--space-xs);
}

.archive-chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-s);
}

.archive-puzzle-card {
  background: var(--paper-light);
  border: 1px solid var(--iron-gall);
  border-radius: var(--radius-subtle);
  padding: var(--space-s);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  text-align: left;
  box-shadow: 2px 2px 0 var(--iron-gall);
  transition: all var(--trans-fast);
}

.archive-puzzle-card:hover {
  transform: translateY(-2px);
  box-shadow: 3px 3px 0 var(--cobalt-yarn);
  border-color: var(--cobalt-yarn);
}

.archive-puzzle-card.is-solved {
  border-color: var(--spruce-green);
  background: #FAFCFA;
}

.archive-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.archive-card-num {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--slate-neutral);
}

.archive-card-status {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-chip);
}

.badge-solved {
  background: #EFF7F4;
  color: var(--spruce-green);
  border: 1px solid var(--spruce-green);
}

.badge-unsolved {
  background: rgba(24, 29, 32, 0.05);
  color: var(--slate-neutral);
  border: 1px solid var(--draft-grid);
}

.archive-card-title {
  font-size: var(--step-0);
  color: var(--iron-gall);
}

.archive-card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--step--1);
  color: var(--slate-neutral);
}

.archive-par-badge {
  font-weight: 700;
  color: var(--cobalt-yarn);
}

/* --- Progress Dashboard Styles --- */
.progress-dashboard {
  display: flex;
  flex-direction: column;
  gap: var(--space-m);
}

.stats-cards-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-s);
}

.stat-card {
  background: var(--paper-light);
  border: 1px solid var(--draft-grid);
  border-radius: var(--radius-card);
  padding: var(--space-m);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
}

.stat-big-number {
  font-family: var(--font-display);
  font-size: var(--step-3);
  font-weight: 700;
  color: var(--iron-gall);
}

.stat-label {
  font-size: var(--step--1);
  font-weight: 600;
  color: var(--slate-neutral);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.progress-chapter-breakdown {
  display: flex;
  flex-direction: column;
  gap: var(--space-s);
}

.chapter-progress-rows {
  display: flex;
  flex-direction: column;
  gap: var(--space-s);
}

.chapter-progress-row {
  display: grid;
  grid-template-columns: 220px 80px 1fr;
  align-items: center;
  gap: var(--space-s);
}

@media (max-width: 600px) {
  .chapter-progress-row {
    grid-template-columns: 1fr auto;
  }
  .chapter-progress-bar-track {
    grid-column: 1 / -1;
  }
}

.chapter-row-title {
  font-weight: 700;
  font-size: var(--step-0);
  color: var(--iron-gall);
}

.chapter-row-fraction {
  font-weight: 600;
  font-size: var(--step--1);
  color: var(--slate-neutral);
}

.chapter-progress-bar-track {
  width: 100%;
  height: 10px;
  background: rgba(24, 29, 32, 0.08);
  border-radius: var(--radius-chip);
  overflow: hidden;
}

.chapter-progress-bar-fill {
  height: 100%;
  width: var(--fill-pct, 0%);
  background: var(--spruce-green);
  transition: width var(--trans-base);
}

.reset-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-color: rgba(169, 37, 35, 0.3);
  flex-wrap: wrap;
  gap: var(--space-s);
}

/* --- Explore Games Styles --- */
.explore-games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-m);
}

.game-showcase-card {
  background: var(--paper-light);
  border: 1px solid var(--draft-grid);
  border-radius: var(--radius-card);
  padding: var(--space-m);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.game-showcase-card.is-active-game {
  border: 2px solid var(--cobalt-yarn);
  box-shadow: 2px 2px 0 var(--cobalt-yarn);
}

.game-showcase-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: var(--radius-chip);
  align-self: flex-start;
}

.ready-badge {
  background: #EFF7F4;
  color: var(--spruce-green);
  border: 1px solid var(--spruce-green);
}

.upcoming-badge {
  background: rgba(24, 29, 32, 0.06);
  color: var(--slate-neutral);
  border: 1px solid var(--draft-grid);
}

.game-showcase-title {
  font-size: var(--step-1);
}

.game-showcase-desc {
  font-size: var(--step-0);
  color: var(--slate-neutral);
  line-height: 1.4;
  flex: 1;
}

.game-showcase-specs {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: var(--step--1);
  color: var(--iron-gall);
  font-weight: 600;
  margin-top: var(--space-xs);
  margin-bottom: var(--space-xs);
}

.future-note {
  font-size: 11px;
  font-style: italic;
  color: var(--slate-neutral);
}

/* --- Mobile Responsiveness (Under 768px & 390px) --- */
@media (max-width: 768px) {
  .app-shell {
    padding: var(--space-xs) var(--space-xs) var(--space-l);
    gap: var(--space-s);
  }

  .puzzle-banner {
    padding: var(--space-xs);
  }

  .panel-card,
  .matrix-card,
  .tray-card,
  .hint-card {
    padding: var(--space-xs);
  }

  .matrix-slots-container {
    padding: var(--space-xs);
    gap: 4px;
  }

  .matrix-slot {
    min-width: 64px;
    height: 64px;
  }

  .operations-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .control-bar {
    padding: var(--space-xs);
  }

  .btn-run {
    width: 100%;
    order: -1;
    margin-bottom: var(--space-xs);
  }

  .nav-tab-list {
    flex-wrap: wrap;
    justify-content: center;
  }

  .replay-modal {
    padding: var(--space-s);
  }
}

/* ==========================================================================
   Interactive Tutorial ("How to Play") Guided Walkthrough (Phase 7 Amendment)
   ========================================================================== */
.tutorial-callout-card {
  position: fixed;
  bottom: var(--space-l);
  right: var(--space-l);
  max-width: 420px;
  width: calc(100% - var(--space-2xl));
  background: var(--grad-surface);
  border: 2px solid var(--iron-gall);
  border-radius: var(--radius-panel);
  box-shadow: 0 8px 24px rgba(24, 29, 32, 0.22);
  padding: var(--space-m);
  z-index: 9500;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  animation: tutorialPopIn 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

.tutorial-callout-card[hidden] {
  display: none !important;
}

@keyframes tutorialPopIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.tutorial-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xs);
}

.tutorial-step-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  background: rgba(30, 76, 161, 0.1);
  color: var(--cobalt-yarn);
  border-radius: var(--radius-chip);
  border: 1px solid rgba(30, 76, 161, 0.25);
}

.tutorial-close-btn {
  background: transparent;
  border: 1px solid transparent;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--slate-neutral);
  cursor: pointer;
  border-radius: var(--radius-chip);
  padding: 2px 6px;
  transition: all var(--trans-fast);
}

.tutorial-close-btn:hover {
  color: var(--iron-gall);
  background: rgba(24, 29, 32, 0.06);
}

.tutorial-step-title {
  font-family: var(--font-display);
  font-size: var(--step-1);
  color: var(--iron-gall);
  line-height: 1.25;
  margin-top: 2px;
}

.tutorial-step-text {
  font-size: var(--step-0);
  line-height: 1.45;
  color: var(--iron-gall);
  margin: var(--space-2xs) 0 var(--space-xs);
}

.tutorial-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xs);
  border-top: 1px solid var(--draft-grid);
  padding-top: var(--space-xs);
}

.tutorial-skip-link {
  background: transparent;
  border: none;
  font-size: var(--step--1);
  color: var(--slate-neutral);
  cursor: pointer;
  text-decoration: underline;
  padding: 4px 6px;
}

.tutorial-skip-link:hover {
  color: var(--iron-gall);
}

.tutorial-btn-group {
  display: flex;
  gap: var(--space-xs);
}

.tutorial-nav-btn {
  font-size: var(--step--1);
  font-weight: 700;
  padding: 6px 14px;
  border-radius: var(--radius-subtle);
  border: 1px solid var(--iron-gall);
  cursor: pointer;
  transition: all var(--trans-fast);
}

.tutorial-nav-btn.btn-prev {
  background: var(--paper-light);
  color: var(--iron-gall);
}

.tutorial-nav-btn.btn-prev:hover:not(:disabled) {
  background: #E8EEF1;
}

.tutorial-nav-btn.btn-prev:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.tutorial-nav-btn.btn-next {
  background: var(--cobalt-yarn);
  color: #FFFFFF;
  border-color: var(--cobalt-yarn);
}

.tutorial-nav-btn.btn-next:hover {
  background: #173B7E;
}

/* Tutorial Spotlight & Highlight */
.is-tutorial-highlight {
  outline: 3px solid var(--cobalt-yarn) !important;
  outline-offset: 4px !important;
  box-shadow: 0 0 0 8px rgba(30, 76, 161, 0.15) !important;
  position: relative;
  z-index: 9400;
}

@media (max-width: 640px) {
  .tutorial-callout-card {
    bottom: var(--space-s);
    right: var(--space-s);
    left: var(--space-s);
    max-width: none;
    width: calc(100% - var(--space-m));
  }
}

/* ==========================================================================
   Preferences, Privacy & Feedback Dialog Details (CLICK 1.0 Release Polish)
   ========================================================================== */
.prefs-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-s);
  margin: var(--space-xs) 0;
}

.pref-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-s);
  padding: var(--space-xs) var(--space-s);
  background: rgba(24, 29, 32, 0.03);
  border: 1px solid var(--draft-grid);
  border-radius: var(--radius-subtle);
}

.pref-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pref-label {
  font-weight: 700;
  font-size: var(--step-0);
  color: var(--iron-gall);
}

.pref-desc {
  font-size: var(--step--1);
  color: var(--slate-neutral);
  line-height: 1.35;
}

.pref-toggle-btn {
  font-size: var(--step--1);
  font-weight: 700;
  padding: 6px 14px;
  border-radius: var(--radius-chip);
  border: 1px solid var(--draft-grid);
  background: var(--paper-light);
  color: var(--iron-gall);
  white-space: nowrap;
  min-height: 36px;
  cursor: pointer;
  transition: all var(--trans-fast);
}

.pref-toggle-btn:hover {
  border-color: var(--iron-gall);
}

.pref-toggle-btn[aria-pressed="true"] {
  background: rgba(30, 76, 161, 0.1);
  border-color: var(--cobalt-yarn);
  color: var(--cobalt-yarn);
}

.btn-danger-subtle {
  border: 1px solid var(--cinnabar);
  color: var(--cinnabar);
  background: rgba(169, 37, 35, 0.05);
  font-size: var(--step--1);
  font-weight: 700;
  padding: 6px 12px;
  border-radius: var(--radius-chip);
}

.btn-danger-subtle:hover {
  background: var(--cinnabar);
  color: #FFFFFF;
}

.privacy-body,
.feedback-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  font-size: var(--step-0);
  line-height: 1.45;
  color: var(--iron-gall);
}

.feedback-channels {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-s);
  margin-top: var(--space-xs);
}

.feedback-channel-card {
  padding: var(--space-s);
  border: 1px solid var(--draft-grid);
  border-radius: var(--radius-subtle);
  background: var(--paper-light);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.channel-title {
  font-weight: 700;
  font-size: var(--step-0);
  color: var(--iron-gall);
}

.channel-desc {
  font-size: var(--step--1);
  color: var(--slate-neutral);
  line-height: 1.35;
}

.feedback-link {
  align-self: flex-start;
  margin-top: var(--space-2xs);
  text-decoration: none;
  font-weight: 600;
  font-size: var(--step--1);
}
