:root {
  --ink: #f4efe2;
  --muted: #a8a198;
  --coal: #12110f;
  --panel: #1d1a16;
  --panel-2: #29241d;
  --brass: #d59d3f;
  --ember: #ff6542;
  --mint: #54d6a1;
  --cyan: #5eb7d9;
  --violet: #c86bf0;
  --line: rgba(244, 239, 226, 0.13);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 12%, rgba(213, 157, 63, 0.16), transparent 24rem),
    radial-gradient(circle at 82% 78%, rgba(84, 214, 161, 0.1), transparent 22rem),
    linear-gradient(135deg, #0f0d0b, #1b1712 55%, #10100e);
  font-family: "Spline Sans Mono", ui-monospace, monospace;
  font-size: 12px;
}

button, input, select { font: inherit; }

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 1600px;
  margin: 0 auto;
  padding: 8px 10px 10px;
  gap: 6px;
}

.app-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: rgba(18, 17, 15, 0.9);
  box-shadow: inset 0 1px 0 rgba(213, 157, 63, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.eyebrow {
  margin: 0;
  color: var(--brass);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
}

.tabs { display: flex; gap: 4px; }

.tab {
  min-height: 28px;
  padding: 4px 10px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  cursor: pointer;
}

.tab.active {
  color: var(--coal);
  background: var(--brass);
  border-color: var(--brass);
}

.resource-bar {
  display: flex;
  flex: 1;
  gap: 6px;
  overflow-x: auto;
  min-width: 0;
}

.resource-bar div {
  flex-shrink: 0;
  padding: 4px 8px;
  border: 1px solid var(--line);
  background: rgba(244, 239, 226, 0.04);
}

.resource-bar span {
  color: var(--muted);
  font-size: 0.62rem;
}

.resource-bar strong {
  margin-left: 6px;
  font-size: 0.78rem;
}

.resource-bar .matter strong { color: var(--violet); }

.header-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.pill {
  padding: 3px 8px;
  border: 1px solid var(--line);
  font-size: 0.65rem;
  font-weight: 700;
}

.pill.mint { color: var(--mint); border-color: rgba(84, 214, 161, 0.35); }
.pill.cyan { color: var(--cyan); border-color: rgba(94, 183, 217, 0.35); }

.stability-vignette {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.35s ease;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(255, 101, 66, 0.35) 100%);
  border-radius: inherit;
}

.stability-vignette.active {
  opacity: 1;
  animation: vignette-pulse 1.2s ease-in-out infinite;
}

@keyframes vignette-pulse {
  0%, 100% { opacity: 0.75; }
  50% { opacity: 1; }
}

.icon-btn {
  min-height: 28px;
  padding: 4px 8px;
  color: var(--ink);
  background: var(--panel-2);
  border: 1px solid var(--line);
  cursor: pointer;
}

.mission-strip {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  padding: 5px 10px;
  border: 1px solid var(--line);
  background: rgba(84, 214, 161, 0.06);
  font-size: 0.72rem;
}

.hotkeys-inline { color: var(--muted); white-space: nowrap; }

.tab-panel {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.tab-panel[hidden] { display: none; }

.engine-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 8px;
  height: 100%;
}

.play-column,
.side-column {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
}

.side-column { overflow-y: auto; }

.card {
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: rgba(18, 17, 15, 0.88);
}

.card.compact h2 {
  margin: 2px 0 4px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1rem;
}

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

.muted {
  margin: 0;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.4;
}

.run-stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}

.run-stats div {
  padding: 5px 6px;
  border: 1px solid var(--line);
  background: rgba(244, 239, 226, 0.04);
}

.run-stats span {
  display: block;
  color: var(--muted);
  font-size: 0.6rem;
}

.run-stats strong {
  display: block;
  margin-top: 2px;
  font-size: 0.95rem;
}

