:root {
  --bg-void: #0b0818;
  --bg-radial: #171230;
  --surface-panel: #191334;
  --surface-header: #261d4e;
  --surface-card: #211a42;
  --surface-card-hover: #2d2459;
  --border-dark: #0e091c;
  --border-subtle: #4c427a;
  --border-strong: #8778c7;
  --text-main: #f4f6ff;
  --text-muted: #a9b2d8;
  --accent-gold: #f7be2b;
  --accent-gold-hi: #fff5a3;
  --accent-gold-lo: #a8640a;
  --accent-cyan: #6fe8ff;
  --accent-purple: #b894ff;
  --accent-coral: #ff5c6c;
  --accent-green: #58e897;

  /* Dynamic World-Theme Button & Modal Accents (default: Meadow Sunburst) */
  --theme-fab-bg: #1e4268;
  --theme-fab-bg-hi: #2b5c8f;
  --theme-fab-border: #f7be2b;
  --theme-fab-hi: #fff5a3;
  --theme-fab-lo: #9c5b0c;
  --theme-fab-glow: rgba(247, 190, 43, 0.4);

  --pad-scale: 1;
  --pad-opacity: 0.54;
  --right-x: 0px;
  --right-y: 0px;
}

body[data-theme='meadow'] {
  --theme-fab-bg: #1e4268;
  --theme-fab-bg-hi: #2b5c8f;
  --theme-fab-border: #f7be2b;
  --theme-fab-hi: #fff5a3;
  --theme-fab-lo: #9c5b0c;
  --theme-fab-glow: rgba(247, 190, 43, 0.42);
}

body[data-theme='canopy'] {
  --theme-fab-bg: #164436;
  --theme-fab-bg-hi: #21614c;
  --theme-fab-border: #72e870;
  --theme-fab-hi: #d4ffae;
  --theme-fab-lo: #1b6b34;
  --theme-fab-glow: rgba(114, 232, 112, 0.4);
}

body[data-theme='ruins'] {
  --theme-fab-bg: #361d4a;
  --theme-fab-bg-hi: #4d2969;
  --theme-fab-border: #ff8e47;
  --theme-fab-hi: #ffe094;
  --theme-fab-lo: #a83c18;
  --theme-fab-glow: rgba(255, 142, 71, 0.42);
}

body[data-theme='vortex'] {
  --theme-fab-bg: #2a1452;
  --theme-fab-bg-hi: #3f1d78;
  --theme-fab-border: #6ef4ff;
  --theme-fab-hi: #ff9ef5;
  --theme-fab-lo: #6c28b8;
  --theme-fab-glow: rgba(110, 244, 255, 0.44);
}

.pixel-icon {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

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

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  background: radial-gradient(circle at 50% 42%, var(--bg-radial) 0%, var(--bg-void) 76%);
  color: var(--text-main);
  font-family: ui-monospace, 'SFMono-Regular', 'Menlo', 'Consolas', 'Liberation Mono', monospace;
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}

/* =========================================================================
 * Full-Bleed Edge-to-Edge Game Viewport (Zero Bezel Waste!)
 * ========================================================================= */
.game-viewport {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-void);
  overflow: hidden;
}

.canvas-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(100vw, calc(100dvh * var(--view-w, 480) / var(--view-h, 270)));
  height: min(100dvh, calc(100vw * var(--view-h, 270) / var(--view-w, 480)));
  max-width: 100vw;
  max-height: 100dvh;
}

.canvas-stage.is-fullbleed {
  width: 100vw;
  height: 100dvh;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: var(--view-w, 480) / var(--view-h, 270);
  background: #0b0e1c;
  image-rendering: -moz-crisp-edges;
  image-rendering: -webkit-crisp-edges;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.canvas-stage.is-fullbleed #game-canvas {
  aspect-ratio: auto;
}

.scanline-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.08) 3px
  );
}

/* =========================================================================
 * Prominent 16-Bit SNES Theme-Colored Top-Right Almanac & Settings Buttons
 * ========================================================================= */
