:root {
  --bg: #ffffff;
  --panel: #fbfaf8;
  --line: rgba(36, 25, 17, 0.22);
  --muted: #756b63;
  --text: #17110d;
  --lime: #8a5a3b;
  --violet: #b98a68;
  --danger: #a22c24;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
  overflow-x: hidden;
}
button, input { font: inherit; }
button, label { -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }

.ambient { position: fixed; width: 520px; height: 520px; border-radius: 50%; filter: blur(130px); opacity: .13; pointer-events: none; }
.ambient-one { background: #d8bfae; top: -220px; right: -120px; }
.ambient-two { background: #b98765; bottom: -330px; left: -240px; opacity: .07; }
.shell { position: relative; width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.topbar { height: 86px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.nav-links { display: flex; gap: 28px; margin-left: auto; margin-right: 34px; }
.nav-links a { color: var(--muted); text-decoration: none; font-size: 12px; }
.nav-links a:hover { color: var(--text); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 750; letter-spacing: -.02em; }
.brand-mark { width: 30px; height: 30px; display: grid; place-items: center; color: #090a0d; background: var(--lime); border-radius: 9px; font-weight: 900; }
.brand small { color: var(--muted); font-size: 9px; letter-spacing: .16em; border: 1px solid var(--line); padding: 4px 6px; border-radius: 20px; }
.local-state { font-size: 12px; color: #bcc0c8; display: flex; align-items: center; gap: 8px; }
.local-state span { width: 7px; height: 7px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 16px var(--lime); }
.local-state b { font: inherit; font-weight: 500; }
.local-state.warming span, .local-state.busy span { background: #ffc857; box-shadow: 0 0 16px #ffc857; }
.local-state.cold span, .local-state.cold-start span { background: #8b8f99; box-shadow: none; }

.video-progress { width: min(360px, 100%); display: grid; gap: 9px; text-align: left; }
.video-progress > div:first-child { display: flex; justify-content: space-between; gap: 18px; color: #d9dce2; font-size: 12px; }
.video-progress > div:first-child b { color: var(--lime); font-variant-numeric: tabular-nums; }
.video-progress-track { height: 7px; overflow: hidden; border-radius: 99px; background: #292c33; box-shadow: inset 0 0 0 1px rgba(255,255,255,.04); }
.video-progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #a8f52f, var(--lime)); box-shadow: 0 0 18px rgba(193,255,59,.35); transition: width .45s ease; }

.hero { min-height: 235px; display: grid; grid-template-columns: 1.25fr .75fr; align-items: center; border-bottom: 1px solid var(--line); }
.eyebrow { margin: 0 0 14px; color: var(--lime); font-size: 10px; font-weight: 800; letter-spacing: .19em; }
.hero h1 { margin: 0; max-width: 760px; font-size: clamp(38px, 4.2vw, 58px); line-height: 1; letter-spacing: -.055em; font-weight: 620; }
.hero h1 em { color: #a9a8ae; font-style: normal; }
.lead { max-width: 650px; margin: 16px 0 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.hero-orbit { position: relative; height: 190px; display: grid; place-items: center; }
.orbit { position: absolute; border: 1px solid rgba(255,255,255,.11); border-radius: 50%; transform: rotate(-22deg); }
.orbit-a { width: 220px; height: 88px; }
.orbit-b { width: 164px; height: 164px; border-color: rgba(201,255,74,.15); }
.hero-tile { position: relative; width: 98px; aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 23px; color: #111; background: linear-gradient(145deg, #d8ff76, #9ede24); box-shadow: 0 30px 90px rgba(171, 237, 46, .2); transform: rotate(8deg); }
.hero-tile span { font-size: 26px; font-weight: 900; letter-spacing: -.06em; }
.hero-tile b { margin-top: 5px; font-size: 11px; opacity: .58; }

.workspace { display: grid; grid-template-columns: .76fr 1.24fr; align-items: stretch; gap: 20px; padding: 64px 0 30px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 24px; padding: 28px; backdrop-filter: blur(20px); }
.panel-heading { display: flex; align-items: center; gap: 14px; }
.panel-heading > span { color: var(--muted); font: 11px/1 monospace; }
.panel-heading p { margin: 0 0 3px; color: var(--muted); font-size: 11px; }
.panel-heading h2 { margin: 0; font-size: 23px; letter-spacing: -.04em; }
.template-select-label { min-width: 0; display: grid; gap: 3px; }
.template-select-label > span { color: var(--muted); font-size: 11px; }
.template-select-label select { min-width: 150px; padding: 0 28px 0 0; color: var(--text); background: transparent; border: 0; outline: 0; cursor: pointer; font-size: 23px; font-weight: 700; letter-spacing: -.04em; }
.template-select-label select:focus-visible { box-shadow: 0 2px 0 var(--lime); }
.template-select-label option { color: #111318; background: #f3f3ef; font-size: 14px; }
.guide-title { margin: 10px 0 18px; color: var(--muted); font-size: 11px; }
.guide-carousel { position: relative; }
.guide-viewport { overflow: hidden; border-radius: 18px; }
.guide-track { display: flex; transition: transform .24s ease; }
.guide-scene { position: relative; flex: 0 0 100%; aspect-ratio: 1; overflow: hidden; background: linear-gradient(145deg, #d6d3cb, #858b8e); }
.guide-scene:not(.has-image):not(.has-video) { aspect-ratio: 1.26; }
.guide-scene::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(0,0,0,.34)), linear-gradient(135deg, transparent 58%, rgba(255,255,255,.14) 59% 62%, transparent 63%); pointer-events: none; }
.guide-scene.has-image::after { background: linear-gradient(180deg, transparent 72%, rgba(0,0,0,.18)); }
.guide-scene.has-video::after { display: none; }
.guide-scene > img, .guide-scene > video { width: 100%; height: 100%; display: block; object-fit: cover; }
.guide-scene.has-video { background: #111; }
.guide-scene.has-video > video { object-fit: cover; }
.guide-scene:nth-child(2n) { background: linear-gradient(145deg, #c9c8c0, #737a80); }
.guide-frame { position: absolute; background: #efebe2; border: 7px solid #805b3d; box-shadow: 0 12px 24px rgba(0,0,0,.28); }
.guide-frame.one { left: 13%; top: 15%; width: 35%; height: 65%; transform: rotate(-3deg); }
.guide-frame.two { right: 11%; top: 25%; width: 30%; height: 50%; transform: rotate(4deg); }
.guide-frame.three { left: 32%; top: 13%; width: 38%; height: 68%; transform: rotate(2deg); }
.guide-frame.four { left: 10%; bottom: 10%; width: 40%; height: 34%; transform: rotate(-4deg); }
.guide-marker { position: absolute; z-index: 3; width: 27px; height: 27px; display: grid; place-items: center; color: #090a0d; background: var(--lime); border: 2px solid #090a0d; border-radius: 50%; box-shadow: 0 3px 12px rgba(0,0,0,.4); font-size: 9px; font-weight: 900; }
.guide-marker.marker-1 { left: 38%; top: 10%; }
.guide-marker.marker-2 { right: 7%; top: 19%; }
.guide-marker.marker-3 { left: 26%; top: 8%; }
.guide-marker.marker-4 { right: 14%; bottom: 11%; }
.guide-marker.marker-5 { left: 34%; bottom: 29%; }
.carousel-arrow { position: absolute; z-index: 5; top: 50%; width: 40px; height: 40px; display: grid; place-items: center; transform: translateY(-50%); color: var(--text); background: rgba(8,9,11,.82); border: 1px solid rgba(255,255,255,.18); border-radius: 50%; cursor: pointer; backdrop-filter: blur(8px); transition: opacity .18s ease, background .18s ease; }
.carousel-arrow:hover:not(:disabled) { background: rgba(8,9,11,.96); }
.carousel-arrow:disabled { opacity: .28; cursor: default; }
.carousel-arrow.previous { left: 12px; }
.carousel-arrow.next { right: 12px; }
.guide-meta { margin: 12px 0 20px; display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; color: var(--muted); font-size: 10px; }
.guide-meta strong { color: var(--text); font-size: 11px; }
.guide-meta span:nth-child(2) { text-align: center; }
.guide-meta span:last-child { font-variant-numeric: tabular-nums; }
.specs { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.specs div { padding: 15px; background: #15171c; }
.specs dt { color: var(--muted); font-size: 10px; }
.specs dd { margin: 5px 0 0; font-size: 13px; font-weight: 650; }

.control-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.control-panel { display: flex; flex-direction: column; container-type: inline-size; container-name: slot-panel; }
.control-panel .primary-button { margin-top: 16px; flex-shrink: 0; }
.slot-count { color: var(--lime); font-size: 10px; letter-spacing: .08em; }
.slots-container { max-height: 760px; margin-top: 22px; padding-right: 4px; display: grid; gap: 8px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(201,255,74,.35) transparent; }
.slot-upload { position: relative; min-width: 0; min-height: 68px; padding: 9px 10px; display: grid; grid-template-columns: 38px 42px minmax(0, 1fr) minmax(112px, .72fr) auto; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.025); cursor: pointer; overflow: hidden; transition: .2s ease; }
.slot-upload:hover { border-color: rgba(201,255,74,.55); background: rgba(201,255,74,.035); }
.slot-upload input { position: absolute; opacity: 0; pointer-events: none; }
.slot-number { width: 34px; height: 34px; display: grid; place-items: center; color: var(--lime); border: 1px solid rgba(201,255,74,.35); border-radius: 9px; font: 10px/1 monospace; }
.slot-thumb { width: 34px; height: 44px; overflow: hidden; border-radius: 6px; background: linear-gradient(145deg, #f2ca9f, #8b526d 48%, #274356); box-shadow: inset 0 0 0 1px rgba(255,255,255,.22); }
.slot-preview { width: 100%; height: 100%; display: block; object-fit: cover; }
.slot-copy, .slot-dimensions { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.slot-copy strong, .slot-dimensions strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11px; }
.slot-copy small, .slot-dimensions small { color: var(--muted); font-size: 9px; }
.slot-choice { min-width: 62px; display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.slot-ready { color: var(--lime); font-size: 9px; }
.slot-choice b { padding: 7px 10px; color: var(--text); border: 1px solid var(--line); border-radius: 999px; font-size: 9px; font-weight: 600; }
.primary-button, .secondary-button, .download-button { border: 0; cursor: pointer; text-decoration: none; transition: transform .18s ease, opacity .18s ease; }
.primary-button { width: 100%; min-height: 57px; padding: 0 20px; display: flex; justify-content: space-between; align-items: center; color: #fff; background: #111; border-radius: 14px; font-weight: 850; }
.primary-button b { font-size: 23px; }
.primary-button:hover:not(:disabled), .secondary-button:hover:not(:disabled), .download-button:hover { transform: translateY(-2px); }
button:disabled { cursor: not-allowed; opacity: .3; }
.status-line { min-height: 18px; margin: 11px 2px 0; color: var(--muted); text-align: center; font-size: 11px; }
.status-line.error { color: var(--danger); }

.results { padding: 56px 0 70px; }
.results-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 22px; }
.results-heading h2, .video-panel h2 { margin: 0; font-size: 34px; letter-spacing: -.05em; }
.scene-heading-line { display: flex; align-items: center; gap: 13px; }
.scene-spinner { width: 19px; height: 19px; flex: 0 0 auto; border: 2px solid rgba(128,128,128,.26); border-top-color: var(--lime); border-radius: 50%; animation: scene-spin .72s linear infinite; }
@keyframes scene-spin { to { transform: rotate(360deg); } }
.progress-pill { display: flex; align-items: center; gap: 9px; padding: 9px 13px; color: var(--muted); border: 1px solid var(--line); border-radius: 30px; font-size: 10px; }
.progress-pill span { width: 7px; height: 7px; border-radius: 50%; background: #555a62; }
.progress-pill.active span { background: var(--lime); box-shadow: 0 0 13px var(--lime); animation: pulse 1.2s infinite; }
.progress-pill.ready span { background: var(--lime); }
.progress-pill.failed span { background: var(--danger); }
@keyframes pulse { 50% { opacity: .25; } }
.scene-carousel { position: relative; }
.scene-viewport { overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; -ms-overflow-style: none; }
.scene-viewport::-webkit-scrollbar { display: none; }
.scene-grid { min-width: 100%; display: flex; gap: 16px; }
.scene-card { position: relative; flex: 0 0 calc((100% - 32px) / 3); aspect-ratio: 1; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: #121419; scroll-snap-align: start; }
.scene-arrow.previous { left: -20px; }
.scene-arrow.next { right: -20px; }
.scene-scroll-hint { margin: 10px 0 0; color: var(--muted); text-align: center; font-size: 9px; }
.scene-card img, .scene-card canvas { width: 100%; height: 100%; object-fit: cover; display: block; animation: reveal .5s both; }
@keyframes reveal { from { opacity: 0; transform: scale(1.03); } }
.scene-label { position: absolute; left: 13px; bottom: 13px; z-index: 2; padding: 7px 10px; background: rgba(7,8,10,.75); border: 1px solid rgba(255,255,255,.12); border-radius: 20px; backdrop-filter: blur(8px); font-size: 10px; }
.scene-wait { position: absolute; inset: 0; display: grid; place-items: center; color: #656a73; font-size: 11px; }
.scene-wait::before { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.04) 48%, transparent 65%); transform: translateX(-100%); animation: shimmer 2.2s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.video-panel { margin-top: 20px; padding: 30px; display: flex; justify-content: space-between; align-items: center; gap: 30px; border: 1px solid var(--line); border-radius: 20px; background: linear-gradient(115deg, rgba(136,116,255,.1), rgba(255,255,255,.02)); }
.final-panel { background: linear-gradient(115deg, rgba(193,255,59,.1), rgba(255,255,255,.02)); }
.video-panel > div:first-child { max-width: 650px; }
.video-panel p:not(.eyebrow) { margin: 12px 0 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.video-action { min-width: 230px; display: flex; flex-direction: column; align-items: stretch; gap: 9px; }
.secondary-button, .download-button { min-height: 48px; display: grid; place-items: center; color: var(--text); background: #292c34; border: 1px solid rgba(255,255,255,.12); border-radius: 12px; font-weight: 700; font-size: 12px; }
.download-button { color: #0d1009; background: var(--lime); grid-template-columns: 1fr auto; padding: 0 17px; }
.download-button span { font-size: 18px; }
.video-action small { color: var(--muted); text-align: center; font-size: 10px; }
.browser-video-preview { width: min(480px, 100%); aspect-ratio: 1; margin: 20px auto 0; overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: #000; box-shadow: 0 18px 50px rgba(0,0,0,.18); }
.browser-video-preview canvas { display: block; width: 100%; height: 100%; }
footer { height: 84px; display: flex; align-items: center; justify-content: space-between; color: #62666e; border-top: 1px solid var(--line); font-size: 10px; }

/* V-15 client confirmation theme: light, square, brown-accented. */
*:not(.ambient):not(.orbit) { border-radius: 0 !important; }
.workspace { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.nav-links a:hover, .brand, .local-state, .guide-meta strong { color: var(--text); }
.brand-mark, .hero-tile, .download-button, .guide-marker { color: #fff; background: #7a4b2f; }
.orbit { border-color: rgba(122,75,47,.24); }
.brand small, .local-state, footer { color: var(--muted); }
.local-state span, .local-state.warming span, .local-state.busy span { background: #8a5a3b; box-shadow: none; }
.hero-tile { box-shadow: 12px 12px 0 #e8ddd5; }
.panel { background: var(--panel); backdrop-filter: none; }
.guide-viewport, .scene-card { border: 1px solid var(--line); }
.carousel-arrow { color: #fff; background: #7a4b2f; border-color: #7a4b2f; backdrop-filter: none; }
.carousel-arrow:hover:not(:disabled) { background: #5f3823; }
.specs { background: var(--line); }
.specs div, .slot-upload { background: #fff; }
.slot-upload:hover { border-color: #8a5a3b; background: #faf5f1; }
.slot-number { color: #7a4b2f; border-color: #8a5a3b; }
.slot-thumb { background: #fff; border: 1px solid #aaa; box-shadow: none; }
.slot-ready, .slot-count, .eyebrow { color: #7a4b2f; }
.slot-choice b { color: var(--text); border-color: var(--line); background: #fff; }
.slots-container { scrollbar-color: #8a5a3b transparent; }
.progress-pill { background: #fff; }
.progress-pill span, .progress-pill.active span, .progress-pill.ready span { background: #8a5a3b; box-shadow: none; }
.scene-card { background: #f3f0ed; }
.scene-wait { color: #776f69; }
.scene-label { color: #fff; background: #7a4b2f; border-color: #7a4b2f; backdrop-filter: none; }
.video-panel { background: #e8e8e8; border-color: #c7c7c7; }
.video-panel.final-panel { background: #e7e2dc; border-color: #bfae9f; }
.secondary-button { color: var(--text); background: #fff; border-color: var(--line); }
.video-progress-track { background: #e5ddd8; }
.video-progress-track span { background: #8a5a3b; box-shadow: none; }
.template-select-label option { color: #17110d; background: #fff; }

.topbar { position: sticky; top: 0; z-index: 20; background: #000; color: #fff; padding: 0 24px; border: 0; transition: background .25s ease, backdrop-filter .25s ease; }
.topbar.is-scrolled { background: linear-gradient(180deg, rgba(0,0,0,.88), rgba(0,0,0,.38)); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.topbar .brand, .topbar .nav-links a, .topbar .local-state { color: #fff; }
.topbar .nav-links a:hover { color: #ccc; }
.topbar .brand small { display: none; }
.template-name { position: relative; justify-self: end; max-width: 100%; min-width: 100px; font-size: clamp(24px, 3.2vw, 44px); font-weight: 600; letter-spacing: -.04em; overflow-wrap: anywhere; }
.template-name select { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.template-name:focus-within { outline: 2px solid var(--lime); outline-offset: 8px; }
.guide-title { margin: 0 0 20px; font-size: 13px; color: var(--text); }
.template-description { max-width: 650px; margin: 20px 0 0; border-top: 1px solid var(--line); }
.template-description summary { min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 16px; color: var(--text); cursor: pointer; list-style: none; font-size: 12px; font-weight: 650; }
.template-description summary::-webkit-details-marker { display: none; }
.template-description summary span { font-size: 18px; font-weight: 400; transition: transform .18s ease; }
.template-description[open] summary span { transform: rotate(45deg); }
.template-description p { margin: -2px 0 15px; color: var(--muted); font-size: 11px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.panel { min-width: 0; }
.slots-container { align-content: start; }
.slot-count { flex-shrink: 0; }
.results, .workspace { scroll-margin-top: 100px; }
.status-line.error { text-align: left; margin: 0 0 20px; }
@media (max-width: 1000px) and (min-width: 801px) {
  .panel { padding: 18px; }
}

/* Keep the original five columns and text hierarchy in the narrower panel. */
@container slot-panel (max-width: 480px) {
  .slot-upload { grid-template-columns: 34px 34px minmax(24px, 1fr) minmax(88px, .72fr) auto; gap: 6px; padding-inline: 6px; }
}

@media (max-width: 800px) {
  .shell { width: min(100% - 24px, 620px); }
  .hero { min-height: 280px; grid-template-columns: 1fr; gap: 28px; padding: 40px 0 28px; }
  .template-name { justify-self: start; }
  .workspace { grid-template-columns: 1fr; padding-top: 36px; }
  .scene-card { flex-basis: calc((100% - 16px) / 2); }
  .slots-container { max-height: none; overflow: visible; }
  .video-panel { align-items: stretch; flex-direction: column; }
}

@media (max-width: 480px) {
  .local-state { font-size: 0; }
  .nav-links { display: none; }
  .hero h1 { font-size: 43px; }
  .panel { padding: 20px; }
  .scene-card { flex-basis: 100%; }
  .topbar { padding: 0 16px; height: 70px; }
  .guide-meta { grid-template-columns: 1fr auto; }
  .guide-meta span:nth-child(2) { display: none; }
  footer { flex-direction: column; justify-content: center; gap: 8px; }
}
