/* game.css — Architekt light theme (Excalidraw/Miro style) */

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

:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --surface2: #f5f5f5;
  --border: #e0e0e0;
  --border-strong: #bdbdbd;
  --text: #1a1a1a;
  --text-dim: #757575;
  --accent: #1976d2;
  --success: #2e7d32;
  --warning: #e65100;
  --danger: #c62828;
  --positive: #2e7d32;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* === Canvas === */

#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* === HUD === */

#hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 44px;
  background: rgba(255,255,255,0.92);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 16px;
  z-index: 100;
  user-select: none;
  flex-wrap: nowrap;
  overflow-x: auto;
}

.hud-item {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.hud-icon { font-size: 14px; }
.hud-value { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--text); }
.hud-sub { font-size: 10px; color: var(--text-dim); }
.hud-danger { color: var(--danger) !important; }
.hud-warning { color: var(--warning) !important; }
.hud-positive { color: var(--positive) !important; }

.hud-speed { margin-left: auto; display: flex; gap: 2px; flex-shrink: 0; }

.speed-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 4px 6px;
  font-size: 10px;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.15s;
}
.speed-btn:hover { background: var(--surface2); color: var(--text); }
.speed-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* === Panels === */

#config-panel, #edge-panel, #monitoring-panel {
  position: absolute;
  top: 50px; right: 8px;
  width: 300px;
  max-height: calc(100vh - 60px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  z-index: 200;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

#monitoring-panel {
  width: 680px;
  right: 8px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}

.panel-title { font-weight: 600; font-size: 13px; color: var(--text); }

.panel-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}
.panel-close:hover { background: rgba(0,0,0,0.06); color: var(--text); }

.panel-body {
  overflow-y: auto;
  padding: 10px 14px;
  flex: 1;
}

/* Config sections */

.config-section {
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.config-section:last-child { border-bottom: none; margin-bottom: 0; }

.config-section-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.config-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.config-label { font-size: 12px; color: var(--text-dim); }

.config-input, .config-select {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 8px;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 12px;
  width: 120px;
  text-align: right;
}
.config-input:focus, .config-select:focus {
  outline: none;
  border-color: var(--accent);
}

.config-check { accent-color: var(--accent); }

.config-cost {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-align: right;
  margin-top: 8px;
}

.config-metric {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 4px;
  color: var(--text-dim);
}
.config-metric span:last-child { font-family: var(--mono); color: var(--text); }

.config-metric-locked {
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
  padding: 12px 0;
  font-style: italic;
}

.config-metric-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 12px;
}

.metric-bar-track {
  flex: 1;
  height: 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.metric-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s;
}
.metric-bar-value {
  font-family: var(--mono);
  font-size: 11px;
  min-width: 40px;
  text-align: right;
  color: var(--text);
}

.config-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

/* === Buttons === */

.btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s;
}
.btn:hover { background: rgba(25,118,210,0.06); border-color: var(--accent); }
.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: rgba(198,40,40,0.06); }
.btn-sm { padding: 3px 10px; font-size: 11px; }

/* === Palette === */

#palette {
  position: absolute;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  min-width: 220px;
  z-index: 300;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.10);
}

.palette-header {
  padding: 8px 14px;
  font-weight: 600;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
}

.palette-list { padding: 4px 0; max-height: 400px; overflow-y: auto; }

.palette-category {
  padding: 4px 14px;
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 0.5px;
  margin-top: 4px;
}

.palette-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  cursor: pointer;
  transition: background 0.1s;
}
.palette-item:hover { background: rgba(25,118,210,0.06); }
.palette-item.locked { opacity: 0.35; cursor: not-allowed; }
.palette-item.locked:hover { background: none; }

.palette-icon { font-size: 14px; width: 24px; text-align: center; }
.palette-name { flex: 1; font-size: 13px; color: var(--text); }
.palette-cost { font-family: var(--mono); font-size: 11px; color: var(--text-dim); }

/* === Feature Banner === */

#feature-banner {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  z-index: 150;
}

.feature-demand {
  background: rgba(255,255,255,0.96);
  border-top: 1px solid var(--border);
  padding: 14px 20px;
}

.feature-demand-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.feature-demand-icon { font-size: 16px; }
.feature-demand-title { font-weight: 700; font-size: 14px; color: var(--accent); flex: 1; }
.feature-demand-deadline { font-family: var(--mono); font-size: 13px; color: var(--warning); }

.feature-demand-desc { font-style: italic; color: var(--text-dim); margin-bottom: 8px; font-size: 13px; }

.feature-demand-criteria { margin-bottom: 8px; }
.feature-criterion { font-size: 12px; color: var(--text); margin: 2px 0; padding-left: 4px; }

.feature-demand-footer {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--text-dim);
  margin-bottom: 8px;
}

/* === Monitoring Table === */

.monitoring-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.monitoring-table th {
  text-align: left;
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.5px;
}
.monitoring-table td {
  padding: 5px 8px;
  font-family: var(--mono);
  font-size: 11px;
  border-bottom: 1px solid var(--border);
}
.monitoring-row:hover { background: rgba(25,118,210,0.04); }
.row-error { background: rgba(198,40,40,0.05); }
.row-warning { background: rgba(230,81,0,0.04); }

/* === Incident Bar === */

