:root {
    --bg: #090a0c;
    --panel: rgba(16, 18, 24, .92);
    --line: #2a3444;
    --line-strong: #3f5067;
    --ink: #f1f4f8;
    --muted: #9ca9ba;
    --dim: #6f7c8e;
    --mint: #58d6b5;
    --amber: #f1be63;
    --rose: #ff7f9c;
    --blue: #8bbcff;
    --radius: 8px;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: Inter, "Pretendard", "Segoe UI", system-ui, sans-serif; overflow-x: hidden; }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
[v-cloak] { display: none; }
#tool-p5 { position: fixed; inset: 0; z-index: -1; background: radial-gradient(circle at 18% 12%, rgba(88, 214, 181, .12), transparent 34%), #090a0c; }
#tool-p5 canvas { display: block; width: 100% !important; height: 100% !important; }
.tool-layout { min-height: 100vh; display: grid; grid-template-rows: auto auto 1fr auto; gap: 14px; padding: 22px; }
.tool-header, .option-strip, .workbench, .action-bar { width: min(1680px, 100%); margin: 0 auto; }
.tool-header { display: flex; align-items: end; justify-content: space-between; gap: 18px; padding: 4px 2px 0; }
.eyebrow { margin: 0 0 8px; color: var(--mint); font-size: 12px; font-weight: 800; letter-spacing: 0; }
h1 { margin: 0; font-size: clamp(32px, 5vw, 56px); line-height: 1; letter-spacing: 0; }
.tool-nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.tool-nav a, .engine-state { min-height: 34px; display: inline-flex; align-items: center; justify-content: center; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(11, 14, 19, .72); color: var(--ink); text-decoration: none; font-size: 12px; font-weight: 800; }
.engine-state { color: var(--amber); }
.engine-state.ready { color: var(--mint); border-color: rgba(88, 214, 181, .42); }
.engine-state.error { color: var(--rose); border-color: rgba(255, 127, 156, .48); }
.option-strip { display: grid; grid-template-columns: minmax(260px, 360px) minmax(340px, 1fr) minmax(120px, 160px); gap: 10px; }
.option-block { min-width: 0; display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.block-label { flex: 0 0 auto; color: var(--muted); font-size: 12px; font-weight: 800; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; width: 100%; }
.segmented button, .check-pill, .counter-row button, .pane-toolbar button, .run-button { border: 1px solid var(--line-strong); border-radius: 7px; background: #151b25; color: var(--ink); cursor: pointer; }
.segmented button { min-height: 36px; padding: 0 10px; font-weight: 800; }
.segmented button.active { background: linear-gradient(135deg, rgba(88, 214, 181, .28), rgba(139, 188, 255, .18)); border-color: rgba(88, 214, 181, .68); }
.integration-block { flex-wrap: wrap; }
.check-pill { min-height: 34px; display: inline-flex; align-items: center; gap: 7px; padding: 0 10px; color: var(--muted); }
.check-pill:has(input:checked) { color: var(--ink); border-color: rgba(241, 190, 99, .62); background: rgba(241, 190, 99, .12); }
.check-pill input { accent-color: var(--amber); }
.seed-block input { width: 100%; min-height: 36px; border: 1px solid var(--line-strong); border-radius: 7px; background: #10141c; color: var(--ink); padding: 0 10px; }
.workbench { min-height: 0; display: grid; grid-template-columns: minmax(260px, 330px) minmax(0, 1fr); gap: 12px; }
.settings-panel, .editor-pane { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); min-width: 0; }
.settings-panel { display: grid; align-content: start; gap: 12px; padding: 12px; max-height: calc(100vh - 220px); overflow: auto; }
.settings-section { display: grid; gap: 8px; padding-bottom: 12px; border-bottom: 1px solid rgba(63, 80, 103, .45); }
.settings-section:last-child { border-bottom: 0; padding-bottom: 0; }
.settings-section h2 { margin: 0; color: var(--ink); font-size: 13px; letter-spacing: 0; }
.toggle-row { min-height: 32px; display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 13px; }
.toggle-row input { accent-color: var(--mint); }
.reserved-area { width: 100%; min-height: 170px; resize: vertical; border: 1px solid var(--line-strong); border-radius: 7px; background: #0d1118; color: var(--ink); padding: 10px; line-height: 1.5; font-family: Consolas, "Segoe UI Emoji", "Apple Color Emoji", monospace; font-size: 12px; }
.reserved-area.short { min-height: 86px; }
.counter-row { min-height: 30px; display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--dim); font-size: 12px; }
.counter-row button { min-height: 28px; padding: 0 9px; font-size: 12px; }
.editor-grid { min-width: 0; min-height: calc(100vh - 220px); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.editor-pane { display: grid; grid-template-rows: auto 1fr; overflow: hidden; }
.pane-toolbar { min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.pane-toolbar strong { font-size: 13px; color: var(--ink); }
.pane-toolbar div { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.pane-toolbar button { min-height: 30px; padding: 0 10px; font-size: 12px; font-weight: 700; }
.pane-toolbar button:disabled, .run-button:disabled { opacity: .48; cursor: not-allowed; }
.editor-pane textarea { width: 100%; min-height: 520px; height: 100%; resize: none; border: 0; outline: none; background: rgba(8, 11, 16, .92); color: var(--ink); padding: 16px; line-height: 1.58; font-family: Consolas, "Cascadia Mono", "Segoe UI Emoji", "Apple Color Emoji", monospace; font-size: 13px; tab-size: 4; }
.result-pane textarea { color: #d9f8ed; }
.action-bar { min-height: 58px; display: grid; grid-template-columns: minmax(220px, 360px) minmax(160px, 1fr) minmax(130px, 180px); align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(10, 13, 18, .92); }
.stats-line { display: flex; flex-wrap: wrap; gap: 8px 14px; color: var(--muted); font-size: 12px; }
.message { min-width: 0; color: var(--dim); overflow-wrap: anywhere; font-size: 13px; }
.message.success { color: var(--mint); }
.message.error { color: var(--rose); }
.run-button { min-height: 40px; padding: 0 18px; background: linear-gradient(135deg, rgba(88, 214, 181, .9), rgba(139, 188, 255, .78)); border-color: rgba(180, 238, 224, .62); color: #07100d; font-weight: 900; }
button:focus-visible, a:focus-visible, textarea:focus-visible, input:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
@media (max-width: 1100px) {
    .tool-layout { padding: 16px; }
    .option-strip, .workbench, .editor-grid, .action-bar { grid-template-columns: 1fr; }
    .settings-panel { max-height: none; }
    .editor-grid { min-height: 0; }
    .editor-pane textarea { min-height: 420px; }
}
@media (max-width: 640px) {
    .tool-layout { padding: 12px; gap: 10px; }
    .tool-header { align-items: start; flex-direction: column; }
    .tool-nav { justify-content: flex-start; }
    .option-block { align-items: stretch; flex-direction: column; }
    .segmented { grid-template-columns: 1fr; }
    .pane-toolbar { align-items: stretch; flex-direction: column; }
    .pane-toolbar div { justify-content: flex-start; }
    .editor-pane textarea { min-height: 360px; font-size: 12px; }
    .action-bar { align-items: stretch; }
    .run-button { width: 100%; }
}