/* ═══════════════════════════════════════════════════
   INTERVAL METRONOME — Mass Effect HUD
═══════════════════════════════════════════════════ */

/* ── Variables ─────────────────────────────────── */
:root {
  --bg:          #060a10;
  --surface:     #0c1828;
  --surface2:    #070d18;
  --inset:       #040810;
  --border:      rgba(0, 200, 255, 0.18);
  --accent:      #FFB800;
  --accent-dim:  #c99000;
  --accent-flash:#ffe066;
  --cyan:        #00c8ff;
  --cyan-dim:    #007899;
  --text:        #e8f0f5;
  --text-dim:    #8ab0c8;
  --danger:      #ff3838;
  --success:     #00e87a;
  --cut:         14px;
}

/* ── Reset ─────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Body ──────────────────────────────────────── */
body {
  background: radial-gradient(ellipse at 40% 0%, #0a1220 0%, var(--bg) 65%);
  min-height: 100vh;
  color: var(--text);
  font-family: 'Rajdhani', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 600;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 16px;
}

/* ── App container ─────────────────────────────── */
.app-container {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}

/* ── Panel base ────────────────────────────────── */
.metronome-section,
.interval-section,
.interval-status,
.stopwatch-section {
  position: relative;
  background: linear-gradient(155deg, var(--surface) 0%, var(--surface2) 100%);
  border: 1px solid var(--border);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    inset 0 -1px 0 rgba(0, 0, 0, 0.45),
    0 8px 28px rgba(0, 0, 0, 0.75),
    0 2px 6px rgba(0, 0, 0, 0.5);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Cut corner — top-right */
.metronome-section::before,
.interval-section::before,
.interval-status::before,
.stopwatch-section::before {
  content: '';
  position: absolute;
  top: -1px;
  right: -1px;
  border-style: solid;
  border-width: 0 var(--cut) var(--cut) 0;
  border-color: transparent var(--bg) transparent transparent;
  z-index: 2;
  pointer-events: none;
}

/* Cut corner — bottom-left */
.metronome-section::after,
.interval-section::after,
.interval-status::after,
.stopwatch-section::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: -1px;
  border-style: solid;
  border-width: var(--cut) 0 0 var(--cut);
  border-color: transparent transparent transparent var(--bg);
  z-index: 2;
  pointer-events: none;
}

/* ── Section labels ────────────────────────────── */
.section-label {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--cyan);
  opacity: 0.7;
}

