:root {
  --bg: #1d1610;
  --bg2: #271d14;
  --panel: #2c2117;
  --line: #4a3826;
  --text: #f5ead6;
  --dim: #c3ae8c;
  --honey: #f2a516;
  --honey2: #ffcf5a;
  --good: #8fd16a;
  --warn: #f2c14e;
  --bad: #ff7a5c;
  --dance: #9cc8ff;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.35 system-ui, -apple-system, "Segoe UI", sans-serif; }
button { font: inherit; color: inherit; background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; cursor: pointer; }
button:hover { border-color: var(--honey); }
button.on { background: var(--honey); color: #2a1a05; border-color: var(--honey); font-weight: 600; }
button.icon { padding: 5px 9px; }
#app { display: flex; flex-direction: column; height: 100dvh; }
#top { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--bg2); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-size: 16px; white-space: nowrap; }
.brand b { color: var(--honey2); }
#when { font-variant-numeric: tabular-nums; color: var(--dim); white-space: nowrap; }
#date { color: var(--text); font-weight: 600; }
#wx { white-space: nowrap; }
#wx .fc { opacity: 0.65; margin-left: 6px; font-size: 12px; }
.seg { display: inline-flex; }
.seg button { border-radius: 0; margin-left: -1px; }
.seg button:first-child { border-radius: 8px 0 0 8px; margin-left: 0; }
.seg button:last-child { border-radius: 0 8px 8px 0; }
#views { margin-left: auto; }
#stats { display: flex; gap: 6px; padding: 6px 12px; overflow-x: auto; background: var(--bg); border-bottom: 1px solid var(--line); scrollbar-width: none; }
.chip { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.chip b { color: var(--honey2); font-weight: 600; }
.chip.warn { border-color: var(--warn); }
.chip.bad { border-color: var(--bad); color: #ffd6cc; }
main { flex: 1; display: flex; min-height: 0; }
#stage { position: relative; flex: 1; min-width: 0; }
#stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#stage canvas[hidden] { display: none; }
.toolbar { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 6px; flex-wrap: wrap; max-width: calc(100% - 24px); }
.toolbar button { background: rgba(39,29,20,0.92); backdrop-filter: blur(4px); }
.toolbar button.on { background: var(--honey); }
.toolbar .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
#banner { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); background: rgba(120,24,12,0.94); border: 1px solid var(--bad); padding: 8px 14px; border-radius: 10px; font-weight: 600; max-width: calc(100% - 24px); text-align: center; box-shadow: 0 6px 24px rgba(0,0,0,0.4); }
#banner button { margin-left: 8px; }
#tip { position: absolute; pointer-events: none; background: rgba(20,15,10,0.92); border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; font-size: 12px; max-width: 240px; }
#card { position: absolute; right: 12px; top: 12px; width: 270px; max-width: calc(100% - 24px); background: rgba(39,29,20,0.96); border: 1px solid var(--line); border-radius: 12px; padding: 12px; box-shadow: 0 8px 30px rgba(0,0,0,0.4); }
#card h3 { margin: 0 0 4px; font-size: 16px; }
#card .x { position: absolute; right: 8px; top: 8px; padding: 2px 8px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 8px 0; font-size: 13px; }
.kv span:nth-child(odd) { color: var(--dim); }
#side { width: 330px; background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; border: 0; border-radius: 0; background: none; padding: 9px; color: var(--dim); }
.tabs button.on { color: var(--honey2); box-shadow: inset 0 -2px var(--honey); background: none; }
#panel { overflow-y: auto; padding: 12px; flex: 1; }
h4 { margin: 14px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--dim); }
h4:first-child { margin-top: 0; }
.role { margin-bottom: 8px; }
.role .row { display: flex; justify-content: space-between; font-size: 13px; }
.role .hint { font-size: 11.5px; color: var(--dim); }
input[type=range] { width: 100%; accent-color: var(--honey); }
.bar { height: 10px; background: var(--bg); border-radius: 6px; overflow: hidden; border: 1px solid var(--line); margin: 4px 0; }
.bar i { display: block; height: 100%; background: var(--honey); }
.small { font-size: 12px; color: var(--dim); }
.ent { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 4px 0; }
.ent .seg button { padding: 3px 8px; font-size: 12px; }
.goal { padding: 6px 0; border-bottom: 1px solid var(--line); display: flex; gap: 8px; }
.goal.done { color: var(--dim); text-decoration: line-through; }
.log p { margin: 0 0 6px; padding-left: 8px; border-left: 3px solid var(--line); font-size: 13px; }
.log p small { color: var(--dim); display: block; font-size: 11px; }
.log .good { border-color: var(--good); } .log .warn { border-color: var(--warn); } .log .bad { border-color: var(--bad); } .log .dance { border-color: var(--dance); }
#modal { position: fixed; inset: 0; background: rgba(10,7,4,0.72); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 10; }
#modal[hidden] { display: none; }
.sheet { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px; width: 720px; max-width: 100%; max-height: calc(100dvh - 32px); overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
.sheet h2 { margin: 0 0 6px; color: var(--honey2); }
.homes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0; }
.home { border: 1px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; background: var(--bg2); }
.home.on { border-color: var(--honey); box-shadow: 0 0 0 1px var(--honey); }
.home h3 { margin: 0 0 4px; }
.home ul { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }
.home .pro li::marker { content: "+ "; color: var(--good); }
.home .con li::marker { content: "− "; color: var(--bad); }
.actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 12px; }
.actions .primary { background: var(--honey); color: #2a1a05; border-color: var(--honey); font-weight: 600; }
.slots { display: grid; gap: 6px; margin: 10px 0; }
.slot { display: flex; align-items: center; gap: 8px; justify-content: space-between; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.reasons li { margin-bottom: 4px; }
.help p { margin: 6px 0; }
@media (max-width: 820px) {
  main { flex-direction: column; }
  #side { width: auto; height: 42%; border-left: 0; border-top: 1px solid var(--line); }
  #top { gap: 6px; padding: 6px 10px; }
  .brand b { display: none; }
  #views { margin-left: 0; }
  .homes { grid-template-columns: 1fr; }
  #card { top: auto; bottom: 56px; right: 8px; left: 8px; width: auto; }
  .toolbar { left: 8px; bottom: 8px; }
  .toolbar button { padding: 5px 8px; font-size: 13px; }
}
