:root {
  color-scheme: light;
  --navy: #10233f;
  --navy-2: #1b365d;
  --ink: #172033;
  --muted: #667085;
  --line: #dce3ed;
  --line-strong: #c8d2e0;
  --panel: #ffffff;
  --surface: #f3f6fa;
  --surface-2: #eaf0f7;
  --accent: #0f766e;
  --accent-2: #0d9488;
  --accent-soft: #e7f7f4;
  --danger: #b42318;
  --shadow-sm: 0 1px 2px rgba(16, 35, 63, .07), 0 1px 4px rgba(16, 35, 63, .05);
  --shadow-md: 0 14px 35px rgba(16, 35, 63, .12);
  --shadow-lg: 0 28px 65px rgba(16, 35, 63, .18);
  --header-height: 68px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--surface); font-size: 14px; line-height: 1.5; }
button, input, textarea, select { font: inherit; color: inherit; }
button, select { cursor: pointer; }
button { border: 0; }
img, svg { display: block; }
a { color: inherit; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.skip-link { position: fixed; z-index: 1000; top: 8px; left: 8px; padding: 9px 14px; color: #fff; background: var(--navy); border-radius: 8px; transform: translateY(-150%); transition: transform .16s ease; }
.skip-link:focus { transform: translateY(0); }

.studio-header {
  position: sticky;
  z-index: 80;
  top: 0;
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 18px;
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 10px rgba(16, 35, 63, .05);
  backdrop-filter: blur(18px);
}
.studio-brand { flex: 0 0 190px; text-decoration: none; }
.studio-brand img { width: 166px; max-height: 38px; object-fit: contain; object-position: left center; }
.project-identity { min-width: 210px; display: grid; gap: 2px; padding-left: 17px; border-left: 1px solid var(--line); }
.project-identity input { width: 210px; padding: 0; font-weight: 720; background: transparent; border: 0; outline: 0; }
.project-identity input:focus { color: var(--accent); }
.save-state { color: var(--muted); font-size: 11px; }
.save-state i { display: inline-block; width: 6px; height: 6px; margin-right: 5px; background: #16a34a; border-radius: 50%; vertical-align: 1px; }
.save-state.is-saving i { background: #f59e0b; }
.header-links { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.header-links a { color: #506178; font-size: 12px; font-weight: 650; text-decoration: none; }
.header-links a:hover { color: var(--accent); }
.header-actions { display: flex; align-items: center; gap: 8px; }

.button, .icon-button, .text-button, .zoom-value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 9px;
  font-weight: 700;
  transition: border-color .16s ease, background .16s ease, color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.button svg, .icon-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.button:hover:not(:disabled), .icon-button:hover:not(:disabled) { transform: translateY(-1px); }
.button-primary { color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 6px 16px rgba(15, 118, 110, .22); }
.button-primary:hover { box-shadow: 0 8px 20px rgba(15, 118, 110, .3); }
.button-secondary { color: var(--navy); background: #fff; border: 1px solid var(--line-strong); box-shadow: var(--shadow-sm); }
.button-secondary:hover { border-color: #aebbcf; background: #f9fbfd; }
.button-ghost { color: #46566d; background: transparent; border: 1px solid transparent; }
.button-ghost:hover { color: var(--navy); background: var(--surface); border-color: var(--line); }
.button-small { min-height: 32px; padding: 0 10px; font-size: 12px; }
.button-block { width: 100%; }
.icon-button { width: 38px; min-width: 38px; padding: 0; color: #52647a; background: #fff; border: 1px solid var(--line); }
.icon-button:disabled { opacity: .38; cursor: not-allowed; }
.text-button { min-height: 30px; padding: 0 4px; color: var(--accent); background: transparent; font-size: 12px; }
.text-button:hover { color: #075f59; }
.text-button.danger { color: var(--danger); }

.studio-shell {
  height: calc(100vh - var(--header-height));
  min-height: 650px;
  display: grid;
  grid-template-columns: 252px minmax(470px, 1fr) 368px;
  overflow: hidden;
}
.preset-sidebar, .inspector { min-width: 0; background: var(--panel); overflow: hidden; }
.preset-sidebar { display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.inspector { display: flex; flex-direction: column; border-left: 1px solid var(--line); }
.sidebar-heading, .panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sidebar-heading { padding: 17px 16px 11px; }
.sidebar-heading h1, .panel-heading h2 { margin: 0; color: var(--navy); font-size: 16px; line-height: 1.25; }
.eyebrow { margin: 0 0 4px; color: var(--accent); font-size: 9px; font-weight: 850; letter-spacing: .18em; text-transform: uppercase; }
.count-badge { min-width: 28px; padding: 4px 8px; color: var(--accent); background: var(--accent-soft); border-radius: 999px; font-size: 11px; font-weight: 800; text-align: center; }
.search-field { position: relative; display: block; margin: 0 12px 10px; }
.search-field svg { position: absolute; z-index: 1; top: 10px; left: 10px; width: 16px; height: 16px; fill: none; stroke: #7a899c; stroke-width: 1.8; }
.search-field input { width: 100%; height: 37px; padding: 0 10px 0 34px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; outline: none; }
.search-field input:focus { background: #fff; border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(13, 148, 136, .1); }
.filter-scroll { display: flex; gap: 6px; padding: 0 12px 10px; overflow-x: auto; scrollbar-width: none; }
.filter-scroll::-webkit-scrollbar { display: none; }
.filter-scroll button { flex: 0 0 auto; padding: 6px 9px; color: #65758b; background: #fff; border: 1px solid var(--line); border-radius: 999px; font-size: 10px; font-weight: 750; }
.filter-scroll button.is-active { color: #fff; background: var(--navy); border-color: var(--navy); }
.preset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-content: start; padding: 0 11px 18px; overflow-y: auto; }
.preset-card { min-width: 0; padding: 8px; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 1px 2px rgba(16, 35, 63, .03); }
.preset-card:hover { border-color: #9db0c8; box-shadow: var(--shadow-sm); }
.preset-card.is-active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(15, 118, 110, .12); }
.preset-thumb { position: relative; height: 54px; display: block; margin-bottom: 7px; overflow: hidden; background: var(--thumb-bg, #f8fafc); border: 1px solid rgba(16, 35, 63, .1); border-radius: 6px; }
.preset-thumb::before { content: ""; position: absolute; inset: 8px; border: 1px solid var(--thumb-accent, var(--accent)); border-radius: 3px; }
.preset-thumb::after { content: ""; position: absolute; top: 17px; right: 14px; left: 14px; height: 3px; background: var(--thumb-accent, var(--accent)); box-shadow: 0 8px 0 rgba(16, 35, 63, .18), 0 15px 0 rgba(16, 35, 63, .1); }
.preset-card strong { display: block; overflow: hidden; color: #2d3b4f; font-size: 10px; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.preset-card small { display: block; margin-top: 2px; overflow: hidden; color: #8793a4; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.empty-presets { grid-column: 1 / -1; padding: 30px 10px; color: var(--muted); text-align: center; }

.canvas-workspace { min-width: 0; display: grid; grid-template-rows: 50px minmax(0, 1fr) 30px; background: #e9eef5; overflow: hidden; }
.canvas-toolbar { display: grid; grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr); align-items: center; gap: 12px; padding: 0 13px; background: rgba(249, 251, 253, .94); border-bottom: 1px solid var(--line); }
.toolbar-group { display: flex; align-items: center; gap: 7px; }
.toolbar-group > label { color: #718096; font-size: 10px; font-weight: 750; text-transform: uppercase; }
.toolbar-group select { height: 31px; padding: 0 27px 0 9px; background: #fff; border: 1px solid var(--line); border-radius: 7px; font-size: 11px; font-weight: 700; }
.toolbar-end { justify-content: flex-end; }
.toolbar-end .icon-button { width: 31px; min-width: 31px; min-height: 31px; height: 31px; border-radius: 7px; }
.segmented-control { display: inline-flex; padding: 2px; background: #e6ebf2; border-radius: 8px; }
.segmented-control button { height: 27px; padding: 0 8px; color: #708096; background: transparent; border-radius: 6px; font-size: 10px; font-weight: 750; }
.segmented-control button.is-active { color: var(--navy); background: #fff; box-shadow: var(--shadow-sm); }
.toolbar-title { min-width: 170px; text-align: center; }
.toolbar-title strong { display: block; max-width: 260px; overflow: hidden; color: var(--navy); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.toolbar-title span { display: block; color: #8390a2; font-size: 9px; }
.zoom-value { min-width: 50px; min-height: 31px; padding: 0 7px; color: #5b6c80; background: #fff; border: 1px solid var(--line); border-radius: 7px; font-size: 10px; }
.toolbar-check { display: flex; align-items: center; gap: 5px; color: #68778b !important; font-size: 9px !important; text-transform: none !important; }
.toolbar-check input { accent-color: var(--accent); }
.canvas-stage { position: relative; display: grid; place-items: center; min-width: 0; min-height: 0; padding: 34px; overflow: auto; }
.canvas-stage::before { content: ""; position: absolute; inset: 0; opacity: .28; pointer-events: none; background-image: radial-gradient(#aeb9c8 1px, transparent 1px); background-size: 18px 18px; }
.canvas-paper { position: relative; z-index: 1; flex: 0 0 auto; line-height: 0; background: #fff; box-shadow: 0 22px 52px rgba(16, 35, 63, .18), 0 3px 10px rgba(16, 35, 63, .12); transition: width .16s ease, height .16s ease; }
.canvas-paper::after { content: ""; position: absolute; inset: -1px; pointer-events: none; border: 1px solid rgba(16, 35, 63, .08); }
#passCanvas { display: block; width: 100%; height: 100%; }
.workspace-status { display: flex; align-items: center; justify-content: space-between; padding: 0 12px; color: #7b899b; background: #f6f8fb; border-top: 1px solid var(--line); font-size: 9px; }
.status-dot { display: inline-block; width: 6px; height: 6px; margin-right: 5px; background: #22c55e; border-radius: 50%; }

.inspector-tabs { display: grid; grid-template-columns: repeat(4, 1fr); min-height: 58px; background: #fbfcfe; border-bottom: 1px solid var(--line); }
.inspector-tabs button { position: relative; display: grid; place-items: center; align-content: center; gap: 3px; color: #718096; background: transparent; font-size: 9px; font-weight: 750; }
.inspector-tabs button::after { content: ""; position: absolute; right: 12px; bottom: 0; left: 12px; height: 2px; background: transparent; border-radius: 3px 3px 0 0; }
.inspector-tabs button.is-active { color: var(--accent); }
.inspector-tabs button.is-active::after { background: var(--accent); }
.inspector-tabs svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.inspector-body { min-height: 0; overflow-y: auto; }
.inspector-panel { padding: 16px 16px 30px; }
.panel-heading { margin-bottom: 14px; }
.panel-help, .microcopy { margin: 0 0 13px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.form-section { margin-bottom: 12px; padding: 13px; background: #fbfcfe; border: 1px solid var(--line); border-radius: 11px; }
.form-section h3 { margin: 0 0 11px; color: var(--navy); font-size: 11px; letter-spacing: .02em; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.form-grid .field-wide { grid-column: 1 / -1; }
.field { display: grid; gap: 5px; margin-bottom: 9px; }
.field:last-child { margin-bottom: 0; }
.field > span { color: #5d6b7f; font-size: 10px; font-weight: 720; }
.field input, .field textarea, .field select {
  width: 100%;
  min-width: 0;
  min-height: 37px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  outline: none;
  resize: vertical;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field textarea { line-height: 1.45; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(13, 148, 136, .1); }
.field input[type="color"] { height: 40px; padding: 4px; cursor: pointer; }
.color-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; padding: 10px 0; border-top: 1px solid var(--line); cursor: pointer; }
.switch-row span { display: grid; gap: 2px; }
.switch-row strong { color: #37475c; font-size: 11px; }
.switch-row small { color: var(--muted); font-size: 9px; }
.switch-row input { position: absolute; opacity: 0; }
.switch-row i { position: relative; width: 36px; height: 20px; flex: 0 0 auto; background: #cbd5e1; border-radius: 999px; transition: background .16s ease; }
.switch-row i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0, 0, 0, .18); transition: transform .16s ease; }
.switch-row input:checked + i { background: var(--accent); }
.switch-row input:checked + i::after { transform: translateX(16px); }

.item-editor-list { display: grid; gap: 10px; margin-bottom: 12px; }
.item-editor { padding: 11px; background: #fbfcfe; border: 1px solid var(--line); border-radius: 10px; }
.item-editor-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.item-editor-head strong { color: var(--navy); font-size: 11px; }
.item-editor-grid { display: grid; grid-template-columns: 1.7fr 1fr .55fr .6fr; gap: 6px; }
.item-editor-grid label { display: grid; gap: 3px; color: var(--muted); font-size: 8px; font-weight: 720; }
.item-editor-grid input, .item-editor-grid select { width: 100%; min-width: 0; height: 32px; padding: 0 7px; background: #fff; border: 1px solid var(--line); border-radius: 6px; outline: none; font-size: 10px; }
.item-editor-grid .item-condition { grid-column: 1 / -1; }

.upload-row { display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 9px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.upload-row:last-of-type { border-bottom: 0; }
.upload-icon { width: 36px; height: 36px; display: grid; place-items: center; color: var(--accent); background: var(--accent-soft); border-radius: 9px; }
.upload-icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.upload-row > div:nth-child(2) { display: grid; min-width: 0; }
.upload-row strong { color: #34445a; font-size: 10px; }
.upload-row small { color: var(--muted); font-size: 8px; }
.upload-row .danger { grid-column: 3; min-height: 22px; }
.theme-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-bottom: 12px; }
.theme-button { min-width: 0; display: grid; gap: 5px; padding: 7px; color: #5d6d81; background: #fff; border: 1px solid var(--line); border-radius: 8px; font-size: 8px; font-weight: 750; text-align: left; }
.theme-button i { height: 17px; display: block; background: var(--theme-bg); border: 1px solid rgba(16, 35, 63, .09); border-radius: 4px; box-shadow: inset 0 -5px 0 var(--theme-accent); }
.theme-button.is-active { color: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 2px rgba(15, 118, 110, .1); }

.bulk-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-bottom: 12px; padding: 3px; background: var(--surface-2); border-radius: 9px; }
.bulk-tabs button { height: 31px; color: #6c7b8e; background: transparent; border-radius: 7px; font-size: 10px; font-weight: 750; }
.bulk-tabs button.is-active { color: var(--navy); background: #fff; box-shadow: var(--shadow-sm); }
.file-drop { width: 100%; min-height: 150px; display: grid; place-items: center; align-content: center; gap: 6px; padding: 20px; color: #5e6f84; background: #fbfcfe; border: 1px dashed #aebccf; border-radius: 11px; text-align: center; }
.file-drop:hover, .file-drop.is-dragging { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); }
.file-drop svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.file-drop strong { font-size: 12px; }
.file-drop span { font-size: 9px; }
.record-list-wrap { margin-top: 15px; }
.record-list-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.record-list-head strong { color: var(--navy); font-size: 11px; }
.record-list { display: grid; gap: 6px; max-height: 280px; overflow: auto; }
.record-item { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 8px; padding: 8px; color: #536378; background: #fbfcfe; border: 1px solid var(--line); border-radius: 8px; text-align: left; }
.record-item:hover { border-color: #aebdd0; }
.record-item.is-active { color: var(--navy); background: var(--accent-soft); border-color: var(--accent); }
.record-index { width: 25px; height: 25px; display: grid; place-items: center; color: var(--accent); background: #fff; border-radius: 7px; font-size: 9px; font-weight: 800; }
.record-copy { min-width: 0; display: grid; }
.record-copy strong, .record-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.record-copy strong { font-size: 10px; }
.record-copy small { color: var(--muted); font-size: 8px; }
.remove-record { width: 24px; height: 24px; color: #9b5560; background: transparent; border-radius: 6px; }
.remove-record:hover { color: var(--danger); background: #fff0f0; }

.studio-footer { padding: 24px clamp(20px, 5vw, 72px); color: #b8c4d5; background: var(--navy); font-size: 11px; text-align: center; }
.studio-footer a { color: #fff; text-decoration: none; }
.studio-footer p { max-width: 900px; margin: 8px auto 0; color: #91a2b8; }

.guide-content { padding: 62px clamp(22px, 6vw, 90px) 74px; color: #2d3b4d; background: #fff; }
.guide-content > * { max-width: 1180px; margin-right: auto; margin-left: auto; }
.breadcrumbs { margin-bottom: 25px; color: #6b7a8f; font-size: 12px; }
.breadcrumbs a { color: var(--accent); text-decoration: none; }
.guide-hero { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(260px, .7fr); align-items: center; gap: 38px; margin-bottom: 35px; padding-bottom: 35px; border-bottom: 1px solid var(--line); }
.guide-hero h2 { max-width: 850px; margin: 0 0 15px; color: var(--navy); font-family: Georgia, serif; font-size: clamp(28px, 4vw, 49px); font-weight: 650; line-height: 1.08; letter-spacing: -.025em; }
.guide-hero p { max-width: 830px; margin: 0; color: #5e6c7d; font-size: 16px; line-height: 1.75; }
.guide-cta { display: grid; gap: 5px; padding: 22px; color: #fff; background: linear-gradient(145deg, var(--navy), #183f66); border-radius: 15px; box-shadow: var(--shadow-md); text-decoration: none; }
.guide-cta strong { font-size: 16px; }
.guide-cta span { color: #c5d4e6; font-size: 11px; }
.answer-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-bottom: 58px; }
.answer-grid article { position: relative; min-height: 180px; padding: 24px; overflow: hidden; background: #f8fafc; border: 1px solid var(--line); border-radius: 14px; }
.answer-grid article > span { position: absolute; top: 7px; right: 14px; color: #e4ebf3; font-family: Georgia, serif; font-size: 54px; font-weight: 700; }
.answer-grid h3 { position: relative; margin: 0 0 10px; color: var(--navy); font-size: 16px; }
.answer-grid p { position: relative; margin: 0; color: #647286; font-size: 13px; line-height: 1.7; }
.guide-section { margin-bottom: 56px; }
.guide-section h2 { margin: 0 0 16px; color: var(--navy); font-family: Georgia, serif; font-size: clamp(24px, 3vw, 34px); line-height: 1.2; }
.guide-section p { margin: 0 0 15px; color: #526174; font-size: 15px; line-height: 1.8; }
.check-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 25px; }
.check-grid div { display: grid; gap: 6px; padding: 18px; background: #fff; border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: 9px; box-shadow: var(--shadow-sm); }
.check-grid strong { color: var(--navy); font-size: 13px; }
.check-grid span { color: #65758a; font-size: 11px; line-height: 1.6; }
.split-guide { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(260px, .65fr); align-items: start; gap: 38px; }
.split-guide.reverse { grid-template-columns: minmax(300px, .75fr) minmax(0, 1.5fr); }
.research-note, .privacy-card { padding: 24px; border-radius: 14px; }
.research-note { color: #fff; background: linear-gradient(145deg, #163657, var(--navy)); box-shadow: var(--shadow-md); }
.research-note strong { display: block; margin-bottom: 8px; color: #83e6dc; font-size: 13px; text-transform: uppercase; letter-spacing: .1em; }
.research-note p { margin: 0; color: #d8e4f1; font-size: 12px; line-height: 1.7; }
.privacy-card { background: #effaf7; border: 1px solid #bce8df; }
.privacy-card strong { color: #0c625c; font-size: 15px; }
.privacy-card ul { margin: 12px 0 0; padding-left: 18px; color: #4e6c69; }
.privacy-card li { margin: 8px 0; font-size: 12px; line-height: 1.55; }
.faq-list { display: grid; gap: 9px; }
.faq-list details { padding: 0 18px; background: #fbfcfe; border: 1px solid var(--line); border-radius: 10px; }
.faq-list summary { padding: 15px 0; color: var(--navy); font-size: 13px; font-weight: 750; cursor: pointer; }
.faq-list p { padding: 0 0 15px; margin: 0; font-size: 13px; }
.source-section { padding-top: 28px; border-top: 1px solid var(--line); }
.source-section p { font-size: 12px; }
.source-section a { color: var(--accent); font-weight: 650; }

.studio-dialog { width: min(760px, calc(100vw - 30px)); max-height: calc(100vh - 30px); padding: 0; color: var(--ink); background: #fff; border: 0; border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; }
.studio-dialog::backdrop { background: rgba(7, 18, 34, .68); backdrop-filter: blur(4px); }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 20px 22px 16px; border-bottom: 1px solid var(--line); }
.dialog-header h2 { margin: 0; color: var(--navy); font-size: 20px; }
.dialog-header p:not(.eyebrow) { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.dialog-header .icon-button { font-size: 22px; line-height: 1; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 15px 22px; border-top: 1px solid var(--line); }
.preview-dialog { width: min(1060px, calc(100vw - 30px)); }
.preview-stage { min-height: 400px; display: grid; place-items: center; padding: 28px; background: #e9eef5; overflow: auto; }
#previewCanvas { max-width: 100%; max-height: calc(100vh - 230px); background: #fff; box-shadow: var(--shadow-md); }
.export-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 18px 22px; }
.export-option { position: relative; display: grid; grid-template-columns: 49px 1fr; align-items: center; gap: 11px; min-height: 76px; padding: 11px; background: #fbfcfe; border: 1px solid var(--line); border-radius: 11px; cursor: pointer; }
.export-option:hover, .export-option.is-selected { border-color: var(--accent); background: var(--accent-soft); }
.export-option input { position: absolute; top: 9px; right: 9px; accent-color: var(--accent); }
.format-icon { width: 46px; height: 46px; display: grid; place-items: center; color: var(--accent); background: #fff; border: 1px solid var(--line); border-radius: 9px; font-size: 10px; font-weight: 850; }
.export-option > span:last-child { display: grid; gap: 3px; }
.export-option strong { color: var(--navy); font-size: 12px; }
.export-option small { color: var(--muted); font-size: 9px; }
.export-settings { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 0 22px 12px; }
.export-note { margin: 0 22px 16px; padding: 10px 12px; color: #66592f; background: #fff9e9; border: 1px solid #f4dfaa; border-radius: 8px; font-size: 10px; }
.progress-dialog { width: min(420px, calc(100vw - 30px)); padding: 34px; text-align: center; }
.progress-dialog h2 { margin: 16px 0 6px; color: var(--navy); }
.progress-dialog p { margin: 0 0 16px; color: var(--muted); }
.progress-ring { --progress: 0%; width: 86px; height: 86px; display: grid; place-items: center; margin: 0 auto; background: conic-gradient(var(--accent) var(--progress), #e3e9f0 0); border-radius: 50%; }
.progress-ring::before { content: ""; position: absolute; width: 68px; height: 68px; background: #fff; border-radius: 50%; }
.progress-ring span { position: relative; z-index: 1; color: var(--navy); font-size: 14px; font-weight: 850; }
.progress-bar { height: 7px; overflow: hidden; background: #e5ebf2; border-radius: 999px; }
.progress-bar span { width: 0; height: 100%; display: block; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .15s ease; }
.progress-dialog .text-button { margin-top: 16px; }
.toast-region { position: fixed; z-index: 200; right: 18px; bottom: 18px; display: grid; gap: 8px; pointer-events: none; }
.toast { min-width: 250px; max-width: 360px; padding: 12px 14px; color: #fff; background: var(--navy); border-radius: 10px; box-shadow: var(--shadow-md); font-size: 11px; font-weight: 650; animation: toast-in .2s ease both; }
.toast.is-error { background: #8f1f1b; }
.toast.is-leaving { animation: toast-out .22s ease both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1280px) {
  .studio-shell { grid-template-columns: 222px minmax(420px, 1fr) 330px; }
  .header-links { display: none; }
  .canvas-toolbar { grid-template-columns: 1fr auto; }
  .toolbar-title { display: none; }
}

@media (max-width: 980px) {
  :root { --header-height: 60px; }
  .studio-header { gap: 9px; padding: 0 10px; }
  .studio-brand { flex-basis: 150px; }
  .studio-brand img { width: 145px; }
  .project-identity { display: none; }
  .header-actions { margin-left: auto; }
  .header-actions .button-ghost { display: none; }
  .header-actions .button { padding: 0 10px; }
  .studio-shell { height: auto; min-height: 0; grid-template-columns: 210px minmax(0, 1fr); grid-template-rows: minmax(620px, calc(100vh - var(--header-height))) auto; overflow: visible; }
  .canvas-workspace { min-height: 620px; }
  .inspector { grid-column: 1 / -1; min-height: 600px; border-top: 1px solid var(--line); border-left: 0; }
  .inspector-body { overflow: visible; }
  .inspector-panel { max-width: 760px; width: 100%; margin: 0 auto; }
  .guide-content { padding-top: 45px; }
  .check-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
  .studio-header { flex-wrap: nowrap; }
  .studio-brand { flex-basis: 130px; }
  .studio-brand img { width: 126px; }
  .header-actions > .icon-button, .header-actions .button-secondary { display: none; }
  .header-actions .button-primary { min-width: 38px; padding: 0 9px; font-size: 0; }
  .header-actions .button-primary svg { width: 19px; height: 19px; }
  .studio-shell { display: block; }
  .preset-sidebar { height: auto; max-height: none; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-heading { padding: 13px 14px 8px; }
  .preset-grid { grid-template-columns: repeat(4, 126px); padding: 0 12px 13px; overflow-x: auto; overflow-y: hidden; }
  .preset-card { width: 126px; }
  .canvas-workspace { min-height: 560px; grid-template-rows: auto minmax(0, 1fr) 29px; }
  .canvas-toolbar { grid-template-columns: 1fr; padding: 7px 9px; }
  .toolbar-group { justify-content: center; flex-wrap: wrap; }
  .toolbar-end { display: none; }
  .canvas-stage { min-height: 470px; padding: 24px 14px; }
  .inspector { min-height: 580px; }
  .inspector-tabs { position: sticky; z-index: 20; top: var(--header-height); }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .field-wide { grid-column: auto; }
  .item-editor-grid { grid-template-columns: 1.4fr 1fr; }
  .item-editor-grid .item-condition { grid-column: 1 / -1; }
  .guide-hero, .split-guide, .split-guide.reverse { grid-template-columns: 1fr; gap: 24px; }
  .answer-grid { grid-template-columns: 1fr; }
  .answer-grid article { min-height: auto; }
  .check-grid { grid-template-columns: 1fr; }
  .export-options, .export-settings { grid-template-columns: 1fr; }
  .export-options { max-height: 48vh; overflow-y: auto; }
  .dialog-actions { flex-wrap: wrap; }
}

@media (max-width: 420px) {
  .studio-brand { flex-basis: 118px; }
  .studio-brand img { width: 114px; }
  .header-actions { gap: 4px; }
  .header-actions .button-primary { width: 38px; }
  .preset-grid { grid-template-columns: repeat(4, 118px); }
  .preset-card { width: 118px; }
  .guide-content { padding-right: 17px; padding-left: 17px; }
  .theme-grid { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

@media print {
  .studio-header, .preset-sidebar, .inspector, .canvas-toolbar, .workspace-status, .guide-content, .studio-footer, .toast-region { display: none !important; }
  body, .studio-shell, .canvas-workspace, .canvas-stage { min-height: 0 !important; height: auto !important; display: block !important; padding: 0 !important; background: #fff !important; overflow: visible !important; }
  .canvas-stage::before { display: none !important; }
  .canvas-paper { width: 100% !important; height: auto !important; box-shadow: none !important; }
  #passCanvas { width: 100% !important; height: auto !important; }
}
