/* Crossfire Express — Style Sheet */

:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-tertiary: #1a2332;
  --bg-surface: #1e293b;
  --bg-hover: #2d3a4f;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-glow: rgba(59, 130, 246, 0.3);
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.3);
  --success: #22c55e;
  --warning: #f59e0b;
  --border: #1e293b;
  --border-light: #334155;
  --shadow: rgba(0, 0, 0, 0.4);
  --radius: 8px;
  --radius-lg: 12px;
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg-primary: #f1f5f9;
  --bg-secondary: #ffffff;
  --bg-tertiary: #e2e8f0;
  --bg-surface: #ffffff;
  --bg-hover: #f8fafc;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-glow: rgba(37, 99, 235, 0.2);
  --danger: #dc2626;
  --danger-glow: rgba(220, 38, 38, 0.2);
  --border: #e2e8f0;
  --border-light: #cbd5e1;
  --shadow: rgba(0, 0, 0, 0.1);
  color-scheme: light;
}

@media (prefers-color-scheme: light) {
  html:not([data-theme="dark"]) {
    --bg-primary: #f1f5f9;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e2e8f0;
    --bg-surface: #ffffff;
    --bg-hover: #f8fafc;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-glow: rgba(37, 99, 235, 0.2);
    --danger: #dc2626;
    --danger-glow: rgba(220, 38, 38, 0.2);
    --border: #e2e8f0;
    --border-light: #cbd5e1;
    --shadow: rgba(0, 0, 0, 0.1);
    color-scheme: light;
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

#app {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  max-width: 1200px;
  margin: 0 auto;
}

#top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 10;
}

#title-area { display: flex; align-items: center; gap: 10px; }
#title-icon { font-size: 1.4em; }
#title-area h1 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-primary);
}

#stats-bar { display: flex; align-items: center; gap: 16px; }
.stat { display: flex; align-items: center; gap: 6px; }
.stat-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.stat-track {
  width: 60px;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
}
.stat-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.4s ease, background 0.3s ease;
}
.stat-fill.health-high { background: var(--success); }
.stat-fill.health-med { background: var(--warning); }
.stat-fill.health-low { background: var(--danger); }
.stat-val {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 20px;
  text-align: right;
}

#main-layout { display: flex; flex: 1; overflow: hidden; }

#inventory-panel {
  width: 200px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: 16px;
  overflow-y: auto;
  flex-shrink: 0;
}

.panel-title {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

#inventory-list, #allies-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.inv-item {
  font-size: 0.78rem;
  color: var(--text-secondary);
  padding: 4px 0;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s;
}
.inv-item:hover { color: var(--text-primary); }
.empty-state {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
}

.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 6px;
  margin-top: 8px;
}
.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--accent);
}

#story-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
  scroll-behavior: smooth;
}
#story-area::-webkit-scrollbar { width: 6px; }
#story-area::-webkit-scrollbar-track { background: transparent; }
#story-area::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }

#scene-image {
  width: 100%;
  height: 180px;
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  transition: background 0.5s ease;
}

.location-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-glow);
  border: 1px solid var(--accent);
  border-radius: 20px;
  padding: 4px 14px;
  margin-bottom: 16px;
  letter-spacing: 0.04em;
}

#scene-location { margin-bottom: 8px; }
#scene-text { margin-bottom: 24px; }
#scene-text p {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text-primary);
  margin-bottom: 14px;
}
#scene-text strong { color: var(--accent); font-weight: 600; }
#scene-text em { color: var(--text-secondary); font-style: italic; }

#scene-choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.choice-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 14px 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.92rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1.4;
}
.choice-btn:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  transform: translateX(4px);
  box-shadow: 0 0 20px var(--accent-glow);
}
.choice-btn:active { transform: translateX(4px) scale(0.98); }
.choice-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}
.overlay[hidden] { display: none !important; }

.overlay-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px var(--shadow);
  animation: slideUp 0.25s ease;
}