.run-stats .combo-hot { color: var(--mint); }
.run-stats .stability-low { color: var(--ember); }
.combat-strip.cursed-haste { border-color: rgba(255, 101, 66, 0.55); box-shadow: 0 0 12px rgba(255, 101, 66, 0.15); }
.combat-strip.cursed-drag { border-color: rgba(94, 183, 217, 0.55); }
.combat-strip.cursed-squeeze { border-color: rgba(200, 107, 240, 0.55); }
.combat-strip.cursed-jam { border-color: rgba(138, 138, 154, 0.55); }
.combat-strip.cursed-glitch { border-color: rgba(200, 107, 240, 0.65); }
.combat-strip.cursed-fracture { border-color: rgba(255, 101, 66, 0.65); }

.run-stats .tempo-rising { color: var(--brass); }
.run-stats .tempo-cursed-haste { color: var(--ember); }
.run-stats .tempo-cursed-drag { color: var(--cyan); }

.fever {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border: 1px solid var(--line);
}

.fever span {
  color: var(--brass);
  font-size: 0.62rem;
  font-weight: 700;
}

.fever div {
  flex: 1;
  height: 6px;
  background: rgba(244, 239, 226, 0.08);
  border: 1px solid var(--line);
}

.fever i {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--brass));
  transition: width 100ms linear;
}

.fever i.burning {
  background: linear-gradient(90deg, var(--brass), var(--ember));
}

.combat-strip {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  align-items: center;
  padding: 6px 10px;
  border: 1px solid var(--line);
  background: rgba(255, 101, 66, 0.06);
  opacity: 0.55;
  transition: opacity 150ms ease, border-color 150ms ease;
}

.combat-strip.active {
  opacity: 1;
  border-color: rgba(255, 101, 66, 0.35);
}

.combat-strip.elite.active {
  border-color: rgba(213, 157, 63, 0.55);
  background: rgba(213, 157, 63, 0.08);
}

.combat-strip.boss.active {
  border-color: rgba(255, 101, 66, 0.65);
  background: rgba(255, 101, 66, 0.1);
  animation: boss-pulse 1.4s ease-in-out infinite;
}

.combat-strip.casting {
  animation: cast-pulse 0.55s ease-in-out infinite;
}

@keyframes boss-pulse {
  0%, 100% { box-shadow: inset 0 0 0 rgba(255, 101, 66, 0); }
  50% { box-shadow: inset 0 0 24px rgba(255, 101, 66, 0.15); }
}

@keyframes cast-pulse {
  0%, 100% { border-color: rgba(255, 101, 66, 0.45); }
  50% { border-color: rgba(213, 157, 63, 0.75); }
}

.combat-foe {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.combat-glyph {
  font-size: 1.4rem;
  line-height: 1;
  color: var(--ember);
}

.combat-meta {
  display: flex;
  gap: 4px;
  margin-bottom: 2px;
}

#combatName {
  display: block;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.85rem;
}

.combat-bars {
  display: grid;
  gap: 4px;
  min-width: 140px;
}

.combat-bar {
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: center;
  gap: 6px;
}

.combat-bar span {
  font-size: 0.55rem;
  color: var(--muted);
}

.combat-hint {
  font-size: 0.72rem;
  margin: 0 0 8px;
}

.combat-side-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.combat-side-stats div {
  display: grid;
  gap: 2px;
}

.combat-side-stats span {
  font-size: 0.6rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.combat-side-stats strong {
  font-size: 1rem;
  color: var(--mint);
}

.combat-track {
  height: 8px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--line);
  overflow: hidden;
}

.combat-track i {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--ember);
  transition: width 100ms linear;
}