#incident-bar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  z-index: 160;
}
.incident-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  font-size: 12px;
  border-top: 1px solid var(--border);
}
.incident-moderate { background: rgba(230,81,0,0.06); }
.incident-critical { background: rgba(198,40,40,0.08); }

/* === Notifications === */

#notifications {
  position: absolute;
  top: 52px; right: 8px;
  width: 280px;
  z-index: 250;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}

.notification {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12px;
  opacity: 0;
  transform: translateX(20px);
  transition: all 0.3s;
  pointer-events: auto;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.notification-show { opacity: 1; transform: translateX(0); }
.notification-info { border-left: 3px solid var(--accent); }
.notification-success { border-left: 3px solid var(--success); }
.notification-warning { border-left: 3px solid var(--warning); }
.notification-error { border-left: 3px solid var(--danger); }

/* === Scrollbar === */

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* === Mobile === */

@media (max-width: 768px) {
  #hud {
    height: 38px;
    gap: 8px;
    padding: 0 8px;
    font-size: 11px;
  }
  .hud-value { font-size: 11px; }
  .hud-sub { font-size: 9px; }
  .speed-btn { padding: 3px 5px; font-size: 9px; }

  #config-panel, #edge-panel {
    position: fixed;
    top: auto; right: 0; bottom: 0; left: 0;
    width: 100%;
    max-height: 55vh;
    border-radius: 16px 16px 0 0;
    border-bottom: none;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.12);
  }

  #monitoring-panel {
    position: fixed;
    top: auto; right: 0; bottom: 0; left: 0;
    width: 100%;
    max-height: 70vh;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.12);
  }

  #palette {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    top: auto !important;
    width: 100% !important;
    min-width: unset;
    max-height: 50vh;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.12);
  }

  .palette-list { max-height: 45vh; }

  #notifications {
    width: 220px;
    right: 4px;
    top: 42px;
  }
}

/* === FAB (Floating Action Button) === */

.palette-fab {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  z-index: 300;
  box-shadow: 0 2px 12px rgba(0,0,0,0.18);
  transition: transform 0.15s, box-shadow 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.palette-fab:hover { transform: scale(1.1); box-shadow: 0 4px 16px rgba(0,0,0,0.24); }
.palette-fab:active { transform: scale(0.95); }
.palette-fab.panel-open {
  transition: bottom 0.3s ease;
}

/* Palette header with close button */
.palette-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.palette-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}
.palette-close:hover { background: rgba(0,0,0,0.06); color: var(--text); }

/* === Satisfaction Popup === */

.sat-popup {
  position: fixed;
  z-index: 400;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  min-width: 220px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  font-size: 12px;
}
.sat-popup-title {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 4px;
  color: var(--text);
}
.sat-popup-bracket {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 8px;
  font-style: italic;
}
.sat-popup-breakdown {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sat-row {
  font-family: var(--mono);
  font-size: 11px;
}
.sat-good { color: var(--success); }
.sat-bad { color: var(--danger); }

@media (max-width: 768px) {
  .palette-fab { bottom: 16px; left: 16px; width: 44px; height: 44px; font-size: 24px; transition: bottom 0.3s ease; }
  .palette-fab.panel-open { bottom: calc(55vh + 8px); }
}

/* === Hamburger Menu === */

.hud-menu-area {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.hamburger-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 16px;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.hamburger-btn:hover { background: var(--surface2); }

.feature-badge {
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  transition: transform 0.15s;
}
.feature-badge:hover { transform: scale(1.08); }

/* === Menu Overlay === */

.menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.2);
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.menu-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* === Slide-out Menu === */

.slide-menu {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 300px;
  max-width: 85vw;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 510;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 20px rgba(0,0,0,0.08);
}
.slide-menu.open {
  transform: translateX(0);
}

.slide-menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}
.slide-menu-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
}

.slide-menu-items {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.slide-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.1s;
  font-family: var(--font);
}
.slide-menu-item:hover { background: rgba(25,118,210,0.06); }
.slide-menu-danger { color: var(--danger); }
.slide-menu-danger:hover { background: rgba(198,40,40,0.06); }

/* === Menu Panel Content === */

.slide-menu-panel {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
}

.menu-panel-title {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 12px;
  color: var(--text);
}

/* Feature list */

.feature-list-item {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
}
.feature-list-item.feature-locked {
  opacity: 0.5;
}
.feature-list-item.feature-highlight {
  border-color: var(--accent);
  background: rgba(25,118,210,0.04);
}

.feature-list-name {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 2px;
}
.feature-list-status {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.feature-active .feature-list-status { color: var(--success); }
.feature-pending .feature-list-status { color: var(--warning); }

.feature-criteria-list {
  margin: 4px 0 0 16px;
  padding: 0;
  font-size: 11px;
  color: var(--text-dim);
}
.feature-criteria-list li { margin-bottom: 2px; }

.feature-unlock-cond {
  font-size: 11px;
  color: var(--text-dim);
  font-style: italic;
}

/* Economy panel */

.econ-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
.econ-row span:last-child { font-family: var(--mono); font-weight: 600; }

.econ-next-title {
  font-weight: 700;
  font-size: 12px;
  margin-top: 12px;
  margin-bottom: 6px;
  color: var(--accent);
}

/* === Feature Checklist === */
.feature-checklist {
  margin: 6px 0 0 0;
}
.feature-check-item {
  font-size: 12px;
  margin: 3px 0;
  display: flex;
  align-items: flex-start;
  gap: 4px;
}
