:root {
  --bg: #0e1216;
  --panel: rgba(17, 22, 36, 0.94);
  --panel-2: #151b2a;
  --panel-3: #1b2234;
  --line: rgba(255, 255, 255, 0.095);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #f4f7ff;
  --muted: #9ca8c3;
  --accent: #a5ebce;
  --accent-2: #8acdc0;
  --danger: #ff6f88;
  --success: #79f0bb;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  --radius: 18px;
  font-family: Pretendard, "Noto Sans KR", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 18% -10%, rgba(79, 128, 255, 0.16), transparent 34rem),
    radial-gradient(circle at 92% 8%, rgba(177, 94, 255, 0.14), transparent 30rem),
    var(--bg);
}
button, input, select, textarea { font: inherit; }
button, select, input[type="color"], input[type="range"], .drop-zone, .file-button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.topbar {
  min-height: 74px;
  padding: 13px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 11, 19, 0.83);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand-block { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  width: 43px; height: 43px; border-radius: 13px; display: grid; place-items: center;
  font-weight: 900; letter-spacing: -0.04em; color: #081019;
  background: linear-gradient(135deg, var(--accent), #c6b7ff 72%);
  box-shadow: 0 8px 28px rgba(111, 218, 255, 0.2);
}
.brand-block h1 { font-size: 17px; line-height: 1.25; margin: 0 0 3px; }
.brand-block p { margin: 0; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions, .inline-actions, .toolbar-group, .preset-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.button, .icon-button, .chip, .format-button, .file-button {
  border: 1px solid var(--line-strong);
  color: var(--text);
  background: var(--panel-3);
  transition: transform .16s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease;
}
.button:hover, .icon-button:hover, .chip:hover, .file-button:hover { border-color: rgba(118, 228, 255, 0.52); background: #222b40; }
.button:active, .icon-button:active, .chip:active, .format-button:active { transform: translateY(1px); }
.button { border-radius: 10px; min-height: 38px; padding: 0 13px; font-weight: 700; font-size: 13px; }
.button.small { min-height: 31px; padding: 0 10px; font-size: 12px; }
.button.full { width: 100%; }
.button.ghost { background: transparent; color: #dbe4f8; }
.button.secondary { background: linear-gradient(135deg, rgba(74, 204, 255, .18), rgba(153, 111, 255, .16)); border-color: rgba(119, 218, 255, .38); }
.button.danger { color: #ff9bad; }
.icon-button { width: 36px; height: 36px; border-radius: 10px; padding: 0; display: grid; place-items: center; font-size: 17px; }
.chip { min-height: 28px; padding: 0 9px; border-radius: 999px; font-size: 11px; color: #cbd6ed; }

.app-shell {
  display: grid;
  grid-template-columns: minmax(265px, 320px) minmax(500px, 1fr) minmax(290px, 350px);
  gap: 14px;
  padding: 14px;
  align-items: start;
  max-width: 1920px;
  margin: 0 auto;
}
.side-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.left-panel, .right-panel { max-height: calc(100vh - 102px); overflow: auto; position: sticky; top: 88px; scrollbar-width: thin; scrollbar-color: #39445d transparent; }
.panel-section { border-bottom: 1px solid var(--line); }
.panel-section:last-child { border-bottom: 0; }
.panel-section summary {
  list-style: none;
  min-height: 48px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
  user-select: none;
}
.panel-section summary::-webkit-details-marker { display: none; }
.panel-section summary::before { content: "▸"; color: var(--muted); margin-right: 7px; transition: transform .16s; }
.panel-section[open] summary::before { transform: rotate(90deg); }
.panel-section summary > span:first-of-type { flex: 1; }
.summary-hint { font-size: 10px; color: var(--muted); font-weight: 700; padding: 3px 7px; border: 1px solid var(--line); border-radius: 999px; }
.section-body { padding: 4px 14px 16px; display: grid; gap: 11px; }

.drop-zone {
  min-height: 112px;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  gap: 5px;
  border: 1px dashed rgba(119, 222, 255, .42);
  border-radius: 15px;
  background: linear-gradient(145deg, rgba(58, 165, 255, .09), rgba(170, 93, 255, .07));
  padding: 14px;
}
.drop-zone.is-dragging { border-color: var(--accent); background: rgba(75, 204, 255, .16); box-shadow: inset 0 0 0 1px rgba(118, 228, 255, .25); }
.drop-icon { font-size: 28px; line-height: 1; color: var(--accent); }
.drop-zone strong { font-size: 13px; }
.drop-zone small { color: var(--muted); font-size: 10px; }
.file-button { min-height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 12px; font-weight: 750; }

.field-group, .field { display: grid; gap: 6px; }
.field > span, .field-label, .export-options label span { font-size: 11px; color: #c7d1e5; font-weight: 700; }
.field.compact { gap: 4px; }
.field input[type="text"], .field input[type="number"], select, textarea {
  width: 100%; min-width: 0; border: 1px solid var(--line-strong); border-radius: 9px; color: var(--text); background: #0d1220; min-height: 34px; padding: 6px 9px;
}
select { appearance: auto; }
input[type="color"] { width: 100%; height: 34px; border: 1px solid var(--line-strong); border-radius: 9px; background: #0d1220; padding: 3px; }
.range-field > span { display: flex; justify-content: space-between; gap: 8px; }
.range-field output { color: var(--accent); font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.check-field { display: flex; align-items: center; gap: 8px; color: #c8d2e6; font-size: 12px; }
.check-field input { accent-color: var(--accent); }
.two-columns, .three-columns, .four-columns { display: grid; gap: 8px; }
.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.three-columns { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.four-columns { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.mini-title { margin: 4px 0 -2px; font-size: 11px; color: var(--accent); font-weight: 850; letter-spacing: .02em; }
.mini-title.separated { margin-top: 9px; padding-top: 12px; border-top: 1px solid var(--line); }
.help-text { margin: 0; color: var(--muted); font-size: 10.5px; line-height: 1.55; }

.workspace { min-width: 0; display: grid; gap: 14px; }
.preview-card, .export-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(14, 18, 30, .88);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.preview-toolbar { min-height: 50px; padding: 7px 10px; display: flex; justify-content: space-between; gap: 10px; align-items: center; border-bottom: 1px solid var(--line); }
.time-readout { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.canvas-stage {
  position: relative;
  margin: 14px;
  border-radius: 14px;
  overflow: hidden;
  background: #03050a;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .45), inset 0 0 0 1px rgba(255,255,255,.08);
}
.canvas-stage canvas { display: block; width: 100%; height: auto; max-height: calc(100vh - 280px); object-fit: contain; }
.canvas-tip {
  position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%);
  max-width: calc(100% - 30px); padding: 6px 10px; border-radius: 999px;
  background: rgba(6, 9, 16, .76); border: 1px solid rgba(255,255,255,.12); backdrop-filter: blur(10px);
  color: #cbd6e9; font-size: 10px; text-align: center; pointer-events: none; opacity: .86;
}
.scrub-row { padding: 0 14px 13px; }
.scrub-row input { display: block; }

.export-card { padding: 17px; }
.export-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 14px; }
.export-heading h2 { font-size: 18px; margin: 0 0 4px; }
.export-heading p { margin: 0; font-size: 11px; color: var(--muted); line-height: 1.5; }
.export-options { display: flex; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.export-options label { display: grid; gap: 3px; min-width: 92px; }
.export-options select { min-height: 31px; font-size: 11px; }
.export-buttons { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.format-button { min-height: 76px; border-radius: 13px; padding: 12px; display: grid; align-content: center; text-align: left; gap: 4px; overflow: hidden; position: relative; }
.format-button::after { content: ""; position: absolute; width: 80px; height: 80px; border-radius: 50%; right: -35px; bottom: -45px; background: currentColor; opacity: .08; }
.format-button strong { font-size: 14px; }
.format-button span { font-size: 10px; color: var(--muted); }
.format-button:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(0,0,0,.28); }
.format-button.apng { color: #80ddff; background: linear-gradient(145deg, rgba(51, 166, 255, .14), rgba(22, 30, 50, .9)); }
.format-button.webp { color: #84f0be; background: linear-gradient(145deg, rgba(51, 220, 147, .13), rgba(22, 30, 50, .9)); }
.format-button.gif { color: #ffd17a; background: linear-gradient(145deg, rgba(255, 179, 61, .14), rgba(22, 30, 50, .9)); }
.format-button.html { color: #c8a8ff; background: linear-gradient(145deg, rgba(161, 94, 255, .15), rgba(22, 30, 50, .9)); }
.format-button:disabled, .button:disabled { opacity: .48; cursor: not-allowed; transform: none; }
.compatibility-note { margin: 12px 0 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.export-progress { margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #0c111e; display: grid; grid-template-columns: 1fr auto; gap: 8px 10px; align-items: center; }
.export-progress[hidden] { display: none; }
.progress-copy { display: flex; justify-content: space-between; gap: 10px; grid-column: 1 / -1; font-size: 11px; color: #cad5e9; }
.progress-track { height: 7px; border-radius: 99px; background: #20283a; overflow: hidden; }
.progress-track > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .12s linear; }

.player-list, .character-list { display: grid; gap: 8px; }
.player-row {
  display: grid; gap: 8px;
  padding: 9px; border: 1px solid var(--line); border-radius: 11px; background: #101625;
}
.player-row.is-editing { border-color: var(--player-color); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--player-color) 42%, transparent), 0 0 22px color-mix(in srgb, var(--player-color) 12%, transparent); }
.player-row-head { display: grid; grid-template-columns: 42px 34px minmax(0, 1fr); gap: 7px; align-items: end; }
.player-tag { align-self: center; font-size: 12px; font-weight: 900; color: var(--player-color); cursor: pointer; }
.player-row input[type="color"] { height: 30px; padding: 2px; }
.player-row select { min-height: 30px; font-size: 10px; }
.player-inline-field { min-width: 0; display: grid; gap: 3px; color: var(--muted); font-size: 8px; font-weight: 800; }
.player-inline-field > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-route-settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; padding-top: 7px; border-top: 1px solid var(--line); }
.player-route-summary { min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 7px; padding: 7px 8px; border-radius: 8px; background: #0b101c; color: var(--muted); font-size: 8px; line-height: 1.45; }
.player-route-summary span { white-space: nowrap; font-weight: 800; }
.player-route-summary strong { min-width: 0; color: #d9e4f6; font-size: 9px; font-weight: 750; overflow-wrap: anywhere; }
.player-route-tools { display: flex; flex-wrap: wrap; gap: 5px; }
.route-button, .mini-route-button { border: 1px solid var(--line); background: #182136; color: #cdd9ed; }
.route-button { min-height: 27px; padding: 0 8px; border-radius: 7px; font-size: 8px; font-weight: 800; }
.route-button:hover:not(:disabled), .mini-route-button:hover:not(:disabled) { border-color: var(--player-color); color: #fff; }
.route-button:disabled, .mini-route-button:disabled { opacity: .42; cursor: not-allowed; }
.player-path-editor { display: grid; gap: 5px; }
.player-route-empty { padding: 7px 8px; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); font-size: 8px; line-height: 1.45; }
.player-waypoint-row { display: grid; grid-template-columns: 43px minmax(0, 1fr) 25px 25px 25px; align-items: center; gap: 4px; }
.waypoint-label { color: var(--muted); font-size: 8px; font-weight: 800; }
.mini-route-button { width: 25px; height: 25px; padding: 0; border-radius: 6px; font-size: 9px; }
.mini-route-button.remove { color: #ff91a3; }

.character-section-body { padding-left: 10px; padding-right: 10px; }
.character-card { border: 1px solid var(--line); border-radius: 12px; background: #101625; padding: 8px; display: grid; gap: 8px; }
.character-main { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.character-thumb { width: 48px; height: 48px; border-radius: 9px; object-fit: cover; background: #080b12; border: 1px solid var(--line); }
.character-name { min-height: 30px !important; font-size: 11px; }
.character-meta { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; min-height: 16px; }
.assignment-dot { display: inline-flex; align-items: center; justify-content: center; min-width: 23px; height: 16px; padding: 0 4px; border-radius: 999px; color: #071017; font-size: 8px; font-weight: 950; background: var(--dot-color); }
.character-actions { display: grid; grid-template-columns: repeat(2, 25px); gap: 4px; }
.character-actions button { width: 25px; height: 25px; border-radius: 7px; border: 1px solid var(--line); color: #cad5ea; background: #1a2234; padding: 0; font-size: 11px; }
.character-actions .remove { color: #ff8ca0; }
.character-tuning { display: grid; gap: 5px; padding-top: 6px; border-top: 1px solid var(--line); }
.tune-row { display: grid; grid-template-columns: 52px minmax(0, 1fr) 38px; align-items: center; gap: 6px; font-size: 9px; color: var(--muted); }
.tune-row output { text-align: right; color: #d6e0f1; font-variant-numeric: tabular-nums; }
.empty-list { padding: 22px 12px; text-align: center; border: 1px dashed var(--line-strong); border-radius: 12px; color: var(--muted); font-size: 11px; line-height: 1.55; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(3, 5, 10, .76); backdrop-filter: blur(12px); }
.modal-backdrop[hidden] { display: none; }
.modal { width: min(980px, 100%); max-height: calc(100vh - 40px); border: 1px solid var(--line-strong); border-radius: 18px; background: #111726; box-shadow: 0 30px 100px rgba(0,0,0,.62); display: grid; grid-template-rows: auto auto minmax(240px, 1fr) auto; overflow: hidden; }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px; border-bottom: 1px solid var(--line); }
.modal-header h2 { margin: 0 0 3px; font-size: 17px; }
.modal-header p { margin: 0; font-size: 11px; color: var(--muted); }
.modal-note { padding: 10px 16px; background: rgba(117, 226, 255, .07); color: #c9d6ea; font-size: 11px; line-height: 1.55; }
.modal textarea { margin: 14px 16px; width: calc(100% - 32px); min-height: 280px; resize: vertical; font: 11px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: #d9e8ff; background: #080c15; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; padding: 0 16px 16px; }
.toast-region { position: fixed; right: 18px; bottom: 18px; z-index: 150; display: grid; gap: 8px; pointer-events: none; }
.toast { min-width: 220px; max-width: 360px; padding: 11px 13px; border-radius: 11px; background: rgba(21, 28, 44, .96); border: 1px solid var(--line-strong); color: #eaf1ff; box-shadow: var(--shadow); font-size: 11px; animation: toast-in .2s ease both; }
.toast.error { border-color: rgba(255, 111, 136, .5); color: #ffc3ce; }
.toast.success { border-color: rgba(121, 240, 187, .45); color: #c9ffe7; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }


/* Guided editor: one task at a time, alongside a persistent preview. */
[hidden] { display: none !important; }
body { background: var(--bg); }
button, input, select, summary { -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: not-allowed; opacity: .4; }
.topbar { position: static; min-height: 80px; padding: 16px 30px; background: #11171b; backdrop-filter: none; }
.brand-mark { width: 42px; height: 42px; border-radius: 12px; background: #bdf4de; color: #1f4940; box-shadow: none; }
.brand-mark svg { width: 31px; height: 31px; }
.brand-block h1 { font-size: 16px; font-weight: 750; letter-spacing: -.4px; }
.brand-block h1 span { font-weight: 400; color: var(--muted); margin-left: 5px; }
.brand-block p { font-size: 11px; margin-top: 6px; }
.button, .icon-button, .chip, .file-button { background: #202a30; box-shadow: none; border-color: #354248; }
.button:hover, .icon-button:hover, .chip:hover, .file-button:hover { background: #2c3b40; border-color: #769c90; }
.button.secondary { background: #213a32; border-color: #476b5d; color: #bdf4de; }
.button.ghost { color: #bec9cb; }
.studio { max-width: 1620px; margin: auto; padding: 28px 30px 40px; }
.workflow-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 20px; padding: 5px; gap: 5px; border: 1px solid #293237; border-radius: 13px; background: #141a1f; }
.workflow-tabs button { display: flex; align-items: center; gap: 14px; text-align: left; padding: 13px 20px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: #9daab0; cursor: pointer; }
.workflow-tabs button:hover { background: #202a2e; }
.workflow-tabs button[aria-selected="true"] { background: #263b34; color: #d7f9e9; border-color: #466557; }
.step-number { font: 13px ui-monospace, monospace; color: #81938e; }
.workflow-tabs [aria-selected="true"] .step-number { color: #a5ebce; }
.workflow-tabs strong { display: block; font-size: 13px; font-weight: 700; }
.workflow-tabs small { display: block; font-size: 10px; color: #9cacac; margin-top: 4px; }
.app-shell { grid-template-columns: 380px minmax(0, 1fr); gap: 22px; padding: 0; margin: 0; }
.editor-panel { min-width: 0; border: 1px solid #2a353a; border-radius: 14px; background: #151c21; overflow: hidden; }
.editor-page { padding: 20px; outline-offset: -3px; }
.editor-heading { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-bottom: 19px; }
.editor-heading h2 { margin: 0 0 7px; font-size: 18px; letter-spacing: -.5px; }
.editor-heading p { margin: 0; color: #a4b0b6; font-size: 11px; line-height: 1.7; }
.count-badge { flex-shrink: 0; padding: 5px 9px; border-radius: 7px; background: #273630; color: #bdebd7; font-size: 12px; font-weight: 700; }
.drop-zone { padding: 18px 10px; min-height: 156px; gap: 7px; border-color: #507e6c; border-radius: 11px; background: #1b2b27; }
.drop-zone:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.drop-zone:hover, .drop-zone.is-dragging { border-color: var(--accent); background: #253d33; }
.drop-icon { width: 35px; height: 35px; border-radius: 10px; background: #2a483b; display: grid; place-items: center; margin-bottom: 3px; font-size: 25px; }
.drop-zone strong { font-size: 13px; color: #d3f4e5; }
.drop-zone > span:not(.drop-icon) { font-size: 11px; color: #b2c3bf; }
.drop-zone small { font-size: 9px; color: #90a39b; }
.upload-help { margin: 12px 1px 23px; font-size: 11px; line-height: 1.7; }
.upload-help strong { color: #c6ded3; font-weight: 500; }
.list-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 11px; gap: 8px; }
.list-heading h3 { font-size: 12px; margin: 0; }
.list-heading span { font-size: 10px; color: #91a0a6; }
.character-list { gap: 10px; }
.character-card { border-color: #303b41; background: #1b242a; padding: 12px; border-radius: 11px; gap: 10px; }
.character-main { grid-template-columns: 50px minmax(0, 1fr); gap: 10px; }
.character-thumb { width: 50px; height: 50px; border-radius: 8px; }
.character-info { min-width: 0; }
.character-name { width: 100%; min-width: 0; min-height: 30px; padding: 4px 7px; border-radius: 6px; border: 1px solid #465159; background: #141c21; color: #e4edef; font-size: 12px; }
.character-meta { margin-top: 5px; min-height: 16px; align-items: center; }
.character-position { color: #94a6ad; font-size: 10px; margin-right: 3px; }
.assignment-dot { font-size: 9px; border-radius: 4px; height: 17px; }
.character-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.replace-image-button { min-height: 32px; padding: 0 11px; border: 1px solid #536d63; border-radius: 7px; background: #253b33; color: #ceefdf; font-size: 11px; cursor: pointer; }
.replace-image-button:hover { border-color: #a5ebce; background: #31503f; }
.character-actions { display: flex; gap: 5px; }
.character-actions button { width: 28px; height: 30px; font-size: 13px; border-color: #38464e; background: #202e36; }
.character-actions button:hover { border-color: #97bdad; }
.character-adjustments { border-top: 1px solid var(--line); padding-top: 1px; }
.character-adjustments summary { font-size: 10px; color: #a6b5bb; padding: 7px 0 0; cursor: pointer; }
.character-adjustments .character-tuning { border: 0; padding-top: 11px; gap: 11px; }
.tune-row { font-size: 10px; grid-template-columns: 58px minmax(0,1fr) 42px; }
.list-management { padding-top: 17px; color: #8f9ca2; font-size: 11px; }
.list-management summary { cursor: pointer; }
.list-management .inline-actions { padding-top: 12px; }
.next-step { display: flex; width: 100%; justify-content: space-between; align-items: center; margin-top: 22px; background: #c0eed9; border-color: #c0eed9; color: #19392a; min-height: 43px; }
.next-step:hover { background: #a5e7c9; border-color: #a5e7c9; }
.editor-page .panel-section { margin: 0 -20px; padding: 0 6px; border-color: #2a353a; }
.panel-section summary { min-height: 54px; font-size: 12px; }
.panel-section > .section-body { padding-top: 3px; padding-bottom: 21px; gap: 14px; }
.panel-section summary::before { margin-right: 0; }
.field > span, .field-label { font-size: 11px; color: #bdcbd0; }
.field input[type="text"], .field input[type="number"], select, textarea, input[type="color"] { background: #10181d; border-color: #39484f; }
.mini-title { color: #c1ddcf; }
.help-text { color: #9baeb5; line-height: 1.7; }
.workspace { position: sticky; top: 20px; gap: 15px; }
.preview-card { border-color: #303d42; background: #151d22; border-radius: 14px; }
.preview-heading { padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid #29363c; }
.preview-heading > div { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.preview-heading h2 { font-size: 13px; margin: 0; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: #a6e9c9; }
.dimension-badge { padding: 4px 6px; border: 1px solid #32434a; border-radius: 4px; color: #92a6af; font: 10px ui-monospace, monospace; }
.canvas-stage { display: flex; justify-content: center; margin: 18px; border-radius: 8px; box-shadow: none; background: #0a1015; }
.canvas-stage canvas { max-height: clamp(240px, calc(100dvh - 430px), 600px); max-width: 100%; width: auto; height: auto; }
.preview-targets { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0 18px 16px; padding-bottom: 15px; border-bottom: 1px solid #2a353a; }
.preview-targets > span { font-size: 10px; color: #a9b9bf; margin-right: 4px; }
.preview-player-buttons { display: flex; gap: 5px; }
.preview-player-buttons button { padding: 5px 9px; border: 1px solid #3a4850; color: #9cadb5; border-radius: 5px; background: transparent; font-size: 11px; cursor: pointer; }
.preview-player-buttons button[aria-pressed="true"] { background: color-mix(in srgb, var(--player-color) 12%, transparent); color: var(--player-color); border-color: var(--player-color); }
.canvas-tip { position: static; transform: none; max-width: none; margin: 0 0 0 4px; padding: 0; background: transparent; border: 0; backdrop-filter: none; font-size: 10px; text-align: left; color: #94a7ae; opacity: 1; }
.preview-toolbar { min-height: 42px; margin: 0 18px; padding: 0; border: 0; }
.play-button { background: #b8ebd3; color: #17392b; border: 0; min-width: 96px; font-size: 12px; }
.play-button:hover { background: #a5e7c9; }
.time-readout { color: #9bafb8; font-size: 10px; }
.scrub-row { padding: 12px 18px 18px; }
.timeline-labels { display: flex; justify-content: space-between; font-size: 9px; color: #81979f; padding-top: 5px; }
.workspace-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.workspace-footer > span { font-size: 11px; color: #84999f; }
.quick-guide { display: flex; align-items: flex-start; gap: 12px; padding: 17px 18px; background: #19231f; border: 1px solid #304236; border-radius: 11px; }
.guide-icon { color: #aacabc; font-size: 18px; }
.quick-guide h3 { font-size: 12px; color: #c3ddce; font-weight: 600; margin: 0 0 7px; }
.quick-guide p { color: #99b0a5; font-size: 11px; line-height: 1.8; margin: 0; }
.player-row { padding: 12px; gap: 12px; background: #192329; border-color: #34434b; }
.player-row.is-editing { border-color: color-mix(in srgb, var(--player-color) 55%, #34434b); box-shadow: none; }
.player-row-head { grid-template-columns: 36px 30px minmax(0, 1fr); }
.player-tag { border: 0; padding: 5px 0; text-align: left; background: none; }
.player-row select { min-height: 34px; font-size: 11px; }
.player-inline-field { font-size: 10px; gap: 6px; }
.player-route-details > summary { min-height: 0; padding: 3px 0; font-size: 11px; color: #a8bac2; justify-content: flex-start; gap: 8px; }
.player-route-details[open] > summary { margin-bottom: 12px; }
.player-route-settings { border: 0; padding: 0; }
.player-route-content { display: grid; gap: 12px; }
.player-route-summary { font-size: 10px; background: #111c22; }
.player-route-summary strong, .player-route-empty { font-size: 10px; line-height: 1.65; }
.route-button { font-size: 10px; min-height: 32px; }
.waypoint-label { font-size: 9px; }
.export-card { border: 0; padding: 0; border-radius: 0; background: none; box-shadow: none; overflow: visible; }
.export-heading { display: flex; flex-direction: column; gap: 20px; }
.export-heading h3 { font-size: 12px; margin: 0 0 8px; }
.export-options { justify-content: flex-start; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; gap: 8px; }
.export-options label { min-width: 0; gap: 6px; }
.export-options select { min-height: 36px; }
.export-buttons { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 20px; }
.format-button { min-height: 104px; padding: 14px; gap: 10px; }
.format-button strong { font-size: 13px; }
.format-button::after { display: none; }
.compatibility-note { font-size: 11px; line-height: 1.8; margin-top: 20px; }
.export-help { border-top: 1px solid #304039; margin-top: 22px; padding-top: 19px; font-size: 11px; color: #a5b7b0; }
.export-help p { line-height: 1.8; margin-bottom: 0; }
@media (min-width: 1500px) { .app-shell { grid-template-columns: 410px minmax(0, 1fr); } }
@media (max-width: 1100px) {
  .studio { padding: 24px 20px 35px; }
  .topbar { padding: 14px 20px; }
  .app-shell { grid-template-columns: 340px minmax(0, 1fr); gap: 16px; }
  .workflow-tabs button { padding: 12px; gap: 10px; }
  .preview-toolbar { align-items: flex-start; flex-wrap: wrap; gap: 10px; }
  .preview-heading { flex-wrap: wrap; }
  .canvas-tip { flex-basis: 100%; margin-left: 0; }
  .brand-block h1 span { display: none; }
}
@media (max-width: 800px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .workspace { position: static; grid-row: 1; }
  .editor-panel { grid-row: 2; }
  .studio { padding: 20px 14px 30px; }
.workflow-tabs { position: sticky; top: 0; z-index: 15; gap: 3px; margin-bottom: 14px; }
  .workflow-tabs button { justify-content: center; padding: 12px 4px; gap: 7px; }
  .workflow-tabs small { display: none; }
  .workflow-tabs strong { font-size: 12px; }
  .step-number { font-size: 10px; }
  .quick-guide { display: none; }
  .workspace-footer { margin-bottom: 4px; }
  .editor-panel { scroll-margin-top: 70px; }
  .canvas-stage { margin: 14px; }
  .canvas-stage canvas { max-height: 55dvh; }
  .preview-targets { margin-bottom: 12px; }
  .canvas-tip { flex-basis: auto; }
  .character-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .topbar { flex-wrap: wrap; padding: 14px; gap: 14px; }
  .brand-block h1 span { display: inline; font-size: 12px; }
  .top-actions { width: 100%; gap: 6px; }
  .top-actions .button { padding: 0 9px; min-height: 32px; font-size: 11px; }
.workflow-tabs button { flex-direction: column; gap: 5px; padding: 8px 2px; }
  .workflow-tabs strong { font-size: 11px; }
  .editor-page { padding: 17px; }
  .editor-page .panel-section { margin: 0 -17px; padding: 0 3px; }
  .character-list { grid-template-columns: minmax(0, 1fr); }
  .preview-heading { padding: 12px; gap: 8px; }
  .preview-heading h2 { font-size: 12px; }
  .preview-heading .button { padding: 0 7px; font-size: 10px; }
  .canvas-stage { margin: 10px; }
  .preview-targets { margin: 0 12px 12px; padding-bottom: 12px; }
  .canvas-tip { flex-basis: 100%; font-size: 10px; margin: 0; }
  .preview-toolbar { margin: 0 12px; gap: 9px; }
  .preview-toolbar .toolbar-group { gap: 6px; }
  .play-button { min-width: 92px; min-height: 36px; }
  .preview-toolbar > .button { width: 100%; text-align: left; padding-left: 0; }
  .scrub-row { padding: 4px 12px 15px; }
  .workspace-footer > span { max-width: 175px; line-height: 1.6; font-size: 10px; }
  .workspace-footer .button { white-space: nowrap; }
  .four-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .modal-backdrop { padding: 10px; }
  .modal { max-height: calc(100dvh - 20px); }
  .modal-actions { flex-wrap: wrap; }
.toast-region { left: 14px; right: 14px; bottom: 14px; }
  .toast { max-width: 100%; min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* Application chrome uses its own theme; canvas output keeps the project colors. */
:root { color-scheme: dark; }
.brand-title { display: flex; align-items: baseline; gap: 7px 13px; flex-wrap: wrap; }
.brand-title h1 { margin-bottom: 0; }
.brand-title h1 span { display: inline; }
.creator-link { color: #a6d8c1; text-decoration: none; font-size: 12px; white-space: nowrap; }
.creator-link:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.creator-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 3px; }
.creator-link > span { opacity: .65; }
.theme-toggle { white-space: nowrap; }
.video-note { color: var(--muted); font-size: 11px; line-height: 1.8; margin: 17px 0 0; }
.format-button.mp4 { color: #9ecbff; background: #1b2e44; }
.format-button.avi { color: #d6b7ff; background: #2b2440; }
input:disabled, select:disabled { opacity: .6; cursor: not-allowed; }
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f2f5f3;
  --panel: #ffffff;
  --panel-2: #f3f6f4;
  --panel-3: #edf2ef;
  --line: rgba(20, 57, 40, .12);
  --line-strong: rgba(20, 57, 40, .24);
  --text: #213b30;
  --muted: #617469;
  --accent: #247651;
  --accent-2: #5a9176;
  --danger: #b02c4a;
  --success: #257a53;
  --shadow: 0 8px 24px rgba(24, 62, 41, .06);
}
html[data-theme="light"] :is(.topbar, .editor-panel, .preview-card, .workflow-tabs, .modal) { background: #fff; border-color: #d4dfd8; }
html[data-theme="light"] :is(.button, .icon-button, .chip, .file-button, .route-button, .mini-route-button) { color: #304a3d; background: #f0f5f2; border-color: #bdcec3; }
html[data-theme="light"] :is(.button, .icon-button, .chip, .file-button, .route-button, .mini-route-button):hover { background: #e1eee6; border-color: #7b9e87; }
html[data-theme="light"] .button.ghost { background: transparent; }
html[data-theme="light"] :is(.button.secondary, .replace-image-button) { background: #e4f3e9; color: #266243; border-color: #a1c5ae; }
html[data-theme="light"] :is(.play-button, .next-step) { background: #276d4d; border-color: #276d4d; color: #fff; }
html[data-theme="light"] :is(.play-button, .next-step):hover { background: #1c563b; border-color: #1c563b; }
html[data-theme="light"] .creator-link { color: #286d4a; }
html[data-theme="light"] :is(.workflow-tabs button, .workflow-tabs small, .step-number) { color: #65786d; }
html[data-theme="light"] .workflow-tabs button:hover { background: #f1f6f3; }
html[data-theme="light"] .workflow-tabs button[aria-selected="true"] { background: #e2f0e7; color: #245b3d; border-color: #b5d1bd; }
html[data-theme="light"] .workflow-tabs [aria-selected="true"] .step-number { color: #3c7b54; }
html[data-theme="light"] :is(.editor-heading p, .help-text, .list-heading span, .list-management, .character-position, .character-adjustments summary, .dimension-badge, .preview-targets > span, .canvas-tip, .time-readout, .timeline-labels, .workspace-footer > span, .export-help, .player-inline-field, .player-route-details > summary) { color: #596e62; }
html[data-theme="light"] :is(.upload-help strong, .mini-title, .field > span, .field-label, .check-field, .export-options label span, .tune-row output) { color: #3a5a47; }
html[data-theme="light"] .drop-zone { background: #f1f8f3; border-color: #8bb198; }
html[data-theme="light"] :is(.drop-zone:hover, .drop-zone.is-dragging) { background: #e3f1e8; border-color: #447e58; }
html[data-theme="light"] .drop-icon { background: #dceee2; color: #34764d; }
html[data-theme="light"] .drop-zone strong { color: #2a593d; }
html[data-theme="light"] .drop-zone > span:not(.drop-icon) { color: #4e6e58; }
html[data-theme="light"] .drop-zone small { color: #687d6f; }
html[data-theme="light"] :is(.count-badge, .quick-guide) { background: #e8f1e9; border-color: #c1d6c5; color: #45674e; }
html[data-theme="light"] :is(.quick-guide h3, .guide-icon) { color: #3c6146; }
html[data-theme="light"] .quick-guide p { color: #5b7763; }
html[data-theme="light"] :is(.character-card, .player-row) { background: #f6f9f7; border-color: #d5dfd8; }
html[data-theme="light"] :is(.field input[type="text"], .field input[type="number"], select, textarea, input[type="color"], .character-name) { background: #fff; color: #263e30; border-color: #bfcfc3; }
html[data-theme="light"] .character-actions button { background: #edf3ef; color: #486550; border-color: #c9d7cd; }
html[data-theme="light"] :is(.button.danger, .character-actions .remove, .mini-route-button.remove) { color: #b3344c; }
html[data-theme="light"] :is(.panel-section, .editor-page .panel-section, .preview-heading, .preview-targets, .export-help) { border-color: #d8e2db; }
html[data-theme="light"] .canvas-stage { background: #dfe7e2; }
html[data-theme="light"] .live-dot { background: #418356; }
html[data-theme="light"] .dimension-badge { border-color: #d0ddd4; }
html[data-theme="light"] .preview-player-buttons button { color: #566d5e; border-color: #b8cabc; }
html[data-theme="light"] .preview-player-buttons button[aria-pressed="true"] { color: color-mix(in srgb, var(--player-color) 30%, #183b27); border-color: color-mix(in srgb, var(--player-color) 35%, #48644f); }
html[data-theme="light"] .player-tag { color: color-mix(in srgb, var(--player-color) 35%, #183b27); }
html[data-theme="light"] .player-row.is-editing { border-color: color-mix(in srgb, var(--player-color) 35%, #48644f); }
html[data-theme="light"] .player-route-summary { background: #eaf0ed; color: #607366; }
html[data-theme="light"] .player-route-summary strong { color: #364e3d; }
html[data-theme="light"] .format-button { background: #eef5f1; color: #335c46; border-color: #c5d6ca; }
html[data-theme="light"] .format-button.apng { background: #edf5fa; color: #36637d; }
html[data-theme="light"] .format-button.webp { background: #edf6ef; color: #356b43; }
html[data-theme="light"] .format-button.gif { background: #faf4e8; color: #846333; }
html[data-theme="light"] .format-button.html { background: #f4f0fa; color: #70578e; }
html[data-theme="light"] .format-button.mp4 { background: #eef2fa; color: #466798; }
html[data-theme="light"] .format-button.avi { background: #f4eef7; color: #76518b; }
html[data-theme="light"] .export-progress { background: #edf4ef; }
html[data-theme="light"] .progress-copy { color: #385943; }
html[data-theme="light"] .progress-track { background: #cdded2; }
html[data-theme="light"] .modal-backdrop { background: rgba(29, 48, 38, .4); }
html[data-theme="light"] .modal-note { background: #eef5f0; color: #4f6b58; }
html[data-theme="light"] .modal textarea { background: #f6f9f7; color: #314f3c; }
html[data-theme="light"] .toast { background: #fff; color: #354d3d; border-color: #bdcec1; }
html[data-theme="light"] .toast.success { color: #27613c; border-color: #7aac8a; }
html[data-theme="light"] .toast.error { color: #9a2a42; border-color: #d39da8; }
@media (max-width: 560px) {
  .brand-title { gap: 6px 10px; }
  .brand-title h1 { font-size: 14px; }
  .brand-title h1 span { font-size: 12px; }
  .creator-link { font-size: 11px; }
  .top-actions { row-gap: 9px; }
  .theme-toggle { margin-left: auto; }
}

.single-player-settings { display: grid; gap: 11px; padding: 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--panel-2); }
.composition-presets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.composition-preset { display: grid; justify-items: center; gap: 5px; min-width: 0; padding: 10px 7px; color: var(--muted); background: var(--panel-2); border: 1px solid var(--line-strong); border-radius: 10px; cursor: pointer; }
.composition-preset svg { width: 100%; max-width: 120px; height: 66px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.composition-preset .diagram-main { fill: currentColor; fill-opacity: .12; }
.composition-preset strong { font-size: 10.5px; color: var(--text); }
.composition-preset small { font-size: 10px; }
.composition-preset:hover, .composition-preset[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }
.main-panel-settings { display: grid; gap: 12px; }
.main-grid-settings { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--line-strong); border-radius: 10px; }
.main-grid-settings input[readonly] { color: var(--muted); background: transparent; border-style: dashed; }
.main-panel-adjustments { border-top: 1px solid var(--line); padding-top: 10px; }
.main-panel-adjustments > summary { display: flex; justify-content: flex-start; gap: 8px; color: var(--muted); font-size: 11px; cursor: pointer; }
.main-panel-adjustments .section-body { padding: 12px 0 0; }
html[data-theme="light"] .composition-preset { background: #f4f8f5; color: #5a7965; border-color: #c4d4c9; }
html[data-theme="light"] .composition-preset:hover, html[data-theme="light"] .composition-preset[aria-pressed="true"] { color: #28643f; background: #e4f1e8; border-color: #74a283; }
.number-with-unit { display: flex; align-items: center; gap: 9px; }
.number-with-unit input { max-width: 120px; }
.number-with-unit > span { font-weight: 700; color: var(--muted); }
.chip[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }
html[data-theme="light"] .chip[aria-pressed="true"] { color: #225e3e; background: #deefe4; border-color: #71a182; }
.character-thumb, .canvas-stage.is-transparent, html[data-theme="light"] .canvas-stage.is-transparent {
  background-color: #cbd2cf;
  background-image: linear-gradient(45deg, #e6eae8 25%, transparent 25%, transparent 75%, #e6eae8 75%), linear-gradient(45deg, #e6eae8 25%, transparent 25%, transparent 75%, #e6eae8 75%);
  background-size: 16px 16px;
  background-position: 0 0, 8px 8px;
}

/* Player display names share the same identity across settings and previews. */
.player-row-head { grid-template-columns: minmax(55px, .7fr) 30px minmax(0, 1fr); }
.player-tag { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-label-input { font-size: 12px; }
.border-presets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.border-preset { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 2px; border-radius: 10px; font-size: 11px; }
.border-sample { display: block; width: 36px; height: 25px; border: 2px solid currentColor; border-radius: 5px; }
.border-sample.dashed { border-style: dashed; }
.border-sample.double { border-width: 4px; border-style: double; }
.border-sample.corners { border: 0; border-radius: 0; background: linear-gradient(currentColor,currentColor) left top/12px 2px, linear-gradient(currentColor,currentColor) left top/2px 9px, linear-gradient(currentColor,currentColor) right top/12px 2px, linear-gradient(currentColor,currentColor) right top/2px 9px, linear-gradient(currentColor,currentColor) left bottom/12px 2px, linear-gradient(currentColor,currentColor) left bottom/2px 9px, linear-gradient(currentColor,currentColor) right bottom/12px 2px, linear-gradient(currentColor,currentColor) right bottom/2px 9px; background-repeat: no-repeat; }
.selection-issue { padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--panel-2); color: var(--text); font-size: 12px; line-height: 1.6; }
.selection-issue p { margin: 0 0 8px; }
.assignment-dot { display: inline-block; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; line-height: 17px; }
.preview-player-buttons { flex-wrap: wrap; min-width: 0; max-width: 100%; max-height: 120px; overflow-y: auto; }
.preview-player-buttons button { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#selectionModeBadge { max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#singlePlayerSettings .chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#timelineModeLabel { max-width: 75%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html[data-theme="light"] .canvas-stage.is-transparent { background-color: #cbd2cf; }