.combat-bar.hp .combat-track.low i {
  background: linear-gradient(90deg, #ff6542, #ffd76a);
  animation: hp-low 0.8s ease-in-out infinite;
}

.combat-bar.mana .combat-track.charging {
  border-color: rgba(94, 183, 217, 0.55);
  box-shadow: 0 0 8px rgba(94, 183, 217, 0.25);
}

.combat-bar.mana .combat-track i { background: var(--cyan); }

@keyframes hp-low {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

.combat-telegraph {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.62rem;
  line-height: 1.3;
}

.machine {
  position: relative;
  flex: 1;
  min-height: 200px;
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at 50% 100%, rgba(213, 157, 63, 0.06), transparent 55%),
    linear-gradient(rgba(244, 239, 226, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(244, 239, 226, 0.04) 1px, transparent 1px);
  background-size: 100% 100%, 28px 28px, 28px 28px;
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.35);
}

.machine.overdrive {
  box-shadow: inset 0 0 40px rgba(213, 157, 63, 0.2), 0 0 24px rgba(213, 157, 63, 0.15);
  animation: machine-pulse 1.2s ease-in-out infinite;
}

@keyframes machine-pulse {
  0%, 100% { border-color: var(--line); }
  50% { border-color: rgba(213, 157, 63, 0.55); }
}

#engineCanvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 200px;
}

.judgement {
  position: absolute;
  left: 8px;
  bottom: 8px;
  max-width: calc(100% - 16px);
  padding: 6px 8px;
  color: var(--coal);
  background: var(--ink);
  font-size: 0.68rem;
  font-weight: 700;
}

.judgement.great { background: var(--mint); }
.judgement.good { background: var(--cyan); }
.judgement.miss { background: var(--ember); color: #fff; }
.judgement.perfect { background: var(--brass); }

.control-row {
  display: grid;
  grid-template-columns: 100px 1fr 90px;
  gap: 6px;
  align-items: end;
}

.control-row label {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 0.62rem;
}

.tempo-label.tempo-locked { opacity: 0.45; pointer-events: none; }

button {
  min-height: 32px;
  color: var(--ink);
  background: var(--panel-2);
  border: 1px solid var(--line);
  cursor: pointer;
}

button:hover { border-color: var(--brass); }

.primary {
  color: var(--coal);
  background: var(--brass);
  border-color: var(--brass);
  font-weight: 700;
}

.danger {
  color: #fff;
  background: var(--ember);
  border-color: var(--ember);
  font-weight: 700;
}

.big { min-height: 44px; font-size: 0.85rem; }

.level-progress { margin: 6px 0; }
.level-progress span { display: block; margin-bottom: 4px; font-size: 0.65rem; }
.level-bar { height: 5px; background: rgba(244, 239, 226, 0.1); }
.level-bar i {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--ember), var(--brass), var(--mint));
}

.song-next-hint {
  grid-column: 1 / -1;
  margin: 0 0 6px;
  padding: 6px 8px;
  border: 1px solid rgba(213, 157, 63, 0.25);
  background: rgba(213, 157, 63, 0.06);
  font-size: 0.62rem;
}

.song-btn .lock-hint {
  display: block;
  margin-top: 2px;
  color: var(--ember);
  font-size: 0.58rem;
}

.song-list {
  display: grid;
  gap: 4px;
  max-height: 180px;
  overflow-y: auto;
}

.song-btn, .pattern-chip {
  width: 100%;
  padding: 6px 8px;
  text-align: left;
  font-size: 0.68rem;
  transition: border-color 120ms ease, background 120ms ease;
}

.song-btn {
  border-left: 3px solid var(--song-a, var(--line));
  background: linear-gradient(90deg, color-mix(in srgb, var(--song-b, transparent) 12%, transparent), transparent 70%);
}

.song-btn:hover:not(:disabled) {
  border-color: var(--song-a, var(--brass));
  background: linear-gradient(90deg, color-mix(in srgb, var(--song-b, var(--brass)) 18%, transparent), transparent 70%);
}

.song-btn b { display: block; font-size: 0.75rem; }
.song-btn small { color: var(--muted); }
.song-btn .song-stars { float: right; color: var(--brass); }
.song-btn.running { border-color: var(--mint); }
.song-btn.locked { opacity: 0.38; cursor: not-allowed; }

