/* Oregon Trail Inspired Retro Styling */
:root {
  /* Warm sepia palette from UX spec */
  --bg: #0A0907;
  --panel: #3A2918;
  --panel-border: #E4C07A;
  --text: #F2D7A0;
  --text-dim: #BFA782;
  --text-bright: #FFF2C9;
  --accent: #F7E39B;
  --accent-2: #D29A43;
  --button-bg: #54381F;
  --button-border: #E4C07A;
  --shadow: #140E07;
  --prairie: #6F8B45;
  --dust: #8A7E6A;
}

/* High Contrast theme toggled via .hc on <html> */
html.hc {
  --bg: #0A0F14;
  --panel: #162128;
  --panel-border: #F2F2F2;
  --text: #F2F2F2;
  --text-dim: #D0D6DD;
  --text-bright: #FFFFFF;
  --accent: #00E0CE;
  --accent-2: #00A896;
  --button-bg: #162128;
  --button-border: #F2F2F2;
  --shadow: #0A0F14;
}

/* Import retro pixel font */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

/* Reset and base styles */
* {
  box-sizing: border-box;
}

html {
  height: 100%;
  margin: 0;
  padding: 0;
  background: var(--bg);
}

body {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: 'Press Start 2P', 'Courier Prime', 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  image-rendering: pixelated;
  cursor: default;
  min-height: 100vh;
}

/* Oregon Trail style numbered menu */
.ot-menu ul[role="menu"] {
  list-style: none;
  padding: 0;
  margin: 0;
}
.ot-menuitem {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  padding-block: 8px;
  padding-inline: 12px;
  min-height: 44px; /* touch target */
  cursor: pointer;
  border: 2px solid transparent;
}
.ot-menuitem:focus {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.ot-menuitem[aria-checked='true']{
  border-color: var(--accent);
}
.ot-menuitem .num {
  color: var(--accent);
  font-weight: bold;
  min-width: 2ch;
}
.ot-menuitem .label {
  color: var(--text-bright);
}
.ot-menu p.muted {
  margin-top: 12px;
}

footer {
  text-align: center;
  padding: 12px 20px;
  font-size: 12px;
  color: var(--text-dim);
}

/* Accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Main container */
#main {
  display: block;
  max-width: min(800px, 95vw);
  margin: 20px auto;
  padding: 20px;
  background: var(--bg);
}

/* Oregon Trail style panels */
.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  padding: 24px;
  margin: 20px auto;
  max-width: 680px;
  box-shadow:
    inset 0 0 0 1px var(--shadow),
    6px 6px 0 var(--shadow);
  position: relative;
}

/* Panel titles */
.panel h1, .panel h2, .panel h3 {
  color: var(--text-bright);
  margin-top: 0;
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Controls layout */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
  justify-content: center;
}

/* Oregon Trail style buttons */
button {
  appearance: none;
  background: var(--button-bg);
  color: var(--text-bright);
  border: 1px solid var(--button-border);
  padding: 12px 20px;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  font-weight: normal;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow:
    4px 4px 0 var(--shadow),
    inset 0 0 0 1px rgba(20, 14, 7, 0.45);
  transition: background-color 140ms ease, color 140ms ease, transform 100ms ease, box-shadow 140ms ease;
  position: relative;
  min-width: 120px;
  border-radius: 4px;
}

button:hover {
  background: #5b3f23;
  color: var(--text-bright);
  box-shadow:
    3px 3px 0 var(--shadow),
    inset 0 0 0 1px rgba(20, 14, 7, 0.45);
}

button:active {
  box-shadow:
    inset 0 0 0 1px #1A1000,
    inset 0 2px 6px rgba(20, 14, 7, 0.6);
  transform: translate(1px, 1px);
  background: #3f2a18;
}

button:focus-visible {
  outline: 2px solid var(--text-bright);
  outline-offset: 3px;
}

button:disabled {
  background: #2D1B00;
  color: #B8956A;
  border-color: #B8956A;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* Oregon Trail ASCII-style decorative elements */
button::before {
  content: "» ";
  color: var(--accent);
  font-weight: bold;
}

button:disabled::before {
  color: var(--text-dim);
}

/* Form inputs */
input, textarea, select {
  background: #000000;
  color: var(--text-bright);
  border: 1px solid #D4A574;
  padding: 12px;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    inset 0 0 0 1px var(--shadow);
  line-height: 1.4;
  border-radius: 4px;
}

input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
  box-shadow:
    0 0 0 2px rgba(247, 227, 155, 0.35),
    inset 0 0 0 2px var(--accent);
}

