:root {
  --bg-primary: #0a0d13;
  --bg-card: #111621;
  --bg-card-hover: #161d2b;
  --border: rgba(255,255,255,0.07);
  --border-highlight: rgba(255,255,255,0.15);
  --amber: #f6a623;
  --amber-dim: #a67416;
  --green: #3ecf8e;
  --green-dim: #1a7a4e;
  --red: #ef4444;
  --red-dim: #991b1b;
  --blue: #60a5fa;
  --blue-dim: #1e4a8a;
  --brown: #a0845c;
  --yellow: #facc15;
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
  margin: 0; padding: 0;
}

body {
  font-family: 'IBM Plex Sans', sans-serif;
  background: var(--bg-primary);
  height: 100vh;
  overflow: hidden;
}

.font-mono { font-family: 'JetBrains Mono', monospace; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color 0.2s;
}

.progress-bar {
  height: 14px;
  border-radius: 3px;
  background: rgba(255,255,255,0.05);
  overflow: hidden;
  position: relative;
}
.progress-bar .fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease, background-color 0.3s;
}
.progress-bar .label {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  color: white;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

@keyframes pulse-warning {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.pulse-warn { animation: pulse-warning 1s infinite; }

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

.action-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  cursor: pointer;
  transition: all 0.15s;
  color: #e2e8f0;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 12px;
  text-align: left;
}
.action-btn:hover:not(:disabled) {
  border-color: var(--amber);
  background: var(--bg-card-hover);
}
.action-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.log-entry {
  padding: 2px 6px;
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  border-left: 2px solid transparent;
  line-height: 1.5;
}
.log-entry.positive { border-left-color: var(--green); color: #86efac; }
.log-entry.warning { border-left-color: var(--yellow); color: #fde68a; }
.log-entry.danger { border-left-color: var(--red); color: #fca5a5; }
.log-entry.neutral { border-left-color: rgba(255,255,255,0.2); color: #94a3b8; }

.game-over-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.sub-menu {
  background: #0f1520;
  border: 1px solid var(--border-highlight);
  border-radius: 8px;
  padding: 10px;
}

.interact-prompt {
  position: absolute;
  background: rgba(17, 22, 33, 0.95);
  border: 1px solid var(--amber);
  border-radius: 8px;
  padding: 12px;
  min-width: 220px;
  z-index: 50;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5);
}

.dpad-btn {
  width: 44px; height: 44px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: #94a3b8;
  font-size: 18px;
  transition: all 0.1s;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
.dpad-btn:active {
  background: rgba(246,166,35,0.2);
  border-color: var(--amber);
  color: var(--amber);
  transform: scale(0.92);
}

.cycle-node {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  border: 1px solid;
}
.cycle-node.active { border-color: var(--green); color: var(--green); background: rgba(62,207,142,0.08); }
.cycle-node.broken { border-color: var(--red); color: var(--red); background: rgba(239,68,68,0.08); }
.cycle-arrow { color: rgba(255,255,255,0.2); font-size: 12px; margin: 0 2px; }

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

canvas#game-canvas {
  image-rendering: pixelated;
  border-radius: 8px;
  border: 1px solid var(--border);
}