/* Subscriptions Empire — carved-stone UI over the 3D world. */
:root {
  --basalt: #211c14;
  --basalt-2: #2c2519;
  --lime: #e8ddc4;
  --lime-dim: #b8ab8c;
  --jade: #2fa37e;
  --gold: #c9a227;
  --ember: #d96f3c;
  --danger: #c94f3d;
  --line: #4d4330;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0e140d; }
body { font-family: "Segoe UI", system-ui, sans-serif; color: var(--lime); font-size: 15px; }
h1, h2, h3 { font-family: "Palatino Linotype", "Book Antiqua", Georgia, serif; letter-spacing: 0.02em; margin: 0; }
button {
  font: inherit; color: var(--lime); background: var(--basalt-2);
  border: 1px solid var(--line); border-radius: 3px; padding: 6px 10px; cursor: pointer;
}
button:hover { border-color: var(--gold); color: #fff3d6; }
button.danger:hover { border-color: var(--danger); color: #ffd9d2; }
input, select {
  font: inherit; color: var(--lime); background: #17130d;
  border: 1px solid var(--line); border-radius: 3px; padding: 6px 8px; width: 100%;
}
label { display: block; margin: 10px 0; color: var(--lime-dim); font-size: 13px; }
label input, label select { margin-top: 4px; color: var(--lime); }
a { color: var(--gold); }
.row { display: flex; gap: 8px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.form-error { color: #ffb4a6; background: #3d1d16; border: 1px solid var(--danger); padding: 8px; border-radius: 3px; }
.panel-hint { color: var(--lime-dim); font-size: 13px; }

#scene { position: fixed; inset: 0; }
#scene canvas { display: block; }

#hud {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
  background: var(--basalt); border-bottom: 2px solid var(--gold);
  padding: 8px 16px;
}
.hud-title h1 { font-size: 20px; color: #f3e9cd; }
.hud-title p { margin: 0; color: var(--jade); font-size: 13px; font-weight: 600; }
.hud-stats { display: flex; gap: 18px; }
.stat { display: flex; flex-direction: column; }
.stat-label { font-size: 11px; color: var(--lime-dim); text-transform: uppercase; letter-spacing: 0.08em; }
.stat strong { font-size: 19px; color: #fff3d6; }
.stat-due strong { color: var(--ember); }
.hud-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.save-status { margin: 0; font-size: 12px; color: var(--lime-dim); min-width: 90px; }
.save-status.failed { color: #ffb4a6; font-weight: 700; }

#travelPanel {
  position: fixed; left: 12px; top: 96px; z-index: 9; width: 208px;
  background: var(--basalt); border: 1px solid var(--line); border-top: 3px solid var(--jade);
  padding: 12px; max-height: calc(100vh - 190px); overflow: auto;
}
#travelPanel h2 { font-size: 16px; }
.district-btn {
  display: flex; width: 100%; justify-content: space-between; align-items: baseline; gap: 8px;
  margin: 5px 0; text-align: left; border-left: 4px solid var(--line);
}
.district-btn .dsub { color: var(--lime-dim); font-size: 12px; white-space: nowrap; }
.district-btn.active { border-color: var(--gold); background: #38301f; }
#btnHome { width: 100%; margin-top: 8px; }

#detailPanel {
  position: fixed; right: 12px; top: 96px; z-index: 9; width: 300px;
  background: var(--basalt); border: 1px solid var(--line); border-top: 3px solid var(--gold);
  padding: 16px; max-height: calc(100vh - 190px); overflow: auto;
}
#detailPanel .icon-btn { position: absolute; top: 8px; right: 8px; padding: 2px 8px; font-size: 18px; }
.detail-category { color: var(--jade); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; margin: 0 24px 2px 0; }
.detail-cost { font-size: 26px; font-weight: 700; color: #fff3d6; margin: 6px 0; }
.detail-cost small { font-size: 13px; color: var(--lime-dim); font-weight: 400; }
#detailPanel dl { margin: 10px 0; }
#detailPanel dl div { display: flex; justify-content: space-between; border-top: 1px solid var(--line); padding: 5px 0; }
#detailPanel dt { color: var(--lime-dim); }
#detailPanel dd { margin: 0; font-weight: 600; }
.detail-note { color: var(--lime-dim); font-size: 13px; }
.due-soon { color: var(--ember); font-weight: 700; }

dialog {
  background: var(--basalt); color: var(--lime); border: 1px solid var(--gold);
  border-radius: 4px; padding: 20px; max-width: min(92vw, 560px);
  max-height: 92vh; overflow-y: auto;
}
dialog::backdrop { background: rgba(5, 8, 5, 0.72); }
dialog .icon-btn { position: sticky; top: 0; float: right; padding: 2px 10px; font-size: 19px; z-index: 2; }
#dashboardModal { max-width: min(96vw, 1160px); }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }
dialog canvas { background: #17130d; border: 1px solid var(--line); max-width: 100%; height: auto; }
#renewalTimeline { max-height: 180px; overflow: auto; padding-left: 22px; }
#renewalTimeline li { margin: 3px 0; }
.category-row { display: grid; grid-template-columns: 1fr 52px auto auto; gap: 6px; margin: 6px 0; align-items: center; }
.category-row input[type="color"] { padding: 2px; height: 34px; }

#hintBar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 8;
  background: rgba(24, 20, 13, 0.92); color: var(--lime-dim);
  font-size: 12.5px; padding: 6px 14px; text-align: center; border-top: 1px solid var(--line);
}
#errorBanner {
  position: fixed; top: 110px; left: 50%; transform: translateX(-50%); z-index: 30;
  background: #421f16; color: #ffd9d2; border: 1px solid var(--danger);
  padding: 10px 16px; border-radius: 3px; max-width: 80vw; font-weight: 600;
}
#toast {
  position: fixed; bottom: 44px; left: 50%; transform: translateX(-50%); z-index: 30;
  background: var(--basalt-2); color: #ffe9a8; border: 1px solid var(--gold);
  padding: 8px 14px; border-radius: 3px;
}
#bootOverlay {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: center;
  background: #0e140d; color: var(--lime); font-family: Georgia, serif; font-size: 20px;
  transition: opacity 0.5s ease;
}
#bootOverlay.done { opacity: 0; pointer-events: none; }
@media (prefers-reduced-motion: reduce) {
  #bootOverlay { transition: none; }
}