/* Field layout */
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-weight: bold;
  color: var(--text-bright);
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.5px;
}

/* Text styling */
.muted {
  color: var(--text-dim);
  word-break: keep-all;
}

/* Stats display */
.stats {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-weight: bold;
}

.stats-list {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  padding: 0;
  margin: 12px 0;
  list-style: none;
}

.stats-list li {
  background: var(--button-bg);
  border: 1px solid var(--panel-border);
  padding: 8px 12px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Executive order display */
.order {
  margin-top: 8px;
  color: var(--accent);
  font-weight: bold;
  text-transform: uppercase;
  font-size: 14px;
}

/* Image rendering */
img {
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

/* Progress bars - Oregon Trail style */
.bar-wrap {
  height: 18px;
  background: #2D1B00;
  border: 1px solid var(--panel-border);
  margin: 16px 0;
  overflow: hidden;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px var(--shadow);
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) 100%);
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.35);
  border-radius: 4px;
}

.bar-wrap.slim {
  height: 12px;
  margin: 8px 0 4px;
}

.bar-fill-glow {
  animation: meterGlow 2s ease-in-out infinite;
}

.bar-fill-pulse {
  animation: meterPulse 1.6s ease-in-out infinite;
}

.pants-warn .bar-fill {
  background: linear-gradient(90deg, var(--accent-2) 0%, #f2b450 100%);
}

.pants-critical .bar-fill {
  background: linear-gradient(90deg, #8a2c2c 0%, #b23b3b 100%);
}

.pants-warn .meter-label,
.pants-critical .meter-label {
  color: var(--text-bright);
}

.store-card-icon,
.persona-portrait {
  image-rendering: pixelated;
}

/* Modal/Drawer styling */
.drawer {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}

.drawer-body {
  width: min(600px, 90vw);
  background: var(--panel);
  border: 3px solid var(--panel-border);
  padding: 24px;
  box-shadow: 6px 6px 0 var(--shadow);
}

/* Log display */
.log {
  background: var(--bg);
  border: 2px solid var(--panel-border);
  padding: 16px;
  margin-top: 16px;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: inset 2px 2px 0 var(--shadow);
}

.log p {
  margin: 0 0 8px 0;
  font-size: 14px;
  line-height: 1.4;
}

.log p:last-child {
  margin-bottom: 0;
}

/* Alert banners - Oregon Trail style */
.alert {
  background: var(--panel);
  border: 3px solid var(--accent-2);
  padding: 16px;
  margin: 16px 0;
  box-shadow: 4px 4px 0 var(--shadow);
  position: relative;
  font-size: 14px;
  line-height: 1.4;
}

.alert::before {
  content: "⚠";
  position: absolute;
  top: 8px;
  inset-inline-start: 8px;
  font-size: 16px;
  color: var(--accent);
}

.breakdown-alert {
  border-color: #FF6B35;
  background: linear-gradient(45deg, var(--panel) 0%, #2D1000 100%);
}

.breakdown-alert::before {
  content: "🔧";
  color: #FF6B35;
}

.alert p {
  margin: 0 0 8px 0;
  padding-inline-start: 24px;
  color: var(--text-bright);
  font-weight: bold;
}

.alert p:last-child {
  margin-bottom: 0;
}

.help-text {
  color: var(--text-dim);
  font-size: 12px;
  margin-top: 8px;
  text-align: center;
}

/* Retro animations */
@media (prefers-reduced-motion: no-preference) {
  .bar-fill-glow {
    animation: meterGlow 2s ease-in-out infinite;
  }

  .bar-fill-pulse {
    animation: meterPulse 1.6s ease-in-out infinite;
  }

  .portrait-pulse {
    animation: portraitPulse 2.4s ease-in-out infinite;
  }

  .persona-tile.selected {
    animation: borderPulse 2.2s ease-in-out infinite;
  }

  .cta-pulse {
    animation: ctaPulse 1.6s ease-in-out infinite;
  }
}

@keyframes meterGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(247, 227, 155, 0.35); }
  50% { box-shadow: 0 0 10px 0 rgba(247, 227, 155, 0.4); }
}

@keyframes meterPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(210, 154, 67, 0.45); }
  50% { box-shadow: 0 0 12px 2px rgba(210, 154, 67, 0.55); }
}

