/* BoingBoing — high-contrast outdoor dark theme (mobile-first) */
:root {
  --bg: #0b0e13;
  --bg2: #12171f;
  --card: #181f2a;
  --card2: #1f2836;
  --text: #e8edf4;
  --muted: #93a1b4;
  --accent: #4ade80;
  --accent2: #38bdf8;
  --warn: #fbbf24;
  --danger: #f87171;
  --radius: 14px;
  --tap: 48px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 0.85rem; }

/* Top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top));
  background: var(--bg2);
  border-bottom: 1px solid #222c3a;
  position: sticky; top: 0; z-index: 20;
}
.brand { font-weight: 800; letter-spacing: 0.02em; }
.phase-badge {
  font-size: 0.65rem; background: var(--accent2); color: #04121f;
  border-radius: 6px; padding: 2px 6px; margin-left: 6px; vertical-align: middle;
  font-weight: 700;
}
.topbar-actions { display: flex; gap: 8px; }

.icon-btn, .send-btn {
  min-width: var(--tap); min-height: var(--tap);
  border: none; border-radius: 10px; background: var(--card2);
  color: var(--text); font-size: 1.15rem; cursor: pointer;
}
.icon-btn:active, .send-btn:active { transform: scale(0.95); }
.send-btn { background: var(--accent); color: #04150b; font-weight: 800; }

/* Snapshot card */
.card {
  background: var(--card); border-radius: var(--radius);
  padding: 14px; margin: 12px 12px 4px;
}
.snapshot-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.snapshot-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.snap-col { background: var(--bg2); border-radius: 10px; padding: 10px; }
.snap-role { font-size: 0.7rem; font-weight: 800; color: var(--accent2); letter-spacing: 0.08em; }
.snap-detail { font-size: 0.8rem; margin-top: 4px; line-height: 1.4; }

/* Chat */
.chat {
  flex: 1; overflow-y: auto; padding: 12px;
  display: flex; flex-direction: column; gap: 10px;
  padding-bottom: 140px;
}
.msg { max-width: 92%; border-radius: var(--radius); padding: 10px 12px; font-size: 0.95rem; line-height: 1.45; }
.msg-user { align-self: flex-end; background: var(--accent2); color: #04121f; font-weight: 500; }
.msg-bot { align-self: flex-start; background: var(--card); }

/* Action cards */
.action-card {
  background: var(--card2); border: 1px solid #2b3648;
  border-radius: 12px; padding: 12px; margin-top: 8px;
}
.card-title { font-weight: 800; font-size: 0.95rem; }
.card-instr { margin-top: 6px; font-size: 0.9rem; background: #0f1420; border-radius: 8px; padding: 8px; font-family: ui-monospace, monospace; }
.card-why { margin-top: 6px; font-size: 0.85rem; color: var(--muted); }
.card-src { margin-top: 6px; font-size: 0.75rem; color: var(--accent2); }
.card-src a { color: var(--accent2); }
.hazardbox {
  margin-top: 8px; background: #2a1d05; border: 1px solid var(--warn);
  border-radius: 8px; padding: 8px; font-size: 0.8rem; color: #ffd98a;
}
.warnbox {
  margin-top: 8px; background: #2a100f; border: 1px solid var(--danger);
  border-radius: 8px; padding: 8px; font-size: 0.8rem; color: #ffb3b3;
}
.apply-btn {
  margin-top: 10px; width: 100%; min-height: var(--tap);
  background: var(--accent); color: #04150b; border: none; border-radius: 10px;
  font-weight: 800; font-size: 0.95rem; cursor: pointer;
}

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip {
  background: var(--bg2); color: var(--text); border: 1px solid #2b3648;
  border-radius: 20px; padding: 10px 14px; font-size: 0.85rem; cursor: pointer;
}

/* Input bar */
.inputbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--bg2); border-top: 1px solid #222c3a;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  z-index: 20;
}
.input-row { display: flex; gap: 8px; align-items: center; }
#txtInput {
  flex: 1; min-height: var(--tap); background: var(--card); color: var(--text);
  border: 1px solid #2b3648; border-radius: 10px; padding: 0 14px; font-size: 1rem;
}
#txtInput:focus { outline: 2px solid var(--accent2); }
.quick-chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; }

/* Drawers */
.drawer {
  position: fixed; inset: 0; background: var(--bg);
  z-index: 30; overflow-y: auto; padding: 16px;
  padding-top: calc(16px + env(safe-area-inset-top));
}
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.form { display: flex; flex-direction: column; gap: 10px; }
.form label { font-size: 0.85rem; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.form input {
  min-height: 44px; background: var(--card); color: var(--text);
  border: 1px solid #2b3648; border-radius: 10px; padding: 0 12px; font-size: 1rem;
}
.primary-btn {
  min-height: var(--tap); background: var(--accent); color: #04150b;
  border: none; border-radius: 10px; font-weight: 800; font-size: 1rem; cursor: pointer;
}
.form-msg { font-size: 0.85rem; }
.form-msg.ok { color: var(--accent); }
.garage-list { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }

/* Toast */
.toast {
  position: fixed; bottom: 110px; left: 50%; transform: translateX(-50%);
  background: #1f2836; border: 1px solid #2b3648; color: var(--text);
  padding: 10px 16px; border-radius: 10px; font-size: 0.85rem; z-index: 40;
  max-width: 90vw; text-align: center;
}

@media (min-width: 768px) {
  .chat, .card { max-width: 720px; margin-left: auto; margin-right: auto; }
  .inputbar { left: 50%; transform: translateX(-50%); width: 720px; border-radius: 14px 14px 0 0; }
}
