:root {
  color-scheme: dark;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
  --night: #050505;
  --ink: #eeede8;
  --soft: rgba(238, 237, 232, .62);
  --muted: rgba(238, 237, 232, .36);
  --line: rgba(238, 237, 232, .13);
  --sky: #b9d6e4;
  --signal: #78d7ad;
  --memory: #e2aa72;
  --danger: #e9a59d;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }

body {
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 72% 34%, rgba(111, 150, 170, .075), transparent 32rem),
    var(--night);
}

button, input, textarea { font: inherit; }
button, label, a { -webkit-tap-highlight-color: transparent; }

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
a:focus-visible,
.photo-drop:focus-within {
  outline: 1px solid var(--sky);
  outline-offset: 4px;
}

.world-shell {
  width: min(1480px, 100%);
  min-height: 100svh;
  margin: 0 auto;
  padding: 22px clamp(18px, 4vw, 64px) max(22px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: clamp(24px, 4vh, 48px);
}

.world-header,
.world-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.brand {
  color: var(--ink);
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  font-size: 18px;
  letter-spacing: .24em;
  text-decoration: none;
}

.release-mark { display: flex; align-items: center; gap: 10px; }
.release-mark i { width: 5px; height: 5px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 14px var(--signal); }
.release-mark b { color: var(--soft); font-weight: 500; }

.world-intro { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 370px); gap: 28px; align-items: end; }
.eyebrow { grid-column: 1 / -1; margin: 0 0 -12px; color: var(--sky); font: 10px/1 ui-monospace, monospace; letter-spacing: .22em; }

.world-intro h1 {
  margin: 0;
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  font-size: clamp(34px, 5.2vw, 78px);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -.065em;
}

.world-intro h1 span { color: rgba(238, 237, 232, .43); }
.intro-copy { margin: 0 0 5px; color: var(--soft); font-size: 13px; line-height: 1.9; }

.world-workbench {
  min-height: min(690px, 70svh);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 318px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.world-stage {
  position: relative;
  min-width: 0;
  min-height: 610px;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(rgba(238,237,232,.026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(238,237,232,.026) 1px, transparent 1px);
  background-size: 42px 42px;
  isolation: isolate;
}

.world-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at center, transparent 20%, rgba(5,5,5,.74) 86%);
  z-index: 8;
}

.photo-drop,
.photo-preview,
.generation-state,
.world-result { position: absolute; inset: 0; z-index: 10; }

.photo-drop {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 22px;
  cursor: pointer;
}

.photo-drop::before,
.photo-drop::after {
  content: "";
  position: absolute;
  width: min(58vw, 640px);
  aspect-ratio: 16 / 10;
  border: 1px solid var(--line);
  pointer-events: none;
}

.photo-drop::after {
  width: min(48vw, 510px);
  transform: perspective(700px) rotateX(66deg) translateY(57%);
  transform-origin: center bottom;
  border-color: rgba(185,214,228,.14);
}

.photo-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-index { color: var(--muted); font: 10px/1 ui-monospace, monospace; letter-spacing: .16em; }
.drop-copy { display: grid; gap: 9px; text-align: center; }
.drop-copy b { font: 400 clamp(22px, 2.6vw, 36px)/1.2 "Songti SC", "STSong", serif; }
.drop-copy small { color: var(--muted); font-size: 11px; letter-spacing: .06em; }

.drop-action,
.generate-button {
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 0 22px;
  border: 1px solid rgba(238,237,232,.24);
  color: var(--ink);
  background: rgba(238,237,232,.04);
  font-size: 12px;
  letter-spacing: .08em;
}

.drop-action i,
.generate-button i { color: var(--sky); font-style: normal; }

.photo-preview { display: grid; align-content: center; gap: 24px; padding: clamp(62px, 8vw, 94px) clamp(24px, 5vw, 72px); }
.source-map-head { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font: 9px/1 ui-monospace, monospace; letter-spacing: .14em; }
.source-map-head b { color: var(--memory); font-weight: 500; }
.source-grid {
  width: min(790px, 100%);
  min-height: 280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(88px, 1fr));
  gap: clamp(9px, 1.4vw, 18px);
  align-items: center;
  perspective: 900px;
}
.source-card {
  position: relative;
  min-width: 0;
  aspect-ratio: 4 / 3;
  border: 1px solid rgba(226,170,114,.3);
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  background: #111;
  box-shadow: 0 22px 50px rgba(0,0,0,.34);
  transform: rotate(var(--tilt, 0deg)) translateY(var(--lift, 0));
}
.source-card:nth-child(2n) { --tilt: 1.8deg; --lift: -7px; }
.source-card:nth-child(3n) { --tilt: -1.4deg; --lift: 6px; }
.source-card img { width: 100%; height: 100%; display: block; object-fit: cover; }
.source-card > span { position: absolute; left: 7px; bottom: 7px; padding: 4px 6px; color: rgba(255,255,255,.82); background: rgba(5,5,5,.7); font: 8px/1 ui-monospace, monospace; letter-spacing: .1em; }
.source-card button {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 50%;
  color: #fff;
  background: rgba(5,5,5,.72);
  cursor: pointer;
}
.source-card.is-single { grid-column: 2 / span 2; aspect-ratio: 16 / 10; }
.coverage-note { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.6; text-align: center; }

