:root {
  --bg: #000000;
  --surface: #121216;
  --surface-subtle: #1a1a20;
  --text: #FFFFFF;
  --text-muted: #9a9aa6;
  --border: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.22);

  --emerald: #10B981;
  --emerald-bg: rgba(16, 185, 129, 0.14);
  --amber: #F59E0B;
  --amber-bg: rgba(245, 158, 11, 0.14);
  --coral: #F43F5E;
  --coral-bg: rgba(244, 63, 94, 0.14);

  --font-serif: Georgia, 'Times New Roman', serif;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(26, 26, 26, 0.05);
  --shadow-md: 0 8px 24px rgba(26, 26, 26, 0.08);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100dvh;
}

.app-shell {
  max-width: 600px;
  margin: 0 auto;
  padding: 12px 16px 24px;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 72px;
}

.header-right {
  justify-content: flex-end;
}

.header-center {
  text-align: center;
}

.brand-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.puzzle-meta {
  margin-top: 2px;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

.puzzle-meta.practice-badge {
  color: var(--amber);
  font-weight: 600;
}

.icon-btn {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.icon-btn:hover {
  background-color: var(--surface-subtle);
  border-color: var(--border);
}

/* Progress Bar */
.progress-bar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin: 14px 0;
}

.progress-step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: all 0.2s ease;
}

.progress-step.active {
  border-color: var(--text);
  box-shadow: 0 0 0 1px var(--text);
}

.progress-step.done {
  background: var(--surface-subtle);
}

.progress-step.tier-high {
  border-color: var(--emerald);
  background: var(--emerald-bg);
}

.progress-step.tier-mid {
  border-color: var(--amber);
  background: var(--amber-bg);
}

.progress-step.tier-low {
  border-color: var(--coral);
  background: var(--coral-bg);
}

.progress-icon {
  font-size: 1.05rem;
  line-height: 1;
}

.progress-score {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.progress-step.tier-high .progress-score { color: var(--emerald); }
.progress-step.tier-mid .progress-score { color: var(--amber); }
.progress-step.tier-low .progress-score { color: var(--coral); }

/* Stage */
.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: fadeIn 0.22s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.round-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.round-kicker {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.round-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.2;
}

.round-instruction {
  margin: 0;
  font-size: 0.94rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Interactive Canvas Box */
.canvas-wrap {
  position: relative;
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.interactive-canvas {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
  cursor: crosshair;
}

.canvas-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px;
  text-align: center;
}

.canvas-overlay.hidden {
  display: none;
}

.flash-timer-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 4px;
  background: var(--text);
  width: 100%;
  transform-origin: left;
}

/* Controls */
.controls-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stepper-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 1.2rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.12s ease;
}

.stepper-btn:hover:not(:disabled) {
  background: var(--surface-subtle);
}

.stepper-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

input[type="range"] {
  flex: 1;
  accent-color: var(--text);
  height: 6px;
  cursor: pointer;
}

.number-readout-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.number-input {
  width: 96px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  padding: 6px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
}

/* Buttons */
.btn-primary {
  appearance: none;
  width: 100%;
  padding: 13px 18px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--text);
  color: var(--surface);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.08s ease;
}

.btn-primary:hover:not(:disabled) {
  opacity: 0.9;
}

.btn-primary:active:not(:disabled) {
  transform: scale(0.99);
}