@keyframes portraitPulse {
  0%, 100% { box-shadow:
    inset -2px -2px 0 rgba(20, 14, 7, 0.6),
    inset 2px 2px 0 rgba(247, 227, 155, 0.16);
  }
  50% { box-shadow:
    inset -1px -1px 0 rgba(20, 14, 7, 0.5),
    inset 3px 3px 0 rgba(247, 227, 155, 0.2);
  }
}

@keyframes borderPulse {
  0%, 100% { box-shadow:
    0 0 0 1px var(--text-bright),
    inset 0 0 0 1px var(--shadow);
  }
  50% { box-shadow:
    0 0 0 2px var(--accent),
    inset 0 0 0 1px var(--shadow);
  }
}

@keyframes ctaPulse {
  0%, 100% { opacity: 1; filter: brightness(1); }
  50% { opacity: 0.78; filter: brightness(1.1); }
}

/* Base responsive design - Mobile First */
.panel {
  padding: 16px;
  margin: 12px 0;
}

button {
  padding: 10px 16px;
  font-size: 12px;
}

.controls {
  gap: 8px;
}

#main {
  margin: 10px auto;
  padding: 10px;
}

/* Tablet and larger screens */
@media (min-width: 768px) {
  .panel {
    padding: 20px;
    margin: 16px 0;
  }

  button {
    padding: 12px 20px;
    font-size: 14px;
  }

  .controls {
    gap: 12px;
  }

  #main {
    margin: 20px auto;
    padding: 20px;
  }
}/* Retro component-specific styling */
.retro-btn-primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  font-weight: bold;
}

.retro-btn-primary:hover {
  background: var(--text-bright);
  color: var(--bg);
  border-color: var(--text-bright);
}

.retro-btn-choice {
  min-width: 200px;
  text-align: start;
}

.retro-encounter {
  border-color: var(--accent);
}

.encounter-desc {
  background: var(--bg);
  border: 1px solid var(--panel-border);
  padding: 16px;
  margin: 16px 0;
  box-shadow: inset 1px 1px 0 var(--shadow);
}

.encounter-panel,
.boss-panel {
  border: 1px solid var(--panel-border);
  box-shadow:
    inset 0 0 0 1px var(--shadow),
    6px 6px 0 var(--shadow);
}

html.hc .encounter-panel,
html.hc .boss-panel {
  box-shadow:
    inset 0 0 0 1px var(--shadow),
    4px 4px 0 var(--accent);
}

/* Share code bar styling */
.share-code-input {
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: bold;
  text-align: center;
}

.share-code-input:invalid {
  border-color: #FF0000;
  background: #330000;
}

/* Stats header row */
.stats-panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: inset 0 0 0 1px var(--shadow);
}

.header-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: center;
}

.header-persona {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  background: rgba(20, 14, 7, 0.35);
  box-shadow: inset 0 0 0 1px var(--shadow);
}

.persona-portrait {
  width: 64px;
  height: 64px;
  border-radius: 4px;
  background: linear-gradient(135deg, #5b3b22 0%, #2b1a0f 100%);
  border: 1px solid var(--panel-border);
  box-shadow:
    inset -2px -2px 0 rgba(20, 14, 7, 0.6),
    inset 2px 2px 0 rgba(247, 227, 155, 0.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.portrait-pulse {
}

.portrait-initial {
  color: var(--text-bright);
  font-size: 18px;
  letter-spacing: 1px;
}

.persona-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.persona-copy p {
  margin: 0;
}

.persona-name {
  color: var(--text-bright);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.stat-chip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  align-self: stretch;
}

.stat-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  background: rgba(20, 14, 7, 0.3);
  box-shadow: inset 0 0 0 1px var(--shadow);
  min-height: 48px;
}

.stat-icon {
  flex-shrink: 0;
}

.stat-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: flex-start;
}

.stat-label {
  color: var(--text-dim);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
}

.stat-value {
  color: var(--text-bright);
  font-weight: 700;
}

.conditions-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

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

.exec-row {
  display: inline-flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.pace-diet-row {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

.pants-meter {
  flex: 1;
  min-width: 220px;
}

.meter-label {
  color: var(--text-dim);
  font-size: 12px;
  margin-bottom: 6px;
}

.condition-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.25);
  box-shadow: inset 0 0 0 1px var(--shadow);
  min-height: 36px;
}

.condition-label {
  color: var(--text-bright);
  font-weight: 600;
}

.sprite-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  color: var(--accent);
  text-shadow: 1px 1px 0 var(--shadow);
  font-weight: 800;
  box-shadow: inset 0 0 0 1px var(--shadow);
  min-width: 20px;
}

