/* The Oregon Trail (1847 / 1978 MECC) - Mobile & Touch-First Stylesheet */

:root {
  --bg-color: #0b120c;
  --surface-color: #121c13;
  --surface-border: #1e3321;
  --text-main: #3aff3a;
  --text-dim: #26b326;
  --text-bright: #6eff6e;
  --accent: #2bff90;
  --accent-glow: rgba(58, 255, 58, 0.4);
  --danger: #ff4d4d;
  --danger-glow: rgba(255, 77, 77, 0.4);
  --warning: #ffcc00;
  --font-mono: "Courier New", Courier, "Lucida Console", Monaco, monospace;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --touch-target: 48px;
}

/* Theme: Amber */
body.theme-amber {
  --bg-color: #120e06;
  --surface-color: #1d1609;
  --surface-border: #382c12;
  --text-main: #ffb733;
  --text-dim: #b88220;
  --text-bright: #ffd480;
  --accent: #ff9900;
  --accent-glow: rgba(255, 183, 51, 0.4);
}

/* Theme: Paper Teletype */
body.theme-paper {
  --bg-color: #f5f0e1;
  --surface-color: #ede6d1;
  --surface-border: #cbbe9f;
  --text-main: #2a2216;
  --text-dim: #63533c;
  --text-bright: #140f08;
  --accent: #8b5a2b;
  --accent-glow: rgba(139, 90, 43, 0.2);
}

/* Theme: Classic Dark */
body.theme-classic {
  --bg-color: #0d1117;
  --surface-color: #161b22;
  --surface-border: #30363d;
  --text-main: #e6edf3;
  --text-dim: #8b949e;
  --text-bright: #58a6ff;
  --accent: #3fb950;
  --accent-glow: rgba(63, 185, 80, 0.4);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  font-family: var(--font-mono);
  background-color: var(--bg-color);
  color: var(--text-main);
  overflow-x: hidden;
  line-height: 1.4;
  font-size: 14px;
}

/* CRT Scanlines Overlay */
#crt-overlay {
  display: none;
  pointer-events: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%),
              linear-gradient(90deg, rgba(255, 0, 0, 0.03), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.03));
  background-size: 100% 3px, 6px 100%;
  z-index: 9999;
}

body.scanlines-on #crt-overlay {
  display: block;
}

/* Header */
.app-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--surface-color);
  border-bottom: 2px solid var(--surface-border);
}

.header-titles .game-title {
  font-size: 1.25rem;
  letter-spacing: 1.5px;
  color: var(--text-bright);
  text-shadow: 0 0 8px var(--accent-glow);
}

.header-titles .game-subtitle {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.header-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.btn-ctrl {
  background: transparent;
  color: var(--text-main);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: bold;
  cursor: pointer;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-ctrl:hover, .btn-ctrl:active {
  background: var(--surface-border);
  color: var(--text-bright);
  border-color: var(--text-main);
}

.btn-danger {
  color: var(--danger);
  border-color: rgba(255, 77, 77, 0.3);
}
.btn-danger:hover {
  background: rgba(255, 77, 77, 0.15);
  border-color: var(--danger);
}

/* Main Container */
.game-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Trail Progress Card */
.trail-progress-card {
  background: var(--surface-color);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  margin-bottom: 8px;
  font-weight: bold;
}

.landmark-name {
  color: var(--text-bright);
}

.miles-summary {
  color: var(--text-dim);
}

.landmark-next {
  color: var(--accent);
}

.progress-bar-track {
  position: relative;
  height: 16px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  overflow: visible;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--text-dim), var(--text-main));
  border-radius: 8px;
  transition: width 0.4s ease;
  box-shadow: 0 0 10px var(--accent-glow);
}

.wagon-marker {
  position: absolute;
  top: -8px;
  transform: translateX(-50%);
  transition: left 0.4s ease;
  font-size: 1.2rem;
  user-select: none;
  filter: drop-shadow(0 0 4px var(--text-bright));
}