.pattern-row {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.pattern-chip {
  flex: 1;
  min-width: 60px;
  padding: 4px 6px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--album-a, var(--brass)) 22%, transparent), color-mix(in srgb, var(--album-b, var(--mint)) 10%, transparent));
  border-color: color-mix(in srgb, var(--album-a, var(--line)) 40%, var(--line));
}

.pattern-chip.active {
  border-color: var(--album-a, var(--brass));
  background: linear-gradient(135deg, color-mix(in srgb, var(--album-a, var(--brass)) 35%, transparent), color-mix(in srgb, var(--album-b, var(--mint)) 18%, transparent));
  box-shadow: 0 0 12px color-mix(in srgb, var(--album-a, var(--brass)) 25%, transparent);
}
.pattern-chip.locked { opacity: 0.35; }
.pattern-more { align-self: center; font-size: 0.62rem; padding: 0 4px; }

.achievement-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.achievement {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 5px 4px;
  border: 1px solid var(--line);
  background: rgba(244, 239, 226, 0.03);
  opacity: 0.35;
  filter: grayscale(1);
  transition: opacity 150ms ease, filter 150ms ease;
}

.achievement.earned {
  opacity: 1;
  filter: none;
  border-color: rgba(213, 157, 63, 0.45);
  background: rgba(213, 157, 63, 0.08);
}

.achievement-icon {
  font-size: 0.95rem;
  line-height: 1;
  color: var(--brass);
}

.achievement-name {
  font-size: 0.55rem;
  text-align: center;
  color: var(--muted);
  line-height: 1.2;
}

.achievement.earned .achievement-name { color: var(--ink); }

.mini-list {
  display: grid;
  gap: 4px;
  max-height: 140px;
  overflow-y: auto;
}

.mini-list button, .foundry-buy {
  width: 100%;
  padding: 6px 8px;
  text-align: left;
  font-size: 0.65rem;
}

.mini-list b, .foundry-buy b { display: block; margin-bottom: 2px; font-size: 0.72rem; }
.mini-list small, .foundry-buy small { display: block; color: var(--muted); line-height: 1.3; }
.mini-list span, .foundry-buy span { display: block; margin-top: 3px; color: var(--mint); font-size: 0.62rem; }
.mini-list button:disabled, .foundry-buy:disabled { opacity: 0.4; cursor: not-allowed; }

.buy-max-btn, .foundry-buy-max {
  width: 100%;
  padding: 6px 8px;
  margin-bottom: 4px;
  color: var(--coal);
  background: linear-gradient(90deg, var(--mint), var(--brass));
  border: none;
  font-weight: 700;
  font-size: 0.65rem;
  cursor: pointer;
}

.mastery { text-align: left; }

.float-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 25;
  overflow: hidden;
}

.dom-float {
  position: fixed;
  transform: translate(-50%, 0);
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.65);
  opacity: 0;
  transition: transform 900ms ease-out, opacity 200ms ease;
  white-space: nowrap;
}

.dom-float.md { font-size: 1rem; }
.dom-float.lg { font-size: 1.45rem; }
.dom-float.sm { font-size: 0.75rem; font-family: "Spline Sans Mono", monospace; }

.dom-float.rise {
  opacity: 1;
  transform: translate(-50%, -72px);
}

.flash-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 15;
  opacity: 0;
  transition: opacity 180ms ease-out;
}

.flash-layer.pop {
  opacity: 1;
}

.resource-bar strong.tick {
  animation: resource-pop 320ms ease;
}

@keyframes resource-pop {
  0% { transform: scale(1); color: inherit; }
  40% { transform: scale(1.18); color: var(--mint); }
  100% { transform: scale(1); }
}

.keys-row #keyChips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.key-chip {
  min-height: 0;
  padding: 4px 7px;
  color: var(--coal);
  background: var(--ink);
  border: 1px solid var(--ink);
  font-size: 0.68rem;
  font-weight: 700;
}

.key-chip.benched { color: var(--muted); background: transparent; text-decoration: line-through; }
.key-chip.locked { opacity: 0.4; cursor: not-allowed; }