.top-right-fabs {
  position: fixed;
  top: max(8px, env(safe-area-inset-top));
  right: max(8px, env(safe-area-inset-right));
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-fab,
.settings-fab {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 0;
  border: 2px solid var(--theme-fab-border);
  background: var(--theme-fab-bg);
  color: var(--accent-gold-hi);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  opacity: 1;
  box-shadow:
    0 0 0 2px var(--border-dark),
    0 4px 0 2px var(--border-dark),
    inset 0 2px 0 var(--theme-fab-hi),
    inset 0 -3px 0 var(--theme-fab-lo),
    0 0 12px var(--theme-fab-glow);
  transition: transform 0.06s steps(2), background 0.08s steps(2);
}

.top-fab::before,
.top-fab::after {
  content: '';
  position: absolute;
  width: 3px;
  height: 3px;
  background: var(--theme-fab-hi);
  pointer-events: none;
}

.top-fab::before {
  top: 2px;
  left: 2px;
}

.top-fab::after {
  top: 2px;
  right: 2px;
}

.top-fab:hover,
.top-fab:focus-visible,
.settings-fab:hover,
.settings-fab:focus-visible {
  background: var(--theme-fab-bg-hi);
  border-color: var(--theme-fab-hi);
  outline: none;
}

.top-fab:active,
.settings-fab:active {
  transform: translateY(2px);
  box-shadow:
    0 0 0 2px var(--border-dark),
    0 2px 0 2px var(--border-dark),
    inset 0 2px 0 var(--theme-fab-lo);
}

/* =========================================================================
 * Native Landscape Floating Analog Thumbstick + Ghost Radial Thumb-Arc HUD
 * ========================================================================= */
.touch-controls {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  touch-action: none;
  user-select: none;
}

.touch-controls[hidden],
.touch-editor[hidden],
.modal-backdrop[hidden],
.rotate-hint[hidden] {
  display: none;
}

/* Invisible dynamic left-half touch field (leaves top HUD / Reserve Box unobstructed) */
.touch-stick-zone {
  position: fixed;
  left: 0;
  top: max(48px, calc(env(safe-area-inset-top) + 36px));
  width: 50vw;
  bottom: 0;
  pointer-events: auto;
  touch-action: none;
}

/* Floating Round Analog Thumbstick (hidden until thumb touches left side!) */
.stick-base {
  position: fixed;
  width: calc(96px * var(--pad-scale));
  height: calc(96px * var(--pad-scale));
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.08s linear;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stick-base.is-visible {
  opacity: max(0.52, calc(var(--pad-opacity) + 0.16));
}

.stick-ring-outer {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.58);
  background: rgba(14, 10, 32, 0.16);
  box-shadow:
    0 0 0 2px rgba(10, 6, 22, 0.42),
    inset 0 0 0 2px rgba(255, 255, 255, 0.12);
}

.stick-base.is-sprinting .stick-ring-outer {
  border-color: rgba(255, 224, 77, 0.85);
  box-shadow:
    0 0 0 2px rgba(10, 6, 22, 0.5),
    0 0 12px rgba(255, 216, 61, 0.35),
    inset 0 0 0 2px rgba(255, 245, 163, 0.24);
}

.stick-crosshair {
  position: absolute;
  width: 14px;
  height: 14px;
  pointer-events: none;
}

.stick-crosshair::before,
.stick-crosshair::after {
  content: '';
  position: absolute;
  background: rgba(255, 255, 255, 0.32);
}

.stick-crosshair::before {
  left: 6px;
  top: 0;
  width: 2px;
  height: 14px;
}

.stick-crosshair::after {
  left: 0;
  top: 6px;
  width: 14px;
  height: 2px;
}

.stick-dir-pip {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.36);
  box-shadow: 0 0 0 1px rgba(10, 6, 22, 0.5);
}

.stick-dir-pip.pip-l {
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
}

.stick-dir-pip.pip-r {
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
}

.stick-dir-pip.pip-d {
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
}

.stick-base.dir-left .pip-l,
.stick-base.dir-right .pip-r,
.stick-base.dir-down .pip-d {
  background: #fff5a3;
  box-shadow: 0 0 6px rgba(255, 224, 77, 0.85);
}

.stick-knob {
  position: relative;
  width: calc(36px * var(--pad-scale));
  height: calc(36px * var(--pad-scale));
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.88);
  background: rgba(255, 255, 255, 0.24);
  box-shadow:
    0 0 0 2px rgba(10, 6, 22, 0.55),
    inset 0 2px 0 rgba(255, 255, 255, 0.45);
  will-change: transform;
}

.stick-base.is-sprinting .stick-knob {
  border-color: #fff6a8;
  background: rgba(247, 190, 43, 0.44);
}

/* Right-Thumb Ergonomic Radial Action Arc (See-Through Ghost Overlay) */
.touch-cluster {
  position: fixed;
  pointer-events: auto;
  touch-action: none;
}