.replace-photo {
  position: absolute;
  top: 18px;
  right: 18px;
  min-width: 78px;
  min-height: 44px;
  border: 1px solid var(--line);
  color: var(--soft);
  background: rgba(5,5,5,.7);
  cursor: pointer;
}

.generation-state { display: grid; place-items: center; align-content: center; gap: 14px; padding: 40px; text-align: center; }
.world-orbit { position: relative; width: 178px; height: 178px; margin-bottom: 18px; }
.world-orbit i { position: absolute; inset: 0; border: 1px solid rgba(185,214,228,.2); border-radius: 50%; }
.world-orbit i:nth-child(1) { transform: rotateX(64deg); }
.world-orbit i:nth-child(2) { transform: rotateY(64deg); }
.world-orbit i:nth-child(3) { transform: rotate(45deg) rotateX(68deg); }
.world-orbit i:nth-child(4) { inset: 76px; border: 0; background: var(--sky); box-shadow: 0 0 24px var(--sky); }
.world-stage[data-state="generating"] .world-orbit { animation: orbit 12s linear infinite; }
.state-step { margin: 0; color: var(--sky); font: 10px/1 ui-monospace, monospace; letter-spacing: .17em; }
.generation-state h2 { margin: 0; font: 400 clamp(25px, 3vw, 43px)/1.2 "Songti SC", "STSong", serif; }
.generation-state > p:not(.state-step) { max-width: 460px; margin: 0; color: var(--soft); font-size: 12px; line-height: 1.8; }
.state-meter { width: min(340px, 74%); height: 1px; margin-top: 17px; overflow: hidden; background: var(--line); }
.state-meter i { display: block; width: 8%; height: 100%; background: var(--sky); transition: width 900ms ease; }
.generation-state small { color: var(--muted); font: 10px/1 ui-monospace, monospace; }

