:root {
  color-scheme: dark;
  --bg: #090a0c;
  --panel: #121417;
  --panel-raised: #1c1f24;
  --ink: #f1f3f6;
  --muted: #969da8;
  --line: #272b32;
  --accent: #c2f36b;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; background: var(--bg); }
body { margin: 0; color: var(--ink); background: radial-gradient(ellipse 420px 260px at 95% 0, #1b23251a, transparent), var(--bg); font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button, label, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

/* A phone layout at every width. Desktop preview keeps the same app proportions. */
.topbar, main, footer, .action-dock { width: min(100%, 480px); margin-inline: auto; }
.topbar { padding: calc(16px + env(safe-area-inset-top)) 22px 14px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-weight: 650; font-size: 12px; letter-spacing: .08em; }
.brand small { display: block; margin-top: 4px; color: #808792; font: 8px/1 var(--mono); letter-spacing: .13em; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 34px; color: #d4d9df; border: 1px solid #535960; border-radius: 9px; background: linear-gradient(145deg, #33373d, #0d1013 75%); font: italic 900 22px/1 Arial, sans-serif; box-shadow: inset 0 1px 0 #ffffff29; }
.local-pill { display: inline-flex; align-items: center; gap: 6px; color: #b2bac4; font-size: 10px; }
.local-pill span { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px #c2f33666; }

main { padding: 17px 18px 0; }
.hero { padding: 0 4px 23px; text-align: center; }
.hero-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.eyebrow, .section-kicker { font: 9px/1.3 var(--mono); letter-spacing: .13em; color: #8c96a3; }
.edition { color: var(--accent); font: 8px/1.2 var(--mono); letter-spacing: .1em; border: 1px solid #c2f36b40; padding: 4px 5px; border-radius: 3px; }
.hero h1 { margin: 16px 0 10px; font-size: clamp(38px, 10.5vw, 49px); line-height: 1.12; font-weight: 850; letter-spacing: -.045em; white-space: nowrap; }
.hero h1 > span:first-child { display: inline-block; margin-inline: 3px; font-family: Arial, sans-serif; font-style: italic; font-weight: 900; background: linear-gradient(155deg, #fff 15%, #9ba6b3 50%, #e4e8ef 65%, #606b78 95%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.title-dot { color: var(--accent); }
.hero p { margin: 0; color: #c3c8d0; font-size: 12px; line-height: 1.6; }
.hero p span { color: #8c949f; margin-left: 6px; }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr); gap: 15px; }
.upload-panel { min-width: 0; }
.dropzone { position: relative; display: grid; grid-template-columns: 42px 1fr; align-items: center; gap: 12px; min-height: 142px; padding: 20px; border: 1px solid #414852; border-radius: 16px; background: radial-gradient(ellipse at top right, #343e4d33, transparent 70%), linear-gradient(145deg, #1c2026, #111418); cursor: pointer; box-shadow: inset 0 1px 0 #ffffff0d; transition: border-color .2s, background .2s; }
.dropzone:hover, .dropzone.is-dragging { border-color: var(--accent); background: #1b2119; }
.dropzone input { position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; }
.dropzone:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }
.upload-icon { width: 42px; height: 44px; display: grid; place-items: center; background: #ffffff08; border: 1px solid #ffffff12; border-radius: 11px; color: #d4dce5; }
.upload-icon svg { width: 23px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.upload-copy strong { display: block; font-size: 17px; font-weight: 650; letter-spacing: -.03em; }
.upload-copy small { display: block; margin-top: 6px; font-size: 10px; color: var(--muted); }
.choose-button { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; min-height: 42px; padding: 0 14px; border: 1px solid #5d6671; border-radius: 8px; background: linear-gradient(125deg, #363b44, #272c34); color: #f1f4f7; font-size: 12px; font-weight: 600; box-shadow: inset 0 1px 0 #ffffff16; }
.choose-button > span { font-size: 19px; color: #b9c2ce; }
.heic-note { margin: 7px 3px 0; font-size: 9px; line-height: 1.5; color: #808996; }

.settings { display: flex; flex-direction: column; gap: 21px; padding: 20px 17px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; min-width: 0; }
.settings-title { display: flex; align-items: center; justify-content: space-between; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.settings h2 { margin: 0; font-size: 14px; font-weight: 650; letter-spacing: .025em; }
.section-index { color: var(--accent); margin-right: 8px; font: 11px/1 var(--mono); }
.text-button { min-height: 30px; padding: 4px 6px; margin: -7px -6px; border: 0; color: #a7b0bc; background: transparent; font-size: 11px; }
.text-button.danger { color: #b5b9c1; }
fieldset { padding: 0; margin: 0; border: 0; min-width: 0; }
legend, .range-row label { width: 100%; display: flex; justify-content: space-between; margin-bottom: 10px; color: #bac2cc; font-size: 11px; font-weight: 500; }
output { font: 10px/1.2 var(--mono); color: #c9d2dd; }
.segmented { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; padding: 3px; border: 1px solid #272b32; border-radius: 9px; background: #090b0e; }
#orientationControl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.segmented label, .crease-presets label { position: relative; cursor: pointer; }
.segmented input, .crease-presets input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.segmented span { display: grid; place-items: center; min-height: 40px; border-radius: 6px; color: #949eab; font-size: 11px; white-space: nowrap; transition: .15s; }
.segmented input:checked + span { color: #eef1f5; background: linear-gradient(#323841, #252b33); box-shadow: inset 0 1px 0 #ffffff21, 0 1px 3px #0006; font-weight: 600; }
.segmented input:focus-visible + span, .crease-presets input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.orientation-note, .split-note { margin: 9px 1px 0; color: #96a0ae; font-size: 10px; line-height: 1.7; }
.split-note { color: #efac9e; }
.range-row input { display: block; appearance: none; width: 100%; height: 5px; margin: 14px 0 6px; border: 0; border-radius: 20px; background: linear-gradient(90deg, #a8b6c7 0 var(--range, 50%), #30353d var(--range, 50%) 100%); outline: none; touch-action: pan-y; }
.range-row input::-webkit-slider-thumb { appearance: none; width: 23px; height: 23px; border: 3px solid #161a20; border-radius: 50%; background: #d8e0ea; box-shadow: 0 0 0 1px #6b7685, 0 2px 6px #0009; }
.range-row input::-moz-range-thumb { width: 18px; height: 18px; border: 3px solid #161a20; border-radius: 50%; background: #d8e0ea; box-shadow: 0 0 0 1px #6b7685; }
.crease-presets { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.crease-presets span { display: grid; place-items: center; min-height: 44px; border-radius: 8px; border: 1px solid #30353e; background: #191d23; color: #a1aab6; font-size: 12px; }
.crease-presets input:checked + span { color: var(--accent); background: #c2f36b12; border-color: #c2f36b9c; box-shadow: inset 0 0 0 1px #c2f36b0d; font-weight: 650; }
.crease-presets label:last-child input:checked + span { color: #ff9d8c; background: #ff735914; border-color: #ff9d8c88; }
.format-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); padding-top: 17px; }
.segmented.compact { grid-template-columns: 1fr 1fr; width: 137px; }
.segmented.compact span { min-height: 34px; font: 10px/1 var(--mono); }
.size-badge { text-align: right; padding-bottom: 6px; }
.size-badge span { display: block; color: #808b99; font-size: 9px; margin-bottom: 8px; }
.size-badge strong { display: block; color: #d2dae5; font: 11px/1 var(--mono); white-space: nowrap; }

.animation-setting { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; cursor: pointer; }
.animation-setting strong { display: block; color: #cbd4df; font-size: 12px; font-weight: 500; }
.animation-setting small { display: block; color: #8793a2; font-size: 10px; margin-top: 6px; }
.animation-setting input { position: absolute; right: 0; width: 44px; height: 28px; opacity: 0; }
.switch-track { flex: 0 0 44px; height: 27px; padding: 3px; border-radius: 20px; background: #343c47; transition: background .2s; }
.switch-track::after { content: ''; display: block; width: 21px; height: 21px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px #0005; transition: transform .2s; }
.animation-setting input:checked + .switch-track { background: #b7e95c; }
.animation-setting input:checked + .switch-track::after { transform: translateX(17px); background: #17220d; }
.animation-setting input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 4px; }
.animation-setting:has(input:disabled) { opacity: .5; }

.duo-stage { padding: 22px 15px 17px; border-radius: 10px; background: radial-gradient(ellipse at 50% 40%, #29313d88, #10141b 70%); }
.duo-preview { position: relative; width: 100%; aspect-ratio: 840 / 600; margin: 0 auto; }
.duo-preview[data-orientation="portrait"] { aspect-ratio: 600 / 840; max-width: 304px; }
.duo-model { position: absolute; inset: 0; width: 100%; height: 100%; visibility: hidden; }
.preview-fallback { position: absolute; inset: 6%; width: 88%; height: 88%; object-fit: fill; border-radius: 18px; }
.model-ready .duo-model { visibility: visible; }
.model-ready .preview-fallback { visibility: hidden; }
.model-status { position: absolute; bottom: 0; left: 0; width: 100%; text-align: center; font-size: 10px; color: #bbc3ce; background: #10141bc9; }
.model-status:empty { display: none; }
.replay-unfold { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; margin: 12px auto 0; padding: 0 14px; border: 1px solid #c2f36b38; border-radius: 22px; background: #c2f36b09; color: #c7e89d; font-size: 11px; }
.replay-unfold span { font-size: 18px; }
.duo-device { position: relative; width: min(100%, 304px); aspect-ratio: var(--device-ratio); margin: 0 auto; }
.duo-artwork { display: block; position: absolute; inset: 0; width: 100%; height: 100%; filter: drop-shadow(0 12px 16px #0008); }
.duo-screen { position: absolute; left: var(--screen-x); top: var(--screen-y); width: var(--screen-width); height: var(--screen-height); overflow: hidden; border-radius: var(--screen-radius); background: #030507; }
.duo-screen img { display: block; width: 100%; height: 100%; object-fit: fill; }
.duo-caption { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 17px; }
.duo-caption strong { color: #cbd4e0; font-size: 12px; font-weight: 500; letter-spacing: .08em; }
.duo-caption > span { color: #8c98a8; font-size: 9px; letter-spacing: .025em; }

.queue-section { padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.section-heading h2 { margin: 0; font-size: 14px; font-weight: 600; }
.section-heading h2 b { display: inline-grid; place-items: center; min-width: 19px; height: 19px; margin-left: 5px; border: 1px solid #3d4652; border-radius: 5px; background: #242b34; color: #cbd5e1; font: 10px/1 var(--mono); vertical-align: 1px; }
.queue { display: grid; gap: 8px; max-height: 212px; overflow-y: auto; overscroll-behavior: contain; }
.queue-item { display: grid; grid-template-columns: 36px minmax(0,1fr) 36px; gap: 10px; align-items: center; }
.queue-thumb { display: block; width: 36px; height: 42px; object-fit: cover; border-radius: 5px; background: #272d36; }
.queue-info { min-width: 0; }
.queue-info strong, .queue-info small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-info strong { font-size: 11px; font-weight: 500; }
.queue-info small { margin-top: 4px; font: 9px/1.2 var(--mono); color: #909baa; }
.remove-button { min-width: 36px; min-height: 42px; padding: 0; border: 0; background: none; color: #909baa; font-size: 20px; }

.results-section { margin-top: 28px; scroll-margin-top: 16px; }
.results-section .section-heading { margin-bottom: 15px; }
.results-section h2 { margin-top: 5px; font-size: 18px; }
.secondary-action { min-height: 38px; border: 1px solid #414b58; border-radius: 8px; background: #1b212a; color: #d7e1ed; padding: 0 12px; font-size: 11px; }
.result-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.result-card { padding: 10px; border: 1px solid #303741; border-radius: 15px; background: #14181d; }
.result-image { display: block; width: 100%; height: 100%; object-fit: fill; }
.result-status { position: absolute; top: 10px; right: 10px; border: 1px solid #ffffff24; border-radius: 4px; padding: 6px 7px; background: #0009; color: #e2e8f0; font: 9px/1 var(--mono); backdrop-filter: blur(10px); }
.result-footer { display: flex; flex-wrap: wrap; gap: 9px; padding: 14px 2px 2px; }
.result-name { flex-basis: 100%; min-width: 0; }
.result-name strong, .result-name small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-name strong { color: #d2dbe6; font-size: 11px; font-weight: 500; }
.result-name small { margin: 5px 0 3px; color: #8895a6; font: 9px/1 var(--mono); }
.save-button, .share-button { flex: 1; min-height: 44px; border: 1px solid #3b4756; border-radius: 8px; background: #252e3a; color: #e9eef6; font-size: 12px; font-weight: 600; }
.share-button { display: none; background: #c2f36b12; border-color: #c2f36b55; color: var(--accent); }
.can-share .share-button { display: block; }
.export-note { margin: 12px 5px 0; font-size: 10px; line-height: 1.7; text-align: center; color: #8b96a5; }

footer { display: flex; justify-content: center; align-items: center; gap: 9px; padding: 24px 20px calc(128px + env(safe-area-inset-bottom)); text-align: left; }
.privacy-lock { color: #747f8e; }
.privacy-lock svg { display: block; width: 19px; fill: none; stroke: currentColor; stroke-width: 1.4; }
footer strong { font-size: 10px; font-weight: 500; color: #98a2b0; letter-spacing: .02em; }
footer strong span { margin-inline: 3px; color: #535c68; }
footer p { margin: 4px 0 0; color: #7f8a99; font-size: 9px; }
.action-dock { position: fixed; z-index: 5; left: 50%; bottom: 0; transform: translateX(-50%); padding: 14px 18px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid #ffffff0c; background: #090b0eef; backdrop-filter: blur(20px); }
.primary-action { width: 100%; min-height: 58px; padding: 0 19px; display: flex; justify-content: space-between; align-items: center; border: 1px solid #deff98; border-radius: 12px; background: linear-gradient(120deg, #d2fa8f, #b7e95c); color: #15200a; box-shadow: inset 0 1px 0 #ffffff66, 0 5px 20px #0004; }
.primary-action:active { transform: scale(.99); }
.primary-action:disabled { border-color: #454e3a; background: linear-gradient(120deg, #343d28, #2b3521); color: #bdcaaa; box-shadow: inset 0 1px 0 #ffffff0a; cursor: default; }
.action-label { text-align: left; display: grid; gap: 4px; }
.button-label { font-size: 15px; font-weight: 700; letter-spacing: .025em; }
.button-meta { font: 9px/1.2 var(--mono); opacity: .65; }
.action-arrow { font-size: 26px; line-height: 1; font-weight: 300; }
.toast { position: fixed; z-index: 10; bottom: calc(106px + env(safe-area-inset-bottom)); left: 50%; max-width: calc(100vw - 36px); transform: translate(-50%, 10px); border: 1px solid #3d4856; border-radius: 10px; padding: 12px 16px; background: #242c36f5; color: #e4ebf5; backdrop-filter: blur(12px); font-size: 11px; line-height: 1.5; text-align: center; opacity: 0; pointer-events: none; transition: .2s; white-space: normal; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 600px) {
  body { background: radial-gradient(ellipse at 50% 0, #1a222c, #080a0d 65%); }
  .topbar, main, footer { border-left: 1px solid #ffffff06; border-right: 1px solid #ffffff06; background-color: var(--bg); }
  .topbar { padding-top: 24px; }
  main { min-height: 70vh; }
  .action-dock { border-inline: 1px solid #ffffff08; }
}
@media (max-width: 359px) {
  main { padding-inline: 13px; }
  .topbar { padding-inline: 17px; }
  .hero h1 { font-size: 37px; }
  .hero p { font-size: 11px; }
  .hero p span { margin-left: 4px; }
  .eyebrow { font-size: 8px; }
  .edition { font-size: 7px; }
  .settings { padding-inline: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
