:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-soft: #f8f9fc;
  --ink: #202d44;
  --ink-soft: #58657a;
  --ink-faint: #748096;
  --main: #6772d6;
  --main-dark: #505bbd;
  --main-soft: #eef0ff;
  --mint: #bde8df;
  --mint-ink: #24685c;
  --line: #e2e7ef;
  --line-strong: #cfd6e2;
  --danger: #b33b4d;
  --danger-soft: #fff1f3;
  --success: #287460;
  --warning: #8a6015;
  --shadow: 0 16px 44px rgba(32, 45, 68, 0.08);
  --shadow-soft: 0 8px 24px rgba(32, 45, 68, 0.055);
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --font-body: "Pretendard Variable", Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { min-width: 320px; background: var(--bg); }

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  background:
    linear-gradient(rgba(103, 114, 214, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(103, 114, 214, .035) 1px, transparent 1px),
    var(--bg);
  background-size: 48px 48px;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  word-break: keep-all;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button, label[for], select, input[type="file"] { touch-action: manipulation; }
button, a { -webkit-tap-highlight-color: transparent; }
svg { display: block; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.shell { width: min(1180px, calc(100% - 48px)); margin-inline: auto; }
.skip-link { position: fixed; z-index: 1000; top: 8px; left: 8px; padding: 10px 14px; color: white; background: var(--ink); border-radius: 8px; transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }

.site-header { background: rgba(255,255,255,.88); border-bottom: 1px solid var(--line); }
.header-inner { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { min-height: 44px; display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand-mark { width: 28px; height: 28px; color: var(--main); }
.brand-mark rect { fill: var(--main-soft); }
.wordmark { font-size: 18px; font-weight: 760; letter-spacing: -.025em; }
.product-label { margin-left: 2px; padding-left: 12px; border-left: 1px solid var(--line-strong); color: var(--ink-soft); font-size: 13px; font-weight: 650; }
.connection-status { display: inline-flex; min-height: 32px; align-items: center; gap: 8px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-soft); background: var(--surface); font-size: 13px; font-weight: 650; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #9aa4b4; box-shadow: 0 0 0 3px #eef0f3; }
.connection-status[data-state="connected"] { color: var(--success); border-color: #cfe7e0; background: #f2faf7; }
.connection-status[data-state="connected"] .status-dot { background: var(--success); box-shadow: 0 0 0 3px #dbeee8; }
.connection-status[data-state="error"] { color: var(--danger); border-color: #f1cbd1; background: var(--danger-soft); }
.connection-status[data-state="error"] .status-dot { background: var(--danger); box-shadow: 0 0 0 3px #f7dce1; }

.environment-banner { min-height: 44px; align-items: center; justify-content: center; gap: 9px; padding: 9px 24px; color: #654915; background: #fff7de; border-bottom: 1px solid #ead8a8; font-size: 13px; }
.environment-banner:not([hidden]) { display: flex; }
.environment-banner svg { width: 17px; height: 17px; }
.environment-banner strong { font-weight: 750; }
.environment-banner span { color: #786239; }

.page-main { padding-block: 52px 80px; }
.intro { max-width: 720px; margin-bottom: 30px; }
.eyebrow, .preview-kicker, .result-eyebrow { margin: 0 0 8px; color: var(--main); font: 700 11px/1.2 var(--font-mono); letter-spacing: .12em; }
.intro h1 { max-width: 660px; margin: 0; font-size: clamp(30px, 4vw, 48px); line-height: 1.16; letter-spacing: -.045em; text-wrap: balance; }
.intro > p:last-child { max-width: 620px; margin: 16px 0 0; color: var(--ink-soft); }

.global-notice { margin: -10px 0 24px; padding: 13px 16px; color: var(--danger); background: var(--danger-soft); border: 1px solid #f0c6cd; border-radius: var(--radius-md); font-size: 14px; font-weight: 620; }
.workspace { display: grid; grid-template-columns: minmax(350px, 390px) minmax(0, 1fr); gap: 22px; align-items: start; }
.control-panel, .preview-panel, .recent-section { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-soft); }
.control-panel { border-radius: var(--radius-lg); overflow: hidden; }
.panel-section { padding: 26px; }
.panel-section + .panel-section { border-top: 1px solid var(--line); }
.section-heading { display: grid; grid-template-columns: 30px 1fr; gap: 10px; margin-bottom: 22px; }
.step-index { padding-top: 3px; color: var(--main); font: 700 11px/1.4 var(--font-mono); letter-spacing: .08em; }
.section-heading h2, .preview-toolbar h2, .recent-heading-row h2 { margin: 0; font-size: 18px; line-height: 1.35; letter-spacing: -.025em; }
.section-heading p { margin: 5px 0 0; color: var(--ink-soft); font-size: 13px; }

.token-row { display: flex; align-items: flex-start; gap: 9px; }
.field-grow { min-width: 0; flex: 1; }
.field + .field { margin-top: 19px; }
.field > label, .result-field > label, .size-fields legend { display: block; margin-bottom: 8px; color: var(--ink); font-size: 13px; font-weight: 700; }
input, select, textarea { width: 100%; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); outline: none; transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease); }
input, select { min-height: 46px; padding: 10px 12px; }
textarea { min-height: 64px; padding: 10px 12px; line-height: 1.45; resize: vertical; }
input::placeholder, textarea::placeholder { color: #9aa4b4; }
input:hover, select:hover, textarea:hover { border-color: #adb7c7; }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--main); box-shadow: 0 0 0 3px rgba(103,114,214,.18); }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--danger); }
.field-help, .field-error { margin: 7px 0 0; font-size: 12px; line-height: 1.45; }
.field-help { color: var(--ink-faint); }
.field-error { min-height: 0; color: var(--danger); font-weight: 620; }
.field-error:empty { display: none; }
.connect-button { flex: 0 0 auto; margin-top: 27px; }

.file-picker { min-height: 76px; display: flex !important; align-items: center; gap: 13px; margin: 0 !important; padding: 13px 14px; color: var(--ink); background: var(--surface-soft); border: 1px dashed #b9c1d0; border-radius: var(--radius-md); cursor: pointer; transition: background 160ms var(--ease), border-color 160ms var(--ease); }
.file-picker:hover { background: var(--main-soft); border-color: var(--main); }
.file-picker svg { width: 24px; height: 24px; flex: 0 0 auto; color: var(--main); }
.file-picker span { min-width: 0; }
.file-picker strong, .file-picker small { display: block; overflow-wrap: anywhere; }
.file-picker strong { font-size: 14px; }
.file-picker small { margin-top: 3px; color: var(--ink-faint); font-size: 12px; font-weight: 500; }
.visually-hidden-input { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.visually-hidden-input:focus-visible + .field-help { outline: 3px solid rgba(103,114,214,.25); outline-offset: 3px; }
.file-picker:has(+ .visually-hidden-input:focus-visible) { border-color: var(--main); box-shadow: 0 0 0 3px rgba(103,114,214,.18); }
.file-picker-compact { min-height: 64px; }

.package-info { margin-top: 12px; padding: 13px; background: #f8f9fd; border: 1px solid #dfe3f1; border-radius: 11px; }
.package-summary { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.package-summary strong, .package-summary span { display: block; }
.package-summary strong { color: var(--ink); font-size: 12px; }
.package-summary div > span { margin-top: 3px; color: var(--ink-faint); font: 11px/1.45 var(--font-mono); }
.package-badge { flex: 0 0 auto; padding: 3px 6px; color: var(--main-dark); background: var(--main-soft); border-radius: 5px; font: 700 9px/1.4 var(--font-mono); letter-spacing: .08em; }
.package-entry-field { margin-top: 13px !important; padding-top: 13px; border-top: 1px solid var(--line); }
.package-tree-details { margin-top: 11px; border-top: 1px solid var(--line); }
.package-tree-details summary { min-height: 40px; display: flex; align-items: center; gap: 8px; color: var(--main-dark); list-style: none; font-size: 11px; font-weight: 700; cursor: pointer; }
.package-tree-details summary::-webkit-details-marker { display: none; }
.package-tree-details summary::before { width: 6px; height: 6px; content: ""; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform 140ms var(--ease); }
.package-tree-details[open] summary::before { transform: rotate(45deg); }
.package-tree { max-height: 154px; margin: 0; padding: 8px 10px; overflow: auto; color: #47546a; background: white; border: 1px solid var(--line); border-radius: 7px; list-style: none; }
.package-tree li { padding: 3px 0; font: 10px/1.45 var(--font-mono); overflow-wrap: anywhere; }
.package-tree li + li { border-top: 1px solid #f0f2f6; }
.package-note { margin: 10px 0 0; color: var(--ink-faint); font-size: 10px; line-height: 1.5; }

.mobile-source-fieldset { margin: 19px 0 0; padding: 0; border: 0; }
.mobile-source-fieldset > legend { margin-bottom: 8px; color: var(--ink); font-size: 13px; font-weight: 700; }
.choice-row { display: grid; grid-template-columns: 1fr 1.28fr; gap: 7px; }
.choice-option { min-height: 46px; display: flex; align-items: center; gap: 8px; padding: 9px 10px; color: var(--ink-soft); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); font-size: 12px; font-weight: 650; cursor: pointer; }
.choice-option:has(input:checked) { color: var(--main-dark); background: var(--main-soft); border-color: #c6ccf2; }
.choice-option:has(input:focus-visible) { outline: 3px solid rgba(103,114,214,.24); outline-offset: 2px; }
.choice-option input { width: 16px; min-height: auto; height: 16px; margin: 0; accent-color: var(--main); }
.mobile-file-field { margin-top: 14px !important; }

.device-settings { margin-top: 22px; padding: 17px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 14px; }
.device-settings-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.device-settings-heading h3 { margin: 0; font-size: 14px; letter-spacing: -.015em; }
.device-settings-heading p { margin: 4px 0 0; color: var(--ink-faint); font-size: 11px; }
.text-button { min-height: 36px; flex: 0 0 auto; padding: 4px 2px; color: var(--main-dark); background: transparent; border: 0; font-size: 11px; font-weight: 700; cursor: pointer; }
.text-button:hover { text-decoration: underline; text-underline-offset: 3px; }
.text-button:focus-visible { outline: 3px solid rgba(103,114,214,.24); outline-offset: 2px; border-radius: 4px; }
.device-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; margin: 15px 0; padding: 3px; background: #eaedf3; border-radius: 10px; }
.device-tab { min-height: 42px; padding: 7px 10px; color: var(--ink-soft); background: transparent; border: 0; border-radius: 7px; font-size: 12px; font-weight: 700; cursor: pointer; }
.device-tab.is-active { color: var(--main-dark); background: var(--surface); box-shadow: 0 2px 7px rgba(32,45,68,.08); }
.device-tab:focus-visible { outline: 3px solid rgba(103,114,214,.25); outline-offset: 1px; }
.viewport-fields { margin-top: 0 !important; }
.fit-field { margin-top: 15px !important; }
.canvas-size-fields { margin-top: 15px; padding-top: 15px; border-top: 1px solid var(--line); }
.profile-hint { grid-column: 1 / -1; margin: 2px 0 0; color: var(--warning); font-size: 11px; font-weight: 650; line-height: 1.45; }
.profile-hint:empty { display: none; }
.device-truth-note { display: flex; gap: 7px; margin: 15px 0 0; padding-top: 14px; color: var(--ink-faint); border-top: 1px solid var(--line); font-size: 11px; line-height: 1.5; }
.device-truth-note svg { width: 15px; height: 15px; margin-top: 1px; flex: 0 0 auto; }

.size-fields { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 8px; margin: 19px 0 0; padding: 0; border: 0; }
.size-fields legend { grid-column: 1 / -1; }
.size-fields .field { margin: 0; }
.size-separator { align-self: center; padding-top: 28px; color: var(--ink-faint); font-family: var(--font-mono); }
.unit-input { position: relative; }
.unit-input input { padding-right: 36px; }
.unit-input span { position: absolute; top: 50%; right: 11px; color: var(--ink-faint); font: 12px var(--font-mono); transform: translateY(-50%); }
.size-error { grid-column: 1 / -1; }

.button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 14px; border: 1px solid transparent; border-radius: var(--radius-sm); font-size: 13px; font-weight: 700; text-decoration: none; cursor: pointer; transition: color 140ms var(--ease), background 140ms var(--ease), border-color 140ms var(--ease), box-shadow 140ms var(--ease), opacity 140ms var(--ease); }
.button svg { width: 18px; height: 18px; }
.button:hover:not(:disabled) { box-shadow: 0 4px 12px rgba(32,45,68,.1); }
.button:active:not(:disabled) { opacity: .82; }
.button:focus-visible, .view-option:focus-visible, .card-action:focus-visible, a:focus-visible { outline: 3px solid rgba(103,114,214,.3); outline-offset: 2px; }
.button:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.button-primary { color: white; background: var(--main); border-color: var(--main); }
.button-primary:hover:not(:disabled) { background: var(--main-dark); border-color: var(--main-dark); }
.button-secondary { color: var(--ink); background: var(--surface); border-color: var(--line-strong); }
.button-secondary:hover:not(:disabled) { border-color: #aeb8c8; background: var(--surface-soft); }
.button-quiet { color: var(--main-dark); background: var(--main-soft); border-color: transparent; }
.button-quiet:hover:not(:disabled) { background: #e5e8ff; }
.button-danger { color: white; background: var(--danger); border-color: var(--danger); }
.publish-button { width: 100%; margin-top: 24px; }
.publish-help { margin: 9px 0 0; color: var(--ink-faint); text-align: center; font-size: 12px; }

.preview-panel { min-width: 0; padding: 26px; border-radius: var(--radius-lg); }
.preview-toolbar { min-height: 48px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.preview-kicker { margin-bottom: 5px; }
.view-switch { display: flex; gap: 4px; padding: 3px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 10px; }
.view-option { min-height: 38px; display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; color: var(--ink-soft); background: transparent; border: 0; border-radius: 7px; font-size: 12px; font-weight: 650; cursor: pointer; }
.view-option svg { width: 17px; height: 17px; }
.view-option.is-active { color: var(--main-dark); background: white; box-shadow: 0 2px 7px rgba(32,45,68,.09); }
.stage-shell { padding: 1px; background: var(--ink); border: 5px solid #edf0f5; border-radius: 15px; box-shadow: inset 0 0 0 1px #111b2c, 0 14px 32px rgba(32,45,68,.11); overflow: hidden; }
.stage-rail { height: 32px; display: flex; align-items: center; gap: 8px; padding: 0 11px; color: #d9deeb; background: var(--ink); font: 650 10px/1 var(--font-mono); letter-spacing: .08em; }
.cue-light { width: 7px; height: 7px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 3px rgba(189,232,223,.13), 0 0 12px rgba(189,232,223,.65); }
.stage-dimensions { margin-left: auto; color: #9ca9bd; letter-spacing: .02em; }
.stage-canvas { position: relative; width: 100%; aspect-ratio: 16 / 9; display: grid; place-items: center; background-color: #e9edf4; background-image: linear-gradient(45deg, #e0e5ed 25%, transparent 25%), linear-gradient(-45deg, #e0e5ed 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #e0e5ed 75%), linear-gradient(-45deg, transparent 75%, #e0e5ed 75%); background-size: 18px 18px; background-position: 0 0, 0 9px, 9px -9px, -9px 0; overflow: hidden; transition: aspect-ratio 220ms var(--ease); }
.stage-shell[data-preview-mode="mobile"] .stage-canvas { width: min(44%, 320px); margin-inline: auto; }
.stage-shell[data-preview-mode="mobile"] { background: #dfe4ed; }
.preview-empty { max-width: 310px; padding: 30px 20px; color: var(--ink-soft); text-align: center; }
.preview-empty svg { width: 48px; height: 48px; margin: 0 auto 12px; color: #a3aec0; }
.preview-empty strong { display: block; color: var(--ink); font-size: 14px; }
.preview-empty p { margin: 6px 0 0; font-size: 12px; }
.preview-loading { position: absolute; inset: 0; z-index: 2; place-items: center; align-content: center; gap: 10px; color: var(--ink-soft); background: rgba(245,247,250,.9); font-size: 13px; }
.preview-loading:not([hidden]) { display: grid; }
.spinner { width: 17px; height: 17px; display: inline-block; flex: 0 0 auto; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
#cardPreview { width: 100%; height: 100%; border: 0; background: white; }
.preview-note { display: flex; gap: 8px; margin: 14px 2px 0; color: var(--ink-faint); font-size: 12px; line-height: 1.5; }
.preview-note svg { width: 16px; height: 16px; margin-top: 1px; flex: 0 0 auto; }

.publish-result { margin-top: 24px; padding: 22px; background: #f8fbfa; border: 1px solid #d9ebe6; border-radius: 14px; }
.result-heading-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.result-eyebrow { color: var(--success); margin-bottom: 4px; }
.result-heading-row h3 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.status-chip { min-height: 30px; display: inline-flex; align-items: center; gap: 7px; padding: 4px 9px; color: var(--warning); background: #fff8e8; border: 1px solid #ebd7a9; border-radius: 999px; white-space: nowrap; font-size: 12px; font-weight: 700; }
.status-chip-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-chip[data-status="accepted"] { color: var(--success); background: #edf8f4; border-color: #cbe6de; }
.status-chip[data-status="rejected"], .status-chip[data-status="failed"] { color: var(--danger); background: var(--danger-soft); border-color: #efcad0; }
.result-field + .result-field { margin-top: 14px; }
.copy-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.technical-input { color: #38465d; background: white; font-family: var(--font-mono); font-size: 12px; overflow-wrap: anywhere; }
.result-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.soop-message { margin: 11px 0 0; color: var(--ink-soft); font-size: 12px; }
.soop-message:empty { display: none; }
.device-embed-details { margin-top: 15px; padding-top: 14px; border-top: 1px solid #d9ebe6; }
.device-embed-details summary { min-height: 40px; display: flex; align-items: center; gap: 8px; color: var(--main-dark); list-style: none; font-size: 12px; font-weight: 700; cursor: pointer; }
.device-embed-details summary::-webkit-details-marker { display: none; }
.device-embed-details summary::before { width: 7px; height: 7px; content: ""; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform 140ms var(--ease); }
.device-embed-details[open] summary::before { transform: rotate(45deg); }
.device-embed-details .result-field { margin-top: 12px; }

.recent-section { margin-top: 22px; padding: 26px; border-radius: var(--radius-lg); }
.recent-heading-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.recent-heading-row .eyebrow { margin-bottom: 5px; }
.list-state { min-height: 104px; align-items: center; justify-content: center; gap: 10px; color: var(--ink-soft); border: 1px dashed var(--line-strong); border-radius: var(--radius-md); font-size: 13px; }
.list-state:not([hidden]) { display: flex; }
.empty-state { flex-direction: column; text-align: center; }
.empty-state svg { width: 34px; height: 34px; color: #a7b1c0; }
.cards-list { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; }
.cards-list:empty { display: none; }
.card-row { min-width: 0; display: grid; grid-template-columns: minmax(180px, 1.3fr) minmax(180px, 1fr) auto; align-items: center; gap: 24px; padding: 16px; background: var(--surface); }
.card-main { min-width: 0; }
.card-title { margin: 0; font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.card-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; margin: 6px 0 0; color: var(--ink-faint); font: 11px/1.4 var(--font-mono); }
.card-url { min-width: 0; color: var(--ink-soft); font: 11px/1.45 var(--font-mono); overflow-wrap: anywhere; }
.card-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.card-action { min-height: 44px; display: inline-flex; align-items: center; padding: 7px 10px; color: var(--main-dark); background: transparent; border: 1px solid var(--line); border-radius: 7px; font-size: 11px; font-weight: 700; text-decoration: none; cursor: pointer; }
.card-action:hover { background: var(--main-soft); border-color: #c8cdf3; }
.card-action-danger { color: var(--danger); }
.card-action-danger:hover { background: var(--danger-soft); border-color: #efcad0; }

.confirm-dialog, .copy-dialog { width: min(420px, calc(100% - 32px)); padding: 0; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 28px 80px rgba(32,45,68,.22); }
.confirm-dialog::backdrop, .copy-dialog::backdrop { background: rgba(25,35,53,.44); backdrop-filter: blur(3px); }
.confirm-dialog form, .copy-dialog form { padding: 28px; }
.dialog-icon { width: 42px; height: 42px; display: grid; place-items: center; margin-bottom: 18px; color: var(--danger); background: var(--danger-soft); border-radius: 50%; }
.dialog-icon svg { width: 20px; height: 20px; }
.confirm-dialog h2 { margin: 0; font-size: 20px; letter-spacing: -.025em; }
.confirm-dialog p { margin: 10px 0 0; color: var(--ink-soft); font-size: 14px; }
.confirm-dialog p strong { color: var(--ink); }
.copy-dialog h2 { margin: 0; font-size: 20px; letter-spacing: -.025em; }
.copy-dialog p { margin: 10px 0 16px; color: var(--ink-soft); font-size: 14px; }
.copy-dialog textarea { min-height: 110px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }

.toast { position: fixed; z-index: 100; right: 22px; bottom: 22px; max-width: min(380px, calc(100% - 32px)); padding: 12px 16px; color: white; background: var(--ink); border-radius: 10px; box-shadow: var(--shadow); font-size: 13px; font-weight: 650; }
.toast[data-kind="error"] { background: #8f2f3e; }

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .shell { width: min(100% - 32px, 720px); }
  .page-main { padding-block: 38px 64px; }
  .workspace { grid-template-columns: 1fr; }
  .control-panel { display: grid; grid-template-columns: 1fr 1fr; }
  .panel-section + .panel-section { border-top: 0; border-left: 1px solid var(--line); }
  .recent-section { margin-top: 18px; }
  .card-row { grid-template-columns: minmax(0, 1fr) auto; gap: 12px 20px; }
  .card-url { grid-row: 2; }
  .card-actions { grid-row: 1 / 3; grid-column: 2; max-width: 150px; }
}

@media (max-width: 640px) {
  .shell { width: min(100% - 24px, 560px); }
  .header-inner { min-height: 60px; }
  .product-label { display: none; }
  .connection-status { padding-inline: 8px; }
  .environment-banner { align-items: flex-start; flex-wrap: wrap; justify-content: flex-start; gap: 4px 7px; padding: 9px 12px; }
  .environment-banner svg { margin-top: 2px; }
  .environment-banner span { width: calc(100% - 24px); margin-left: 24px; }
  .page-main { padding-block: 30px 48px; }
  .intro { margin-bottom: 22px; }
  .intro h1 { font-size: clamp(29px, 9vw, 38px); }
  .intro > p:last-child { font-size: 14px; }
  .control-panel { display: block; }
  .panel-section { padding: 22px 18px; }
  .panel-section + .panel-section { border-top: 1px solid var(--line); border-left: 0; }
  .token-row { display: block; }
  .connect-button { width: 100%; margin-top: 12px; }
  .choice-row { grid-template-columns: 1fr; }
  .preview-panel, .recent-section { padding: 18px; }
  .preview-toolbar { display: block; }
  .view-switch { margin-top: 16px; }
  .view-option { min-height: 44px; flex: 1; justify-content: center; }
  .stage-shell[data-preview-mode="mobile"] .stage-canvas { width: 58%; }
  .preview-empty { padding: 20px 12px; }
  .preview-empty svg { width: 38px; height: 38px; }
  .preview-empty p { display: none; }
  .result-heading-row { display: block; }
  .status-chip { margin-top: 12px; }
  .copy-row { grid-template-columns: 1fr; }
  .copy-row .button { width: 100%; }
  .result-actions > * { width: 100%; }
  .recent-heading-row { align-items: flex-end; }
  .card-row { grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 14px; }
  .card-url, .card-actions { grid-column: 1; grid-row: auto; }
  .card-actions { max-width: none; justify-content: flex-start; }
  .card-action { min-height: 44px; padding-inline: 12px; }
  .toast { right: 16px; bottom: 16px; left: 16px; max-width: none; }
}

@media (max-width: 380px) {
  .stage-rail { font-size: 9px; }
  .preview-panel { padding-inline: 12px; }
  .recent-heading-row { align-items: flex-start; }
  .recent-heading-row .button { padding-inline: 10px; }
}

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