.sprite-weather {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  font-size: 14px;
}

.sprite-eo {
  width: 20px;
  height: 20px;
  border-radius: 3px;
  font-size: 12px;
}

.sprite-pace,
.sprite-diet {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  font-size: 12px;
}

.sprite-weather-clear { background: linear-gradient(135deg, #f7e39b 0%, #54381f 100%); }
.sprite-weather-storm { background: linear-gradient(135deg, #2d1b00 0%, #8a7e6a 100%); }
.sprite-weather-heat { background: linear-gradient(135deg, #d29a43 0%, #f7e39b 100%); }
.sprite-weather-cold { background: linear-gradient(135deg, #3a2918 0%, #8a7e6a 100%); }
.sprite-weather-smoke { background: linear-gradient(135deg, #2d1b00 0%, #6f8b45 100%); }

.sprite-eo-shutdown { background: linear-gradient(135deg, #8a2c2c 0%, #54381f 100%); }
.sprite-eo-travelban { background: linear-gradient(135deg, #2d1b00 0%, #d29a43 100%); }
.sprite-eo-book { background: linear-gradient(135deg, #3a2918 0%, #f7e39b 100%); }
.sprite-eo-tariff { background: linear-gradient(135deg, #140e07 0%, #d29a43 100%); }
.sprite-eo-doe { background: linear-gradient(135deg, #2d1b00 0%, #6f8b45 100%); }
.sprite-eo-war { background: linear-gradient(135deg, #54381f 0%, #f7e39b 100%); }

.sprite-pace,
.sprite-diet {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  font-size: 12px;
}

.weather-icon {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: var(--shadow);
  color: var(--text-bright);
  font-weight: 700;
}

.weather-pill.mitigated {
  filter: brightness(0.75) saturate(0.9);
}

.exec-pill {
  background: rgba(247, 227, 155, 0.1);
  gap: 8px;
}

/* Menu styling - Mobile First */
.retro-menu {
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

.retro-header {
  margin-bottom: 20px;
}

/* Persona selection grid */
.persona-select {
  text-align: left;
}

.persona-layout {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.persona-grid {
  flex: 2;
  display: grid;
  width: 100%;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.persona-tile {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  background: rgba(20, 14, 7, 0.35);
  box-shadow: inset 0 0 0 1px var(--shadow);
  cursor: pointer;
}

.persona-tile:hover {
  border-color: var(--text-bright);
  background: rgba(247, 227, 155, 0.08);
}

.persona-tile:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.persona-tile.selected {
  border-color: var(--text-bright);
  box-shadow:
    0 0 0 1px var(--text-bright),
    inset 0 0 0 1px var(--shadow);
}

.persona-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.persona-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.persona-mult {
  background: var(--accent-2);
  color: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.persona-desc {
  margin: 0;
}

.persona-stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.persona-preview-card {
  flex: 1;
  min-width: 240px;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  padding: 12px;
  background: rgba(20, 14, 7, 0.3);
  box-shadow: inset 0 0 0 1px var(--shadow);
}

.persona-preview-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.persona-preview-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.persona-mods {
  color: var(--text);
  font-weight: 600;
}

.mini-stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.2);
  font-size: 11px;
  letter-spacing: 0.3px;
}

.mini-stat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: var(--panel-border);
  color: var(--bg);
  font-weight: 700;
}

.mini-stat-value {
  color: var(--text-bright);
  font-weight: 700;
}

/* Outfitting store */
.store-shell {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.store-budget {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  padding: 10px 12px;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  background: rgba(20, 14, 7, 0.4);
  min-width: 160px;
  box-shadow: inset 0 0 0 1px var(--shadow);
}

.store-budget .label {
  color: var(--text-dim);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.store-budget .value {
  color: var(--text-bright);
  font-weight: 700;
  font-size: 14px;
}

.store-budget.over .value {
  color: #f05f5f;
}

.store-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.store-tab {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  padding: 8px 12px;
  box-shadow: inset 0 0 0 1px var(--shadow);
  cursor: pointer;
}

.store-tab:hover {
  background: rgba(247, 227, 155, 0.08);
  color: var(--text-bright);
}

.store-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.store-item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.store-cart-panel {
  max-width: 720px;
}

.store-cart-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.store-cart-line {
  background: rgba(20, 14, 7, 0.35);
  border-radius: 4px;
}

.cart-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cart-total {
  font-weight: 700;
  color: var(--text-bright);
}

.store-card {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  background: rgba(20, 14, 7, 0.35);
  box-shadow: inset 0 0 0 1px var(--shadow);
}

.store-card-icon {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  background: linear-gradient(135deg, #5b3b22 0%, #2b1a0f 100%);
  border: 1px solid var(--panel-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-bright);
  font-weight: 800;
  font-size: 18px;
}

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

.store-price {
  background: var(--accent-2);
  color: var(--bg);
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.store-qty-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.store-qty-btn {
  min-width: 36px;
  min-height: 36px;
  padding: 6px;
  font-size: 16px;
  border-radius: 6px;
  border: 1px solid var(--panel-border);
  background: var(--button-bg);
  color: var(--text-bright);
  box-shadow: inset 0 0 0 1px var(--shadow);
}

.store-qty-btn:hover {
  background: #5b3f23;
}

.store-qty-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.store-qty {
  min-width: 28px;
  text-align: center;
  font-weight: 700;
  color: var(--text-bright);
}

.store-footer-row {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.store-menu {
  margin: 0;
  padding: 0;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.travel-shell {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.travel-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.panel-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 8px;
}

.nav-footer {
  max-width: min(800px, 95vw);
  margin: 0 auto;
}

.seed-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px;
  margin-top: 8px;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  background: rgba(20, 14, 7, 0.4);
  box-shadow: inset 0 0 0 1px var(--shadow);
}

.seed-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.seed-meta {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.seed-label {
  color: var(--text-bright);
  font-weight: 700;
}

.seed-code {
  padding: 6px 10px;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text-bright);
  letter-spacing: 1px;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px var(--shadow);
}

.store-cart-summary {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.25);
}

.store-cart-summary .value {
  color: var(--text-bright);
  font-weight: 700;
}

header[role="banner"] {
  max-width: min(800px, 95vw);
  margin: 12px auto 0;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px var(--shadow), 4px 4px 0 var(--shadow);
}

.header-left {
  flex: 1;
  display: flex;
  align-items: center;
}

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

.header-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.header-left select {
  appearance: none;
  background: var(--button-bg);
  color: var(--text);
  border: 2px solid var(--button-border);
  padding: 6px 10px;
  font-family: inherit;
  font-size: 11px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--shadow);
  min-width: 120px;
  position: relative;
  line-height: 1;
}

.header-left select:hover {
  background-color: var(--panel);
  color: var(--text-bright);
}

.header-left select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.header-right button {
  padding: 6px 10px;
  font-size: 11px;
  min-width: auto;
}

#save-open-btn::before {
  content: "💾 ";
  color: var(--accent);
}

.hc-toggle::before {
  content: none;
}

.hc-toggle {
  min-width: 72px;
}

/* ASCII Art - Mobile First */
.ascii-art {
  font-family: 'Courier Prime', 'Courier New', monospace;
  color: var(--accent);
  font-size: 10px;
  line-height: 1.1;
  margin: 0;
  text-align: center;
  font-weight: bold;
  white-space: pre;
  overflow-x: auto;
  max-width: 100%;
  display: block;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
}

/* Desktop and larger screens */
@media (min-width: 768px) {
  .header-content {
    gap: 16px;
  }

  .header-left select {
    padding: 6px 12px;
    font-size: 12px;
    min-width: 140px;
  }

  .header-right button {
    padding: 8px 12px;
    font-size: 12px;
  }

  .ascii-art {
    font-size: 14px;
    line-height: 1.2;
  }
}

@media (max-width: 720px) {
  .header-row {
    grid-template-columns: 1fr;
  }

  .conditions-stack {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-content {
    flex-direction: column;
    align-items: stretch;
  }

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

  .persona-layout {
    flex-direction: column;
  }

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

.retro-menu img {
  margin-bottom: 24px;
  /* Oregon Trail green monochrome effect for logo */
  filter:
    brightness(0)
    saturate(100%)
    invert(42%)
    sepia(100%)
    hue-rotate(120deg)
    brightness(1.5)
    contrast(1.2);
}

.mode-selection {
  margin-top: 24px;
}

.mode-selection h3 {
  margin-bottom: 16px;
  color: var(--accent);
}

/* Boot screen */
.boot-screen {
  text-align: center;
  padding: 40px 20px;
}

.boot-screen img {
  margin-bottom: 32px;
}

/* Result screen */
.result-panel {
  text-align: center;
  border-color: var(--accent);
}

.result-title {
  color: var(--accent);
  font-size: 24px;
  margin-bottom: 16px;
}

.result-summary {
  margin-bottom: 24px;
  line-height: 1.6;
}

.seed-display {
  background: var(--bg);
  border: 2px solid var(--panel-border);
  padding: 16px;
  margin: 16px 0;
  font-family: inherit;
  font-weight: bold;
  letter-spacing: 2px;
  text-align: center;
  box-shadow: inset 2px 2px 0 var(--shadow);
}

/* Save drawer specific styling */
.save-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.save-textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
}

/* Result Screen Styles */
.result-screen {
  padding: 24px;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  outline: none;
}

.result-headline {
  color: var(--accent);
  text-align: center;
  margin-bottom: 32px;
  font-size: 16px;
  text-shadow: 2px 2px 0 var(--shadow);
}

.result-info {
  margin-bottom: 32px;
}

.result-metadata {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
  justify-content: center;
}

.metadata-item {
  display: inline-block;
  padding: 8px;
  background: var(--panel);
  border: 2px solid var(--panel-border);
}

.badge {
  background: var(--accent);
  color: var(--bg);
  padding: 2px 6px;
  margin-left: 8px;
  font-size: 10px;
  border-radius: 0;
}

.score-display {
  text-align: center;
  font-size: 14px;
  margin-bottom: 16px;
}

.score-value {
  color: var(--accent);
  font-size: 18px;
  margin-left: 8px;
}

.stats-section {
  margin-bottom: 32px;
}

.stats-section h2 {
  color: var(--accent);
  margin-bottom: 16px;
  text-align: center;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  max-width: 500px;
  margin: 0 auto;
  background: var(--panel);
  border: 2px solid var(--panel-border);
  padding: 16px;
}

.stats-grid dt {
  text-align: right;
  font-weight: normal;
}

.stats-grid dd {
  text-align: left;
  margin: 0;
  color: var(--accent);
}

.epilogue-section {
  text-align: center;
  margin-bottom: 32px;
}

.epilogue {
  background: var(--panel);
  border: 2px solid var(--panel-border);
  padding: 16px;
  margin: 0 auto;
  max-width: 600px;
  font-style: italic;
}

.result-menu {
  max-width: 500px;
  margin: 0 auto;
}

.result-menu ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.menu-item {
  display: block;
  padding: 16px;
  margin-bottom: 8px;
  background: var(--button-bg);
  border: 2px solid var(--button-border);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 44px; /* WCAG 2.2 AA touch target size */
  display: flex;
  align-items: center;
}

.menu-item:hover {
  background: var(--panel);
  color: var(--accent);
}

.menu-item:focus,
.menu-item.focused {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  background: var(--panel);
  color: var(--accent);
}

.menu-item:active {
  transform: translateY(1px);
}

/* Screen reader only content */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* RTL Support */
html[dir="rtl"] .result-metadata {
  direction: rtl;
}

html[dir="rtl"] .stats-grid {
  direction: rtl;
}

html[dir="rtl"] .stats-grid dt {
  text-align: left;
}

html[dir="rtl"] .stats-grid dd {
  text-align: right;
}

html[dir="rtl"] .badge {
  margin-left: 0;
  margin-right: 8px;
}

/* Mobile responsive */
@media (max-width: 600px) {
  .result-metadata {
    flex-direction: column;
    align-items: center;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .stats-grid dt,
  .stats-grid dd {
    text-align: center;
  }

  html[dir="rtl"] .stats-grid dt,
  html[dir="rtl"] .stats-grid dd {
    text-align: center;
  }
}

/* High contrast adjustments */
html.hc .menu-item:focus,
html.hc .menu-item.focused {
  outline: 4px solid var(--accent);
  outline-offset: 3px;
}

html.hc .badge {
  border: 1px solid var(--accent);
}