/* ── Beat Count Row ────────────────────────────── */
.beat-count-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sound-mode-btn {
  padding: 4px 11px;
  background: linear-gradient(180deg, #141e2e 0%, #0a1220 100%);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  cursor: pointer;
  min-height: 26px;
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: color 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.sound-mode-btn:hover { color: var(--text); }
.sound-mode-btn.cowbell {
  color: var(--accent);
  border-color: rgba(255, 184, 0, 0.4);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 0 10px rgba(255, 184, 0, 0.18);
}

.beat-count-ctrl {
  display: flex;
  align-items: center;
  gap: 10px;
}

.beat-count-btn {
  width: 28px;
  height: 28px;
  background: linear-gradient(180deg, #141e2e 0%, #0a1220 100%);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 2px 6px rgba(0, 0, 0, 0.5);
  transition: color 0.15s, box-shadow 0.15s;
}
.beat-count-btn:hover {
  color: var(--cyan);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 0 10px rgba(0, 200, 255, 0.18);
}
.beat-count-btn:active {
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.6);
  transform: translateY(1px);
}

#beatCountDisplay {
  font-family: 'Orbitron', monospace;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  min-width: 18px;
  text-align: center;
}

/* ── Beat Indicators ───────────────────────────── */
.beat-indicators {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  /* 8 × 40px items + 7 × 6px gaps = 362px — up to 8 per row (max 2 rows of 8). */
  max-width: 362px;
  margin: 0 auto;
}
/* On narrow phones, shrink the pips a touch so 8 still fit one row. */
@media (max-width: 380px) {
  .beat-indicators { gap: 4px; max-width: 100%; }
  .beat-indicator { width: 34px; }
}

.beat-indicator {
  width: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  user-select: none;
  padding: 3px 0;
  -webkit-tap-highlight-color: transparent;
}
.beat-indicator:active { opacity: 0.65; }

.beat-num {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  line-height: 1;
}

.beat-pip {
  display: block;
  width: 36px;
  height: 36px;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  transition: background 0.08s, filter 0.08s;
}

/* Mode fills — 3D gradient gem look */
.beat-indicator[data-mode="accent"] .beat-pip {
  background: linear-gradient(145deg, #ffe980 0%, #FFB800 55%, #7a5000 100%);
  filter: drop-shadow(0 0 5px rgba(255, 184, 0, 0.6));
}

.beat-indicator[data-mode="click"] .beat-pip {
  background: linear-gradient(145deg, #80eeff 0%, #00c8ff 55%, #004466 100%);
  filter: drop-shadow(0 0 5px rgba(0, 200, 255, 0.5));
}

.beat-indicator[data-mode="silent"] .beat-pip {
  background: linear-gradient(145deg, #141e2e 0%, #070d18 100%);
  filter: none;
}

/* Flash */
.beat-indicator.flash-accent .beat-pip {
  background: linear-gradient(145deg, #ffffff 0%, var(--accent-flash) 45%, #FFB800 100%) !important;
  filter: drop-shadow(0 0 14px rgba(255, 224, 102, 1)) !important;
}
.beat-indicator.flash-click .beat-pip {
  background: linear-gradient(145deg, #ffffff 0%, #aaefff 45%, var(--cyan) 100%) !important;
  filter: drop-shadow(0 0 14px rgba(0, 200, 255, 1)) !important;
}

/* ── BPM Display ───────────────────────────────── */
.bpm-display {
  text-align: center;
  line-height: 1;
}

.bpm-value-input {
  font-family: 'Orbitron', monospace;
  font-size: 4rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--text);
  background: transparent;
  border: none;
  outline: none;
  text-align: center;
  width: 100%;
  -moz-appearance: textfield;
  cursor: text;
  text-shadow: 0 0 40px rgba(184, 204, 216, 0.12);
}
.bpm-value-input::-webkit-inner-spin-button,
.bpm-value-input::-webkit-outer-spin-button { -webkit-appearance: none; }

.bpm-label {
  display: block;
  font-family: 'Orbitron', monospace;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--cyan);
  opacity: 0.65;
  text-transform: uppercase;
  margin-top: -4px;
}

/* ── BPM Slider ────────────────────────────────── */
.bpm-slider-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.slider-label {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-dim);
  white-space: nowrap;
  min-width: 28px;
}
.slider-label:last-child { text-align: right; }

.bpm-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 3px;
  border-radius: 0;
  background: linear-gradient(90deg, var(--cyan-dim) 0%, var(--inset) 100%);
  outline: none;
  cursor: pointer;
}
.bpm-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  background: linear-gradient(145deg, #80eeff 0%, var(--cyan) 55%, #004466 100%);
  cursor: pointer;
  filter: drop-shadow(0 0 4px rgba(0, 200, 255, 0.7));
}
.bpm-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 0;
  background: var(--cyan);
  cursor: pointer;
  border: none;
}

/* ── BPM Buttons ───────────────────────────────── */
.bpm-buttons {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.bpm-btn {
  flex: 1;
  padding: 6px 2px;
  background: linear-gradient(180deg, #141e2e 0%, #0a1220 100%);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  min-height: 30px;
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 2px 6px rgba(0, 0, 0, 0.5);
  transition: color 0.15s, box-shadow 0.15s;
}
.bpm-btn:hover {
  color: var(--cyan);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 0 12px rgba(0, 200, 255, 0.15), 0 2px 6px rgba(0, 0, 0, 0.5);
}
.bpm-btn:active {
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6);
  transform: translateY(1px);
}

/* ── Subdivision ───────────────────────────────── */
.subdivision-buttons {
  display: flex;
  gap: 5px;
}

.sub-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 3px;
  background: linear-gradient(180deg, #141e2e 0%, #0a1220 100%);
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  min-height: 34px;
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 2px 6px rgba(0, 0, 0, 0.4);
  transition: color 0.15s, box-shadow 0.15s;
}
.sub-btn:hover {
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 0 10px rgba(0, 200, 255, 0.12);
}
.sub-btn.active {
  background: linear-gradient(180deg, #0d1e32 0%, #071220 100%);
  color: var(--cyan);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    inset 0 0 0 1px rgba(0, 200, 255, 0.22),
    0 0 14px rgba(0, 200, 255, 0.18);
}

.sub-icon {
  font-size: 1.1rem;
  line-height: 1;
}

/* ── Start Row ─────────────────────────────────── */
.start-row {
  display: flex;
  gap: 10px;
}

/* ── START / STOP button ───────────────────────── */
.start-stop-btn {
  flex: 1;
  padding: 15px;
  background: linear-gradient(180deg, #ffd455 0%, #FFB800 45%, #a87200 100%);
  border: none;
  color: #060a10;
  font-family: 'Orbitron', monospace;
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  min-height: 48px;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -2px 0 rgba(0, 0, 0, 0.25),
    0 4px 18px rgba(255, 184, 0, 0.28),
    0 2px 6px rgba(0, 0, 0, 0.7);
  transition: box-shadow 0.15s, transform 0.08s;
}
.start-stop-btn:hover {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -2px 0 rgba(0, 0, 0, 0.25),
    0 4px 24px rgba(255, 184, 0, 0.45),
    0 2px 6px rgba(0, 0, 0, 0.7);
}
.start-stop-btn:active { transform: translateY(1px); }
.start-stop-btn.running {
  background: linear-gradient(180deg, #ff5c5c 0%, #dd1a1a 45%, #7a0000 100%);
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    inset 0 -2px 0 rgba(0, 0, 0, 0.3),
    0 4px 18px rgba(255, 50, 50, 0.3),
    0 2px 6px rgba(0, 0, 0, 0.7);
}
.start-stop-btn.running:hover {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    inset 0 -2px 0 rgba(0, 0, 0, 0.3),
    0 4px 24px rgba(255, 50, 50, 0.48),
    0 2px 6px rgba(0, 0, 0, 0.7);
}

/* ── TAP button ────────────────────────────────── */
.tap-btn {
  flex: 1;
  padding: 15px;
  background: linear-gradient(180deg, #141e2e 0%, #0a1220 100%);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: 'Orbitron', monospace;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  min-height: 48px;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 -2px 0 rgba(0, 0, 0, 0.4),
    0 4px 14px rgba(0, 0, 0, 0.65);
  transition: color 0.12s, box-shadow 0.12s, transform 0.06s;
}
.tap-btn:hover {
  color: var(--cyan);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 -2px 0 rgba(0, 0, 0, 0.4),
    0 0 18px rgba(0, 200, 255, 0.18),
    0 4px 14px rgba(0, 0, 0, 0.65);
}
.tap-btn:active {
  transform: translateY(1px);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.65), inset 0 0 14px rgba(0, 200, 255, 0.12);
}

/* ── Pause button ──────────────────────────────── */
.pause-btn {
  display: none;
  flex: 1;
  padding: 15px 8px;
  background: linear-gradient(180deg, #0d1e32 0%, #071220 100%);
  border: 1px solid rgba(0, 200, 255, 0.35);
  color: var(--cyan);
  font-family: 'Orbitron', monospace;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  min-height: 48px;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    inset 0 -2px 0 rgba(0, 0, 0, 0.4),
    0 0 12px rgba(0, 200, 255, 0.1),
    0 4px 14px rgba(0, 0, 0, 0.65);
  transition: color 0.12s, box-shadow 0.12s, transform 0.06s;
}
.pause-btn.visible { display: flex; align-items: center; justify-content: center; }
.pause-btn:active  { transform: translateY(1px); }
.pause-btn.resuming {
  border-color: rgba(0, 232, 122, 0.45);
  color: var(--success);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    inset 0 -2px 0 rgba(0, 0, 0, 0.4),
    0 0 14px rgba(0, 232, 122, 0.18),
    0 4px 14px rgba(0, 0, 0, 0.65);
}

/* ── Interval Toggle Row ───────────────────────── */
.interval-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--inset);
  border: 1px solid var(--border);
  clip-path: polygon(0 0, calc(100% - 4px) 0, 100% 4px, 100% 100%, 4px 100%, 0 calc(100% - 4px));
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  top: 3px;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  background: var(--text-dim);
  transition: transform 0.2s, background 0.2s;
}
.toggle-switch input:checked + .toggle-slider {
  border-color: rgba(0, 200, 255, 0.4);
  background: rgba(0, 200, 255, 0.08);
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(22px);
  background: var(--cyan);
}

/* ── Interval Config ───────────────────────────── */
.interval-config { display: none; }
.interval-config.visible { display: block; }

.config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.config-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.config-field label {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  line-height: 1.2;
}

.config-input {
  width: 100%;
  padding: 5px 6px;
  background: linear-gradient(180deg, var(--inset) 0%, #030609 100%);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  outline: none;
  min-height: 32px;
  clip-path: polygon(0 0, calc(100% - 5px) 0, 100% 5px, 100% 100%, 5px 100%, 0 calc(100% - 5px));
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.4);
  transition: border-color 0.15s;
}
.config-input:focus  { border-color: rgba(0, 200, 255, 0.45); }
.config-input:disabled { opacity: 0.35; cursor: not-allowed; }

.time-input {
  display: flex;
  align-items: center;
  gap: 3px;
}
.time-part {
  flex: 1;
  padding: 5px 3px;
  background: linear-gradient(180deg, var(--inset) 0%, #030609 100%);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  outline: none;
  min-height: 32px;
  min-width: 0;
  clip-path: polygon(0 0, calc(100% - 5px) 0, 100% 5px, 100% 100%, 5px 100%, 0 calc(100% - 5px));
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.4);
  transition: border-color 0.15s;
}
.time-part:focus   { border-color: rgba(0, 200, 255, 0.45); }
.time-part:disabled { opacity: 0.35; cursor: not-allowed; }

.time-sep {
  color: var(--text-dim);
  font-family: 'Orbitron', monospace;
  font-weight: 700;
  font-size: 0.9rem;
}

/* ── Interval Status ───────────────────────────── */
.interval-status { display: none; }
.interval-status.visible { display: flex; }

.status-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.status-phase {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 3px 10px;
  background: rgba(255, 184, 0, 0.1);
  color: var(--accent);
  border: 1px solid rgba(255, 184, 0, 0.28);
  clip-path: polygon(0 0, calc(100% - 5px) 0, 100% 5px, 100% 100%, 5px 100%, 0 calc(100% - 5px));
}
.status-phase.rest {
  background: rgba(0, 200, 255, 0.08);
  color: var(--cyan);
  border-color: rgba(0, 200, 255, 0.28);
}
.status-phase.countin {
  background: rgba(0, 232, 122, 0.1);
  color: var(--success);
  border-color: rgba(0, 232, 122, 0.3);
}
/* Sub-row toggle inside the ramp config (e.g. count-in) */
.interval-subrow { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }

.status-set {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dim);
  flex: 1;
  text-align: center;
}

.status-bpm {
  font-family: 'Orbitron', monospace;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text);
}

.status-countdown {
  font-family: 'Orbitron', monospace;
  font-size: 3.2rem;
  font-weight: 900;
  text-align: center;
  letter-spacing: 0.04em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 30px rgba(184, 204, 216, 0.1);
}

.progress-bar-container {
  height: 6px;
  background: var(--inset);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 100%;
  background-color: var(--cyan);
  background-image: repeating-linear-gradient(
    90deg,
    transparent 0,
    transparent 14px,
    rgba(4, 8, 16, 0.55) 14px,
    rgba(4, 8, 16, 0.55) 15px
  );
  box-shadow: 0 0 8px rgba(0, 200, 255, 0.5);
  transition: width 1s linear, background-color 0.3s;
}
.progress-bar.rest-mode {
  background-color: #3a60cc;
  box-shadow: 0 0 8px rgba(58, 96, 204, 0.5);
}

.status-next {
  text-align: center;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dim);
}

/* ── Done Overlay ──────────────────────────────── */
.done-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 100;
  justify-content: center;
  align-items: safe center;
  --overlay-pad: clamp(16px, 3vh, 32px);
  padding: var(--overlay-pad);
  padding-top: max(var(--overlay-pad), env(safe-area-inset-top, 0px));
  padding-right: max(var(--overlay-pad), env(safe-area-inset-right, 0px));
  padding-bottom: max(var(--overlay-pad), env(safe-area-inset-bottom, 0px));
  padding-left: max(var(--overlay-pad), env(safe-area-inset-left, 0px));
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.done-overlay.visible { display: flex; }

.done-message {
  background: linear-gradient(155deg, var(--surface) 0%, var(--surface2) 100%);
  border: 1px solid var(--border);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 20px 60px rgba(0, 0, 0, 0.85),
    0 0 40px rgba(0, 200, 255, 0.06);
  padding: 32px;
  text-align: center;
  max-width: 320px;
  width: 100%;
  max-height: calc(100vh - var(--overlay-pad) * 2 - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  max-height: calc(100dvh - var(--overlay-pad) * 2 - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 18px 100%, 0 calc(100% - 18px));
}
.done-message h2 {
  font-family: 'Orbitron', monospace;
  font-size: 1.2rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: var(--success);
  margin-bottom: 12px;
  text-shadow: 0 0 20px rgba(0, 232, 122, 0.4);
}
.done-message p {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 24px;
  line-height: 1.5;
}
.done-btn {
  padding: 12px 40px;
  background: linear-gradient(180deg, #ffd455 0%, #FFB800 45%, #a87200 100%);
  border: none;
  color: #060a10;
  font-family: 'Orbitron', monospace;
  font-size: 0.88rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  cursor: pointer;
  min-height: 40px;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 4px 14px rgba(255, 184, 0, 0.25);
  transition: box-shadow 0.15s;
}
.done-btn:hover {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 4px 20px rgba(255, 184, 0, 0.42);
}

/* ── Stopwatch ─────────────────────────────────── */
.stopwatch-section {
  padding: 10px 14px;
  gap: 8px;
}
.stopwatch-body { display: none; }
.stopwatch-body.visible {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stopwatch-display {
  font-family: 'Orbitron', monospace;
  font-size: 1.6rem;
  font-weight: 900;
  text-align: center;
  letter-spacing: 0.04em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 20px rgba(184, 204, 216, 0.1);
}
.stopwatch-controls { display: flex; gap: 8px; }

.stopwatch-btn {
  flex: 1;
  padding: 7px;
  border: none;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  min-height: 36px;
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px));
  transition: box-shadow 0.15s, transform 0.08s;
}
.stopwatch-btn.start-stop {
  background: linear-gradient(180deg, #ffd455 0%, #FFB800 45%, #a87200 100%);
  color: #060a10;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 3px 10px rgba(255, 184, 0, 0.2);
}
.stopwatch-btn.start-stop:hover {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 3px 16px rgba(255, 184, 0, 0.38);
}
.stopwatch-btn.start-stop:active { transform: translateY(1px); }
.stopwatch-btn.start-stop.running {
  background: linear-gradient(180deg, #ff5c5c 0%, #dd1a1a 45%, #7a0000 100%);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 3px 10px rgba(255, 50, 50, 0.2);
}
.stopwatch-btn.reset {
  background: linear-gradient(180deg, #141e2e 0%, #0a1220 100%);
  border: 1px solid var(--border);
  color: var(--text-dim);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 2px 6px rgba(0, 0, 0, 0.4);
}
.stopwatch-btn.reset:hover { color: var(--text); }

/* Stopwatch / Timer mode switch */
.sw-mode-row { display: flex; gap: 8px; }
.stopwatch-btn.sw-mode-btn {
  background: linear-gradient(180deg, #141e2e 0%, #0a1220 100%);
  border: 1px solid var(--border);
  color: var(--text-dim);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 2px 6px rgba(0, 0, 0, 0.4);
}
.stopwatch-btn.sw-mode-btn.active {
  border-color: var(--accent, #12a0ff);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(18, 160, 255, 0.35), 0 2px 10px rgba(18, 160, 255, 0.2);
}
.sw-timer-set { justify-content: center; }

/* Count-in bars: label on its own line, full-width touch-friendly button row */
.count-in-block { display: flex; flex-direction: column; gap: 10px; }
.count-in-row { gap: 8px; width: 100%; }
.count-in-row .ci-btn {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 10px 0;
  font-size: 1rem;
  letter-spacing: 0.06em;
  text-align: center;
  background: linear-gradient(180deg, #141e2e 0%, #0a1220 100%);
  border: 1px solid var(--border);
  color: var(--text-dim);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 2px 6px rgba(0, 0, 0, 0.4);
}
/* Clear, filled active state (accent) so the selected count-in is obvious */
.count-in-row .ci-btn.active {
  background: linear-gradient(180deg, #1ea7ff 0%, #0a66ff 100%);
  border-color: var(--accent, #12a0ff);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 2px 12px rgba(18, 160, 255, 0.4);
}
.stopwatch-display.sw-done {
  color: var(--danger, #ff5c5c);
  text-shadow: 0 0 20px rgba(255, 92, 92, 0.4);
}

/* Favourite ramps (saved configs) */
.ramp-favs { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.ramp-fav-select { font-size: 0.95rem; text-align: left; color-scheme: dark; }
.ramp-fav-select option { background: #0c1828; color: var(--text); }
.ramp-favs-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.ramp-fav-btn {
  flex: 1;
  min-width: 0;
  padding: 7px;
  min-height: 34px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #141e2e 0%, #0a1220 100%);
  color: var(--text-dim);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px));
  transition: box-shadow 0.15s, color 0.15s;
}
.ramp-fav-btn:hover { color: var(--text); }
.ramp-fav-btn:disabled { opacity: 0.4; cursor: default; color: var(--text-dim); }
.ramp-fav-btn.save { color: var(--text); border-color: rgba(18, 160, 255, 0.4); }
.ramp-fav-btn.danger:hover { color: var(--danger, #ff5c5c); }
.ramp-fav-sync-hint {
  align-self: flex-start;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-dim);
  text-align: left;
  cursor: default;
  line-height: 1.35;
}
.ramp-fav-sync-hint.is-cta {
  color: var(--cyan);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.ramp-fav-sync-hint.is-cta:hover { color: var(--text); }

/* Ramp export / import modal */
.ramp-io-gate {
  position: fixed; inset: 0; z-index: 340;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; background: rgba(2, 6, 12, 0.82);
}
.ramp-io-gate[hidden] { display: none; }
.ramp-io-card {
  position: relative; width: 100%; max-width: 400px; text-align: left;
  padding: 28px 24px 22px;
  background: linear-gradient(155deg, var(--surface) 0%, var(--surface2) 100%);
  border: 1px solid var(--border);
  box-shadow: 0 20px 60px rgba(0,0,0,0.85), 0 0 50px rgba(0,200,255,0.12);
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 16px 100%, 0 calc(100% - 16px));
}
.ramp-io-close {
  position: absolute; right: 12px; top: 10px;
  background: none; border: 0; color: var(--text-dim); font-size: 1rem; cursor: pointer;
}
.ramp-io-close:hover { color: var(--danger); }
.ramp-io-title {
  font-family: 'Orbitron', monospace; font-weight: 900; font-size: 1rem;
  letter-spacing: 0.04em; color: var(--text); margin-bottom: 8px; padding-right: 24px;
}
.ramp-io-msg {
  font-family: 'Rajdhani', sans-serif; font-size: 0.88rem; font-weight: 600;
  color: var(--text-dim); line-height: 1.4; margin: 0 0 16px;
}
.ramp-io-section { margin-bottom: 16px; }
.ramp-io-section:last-child { margin-bottom: 0; }
.ramp-io-section-label {
  font-family: 'Orbitron', monospace; font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--cyan); margin-bottom: 8px;
}
.ramp-io-list {
  max-height: 180px; overflow-y: auto; margin-bottom: 10px;
  border: 1px solid var(--border); background: var(--inset);
  padding: 6px 8px;
}
.ramp-io-item {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 2px;
  font-family: 'Rajdhani', sans-serif; font-size: 0.9rem; font-weight: 600; color: var(--text);
  cursor: pointer;
}
.ramp-io-item input { accent-color: var(--cyan); flex: none; }
.ramp-io-empty {
  font-family: 'Rajdhani', sans-serif; font-size: 0.85rem; font-weight: 600;
  color: var(--text-dim); margin: 0 0 10px;
}
.ramp-io-actions { display: flex; gap: 8px; }
.ramp-io-import-btn {
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 1 auto; padding: 7px 14px; box-sizing: border-box;
}
.ramp-io-status {
  min-height: 1.2em; margin: 8px 0 0;
  font-family: 'Rajdhani', sans-serif; font-size: 0.82rem; font-weight: 600; color: var(--cyan);
}
.ramp-io-status.is-error { color: var(--danger, #ff5c5c); }

/* ── Roguelite Mode ────────────────────────────── */
/* Reuses the existing Mass Effect HUD system (same panel base, cut corners,
   cyan/amber/danger/success vars) so it sits flush with the rest of the app. */
.rogue-section {
  position: relative;
  background: linear-gradient(155deg, var(--surface) 0%, var(--surface2) 100%);
  border: 1px solid var(--border);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    inset 0 -1px 0 rgba(0, 0, 0, 0.45),
    0 8px 28px rgba(0, 0, 0, 0.75),
    0 2px 6px rgba(0, 0, 0, 0.5);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.rogue-section::before {
  content: '';
  position: absolute;
  top: -1px; right: -1px;
  border-style: solid;
  border-width: 0 var(--cut) var(--cut) 0;
  border-color: transparent var(--bg) transparent transparent;
  z-index: 2; pointer-events: none;
}
.rogue-section::after {
  content: '';
  position: absolute;
  bottom: -1px; left: -1px;
  border-style: solid;
  border-width: var(--cut) 0 0 var(--cut);
  border-color: transparent transparent transparent var(--bg);
  z-index: 2; pointer-events: none;
}

.rogue-body { display: none; flex-direction: column; gap: 14px; }
.rogue-body.visible { display: flex; }

.rogue-intro {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text-dim);
}

.rogue-step { display: flex; flex-direction: column; gap: 7px; }

.rogue-step-label {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--cyan);
  opacity: 0.75;
}

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

.rogue-btn {
  padding: 9px 16px;
  background: linear-gradient(180deg, #141e2e 0%, #0a1220 100%);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  min-height: 38px;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 2px 6px rgba(0, 0, 0, 0.5);
  transition: color 0.15s, box-shadow 0.15s;
}
.rogue-btn:hover:not(:disabled) {
  color: var(--cyan);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 0 12px rgba(0, 200, 255, 0.15), 0 2px 6px rgba(0, 0, 0, 0.5);
}
.rogue-btn:active:not(:disabled) { transform: translateY(1px); }
.rogue-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.rogue-run-btn {
  background: linear-gradient(180deg, #ffd455 0%, #FFB800 45%, #a87200 100%);
  color: #060a10;
  border: none;
  font-family: 'Orbitron', monospace;
  font-weight: 900;
}
.rogue-run-btn:hover:not(:disabled) {
  color: #060a10;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 4px 20px rgba(255, 184, 0, 0.4);
}
.rogue-run-btn:disabled { color: #060a10; }

.rogue-select {
  flex: 1;
  min-width: 120px;
  padding: 7px 8px;
  background: linear-gradient(180deg, var(--inset) 0%, #030609 100%);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  outline: none;
  min-height: 36px;
  color-scheme: dark;   /* render the native dropdown popup dark, not white */
}
/* Force dark option rows on browsers that don't honour color-scheme alone. */
.rogue-select option { background: #0c1828; color: var(--text); }

.rogue-status {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-dim);
}
.rogue-status.error { color: var(--danger); }

/* TIME TRIAL / SUDDEN DEATH / GAUNTLET selector + free-mode params. */
.rogue-mode-select { display: flex; gap: 6px; margin-bottom: 10px; }
.rogue-mode-btn {
  flex: 1;
  min-width: 0;
  padding: 8px 3px;
  cursor: pointer;
  font-family: 'Orbitron', monospace;
  font-weight: 700;
  font-size: 0.6rem;
  letter-spacing: 0.02em;
  line-height: 1.2;
  white-space: normal;
  text-align: center;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.12);
  clip-path: polygon(7px 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%, 0 7px);
}
.rogue-mode-btn.active {
  color: #060a10;
  background: var(--cyan);
  border-color: var(--cyan);
}
.rogue-mode-btn:disabled { opacity: 0.5; cursor: default; }

.rogue-subdiv-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}
.rogue-subdiv-field .rogue-field-label {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.rogue-subdivision-buttons {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.rogue-subdiv-btn {
  flex: 1;
  min-width: 36px;
  padding: 6px 4px;
  background: linear-gradient(180deg, #141e2e 0%, #0a1220 100%);
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 4px) 0, 100% 4px, 100% 100%, 4px 100%, 0 calc(100% - 4px));
  transition: color 0.15s, box-shadow 0.15s;
}
.rogue-subdiv-btn:hover { color: var(--text); }
.rogue-subdiv-btn.active {
  color: var(--cyan);
  box-shadow: inset 0 0 0 1px rgba(0, 200, 255, 0.3), 0 0 10px rgba(0, 200, 255, 0.15);
}
.rogue-subdiv-btn:disabled { opacity: 0.5; cursor: default; }
.rogue-subdiv-btn .sub-icon { font-size: 1.1rem; line-height: 1; }

.rogue-field-row { display: flex; gap: 10px; margin-bottom: 6px; }
.rogue-field { display: flex; flex-direction: column; gap: 3px; flex: 1; }

/* BPM ladder stepper (Time Trial / Sudden Death): −  120  + */
.rogue-stepper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(180deg, var(--inset) 0%, #030609 100%);
  border: 1px solid var(--border);
  clip-path: polygon(0 0, calc(100% - 5px) 0, 100% 5px, 100% 100%, 5px 100%, 0 calc(100% - 5px));
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.4);
  padding: 2px;
  min-height: 36px;
}
.rogue-step-btn {
  width: 34px;
  align-self: stretch;
  background: linear-gradient(180deg, #141e2e 0%, #0a1220 100%);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 5px) 0, 100% 5px, 100% 100%, 5px 100%, 0 calc(100% - 5px));
  transition: color 0.15s, box-shadow 0.15s;
}
.rogue-step-btn:hover:not(:disabled) {
  color: var(--cyan);
  box-shadow: 0 0 10px rgba(0, 200, 255, 0.18);
}
.rogue-step-btn:active:not(:disabled) { transform: translateY(1px); }
.rogue-step-btn:disabled { opacity: 0.3; cursor: default; }
.rogue-step-val {
  flex: 1;
  text-align: center;
  font-family: 'Orbitron', monospace;
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.rogue-field-hint {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-dim);
  margin-top: 2px;
}
.rogue-field > span {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}

/* Calibration tempo field — label + number with a BPM unit suffix. */
.rogue-cal-tempo { display: block; margin-bottom: 8px; }
.rogue-field-label {
  display: block;
  margin-bottom: 4px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}
.rogue-input-unit { display: flex; align-items: center; gap: 8px; }
.rogue-input-unit .config-input { flex: 1; }
.rogue-unit {
  font-family: 'Orbitron', monospace;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* Skip-calibration manual offset row. */
.rogue-manual-row { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.rogue-manual-input { width: 90px; flex: 0 0 auto; }

/* Prominent count-off / live banners during calibration and runs. */
.rogue-status.countin,
.rogue-status.live {
  font-family: 'Orbitron', monospace;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 4px;
  padding: 8px 10px;
  border-left: 3px solid currentColor;
  background: rgba(255, 255, 255, 0.04);
}
.rogue-status.countin {
  color: var(--accent);
  animation: rogue-countin-pulse 0.5s steps(1, end) infinite alternate;
}
.rogue-status.live { color: var(--success); }
@keyframes rogue-countin-pulse {
  from { opacity: 1; }
  to   { opacity: 0.55; }
}

.rogue-kicknote {
  font-family: 'Orbitron', monospace;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text);
}

.rogue-level-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.rogue-level-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 9px 4px;
  background: linear-gradient(180deg, #141e2e 0%, #0a1220 100%);
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  min-height: 48px;
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 2px 6px rgba(0, 0, 0, 0.4);
  transition: color 0.15s, box-shadow 0.15s;
}
.rogue-level-btn:hover:not(:disabled) { color: var(--text); }
.rogue-level-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.rogue-level-btn.active {
  background: linear-gradient(180deg, #0d1e32 0%, #071220 100%);
  color: var(--cyan);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    inset 0 0 0 1px rgba(0, 200, 255, 0.3),
    0 0 14px rgba(0, 200, 255, 0.2);
}
.rogue-level-n {
  font-family: 'Orbitron', monospace;
  font-size: 0.92rem;
  font-weight: 900;
  line-height: 1;
}
.rogue-level-d {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* Run-over / complete overlay (reuses .done-overlay / .done-message base) */
.rogue-overlay-title {
  font-family: 'Orbitron', monospace;
  font-size: 1.2rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  margin-bottom: 16px;
  flex-shrink: 0;
}
.rogue-overlay-title.fail { color: var(--danger); text-shadow: 0 0 20px rgba(255, 56, 56, 0.4); }
.rogue-overlay-title.win  { color: var(--success); text-shadow: 0 0 20px rgba(0, 232, 122, 0.4); }

.rogue-diag-big {
  font-family: 'Orbitron', monospace;
  font-size: 2.4rem;
  font-weight: 900;
  color: var(--text);
  line-height: 1;
  margin-bottom: 12px;
}
.rogue-diag-line {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  line-height: 1.4;
}
.rogue-diag-sub {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dim);
  line-height: 1.5;
}
.rogue-overlay .done-message {
  margin-bottom: 0;
  max-width: 420px;
  padding: 36px 34px;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* scroll the body; keep title + actions visible */
}
#rogueOverlayBody {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* Dark-only scrollbars on overlay modals (nested scroll areas ignore OS theme). */
.done-overlay,
.done-message,
#rogueOverlayBody {
  color-scheme: dark;
  scrollbar-width: thin;
  scrollbar-color: rgba(138, 176, 200, 0.38) var(--inset);
}
.done-overlay::-webkit-scrollbar,
.done-message::-webkit-scrollbar,
#rogueOverlayBody::-webkit-scrollbar { width: 8px; }
.done-overlay::-webkit-scrollbar-track,
.done-message::-webkit-scrollbar-track,
#rogueOverlayBody::-webkit-scrollbar-track { background: var(--inset); }
.done-overlay::-webkit-scrollbar-thumb,
.done-message::-webkit-scrollbar-thumb,
#rogueOverlayBody::-webkit-scrollbar-thumb {
  background: rgba(138, 176, 200, 0.38);
  border-radius: 4px;
}
.done-overlay::-webkit-scrollbar-thumb:hover,
.done-message::-webkit-scrollbar-thumb:hover,
#rogueOverlayBody::-webkit-scrollbar-thumb:hover {
  background: rgba(138, 176, 200, 0.58);
}

.rogue-overlay-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 22px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.rogue-overlay-actions .done-btn {
  flex: 1 1 auto;
  min-width: 140px;
}
.done-btn-secondary {
  background: transparent;
  border: 1px solid rgba(255, 184, 0, 0.45);
  color: var(--text);
  box-shadow: none;
}
.done-btn-secondary:hover {
  background: rgba(255, 184, 0, 0.08);
  box-shadow: 0 0 12px rgba(255, 184, 0, 0.15);
}

/* ── Number spinners — hide ────────────────────── */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; }
input[type="number"] { -moz-appearance: textfield; }

/* ── Responsive ────────────────────────────────── */
@media (max-width: 360px) {
  .subdivision-buttons { gap: 3px; }
  .sub-btn { padding: 4px 2px; }
  .config-grid { grid-template-columns: 1fr 1fr 1fr; gap: 5px; }
  .config-field label { font-size: 0.55rem; }
  .bpm-value-input { font-size: 3.2rem; }
}

/* ═══ Roguelite Focused HUD — active only while a run is live (body.rogue-run) ═══ */
.rogue-hud { display: none; }
body.rogue-run .rogue-hud {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin: 12px 0 6px;
}
.rogue-hud-banner {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.rogue-hud-banner.countin {
  color: var(--accent);
  animation: rogue-countin-pulse 0.5s steps(1, end) infinite alternate;
}
.rogue-hud-banner.live { color: var(--success); }
.rogue-hud-verdict {
  font-family: 'Orbitron', monospace;
  font-weight: 900;
  font-size: 3.6rem;
  line-height: 1;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  transition: color 0.06s ease, text-shadow 0.06s ease;
}
.rogue-hud-verdict.rogue-good { color: var(--success); text-shadow: 0 0 18px rgba(0, 232, 122, 0.6); }
.rogue-hud-verdict.rogue-drag { color: var(--accent);  text-shadow: 0 0 18px rgba(255, 184, 0, 0.6); }
.rogue-hud-verdict.rogue-rush { color: #ff7a18;        text-shadow: 0 0 18px rgba(255, 122, 24, 0.65); }
.rogue-hud-verdict.rogue-bad  { color: var(--danger);  text-shadow: 0 0 20px rgba(255, 56, 56, 0.75); }
.rogue-hud-bpm {
  font-family: 'Orbitron', monospace;
  font-weight: 700;
  font-size: 1.9rem;
  color: var(--cyan);
}

/* Scrolling beat-history lane — newest slides in on the right, oldest fades off the
   left. Width = exactly 10 cells (10×26 + 9×5 = 305px) so 10 full hexagons show. */
.rogue-lane {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  width: 305px;
  max-width: 100%;
  height: 32px;
  overflow: hidden;
}
.rogue-lane-cell {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  animation: rogue-lane-in 0.12s ease-out;
}
.rogue-lane-cell.rogue-good { background: linear-gradient(145deg, #b6ffd9 0%, var(--success) 55%, #00643a 100%); filter: drop-shadow(0 0 6px rgba(0, 232, 122, 0.7)); }
.rogue-lane-cell.rogue-drag { background: linear-gradient(145deg, #ffe980 0%, var(--accent) 55%, #7a5000 100%); filter: drop-shadow(0 0 6px rgba(255, 184, 0, 0.7)); }
.rogue-lane-cell.rogue-rush { background: linear-gradient(145deg, #ffc187 0%, #ff7a18 55%, #6e3000 100%); filter: drop-shadow(0 0 6px rgba(255, 122, 24, 0.75)); }
.rogue-lane-cell.rogue-bad  { background: linear-gradient(145deg, #ffd0d0 0%, var(--danger) 55%, #5a0000 100%); filter: drop-shadow(0 0 7px rgba(255, 56, 56, 0.85)); }
.rogue-lane-cell.leaving { animation: rogue-lane-out 0.24s ease-in forwards; }
@keyframes rogue-lane-in  { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: translateX(0); } }
@keyframes rogue-lane-out { from { opacity: 1; transform: translateX(0) scale(1); } to { opacity: 0; transform: translateX(-10px) scale(0.55); } }

/* Declutter: while a run is live, the page IS the game — hide everything else. */
body.rogue-run .beat-indicators,
body.rogue-run .beat-count-row,
body.rogue-run .bpm-display,
body.rogue-run .bpm-slider-container,
body.rogue-run .bpm-buttons,
body.rogue-run .subdivision-buttons,
body.rogue-run .pause-btn,
body.rogue-run .tap-btn,
body.rogue-run .interval-section,
body.rogue-run .stopwatch-section,
body.rogue-run .rogue-section { display: none !important; }

/* Result card — Good / Neutral / Bad table with hexagon icons, then % green. */
.rogue-result { margin: 14px auto 4px; max-width: 280px; }
.rogue-result-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.rogue-hex {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}
.rogue-hex.rogue-good { background: linear-gradient(145deg, #b6ffd9 0%, var(--success) 55%, #00643a 100%); }
.rogue-hex.rogue-drag { background: linear-gradient(145deg, #ffe980 0%, var(--accent) 55%, #7a5000 100%); }
.rogue-hex.rogue-bad  { background: linear-gradient(145deg, #ffd0d0 0%, var(--danger) 55%, #5a0000 100%); }
.rl-lbl {
  flex: 1 1 auto;
  text-align: left;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}
.rl-split { font-weight: 600; font-size: 0.74rem; color: var(--text-dim); }
.rl-n {
  flex: 0 0 auto;
  font-family: 'Orbitron', monospace;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
}
.rogue-result-score { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; margin-top: 18px; }

/* Per-hit timeline (collapsible chart on the result card) */
.rl-timeline { margin: 14px auto 0; max-width: 540px; text-align: left; }
.rl-timeline > summary {
  cursor: pointer;
  font-family: 'Orbitron', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: #9fe7ff;
  padding: 6px 2px;
  list-style: revert;
}
.rl-timeline > summary:hover { color: #cfe9ff; }
.rl-timeline-svg {
  width: 100%; height: auto; display: block;
  background: rgba(10, 20, 34, 0.6);
  border: 1px solid rgba(0, 200, 255, 0.18);
  border-radius: 2px;
}
.rogue-result-rank {
  font-family: 'Orbitron', monospace;
  font-weight: 900;
  font-style: italic;
  font-size: 3.6rem;
  line-height: 1;
  letter-spacing: 0.02em;
}
/* A/S/SS hero emblem (result screen only — the in-game HUD stays compact). */
.rogue-result-rank.has-art { font-style: normal; line-height: 0; }
.rank-art {
  display: block;
  width: 210px; height: 210px; max-width: 62vw; max-height: 62vw;
  object-fit: contain;
  /* No drop-shadow filter: it forces a per-frame shadow re-render while the
     emblem scales (rankBurst). The PNG already carries its own glow. */
}
.rogue-result-pct {
  font-family: 'Orbitron', monospace;
  font-weight: 900;
  font-size: 2.2rem;
  color: var(--success);
  text-shadow: 0 0 16px rgba(0, 232, 122, 0.5);
}
.rogue-result-pct span { font-size: 1.1rem; font-weight: 700; color: var(--text-dim); }

/* Live HUD rank + filling gauge meter — spans the lane width (305px) for continuity:
   rank flush-left (at the first hexagon), gauge flexing out to the right hexagon.
   The rank sits in a fixed 2-char slot so the gauge start doesn't shift when E→SS. */
.rogue-hud-score {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 305px;
  max-width: 100%;
  margin: 2px auto 0;
}
.rogue-hud-rank {
  flex: 0 0 auto;
  min-width: 2.1ch;
  text-align: left;
  font-family: 'Orbitron', monospace;
  font-weight: 900;
  font-style: italic;
  font-size: 2.4rem;
  line-height: 1;
  letter-spacing: 0.02em;
}
.rogue-hud-gauge {
  flex: 1 1 auto;
  height: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  clip-path: polygon(4px 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%, 0 4px);
  overflow: hidden;
}
.rogue-hud-gauge-fill {
  display: block;
  width: 0;
  height: 100%;
  background: var(--cyan);
  box-shadow: 0 0 10px currentColor;
  transition: width 0.15s ease, background 0.15s ease;
}

/* Rank colours (shared by live HUD + result card) — escalating sci-fi palette. */
.rank-ss { color: #ffe066; text-shadow: 0 0 10px rgba(255, 224, 102, 0.9), 0 0 28px rgba(255, 184, 0, 0.7); }
.rank-s  { color: var(--cyan);    text-shadow: 0 0 10px rgba(0, 200, 255, 0.85), 0 0 24px rgba(0, 200, 255, 0.5); }
.rank-a  { color: var(--success); text-shadow: 0 0 10px rgba(0, 232, 122, 0.8); }
.rank-b  { color: #4aa8ff;        text-shadow: 0 0 9px rgba(74, 168, 255, 0.7); }
.rank-c  { color: #b06fff;        text-shadow: 0 0 9px rgba(176, 111, 255, 0.6); }
.rank-d  { color: var(--text-dim); }
.rank-e  { color: var(--danger);  text-shadow: 0 0 9px rgba(255, 56, 56, 0.6); }

/* ═══════════════════════════════════════════════════
   CLOUD / ACCOUNT + STATS PAGE
═══════════════════════════════════════════════════ */

/* Auth bar (app + stats pages) */
.cloud-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.cloud-authbar { display: flex; align-items: center; gap: 8px; min-height: 32px; }
.cloud-name { font-family: 'Rajdhani', sans-serif; font-weight: 700; color: var(--text); font-size: 0.85rem; }
.cloud-avatar { width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--border); }
.cloud-avatar.sm { width: 20px; height: 20px; }

.cloud-btn {
  padding: 7px 12px;
  background: linear-gradient(180deg, #141e2e 0%, #0a1220 100%);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  min-height: 32px;
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px));
  transition: color 0.15s, box-shadow 0.15s;
}
.cloud-btn:hover { color: var(--cyan); box-shadow: 0 0 10px rgba(0, 200, 255, 0.18); }
.cloud-google { display: inline-flex; align-items: center; gap: 8px; }
.cloud-g {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; color: #4285F4; font-family: 'Orbitron', monospace; font-weight: 900; font-size: 0.72rem;
}
.cloud-stats-link {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--cyan);
  text-decoration: none;
  white-space: nowrap;
}
.cloud-stats-link:hover { text-shadow: 0 0 10px rgba(0, 200, 255, 0.4); }

.cloud-local-badge {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--amber, #ffb020);
  border: 1px solid rgba(255, 176, 32, 0.45);
  border-radius: 3px;
  padding: 1px 5px;
  text-transform: uppercase;
}
.cloud-dev-signin-wrap { display: inline-flex; }
.cloud-dev-picker {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.cloud-dev-picker-panel {
  background: var(--panel, #0f1824);
  border: 1px solid var(--border, #2a3d52);
  border-radius: 8px;
  padding: 20px;
  min-width: 240px;
  max-width: 320px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}
.cloud-dev-picker-title {
  margin: 0 0 4px;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text, #e8f0f5);
}
.cloud-dev-picker-hint {
  margin: 0 0 14px;
  font-size: 0.8rem;
  color: var(--muted, #8ab0c8);
}
.cloud-dev-picker-users {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.cloud-dev-picker-user { width: 100%; justify-content: center; }
.cloud-dev-picker-cancel { width: 100%; opacity: 0.85; }

/* Stats page */
.stats-section { gap: 14px; }
.stats-footer {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid rgba(0, 200, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #8ab0c8;
}
.stats-footer a {
  color: #00c8ff;
  text-decoration: none;
}
.stats-footer a:hover { color: #FFB800; }

.app-footer {
  margin-top: 20px;
  padding: 20px 4px 8px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}
.app-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  justify-content: flex-end;
}
.app-footer a {
  color: var(--cyan);
  text-decoration: none;
}
.app-footer a:hover { color: var(--accent); }
body.rogue-run .app-footer { display: none; }

.stats-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stats-title {
  font-family: 'Orbitron', monospace;
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: var(--text);
}
.stats-signedout p {
  font-family: 'Rajdhani', sans-serif; font-weight: 600; color: var(--text-dim);
  line-height: 1.45; margin-bottom: 12px;
}

.stats-viewtoggle, .stats-modes { display: flex; gap: 6px; }
.stats-subdivisions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}
.stats-subdiv-btn {
  flex: 1;
  min-width: 0;
  padding: 8px 4px;
  background: linear-gradient(180deg, #141e2e 0%, #0a1220 100%);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
  text-transform: uppercase;
  cursor: pointer;
  min-height: 36px;
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px));
  transition: color 0.15s, box-shadow 0.15s;
}
.stats-subdiv-btn:hover { color: var(--text); }
.stats-subdiv-btn.active {
  background: linear-gradient(180deg, #0d1e32 0%, #071220 100%);
  color: var(--cyan);
  box-shadow: inset 0 0 0 1px rgba(0, 200, 255, 0.3), 0 0 14px rgba(0, 200, 255, 0.18);
}
.stats-view-btn, .stats-mode-btn {
  flex: 1;
  padding: 9px 6px;
  background: linear-gradient(180deg, #141e2e 0%, #0a1220 100%);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.8rem; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer; min-height: 38px;
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px));
  transition: color 0.15s, box-shadow 0.15s;
}
.stats-view-btn:hover, .stats-mode-btn:hover { color: var(--text); }
.stats-view-btn.active, .stats-mode-btn.active {
  background: linear-gradient(180deg, #0d1e32 0%, #071220 100%);
  color: var(--cyan);
  box-shadow: inset 0 0 0 1px rgba(0, 200, 255, 0.3), 0 0 14px rgba(0, 200, 255, 0.18);
}

.stats-subselect { display: flex; align-items: center; gap: 10px; }
.stats-sub-label {
  font-family: 'Rajdhani', sans-serif; font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--cyan); opacity: 0.8;
}

.stats-summary { display: flex; gap: 16px; flex-wrap: wrap; }
.stats-stat { font-family: 'Rajdhani', sans-serif; font-size: 0.82rem; color: var(--text-dim); }
.stats-stat b { font-family: 'Orbitron', monospace; color: var(--text); font-size: 1rem; }

.stats-loading, .stats-empty {
  font-family: 'Rajdhani', sans-serif; font-weight: 600; color: var(--text-dim);
  text-align: center; padding: 18px 8px;
}
.stats-lb-where {
  font-family: 'Rajdhani', sans-serif; font-size: 0.75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); margin-bottom: 6px;
}

.stats-table { width: 100%; border-collapse: collapse; font-family: 'Rajdhani', sans-serif; }
.stats-table th {
  text-align: left; font-size: 0.64rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--cyan); opacity: 0.7; padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}
.stats-table td {
  padding: 8px 8px; font-size: 0.9rem; font-weight: 600; color: var(--text);
  border-bottom: 1px solid rgba(0, 200, 255, 0.07);
}
.stats-table tbody tr:hover { background: rgba(0, 200, 255, 0.04); }
.stats-rank { font-family: 'Orbitron', monospace; font-weight: 900; }
.stats-player { display: inline-flex; align-items: center; gap: 7px; }
.stats-pos {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; font-family: 'Orbitron', monospace; font-weight: 900; color: var(--text-dim);
}
.stats-pos.top { color: var(--accent); }

/* ── Brand / logo ──────────────────────────────── */
.app-brand {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 2px 0 4px;
}
/* Settings gear (top-right) + panel */
.settings-gear {
  position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px; padding: 0;
  background: transparent; border: 1px solid var(--border); color: var(--text-dim);
  font-size: 1.1rem; line-height: 1; cursor: pointer; border-radius: 50%;
  transition: color 0.15s, border-color 0.15s, transform 0.2s;
}
.settings-gear:hover { color: var(--cyan); border-color: var(--cyan); transform: translateY(-50%) rotate(45deg); }
.settings-overlay {
  position: fixed; inset: 0; z-index: 300; display: flex;
  align-items: flex-start; justify-content: center; padding: 64px 18px;
  background: rgba(2, 6, 12, 0.7);
}
.settings-overlay[hidden] { display: none; }
.settings-panel {
  width: 100%; max-width: 360px;
  background: linear-gradient(155deg, var(--surface) 0%, var(--surface2) 100%);
  border: 1px solid var(--border); padding: 18px 20px 22px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.8);
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
}
.settings-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.settings-title { font-family: 'Orbitron', monospace; font-weight: 900; font-size: 0.95rem; letter-spacing: 0.06em; color: var(--text); }
.settings-close { background: none; border: 0; color: var(--text-dim); font-size: 1rem; cursor: pointer; padding: 4px 6px; }
.settings-close:hover { color: var(--danger); }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 8px 0; }
.settings-row-label { font-family: 'Rajdhani', sans-serif; font-weight: 700; font-size: 0.92rem; color: var(--text); display: flex; flex-direction: column; gap: 2px; }
.settings-row-label-left { align-items: flex-start; text-align: left; }
.settings-row-label small { font-weight: 600; font-size: 0.72rem; color: var(--text-dim); }
/* Keep the toggle at its full size even when the label text is long (it would
   otherwise get flex-shrunk and look different from the others). */
.settings-row .toggle-switch { flex: none; }
.settings-row-btn { width: 100%; background: none; border: 0; border-top: 1px solid var(--border); margin-top: 4px; cursor: pointer; }
/* What's New banner (below brand header) */
.whats-new-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin: 0 0 8px;
  padding: 10px 14px;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text);
  background: linear-gradient(90deg, rgba(255, 184, 0, 0.12), rgba(0, 200, 255, 0.08));
  border: 1px solid rgba(255, 184, 0, 0.35);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
}
.whats-new-banner[hidden] { display: none; }
.whats-new-text strong { color: var(--gold-flash); font-weight: 700; }
.whats-new-link {
  font-family: 'Orbitron', monospace;
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--cyan);
  transition: color 0.15s;
}
.whats-new-link:hover { color: var(--gold); }
.whats-new-dismiss {
  margin-left: auto;
  padding: 2px 8px;
  background: transparent;
  border: 0;
  color: var(--text-dim);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s;
}
.whats-new-dismiss:hover { color: var(--danger); }

.settings-patch-notes-btn { margin-top: 8px; text-decoration: none; color: inherit; }
.settings-patch-notes-btn:hover .settings-row-label { color: var(--cyan); }
.settings-patch-notes-btn:hover .settings-disclosure { color: var(--cyan); }

.settings-faq-btn { margin-top: 4px; text-decoration: none; color: inherit; }
.settings-faq-btn:hover .settings-row-label { color: var(--cyan); }
.settings-faq-btn:hover .settings-disclosure { color: var(--cyan); }
.settings-tutorial-btn { text-decoration: none; color: inherit; }
.settings-tutorial-btn:hover .settings-row-label { color: var(--cyan); }
.settings-tutorial-btn:hover .settings-disclosure { color: var(--cyan); }
.settings-feedback-btn { margin-top: 4px; }
.settings-feedback-btn:hover .settings-row-label { color: var(--cyan); }
.settings-feedback-btn:hover .settings-disclosure { color: var(--cyan); }
.settings-disclosure { color: var(--text-dim); font-size: 0.9rem; transition: transform 0.15s; }
.settings-shortcuts { border-top: 1px solid var(--border); padding-top: 8px; }
.sc-group { font-family: 'Orbitron', monospace; font-size: 0.62rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--cyan); margin: 8px 0 3px; }
.sc-table { width: 100%; border-collapse: collapse; }
.sc-table td { padding: 3px 0; font-family: 'Rajdhani', sans-serif; font-size: 0.84rem; font-weight: 600; color: var(--text); }
.sc-table td:first-child { width: 104px; white-space: nowrap; }
.sc-table kbd { display: inline-block; min-width: 14px; text-align: center; padding: 1px 5px; font-family: 'Rajdhani', sans-serif; font-size: 0.72rem; font-weight: 700; color: var(--text); background: var(--inset); border: 1px solid var(--border); }
.sc-hint { font-size: 0.7rem; color: var(--text-dim); opacity: 0.8; margin-top: 8px; }

/* ── Profile management editor ── */
.profile-settings {
  border-top: 1px solid var(--border);
  padding-top: 10px;
  padding-bottom: 4px;
}
.profile-settings[hidden] { display: none; }
#profileToggleRow[hidden] { display: none; }
.profile-field { display: block; margin-bottom: 12px; border: 0; padding: 0; min-width: 0; }
.profile-avatar-field { margin-left: 0; padding-left: 0; }
.profile-field-label {
  display: block;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 0.86rem;
  color: var(--text);
  margin-bottom: 6px;
}
.profile-field .config-input,
.profile-field .rogue-select { width: 100%; box-sizing: border-box; }
.profile-avatar-modes { display: flex; flex-direction: column; gap: 6px; }
.profile-avatar-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}
.profile-custom-url-row { margin-top: 8px; }
.profile-custom-url-row[hidden] { display: none; }
.profile-avatar-preview { margin-top: 10px; width: 40px; height: 40px; }
.profile-avatar-preview[hidden] { display: none; }
.profile-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.profile-save-btn { flex: 1 1 auto; min-width: 120px; }
.profile-status {
  min-height: 1.2em;
  margin: 8px 0 0;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--cyan);
}
.profile-status.is-error { color: var(--danger); }

.profile-signin-prompt { margin-bottom: 4px; }
.profile-signin-prompt[hidden] { display: none; }
.profile-signed-in[hidden] { display: none; }
.profile-signin-msg {
  margin: 0 0 10px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-dim);
  line-height: 1.45;
}
.profile-signin-btn { width: 100%; }

.profile-danger-zone {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 56, 56, 0.25);
}
.profile-delete-account-btn {
  width: 100%;
  background: linear-gradient(180deg, #4a1010 0%, #2a0808 100%);
  border-color: rgba(255, 56, 56, 0.45);
  color: #ffb0b0;
}
.profile-delete-account-btn:hover:not(:disabled) {
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 0 14px rgba(255, 56, 56, 0.35), 0 2px 6px rgba(0, 0, 0, 0.5);
}
.profile-deletion-pending {
  margin-top: 12px;
  padding: 10px 12px;
  background: rgba(255, 184, 0, 0.08);
  border: 1px solid rgba(255, 184, 0, 0.35);
}
.profile-deletion-pending[hidden] { display: none; }
.profile-deletion-pending-msg {
  margin: 0 0 8px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--amber, #ffb800);
  line-height: 1.4;
}
.profile-cancel-deletion-btn { width: 100%; }

.profile-delete-dialog {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(2, 6, 12, 0.88);
}
.profile-delete-panel {
  position: relative;
  width: 100%;
  max-width: 420px;
  padding: 26px 24px 22px;
  background: linear-gradient(155deg, var(--surface) 0%, var(--surface2) 100%);
  border: 1px solid rgba(255, 56, 56, 0.35);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.85), 0 0 40px rgba(255, 56, 56, 0.12);
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 16px 100%, 0 calc(100% - 16px));
}
.profile-delete-close {
  position: absolute;
  right: 12px;
  top: 10px;
  background: none;
  border: 0;
  color: var(--text-dim);
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
}
.profile-delete-close:hover { color: var(--danger); }
.profile-delete-title {
  margin: 0 0 10px;
  font-family: 'Orbitron', monospace;
  font-weight: 900;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  color: var(--danger);
}
.profile-delete-lead {
  margin: 0 0 14px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-dim);
  line-height: 1.45;
}
.profile-delete-grace {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}
.profile-delete-grace small {
  display: block;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-dim);
  margin-top: 2px;
}
.profile-delete-confirm-label {
  display: block;
  margin-bottom: 16px;
}
.profile-delete-confirm-label > span {
  display: block;
  margin-bottom: 6px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text);
}
.profile-delete-confirm-input { width: 100%; box-sizing: border-box; }
.profile-delete-actions {
  display: flex;
  gap: 10px;
}
.profile-delete-cancel-btn { flex: 1; }
.profile-delete-confirm-btn {
  flex: 1.4;
  background: linear-gradient(180deg, #6a1818 0%, #3a0a0a 100%);
  border-color: rgba(255, 56, 56, 0.5);
  color: #ffc0c0;
}
.profile-delete-confirm-btn:hover:not(:disabled) {
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 0 14px rgba(255, 56, 56, 0.4), 0 2px 6px rgba(0, 0, 0, 0.5);
}
.profile-delete-status {
  min-height: 1.2em;
  margin: 12px 0 0;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--cyan);
}
.profile-delete-status.is-error { color: var(--danger); }

/* ── Beta access gate (Game Mode) ── */
.beta-gate { position: fixed; inset: 0; z-index: 350; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(2, 6, 12, 0.82); }
.beta-gate[hidden] { display: none; }
.beta-gate-card {
  position: relative; width: 100%; max-width: 360px; text-align: center;
  padding: 30px 26px 26px;
  background: linear-gradient(155deg, var(--surface) 0%, var(--surface2) 100%);
  border: 1px solid var(--border);
  box-shadow: 0 20px 60px rgba(0,0,0,0.85), 0 0 50px rgba(0,200,255,0.12);
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 16px 100%, 0 calc(100% - 16px));
}
.beta-gate-close { position: absolute; right: 12px; top: 10px; background: none; border: 0; color: var(--text-dim); font-size: 1rem; cursor: pointer; }
.beta-gate-close:hover { color: var(--danger); }
.beta-gate-logo { width: 54px; height: 54px; border-radius: 50%; filter: drop-shadow(0 0 12px rgba(0,200,255,0.3)); margin-bottom: 10px; }
.beta-gate-title { font-family: 'Orbitron', monospace; font-weight: 900; font-size: 1.05rem; letter-spacing: 0.04em; color: var(--text); margin-bottom: 8px; }
.beta-gate-msg { font-family: 'Rajdhani', sans-serif; font-size: 0.9rem; font-weight: 600; color: var(--text-dim); line-height: 1.45; margin-bottom: 16px; }
.beta-signin { display: inline-flex; align-items: center; gap: 8px; }
.beta-wait { display: flex; gap: 8px; }
.beta-wait input { flex: 1; min-width: 0; padding: 9px 10px; background: var(--inset); border: 1px solid var(--border); color: var(--text); font-family: 'Rajdhani', sans-serif; font-weight: 600; color-scheme: dark; }
.beta-wait-msg { font-family: 'Rajdhani', sans-serif; font-size: 0.82rem; font-weight: 600; color: var(--cyan); margin-top: 10px; min-height: 1em; }
.brand-logo {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  flex: none;
  filter: drop-shadow(0 0 10px rgba(0, 200, 255, 0.25));
}
.brand-word {
  font-family: 'Orbitron', monospace;
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  color: var(--text);
  text-shadow: 0 0 24px rgba(184, 204, 216, 0.18);
}
/* Early-access tag tucked beside the title (hover shows the version). */
.brand-beta {
  align-self: flex-start;
  margin: 1px 0 0 -7px;
  padding: 2px 6px 1px;
  font-family: 'Orbitron', monospace;
  font-size: 0.5rem; font-weight: 900; letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #0a0f16; background: var(--accent);
  box-shadow: 0 0 10px rgba(255, 184, 0, 0.4);
  cursor: default;
}
/* small inline logo (e.g. beside the stats heading) */
.brand-logo.sm {
  width: 26px;
  height: 26px;
  vertical-align: middle;
  margin-right: 9px;
  filter: none;
}
.stats-title { display: flex; align-items: center; }
@media (max-width: 360px) {
  .brand-word { font-size: 0.9rem; }
  .brand-logo { width: 40px; height: 40px; }
}

/* ── Instrument selector (Kick / Snare) ────────────── */
.rogue-instrument-row { display: flex; gap: 6px; }
.rogue-instr-btn {
  flex: 1;
  padding: 11px 6px;
  background: linear-gradient(180deg, #141e2e 0%, #0a1220 100%);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.88rem; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer; min-height: 40px;
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px));
  transition: color 0.15s, box-shadow 0.15s;
}
.rogue-instr-btn:hover:not(:disabled) { color: var(--text); }
.rogue-instr-btn.active {
  background: linear-gradient(180deg, #0d1e32 0%, #071220 100%);
  color: var(--cyan);
  box-shadow: inset 0 0 0 1px rgba(0, 200, 255, 0.3), 0 0 14px rgba(0, 200, 255, 0.18);
}

/* Stats: instrument toggle (Kick / Snare) — mirrors the mode buttons */
.stats-instr { display: flex; gap: 6px; }
.stats-instr-btn {
  flex: 1;
  padding: 8px 6px;
  background: linear-gradient(180deg, #141e2e 0%, #0a1220 100%);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer; min-height: 34px;
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px));
  transition: color 0.15s, box-shadow 0.15s;
}
.stats-instr-btn:hover { color: var(--text); }
.stats-instr-btn.active {
  background: linear-gradient(180deg, #0d1e32 0%, #071220 100%);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(255, 184, 0, 0.3), 0 0 14px rgba(255, 184, 0, 0.16);
}

/* ── Input source selector (MIDI / Audio) + audio meter ────────── */
.rogue-input-row { display: flex; gap: 6px; }
.rogue-input-btn {
  flex: 1;
  padding: 9px 6px;
  background: linear-gradient(180deg, #141e2e 0%, #0a1220 100%);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.82rem; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer; min-height: 36px;
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px));
  transition: color 0.15s, box-shadow 0.15s;
}
.rogue-input-btn:hover:not(:disabled) { color: var(--text); }
.rogue-input-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.rogue-input-btn.active {
  background: linear-gradient(180deg, #0d1e32 0%, #071220 100%);
  color: var(--cyan);
  box-shadow: inset 0 0 0 1px rgba(0, 200, 255, 0.3), 0 0 14px rgba(0, 200, 255, 0.18);
}

/* Live input meter (audio mode) */
.rogue-meter {
  position: relative;
  height: 18px;
  margin-top: 8px;
  /* Dim zone shading so the green / hot / clip regions read even when empty.
     Green up to 70% (sweet spot), amber 70–92%, red 92–100%. */
  background:
    linear-gradient(90deg,
      rgba(0, 232, 122, 0.10) 0%, rgba(0, 232, 122, 0.10) 70%,
      rgba(255, 184, 0, 0.16) 70%, rgba(255, 184, 0, 0.16) 92%,
      rgba(255, 56, 56, 0.20) 92%, rgba(255, 56, 56, 0.20) 100%),
    linear-gradient(180deg, var(--inset) 0%, #030609 100%);
  border: 1px solid var(--border);
  overflow: hidden;
  clip-path: polygon(0 0, calc(100% - 4px) 0, 100% 4px, 100% 100%, 4px 100%, 0 calc(100% - 4px));
}
/* Live level fill — translucent so it reads against the coloured zone background. */
.rogue-meter-fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0%;
  background: rgba(180, 240, 255, 0.45);
  transition: width 0.05s linear;
}
/* Peak tick — LATCHES at your last hit's peak (coloured by its verdict) and stays
   there until the next hit, so a hot/clip reading doesn't fade away. */
.rogue-meter-peak {
  position: absolute; top: 0; bottom: 0; width: 3px;
  left: 0; margin-left: -1px;
  background: #fff;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.7);
  transition: left 0.05s linear, background 0.1s;
}
.rogue-meter-peak.good { background: var(--success); box-shadow: 0 0 7px rgba(0, 232, 122, 0.8); }
.rogue-meter-peak.hot  { background: var(--accent);  box-shadow: 0 0 7px rgba(255, 184, 0, 0.8); }
.rogue-meter-peak.clip { background: var(--danger);  box-shadow: 0 0 8px rgba(255, 56, 56, 0.9); }
.rogue-meter.hit { box-shadow: inset 0 0 0 1px var(--accent), 0 0 12px rgba(255, 184, 0, 0.4); }

.rogue-gain-hint {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.35;
  margin-top: 5px;
  color: var(--text-dim);
}
.rogue-gain-hint.good { color: var(--success); }
.rogue-gain-hint.hot  { color: var(--accent); }
.rogue-gain-hint.clip { color: var(--danger); }

/* Calibration status row + Stop button */
.rogue-cal-statusrow { display: flex; align-items: stretch; gap: 8px; }
.rogue-cal-statusrow .rogue-status { flex: 1; }
.rogue-cal-stop {
  flex: none;
  align-self: stretch;
  padding: 0 16px;
  background: linear-gradient(180deg, #ff5c5c 0%, #dd1a1a 45%, #7a0000 100%);
  border: none;
  color: #fff;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  min-height: 34px;
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 2px 8px rgba(255, 50, 50, 0.3);
  transition: box-shadow 0.15s, transform 0.06s;
}
.rogue-cal-stop:hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 0 14px rgba(255, 50, 50, 0.5); }
.rogue-cal-stop:active { transform: translateY(1px); }

/* ═══════════════════════════════════════════════════
   TROPHIES / ACHIEVEMENTS
═══════════════════════════════════════════════════ */
.trophy-summary {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.9rem; font-weight: 600; color: var(--text-dim);
  text-align: center; margin-bottom: 12px;
}
.trophy-summary b { font-family: 'Orbitron', monospace; font-size: 1.3rem; color: var(--accent); }

.trophy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.trophy {
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  padding: 14px 8px 12px;
  background: linear-gradient(155deg, #0d1828 0%, #070d18 100%);
  border: 1px solid var(--border);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
}
.trophy.locked { opacity: 0.62; }

/* Hexagon badge */
.trophy-badge {
  position: relative;
  width: 94px; height: 94px;
  display: flex; align-items: center; justify-content: center;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  background: linear-gradient(145deg, #1a2636 0%, #0a1220 100%);
  margin-bottom: 9px;
}
/* metallic shine */
.trophy-badge::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(150deg, rgba(255,255,255,0.45) 0%, rgba(255,255,255,0) 42%);
  clip-path: inherit; pointer-events: none;
}
.trophy-icon { font-size: 2.75rem; line-height: 1; filter: drop-shadow(0 1px 1px rgba(0,0,0,0.5)); }
.trophy.locked .trophy-icon { filter: grayscale(1) brightness(0.6); opacity: 0.5; }
.trophy-lock {
  position: absolute; right: -2px; bottom: -2px; font-size: 0.85rem;
  filter: drop-shadow(0 1px 2px #000);
}

/* Tier fills + glow (on .trophy-badge itself, so a standalone badge — e.g. the
   reveal popup — colours correctly without a .trophy ancestor).
   Ladder: 1 Iron · 2 Bronze · 3 Silver · 4 Gold · 5 Emerald · 6 Ruby · 7 Diamond ·
   8 Platinum · 9 Master · 10 Grandmaster. (solo = an earned single-badge trophy.) */
.trophy-badge.tier-1  { background: linear-gradient(145deg, #aab1b8, #6a727b 55%, #353b42); filter: drop-shadow(0 0 8px rgba(150,160,170,0.45)); }
.trophy-badge.tier-2  { background: linear-gradient(145deg, #f0b27a, #cd7f32 55%, #6e3f17); filter: drop-shadow(0 0 9px rgba(205,127,50,0.55)); }
.trophy-badge.tier-3  { background: linear-gradient(145deg, #ffffff, #c0c0c0 55%, #6e7479); filter: drop-shadow(0 0 10px rgba(200,210,220,0.6)); }
.trophy-badge.tier-4  { background: linear-gradient(145deg, #fff1a8, #ffd24a 52%, #9a6e16); filter: drop-shadow(0 0 13px rgba(255,210,74,0.7)); }
.trophy-badge.tier-5  { background: linear-gradient(145deg, #c7ffd9, #2ecc71 52%, #15823f); filter: drop-shadow(0 0 15px rgba(46,204,113,0.8)); }
.trophy-badge.tier-6  { background: linear-gradient(145deg, #ffd0dd, #ff3b6b 52%, #8a1030); filter: drop-shadow(0 0 16px rgba(255,59,107,0.8)); }
.trophy-badge.tier-7  { background: linear-gradient(145deg, #eaffff, #9fe7ff 50%, #3f8fb0); filter: drop-shadow(0 0 17px rgba(120,225,255,0.85)); }
.trophy-badge.tier-8  { background: linear-gradient(145deg, #ffffff, #dbe7ee 50%, #8fa3ad); filter: drop-shadow(0 0 18px rgba(220,235,245,0.9)); }
.trophy-badge.tier-9  { background: linear-gradient(145deg, #efe2ff, #b06fff 52%, #5a2ca8); filter: drop-shadow(0 0 19px rgba(176,111,255,0.9)); }
.trophy-badge.tier-10 { background: linear-gradient(135deg, #ffe066 0%, #ff8a3c 30%, #ff5cc8 60%, #7fd0ff 100%); filter: drop-shadow(0 0 22px rgba(255,210,120,0.95)); }
.trophy-badge.tier-solo { background: linear-gradient(145deg, #fff1a8, #ffd24a 50%, #b07a18); filter: drop-shadow(0 0 14px rgba(255,210,74,0.7)); }
.trophy-badge[class*="tier-"] .trophy-icon { filter: drop-shadow(0 1px 2px rgba(0,0,0,0.55)); }

/* Art badges: the PNG is the whole badge (frame + coloured icon), so drop the
   hexagon fill/shine and keep only the tier-coloured glow (the tier-N filter
   above still applies to the badge box, glowing the art). */
.trophy-badge.has-art { clip-path: none; background: none; }
.trophy-badge.has-art::before { display: none; }
.trophy-badge[class*="tier-"].has-art { background: none; }
.trophy-art { width: 100%; height: 100%; object-fit: contain; display: block; }
.trophy.locked .trophy-art,
.trophy-badge.tier-0 .trophy-art { filter: grayscale(0.85) brightness(0.6); opacity: 0.55; }

.trophy.tier-1 .trophy-tier  { color: #b8c0c8; }
.trophy.tier-2 .trophy-tier  { color: #e09a5a; }
.trophy.tier-3 .trophy-tier  { color: #d4dde4; }
.trophy.tier-4 .trophy-tier  { color: var(--accent); }
.trophy.tier-5 .trophy-tier  { color: #2ecc71; }
.trophy.tier-6 .trophy-tier  { color: #ff5c7a; }
.trophy.tier-7 .trophy-tier  { color: #9fe7ff; }
.trophy.tier-8 .trophy-tier  { color: #e6f2f8; }
.trophy.tier-9 .trophy-tier  { color: #b06fff; }
.trophy.tier-10 .trophy-tier { color: #ffd24a; }
.trophy.solo .trophy-tier    { color: var(--accent); }

.trophy-badge.sm { width: 46px; height: 46px; margin-bottom: 0; }
.trophy-badge.sm .trophy-icon { font-size: 1.35rem; }
.trophy-desc {
  font-family: 'Rajdhani', sans-serif; font-size: 0.66rem; font-weight: 600;
  color: var(--text-dim); line-height: 1.3; margin-top: 6px; opacity: 0.85;
}

.trophy-name {
  font-family: 'Rajdhani', sans-serif; font-size: 0.86rem; font-weight: 700;
  letter-spacing: 0.02em; color: var(--text); line-height: 1.1;
}
.trophy-tier {
  font-family: 'Orbitron', monospace; font-size: 0.58rem; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim);
  margin-top: 3px;
}
/* (tier-label colours are defined with the badge tiers above) */

.trophy-bar {
  width: 100%; height: 5px; margin-top: 8px;
  background: var(--inset); overflow: hidden;
}
.trophy-bar > i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--success), var(--cyan));
}
.trophy.locked .trophy-bar > i { background: var(--cyan-dim); }
.trophy-prog {
  font-family: 'Rajdhani', sans-serif; font-size: 0.68rem; font-weight: 600;
  color: var(--text-dim); line-height: 1.3; margin-top: 5px;
}

/* Trophy-unlocked block inside the run-end overlay */
.rogue-trophies-won {
  margin-top: 16px; padding-top: 14px;
  border-top: 1px solid var(--border);
}
.rtw-title {
  font-family: 'Orbitron', monospace; font-size: 0.82rem; font-weight: 900;
  letter-spacing: 0.04em; color: var(--accent);
  text-shadow: 0 0 16px rgba(255, 184, 0, 0.45);
  margin-bottom: 10px;
}
.rtw-item {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 6px 0;
  animation: rtwPop 0.4s ease both;
}
.rtw-text { text-align: left; }
.rtw-name { font-family: 'Rajdhani', sans-serif; font-weight: 700; font-size: 0.98rem; color: var(--text); line-height: 1.1; }
.rtw-tier { font-family: 'Orbitron', monospace; font-size: 0.6rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); margin-top: 2px; }
@keyframes rtwPop { from { opacity: 0; transform: scale(0.8); } to { opacity: 1; transform: scale(1); } }

/* ═══════════════════════════════════════════════════
   RESULT REVEAL — rank animates in, trophies pop after
═══════════════════════════════════════════════════ */
/* Style Rank stays hidden until JS adds .revealed (a beat after the card shows),
   so the results land first and the rank then bursts in with its sound. */
.rogue-result-rank { display: inline-block; opacity: 0; }
/* will-change promotes the emblem to its own GPU layer so the burst is composited
   (transform/opacity only — no filter animation, which would repaint each frame). */
.rogue-result-rank.revealed { opacity: 1; will-change: transform; animation: rankPop 0.5s cubic-bezier(0.2,1.4,0.4,1) both; }
.rogue-result-rank.revealed.rank-s, .rogue-result-rank.revealed.rank-ss { animation: rankBurst 0.75s cubic-bezier(0.2,1.5,0.4,1) both; }
@keyframes rankPop  { 0% { opacity: 0; transform: scale(0.3); } 100% { opacity: 1; transform: scale(1); } }
@keyframes rankBurst {
  0%   { opacity: 0; transform: scale(0.2) rotate(-8deg); }
  55%  { opacity: 1; transform: scale(1.4) rotate(3deg); }
  75%  { transform: scale(0.92); }
  100% { transform: scale(1) rotate(0); }
}

/* Results card dims/blurs back while a trophy pops over it. Static (no transition)
   — animating blur re-rasterizes the whole card every frame and is the main
   result-screen jank on weaker GPUs. A one-time 4px blur is cheap to hold. */
.done-overlay.blurred .done-message { filter: blur(4px) brightness(0.5); pointer-events: none; }

/* ── Trophy reveal popup (3D pop, one at a time) ── */
.rogue-trophypop {
  display: none; position: fixed; inset: 0; z-index: 200;
  align-items: center; justify-content: center; padding: 24px;
  background: rgba(2, 6, 12, 0.62);
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.rogue-trophypop.visible { display: flex; }
.rtp-card {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px;
  padding: 26px 28px; max-width: 300px;
  background: linear-gradient(155deg, var(--surface) 0%, var(--surface2) 100%);
  border: 1px solid var(--border);
  box-shadow: 0 20px 60px rgba(0,0,0,0.85), 0 0 50px rgba(0,200,255,0.14);
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 16px 100%, 0 calc(100% - 16px));
  will-change: transform, opacity;   /* one GPU layer: 3D pop + shadow + badge glow */
}
.rtp-card.pop { animation: tpPop 0.5s cubic-bezier(0.2,1.5,0.4,1) both; }
.rogue-trophypop.out .rtp-card { animation: tpOut 0.18s ease both; }
@keyframes tpPop {
  0%   { opacity: 0; transform: perspective(700px) translateZ(-220px) scale(0.4) rotateX(24deg); }
  60%  { opacity: 1; transform: perspective(700px) translateZ(0) scale(1.08) rotateX(0); }
  100% { transform: scale(1); }
}
@keyframes tpOut { to { opacity: 0; transform: scale(0.85); } }
.rtp-flash { font-family: 'Orbitron', monospace; font-size: 0.7rem; font-weight: 900; letter-spacing: 0.14em; color: var(--accent); text-shadow: 0 0 16px rgba(255,184,0,0.5); }
.rtp-badge .trophy-badge { width: 96px; height: 96px; margin: 4px 0 2px; }
.rtp-badge .trophy-icon { font-size: 2.8rem; }
.rtp-name { font-family: 'Orbitron', monospace; font-size: 1.15rem; font-weight: 900; color: var(--text); line-height: 1.1; }
.rtp-tier { font-family: 'Orbitron', monospace; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--cyan); }
.rtp-desc { font-family: 'Rajdhani', sans-serif; font-size: 0.82rem; font-weight: 600; color: var(--text-dim); line-height: 1.35; }
.rtp-hint { font-family: 'Rajdhani', sans-serif; font-size: 0.66rem; font-weight: 600; color: var(--text-dim); opacity: 0.6; margin-top: 6px; }