.foundry-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  grid-template-rows: auto 1fr;
  gap: 8px;
  height: 100%;
}

.foundry-hero {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto 1fr;
  gap: 10px 16px;
  overflow: hidden;
}

.foundry-canvas {
  grid-column: 1 / -1;
  display: block;
  width: 100%;
  height: 100px;
  border: 1px solid var(--line);
  background: #0c0e12;
}

.foundry-hero-body {
  min-width: 0;
}

.foundry-hero h2 {
  margin: 4px 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.2rem;
}

.foundry-stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  align-self: start;
}

.foundry-stats div {
  padding: 8px;
  border: 1px solid var(--line);
  background: rgba(244, 239, 226, 0.04);
}

.foundry-stats span { display: block; color: var(--muted); font-size: 0.6rem; }
.foundry-stats strong { display: block; margin-top: 4px; font-size: 0.9rem; }

.foundry-actions {
  display: grid;
  gap: 8px;
  align-content: start;
}

.foundry-note strong { color: var(--mint); }

.finale-card {
  border-color: rgba(213, 157, 63, 0.42);
  background: radial-gradient(circle at 100% 0%, rgba(213, 157, 63, 0.13), transparent 45%), rgba(244, 239, 226, 0.025);
}

.finale-card h3 { margin: 6px 0; color: var(--brass); }
.finale-card > .danger { width: 100%; margin-top: 10px; }

.tilt-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  grid-template-rows: auto 1fr;
  gap: 8px;
  height: 100%;
}

.tilt-hero {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(280px, 420px) 1fr;
  grid-template-rows: auto auto;
  gap: 10px 16px;
  overflow: hidden;
}

.tilt-play-wrap {
  grid-row: 1 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 420px;
  max-height: min(72vh, 640px);
  border: 1px solid var(--line);
  background: #06050a;
}

.pinball-canvas {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.tilt-hero-body {
  min-width: 0;
  align-self: start;
}

.tilt-hero h2 {
  margin: 4px 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.1rem;
}

.tilt-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  align-self: start;
}

.tilt-stats div {
  padding: 8px;
  border: 1px solid var(--line);
  background: rgba(244, 239, 226, 0.04);
}

.tilt-stats span { display: block; color: var(--muted); font-size: 0.6rem; }
.tilt-stats strong { display: block; margin-top: 4px; font-size: 0.85rem; }

.tilt-actions {
  display: grid;
  gap: 8px;
  align-content: start;
}

.pill.violet { color: #c86bf0; border-color: rgba(200, 107, 240, 0.35); background: rgba(200, 107, 240, 0.08); }

.settings-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 8px;
  height: 100%;
  overflow-y: auto;
  align-content: start;
}

.settings-card h2 {
  margin: 4px 0 10px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.1rem;
}

.settings-toggle {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  cursor: pointer;
}

.settings-toggle input {
  margin-top: 3px;
  accent-color: var(--brass);
}

.settings-toggle b {
  display: block;
  margin-bottom: 3px;
  font-size: 0.78rem;
}