.world-result { background: #000; }
.world-viewer { position: absolute; inset: 0; outline: none; }
.world-viewer canvas { display: block; width: 100%; height: 100%; }
.viewer-head,
.viewer-controls { position: absolute; left: 18px; right: 18px; z-index: 4; display: flex; justify-content: space-between; gap: 12px; pointer-events: none; }
.viewer-head { top: 18px; font: 9px/1 ui-monospace, monospace; letter-spacing: .14em; }
.viewer-head span { color: var(--signal); }
.viewer-head b { color: var(--soft); font-weight: 400; }
.viewer-controls { bottom: 18px; align-items: center; color: var(--muted); font-size: 9px; letter-spacing: .06em; }
.viewer-controls a { min-height: 42px; display: inline-flex; align-items: center; padding: 0 13px; border: 1px solid var(--line); color: var(--ink); background: rgba(5,5,5,.68); text-decoration: none; pointer-events: auto; }
.viewer-fallback { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; align-content: center; gap: 16px; background: #080808; text-align: center; }
.viewer-fallback p { color: var(--soft); }
.viewer-fallback a { color: var(--sky); }
.photo-portals {
  position: absolute;
  left: 18px;
  top: 52px;
  bottom: 68px;
  z-index: 6;
  width: 64px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: center;
  pointer-events: none;
}
.photo-portal {
  position: relative;
  width: 58px;
  aspect-ratio: 4 / 3;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(226,170,114,.46);
  color: var(--ink);
  background: rgba(5,5,5,.72);
  box-shadow: 0 10px 22px rgba(0,0,0,.34);
  cursor: pointer;
  pointer-events: auto;
  transition: width 160ms ease, border-color 160ms ease;
}
.photo-portal:hover { width: 68px; border-color: var(--memory); }
.photo-portal img { width: 100%; height: 100%; display: block; object-fit: cover; }
.photo-portal span { position: absolute; left: 3px; bottom: 3px; padding: 2px 3px; color: #fff; background: rgba(0,0,0,.72); font: 7px/1 ui-monospace, monospace; }
.source-overlay {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: grid;
  place-items: center;
  padding: 66px 32px 74px 92px;
  background: rgba(5,5,5,.88);
  backdrop-filter: blur(14px);
}
.source-overlay img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; box-shadow: 0 24px 70px rgba(0,0,0,.68); }
.source-overlay > div { position: absolute; left: 92px; right: 24px; bottom: 20px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.source-overlay span { color: var(--memory); font: 9px/1 ui-monospace, monospace; letter-spacing: .14em; }
.source-overlay button { min-height: 42px; border: 1px solid var(--line); padding: 0 13px; color: var(--ink); background: rgba(5,5,5,.72); cursor: pointer; }

.world-console { padding: 24px 0 24px 26px; display: flex; flex-direction: column; justify-content: space-between; gap: 32px; }
.world-console form { display: grid; gap: 12px; }
.console-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 14px; color: var(--muted); font: 9px/1 ui-monospace, monospace; letter-spacing: .13em; }
.console-head output { color: var(--soft); text-align: right; }
.console-head output.is-live { color: var(--signal); }
.console-head output.is-error { color: var(--danger); }
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 0 0 10px; }
.mode-switch button { display: grid; gap: 5px; min-height: 64px; border: 1px solid var(--line); padding: 10px 11px; color: var(--muted); background: transparent; text-align: left; cursor: pointer; }
.mode-switch button[aria-pressed="true"] { border-color: rgba(185,214,228,.45); color: var(--ink); background: rgba(185,214,228,.075); }
.mode-switch button:disabled { cursor: not-allowed; opacity: .5; }
.mode-switch b { font-size: 11px; font-weight: 500; }
.mode-switch small { color: var(--muted); font: 8px/1 ui-monospace, monospace; letter-spacing: .08em; }
.field-label { margin-top: 5px; color: var(--soft); font-size: 11px; letter-spacing: .08em; }
.field-label small { color: var(--muted); }
.world-console input:not([type="checkbox"]),
.world-console textarea { width: 100%; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 11px 0; color: var(--ink); background: transparent; outline-offset: 2px; resize: vertical; }
.world-console input::placeholder,
.world-console textarea::placeholder { color: rgba(238,237,232,.26); }
.consent-row { margin: 13px 0 5px; display: grid; grid-template-columns: 18px 1fr; gap: 10px; color: var(--muted); font-size: 10px; line-height: 1.7; cursor: pointer; }
.consent-row input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--sky); }
.terms-link { display: inline-block; margin: 0 0 10px 28px; color: var(--muted); font-size: 9px; text-underline-offset: 3px; }
.terms-link:hover { color: var(--ink); }
.generate-button { width: 100%; margin-top: 6px; justify-content: space-between; cursor: pointer; transition: color 180ms ease, background 180ms ease; }
.generate-button:not(:disabled):hover { color: #050505; background: var(--ink); }
.generate-button:disabled { cursor: not-allowed; opacity: .34; }
.form-status { min-height: 32px; margin: 2px 0 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.form-status.is-error { color: var(--danger); }
.truth-note { border-top: 1px solid var(--line); padding-top: 18px; color: var(--muted); font-size: 10px; line-height: 1.65; }
.truth-note > span { font: 9px/1 ui-monospace, monospace; letter-spacing: .13em; }
.truth-note p { margin: 10px 0 0; }
.truth-note b { color: var(--soft); font-weight: 500; }
.truth-note small { display: block; margin-top: 13px; padding-top: 12px; border-top: 1px solid rgba(238,237,232,.08); color: rgba(238,237,232,.28); font-size: 9px; line-height: 1.65; }
.world-footer { padding-top: 2px; }

@keyframes scan { 0%, 100% { transform: translateY(-115px); opacity: .18; } 50% { transform: translateY(115px); opacity: .9; } }
@keyframes orbit { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .world-intro { grid-template-columns: 1fr; }
  .world-workbench { grid-template-columns: 1fr; }
  .world-stage { min-height: min(66svh, 590px); border-right: 0; border-bottom: 1px solid var(--line); }
  .world-console { padding: 24px 0; }
  .photo-drop::before { width: min(78vw, 640px); }
  .photo-drop::after { width: min(68vw, 510px); }
}

@media (max-width: 560px) {
  .world-shell { gap: 24px; padding-top: 16px; }
  .release-mark span { display: none; }
  .world-intro h1 { font-size: clamp(34px, 12vw, 54px); }
  .intro-copy { font-size: 12px; }
  .world-workbench { margin-inline: -18px; }
  .world-stage { min-height: 520px; }
  .world-console { padding-inline: 18px; }
  .photo-preview { padding: 62px 16px 52px; }
  .source-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); min-height: 320px; align-content: center; }
  .source-card.is-single { grid-column: 1 / -1; }
  .photo-portals { top: auto; left: 12px; right: 92px; bottom: 15px; width: auto; height: 52px; flex-direction: row; justify-content: flex-start; overflow-x: auto; }
  .photo-portal, .photo-portal:hover { flex: 0 0 58px; width: 58px; }
  .source-overlay { padding: 62px 14px 82px; }
  .source-overlay > div { left: 14px; right: 14px; bottom: 20px; }
  .viewer-controls span { display: none; }
  .viewer-controls { justify-content: flex-end; }
  .world-footer { display: grid; line-height: 1.6; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition-duration: .01ms !important; }
}
#world-model{width:100%;font:inherit;padding:12px;border:1px solid #c9a45b;border-radius:8px;background:#f5eef9;color:#413757}
