/* StagePlot Studio — editor layout (基于 tokens，spec 兼容) */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
[hidden] { display: none !important; }

html { scrollbar-gutter: stable; }
body {
  background: var(--bg); color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px; line-height: 1.55;
}

:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; inset-block-start: -100%; inset-inline-start: 8px; z-index: 30;
  background: var(--sur); color: var(--ink); border: 1px solid var(--acc);
  border-radius: 8px; padding: 8px 14px; }
.skip:focus-visible { inset-block-start: 8px; }

.wrap { max-width: 1240px; margin-inline: auto; padding-inline: 16px; }

.top {
  position: sticky; inset-block-start: 0; z-index: 20;
  background: color-mix(in oklab, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-block-end: 1px solid var(--line);
}
.header-grid { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 60px; }
.brand { font-weight: 800; font-size: 18px; color: var(--ink); text-decoration: none; }
.brand span { color: var(--acc); }
.header-actions { display: flex; gap: 10px; align-items: center; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding-inline: 16px;
  border-radius: var(--shape-m); border: 1px solid transparent;
  font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none;
}
.btn.primary { background: var(--acc); color: #fff; border-color: transparent; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: var(--sur); color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--acc); }
.btn.danger:hover { border-color: var(--danger); color: var(--danger); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.pro-tag {
  background: var(--acc); color: #fff; font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 999px; margin-inline-start: 4px;
}

.editor-wrap { display: grid; grid-template-columns: 300px 1fr; gap: 16px; padding-block: 16px; }
@media (max-width: 60rem) { .editor-wrap { grid-template-columns: 1fr; } }

.panel {
  background: var(--sur); border: 1px solid var(--line);
  border-radius: var(--shape-l); padding: 16px;
}
fieldset { border: 1px solid var(--line); border-radius: var(--shape-m);
  padding: 10px 12px 12px; margin-block-end: 14px; }
legend { font-size: 12px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--acc); padding-inline: 6px; }

.field { display: grid; gap: 4px; margin-block-end: 10px; }
.field label { font-weight: 600; font-size: 13px; }
.field input[type="number"], .field input[type="checkbox"], .field select {
  accent-color: var(--acc);
}
.row2 { display: flex; gap: 10px; } .row2 .field { flex: 1; }

.add-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.add, .tpl {
  min-height: 38px; border-radius: var(--shape-s); border: 1px solid var(--line);
  background: var(--sur-high); color: var(--ink); cursor: pointer; font-size: 13px;
  padding-inline: 8px;
}
.add:hover, .tpl:hover { border-color: var(--acc); color: var(--acc); }

.canvas-panel { min-height: 400px; }
#stage-holder { border: 1px solid var(--line); border-radius: var(--shape-m); overflow: hidden; background: var(--sur-high); }
.hint { color: var(--mut); font-size: 12.5px; }
.center { text-align: center; }

dialog {
  border: 1px solid var(--line); border-radius: var(--shape-l);
  background: var(--sur); color: var(--ink);
  padding: 22px; max-inline-size: 26rem; margin: auto;
}
dialog::backdrop { background: rgba(0,0,0,.55); }
dialog h2 { font-size: 17px; margin-block-end: 8px; }
dialog .sep { text-align: center; color: var(--mut); font-size: 12px; margin-block: 10px; }
#proPayButtons, #donatePayButtons { min-block-size: 46px; margin-block-end: 6px; }

#toast {
  position: fixed; inset-block-end: 20px; inset-inline-start: 50%; translate: -50% 0;
  background: var(--sur-high); color: var(--ink); border: 1px solid var(--acc);
  border-radius: var(--shape-m); padding: 10px 18px; z-index: 50; font-weight: 600;
}
.foot { padding-block: 16px; font-size: 12.5px; color: var(--mut); }
.foot a { color: var(--acc); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
@media (forced-colors: active) {
  .panel, fieldset, .add, .tpl, dialog { border-color: CanvasText; }
  .btn.primary { border: 1px solid ButtonText; }
}
