:root {
    color-scheme: light;
    font: 15px/1.5 "Segoe UI", "Hiragino Sans", "Yu Gothic UI", system-ui, sans-serif;
    color: #191b30;
    background: #f5f6fb;
    --ink: #191b30;
    --muted: #535970;
    --line: #dce0ee;
    --surface: #fafaff;
    --accent: #5945c7;
    --accent-tint: #eeecfc;
}
* { box-sizing: border-box }
body { margin: 0 }
button, input, select { font: inherit }
button, select { cursor: pointer }
button:disabled, select:disabled { cursor: default; opacity: .52 }
button, select, input[type="range"], summary { accent-color: var(--accent) }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px }
[hidden], #resized { display: none !important }
.app-shell { display: grid; grid-template-columns: clamp(300px, 27vw, 420px) minmax(0,1fr); min-height: 100vh }
.sidebar { padding: 30px clamp(20px, 2.3vw, 35px); border-right: 1px solid #e5e7f2; background: #f8f8fc }
.brand { display: flex; align-items: center; gap: 12px }
.brand-icon { color: #4433a4; width: 29px; height: 29px; flex: none }
h1 { font-size: clamp(22px, 2vw, 29px); letter-spacing: -.04em; margin: 0; line-height: 1.21 }
.intro { color: var(--muted); margin: 8px 0 23px; max-width: 31ch }
.settings-group { border-top: 1px solid var(--line); padding: 15px 0 17px }
.settings-group h2 { margin: 0 0 11px; font-size: 17px; letter-spacing: .015em }
.fields { display: grid; gap: 9px }
.field { display: grid; grid-template-columns: minmax(105px, .78fr) minmax(0, 1.22fr); align-items: center; gap: 9px; min-height: 34px }
.field > span:first-child { font-size: 14px }
select, .file-box, .command-box {
    min-width: 0; color: var(--ink); border: 1px solid #d7dbeb; border-radius: 8px;
    background: #f8f8fe;
}
select { width: 100%; min-height: 35px; padding: 5px 7px; text-overflow: ellipsis; font-size: 14px }
.file-box { display: flex; align-items: stretch; min-height: 45px; background: #f3f3fc }
.file-pick { position: relative; display: flex; flex: 1; min-width: 0; align-items: center; gap: 11px; padding: 9px 13px; cursor: pointer }
.file-pick:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px }
.file-pick input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer }
.filename { white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.icon { width: 19px; height: 19px; flex: none; vertical-align: middle }
.file-pick .icon { color: #626b87 }
.icon-button { display: inline-grid; place-items: center; min-width: 37px; min-height: 35px; color: var(--ink); border: 1px solid #dce0ef; border-radius: 8px; background: #f8f9ff }
.file-box .icon-button { border: 0; background: transparent; margin: 3px }
.icon-button:hover:not(:disabled) { background: var(--accent-tint) }
.strength-control { display: flex; align-items: center; gap: 9px }
.strength-control input { min-width: 0; width: 100%; margin: 0 }
.strength-control output { min-width: 37px; text-align: right; font-variant-numeric: tabular-nums; color: var(--muted) }
.switch { justify-self: end; appearance: none; cursor: pointer; width: 40px; height: 23px; margin: 0; border-radius: 20px; border: 1px solid #989db5; background: #d9dceb; display: inline-flex; align-items: center; padding: 2px; transition: background .15s }
.switch::before { content: ""; width: 17px; height: 17px; border-radius: 100%; background: white; box-shadow: 0 1px 3px #25224932; transition: transform .15s }
.switch:checked { background: var(--accent); border-color: var(--accent) }
.switch:checked::before { transform: translateX(17px) }
.switch:disabled { opacity: .50; cursor: default }
.action { display: flex; justify-content: center; align-items: center; gap: 9px; width: 100%; min-height: 42px; border-radius: 9px; font-weight: 650; padding: 7px 12px }
.primary { margin-top: 14px; color: white; background: var(--accent); border: 1px solid transparent }
.primary:hover:not(:disabled) { background: #4d38b2 }
.secondary { margin-top: 12px; color: #30275c; border: 1px solid #dedbf0; background: #eeecf9 }
.secondary:hover:not(:disabled) { background: #e4dff8 }
.command-box { display: flex; align-items: flex-start; margin-top: 6px }
.command-box pre { min-width: 0; flex: 1; margin: 0; padding: 8px 10px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 11px }
.command-box button { margin: 3px; min-width: 32px; min-height: 30px; border: 0 }
.command-box .icon { width: 16px; height: 16px }
.command-label { margin: 12px 0 0; font-size: 14px }
.help { margin-top: 11px; color: var(--muted); font-size: 13px }
.help summary { cursor: pointer; color: var(--ink) }
.help p { margin: 7px 0 0 }
#status { margin: 0; min-height: 24px; color: var(--muted); font-size: 13px }
.workspace { min-width: 0; padding: clamp(18px, 2.2vw, 34px); display: flex; flex-direction: column; gap: 15px }
.previews { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px }
.panel { min-width: 0; margin: 0; border: 1px solid #e0e3ef; border-radius: 14px; background: var(--surface) }
.preview-card { padding: 14px }
.preview-card figcaption { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 5px 10px; min-height: 34px; font-size: 17px; font-weight: 700; margin-bottom: 11px }
.badge { padding: 4px 8px; border-radius: 7px; background: #eeeff8; color: #393d58; font-size: 12px; font-weight: 500 }
.media { display: grid; place-items: center; height: clamp(190px, 23vw, 365px); border-radius: 8px; background: #f0f2f9; overflow: hidden }
.media > img, .media > canvas { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain }
#preview, #map-canvas { image-rendering: pixelated }
.empty { text-align: center; color: var(--muted); padding: 18px }
.empty .icon { display: block; margin: 0 auto 8px; width: 28px; height: 28px; color: #7977a8 }
.workspace-tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 10px; border-bottom: 1px solid #e2e4f0 }
.workspace-tab { display: flex; gap: 8px; align-items: center; min-height: 49px; padding: 0 12px; border: 0; border-bottom: 2px solid transparent; color: var(--muted); background: transparent; font-weight: 650 }
.workspace-tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent) }
.view-panel { padding: 13px }
.stage { position: relative; border-radius: 9px; overflow: hidden; background: #e6ecfa }
.placement-tools { position: absolute; z-index: 1; display: flex; gap: 7px; top: 10px; right: 10px }
.placement-tools select { width: min(150px, 35vw) }
#placement-canvas { background: linear-gradient(155deg,#87a6df,#c4d5ef 73%,#d9e2f0); display: block; width: 100%; height: clamp(285px, 42vw, 570px); touch-action: none; cursor: grab; outline-offset: -3px }
#placement-canvas:active { cursor: grabbing }
.view-empty, .map-stage { min-height: clamp(235px, 34vw, 470px) }
.view-empty { display: grid; place-content: center }
.map-stage { display: grid; place-items: center; padding: 15px; background: #eeeefa; border-radius: 9px }
#map-canvas { display: block; max-width: 100%; max-height: 62vh; width: auto; height: auto; object-fit: contain }
.view-meta { display: flex; flex-wrap: wrap; gap: 0 16px }
.view-meta p { margin: 7px 0 0; font-size: 12px; color: var(--muted) }
@media(max-width: 930px) { .app-shell { grid-template-columns: 305px minmax(0,1fr) } .workspace { padding: 17px } .preview-card { padding: 10px } }
@media(max-width: 690px) { .app-shell { display: flex; flex-direction: column } .sidebar { border-right: 0; border-bottom: 1px solid var(--line); padding: 19px 16px } .workspace { padding: 13px } .media { height: clamp(130px,36vw,230px) } .preview-card figcaption { font-size: 14px } .previews { gap: 8px } .brand { gap: 8px } }
@media(prefers-reduced-motion: reduce) { *, *::before { transition: none !important } }
