/* ═══════════════════════════════════════════════════════════════
   Hearthline — styles
   Warm Sims-style palette, rounded panels, playful but clean.
   ═══════════════════════════════════════════════════════════════ */
:root {
  --bg: #1a1826;
  --panel: #2b2740;
  --panel-2: #332e4d;
  --line: #4a4368;
  --ink: #efe9ff;
  --ink-dim: #a89fc8;
  --accent: #ffb347;      /* warm amber */
  --accent-2: #7ee0a3;    /* sims green */
  --danger: #ff5d6c;
  --gold: #ffd166;
  --font: "Avenir Next", "Segoe UI", system-ui, sans-serif;
}

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

html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
}

/* ═══ App layout ═══ */
.app {
  display: flex;
  height: 100vh;
  width: 100vw;
}

.stage {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: radial-gradient(1200px 700px at 30% 20%, #241f38 0%, var(--bg) 70%);
}

.sidebar {
  flex: 0 0 400px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
  background: #14121d;
  border-left: 1px solid var(--line);
  overflow-y: auto;
  min-height: 0;
}

/* ═══ Stage top bar ═══ */
.stage-topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #221d33 0%, #1d1930 100%);
}

.brand { display: flex; align-items: baseline; gap: 8px; }
.brand-mark { color: var(--danger); font-size: 20px; }
.brand-name {
  font-size: 20px; font-weight: 800; letter-spacing: 0.5px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand-tag { color: var(--ink-dim); font-size: 12px; }

.clock-wrap { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.sim-clock { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sim-date { color: var(--ink-dim); font-size: 12px; }

.speed-row { display: flex; align-items: center; gap: 6px; }
.speed-label { color: var(--ink-dim); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; }
.speed-btns { display: flex; gap: 3px; }
.speed-btns .btn { padding: 3px 8px; font-size: 11px; }

.status-chips { display: flex; gap: 6px; }
.chip {
  font-size: 11px; font-weight: 700; padding: 3px 9px;
  border-radius: 999px; background: var(--panel-2);
  border: 1px solid var(--line); color: var(--ink);
}
.chip-live { color: #0c2; background: #123a22; border-color: #1d5c37; }
.chip-alerts { color: #fff; background: var(--danger); border-color: var(--danger); }

/* ═══ Stage body / canvas ═══ */
.stage-body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
}
#worldCanvas { position: absolute; inset: 0; width: 100%; height: 100%; }

.toast {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  background: rgba(20,18,29,0.92); border: 1px solid var(--line);
  border-radius: 12px; padding: 8px 16px; font-size: 13px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.4); z-index: 30;
  animation: toast-in 0.25s ease-out;
}
.toast.toast-alert { border-color: var(--danger); color: #ffb3ba; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }

.hud-plumbob { position: absolute; z-index: 20; pointer-events: none; }
.thought-bubble {
  position: absolute; z-index: 25; pointer-events: none;
  background: #fffdf4; color: #333; font-size: 12px; font-weight: 600;
  padding: 5px 10px; border-radius: 12px; box-shadow: 0 4px 14px rgba(0,0,0,0.35);
  max-width: 180px; animation: bob 1.6s ease-in-out infinite;
}
.thought-bubble::after {
  content: ""; position: absolute; bottom: -6px; left: 20px;
  border-left: 7px solid transparent; border-right: 7px solid transparent;
  border-top: 7px solid #fffdf4;
}
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

.cam-overlay {
  position: absolute; z-index: 40; right: 14px; top: 14px;
  background: rgba(10,10,16,0.88); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px; width: 240px; pointer-events: none;
}
.cam-overlay img { width: 100%; border-radius: 6px; display: block; }
.cam-overlay .cam-meta { display: flex; justify-content: space-between; margin-top: 6px; font-size: 11px; color: var(--ink-dim); }

/* ═══ Stage bottom ═══ */
.stage-bottom {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 14px; border-top: 1px solid var(--line);
  background: #1d1930;
}
.replay-wrap { display: flex; align-items: center; gap: 10px; flex: 1; }
.scrubber { flex: 1; accent-color: var(--accent); }
.scrub-info { color: var(--ink-dim); font-size: 12px; min-width: 120px; text-align: right; }
.legend { display: flex; gap: 12px; font-size: 11px; color: var(--ink-dim); }
.legend-item { display: flex; align-items: center; gap: 4px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-alert { background: var(--danger); }
.dot-activity { background: var(--accent-2); }
.dot-cam { background: var(--accent); }

/* ═══ Buttons ═══ */
.btn {
  font-family: inherit; font-size: 12px; font-weight: 600;
  padding: 5px 12px; border-radius: 8px; cursor: pointer;
  background: var(--panel-2); color: var(--ink);
  border: 1px solid var(--line); transition: background 0.15s, transform 0.1s;
}
.btn:hover { background: #3d3760; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #241a05; border-color: var(--accent); }
.btn-primary:hover { background: #ffc166; }
.btn-small { padding: 2px 8px; font-size: 11px; }

/* ═══ Sidebar panels ═══ */
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; overflow: hidden;
  display: flex; flex-direction: column;
}
.panel-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px; color: var(--ink-dim);
  background: var(--panel-2); border-bottom: 1px solid var(--line);
}

.feed-body { max-height: 260px; overflow-y: auto; padding: 8px; }
.feed-hint { font-size: 11px; color: var(--ink-dim); padding: 4px 6px 8px; line-height: 1.4; }
.feed-list { display: flex; flex-direction: column; gap: 6px; }
.feed-item {
  display: flex; gap: 8px; align-items: center;
  background: #211c33; border: 1px solid var(--line);
  border-radius: 8px; padding: 5px; font-size: 11px;
}
.feed-item img { width: 64px; height: 48px; border-radius: 5px; object-fit: cover; background: #000; }
.feed-item .fi-main { flex: 1; min-width: 0; }
.feed-item .fi-act { font-weight: 700; font-size: 12px; }
.feed-item .fi-cam { color: var(--ink-dim); }
.feed-item .fi-conf { color: var(--accent); font-variant-numeric: tabular-nums; }
.feed-item.fi-alert { border-color: var(--danger); background: #2c1a22; }
.feed-item.fi-alert .fi-act { color: #ff8d9a; }

.log-body { max-height: 240px; overflow-y: auto; padding: 6px 8px; }
.log-list { display: flex; flex-direction: column; }
.log-row {
  display: flex; gap: 8px; padding: 4px 6px; font-size: 11.5px;
  border-bottom: 1px solid rgba(74,67,104,0.35); align-items: baseline;
}
.log-row:last-child { border-bottom: none; }
.log-time { color: var(--ink-dim); font-variant-numeric: tabular-nums; white-space: nowrap; }
.log-msg { color: var(--ink); }
.log-row.log-alert { background: rgba(255,93,108,0.12); }
.log-row.log-alert .log-msg { color: #ff8d9a; font-weight: 600; }
.log-row.log-info .log-msg { color: var(--accent-2); }

.status-now { padding: 8px 12px 10px; display: flex; flex-direction: column; gap: 5px; }
.status-row { display: flex; justify-content: space-between; font-size: 12px; }
.s-label { color: var(--ink-dim); }
.s-value { font-weight: 700; }

.panel-day { min-height: 120px; }
.panel-day .panel-head { border-bottom: none; }
#dayChart { width: 100%; height: 120px; display: block; }
.day-stats { padding: 0 12px 8px; font-size: 11px; color: var(--ink-dim); line-height: 1.5; }
.achievements { padding: 0 12px 10px; display: flex; flex-wrap: wrap; gap: 5px; }
.ach {
  font-size: 10.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  background: #1d2b21; color: #8fe8b0; border: 1px solid #2f5a3c;
}
.ach.locked { background: #221f30; color: #6f6890; border-color: #3a3457; }

/* ═══ Scrollbars ═══ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #4a4368; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ═══ Compact (narrow) ═══ */
@media (max-width: 1100px) {
  .sidebar { flex-basis: 340px; }
  .brand-tag, .sim-date { display: none; }
}