.overlay-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.overlay-header span {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.btn-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.btn-close:hover {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}

.mission-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.mission-item:last-child { border-bottom: none; }
.mission-icon { font-size: 1.2rem; width: 32px; text-align: center; }
.mission-name { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); }
.mission-status { font-size: 0.7rem; color: var(--text-muted); }

.journal-entry {
  padding: 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius);
  margin-bottom: 8px;
  border-left: 3px solid var(--accent);
}
.journal-time { font-size: 0.65rem; color: var(--text-muted); margin-bottom: 4px; }
.journal-location { font-size: 0.75rem; font-weight: 600; color: var(--accent); margin-bottom: 4px; }
.journal-choice { font-size: 0.82rem; color: var(--text-secondary); font-style: italic; }

.death-content { text-align: center; }
.death-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--danger);
  margin-bottom: 8px;
}
.death-subtitle { font-size: 0.9rem; color: var(--text-muted); }

.btn-primary {
  margin-top: 20px;
  padding: 12px 32px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 20px var(--accent-glow);
}
.btn-primary:active { transform: scale(0.96); }

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

@media (max-width: 768px) {
  #inventory-panel { display: none; }
  #story-area { padding: 16px 16px 24px; }
  #scene-image { height: 120px; }
  #top-bar { padding: 10px 14px; }
  #title-area h1 { font-size: 0.95rem; }
  .stat-track { width: 40px; }
  .choice-btn { padding: 12px 14px; font-size: 0.88rem; }
  .overlay-content { width: 95%; padding: 18px; }
}

@media (max-width: 480px) {
  #stats-bar { gap: 10px; }
  .stat-label { font-size: 0.6rem; }
  .stat-track { width: 30px; }
  #title-area h1 { font-size: 0.85rem; }
  #scene-text p { font-size: 0.92rem; line-height: 1.65; }
}

#scene-image[data-bg="night-city"] { background: linear-gradient(180deg, #0c1445 0%, #1a1a3e 40%, #2d1b4e 100%); }
#scene-image[data-bg="market"] { background: linear-gradient(180deg, #c2410c 0%, #92400e 40%, #78350f 100%); }
#scene-image[data-bg="alley"] { background: linear-gradient(180deg, #1c1917 0%, #292524 50%, #1c1917 100%); }
#scene-image[data-bg="cafe"] { background: linear-gradient(180deg, #713f12 0%, #854d0e 40%, #422006 100%); }
#scene-image[data-bg="airport"] { background: linear-gradient(180deg, #1e293b 0%, #334155 50%, #1e293b 100%); }
#scene-image[data-bg="building"] { background: linear-gradient(180deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%); }
#scene-image[data-bg="server"] { background: linear-gradient(180deg, #020617 0%, #064e3b 50%, #020617 100%); }
#scene-image[data-bg="corridor"] { background: linear-gradient(180deg, #1a0000 0%, #450a0a 50%, #1a0000 100%); }
#scene-image[data-bg="tunnel"] { background: linear-gradient(180deg, #0c0a09 0%, #27272a 50%, #0c0a09 100%); }
#scene-image[data-bg="river"] { background: linear-gradient(180deg, #0c4a6e 0%, #0e7490 50%, #164e63 100%); }
#scene-image[data-bg="road"] { background: linear-gradient(180deg, #1e1b4b 0%, #312e81 50%, #1e1b4b 100%); }
#scene-image[data-bg="elevator"] { background: linear-gradient(180deg, #3f3f46 0%, #52525b 50%, #27272a 100%); }
#scene-image[data-bg="phone"] { background: linear-gradient(180deg, #14532d 0%, #166534 50%, #052e16 100%); }
#scene-image[data-bg="fight"] { background: linear-gradient(180deg, #450a0a 0%, #7f1d1d 50%, #450a0a 100%); }
#scene-image[data-bg="street"] { background: linear-gradient(180deg, #1e1b4b 0%, #3730a3 50%, #1e1b4b 100%); }