.settings-toggle small {
  display: block;
  color: var(--muted);
  font-size: 0.65rem;
  line-height: 1.4;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.command-menu[hidden] { display: none; }
.command-menu {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: start center;
  padding: min(12vh, 92px) 16px 24px;
  background: rgba(8, 9, 11, 0.78);
  backdrop-filter: blur(8px);
}

.command-menu-card {
  width: min(680px, 100%);
  max-height: min(720px, 78vh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(213, 157, 63, 0.5);
  background: linear-gradient(155deg, #1d1d20, #111215 65%);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.65), inset 0 1px rgba(255,255,255,0.05);
}

.command-search-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); color: var(--brass); }
.command-search-row input { width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; font: 600 0.95rem "Spline Sans Mono", monospace; }
.command-search-row kbd, .command-menu-footer kbd { color: var(--muted); }
.command-menu-heading { display: flex; justify-content: space-between; align-items: end; padding: 14px 16px 8px; }
.command-menu-heading h2 { margin: 3px 0 0; font: 700 1.15rem "Space Grotesk", sans-serif; }
.command-results { overflow-y: auto; padding: 4px 8px 10px; }
.command-result { width: 100%; display: grid; grid-template-columns: 94px 1fr auto; gap: 12px; align-items: start; padding: 10px; border: 1px solid transparent; color: var(--ink); background: transparent; text-align: left; }
.command-result:hover, .command-result.selected { border-color: rgba(213, 157, 63, 0.38); background: rgba(213, 157, 63, 0.09); }
.command-result-kind { color: var(--brass); font-size: 0.58rem; letter-spacing: 0.1em; text-transform: uppercase; }
.command-result b { display: block; margin-bottom: 3px; font-size: 0.78rem; }
.command-result small { display: block; color: var(--muted); font-size: 0.64rem; line-height: 1.45; }
.command-result kbd { color: var(--mint); font-size: 0.62rem; }
.command-empty { padding: 30px 16px; color: var(--muted); text-align: center; }
.command-menu-footer { margin: 0; padding: 9px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.58rem; text-align: right; }

@media (max-width: 600px) {
  .command-menu { padding: 12px; }
  .command-menu-card { max-height: calc(100vh - 24px); }
  .command-result { grid-template-columns: 72px 1fr; }
  .command-result kbd { display: none; }
}

.list-empty {
  margin: 6px 0 0;
  padding: 8px;
  border: 1px dashed var(--line);
  font-size: 0.65rem;
  line-height: 1.4;
  text-align: center;
}

.toasts {
  position: fixed;
  right: 10px;
  bottom: 10px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}

.toast {
  padding: 8px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--panel-2);
  border: 1px solid var(--line);
  animation: toast-in 200ms ease, toast-out 300ms ease 2.2s forwards;
}

.toast.gold { color: var(--coal); background: var(--brass); border-color: var(--brass); }
.toast.bad { color: #fff; background: var(--ember); border-color: var(--ember); }

@keyframes toast-in { from { opacity: 0; transform: translateX(16px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }

.results {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.75);
}

.results.open { display: flex; }

.results-card {
  width: min(380px, calc(100vw - 24px));
  padding: 20px;
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--line);
}

.results-card h2 {
  margin: 0 0 10px;
  font-family: "Space Grotesk", sans-serif;
}

.result-stars {
  margin-bottom: 14px;
  color: rgba(244, 239, 226, 0.25);
  font-size: 2rem;
  letter-spacing: 4px;
}

.result-stars.earned { color: var(--brass); }

.result-body {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
  text-align: left;
  font-size: 0.75rem;
}

.result-body div {
  display: flex;
  justify-content: space-between;
  padding: 6px 8px;
  border: 1px solid var(--line);
  background: rgba(244, 239, 226, 0.04);
}

.climb-countdown {
  grid-column: 1 / -1;
  margin: 4px 0 0;
  padding: 8px 10px;
  text-align: center;
  border: 1px solid rgba(213, 157, 63, 0.35);
  background: rgba(213, 157, 63, 0.08);
  color: var(--brass);
  font-size: 0.72rem;
}

@media (max-width: 1100px) {
  body { overflow: auto; }
  .app { height: auto; min-height: 100vh; overflow: visible; }
  .engine-grid { grid-template-columns: 1fr; height: auto; }
  .machine { min-height: 260px; }
  .foundry-layout { grid-template-columns: 1fr; height: auto; }
  .foundry-stats { grid-template-columns: repeat(2, 1fr); }
  .tilt-layout { grid-template-columns: 1fr; height: auto; }
  .tilt-hero { grid-template-columns: 1fr; }
  .tilt-play-wrap { grid-row: auto; min-height: 360px; max-height: 55vh; }
  .tilt-stats { grid-template-columns: repeat(2, 1fr); }
}