.touch-right {
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  opacity: var(--pad-opacity);
  transform: translate(var(--right-x), var(--right-y)) scale(var(--pad-scale));
  transform-origin: right bottom;
  transition: opacity 0.08s linear;
}

body.is-editing-pad .touch-right {
  outline: 2px dashed var(--accent-gold);
  outline-offset: 8px;
  background: rgba(247, 190, 43, 0.14);
  cursor: grab;
  opacity: max(var(--pad-opacity), 0.85);
}

body.is-editing-pad .touch-right:active {
  cursor: grabbing;
}

/* Orbital 3-button right pad: larger Jump in lower-left corner + 2 smaller orbiting action buttons */
.radial-arc {
  position: relative;
  width: 146px;
  height: 150px;
  touch-action: none;
}

.arc-btn {
  position: absolute;
  appearance: none;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.78);
  background: rgba(14, 10, 32, 0.28);
  color: rgba(255, 255, 255, 0.96);
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  touch-action: none;
  pointer-events: auto;
  box-shadow:
    0 0 0 2px rgba(10, 6, 22, 0.55),
    inset 0 2px 0 rgba(255, 255, 255, 0.28);
  transition: transform 0.04s steps(2), background 0.05s steps(2), border-color 0.06s linear;
}

/* Generous invisible touch hitbox extending 10px beyond visible outline */
.arc-btn::before {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 50%;
}

/* Primary Anchor: Large Jump button in lower-left corner of right cluster */
.arc-jump {
  left: 4px;
  bottom: 4px;
  width: 78px;
  height: 78px;
  border-color: rgba(255, 232, 130, 0.92);
}

/* Smaller Orbital Button 1: Spin Jump (diagonal right-up orbit around Jump) */
.arc-spin {
  left: 90px;
  bottom: 52px;
  width: 50px;
  height: 50px;
  border-color: rgba(140, 238, 255, 0.84);
}

/* Smaller Orbital Button 2: Run / Carry / Context Solar Fire (diagonal upper orbit around Jump) */
.arc-fire {
  left: 40px;
  bottom: 95px;
  width: 50px;
  height: 50px;
  border-color: rgba(255, 255, 255, 0.74);
}

.arc-fire .icon-fire {
  display: none;
}

.arc-fire.is-solar-fire .icon-run {
  display: none;
}

.arc-fire.is-solar-fire .icon-fire {
  display: block;
}

.arc-fire.is-autorun {
  border-color: rgba(124, 238, 146, 0.72);
  color: #c8ffd2;
}

.arc-fire.is-solar-fire {
  border-color: #ffd84d;
  background: rgba(184, 86, 18, 0.34);
  color: #fff6a8;
  box-shadow:
    0 0 0 2px rgba(10, 6, 22, 0.62),
    0 0 12px rgba(255, 208, 64, 0.55),
    inset 0 2px 0 rgba(255, 248, 178, 0.45);
}

.arc-btn.is-active {
  transform: translateY(2px);
  background: rgba(247, 190, 43, 0.46);
  border-color: #ffffff;
  color: #ffffff;
  box-shadow:
    0 0 0 2px rgba(10, 6, 22, 0.7),
    0 0 14px rgba(255, 232, 118, 0.55);
}

/* Subtle dismissible portrait rotate tip */
.rotate-hint {
  position: fixed;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 35;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(20, 15, 44, 0.88);
  border: 2px solid var(--accent-gold);
  box-shadow: 0 0 0 2px var(--border-dark), 0 4px 0 2px var(--border-dark);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--accent-gold-hi);
  white-space: nowrap;
}

.rotate-hint button {
  appearance: none;
  border: 0;
  background: transparent;
  color: #cfd6f4;
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  padding: 0 2px;
}

/* Portrait phone: lift canvas slightly so action arc rests neatly below or at lower edge */
@media (orientation: portrait) and (max-width: 760px) {
  body.has-touch-pad .game-viewport {
    align-items: flex-start;
    padding-top: max(50px, calc(env(safe-area-inset-top) + 40px));
  }

  .touch-right {
    right: max(14px, env(safe-area-inset-right));
    bottom: max(46px, calc(env(safe-area-inset-bottom) + 38px));
  }
}

/* Compact landscape phones: true edge-to-edge fullscreen feel with sleek top-right plaques */
@media (orientation: landscape) and (max-height: 500px) {
  .top-fab,
  .settings-fab {
    width: 38px;
    height: 38px;
  }

  .top-fab .pixel-icon {
    width: 20px;
    height: 20px;
  }

  .radial-arc {
    width: 146px;
    height: 124px;
  }

  .arc-jump {
    width: 62px;
    height: 62px;
  }

  .arc-spin {
    right: 76px;
    bottom: 10px;
    width: 52px;
    height: 52px;
  }

  .arc-fire {
    right: 32px;
    bottom: 72px;
    width: 48px;
    height: 48px;
  }
}

