/* Rune Cascade — 16-Bit Candlelit Alchemy Sanctum UI & 4 Grimoire Board Themes */
:root {
  --bg-deep: #0b0814;
  --bg-grad: radial-gradient(circle at 50% 25%, #1d1532 0%, #0b0814 75%);
  --panel-bg: rgba(18, 13, 30, 0.9);
  --panel-border: rgba(212, 169, 89, 0.34);
  --brass: #d4a959;
  --brass-bright: #fde047;
  --text-main: #f8f4e8;
  --text-muted: #b7adc9;
  --accent: #a855f7;
  --accent-2: #f59e0b;
  --btn-bg: rgba(34, 24, 54, 0.92);
}

body[data-theme="emerald"] {
  --bg-deep: #071410;
  --bg-grad: radial-gradient(circle at 50% 25%, #113226 0%, #071410 75%);
  --panel-bg: rgba(10, 28, 22, 0.92);
  --panel-border: rgba(74, 222, 128, 0.35);
  --brass: #6ee7b7;
  --brass-bright: #a7f3d0;
  --accent: #10b981;
  --accent-2: #f59e0b;
  --btn-bg: rgba(16, 44, 34, 0.94);
}

body[data-theme="astral"] {
  --bg-deep: #08061a;
  --bg-grad: radial-gradient(circle at 50% 25%, #23124c 0%, #08061a 75%);
  --panel-bg: rgba(17, 10, 42, 0.92);
  --panel-border: rgba(192, 132, 252, 0.42);
  --brass: #c084fc;
  --brass-bright: #f0abfc;
  --accent: #8b5cf6;
  --accent-2: #38bdf8;
  --btn-bg: rgba(34, 18, 72, 0.94);
}

body[data-theme="sunforge"] {
  --bg-deep: #160906;
  --bg-grad: radial-gradient(circle at 50% 25%, #3d160c 0%, #160906 75%);
  --panel-bg: rgba(36, 14, 10, 0.92);
  --panel-border: rgba(251, 146, 60, 0.44);
  --brass: #fbbf24;
  --brass-bright: #fef08a;
  --accent: #f97316;
  --accent-2: #ef4444;
  --btn-bg: rgba(60, 22, 14, 0.94);
}

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

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
  background: var(--bg-deep);
  background-image: var(--bg-grad);
  color: var(--text-main);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100dvh;
  max-width: 1240px;
  margin: 0 auto;
  padding: 10px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* HUD Bar */
.hud-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  flex-wrap: wrap;
}

.hud-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-crest {
  font-size: 24px;
  filter: drop-shadow(0 0 8px rgba(168, 85, 247, 0.65));
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.brand-title {
  margin: 0;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: var(--brass-bright);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
  line-height: 1.1;
}

.mode-pill {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.hud-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.stat-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 72px;
  padding: 4px 10px;
  border-radius: 9px;
  background: rgba(6, 4, 14, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.stat-val {
  font-size: 16px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: #ffffff;
  line-height: 1.15;
}

.stat-score .stat-val { color: var(--brass-bright); }
.stat-clock.urgent .stat-val { color: #f87171; animation: pulseUrgent 0.6s infinite alternate; }
.stat-combo .stat-val { color: #38bdf8; }
.stat-dust .stat-val { color: #e879f9; }

@keyframes pulseUrgent {
  from { transform: scale(1); }
  to { transform: scale(1.1); }
}

.hud-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 10px;
  border-radius: 9px;
  border: 1px solid var(--panel-border);
  background: var(--btn-bg);
  color: var(--text-main);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.icon-btn:hover {
  border-color: var(--brass-bright);
  transform: translateY(-1px);
}

/* Banner Strip */
.banner-strip {
  padding: 6px 12px;
  border-radius: 9px;
  background: linear-gradient(90deg, rgba(168, 85, 247, 0.25), rgba(245, 158, 11, 0.25));
  border: 1px solid rgba(253, 224, 71, 0.45);
  font-size: 12.5px;
  font-weight: 700;
  color: #fef3c7;
  text-align: center;
}

/* Workspace */
.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 238px minmax(0, 646px) 238px;
  justify-content: center;
  align-items: start;
  gap: 12px;
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panel-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 10px 11px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.panel-title {
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: var(--brass-bright);
}

.panel-key {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
}

/* Mana Flask Spells */
.flask-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.flask-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 9px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(8, 5, 18, 0.72);
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.flask-btn.ready {
  border-color: var(--brass-bright);
  box-shadow: 0 0 14px rgba(253, 224, 71, 0.35);
  animation: spellReadyPulse 1.4s ease-in-out infinite;
}

.flask-btn.targeting {
  border-color: #ff6b6b;
  box-shadow: 0 0 18px rgba(255, 77, 77, 0.7);
}

@keyframes spellReadyPulse {
  0%, 100% { box-shadow: 0 0 10px rgba(253, 224, 71, 0.28); }
  50% { box-shadow: 0 0 20px rgba(253, 224, 71, 0.62); }
}

.flask-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: var(--brass);
}

.flask-meter {
  width: 14px;
  height: 46px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  flex-shrink: 0;
}

.flask-fill {
  width: 100%;
  height: 0%;
  transition: height 0.25s ease;
}

.fill-fire { background: linear-gradient(180deg, #fde047, #ef4444); }
.fill-storm { background: linear-gradient(180deg, #fef08a, #f59e0b); }
.fill-void { background: linear-gradient(180deg, #f0abfc, #9333ea); }

.flask-info {
  flex: 1;
  min-width: 0;
}

.flask-name {
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.flask-name kbd, .action-btn kbd {
  font-family: monospace;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--brass-bright);
}

.flask-desc {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.flask-pct {
  font-size: 10.5px;
  font-weight: 800;
  color: var(--brass);
  margin-top: 2px;
}

/* Reaction Codex */
.codex-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 11px;
  color: var(--text-muted);
}

.codex-list li {
  display: flex;
  align-items: center;
  gap: 5px;
  line-height: 1.25;
}

.codex-list strong {
  color: var(--text-main);
}

.rx-pair {
  display: inline-block;
  min-width: 36px;
  font-size: 11px;
}

/* Board Stage */
.board-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.canvas-wrap {
  position: relative;
  width: 100%;
  max-width: 630px;
  border-radius: 14px;
  padding: 4px;
  background: linear-gradient(145deg, rgba(212, 169, 89, 0.65), rgba(74, 48, 22, 0.8), rgba(212, 169, 89, 0.5));
  box-shadow: 0 16px 46px rgba(0, 0, 0, 0.68), 0 0 28px rgba(168, 85, 247, 0.16);
}

#game-canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  touch-action: none;
  cursor: pointer;
  background: #0d0a16;
}

.spell-target-banner {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(127, 29, 29, 0.94);
  border: 1px solid #fca5a5;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  pointer-events: none;
}

/* Mobile Spell Dock (hidden on desktop) */
.mobile-spell-dock {
  display: none;
  width: 100%;
  max-width: 500px;
  grid-template-columns: 1fr 1fr 1fr 44px;
  gap: 6px;
}

.m-flask-btn {
  position: relative;
  overflow: hidden;
  padding: 9px 6px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: rgba(12, 8, 24, 0.9);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.m-flask-btn.ready {
  border-color: var(--brass-bright);
  box-shadow: 0 0 12px rgba(253, 224, 71, 0.45);
}

.m-fill {
  position: absolute;
  left: 0;
  bottom: 0;
  top: 0;
  width: 0%;
  opacity: 0.35;
  transition: width 0.25s ease;
}

.m-lbl {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.m-lbl em {
  font-style: normal;
  font-size: 10px;
  color: var(--brass-bright);
}

.m-hint-btn {
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: var(--btn-bg);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
}

/* Right Panel Objective & Counters */
.streak-pill {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.2);
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: #fcd34d;
}

.objective-box {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 10px;
}

.obj-title {
  font-size: 13px;
  font-weight: 800;
  color: #fff;
}

.obj-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.3;
}

.obj-bar-wrap {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  overflow: hidden;
}

.obj-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #a855f7, #f59e0b, #fde047);
  transition: width 0.25s ease;
}

.obj-progress {
  font-size: 11px;
  font-weight: 700;
  color: var(--brass-bright);
}

.run-counters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.rc-item {
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(6, 4, 14, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rc-item span {
  font-size: 9.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
}

.rc-item strong {
  font-size: 13.5px;
  font-weight: 900;
  color: #fff;
}

.quick-btns {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.action-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid var(--panel-border);
  background: var(--btn-bg);
  color: var(--text-main);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.action-btn:hover {
  border-color: var(--brass-bright);
}

.accent-btn {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.28), rgba(168, 85, 247, 0.28));
  border-color: rgba(253, 224, 71, 0.55);
  color: #fef3c7;
  justify-content: center;
}

.forge-legend {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.forge-legend strong {
  color: var(--text-main);
}

/* Footer */
.footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 10px;
  background: var(--panel-bg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 11.5px;
  color: var(--text-muted);
}

.footer-theme-tag {
  color: var(--brass);
  font-weight: 700;
}

/* Modals & Overlays */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(5, 3, 12, 0.78);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  overflow-y: auto;
}

.card {
  width: 100%;
  max-width: 470px;
  max-height: 92dvh;
  overflow-y: auto;
  background: linear-gradient(180deg, rgba(24, 17, 40, 0.98), rgba(12, 8, 22, 0.99));
  border: 1.5px solid var(--brass);
  border-radius: 16px;
  padding: 18px 18px 16px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-wide {
  max-width: 600px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.modal-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 900;
  color: var(--brass-bright);
}

.close-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
}

.ov-badge {
  align-self: center;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.12em;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(168, 85, 247, 0.22);
  border: 1px solid rgba(192, 132, 252, 0.45);
  color: #e9d5ff;
}

.ov-title {
  margin: 0;
  font-size: 26px;
  font-weight: 900;
  text-align: center;
  letter-spacing: 0.06em;
  color: var(--brass-bright);
  text-shadow: 0 2px 12px rgba(245, 158, 11, 0.35);
}

.ov-sub {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.4;
}

/* Mode Buttons */
.ov-mode-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-primary, .btn-secondary, .btn-gold {
  border-radius: 11px;
  border: 1px solid transparent;
  padding: 10px 14px;
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
  color: #fff;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #9333ea, #6d28d9);
  border-color: #c084fc;
}

.btn-secondary {
  background: rgba(34, 24, 56, 0.95);
  border-color: rgba(212, 169, 89, 0.45);
}

.btn-gold {
  background: linear-gradient(135deg, #d97706, #b45309);
  border-color: #fde047;
}

.btn-primary:hover, .btn-secondary:hover, .btn-gold:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.btn-big {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 11px 14px;
}

.m-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.m-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.m-copy strong { font-size: 14.5px; }
.m-copy small { font-size: 11.5px; opacity: 0.86; font-weight: 500; }

/* Post-Run Stats & Cliffhanger */
.ov-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
}

.ov-stat-box {
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(8, 5, 18, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.12);
  text-align: center;
}

.ov-stat-box span {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
}

.ov-stat-box strong {
  font-size: 17px;
  font-weight: 900;
  color: var(--brass-bright);
}

.ov-cliffhanger {
  padding: 9px 11px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.16), rgba(168, 85, 247, 0.16));
  border: 1px solid rgba(253, 224, 71, 0.42);
  font-size: 12px;
  font-weight: 700;
  color: #fef3c7;
  text-align: center;
}

.lb-submit-row {
  display: flex;
  gap: 7px;
}

.lb-submit-row input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(6, 4, 14, 0.85);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.lb-submit-msg {
  font-size: 11.5px;
  color: #86efac;
  text-align: center;
  font-weight: 700;
}

.ov-post-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.share-preview {
  margin: 0;
  padding: 8px 10px;
  border-radius: 9px;
  background: rgba(4, 2, 10, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 11px;
  line-height: 1.4;
  color: #e2e8f0;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Crucible Stages Grid */
.mode-shortcuts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.stages-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.stage-card {
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid rgba(212, 169, 89, 0.35);
  background: rgba(10, 6, 22, 0.82);
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.stage-card:hover:not(:disabled) {
  border-color: var(--brass-bright);
  background: rgba(34, 22, 58, 0.9);
}

.stage-card:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.stage-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  font-weight: 800;
}

.stage-stars {
  color: #fde047;
  font-size: 12px;
}

.stage-goal {
  font-size: 11px;
  color: var(--text-muted);
}

/* Grimoire Upgrades & Themes */
.grimoire-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.g-tab {
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(12, 8, 24, 0.75);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
}

.g-tab.active {
  border-color: var(--brass-bright);
  background: rgba(168, 85, 247, 0.25);
  color: #fff;
}

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

.upg-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(10, 6, 22, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.upg-info strong {
  font-size: 13px;
  color: #fff;
  display: block;
}

.upg-info small {
  font-size: 11px;
  color: var(--text-muted);
}

.upg-buy {
  padding: 7px 11px;
  border-radius: 8px;
  border: 1px solid var(--brass);
  background: linear-gradient(135deg, #7e22ce, #581c87);
  color: #fff;
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.upg-buy:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.themes-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.theme-card {
  padding: 11px;
  border-radius: 11px;
  border: 1.5px solid rgba(255, 255, 255, 0.16);
  background: rgba(10, 6, 22, 0.84);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.theme-card.active {
  border-color: var(--brass-bright);
  box-shadow: 0 0 14px rgba(253, 224, 71, 0.28);
}

.theme-swatch {
  height: 22px;
  border-radius: 6px;
}

.theme-card strong { font-size: 13px; }
.theme-card small { font-size: 11px; color: var(--text-muted); }

/* Leaderboard */
.lb-meta {
  font-size: 12px;
  color: var(--brass-bright);
  text-align: center;
  font-weight: 700;
}

.lb-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 280px;
  overflow-y: auto;
}

.lb-row {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(8, 5, 18, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12.5px;
}

.lb-rank { font-weight: 900; color: var(--brass-bright); }
.lb-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-score { font-weight: 900; color: #38bdf8; font-variant-numeric: tabular-nums; }

.lb-footer-actions {
  display: flex;
  justify-content: center;
}

/* Responsive Tablet / Mobile */
@media (max-width: 1080px) {
  .workspace {
    grid-template-columns: 1fr;
    justify-items: center;
  }
  .side-panel {
    display: none;
  }
  .mobile-spell-dock {
    display: grid;
  }
}

@media (max-width: 600px) {
  .app-shell {
    padding: 6px 8px 10px;
    gap: 6px;
  }
  .hud-bar {
    padding: 6px 8px;
    gap: 6px;
  }
  .brand-crest { font-size: 20px; }
  .brand-title { font-size: 14px; }
  .mode-pill { font-size: 10px; }
  .hud-stats {
    width: 100%;
    justify-content: space-between;
    order: 3;
    gap: 4px;
  }
  .stat-chip {
    flex: 1;
    min-width: 0;
    padding: 3px 4px;
  }
  .stat-val { font-size: 14px; }
  .icon-btn { padding: 6px 8px; font-size: 13px; }
  .icon-btn .btn-txt { display: none; }
  .stages-grid, .themes-grid, .ov-post-actions, .mode-shortcuts {
    grid-template-columns: 1fr;
  }
  .footer-bar {
    font-size: 10.5px;
    padding: 6px 8px;
  }
  .footer-hint {
    display: none;
  }
}
