:root {
  --bg: #0f1a2b;
  --panel: #16243a;
  --line: #243954;
  --text: #e8eef6;
  --muted: #8ea3bd;
  --accent: #f2b33d;
  --danger: #e2574c;
  font-family: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
.app { display: flex; height: 100vh; }
.sidebar { width: 320px; flex-shrink: 0; overflow-y: auto; border-right: 1px solid var(--line); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.brand h1 { margin: 0; font-size: 20px; color: var(--accent); }
.brand p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.badge { background: #3a2c10; color: #f5d27e !important; padding: 6px 8px; border-radius: 6px; font-size: 12px !important; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.panel h2 { margin: 0 0 2px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.panel h4 { margin: 6px 0 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
input[type="text"], select, .land-list input {
  background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 7px 8px; font: inherit; font-size: 13px; width: 100%;
}
input[type="range"] { accent-color: var(--accent); width: 100%; }
button { background: #203350; color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; font: inherit; font-size: 13px; cursor: pointer; }
button:hover { border-color: var(--accent); }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button[aria-pressed="true"] { background: var(--accent); color: #1a1205; border-color: var(--accent); font-weight: 600; }
button.primary { background: var(--accent); color: #1a1205; border-color: var(--accent); font-weight: 600; }
button.danger { color: #ffb4ac; }
button.danger:hover { border-color: var(--danger); }
button.wide { width: 100%; }
button.pulse { box-shadow: 0 0 0 3px rgba(242, 179, 61, .35); }
.row { display: flex; gap: 6px; flex-wrap: wrap; }
.row > button { flex: 1; }
.tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.grid { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { position: relative; padding: 5px 9px; font-size: 12px; border-radius: 999px; }
.chip-del { margin-left: 6px; color: #ffb4ac; font-weight: 700; }
.land-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.land-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 2; }
.land-label {
  position: absolute; left: 0; top: 0; min-width: 26px; height: 26px; padding: 0 7px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 13px; background: #10202c; color: #ffd23f; border: 2px solid #ffd23f;
  font: 700 13px/1 "Be Vietnam Pro", system-ui, sans-serif; box-shadow: 0 2px 6px rgba(0,0,0,.45);
  will-change: transform;
}
.land-label.active { background: #ffd23f; color: #10202c; }
.land-label.invalid { background: #d9534f; color: #fff; border-color: #fff; }
.land-num {
  min-width: 22px; height: 22px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center;
  background: #10202c; color: #ffd23f; border: 1.5px solid #ffd23f; font-size: 11px; font-weight: 700;
}
.land-list li.active .land-num { background: #ffd23f; color: #10202c; }
.land-list { max-height: 360px; overflow-y: auto; padding-right: 2px; }
.land-list li { display: grid; grid-template-columns: auto auto 1fr auto auto auto; gap: 4px; align-items: center; padding: 2px; border-radius: 6px; }
.land-list li.checked { background: rgba(244, 180, 60, 0.14); }
.land-list input[type="checkbox"], .land-bulk input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; margin: 0; }
.land-bulk { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 12px; }
.land-bulk label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.land-bulk .muted { flex: 1; color: var(--muted); font-size: 11px; }
.land-bulk button:disabled { opacity: 0.4; cursor: not-allowed; }
.land-list li.active input { border-color: var(--accent); }
.land-list small { color: var(--muted); font-size: 11px; }
.mini { padding: 4px 6px; font-size: 11px; }
.muted { color: var(--muted); font-size: 13px; }
.file { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.file input { font-size: 12px; color: var(--text); }
.stage { position: relative; flex: 1; min-width: 0; }
#scene { display: block; width: 100%; height: 100%; touch-action: none; }
.hud { position: absolute; top: 14px; right: 14px; display: flex; gap: 12px; align-items: center; background: rgba(10, 18, 30, .7); backdrop-filter: blur(6px); padding: 10px 14px; border-radius: 10px; font-size: 13px; }
.clock { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent); }
.hint { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); margin: 0; max-width: calc(100% - 28px); background: rgba(10, 18, 30, .75); padding: 8px 14px; border-radius: 8px; font-size: 13px; text-align: center; }
.toast { position: absolute; top: 14px; left: 50%; transform: translate(-50%, -20px); opacity: 0; transition: .25s; background: var(--accent); color: #1a1205; padding: 8px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; pointer-events: none; max-width: 80%; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 800px) {
  .app { flex-direction: column-reverse; }
  .sidebar { width: 100%; height: 45vh; border-right: 0; border-top: 1px solid var(--line); }
  .stage { height: 55vh; }
}