/* =========================================================================
 * 16-Bit Touch Layout Customizer Floating Bar
 * ========================================================================= */
.touch-editor {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 45;
  width: min(440px, calc(100vw - 24px));
  padding: 12px 14px;
  border-radius: 0;
  background: var(--surface-panel);
  border: 2px solid var(--accent-gold);
  box-shadow:
    0 0 0 2px var(--border-dark),
    0 6px 0 2px var(--border-dark),
    inset 0 2px 0 var(--accent-gold-hi);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.editor-title {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-align: center;
  color: var(--accent-gold-hi);
  text-shadow: 0 2px 0 var(--border-dark);
}

.editor-sliders {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  font-size: 10px;
  font-weight: 800;
  color: var(--text-main);
}

.editor-sliders label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.editor-sliders input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  width: 88px;
  height: 8px;
  background: #0e0a20;
  border: 2px solid var(--border-subtle);
  border-radius: 0;
}

.editor-sliders input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 16px;
  background: var(--accent-gold);
  border: 2px solid var(--border-dark);
  border-radius: 0;
  box-shadow: inset 0 2px 0 var(--accent-gold-hi);
  cursor: pointer;
}

.editor-check {
  cursor: pointer;
}

.editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* =========================================================================
 * 16-Bit SNES Modal System (Settings & Controls + 3-Slot Save Picker)
 * ========================================================================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(8, 6, 20, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    max(12px, env(safe-area-inset-top))
    max(12px, env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom))
    max(12px, env(safe-area-inset-left));
}

.modal-sheet {
  width: min(560px, 100%);
  max-height: calc(100dvh - 24px);
  display: flex;
  flex-direction: column;
  border-radius: 0;
  background: var(--surface-panel);
  border: 2px solid var(--theme-fab-border);
  box-shadow:
    0 0 0 3px var(--border-dark),
    0 8px 0 3px var(--border-dark),
    inset 0 2px 0 var(--theme-fab-hi);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface-header);
  border-bottom: 2px solid var(--border-dark);
  flex-shrink: 0;
}

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-header h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-gold);
  text-shadow: 0 2px 0 var(--border-dark);
}

.slot-pill {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
  padding: 3px 8px;
  border-radius: 0;
  background: #14364a;
  border: 2px solid var(--accent-cyan);
  color: #b8f6ff;
  box-shadow: 0 2px 0 var(--border-dark);
}

.icon-close-btn {
  appearance: none;
  width: 32px;
  height: 32px;
  border-radius: 0;
  border: 2px solid var(--accent-coral);
  background: #4e1526;
  color: #ffd0d5;
  font-family: inherit;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 2px 0 var(--border-dark),
    inset 0 2px 0 rgba(255, 190, 195, 0.35);
}

.icon-close-btn:hover {
  background: #731d34;
  color: #ffffff;
}

.icon-close-btn:active {
  transform: translateY(2px);
  box-shadow: none;
}

.modal-body {
  padding: 14px 16px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  -webkit-overflow-scrolling: touch;
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.section-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-cyan);
  text-shadow: 0 1px 0 var(--border-dark);
}

/* 16-Bit Beveled Buttons & Segmented Pickers */
.ui-btn,
.seg-btn {
  appearance: none;
  border: 2px solid var(--border-subtle);
  background: var(--surface-card);
  color: var(--text-main);
  font-family: inherit;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 11px;
  border-radius: 0;
  cursor: pointer;
  box-shadow:
    0 3px 0 var(--border-dark),
    inset 0 2px 0 rgba(255, 255, 255, 0.14),
    inset 0 -2px 0 rgba(0, 0, 0, 0.35);
}

.ui-btn:hover,
.seg-btn:hover {
  background: var(--surface-card-hover);
  border-color: var(--border-strong);
}

.ui-btn:active,
.seg-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--border-dark);
}

.ui-btn[hidden] {
  display: none;
}

.ui-btn.is-primary {
  background: #174c34;
  border-color: var(--accent-green);
  color: #c2ffdc;
}

.ui-btn.is-accent {
  background: #4e3910;
  border-color: var(--accent-gold);
  color: var(--accent-gold-hi);
}

.ui-btn.is-warn {
  background: #4e1726;
  border-color: var(--accent-coral);
  color: #ffc2c8;
}

