:root {
  --bg: #0c0f14;
  --panel: #151b24;
  --panel2: #1b2430;
  --border: #2c3a4d;
  --text: #e8eef7;
  --muted: #93a4b8;
  --accent: #6ec6ff;
  --good: #3dd68c;
  --bad: #ff6b6b;
  --warn: #f0b429;
  --bar: #243041;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 system-ui, "Segoe UI", sans-serif; }
button, select, input { font: inherit; }
.screen { display: none; min-height: 100vh; }
.screen.active { display: block; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.panel h2 { margin: 0 0 10px; font-size: 14px; color: #cfe3f7; }
.title-panel { max-width: 560px; margin: 10vh auto; }
h1 { margin: 0 0 6px; font-size: 28px; }
h1 .en { color: var(--muted); font-size: 16px; font-weight: 500; }
.tagline { color: var(--muted); margin-top: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0; }
label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 12px; }
label select { background: var(--panel2); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 8px; }
.check { flex-direction: row; align-items: center; gap: 8px; }
.check.small { font-size: 12px; color: var(--muted); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; margin-top: 10px; }
button { background: var(--panel2); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; cursor: pointer; }
button:hover { filter: brightness(1.08); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.primary { background: #1b3a55; border-color: #2d6ea3; color: #d7efff; }
button.ghost { background: transparent; }
button.danger { border-color: #7a3030; color: #ffc9c9; }
.hint { color: var(--muted); font-size: 12px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: rgba(12,15,20,.92); backdrop-filter: blur(8px); z-index: 5; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); font-size: 12px; margin-left: 6px; }
.layout { display: grid; grid-template-columns: 280px 1fr 320px; gap: 12px; padding: 12px; }
.kv { display: grid; gap: 4px; font-size: 13px; }
.kv div { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px dashed #243041; padding: 3px 0; }
.kv span:last-child { color: #d7e7f8; }
.meta { color: var(--muted); font-size: 12px; margin-top: 8px; }
.need { margin-bottom: 8px; }
.need .label { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.bar { height: 8px; background: var(--bar); border-radius: 99px; overflow: hidden; margin-top: 3px; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.bar.food > i { background: #f0b429; }
.bar.rest > i { background: #6ea8ff; }
.bar.joy > i { background: #b07cff; }
.bar.mood > i { background: #3dd68c; }
.bar.mood.bad > i { background: var(--bad); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions button { text-align: left; min-width: 140px; }
.actions button small { display: block; color: var(--muted); font-size: 11px; }
.log { max-height: 280px; overflow: auto; font-size: 13px; display: flex; flex-direction: column; gap: 6px; }
.log .item { padding: 6px 8px; border-radius: 8px; background: var(--panel2); border-left: 3px solid #3d5673; }
.log .item.good { border-left-color: var(--good); }
.log .item.bad { border-left-color: var(--bad); }
.log .item.warn { border-left-color: var(--warn); }
.log.dev .item { border-left-color: #8a6d3b; font-family: ui-monospace, monospace; font-size: 11px; white-space: pre-wrap; }
.debug { max-height: 240px; overflow: auto; background: #0a0d11; border-radius: 8px; padding: 8px; font-size: 11px; color: #b7c7d9; }
body.dev #panel-devlog, body.dev #panel-debug { display: block !important; }
body:not(.dev) .dev-only { display: none !important; }
@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .grid2 { grid-template-columns: 1fr; }
}

/* Event modal */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.62);
  z-index: 40; display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal-mask[hidden] { display: none !important; }
.modal-card {
  width: min(560px, 100%); max-height: 85vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  padding: 16px 18px; box-shadow: 0 20px 60px rgba(0,0,0,.45);
}
.modal-card h2 { margin: 0 0 8px; font-size: 18px; color: #ffe08a; }
.modal-card .event-body { color: var(--text); font-size: 15px; line-height: 1.6; margin: 10px 0 14px; white-space: pre-wrap; }
.modal-card .event-meta { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.plan-box { border: 1px dashed var(--border); border-radius: 10px; padding: 10px; margin: 10px 0; background: #10161f; }
.plan-box h3 { margin: 0 0 8px; font-size: 13px; color: #cfe3f7; }
.plan-list { display: flex; flex-direction: column; gap: 6px; min-height: 28px; }
.plan-item {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  background: var(--panel2); border-radius: 8px; padding: 6px 8px; font-size: 13px;
}
.plan-item button { padding: 2px 8px; font-size: 12px; }
.banner {
  background: #3a2a12; border: 1px solid #8a6d3b; color: #ffe6b0;
  border-radius: 10px; padding: 8px 10px; margin-bottom: 10px; font-size: 13px;
}
.banner.danger { background: #3a1515; border-color: #7a3030; color: #ffc9c9; }
.actions button.planned { outline: 1px solid #2d6ea3; }

/* Action IO */
.actions button {
  display: flex; flex-direction: column; align-items: flex-start;
  gap: 2px; min-width: 168px; max-width: 240px;
}
.actions button .act-label { font-weight: 600; }
.actions button .act-ap { color: #9ec5ff; font-size: 11px; }
.actions button .act-pay { color: #f0b429; font-size: 11px; line-height: 1.3; }
.actions button .act-gain { color: #3dd68c; font-size: 11px; line-height: 1.3; }
.plan-item-main { flex: 1; min-width: 0; }
.plan-io { color: var(--muted); font-size: 12px; margin-top: 2px; }
.muted { color: var(--muted); }
.modal-wide { width: min(720px, 100%); }
.pick-body { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.pick-row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--panel2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
}
.pick-row.dim { opacity: 0.72; }
.pick-name { font-weight: 600; margin-bottom: 4px; }
.pick-cost { color: #f0b429; font-size: 12px; }
.pick-gain { color: #3dd68c; font-size: 12px; margin-top: 2px; }
.pick-reason { color: #ff8e8e; font-size: 12px; margin-top: 4px; }