.btn-primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-secondary {
  appearance: none;
  width: 100%;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.btn-secondary:hover {
  background: var(--surface-subtle);
}

.btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Feedback Banner */
.feedback-banner {
  border-radius: var(--radius-md);
  padding: 14px 16px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.feedback-banner.tier-high {
  background: var(--emerald-bg);
  border-color: var(--emerald);
}

.feedback-banner.tier-mid {
  background: var(--amber-bg);
  border-color: var(--amber);
}

.feedback-banner.tier-low {
  background: var(--coral-bg);
  border-color: var(--coral);
}

.feedback-detail {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.feedback-headline {
  font-weight: 700;
  font-size: 0.98rem;
}

.feedback-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.feedback-points {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 700;
  white-space: nowrap;
}

.tier-high .feedback-points { color: var(--emerald); }
.tier-mid .feedback-points { color: var(--amber); }
.tier-low .feedback-points { color: var(--coral); }

/* Rhythm Beat Strip */
.beat-strip {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
}

.beat-cell {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: transform 0.08s ease, background-color 0.08s ease, border-color 0.08s ease;
}

.beat-cell.pulse {
  background: var(--text);
  color: var(--surface);
  border-color: var(--text);
  transform: scale(1.08);
}

.beat-cell.target-beat {
  border-style: dashed;
  border-color: var(--text);
  color: var(--text);
}

.beat-cell.silent-beat {
  opacity: 0.55;
}

.tap-pad {
  width: 100%;
  padding: 28px 16px;
  border-radius: var(--radius-md);
  border: 2px solid var(--text);
  background: var(--surface-subtle);
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.06s ease, background-color 0.1s ease;
}

.tap-pad:active:not(:disabled),
.tap-pad.pressed {
  transform: scale(0.98);
  background: var(--text);
  color: var(--surface);
}

.tap-pad:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Summary Screen */
.summary-hero {
  text-align: center;
  padding: 12px 0 6px;
}

.summary-rank {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  margin-bottom: 10px;
}

.summary-score {
  font-family: var(--font-serif);
  font-size: 3.1rem;
  font-weight: 700;
  line-height: 1;
}

.summary-score span {
  font-size: 1.25rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.breakdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.breakdown-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.breakdown-icon {
  font-size: 1.2rem;
}

.breakdown-name {
  font-weight: 600;
  font-size: 0.92rem;
}

.breakdown-metric {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.breakdown-score {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1rem;
}

.breakdown-score.tier-high { color: var(--emerald); }
.breakdown-score.tier-mid { color: var(--amber); }
.breakdown-score.tier-low { color: var(--coral); }

/* Footer */
.footer {
  margin-top: 18px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 26, 0.45);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 440px;
  max-height: 85dvh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.2rem;
}

.modal-body {
  padding: 16px 18px;
  overflow-y: auto;
  font-size: 0.92rem;
  line-height: 1.5;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.stat-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 6px;
  text-align: center;
}

.stat-val {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
}

.stat-lbl {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.archive-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.archive-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.archive-item:hover {
  border-color: var(--text);
  background: var(--surface-subtle);
}

.archive-badge {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.archive-badge.played {
  background: var(--emerald-bg);
  border-color: var(--emerald);
  color: var(--emerald);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--surface);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  z-index: 100;
  transition: opacity 0.2s ease;
}

.toast.hidden {
  display: none;
}

@media (max-width: 440px) {
  .card {
    padding: 16px;
  }
  .brand-title {
    font-size: 1.45rem;
  }
  .beat-strip {
    gap: 4px;
  }
  .beat-cell {
    font-size: 0.72rem;
  }
}

/* Locked In (90+) Glow & Badge */
.progress-step.locked-in {
  box-shadow: 0 0 0 1px var(--emerald), 0 0 10px rgba(5, 150, 105, 0.22);
}

.feedback-banner.is-locked-in {
  box-shadow: 0 0 0 1px var(--emerald), 0 4px 16px rgba(5, 150, 105, 0.16);
}

.locked-in-badge {
  display: inline-block;
  align-self: flex-start;
  background: var(--emerald);
  color: #FFFFFF;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 999px;
  margin-bottom: 2px;
}

.mini-lock-badge {
  display: inline-block;
  background: var(--emerald-bg);
  color: var(--emerald);
  border: 1px solid var(--emerald);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  margin-left: 6px;
  vertical-align: middle;
}

/* Setup / Start Screen */
.lineup-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 4px 0;
}

.lineup-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 0.84rem;
  font-weight: 600;
}

.mode-toggle-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.mode-toggle-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  padding: 9px 10px;
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mode-toggle-btn.active {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.mode-toggle-btn.active.hardcore {
  color: var(--coral);
  border-color: rgba(225, 29, 72, 0.35);
}

/* Pitch Match */
.pitch-stage {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.pitch-slider-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pitch-end-lbl {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  min-width: 32px;
  text-align: center;
}

.pitch-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.pitch-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-family: var(--font-mono);
}

.pitch-box.target {
  border-color: var(--emerald);
  background: var(--emerald-bg);
}

.pitch-box-lbl {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* Flash Grid */
.grid-stage-wrap {
  position: relative;
  width: 100%;
  max-width: 330px;
  margin: 0 auto;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.flash-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  padding: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.grid-cell {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.08s ease, background-color 0.12s ease, border-color 0.12s ease;
  touch-action: manipulation;
}

.grid-cell.flashed,
.grid-cell.selected {
  background: var(--text);
  border-color: var(--text);
}

.grid-cell.reveal-hit {
  background: var(--emerald);
  border-color: var(--emerald);
}

.grid-cell.reveal-wrong {
  background: var(--coral);
  border-color: var(--coral);
}

.grid-cell.reveal-missed {
  background: var(--emerald-bg);
  border: 2px dashed var(--emerald);
  color: var(--emerald);
}

.link-btn {
  background: none;
  border: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  padding: 2px 4px;
}

/* Mental Stopwatch */
.stopwatch-stage {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 28px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.stopwatch-readout {
  font-family: var(--font-mono);
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}

.stopwatch-unit {
  font-size: 1.3rem;
  color: var(--text-muted);
  margin-left: 2px;
}

.stopwatch-bar-wrap {
  width: 100%;
  max-width: 240px;
  height: 5px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  transition: opacity 0.2s ease;
}

.stopwatch-bar {
  width: 100%;
  height: 100%;
  background: var(--text);
  transform-origin: left;
}

.stopwatch-sub {
  font-size: 0.84rem;
  color: var(--text-muted);
}

/* Color Match */
.color-stage-wrap {
  position: relative;
  width: 100%;
  height: 180px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.color-swatch {
  width: 100%;
  height: 100%;
  background: var(--bg);
}

.color-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  height: 100%;
}

.color-half {
  position: relative;
  height: 100%;
}

.color-tag {
  position: absolute;
  bottom: 10px;
  left: 10px;
  background: rgba(26, 26, 26, 0.72);
  color: #FFFFFF;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
}

.hsl-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hsl-lbl {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  width: 42px;
}

.hue-slider {
  -webkit-appearance: none;
  appearance: none;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
}

/* Summary Benchmark & Streak */
.benchmark-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
}

.benchmark-pill {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.benchmark-pill.locked {
  background: var(--emerald-bg);
  border-color: var(--emerald);
  color: var(--emerald);
  font-weight: 700;
}

/* ===== Modern Dark Theme Overrides ===== */
html {
  background: #000;
}

body {
  background:
    radial-gradient(1000px 600px at 50% -10%, #15151d 0%, rgba(13, 13, 18, 0) 70%),
    linear-gradient(180deg, #000000 0%, #0d0d12 100%);
  background-attachment: fixed;
  color: #FFFFFF;
  letter-spacing: 0.005em;
}

.app-shell { padding: 16px 18px 32px; }

.header { border-bottom: 1px solid rgba(255, 255, 255, 0.12); padding-bottom: 14px; }
.brand-title { color: #FFFFFF; letter-spacing: -0.03em; }

.icon-btn { color: #FFFFFF; transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.12s ease; }
.icon-btn:hover { background: rgba(255, 255, 255, 0.07); border-color: rgba(255, 255, 255, 0.14); }
.icon-btn:active { transform: scale(0.94); }

.card {
  background: linear-gradient(180deg, #14141a 0%, #121216 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  padding: 24px;
  gap: 20px;
}

.round-title { color: #FFFFFF; }
.round-instruction { line-height: 1.5; }

.progress-step {
  background: #121216;
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: all 0.2s ease;
}
.progress-step.active { border-color: #FFFFFF; box-shadow: 0 0 0 1px #FFFFFF, 0 0 16px rgba(255, 255, 255, 0.12); }

.canvas-wrap, .pitch-stage, .stopwatch-stage, .color-stage-wrap, .flash-grid {
  background: #000000;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.canvas-overlay { background: rgba(0, 0, 0, 0.9); backdrop-filter: blur(3px); }

/* Primary buttons: subtle gradient highlight */
.btn-primary {
  background: linear-gradient(180deg, #ffffff 0%, #d9d9e2 100%);
  color: #08080b;
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 6px 20px rgba(255, 255, 255, 0.08);
  transition: transform 0.12s ease, box-shadow 0.18s ease, filter 0.18s ease;
}
.btn-primary:hover:not(:disabled) {
  opacity: 1;
  filter: brightness(1.06);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 8px 28px rgba(255, 255, 255, 0.16);
}
.btn-primary:active:not(:disabled) { transform: scale(0.985); }

.btn-secondary, .stepper-btn {
  background: #121216;
  color: #FFFFFF;
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.12s ease;
}
.btn-secondary:hover, .stepper-btn:hover:not(:disabled) {
  background: #1c1c24;
  border-color: rgba(255, 255, 255, 0.28);
}
.btn-secondary:active, .stepper-btn:active:not(:disabled) { transform: scale(0.985); }

.number-input {
  background: #0a0a0e;
  color: #FFFFFF;
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: border-color 0.18s ease;
}
.number-input:focus { outline: none; border-color: rgba(255, 255, 255, 0.5); }

input[type="range"] { accent-color: #FFFFFF; }

.tap-pad {
  background: #121216;
  color: #FFFFFF;
  border: 1px solid rgba(255, 255, 255, 0.28);
  transition: transform 0.08s ease, background-color 0.15s ease;
}
.tap-pad:active:not(:disabled), .tap-pad.pressed { background: #FFFFFF; color: #000000; }

.beat-cell { background: #0a0a0e; border: 1px solid rgba(255, 255, 255, 0.12); }
.beat-cell.pulse { background: #FFFFFF; color: #000000; border-color: #FFFFFF; }
.beat-cell.target-beat { border-color: rgba(255, 255, 255, 0.6); color: #FFFFFF; }

.grid-cell { background: #121216; border: 1px solid rgba(255, 255, 255, 0.12); transition: all 0.15s ease; }
.grid-cell:hover { border-color: rgba(255, 255, 255, 0.35); }
.grid-cell.flashed, .grid-cell.selected { background: #FFFFFF; border-color: #FFFFFF; }
.grid-cell.reveal-hit { background: var(--emerald); border-color: var(--emerald); color: #fff; }
.grid-cell.reveal-wrong { background: var(--coral); border-color: var(--coral); color: #fff; }

.flash-timer-bar, .stopwatch-bar { background: #FFFFFF; }
.stopwatch-bar-wrap { background: rgba(255, 255, 255, 0.12); }
.stopwatch-readout { color: #FFFFFF; text-shadow: 0 0 24px rgba(255, 255, 255, 0.18); }

.feedback-banner { border-width: 1px; }
.feedback-points { font-size: 1.5rem; }

.summary-rank { background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.12); color: #FFFFFF; }
.summary-score { color: #FFFFFF; text-shadow: 0 0 30px rgba(255, 255, 255, 0.15); }

.breakdown-item, .archive-item, .stat-box, .pitch-box, .benchmark-pill, .lineup-pill {
  background: #0d0d11;
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.archive-item { transition: border-color 0.18s ease, background-color 0.18s ease; }
.archive-item:hover { background: #17171d; border-color: rgba(255, 255, 255, 0.3); }
.archive-badge { background: #121216; color: #FFFFFF; border: 1px solid rgba(255, 255, 255, 0.12); }
.pitch-box.target, .archive-badge.played, .benchmark-pill.locked { background: var(--emerald-bg); border-color: var(--emerald); color: var(--emerald); }

.mode-toggle-group { background: #0a0a0e; border: 1px solid rgba(255, 255, 255, 0.12); }
.mode-toggle-btn { color: var(--text-muted); transition: all 0.18s ease; }
.mode-toggle-btn.active { background: #1c1c24; color: #FFFFFF; border-color: rgba(255, 255, 255, 0.2); }
.mode-toggle-btn.active.hardcore { color: var(--coral); border-color: rgba(244, 63, 94, 0.45); }

.modal-backdrop { background: rgba(0, 0, 0, 0.75); backdrop-filter: blur(6px); }
.modal-card {
  background: #121216;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7);
}
.modal-header { border-bottom: 1px solid rgba(255, 255, 255, 0.12); }

.toast { background: #FFFFFF; color: #000000; }
.footer { color: var(--text-muted); }

/* ===== More Exciting Game Icons ===== */
@keyframes iconFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-2px) rotate(-4deg); }
}

@keyframes iconPop {
  0% { transform: scale(0.6) rotate(-12deg); }
  60% { transform: scale(1.3) rotate(6deg); }
  100% { transform: scale(1) rotate(0deg); }
}

@keyframes iconGlow {
  0%, 100% { box-shadow: 0 0 0 rgba(139, 92, 246, 0); }
  50% { box-shadow: 0 0 16px rgba(139, 92, 246, 0.55); }
}

/* Progress bar icons: glowing gradient badges */
.progress-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.28), rgba(56, 189, 248, 0.18));
  border: 1px solid rgba(255, 255, 255, 0.14);
  filter: saturate(0.6) opacity(0.7);
  transition: transform 0.2s ease, filter 0.2s ease;
}

.progress-step.active .progress-icon {
  filter: none;
  background: linear-gradient(135deg, #8b5cf6, #38bdf8);
  border-color: rgba(255, 255, 255, 0.5);
  animation: iconFloat 1.8s ease-in-out infinite, iconGlow 2.2s ease-in-out infinite;
}

.progress-step.done .progress-icon {
  filter: none;
  animation: iconPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.progress-step.tier-high .progress-icon { background: linear-gradient(135deg, #10b981, #34d399); }
.progress-step.tier-mid .progress-icon { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.progress-step.tier-low .progress-icon { background: linear-gradient(135deg, #f43f5e, #fb7185); }

.progress-step.locked-in .progress-icon {
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.7);
}

/* Setup lineup pills */
.lineup-pill {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.16), rgba(56, 189, 248, 0.1));
  border-color: rgba(255, 255, 255, 0.18);
  font-size: 0.9rem;
  padding: 8px 14px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.lineup-pill:hover {
  transform: translateY(-2px) scale(1.04);
  border-color: rgba(139, 92, 246, 0.7);
}

/* Summary breakdown icons */
.breakdown-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.35), rgba(56, 189, 248, 0.22));
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s ease;
}

.breakdown-item:hover .breakdown-icon {
  transform: rotate(-8deg) scale(1.12);
}

/* Round title emoji pop */
.round-title {
  text-shadow: 0 0 22px rgba(139, 92, 246, 0.25);
}

@media (prefers-reduced-motion: reduce) {
  .progress-step.active .progress-icon,
  .progress-step.done .progress-icon {
    animation: none;
  }
}

/* ===== Vector (SVG) game icons ===== */
.game-icon {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
  vertical-align: -0.14em;
  color: inherit;
}

.progress-icon { color: #FFFFFF; }
.progress-icon .game-icon { width: 20px; height: 20px; }

.breakdown-icon { color: #FFFFFF; }
.breakdown-icon .game-icon { width: 22px; height: 22px; }

.lineup-pill .game-icon { width: 1.1em; height: 1.1em; color: #a78bfa; }

.title-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7em;
  height: 1.7em;
  margin-right: 0.45em;
  border-radius: 0.5em;
  vertical-align: middle;
  color: #FFFFFF;
  background: linear-gradient(135deg, #8b5cf6, #38bdf8);
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.35);
}

.title-icon .game-icon { width: 1.05em; height: 1.05em; vertical-align: 0; }

.locked-in-badge .game-icon,
.benchmark-pill .game-icon,
.mini-lock-badge .game-icon { width: 0.95em; height: 0.95em; margin-right: 2px; }

.modal-body li .game-icon { margin-right: 4px; color: #a78bfa; }

/* ===== Borderless icons ===== */
.progress-icon,
.breakdown-icon,
.title-icon {
  border: none !important;
  outline: none;
}

.breakdown-icon {
  box-shadow: none;
}

.progress-step.active .progress-icon {
  border: none !important;
}

/* ===== Remove frames/tiles around icons ===== */
.progress-icon,
.progress-step.active .progress-icon,
.progress-step.done .progress-icon,
.progress-step.tier-high .progress-icon,
.progress-step.tier-mid .progress-icon,
.progress-step.tier-low .progress-icon,
.breakdown-icon,
.title-icon {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  filter: none;
}

.progress-step,
.progress-step.active,
.progress-step.done,
.progress-step.tier-high,
.progress-step.tier-mid,
.progress-step.tier-low,
.progress-step.locked-in {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
}

.progress-step.active .progress-icon { animation: iconFloat 1.8s ease-in-out infinite; }
.progress-step.locked-in .progress-icon { filter: drop-shadow(0 0 6px rgba(16, 185, 129, 0.8)); }

/* ===== Visible score chips under progress icons ===== */
.progress-score {
  min-width: 34px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
}

.progress-step.tier-high .progress-score {
  background: rgba(16, 185, 129, 0.18);
  border-color: var(--emerald);
  color: #34d399;
}

.progress-step.tier-mid .progress-score {
  background: rgba(245, 158, 11, 0.18);
  border-color: var(--amber);
  color: #fbbf24;
}

.progress-step.tier-low .progress-score {
  background: rgba(244, 63, 94, 0.18);
  border-color: var(--coral);
  color: #fb7185;
}

.progress-step.active .progress-score {
  border-color: #FFFFFF;
}

/* ===== Archive list text ===== */
.archive-item,
.archive-item div {
  color: #FFFFFF;
}

.archive-item div > div:last-child {
  color: #FFFFFF;
  opacity: 0.8;
}