/* Wagon Dashboard */
.wagon-dashboard {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

@media (max-width: 600px) {
  .wagon-dashboard {
    grid-template-columns: repeat(2, 1fr);
  }
}

.dash-tile {
  background: var(--surface-color);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  padding: 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.tile-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.tile-val {
  font-size: 1rem;
  font-weight: bold;
  color: var(--text-bright);
}

.status-healthy { color: var(--accent); }
.status-warning { color: var(--warning); }
.status-danger { color: var(--danger); text-shadow: 0 0 6px var(--danger-glow); }

/* Terminal Card */
.terminal-card {
  background: var(--surface-color);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.terminal-bar {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid var(--surface-border);
  gap: 6px;
}

.terminal-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.terminal-dot.red { background: #ff5f56; }
.terminal-dot.yellow { background: #ffbd2e; }
.terminal-dot.green { background: #27c93f; }

.terminal-title {
  font-size: 0.75rem;
  color: var(--text-dim);
  flex: 1;
  margin-left: 6px;
  font-weight: bold;
}

.terminal-btn {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  padding: 2px 6px;
  cursor: pointer;
}

.terminal-content {
  height: 220px;
  overflow-y: auto;
  padding: 12px;
  font-size: 0.95rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.terminal-line {
  margin-bottom: 3px;
  animation: fadeIn 0.1s ease;
}

.terminal-line.highlight {
  color: var(--text-bright);
  font-weight: bold;
}

.terminal-line.danger {
  color: var(--danger);
  font-weight: bold;
}

.terminal-line.success {
  color: var(--accent);
  font-weight: bold;
}

/* Interactive Controls Panel */
.interactive-panel {
  background: var(--surface-color);
  border: 2px solid var(--text-dim);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: 0 0 12px var(--accent-glow);
}

.prompt-header {
  margin-bottom: 12px;
}

.prompt-text {
  font-size: 1.1rem;
  color: var(--text-bright);
  margin-bottom: 4px;
}

.prompt-details {
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* Control Buttons & Inputs */
.controls-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.touch-btn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

@media (max-width: 480px) {
  .touch-btn-grid {
    grid-template-columns: 1fr;
  }
}

.btn-action {
  min-height: var(--touch-target);
  background: rgba(0, 0, 0, 0.4);
  color: var(--text-bright);
  border: 2px solid var(--text-dim);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: bold;
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-action:hover, .btn-action:active {
  background: var(--text-dim);
  color: var(--bg-color);
  border-color: var(--text-bright);
  box-shadow: 0 0 10px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-primary {
  border-color: var(--text-bright);
  background: rgba(58, 255, 58, 0.1);
}

/* Store / Budget Interface */
.store-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.store-budget-bar {
  display: flex;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.4);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--surface-border);
  font-weight: bold;
}

.store-row {
  display: grid;
  grid-template-columns: 150px 1fr auto;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.2);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--surface-border);
}

@media (max-width: 640px) {
  .store-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

.store-label {
  font-weight: bold;
  color: var(--text-bright);
}

.store-steppers {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-step {
  min-width: 44px;
  min-height: 40px;
  background: transparent;
  color: var(--text-main);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-weight: bold;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-step:hover, .btn-step:active {
  background: var(--surface-border);
  color: var(--text-bright);
}

.store-input {
  width: 90px;
  min-height: 40px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  color: var(--text-bright);
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: bold;
  text-align: center;
}

.store-input:focus {
  outline: none;
  border-color: var(--text-bright);
}

/* Shooting / Hunting Arena */
.shooting-arena {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 10px;
  gap: 16px;
  text-align: center;
}

.shooting-timer {
  font-size: 1.4rem;
  color: var(--warning);
  font-weight: bold;
  letter-spacing: 1px;
}

.btn-shoot-target {
  min-width: 240px;
  min-height: 72px;
  background: var(--danger);
  color: #fff;
  border: 3px solid #ff9999;
  border-radius: var(--radius-lg);
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: 2px;
  cursor: pointer;
  animation: pulseTarget 0.8s infinite alternate;
  box-shadow: 0 0 20px var(--danger-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.btn-shoot-target:active {
  transform: scale(0.95);
  background: #cc0000;
}

@keyframes pulseTarget {
  0% { box-shadow: 0 0 10px var(--danger-glow); filter: brightness(1); }
  100% { box-shadow: 0 0 35px var(--danger-glow), 0 0 15px #ff5555; filter: brightness(1.15); }
}

.shooting-keyboard-opt {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 320px;
}

.input-shoot {
  flex: 1;
  min-height: 44px;
  background: rgba(0, 0, 0, 0.6);
  border: 2px solid var(--text-dim);
  border-radius: var(--radius-sm);
  color: var(--text-bright);
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: bold;
  text-align: center;
  text-transform: uppercase;
}

/* Footer */
.app-footer {
  max-width: 960px;
  margin: 0 auto;
  padding: 8px 16px 24px;
  color: var(--text-dim);
  font-size: 0.75rem;
}

.tip-badge {
  background: var(--surface-border);
  color: var(--text-bright);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-weight: bold;
  margin-right: 6px;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(2px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Landmark Modal */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 999;
}

.modal-dialog {
  background: var(--surface-color);
  border: 2px solid var(--text-bright);
  border-radius: var(--radius-md);
  max-width: 600px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 20px var(--accent-glow);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--surface-border);
}

.modal-title {
  color: var(--text-bright);
  font-size: 1.1rem;
}

.modal-close-btn {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-weight: bold;
}

.modal-close-btn:hover {
  background: var(--surface-border);
  color: var(--text-bright);
}

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

.landmark-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
}

.landmark-item.passed {
  border-color: var(--text-dim);
  opacity: 0.75;
}

.landmark-item.current {
  border-color: var(--text-bright);
  background: rgba(58, 255, 58, 0.1);
}

.landmark-badge {
  font-weight: bold;
  color: var(--text-bright);
  min-width: 70px;
}

.landmark-info {
  flex: 1;
}

.landmark-header {
  font-weight: bold;
  color: var(--text-bright);
  margin-bottom: 2px;
}

.landmark-desc {
  font-size: 0.8rem;
  color: var(--text-dim);
}