.ui-btn.is-on {
  background: #154059;
  border-color: var(--accent-cyan);
  color: #c8f7ff;
}

.ui-btn.is-muted {
  color: #ff9ea6;
  border-color: var(--accent-coral);
  background: #3d1422;
}

.ui-btn.is-trippy {
  background: linear-gradient(90deg, #4b1d7a 0%, #1d4e70 100%);
  border-color: #d094ff;
  color: #f8e4ff;
}

.segmented-grid {
  display: grid;
  gap: 6px;
}

.pace-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

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

.pad-mode-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  flex: 1;
}

.seg-btn {
  padding: 7px 6px;
  text-align: center;
  font-size: 9.5px;
}

.seg-btn.is-selected {
  background: #5c420e;
  border-color: var(--accent-gold);
  color: var(--accent-gold-hi);
  box-shadow:
    0 3px 0 var(--border-dark),
    inset 0 2px 0 var(--accent-gold-hi);
}

.toggle-row,
.pad-settings-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.toggle-btn {
  flex: 1 1 180px;
}

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

/* Controls Guide Inside Settings */
.controls-section {
  padding-top: 10px;
  border-top: 2px solid var(--border-dark);
}

.controls-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 18px;
}

.control-col h3 {
  margin: 0 0 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-gold);
  text-shadow: 0 1px 0 var(--border-dark);
}

.control-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 10.5px;
  line-height: 1.4;
  color: #d6dcf5;
}

kbd {
  display: inline-block;
  padding: 1px 5px;
  font-family: inherit;
  font-size: 9.5px;
  font-weight: 800;
  color: var(--accent-gold-hi);
  background: #120d26;
  border: 2px solid var(--border-subtle);
  border-radius: 0;
  box-shadow: 0 2px 0 var(--border-dark);
}

/* =========================================================================
 * 16-Bit 3-Slot Save Picker Modal
 * ========================================================================= */
.save-picker-sheet {
  width: min(480px, 100%);
}

.save-slots-list {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}

.save-slot-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 0;
  border: 2px solid var(--border-subtle);
  background: var(--surface-card);
  cursor: pointer;
  box-shadow:
    0 3px 0 var(--border-dark),
    inset 0 2px 0 rgba(255, 255, 255, 0.08);
}

.save-slot-card:hover {
  background: var(--surface-card-hover);
  border-color: var(--border-strong);
}

.save-slot-card.is-focused {
  border-color: var(--accent-gold);
  background: #332757;
  box-shadow:
    0 3px 0 var(--border-dark),
    inset 0 2px 0 var(--accent-gold-hi);
}

.save-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.save-slot-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #ffffff;
  text-shadow: 0 2px 0 var(--border-dark);
}

.save-world-tag {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 0;
  background: #523b0d;
  border: 2px solid var(--accent-gold);
  color: var(--accent-gold-hi);
}

.save-world-tag.is-clear {
  background: #144d31;
  border-color: var(--accent-green);
  color: #b4ffd8;
}

.save-new-label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--accent-cyan);
  text-shadow: 0 2px 0 var(--border-dark);
}

.save-new-sub {
  font-size: 10px;
  color: var(--text-muted);
}

.save-stats-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  font-size: 10.5px;
  color: #d7def7;
}

.save-stat strong {
  color: var(--accent-gold-hi);
}

.save-erase-area {
  display: flex;
  align-items: center;
  gap: 6px;
}

.save-erase-btn {
  appearance: none;
  border: 2px solid var(--accent-coral);
  background: #461524;
  color: #ffb8bf;
  font-family: inherit;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 4px 8px;
  border-radius: 0;
  cursor: pointer;
  box-shadow: 0 2px 0 var(--border-dark);
}

.save-erase-btn:hover {
  background: #6e1c33;
  color: #ffffff;
}

.save-confirm-yes {
  background: #8a1d32;
  border-color: #ff7a84;
  color: #ffffff;
}

.save-confirm-no {
  border-color: var(--border-subtle);
  background: var(--surface-card);
  color: var(--text-main);
}

.save-picker-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 10px 16px;
  background: var(--surface-header);
  border-top: 2px solid var(--border-dark);
  font-size: 10px;
  color: var(--text-muted);
}

@media (max-width: 540px) {
  .top-right-fabs {
    gap: 6px;
  }

  .top-fab,
  .settings-fab {
    width: 38px;
    height: 38px;
  }

  .pace-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .actions-grid {
    grid-template-columns: 1fr;
  }
}
