@import url('https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&display=swap');

:root {
  color-scheme: dark;
  --background: #111316;
  --surface: #191c20;
  --surface-raised: #202429;
  --line: #2b3036;
  --text: #f0f3f5;
  --muted: #a0a8af;
  --accent: #43d1f5;
  --focus: #7cdef8;
  font-family: Geist, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
* { box-sizing: border-box }
html { scroll-behavior: smooth }
body { margin: 0; color: var(--text); background: var(--background); font-size: 14px; line-height: 1.5 }
[hidden] { display: none !important }
a { color: inherit; text-decoration: none }
button, input, select, textarea { font: inherit; color: inherit }
button { cursor: pointer }
button:disabled { cursor: default; opacity: .42 }
button, a, textarea, input, select, label.upload { -webkit-tap-highlight-color: transparent }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px }
h1,h2,h3,p { margin: 0 }
img { max-width: 100%; display: block }
.topbar {
  position: sticky; top: 0; z-index: 10; display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center; min-height: 68px; padding: 0 clamp(24px, 4.7vw, 72px);
  border-bottom: 1px solid #25292d; background: #121417;
}
.brand { display: inline-flex; gap: 11px; align-items: center; justify-self: start; font-size: 22px; font-weight: 700; letter-spacing: .03em }
.brand-mark { width: 29px; height: 27px; position: relative; display: inline-block; transform: skewX(-16deg); margin-left: 3px }
.brand-mark::before,.brand-mark::after { position: absolute; content: ""; width: 12px; height: 23px; border-radius: 2px; background: var(--accent) }
.brand-mark::after { left: 15px; top: 5px; height: 18px; background: #b7effb }
.brand small { font-size: 10px; color: #a5b0b7; letter-spacing: .15em; margin-left: 3px }
.site-nav { display: flex; gap: clamp(16px, 2.5vw, 36px); align-items: stretch; align-self: stretch }
.site-nav a { white-space: nowrap; color: var(--muted); padding: 22px 0; border-bottom: 2px solid transparent }
.site-nav a:hover,.site-nav a.active { color: var(--text) }
.site-nav a.active { border-color: var(--accent) }
.button { border: 1px solid transparent; min-height: 40px; border-radius: 7px; padding: 8px 16px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; font-weight: 600; white-space: nowrap }
.primary { background: var(--accent); color: #0d2228 }
.primary:hover:not(:disabled) { background: #8ce7ff }
.secondary { background: var(--surface-raised); border-color: var(--line); color: var(--text) }
.secondary:hover:not(:disabled) { background: #2c333a }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap }
.output-actions { margin-top: 10px }
.output-actions .button { flex: 1 }
.join { justify-self: end; font-weight: 500 }
.site-main { width: min(1460px, 100%); margin: auto; padding: 34px clamp(24px,4.7vw,72px) 0 }
.hero { position: relative; isolation: isolate; min-height: 320px; overflow: hidden; border: 1px solid #28333b; border-radius: 13px; background: #151d23; display: flex; align-items: center }
.hero-content { padding: 46px clamp(24px,4vw,60px); }
.studio-label { display: flex; align-items: center; gap: 10px; font-size: 11px; letter-spacing: .16em; color: #a4c9d1; font-weight: 600 }
.studio-label span { width: 15px; height: 1px; background: var(--accent) }
.hero h1 { font-size: clamp(32px,4vw,57px); letter-spacing: -.065em; margin-top: 12px; line-height: 1.2; font-weight: 700 }
.hero p { color: #bbc6ce; margin: 15px 0 28px; font-size: 15px }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px }
.mode-card { display: flex; align-items: center; gap: 17px; padding: 22px; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 11px; transition: background .15s,border .15s }
.mode-card:hover { border-color: #41869a; background: #1c242a }
.mode-icon { width: 48px; height: 48px; border-radius: 9px; display: grid; place-items: center; font-size: 27px; color: var(--accent); background: #19323a; flex: none }
.icon-remix { color: #c4d6ff; background: #283141 }
.mode-text { flex: 1; min-width: 0 }
.mode-text strong { display: block; font-size: 18px; letter-spacing: -.03em }
.mode-text small { display: block; color: var(--muted); margin-top: 4px; font-size: 12px }
.mode-action { flex: none; color: #a7c5cc; font-size: 12px; white-space: nowrap }
.mode-action b { color: var(--accent); margin-left: 5px }
.gallery { margin-top: 44px; scroll-margin-top: 86px }
.gallery-head { display: flex; justify-content: space-between; align-items: end; gap: 18px; margin-bottom: 18px }
.gallery h2,.page-head h1 { font-weight: 650; letter-spacing: -.04em }
.gallery h2 { font-size: 25px }
.gallery-head p,.page-head p { color: var(--muted); margin-top: 5px }
.filters { display: flex; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 7px }
.filter { border: 0; border-radius: 4px; background: none; padding: 6px 11px; color: var(--muted); white-space: nowrap; font-size: 12px }
.filter.active { background: #28363d; color: #bdefff }
.work-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 16px }
.work-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--surface) }
.work-image { position: relative; aspect-ratio: 1.54; overflow: hidden; background: #263139 }
.work-image img { height: 100%; width: 100%; object-fit: cover; transition: transform .25s }
.work-card:hover img { transform: scale(1.04) }
.work-image span { position: absolute; top: 10px; left: 10px; border-radius: 4px; background: #101418bf; color: #fff; padding: 4px 7px; font-size: 10px }
.work-body { padding: 13px 14px 14px }
.work-body h3 { font-size: 15px; overflow-wrap: anywhere }
.work-meta { display: flex; gap: 8px; justify-content: space-between; align-items: center; margin-top: 9px; color: var(--muted); font-size: 11px }
.work-meta button { padding: 5px 8px; font-size: 11px; min-height: 30px }
.site-footer { display: flex; justify-content: space-between; margin-top: 36px; padding: 20px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px }
.text-button { border: 0; background: transparent; color: var(--muted); padding: 0 }
.text-button:hover { color: var(--accent) }
.ai-signin { color: var(--accent); text-decoration: underline; text-underline-offset: 3px }
.page-head { display: flex; justify-content: space-between; align-items: end; gap: 18px; margin-bottom: 20px }
.back { color: var(--muted); font-size: 12px }
.back:hover { color: var(--accent) }
.page-head h1 { font-size: 38px; margin-top: 8px; line-height: 1.2 }
.board { height: 520px; overflow: hidden; position: relative; touch-action: none; background-color: #161a1e; background-image: radial-gradient(#38434b 1px,transparent 1px); background-size: 19px 19px; border: 1px solid var(--line); border-radius: 11px; cursor: grab }
.board.dragging { cursor: grabbing; user-select: none }
.world { position: absolute; transform-origin: 0 0; width: 1225px; height: 365px; pointer-events: none }
.node { pointer-events: auto; cursor: auto; position: absolute; width: 280px; min-height: 198px; top: 0; border: 1px solid #353e46; border-radius: 10px; background: #1b2025; padding: 15px; box-shadow: 0 8px 30px #0003 }
.node header { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; font-weight: 600 }
.node-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent) }
.source-node { left: 0 }
.frames-node { left: 315px }
.idea-node { left: 630px }
.prompt-node { left: 945px }
.connector { position: absolute; width: 35px; height: 1px; top: 32px; background: #6595a4; pointer-events: none; transform-origin: left center }
.connector::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); position: absolute; right: 0; top: -2.5px }
.c1 { left: 280px } .c2 { left: 595px } .c3 { left: 910px }
.board-top { display: flex; gap: 12px; align-items: center; position: absolute; z-index: 2; top: 14px; left: 14px; padding: 8px 12px; background: #1c2229; border: 1px solid var(--line); border-radius: 6px }
.board-top small,.board-foot { font-size: 11px; color: var(--muted) }
.board-tools { position: absolute; z-index: 2; bottom: 14px; left: 14px; display: flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 7px; background: #1c2229; padding: 4px; cursor: auto }
.board-tools button,.icon-button { border: 0; background: none; padding: 7px 10px; border-radius: 4px }
.board-tools button:hover,.icon-button:hover { background: #303c46 }
.board-tools span { color: var(--muted); width: 50px; text-align: center }
.board-foot { position: absolute; bottom: 18px; right: 15px; background: #181e23; padding: 6px }
.node [data-node-handle] { cursor: grab; touch-action: none; user-select: none }
.node { z-index: 1 }
.board.dragging .node [data-node-handle] { cursor: grabbing }
.node-shortcuts { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px }
.node-shortcuts > span { color: var(--muted); font-size: 12px }
.node-shortcuts .button { min-height: 34px; padding: 5px 10px; font-size: 12px }
.upload { position: relative; display: grid; justify-items: center; gap: 3px; border: 1px dashed #47535e; border-radius: 7px; padding: 14px; color: #e5edf1; background: #171c20; cursor: pointer }
.upload:hover,.upload.drag-over { border-color: var(--accent); background: #1a3038 }
.upload input { opacity: 0; position: absolute; inset: 0; width: 100%; cursor: pointer; padding: 0 }
.upload:focus-within { outline: 2px solid var(--focus) }
.upload>span:first-of-type { font-size: 23px; color: var(--accent) }
.upload small,.node-hint,.file-name { font-size: 11px; color: var(--muted) }
.file-name { margin: 7px 0; overflow-wrap: anywhere }
.node video { width: 100%; max-height: 144px; background: #111; border-radius: 5px }
.full { width: 100%; margin-top: 10px }
.frames-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 5px; margin-top: 12px }
.frame-choice { border: 1px solid var(--line); padding: 3px; border-radius: 4px; background: #12181d; color: var(--muted); overflow: hidden; font-size: 9px }
.frame-choice img { aspect-ratio: 1.45; width: 100%; object-fit: cover; border-radius: 2px }
.frame-choice[aria-pressed=true] { border-color: var(--accent); color: var(--accent) }
textarea,input:not([type=file]),select { width: 100%; border: 1px solid #373f48; background: #12171b; border-radius: 6px; padding: 10px 12px }
textarea { resize: vertical; min-height: 68px }
textarea::placeholder,input::placeholder { color: #8b969f }
textarea:disabled { opacity: .65 }
.pet-row { display: flex; align-items: center; gap: 12px; border-top: 1px solid var(--line); margin-top: 17px; padding-top: 13px; font-size: 12px }
.pet { display: inline-block; flex: none; position: relative; height: 32px; width: 38px; background: #88dbed; border-radius: 12px 12px 13px 13px; border-bottom: 3px solid #54b8d0 }
.pet::before { content: ""; position: absolute; left: 4px; right: 4px; top: -4px; height: 12px; background: #88dbed; border-radius: 7px }
.pet::after { content: ""; position: absolute; left: 10px; top: 13px; height: 5px; width: 4px; border-radius: 50%; background: #1b4657; box-shadow: 14px 0 #1b4657 }
.pet-row.working .pet { animation: breathe 1.1s ease-in-out infinite }
@keyframes breathe { 50% { transform: translateY(-3px) } }
.pet-status { display: block; color: var(--muted); margin-top: 2px; font-size: 11px }
.remix-layout { display: grid; grid-template-columns: 1.05fr .95fr; gap: 16px }
.panel { padding: 22px; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; min-width: 0 }
.panel h2 { font-size: 18px }
.field { display: block; margin: 17px 0 6px; font-size: 13px; color: #cbd4db }
.field small,.muted { color: var(--muted); font-weight: 400 }
.image-upload { padding: 11px }
.input-actions { display: flex; gap: 8px }
.input-actions input { min-width: 0 }
.reference-preview { display: flex; align-items: end; gap: 8px }
#reference-image { max-height: 150px; margin-top: 8px; object-fit: contain; border-radius: 5px }
.reference-preview img { min-width: 0 }
.remix-actions { margin-top: 12px }
.edit-image-panel { margin-top: 18px }
.edit-image-panel > p { margin: 7px 0 10px }
.remix-image-panel { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 17px }
.replacement-input { margin-top: 8px; color: var(--muted); font-size: 11px }
.replacement-input summary { cursor: pointer }
.replacement-input .field { margin: 7px 0 4px; font-size: 11px }
.replacement-input button { margin: 5px 0 }
.image-status { font-size: 12px; margin: 9px 0 }
.image-status:empty { display: none }
.generated-reference { max-height: 460px; object-fit: contain; border-radius: 6px; margin-top: 10px }
.result-panel p { margin: 8px 0 12px }
.result-panel button { margin-top: 10px }
.chosen-work { display: flex; gap: 11px; align-items: center; border: 1px solid #365761; margin-top: 12px; padding: 8px; border-radius: 6px }
.chosen-work img { width: 60px; height: 44px; object-fit: cover; border-radius: 4px }
.chosen-work button { margin-left: auto }
dialog { width: min(460px,calc(100% - 28px)); border: 1px solid #36454f; background: var(--surface); color: var(--text); border-radius: 12px; padding: 24px }
dialog::backdrop { background: #06090be0 }
.dialog-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px }
.dialog-head h2 { font-size: 21px }
.dialog-head button { font-size: 22px }
input[type=file] { max-width: 100% }
.submissions-list { display: grid; gap: 8px; margin-top: 16px }
.submission-row { display: flex; gap: 10px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 6px }
.submission-row img { width: 54px; height: 38px; object-fit: cover; border-radius: 4px }
.submission-row strong { overflow-wrap: anywhere }
.submission-row small { color: var(--accent); margin-left: auto; flex: none }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 20; background: #253741; border: 1px solid #46616c; color: #e5f7fb; padding: 11px 17px; border-radius: 7px; max-width: calc(100% - 20px) }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap }
@media(max-width:1050px) { .mode-action { display: none } .work-grid { grid-template-columns: repeat(2,minmax(0,1fr)) } }
@media(max-width:720px) {
  .topbar { grid-template-columns: 1fr 1fr; padding: 12px 16px 0; gap: 5px }
  .site-nav { grid-row: 2; grid-column: 1 / -1; justify-content: space-between; gap: 8px }
  .site-nav a { font-size: 12px; padding: 12px 0 }
  .site-main { padding: 18px 16px 0 }
  .brand small { display: none }
  .hero { min-height: 278px }
  .hero-content { padding: 27px 19px 43px }
  .hero p { font-size: 13px }
  .modes,.remix-layout { grid-template-columns: 1fr }
  .mode-card,.panel { padding: 16px }
  .gallery { margin-top: 33px; scroll-margin-top: 112px }
  .gallery-head { align-items: start; flex-direction: column; gap: 10px }
  .work-grid { gap: 9px }
  .work-meta { flex-wrap: wrap }
  .page-head h1 { font-size: 30px }
  .page-head { align-items: start; flex-direction: column }
  .board-top { flex-wrap: wrap; gap: 3px 10px; right: 14px }
  .board { height: 500px }
  .board-foot { bottom: 63px }
}
@media(prefers-reduced-motion:reduce) { html { scroll-behavior: auto } *,*::before,*::after { animation: none !important; transition: none !important } }
