:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  color: #193047;
  background: #edf3f7;
  --ink: #193047;
  --muted: #52687c;
  --line: #cbd9e3;
  --accent: #075f85;
  --accent-dark: #064766;
  --accent-soft: #e3f3f8;
  --paper: #fff;
  --shadow: 0 3px 14px rgb(23 55 77 / 8%);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; line-height: 1.45; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button, .button, input[type="file"]::file-selector-button {
  border: 1px solid #a9bdcb;
  border-radius: 8px;
  padding: .55rem .8rem;
  background: #fff;
  color: var(--ink);
  font-weight: 650;
  min-height: 42px;
}
button:hover, .button:hover, input[type="file"]::file-selector-button:hover { background: var(--accent-soft); border-color: var(--accent); }
button:disabled { cursor: not-allowed; opacity: .5; }
:focus-visible { outline: 3px solid #d45b00; outline-offset: 3px; }
a { color: #075f85; }
a:hover { color: #043e58; }
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .7rem 1.5rem;
  padding: 1rem clamp(1rem, 2vw, 2rem);
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: .15rem; }
.brand-logo { display: block; width: min(248px, 100%); height: auto; }
.subtitle { margin: 0; color: var(--muted); }
.intro { max-width: 1800px; margin: 0 auto; padding: 1.5rem 1rem .4rem; display: flex; align-items: end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.intro h1 { margin: .2rem 0; font-size: clamp(1.55rem, 2.4vw, 2.1rem); line-height: 1.2; }
.intro p, .panel-note { margin: .35rem 0 0; color: var(--muted); }
.eyebrow { font-size: .76rem; font-weight: 800; color: #41697c; letter-spacing: .08em; }
.stage-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .7rem; margin-bottom: 1rem; }
.stage-header h2 { margin: 0; font-size: 1.15rem; }
.history, .object-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.object-actions { margin-top: 1rem; }
.history button { font-size: .9rem; }
.count { padding: .1rem .45rem; border-radius: 999px; background: #e3f3f8; font-size: .85rem; }
.object-item { display: flex; align-items: center; gap: .6rem; }
.object-item strong, .object-item small { display: block; }
.object-item small { color: var(--muted); font-weight: 400; }
.swatch { flex: none; width: 1.5rem; height: 1.5rem; border-radius: 5px; border: 1px solid #8fa7b7; }
.list-empty { color: var(--muted); }
.card-title { display: grid; gap: .2rem; padding: .75rem; background: #eaf6f8; border-radius: 8px; overflow-wrap: anywhere; }
.card-title span { color: var(--muted); font-size: .9rem; }
.object-card { overflow: hidden; border: 2px solid #1f6f89; border-radius: 10px; background: #fff; box-shadow: 0 2px 8px rgb(23 55 77 / 8%); }
.object-card-header { padding: .7rem .8rem; background: #d9f0f7; color: #074964; font-size: 1.05rem; font-weight: 750; overflow-wrap: anywhere; }
.object-card-attributes { display: grid; gap: .3rem; margin: 0; padding: .75rem .8rem; }
.object-card-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: baseline; gap: .35rem; overflow-wrap: anywhere; }
.object-card-name { font-weight: 650; }
.object-card-value { grid-column: 2 / 4; display: flex; justify-content: space-between; gap: .35rem; color: #164c64; text-align: right; margin: 0; }
.object-card-value::before { content: "="; color: var(--muted); }
.primary { margin-top: .8rem; width: 100%; background: var(--accent); border-color: var(--accent); color: white; }
.primary:hover { background: var(--accent-dark); color: white; }
.empty-state strong { display: block; }
.empty-state > span { display: block; font-size: 2rem; }
.legal-header, .legal-page { max-width: 850px; margin: 0 auto; padding: 1rem; }
.legal-page { background: white; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 2rem; }
dialog { max-width: min(38rem, 90vw); border: 1px solid var(--line); border-radius: 12px; padding: 1.5rem; color: var(--ink); }
dialog::backdrop { background: rgb(12 35 50 / 55%); }
.actions, .tools { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.workspace {
  display: grid;
  grid-template-columns: minmax(180px, 235px) minmax(360px, 1fr) minmax(245px, 300px);
  gap: 1rem;
  align-items: start;
  max-width: 1800px;
  margin: 0 auto;
  padding: 1rem;
}
.panel, .stage, .inspector {
  min-width: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.panel, .inspector { padding: 1rem; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .75rem; }
.panel-head h2, .panel-head h3, .panel h2, .inspector h2 { margin: 0; font-size: 1.15rem; line-height: 1.25; }
.object-list { display: grid; gap: .4rem; margin: 0; padding: 0; list-style: none; }
.object-list { margin-top: .8rem; }
.tree-node { min-width: 0; }
.tree-row { display: flex; align-items: center; gap: .35rem; min-width: 0; }
.tree-row .tree-select { flex: 0 0 auto; margin: .25rem; }
.tree-row .object-item { flex: 1 1 auto; min-width: 0; }
.tree-children { display: grid; gap: .4rem; margin: .35rem 0 0 .8rem; padding-left: .55rem; border-left: 2px solid var(--line); }
.group-swatch { display: grid; place-items: center; flex: none; width: 1.5rem; height: 1.5rem; border-radius: 5px; background: #d9f0f7; color: var(--accent-dark); }
.object-list button { width: 100%; text-align: left; overflow-wrap: anywhere; }
.object-list button[aria-selected="true"], .object-list button.active, .object-list button.selected,
.tool[aria-pressed="true"], .tool.active, .tool.selected { background: #d9f0f7; border-color: #08759a; color: #074964; box-shadow: inset 4px 0 #08759a; }
.stage { padding: 1rem; }
.tools { margin-bottom: .8rem; }
.tool { display: inline-flex; justify-content: center; align-items: center; gap: .35rem; }
.canvas-wrap { position: relative; width: 100%; overflow: auto; background: #e3ebf0; border: 1px solid #a9bdcb; border-radius: 8px; }
#canvas, .canvas-wrap canvas, .canvas-wrap svg { display: block; max-width: 100%; background: #fff; touch-action: none; }
#canvas { width: 100%; height: auto; aspect-ratio: 3 / 2; }
.hint, .status, .empty-state { color: var(--muted); }
.hint { margin: .65rem 0 0; }
.command-bar { margin-top: 1rem; padding: .9rem; border: 1px solid #c1dfe8; border-radius: 8px; background: #f0f8fa; }
.command-bar label { font-weight: 750; }
.command-bar p { margin: .25rem 0 .55rem; color: var(--muted); }
.command-bar code { font-size: .9em; }
.command-entry { display: flex; flex-wrap: wrap; gap: .5rem; }
.command-entry input { flex: 1 1 14rem; font-family: ui-monospace, Consolas, monospace; }
.command-run { background: var(--accent); border-color: var(--accent); color: white; }
.command-run:hover { background: var(--accent-dark); color: white; }
.command-bar .command-feedback:empty { display: none; }
.command-bar .command-feedback { margin: .5rem 0 0; }
.empty-state { padding: .75rem; border-radius: 8px; background: #f2f7fa; }
.fields { display: grid; gap: .75rem; }
.field { display: grid; gap: .3rem; min-width: 0; }
.field label, label.field { font-weight: 650; }
input:not([type="checkbox"]):not([type="radio"]):not([type="color"]), select, textarea {
  width: 100%; min-width: 0; padding: .48rem .6rem; border: 1px solid #8fa7b7; border-radius: 7px; background: #fff; color: var(--ink); min-height: 42px;
}
input[type="color"] { width: 100%; min-height: 42px; padding: 3px; border: 1px solid #8fa7b7; border-radius: 7px; background: #fff; }
input[type="checkbox"], input[type="radio"] { width: 1.2em; height: 1.2em; accent-color: var(--accent); }
.method-box { margin-top: 1rem; padding: .8rem; background: #f0f8fa; border: 1px solid #c1dfe8; border-radius: 8px; }
.method-box h3 { margin: 0 0 .6rem; font-size: 1rem; }
.footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1rem; padding: 1rem clamp(1rem, 2vw, 2rem); color: var(--muted); border-top: 1px solid var(--line); background: #fff; }
.footer p { margin: 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: .3rem 1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.status { min-height: 1.5em; }
[hidden] { display: none !important; }
@media (max-width: 1050px) {
  .workspace { grid-template-columns: minmax(180px, 235px) minmax(0, 1fr); }
  .inspector { grid-column: 1 / -1; }
  .inspector .fields { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
}
@media (max-width: 650px) {
  .topbar, .workspace { padding: .75rem; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .inspector { grid-column: auto; }
  .actions { width: 100%; }
  .intro { padding: 1rem .75rem 0; }
  .stage, .panel, .inspector { padding: .75rem; }
  .footer { padding: .75rem; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; } }
@media print { .topbar, .panel, .inspector, .tools, .hint, .footer { display: none !important; } .workspace { display: block; padding: 0; } .stage, .canvas-wrap { border: 0; box-shadow: none; padding: 0; } }
