/* Cinematic studio theme inspired by the public DaVinci AI interface. */
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ui-icon, .side-icon { display: inline-block; width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.side-link.active .side-icon, .side-link:hover .side-icon { color: #c2b6ff; }
.avatar .ui-icon { width: 17px; height: 17px; }
.card-icon .ui-icon { width: 28px; height: 28px; }
.quota-icon { width: 19px; height: 19px; }
.reference-empty-icon { width: 44px; height: 44px; color: #a99af8; }
.empty-gallery-icon { width: 40px; height: 40px; margin-bottom: 11px; color: #aa9af3; }
.movie-placeholder-icon { width: 54px; height: 54px; color: #c3b8ff; }
:root {
  color-scheme: dark;
  --purple: #8e78ff;
  --deep: #735af0;
  --ink: #f5f5f8;
  --muted: #979ba9;
  --line: #2c2e39;
  color: var(--ink);
  background: #0c0d12;
}
html { scroll-behavior: smooth; }
body { background: #0c0d12; }
.site-footer { position: relative; z-index: 1; padding: 20px 24px 28px; border-top: 1px solid #242630; background: #0c0d12; color: #858999; text-align: center; font-size: 12px; }
.site-footer strong { color: #cbbfff; font-weight: 700; }
.footer-links { display: inline-flex; gap: 18px; margin-left: 20px; }
.site-footer a, .shop-terms a, .policy-main a:not(.policy-back) { color: #cbbfff; text-decoration: underline; text-underline-offset: 3px; }
.shop-terms { margin-top: 24px !important; }
.policy-main { width: min(780px, calc(100% - 36px)); margin: 45px auto 70px; padding: clamp(25px, 5vw, 55px); border: 1px solid #30313d; border-radius: 18px; background: #171820; line-height: 1.75; }
.policy-main h1 { margin: 8px 0 18px; color: #f5f3fa; font-size: clamp(30px, 5vw, 43px); }
.policy-main h2 { margin: 28px 0 7px; color: #ded8ff; font-size: 19px; }
.policy-main p { margin: 0 0 15px; color: #bdc0cb; font-size: 14px; }
.policy-main .policy-note { margin-top: 28px; color: #9296a5; font-size: 12px; }
.policy-back { display: inline-flex; align-items: center; padding: 9px 15px; text-decoration: none; }
@media (max-width: 600px) { .footer-links { display: flex; justify-content: center; margin: 9px 0 0; } }
.ambient-one { background: #31205c; opacity: .22; }
.ambient-two { background: #19485f; opacity: .12; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  height: 76px;
  max-width: none;
  padding: 0 26px;
  background: #0c0d12ee;
  backdrop-filter: blur(20px);
  border-bottom: 1px solid #242630;
}
.brand { color: #fafafe; font-size: 21px; letter-spacing: -.8px; }
.brand-mark { width: 43px; height: 43px; border-radius: 13px; background: #242033; box-shadow: none; }
.brand-dot { color: #a794ff; }
.topbar-tag { color: #b5b8c4; background: #1d1e26; border: 1px solid #30313b; }
.avatar { background: #322e4f; color: #bcaeff; }
.text-button { color: #b8aaff; }
main { max-width: none; margin: 0; padding: 0; }
.tiny-label { color: #a99af8; letter-spacing: .14em; }
.tiny-star { color: #a99af8; }
.primary-button { background: #795ff0; box-shadow: none; border-radius: 11px; }
.primary-button:hover:not(:disabled) { background: #927bff; }
.primary-button:disabled { background: #3f3b57; color: #9d9aaf; }
.outline-button { background: #242630; color: #ebe8ff; border-color: #3d3e4a; }
.outline-button:hover { background: #30313e; }
.form-error, .inline-error { background: #42282c; color: #ffb4b5; }

/* Signed-out view: cinematic showcase and a quiet login panel. */
.login-layout {
  width: min(1300px, calc(100% - 48px));
  min-height: min(720px, calc(100vh - 124px));
  margin: 24px auto;
  padding: 0;
  gap: 0;
  align-items: stretch;
  grid-template-columns: 1.12fr .88fr;
  overflow: hidden;
  background: #14151b;
  border: 1px solid #2b2d37;
  border-radius: 28px;
  box-shadow: 0 30px 90px #0007;
}
.login-intro {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: clamp(35px, 5vw, 75px);
  overflow: hidden;
  background: radial-gradient(circle at 77% 66%, #5140a3 0, #22204b 28%, transparent 59%), linear-gradient(135deg, #1b2032, #171727 55%, #211a35);
}
.login-intro:before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(#ffffff05 1px, transparent 1px), linear-gradient(90deg, #ffffff05 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}
.login-intro>* { position: relative; z-index: 1; }
.login-intro h1 { font-size: clamp(46px, 5vw, 74px); color: #f9f9fd; letter-spacing: -3.6px; line-height: 1.08; }
.login-intro em { color: #b8a7ff; }
.login-intro>p { color: #c4c4d0; line-height: 1.65; max-width: 560px; }
.login-scene {
  width: 100%;
  max-width: none;
  height: 310px;
  margin-top: 34px;
  border: 1px solid #ffffff18;
  border-radius: 20px;
  background: radial-gradient(circle at 55% 46%, #8167ff99, transparent 33%), linear-gradient(130deg, #2b3351, #211f3c 60%, #121825);
  box-shadow: 0 20px 60px #0006;
}
.login-scene:before { background: #211b3c; height: 130px; bottom: -90px; }
.login-scene .planet { color: #8f82c9; opacity: .4; }
.login-octopus { width: 260px; height: 260px; left: calc(50% - 130px); bottom: 14px; filter: drop-shadow(0 24px 20px #08081288); }
.login-film { background: #8d7afe; color: #fff; }
.login-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: none;
  border: 0;
  border-left: 1px solid #2b2d37;
  border-radius: 0;
  box-shadow: none;
  padding: clamp(30px, 5vw, 76px);
  background: #14151b;
}
.card-icon { background: #27243c; color: #a994ff; }
.login-card h2 { color: #fafaff; }
.login-card>p:not(.form-error) { color: #a2a5b1; }
.login-card label { color: #d5d6df; }
.login-card input, .register-card>input {
  background: #1d1f27;
  border: 1px solid #383a45;
  color: #f6f6f9;
}
.login-card input::placeholder, .register-card>input::placeholder { color: #777b8a; }
.login-card input:focus, .register-card>input:focus { border-color: #9c87ff; box-shadow: 0 0 0 3px #8f77ff20; }
.login-foot { border-color: #2d2e38; color: #999cab; }

/* App frame and navigation. */
.studio { margin-left: 224px; padding: 36px clamp(22px, 3.3vw, 58px) 100px; }
.studio-sidebar {
  position: fixed;
  top: 76px;
  bottom: 0;
  left: 0;
  z-index: 11;
  display: flex;
  flex-direction: column;
  width: 224px;
  padding: 31px 14px 20px;
  background: #111218;
  border-right: 1px solid #262831;
}
.sidebar-heading { padding: 0 15px; color: #666b7b; font-size: 10px; font-weight: 850; letter-spacing: .19em; }
.sidebar-new-project { width: 100%; min-width: 0; min-height: 42px; margin-bottom: 24px; gap: 8px; flex-shrink: 0; }
.sidebar-new-project span { min-width: 0; overflow-wrap: anywhere; }
.sidebar-heading-second { margin-top: 32px; }
.sidebar-nav { display: grid; gap: 5px; margin-top: 13px; }
.side-link { display: flex; align-items: center; gap: 13px; height: 43px; padding: 0 14px; border-radius: 10px; color: #969aaa; font-size: 13px; font-weight: 700; transition: color .15s, background .15s; }
.side-link:hover { color: #f5f2ff; background: #20212b; }
.side-link.active { color: #f8f5ff; background: #322b55; }
.side-icon { width: 19px; height: 19px; color: #a6a2b5; }
.sidebar-bottom { display: flex; flex-direction: column; gap: 5px; margin-top: auto; padding: 18px; border: 1px solid #3a335b; border-radius: 14px; background: linear-gradient(145deg, #29243e, #1b1c28); }
.sidebar-bottom-label { color: #b8adc9; font-size: 11px; }
.sidebar-bottom strong { color: #fff; font-size: 30px; line-height: 1.15; }
.sidebar-bottom small { font-size: 13px; color: #c8bef8; }
.sidebar-bottom-note { color: #818598; font-size: 10px; }
#studio-home, #credit-shop, #project-studio, #gallery-section { scroll-margin-top: 95px; }
.studio-page { min-height: calc(100vh - 180px); }

/* Dashboard. */
.welcome-row { margin-bottom: 26px; }
.welcome-row h1 { margin: 9px 0 7px; color: #f8f8fb; font-size: clamp(34px, 3.5vw, 48px); letter-spacing: -1.7px; }
.welcome-row p { color: #9fa3b1; }
.accent-question { color: #aa97ff; }
.quota-card { width: 286px; padding: 15px 18px; border: 1px solid #333540; border-radius: 14px; background: #191a22; box-shadow: none; }
.quota-top, .quota-bottom, .quota-card small { color: #a1a4b1; }
.quota-card strong { color: #f5f5f9; font-size: 28px; }
.quota-icon { color: #a997ff; }
.progress-track { background: #35303f; height: 5px; }
.progress-fill { background: #957dff; }
.studio-hero { display: grid; grid-template-columns: 1.07fr .93fr; min-height: 325px; margin-bottom: 26px; overflow: hidden; border: 1px solid #343242; border-radius: 22px; background: linear-gradient(120deg, #252139, #1b1c2b 49%, #25204b); }
.hero-copy { position: relative; z-index: 1; padding: 34px clamp(25px, 3vw, 45px); }
.hero-eyebrow { color: #b2a3ff; font-size: 10px; font-weight: 850; letter-spacing: .2em; }
.hero-copy h2 { margin: 13px 0 12px; color: #fff; font-size: clamp(32px, 3.5vw, 48px); line-height: 1.13; letter-spacing: -1.8px; }
.hero-copy h2 em { color: #c4b8ff; font-style: normal; }
.hero-copy p { max-width: 440px; margin: 0 0 23px; color: #b9b8cb; line-height: 1.6; font-size: 13px; }
.hero-action { display: inline-flex; align-items: center; gap: 22px; min-height: 42px; padding: 0 17px; border-radius: 9px; background: #8b73ff; color: white; font-size: 12px; font-weight: 850; }
.hero-action:hover { background: #a28fff; }
.hero-visual { position: relative; min-height: 300px; overflow: hidden; background: radial-gradient(circle at 51% 52%, #6952ba 0, #3d356c 36%, #1e2339 75%); }
.hero-visual:before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(#ffffff09 1px, transparent 1px), linear-gradient(90deg, #ffffff09 1px, transparent 1px); background-size: 30px 30px; transform: perspective(300px) rotateX(18deg) scale(1.2); opacity: .4; }
.hero-visual img { position: absolute; z-index: 2; width: min(270px, 65%); height: 260px; object-fit: contain; left: 50%; top: 42%; transform: translate(-50%, -50%); filter: drop-shadow(0 22px 23px #070818bb); }
.hero-orbit { position: absolute; border: 1px solid #ffffff39; border-radius: 50%; transform: rotate(-20deg); }
.hero-orbit-one { width: 470px; height: 220px; left: -2%; top: 6%; }
.hero-orbit-two { width: 550px; height: 260px; left: -13%; top: 8%; }
.hero-visual-label { position: absolute; z-index: 2; right: 24px; top: 24px; color: #ffffffb0; font-size: 10px; font-weight: 850; letter-spacing: .22em; }

/* Credits, editor, timeline and library. */
.credit-shop { margin: 0 0 27px; padding: 22px; grid-template-columns: minmax(180px,.55fr) minmax(0,1.45fr); background: #171820; border: 1px solid #2d2e39; border-radius: 18px; }
.credit-shop h2 { color: #f4f4fa; }
.credit-shop p { color: #9a9dac; }
.credit-packages { display: block; }
.package-group + .package-group { margin-top: 20px; }
.package-group h3 { margin: 0 0 10px; color: #ddd7f8; font-size: 13px; }
.package-group-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.package-card { background: #21222c; border: 1px solid #383a47; border-radius: 12px; }
.package-card .package-points { color: #ad9dff; }
.package-card small { color: #999cab; }
.package-card button { background: #2d2b42; border-color: #4a436c; }
.shop-message { color: #b3a9dc !important; }
.public-plans { max-width: 1280px; margin: 0 auto 70px; padding: 26px 30px; border: 1px solid #30313d; border-radius: 18px; background: #171820; }
.public-plans h2 { margin: 8px 0; color: #f5f3fa; font-size: 28px; }
.public-plans > p { max-width: 760px; color: #a4a5b1; font-size: 13px; line-height: 1.7; }
.public-package-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
.public-package-grid article { display: flex; flex-direction: column; gap: 5px; min-width: 0; padding: 15px; border: 1px solid #3a3b48; border-radius: 12px; background: #22232d; }
.public-package-grid strong { color: #f1eff7; font-size: 13px; }
.public-package-grid span { color: #b4a3ff; font-size: 22px; font-weight: 850; }
.public-package-grid small { color: #abaeba; font-size: 11px; line-height: 1.5; }
@media (max-width: 700px) { .public-plans { padding: 22px; } .public-package-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .public-package-grid { grid-template-columns: 1fr; } }
.project-studio { padding: 30px; background: #171820; border: 1px solid #2d2f3b; border-radius: 19px; box-shadow: none; }
.create-step-nav { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 26px; padding-bottom: 17px; border-bottom: 1px solid #30313e; }
.create-step-tab { min-height: 42px; padding: 9px 16px; border: 1px solid #3b3c48; border-radius: 10px; background: #22232d; color: #aeb0c0; font-size: 12px; font-weight: 800; }
.create-step-tab.active { background: #594a96; border-color: #937df1; color: #fff; }
.create-step-panel { padding-top: 5px; }
.create-step-panel .storyboard-heading { margin-top: 10px; padding-top: 0; border-top: 0; }
.setup-actions { display: flex; justify-content: flex-end; margin-top: 23px; }
.shot-selector { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin: 7px 0 18px; }
.shot-selector-button { min-height: 48px; padding: 8px; border: 1px solid #3a3c49; border-radius: 10px; background: #22232d; color: #abb0c0; font-size: 11px; font-weight: 800; }
.shot-selector-button.active { border-color: #a18eff; background: #342c50; color: #f5f1ff; }
.shot-current { color: #c0b0ff; font-size: 12px; font-weight: 800; }
.shot-grid { display: block; max-width: none; }
.shot-navigation { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 16px; }
.shot-navigation #to-finish-btn { margin-left: auto; }
.finish-summary { margin-top: 20px; }
.finish-summary h3 { margin: 0 0 8px; color: #f5f5fa; }
.finish-summary p { margin: 0 0 18px; color: #a8a9b7; font-size: 13px; }
.project-heading h2, .storyboard-heading h3, .project-finish strong, .gallery-head h2 { color: #f5f5fa; }
.project-heading p, .storyboard-heading p, .project-finish p, .gallery-head p { color: #9a9ead; }
.project-runtime { color: #c2b5ff; background: #302c47; }
.project-fields label, .shot-card label { color: #c3c5d0; }
.project-fields input, .project-fields textarea, .shot-card textarea, .shot-card input { color: #f4f4f8; border: 1px solid #3a3c49; background: #20212a; }
.project-fields select { grid-column: 1/-1; width: 100%; min-height: 44px; padding: 10px 12px; color: #f4f4f8; background: #20212a; border: 1px solid #3a3c49; border-radius: 10px; font: inherit; }
.template-help { grid-column: 1/-1; color: #a9a4bb; font-size: 12px; line-height: 1.6; margin: 0 0 8px; }
.setup-actions { gap: 10px; }
.project-fields input:focus, .project-fields textarea:focus, .shot-card textarea:focus, .shot-card input:focus { border-color: #9b85ff; box-shadow: 0 0 0 3px #9b85ff20; }
.concept-suggestions { grid-column: 1/-1; display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin: -2px 0 4px; color: #9899aa; font-size: 11px; }
.concept-suggestions button { min-height: 28px; padding: 4px 9px; border: 1px solid #45405f; border-radius: 999px; background: #25233a; color: #c5bbf5; font: inherit; cursor: pointer; }
.concept-suggestions button:hover, .concept-suggestions button:focus-visible { border-color: #9b85ff; background: #332b52; color: #fff; outline: none; }
.ai-draft-toolbar { grid-column: 1/-1; display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 2px 0 3px; }
.ai-draft-toolbar .outline-button { min-height: 36px; }
.ai-draft-toolbar .outline-button:disabled { opacity: .6; cursor: not-allowed; }
#ai-story-status { color: #9c9caf; font-size: 11px; }
#ai-story-status:not(:empty) { padding: 3px 0; }
.reference-panel { background: #20202c; border-color: #504b65; }
.reference-preview { background: #171823; color: #aea5c9; }
.reference-preview-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.reference-preview-grid.reference-count-1 { grid-template-columns: minmax(0, 1fr); }
.reference-preview-grid.reference-count-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.reference-preview-grid img { object-fit: contain; background: #0f111a; }
.reference-label, .shot-top strong { color: #f1f0f6; }
.reference-panel small, .shot-status, .project-disclaimer { color: #9396a6; }
.reference-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.reference-actions .outline-button { min-height: 36px; }
.reference-ai-status { display: block; min-height: 17px; margin-top: 5px; color: #8fe8e4; font-size: 11px; }
.reference-actions .outline-button:disabled { opacity: .6; cursor: not-allowed; }
.shot-status.warning { color: #f4c77b; line-height: 1.6; }
@media (max-width: 600px) { .package-group-cards { grid-template-columns: 1fr; } .setup-actions { flex-wrap: wrap; } }
.storyboard-heading { border-color: #30313e; }
.project-message { color: #c1b1ff; }
.project-message.error { color: #ffabab; }
.project-message:empty { display: none; }

/* Keep storyboard controls in their own flow so they never cover the
   availability notice, shot selector, or editor fields when the viewport
   gets narrower. */
.storyboard-heading {
  align-items: flex-start;
  flex-wrap: wrap;
}
.storyboard-heading > div:first-child {
  min-width: 220px;
  flex: 1 1 250px;
}
.project-controls {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  flex: 1 1 600px;
  align-items: center;
  justify-content: flex-end;
  row-gap: 7px;
}
.project-controls button {
  min-width: 0;
  max-width: 100%;
  white-space: nowrap;
  line-height: 1.25;
}
.project-controls .outline-button,
.project-controls .primary-button {
  min-height: 38px;
  height: 38px;
  padding: 0 12px;
}
.batch-generate-button[aria-busy="true"] { opacity: .7; cursor: wait; }
.batch-generate-status {
  flex: 1 1 100%;
  min-width: 0;
  color: #bdb2ff;
  font-size: 11px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.batch-generate-status.error { color: #f4c77b; }
.shot-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr));
  gap: 8px;
  align-items: stretch;
}
.shot-actions button,
.shot-actions a,
.shot-actions label {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.shot-actions .primary-button {
  height: auto;
  min-height: 36px;
}
.provider-details { margin-top: 22px; border-top: 1px solid #30313e; padding-top: 16px; }
.provider-details summary { color: #cbbcff; cursor: pointer; font-size: 12px; font-weight: 800; }
.provider-details .provider-note { margin: 15px 0 0; }
.provider-note>div { background: #20212b; border-color: #353745; }
.provider-note strong { color: #eae8f3; }
.provider-note span { color: #a0a2b0; }
.generation-availability { margin: -5px 0 18px; padding: 12px 14px; border: 1px solid #554b6b; border-radius: 10px; background: #2b263a; color: #d1c3ff; font-size: 12px; line-height: 1.6; }
.shot-card { background: #1e2029; border-color: #363844; }
.shot-card.spotlight { outline: 2px solid #ae9aff; outline-offset: 3px; }
.shot-time { color: #b9aafa; background: #302b46; }
.project-finish { background: #242138; }
.project-export video { background: #0b0b10; }
.project-export-toolbar,
.video-editor-heading,
.video-editor-actions,
.movie-card-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.project-export-toolbar { margin-bottom: 10px; }
.project-export-toolbar strong,
.video-editor-heading h4 { color: #eeeaff; font-size: 14px; }
.project-export-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.video-editor-panel { display: grid; gap: 14px; margin-top: 18px; padding: 18px; border: 1px solid #4a4c70; border-radius: 14px; background: linear-gradient(145deg, #151828, #10121d); box-shadow: inset 0 0 24px #0004; }
.video-editor-heading { align-items: flex-start; }
.video-editor-heading h4 { margin: 0 0 4px; }
.video-editor-heading p { margin: 0; color: #9da3b8; font-size: 11px; line-height: 1.55; }
.video-editor-preview { width: 100%; max-height: 430px; border: 1px solid #343b5c; border-radius: 10px; background: #080a11; }
.video-editor-timeline { display: grid; gap: 6px; }
.video-editor-timeline label,
.video-editor-fields label { color: #c8cbe0; font-size: 11px; font-weight: 750; }
.video-editor-timeline input[type="range"], .video-editor-fields input[type="range"] { width: 100%; accent-color: var(--cyber-cyan); }
.video-editor-time { display: flex; justify-content: space-between; color: #989eb5; font-size: 10px; font-variant-numeric: tabular-nums; }
.video-editor-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-items: end; }
.video-editor-fields label { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 7px; }
.video-editor-fields label input[type="number"] { min-width: 0; width: 100%; min-height: 34px; padding: 7px 9px; color: #f4f4f8; border: 1px solid #3a3c49; border-radius: 8px; background: #20212a; font: inherit; }
.video-editor-fields label small { color: #8f94a9; font-size: 10px; }
.video-editor-fields .video-editor-volume { grid-column: 1 / -1; grid-template-columns: auto minmax(0, 1fr) auto; }
.video-editor-fields .video-editor-check { display: flex; grid-template-columns: none; justify-content: flex-start; gap: 7px; min-height: 34px; }
.video-editor-fields input:focus { outline: 0; border-color: var(--cyber-cyan); box-shadow: 0 0 0 3px #4de8ed1c; }
.video-editor-actions { justify-content: flex-start; }
.video-editor-actions #video-editor-status { min-width: 0; flex: 1 1 220px; color: #9feee9; font-size: 11px; line-height: 1.45; }
.video-editor-actions #video-editor-status.error { color: #f4c77b; }
.movie-card-actions { justify-content: flex-start; margin-top: 8px; }
.movie-card-actions .download-link { margin-top: 0; }
.movie-edit-button { min-height: 32px; padding: 0 10px; font-size: 11px; }
@media (max-width: 600px) {
  .video-editor-fields { grid-template-columns: 1fr; }
  .video-editor-fields .video-editor-volume { grid-column: auto; }
  .project-export-toolbar { align-items: flex-start; }
  .project-export-actions { width: 100%; }
}
.quick-story { border-color: #30313d; background: #181920; }
.quick-story summary { color: #d2c9ff; }
.choice-section { border-color: #32343d; }
.section-head h2, .preview-header, .preview-story h3, .safety-card strong { color: #f2f2f8; }
.section-head p, .preview-story p, .preview-note { color: #999eaa; }
.step { background: #302d43; border-color: #4b4665; color: #bbaaff; }
.choice { background: #22232d; border-color: #3b3d48; color: #f0f0f4; box-shadow: none; }
.choice:hover { border-color: #8875df; }
.choice.selected { background: #302b4b; border-color: #9a83ff; box-shadow: none; }
.choice small { color: #999cae; }
.preview-card { background: #1d1e26; border-color: #383a45; box-shadow: none; }
.model-pill { background: #302b49; color: #bfafff; }
.safety-card { background: #1c2a28; border-color: #2d4944; }
.safety-card p { color: #a3b7af; }
.gallery-section { border-color: #31323e; }
.gallery-section.studio-page { padding-top: 4px; border-top: 0; }
.gallery-grid {
  /* Keep each project at its own content height.  The default grid stretch
     made a compact legacy project expand to match an open project beside it,
     leaving a large empty panel and vertically centring its heading. */
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
  align-items: start;
  gap: 18px;
}
.gallery-count { background: #302c47; color: #c1b5ff; }
.empty-gallery { background: #191a21; border-color: #42414f; color: #d7d4df; }
.empty-gallery p { color: #9396a4; }
.movie-card { background: #1d1f28; border-color: #383a47; box-shadow: none; }
.movie-body h3 { color: #f4f4f8; }
.movie-meta { color: #989aa9; }
.movie-status { background: #2a2541; color: #d1c7ff; }
.download-link { color: #b29fff; }
.library-project-card { display: grid; align-content: start; align-self: start; gap: 0; min-height: 0; padding: 18px; border: 1px solid #35405d; border-radius: 16px; background: linear-gradient(145deg, #141827ee, #0f121cee); box-shadow: 0 0 0 1px #8e78ff0d, 0 14px 35px #0005; }
.library-project-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.library-project-actions { display: inline-flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.library-project-kicker { display: block; margin-bottom: 6px; color: #8fe8e4; font-size: 10px; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; }
.library-project-head h3 { margin: 0; color: #f4f4f8; font-size: 18px; }
.library-project-head p { margin: 5px 0 0; color: #aeb0c0; font-size: 12px; }
.library-project-toggle, .library-project-load { flex: 0 0 auto; min-height: 38px; }
.library-project-details { display: grid; gap: 12px; margin-top: 17px; padding-top: 16px; border-top: 1px solid #30313e; }
.library-project-summary { margin: 0; color: #b7b8c5; line-height: 1.6; }
.library-project-details h4 { margin: 4px 0 0; color: #c4b6ff; font-size: 13px; }
.library-shot-list { display: grid; gap: 10px; margin: 0; padding-left: 24px; }
.library-shot-list > li { display: grid; gap: 6px; color: #ecebf3; line-height: 1.5; }
.library-shot-list > li > small { color: #999cab; }
.library-shot-list .movie-card { margin-top: 4px; }
.library-media-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.library-project-card[data-legacy="true"] { border-color: #3c3b55; background: linear-gradient(145deg, #171827ee, #10121cee); }
.library-project-card[data-legacy="true"] .library-project-kicker { color: #b4a4de; }
@media (max-width: 620px) { .library-project-head { align-items: flex-start; flex-direction: column; } .library-project-actions, .library-project-toggle, .library-project-load { width: 100%; } .library-media-grid { grid-template-columns: 1fr; } }
.register-modal { background: #080910dc; }
.register-card { background: #191a22; border: 1px solid #3b3c48; color: #f8f8fa; }
.register-card p { color: #a5a8b6; }
.register-close { color: #b8b4c8; }
.toast { background: #393054; }

@media (max-width: 1050px) {
  .studio { margin-left: 185px; padding: 30px 22px 80px; }
  .studio-sidebar { width: 185px; }
  .credit-shop { grid-template-columns: 1fr; }
  .hero-copy h2 { font-size: 36px; }
  .storyboard-heading { display: grid; grid-template-columns: minmax(0, 1fr); gap: 13px; }
  .project-controls { justify-content: flex-start; flex-basis: auto; }
}

.settings-card > p { margin: 6px 0 15px; }
.settings-login-name { color: #9696a8 !important; font-size: 12px !important; }
.settings-login-name strong { color: #d7d3ef; font-weight: 700; }
@media (max-width: 760px) {
  .topbar { height: 68px; padding: 0 16px; }
  .topbar-tag { display: none; }
  .studio-sidebar { position: sticky; top: 68px; width: auto; height: 64px; min-height: 0; flex-direction: row; align-items: center; padding: 8px 12px; margin: -25px -18px 24px; overflow-x: auto; border-right: 0; border-bottom: 1px solid #2c2e39; }
  .studio-sidebar .sidebar-heading, .studio-sidebar .sidebar-bottom { display: none; }
  .studio-sidebar .sidebar-new-project { width: auto; min-height: 38px; margin: 0 10px 0 0; padding: 8px 12px; white-space: nowrap; font-size: 12px; }
  .sidebar-nav { display: flex; gap: 5px; margin: 0; flex: 0 0 auto; }
  .side-link { white-space: nowrap; height: 38px; font-size: 12px; }
  .side-icon { width: 18px; height: 18px; }
  .studio { margin-left: 0; padding: 25px 18px 70px; }
  .welcome-row { margin-bottom: 22px; }
  .studio-hero { grid-template-columns: 1fr; }
  .hero-visual { min-height: 250px; }
  .hero-copy { padding: 27px; }
  .login-layout { width: calc(100% - 24px); margin: 12px auto; display: flex; flex-direction: column; min-height: 0; padding: 0; gap: 0; }
  .login-intro { padding: 33px 27px 24px; }
  .login-intro h1 { font-size: 45px; }
  .login-intro>p { font-size: 14px; }
  .login-scene { height: 200px; }
  .login-octopus { width: 190px; height: 190px; left: calc(50% - 95px); bottom: 4px; }
  .login-card { padding: 30px 27px 38px; border-left: 0; border-top: 1px solid #2b2d37; }
  .credit-shop { margin-top: 0; }
  .shot-selector { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .shot-navigation { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shot-navigation > * { width: 100%; min-width: 0; }
  .shot-navigation #to-finish-btn { grid-column: 1 / -1; margin-left: 0; }
  .project-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .project-controls button { width: 100%; }
}
@media (max-width: 540px) {
  .brand { font-size: 17px; }
  .brand-mark { width: 36px; height: 36px; }
  .user-menu { gap: 7px; font-size: 12px; }
  .avatar { display: none; }
  .welcome-row h1 { font-size: 36px; }
  .hero-copy h2 { font-size: 34px; }
  .hero-visual { min-height: 210px; }
  .hero-visual img { height: 185px; }
  .project-studio { padding: 19px; }
  .create-step-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .create-step-tab { text-align: center; padding: 8px 5px; font-size: 11px; }
  .project-runtime { display: none; }
  .shot-selector { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .project-controls { grid-template-columns: 1fr; }
  .project-controls button { width: 100%; }
  .shot-actions { grid-template-columns: 1fr; }
  .credit-packages { grid-template-columns: 1fr; }
  .package-card small { min-height: 0; }
  .login-intro h1 { font-size: 39px; }
  .login-scene { height: 160px; }
  .login-octopus { width: 150px; height: 150px; left: calc(50% - 75px); }
}

/* Cyber studio finish: a restrained neon HUD layer over the dark theme. */
:root {
  --cyber-violet: #9b7dff;
  --cyber-cyan: #49e6e1;
  --cyber-pink: #ef79d8;
  --cyber-panel: #111521;
  --cyber-line: #303a55;
}
body {
  background-color: #080a12;
  background-image:
    radial-gradient(circle at 77% 12%, #33246c55 0, transparent 29%),
    radial-gradient(circle at 10% 72%, #093d4b33 0, transparent 25%),
    linear-gradient(#ffffff08 1px, transparent 1px),
    linear-gradient(90deg, #ffffff08 1px, transparent 1px);
  background-size: auto, auto, 42px 42px, 42px 42px;
  background-attachment: fixed;
}
.topbar {
  background: #080a12e8;
  border-bottom-color: #303750;
  box-shadow: 0 1px 0 #49e6e122, 0 12px 35px #0006;
}
.brand-mark {
  border: 1px solid #8e78ff88;
  box-shadow: 0 0 0 3px #8e78ff18, 0 0 25px #8e78ff55;
}
.brand-dot { color: var(--cyber-cyan); text-shadow: 0 0 12px #49e6e1aa; }
.topbar-tag {
  border-color: #49e6e155;
  color: #a9f8f1;
  background: #12272e;
  box-shadow: inset 0 0 14px #49e6e10d;
}
.avatar {
  border: 1px solid #9b7dff77;
  box-shadow: 0 0 14px #9b7dff55;
}
.studio-sidebar {
  background: #090c14e8;
  border-right-color: #303750;
  box-shadow: 10px 0 30px #0005;
}
.sidebar-heading { color: #687492; }
.side-link.active {
  background: linear-gradient(100deg, #392d65, #242545);
  border: 1px solid #9b7dff66;
  box-shadow: inset 3px 0 0 var(--cyber-violet), 0 0 22px #7655d722;
}
.side-link.active .side-icon { color: var(--cyber-cyan); filter: drop-shadow(0 0 7px #49e6e1aa); }
.studio-hero,
.project-studio,
.credit-shop,
.preview-card,
.movie-card,
.quick-story {
  background: linear-gradient(145deg, #141827ee, #0f121cee);
  border-color: #35405d;
  box-shadow: 0 0 0 1px #8e78ff0d, 0 20px 60px #0007;
}
.studio-hero {
  background: radial-gradient(circle at 78% 52%, #4838a855 0, transparent 32%), linear-gradient(120deg, #181832, #101522 55%, #171332);
}
.studio-hero::after,
.project-studio::after {
  content: "";
  display: block;
  position: absolute;
  pointer-events: none;
}
.studio-hero { position: relative; }
.studio-hero::after {
  inset: 10px;
  border: 1px solid #49e6e112;
  border-radius: 16px;
}
.project-studio { position: relative; overflow: hidden; }
.project-studio::after {
  inset: 0;
  background: linear-gradient(90deg, transparent 0 96%, #49e6e155 96% 96.2%, transparent 96.2%), linear-gradient(0deg, transparent 0 94%, #9b7dff44 94% 94.2%, transparent 94.2%);
  opacity: .35;
}
.project-studio > * { position: relative; z-index: 1; }
.project-studio::before {
  content: "DIRECTOR // STORYBOARD";
  position: absolute;
  top: 12px;
  right: 24px;
  color: #49e6e177;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .18em;
  pointer-events: none;
  z-index: 2;
}
.hero-eyebrow,
.tiny-label,
.sidebar-heading { text-shadow: 0 0 12px #9b7dff66; }
.create-step-nav { border-bottom-color: #35405d; }
.create-step-tab,
.shot-selector-button,
.outline-button {
  border-color: #3c4967;
  background: #151b2a;
  color: #d9deef;
  box-shadow: inset 0 0 12px #49e6e108;
}
.create-step-tab:hover,
.shot-selector-button:hover,
.outline-button:hover {
  border-color: #49e6e1aa;
  color: #f3ffff;
  box-shadow: 0 0 15px #49e6e12b;
}
.create-step-tab.active,
.shot-selector-button.active {
  border-color: var(--cyber-cyan);
  background: linear-gradient(135deg, #44366f, #243450);
  box-shadow: 0 0 0 1px #49e6e155, 0 0 20px #49e6e133;
}
.auth-method-switch {
  background: #0e1420;
  border-color: #354564;
  box-shadow: inset 0 0 16px #0005, 0 0 12px #49e6e10b;
}
.auth-method-tab { color: #aab4cc; }
.auth-method-tab:hover {
  color: #efffff;
  background: #1b2940;
}
.auth-method-tab.active {
  background: linear-gradient(135deg, #8167f4, #5a50bd);
  box-shadow: 0 0 15px #8e78ff55, inset 0 0 10px #ffffff12;
}
.primary-button {
  background: linear-gradient(135deg, #8e70ff, #6d58df);
  border: 1px solid #b5a4ff88;
  box-shadow: 0 0 16px #8e78ff44, inset 0 0 12px #ffffff12;
}
.primary-button:hover:not(:disabled) {
  background: linear-gradient(135deg, #a18aff, #7b65ee);
  box-shadow: 0 0 24px #9b7dff88, inset 0 0 12px #ffffff18;
}
.project-controls .primary-button { border-color: #c0b2ff99; }
.project-fields input,
.project-fields textarea,
.project-fields select,
.shot-card textarea,
.shot-card input {
  background: #0e1420;
  border-color: #33415e;
  box-shadow: inset 0 0 18px #0005;
}
.project-fields input:focus,
.project-fields textarea:focus,
.project-fields select:focus,
.shot-card textarea:focus,
.shot-card input:focus {
  border-color: var(--cyber-cyan);
  box-shadow: 0 0 0 3px #49e6e11f, 0 0 18px #49e6e133;
}
.generation-availability {
  border-color: #49e6e155;
  background: linear-gradient(90deg, #172b38, #24203e);
  color: #bdfbf4;
  box-shadow: inset 0 0 18px #49e6e10d;
}
.shot-card {
  background: linear-gradient(145deg, #171d2b, #10141f);
  border-color: #354564;
  box-shadow: inset 0 0 22px #0004;
}
.shot-card.spotlight { outline-color: var(--cyber-cyan); box-shadow: 0 0 25px #49e6e122; }
.shot-time,
.project-runtime,
.model-pill {
  border: 1px solid #9b7dff55;
  background: #252449;
  box-shadow: 0 0 13px #9b7dff22;
}
.shot-status.warning { color: #ffe49a; text-shadow: 0 0 10px #f4c77b55; }
.project-finish { background: linear-gradient(110deg, #221e43, #17273c); border: 1px solid #53608a; }
.project-finish .primary-button { border-color: #49e6e188; box-shadow: 0 0 20px #49e6e144; }
.project-disclaimer { color: #8792ad; }
.site-footer { border-top-color: #303750; background: #080a12cc; }

@media (max-width: 540px) {
  .project-studio::before { right: 18px; font-size: 8px; }
  .studio-hero::after { inset: 7px; }
}

/* Cyber studio finish: restrained neon accents over the existing dark layout. */
:root {
  --cyber-purple: #9a82ff;
  --cyber-purple-soft: #735cf0;
  --cyber-cyan: #4de8ed;
  --cyber-border: #363a57;
  --cyber-glow-purple: #8a73ff40;
  --cyber-glow-cyan: #4de8ed2b;
}

body {
  background-color: #090b12;
  background-image:
    radial-gradient(circle at 70% -10%, #5c40bb22, transparent 34%),
    radial-gradient(circle at -10% 55%, #1497ac16, transparent 32%),
    linear-gradient(#8f78ff0d 1px, transparent 1px),
    linear-gradient(90deg, #8f78ff0d 1px, transparent 1px);
  background-size: auto, auto, 36px 36px, 36px 36px;
  background-attachment: fixed;
}

.topbar {
  border-bottom-color: #343752;
  box-shadow: 0 1px 0 #4de8ed14, 0 12px 34px #02030b55;
}
.brand-mark {
  border: 1px solid #9882ff66;
  box-shadow: 0 0 0 1px #4de8ed12, 0 0 22px #7655d733;
}
.topbar-tag {
  border-color: #4f4a75;
  box-shadow: inset 0 0 12px #8a73ff12, 0 0 12px #4de8ed0d;
}

.studio-sidebar {
  border-right-color: #343752;
  box-shadow: 6px 0 24px #02030a38;
}
.side-link.active {
  border: 1px solid #7564c766;
  box-shadow: inset 0 0 18px #8a73ff1e, 0 0 13px #8a73ff17;
}
.side-link:hover { box-shadow: inset 0 0 15px #4de8ed10; }
.sidebar-bottom {
  border-color: #4c4774;
  box-shadow: inset 0 0 20px #8a73ff12, 0 0 15px #4de8ed0e;
}

.login-layout,
.studio-hero,
.project-studio,
.credit-shop,
.preview-card,
.quota-card,
.movie-card,
.register-card {
  border-color: var(--cyber-border);
  box-shadow: 0 0 0 1px #8a73ff12, 0 0 24px #4de8ed0d, 0 25px 75px #02030a55;
}
.login-layout,
.studio-hero,
.project-studio,
.credit-shop,
.preview-card,
.quota-card,
.movie-card,
.register-card,
.shot-card,
.choice {
  position: relative;
}
.login-layout::after,
.studio-hero::after,
.project-studio::after,
.credit-shop::after,
.preview-card::after,
.quota-card::after,
.movie-card::after,
.register-card::after,
.shot-card::after,
.choice::after {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid #4de8ed0d;
  border-radius: inherit;
  pointer-events: none;
}
.login-card { box-shadow: none; }

.primary-button,
.hero-action {
  box-shadow: 0 0 0 1px #b5a7ff35, 0 0 18px var(--cyber-glow-purple);
}
.primary-button:hover:not(:disabled),
.hero-action:hover {
  box-shadow: 0 0 0 1px #c9c0ff77, 0 0 23px #8a73ff70, 0 0 8px #4de8ed33;
}
.outline-button,
.create-step-tab,
.shot-selector-button {
  border-color: #454a6b;
}
.outline-button:hover,
.create-step-tab:hover,
.shot-selector-button:hover {
  border-color: var(--cyber-cyan);
  box-shadow: 0 0 14px var(--cyber-glow-cyan);
}
.create-step-tab.active {
  border-color: var(--cyber-purple);
  box-shadow: inset 0 0 16px #8a73ff28, 0 0 14px #8a73ff2a;
}

.quota-card .progress-fill { background: linear-gradient(90deg, var(--cyber-purple), var(--cyber-cyan)); box-shadow: 0 0 10px #4de8ed99; }
.project-runtime,
.model-pill,
.gallery-count,
.shot-time {
  border: 1px solid #655b91;
  box-shadow: 0 0 11px #8a73ff1f;
}
.project-fields input:focus,
.project-fields textarea:focus,
.project-fields select:focus,
.shot-card textarea:focus,
.shot-card input:focus,
.login-card input:focus,
.register-card>input:focus {
  border-color: var(--cyber-cyan);
  box-shadow: 0 0 0 3px #4de8ed1c, 0 0 14px #4de8ed1f;
}
.shot-card.spotlight { outline-color: var(--cyber-cyan); box-shadow: 0 0 18px #4de8ed20; }
.generation-availability { border-color: #64558e; box-shadow: inset 0 0 18px #8a73ff18, 0 0 13px #8a73ff17; }
.project-message { text-shadow: 0 0 10px #9a82ff80; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}

/* Compact controls and status indicators. Keep the mark itself clean so the
   octopus artwork reads as a logo instead of a framed app icon. */
.brand-mark {
  border: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  padding: 0;
}
.brand-mark img { display: block; width: 100%; height: 100%; object-fit: contain; }
.button-icon, .inline-icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -.22em;
}
.inline-icon { width: 15px; height: 15px; color: var(--cyber-cyan); margin-right: 3px; }
.button-icon + span, span + .button-icon { margin-left: 3px; }
.project-controls button,
.shot-navigation button,
.upload-reference { display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.locale-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 3px 8px 3px 11px;
  border: 1px solid #354564;
  border-radius: 12px;
  color: #f5f5ff;
  background: #0a0d19;
  box-shadow: inset 0 0 10px #8a73ff12;
  position: relative;
}
.locale-control::before { display: none; }
.locale-control > .ui-icon { width: 22px; height: 22px; position: relative; z-index: 1; }
.locale-control .locale-select { position: relative; z-index: 1; width: 65px; height: 42px; padding: 0 6px; border: 1px solid #354564; border-radius: 9px; background: #222942; box-shadow: none; color: #fff; text-align: center; }
.locale-control:hover { color: #fff; border-color: #62749c; background: #11172b; }
.locale-control:focus-within { outline: none; }
.locale-control .locale-select:focus-visible { outline: 2px solid var(--cyber-cyan); outline-offset: 2px; }
.shot-status.processing {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #c5f7f2;
}
.shot-card.is-generating { border-color: #4de8ed66; box-shadow: inset 0 0 22px #4de8ed0d, 0 0 20px #4de8ed14; }
.shot-media { position: relative; width: 100%; aspect-ratio: 16 / 9; margin-top: 13px; overflow: hidden; border: 1px solid #303b5f; border-radius: 12px; background: #0d111d; }
.shot-media video { display: block; width: 100%; height: 100%; object-fit: cover; background: #0d111d; }
.shot-video-placeholder { position: relative; display: grid; place-items: center; width: 100%; height: 100%; overflow: hidden; color: #c3b8ff; background: radial-gradient(circle at 50% 35%, #25234a, #101522 72%); }
.shot-video-placeholder img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .38; filter: saturate(.8); }
.shot-video-placeholder .movie-placeholder-icon, .shot-video-placeholder > span { position: relative; z-index: 1; }
.shot-video-placeholder > span { padding: 7px 12px; border: 1px solid #7871a8; border-radius: 999px; color: #e4ddff; background: #11172acc; font-size: 11px; font-weight: 750; }
.shot-processing-overlay { position: absolute; inset: 0; display: grid; place-items: center; background: #080d18a8; backdrop-filter: blur(2px); }
.shot-processing-overlay .shot-processing-state { flex-direction: column; min-height: 0; margin: 0; padding: 16px 24px; border: 1px solid #4de8ed66; border-radius: 12px; background: #101827e8; box-shadow: 0 0 28px #4de8ed20; }
.shot-processing-overlay .shot-processing-state::before { display: none; }
@keyframes shot-spinner { to { transform: rotate(360deg); } }
.shot-processing-state {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin-top: 13px;
  padding: 0 14px;
  border-left: 2px solid var(--cyber-cyan);
  border-radius: 0 9px 9px 0;
  color: #c5f7f2;
  background: linear-gradient(90deg, #16333b, #111827);
  box-shadow: inset 0 0 18px #4de8ed0d;
  font-size: 12px;
  font-weight: 800;
}
.shot-processing-state::before {
  content: "";
  width: 100%;
  max-width: 42px;
  height: 1px;
  background: #4de8ed66;
}
.shot-loading-icon {
  width: 20px;
  height: 20px;
  color: var(--cyber-cyan);
  animation: shot-spinner .8s linear infinite;
}
.shot-status.processing { color: #a9afc1; }
@media (prefers-reduced-motion: reduce) { .shot-loading-icon { animation: none; } }

/* Public landing samples and language controls. */
.locale-select {
  flex: none;
  width: 72px;
  height: 44px;
  padding: 0 10px;
  border: 1px solid #354564;
  border-radius: 12px;
  background: #0e1420;
  color: #ded7ff;
  color-scheme: dark;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: inset 0 0 10px #8a73ff12;
}
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid #354564;
  border-radius: 12px;
  color: #c8bcff;
  background: #141a2a;
}
.icon-button:hover, .locale-select:hover { color: #fff; background: #242c46; border-color: #8e78ff; }
.icon-button:focus-visible, .locale-select:focus-visible { outline: 2px solid #4de8ed; outline-offset: 3px; }
.register-close.icon-button { top: 14px; right: 14px; z-index: 1; }
.register-card h2 { padding-right: 38px; }
.topbar { gap: 12px; }
.topbar .brand { min-width: 0; }
.topbar .brand-mark { flex: none; }
.topbar .brand > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-right { flex: none; gap: 12px; }
.user-menu { gap: 8px; }
#username-label { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 1050px) { .topbar-tag { display: none; } }
@media (max-width: 540px) { #username-label { display: none; } }
.public-showcase {
  max-width: 1300px;
  margin: 0 auto 70px;
  padding: 26px 30px;
  border: 1px solid #303b56;
  border-radius: 18px;
  background: #111521ee;
  box-shadow: 0 0 0 1px #8a73ff10, 0 24px 70px #02030a55;
}
.public-showcase-heading { display: flex; justify-content: space-between; align-items: end; gap: 18px; margin-bottom: 18px; }
.public-showcase h2 { margin: 8px 0 5px; color: #f5f5fa; font-size: 28px; }
.public-showcase p { margin: 0; color: #a4a5b1; font-size: 13px; }
.showcase-badge { display: inline-flex; align-items: center; padding: 7px 11px; border: 1px solid #4de8ed66; border-radius: 999px; color: #aaf4f1; background: #18353a55; font-size: 11px; font-weight: 800; white-space: nowrap; }
.public-work-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.public-work-grid--single { grid-template-columns: minmax(0, 1fr); max-width: 860px; margin: 0 auto; }
.public-work-card { overflow: hidden; border: 1px solid #354564; border-radius: 14px; background: #171b29; box-shadow: 0 0 0 1px #8a73ff0c; }
.public-work-thumb { min-height: 160px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 10px; position: relative; padding: 18px; text-align: center; }
.showcase-video-thumb { min-height: 0; aspect-ratio: 16 / 9; padding: 0; background: #0b0d14; }
.showcase-video { display: block; width: 100%; height: 100%; object-fit: cover; }
.showcase-video-thumb::after { display: none; }
.showcase-video-fallback { position: absolute; left: 12px; bottom: 12px; z-index: 1; padding: 5px 8px; border: 1px solid #4de8ed55; border-radius: 999px; color: #c5faf6; background: #080a12b8; font-size: 10px; font-weight: 800; pointer-events: none; }
.public-work-grid--single .public-work-body { padding: 16px 20px 18px; }
.public-work-grid--single .public-work-body h3 { font-size: 18px; }
.public-work-grid--single .public-work-body p { font-size: 12px; }
.public-work-thumb::after { content: ""; position: absolute; inset: 10px; border: 1px solid #ffffff16; border-radius: 10px; pointer-events: none; }
.thumb-story { background: radial-gradient(circle at 25% 25%, #4de8ed3d, transparent 38%), linear-gradient(135deg, #2f235f, #151f3a 70%, #162f3e); }
.thumb-fraction { background: radial-gradient(circle at 72% 35%, #4de8ed3d, transparent 34%), linear-gradient(135deg, #16355b, #25205b 70%, #1f3462); }
.thumb-orange { background: radial-gradient(circle at 75% 22%, #ffb15b55, transparent 33%), linear-gradient(135deg, #522b55, #292354 68%, #3a273b); }
.work-mark { position: absolute; top: 15px; left: 20px; color: #b9aaff; text-shadow: 0 0 12px #8a73ff; }
.work-characters { color: #fff; font-size: 34px; letter-spacing: 5px; filter: drop-shadow(0 0 10px #4de8ed55); }
.work-equation { color: #fff; font-size: 27px; font-weight: 900; text-shadow: 0 0 14px #49e6e1aa; }
.work-caption { color: #d9dcf6; font-size: 12px; font-weight: 700; }
.public-work-body { padding: 14px; }
.public-work-body h3 { margin: 0 0 5px; color: #f4f2ff; font-size: 15px; }
.public-work-body p { color: #929ab0; font-size: 11px; }
@media (max-width: 850px) { .public-work-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 850px) { .public-work-grid--single { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 540px) {
  .public-showcase { margin-bottom: 42px; padding: 20px; }
  .public-showcase-heading { display: block; }
  .showcase-badge { margin-top: 10px; }
  .public-work-grid { grid-template-columns: 1fr; }
  .topbar-right { gap: 7px; }
}

/* Keep the storyboard heading and its controls in separate, predictable
   layout areas.  The controls become a full-width row only on narrow screens. */
.create-step-panel .storyboard-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 14px 20px;
}
.create-step-panel .storyboard-heading > div:first-child { min-width: 0; }
.create-step-panel .storyboard-heading .project-controls {
  width: auto;
  max-width: 100%;
  min-width: 0;
  margin-left: auto;
  flex: none;
  justify-content: flex-end;
}
.generation-availability { margin: 12px 0 18px; }

/* One model picker and one action per shot. Keep the cost hint close to the
   control so the provider status does not take over the storyboard. */
.shot-generate-control { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.shot-model-label { margin: 0 !important; color: #c3c5d0 !important; font-size: 11px !important; }
.shot-model-row { display: flex; align-items: stretch; gap: 6px; min-width: 0; }
.shot-model { width: 100%; min-width: 0; min-height: 36px; padding: 7px 30px 7px 10px; color: #f4f4f8; background: #20212a; border: 1px solid #454a6b; border-radius: 9px; font: inherit; font-size: 11px; font-weight: 750; }
.shot-model:focus { outline: 0; border-color: var(--cyber-cyan); box-shadow: 0 0 0 3px #4de8ed1c; }
.shot-model:disabled { opacity: .65; cursor: not-allowed; }
.shot-info { flex: 0 0 36px; width: 36px !important; min-height: 36px !important; padding: 0 !important; border: 1px solid #454a6b; border-radius: 50%; background: #24233a; color: #c7baff; font-size: 14px !important; font-weight: 900; cursor: pointer; }
.shot-info .ui-icon { width: 17px; height: 17px; }
.shot-info:hover { border-color: var(--cyber-cyan); color: #fff; box-shadow: 0 0 12px #4de8ed30; }
.shot-model-info { color: #9fa4b8; font-size: 10px; line-height: 1.45; padding: 6px 8px; border: 1px solid #383b4d; border-radius: 7px; background: #171923; }
.shot-generate { min-width: 0; }
.shot-retry-stuck { margin-top: 7px; min-height: 34px; padding: 0 10px; font-size: 11px; }
@media (max-width: 620px) { .shot-actions { grid-template-columns: 1fr 1fr; } .shot-generate-control { grid-column: 1/-1; } }

/* Keep the secondary shot actions visually aligned even when one is a label
   wrapping a hidden file input and the other is a regular button. */
.shot-actions > .shot-copy,
.shot-actions > .shot-upload {
  height: 42px;
  min-height: 42px;
  padding-top: 0;
  padding-bottom: 0;
}
.shot-actions > .shot-upload { display: inline-flex; align-items: center; justify-content: center; }
@media (max-width: 1050px) {
  .create-step-panel .storyboard-heading { grid-template-columns: minmax(0, 1fr); }
  .create-step-panel .storyboard-heading .project-controls {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }
}

/* Narrow viewport guardrails.  The storyboard is a single-column editor on
   phones and small embedded browser panes; keep every grid item shrinkable so
   a long button label or the desktop shot width cannot push the page sideways. */
/* Clip accidental horizontal overflow without creating a scroll container.
   `overflow-x: hidden` on the root/body breaks the sticky topbar in browsers
   by making the document itself the sticky scrolling ancestor. */
html, body { max-width: 100%; overflow-x: clip; }
.studio,
.studio-page,
.project-studio,
.create-step-panel,
.shot-grid,
.shot-card,
.storyboard-heading,
.project-controls { min-width: 0; max-width: 100%; }
.project-studio { width: 100%; }
.shot-grid { width: 100%; max-width: none; }
.storyboard-heading > *,
.project-heading > *,
.project-controls > * { min-width: 0; max-width: 100%; }
.project-heading h2,
.project-heading p,
.storyboard-heading h3,
.storyboard-heading p { overflow-wrap: anywhere; }

@media (max-width: 760px) {
  .topbar { min-width: 0; gap: 8px; }
  .topbar .brand { min-width: 0; max-width: 55%; flex: 1 1 auto; }
  .topbar-right { min-width: 0; max-width: 45%; flex: 0 1 auto; }
  .studio { width: 100%; min-width: 0; }
  .project-studio { padding: 16px; }
  .project-heading,
  .create-step-panel .storyboard-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }
  .project-heading .project-runtime { justify-self: start; max-width: 100%; }
  .create-step-panel .storyboard-heading .project-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 7px;
  }
  .create-step-panel .project-controls button {
    width: 100%;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .shot-selector { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shot-card { width: 100%; }
  .shot-actions { grid-template-columns: minmax(0, 1fr); }
  .shot-actions > * { min-width: 0; }
}

@media (max-width: 420px) {
  .topbar { padding-left: 10px; padding-right: 10px; }
  .topbar .brand { max-width: 60%; }
  .topbar-right { max-width: 40%; gap: 5px; }
  .project-studio { padding: 12px; }
  .create-step-panel .storyboard-heading .project-controls,
  .shot-selector { grid-template-columns: 1fr; }
  .create-step-tab { min-width: 0; }
}

.shot-narration-control { flex: 1 1 100%; min-width: 0; display: grid; gap: 6px; align-self: start; align-content: start; }
.shot-jyutping-control { flex: 1 1 100%; min-width: 0; display: grid; gap: 6px; }
.shot-caption-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.shot-caption-row label { margin: 7px 0 4px; }
.shot-caption-visibility { min-height: 30px; padding: 5px 28px 5px 9px; color: #d6d7e2; background: #171923; border: 1px solid #383b4d; border-radius: 8px; font: inherit; font-size: 11px; font-weight: 700; }
.shot-voice-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; min-width: 0; }
.shot-voice-label-row .shot-model-label { flex: 0 0 auto; }
.shot-voice-hint { flex: 0 1 auto; min-width: 0; overflow: hidden; color: #898da3; font-size: 10px; font-weight: 600; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.shot-narration-control .shot-model-row { display: flex; align-items: center; gap: 7px; }
.shot-voice { flex: 1 1 auto; min-width: 0; min-height: 36px; padding: 7px 30px 7px 10px; color: #f4f4f8; background: #20212a; border: 1px solid #454a6b; border-radius: 9px; font: inherit; font-size: 11px; font-weight: 750; }
.shot-narration-control .shot-tts { width: auto; flex: 0 0 auto; height: 36px; min-height: 36px; padding: 0 12px; white-space: nowrap; }
.shot-jyutping { min-height: 36px; padding: 7px 10px !important; color: #d6d7e2 !important; background: #171923 !important; border-color: #383b4d !important; font-size: 11px !important; }
.shot-jyutping-label { display: block; margin: 7px 0 4px; color: #8fe8e4; font-size: 11px; font-weight: 700; }
.shot-jyutping-row { display: flex; align-items: center; justify-content: space-between; gap: 7px; }
.shot-jyutping-row .shot-jyutping-label { margin: 7px 0 4px; }
.shot-jyutping-ai { min-height: 30px; padding: 0 9px; white-space: nowrap; }
.shot-jyutping-ai:disabled { opacity: .55; cursor: not-allowed; }
.shot-narration-audio { width: 100%; min-height: 36px; margin-top: 10px; }
.private-voice-settings { margin-top: 18px; padding-top: 16px; border-top: 1px solid #363847; }
.private-voice-settings { display: none !important; }
.private-voice-settings h3 { margin: 0 0 5px; color: #ded8ff; font-size: 14px; }
.private-voice-settings p { margin: 0 0 10px; color: #9296a8; font-size: 11px; line-height: 1.5; }
.private-voice-fields { display: grid; grid-template-columns: 1fr 1fr auto; gap: 7px; }
.private-voice-fields input { min-width: 0; }
.private-voice-fields .outline-button { min-height: 40px; white-space: nowrap; }
.private-voice-list { display: grid; gap: 5px; margin-top: 9px; }
.private-voice-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 9px; border: 1px solid #363847; border-radius: 8px; color: #b9bbca; font-size: 11px; }
.private-voice-row .icon-button { min-width: 28px; width: 28px; height: 28px; padding: 0; color: #e9b4bd; }
@media (max-width: 620px) { .private-voice-fields { grid-template-columns: 1fr; } .shot-narration-control .shot-model-row { flex-wrap: wrap; } .shot-narration-control .shot-tts { width: 100%; } .shot-voice-label-row { align-items: flex-start; flex-direction: column; gap: 2px; } .shot-voice-hint { overflow: visible; text-align: left; text-overflow: clip; white-space: normal; } .shot-jyutping-row { align-items: flex-start; flex-direction: column; gap: 2px; } .shot-jyutping-ai { width: 100%; } }

/* Keep the controls in each shot visually balanced.  The model picker has
   two rows of metadata, so a stretched grid row used to make the generate
   button much taller than Copy prompt and Import MP4. */
.shot-actions {
  align-items: start;
}
.shot-actions > .shot-generate,
.shot-actions > .shot-copy,
.shot-actions > .shot-upload {
  align-self: start;
  height: 44px;
  min-height: 44px;
  padding: 0 12px;
  line-height: 1.2;
}
.shot-actions > .shot-generate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.shot-actions > .shot-copy,
.shot-actions > .shot-upload {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Navigation actions share one height and a comfortable minimum width on
   desktop.  The grid override below lets them fill narrow screens without
   introducing horizontal overflow. */
.shot-navigation > button {
  height: 48px;
  min-height: 48px;
  min-width: 142px;
  padding: 0 16px;
  white-space: nowrap;
}
.shot-navigation #to-finish-btn {
  min-width: 186px;
}

/* Keep the project toolbar compact and consistent with shot actions. */
.project-controls > button {
  height: 42px;
  min-height: 42px;
  padding: 0 13px;
}

@media (max-width: 760px) {
  .shot-navigation > button {
    min-width: 0;
    width: 100%;
  }
  .shot-actions > .shot-generate,
  .shot-actions > .shot-copy,
  .shot-actions > .shot-upload {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .shot-actions > .shot-generate,
  .shot-actions > .shot-copy,
  .shot-actions > .shot-upload {
    height: auto;
    min-height: 44px;
    padding: 8px 10px;
    white-space: normal;
  }
}

/* Product tour / onboarding overlay. */
body.tour-open { overflow: hidden; }
.tour-open-button { color: #b9adff; }
.product-tour { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; }
.product-tour-backdrop { position: absolute; inset: 0; background: transparent; }
.tour-spotlight { position: fixed; z-index: 1; border: 2px solid var(--cyber-cyan); border-radius: 12px; box-shadow: 0 0 0 9999px #050610d9, 0 0 24px #4de8ed99; pointer-events: none; }
.tour-spotlight[hidden] { display: none; }
.product-tour:not(.tour-has-target) .product-tour-backdrop { background: #050610d9; }
.product-tour-card { position: fixed; z-index: 2; width: min(520px, 100%); max-height: calc(100vh - 28px); overflow: auto; padding: 26px; border: 1px solid #6a5db1; border-radius: 20px; background: linear-gradient(145deg, #1a1d31, #10131f); box-shadow: 0 25px 80px #000b, 0 0 0 1px #4de8ed18, 0 0 38px #806cff30; }
.product-tour-header, .product-tour-progress, .product-tour-actions, .tour-navigation { display: flex; align-items: center; }
.product-tour-header, .product-tour-actions { justify-content: space-between; gap: 18px; }
.product-tour-header .icon-button { flex: 0 0 auto; }
.product-tour-kicker { color: #a9f8f1; font-size: 11px; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; }
.product-tour-progress { gap: 10px; margin: 22px 0 15px; color: #9da5bd; font-size: 11px; font-weight: 800; }
.tour-dot { width: 7px; height: 7px; display: inline-block; margin-right: 5px; border-radius: 50%; background: #3b435d; }
.tour-dot.active { background: var(--cyber-cyan); box-shadow: 0 0 10px #4de8edaa; }
.product-tour-card h2 { margin: 0 0 9px; color: #f7f6ff; font-size: 26px; letter-spacing: -.7px; }
.product-tour-card p { min-height: 52px; margin: 0; color: #b8bed0; font-size: 14px; line-height: 1.65; }
.product-tour-actions { align-items: end; margin-top: 26px; }
.tour-auto-open { display: inline-flex; align-items: center; gap: 8px; color: #aeb5c7; font-size: 11px; line-height: 1.4; }
.tour-auto-open input { width: 16px; height: 16px; margin: 0; accent-color: var(--cyber-cyan); }
.tour-navigation { gap: 8px; }
.tour-navigation button { min-width: 82px; min-height: 40px; }
@media (max-width: 600px) {
  .product-tour { padding: 14px; }
  .product-tour-card { padding: 21px; }
  .product-tour-actions { align-items: stretch; flex-direction: column; }
  .tour-navigation { justify-content: flex-end; }
}

/* Shot action alignment: keep the model picker as the first column and line
   every action up with its select row.  The previous auto-fit grid stretched
   action buttons to the height of the model label, so Generate/Copy/Import
   appeared too tall and started above the select control. */
.shot-actions {
  grid-template-columns: minmax(250px, 1.15fr) repeat(3, minmax(150px, 1fr));
  align-items: start;
}
.shot-actions > .shot-generate-control {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
}
.shot-actions > .shot-generate,
.shot-actions > .shot-copy,
.shot-actions > .shot-upload {
  align-self: start;
  width: 100%;
  box-sizing: border-box;
  height: 42px;
  min-height: 42px;
  margin-top: 21px;
  padding: 0 12px;
  line-height: 1;
}
.shot-actions > .shot-generate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  grid-column: 2;
  grid-row: 1;
}
.shot-actions > .shot-copy,
.shot-actions > .shot-upload {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.shot-actions > .shot-upload .shot-upload-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
}
.shot-actions > .shot-copy { grid-column: 3; grid-row: 1; }
.shot-actions > .shot-upload { grid-column: 4; grid-row: 1; }
.shot-actions > .shot-narration-control {
  grid-column: 1 / -1;
  grid-row: 2;
  width: 100%;
}

@media (max-width: 1100px) {
  .shot-actions {
    grid-template-columns: minmax(190px, 1fr) repeat(3, minmax(110px, 1fr));
  }
}

@media (max-width: 760px) {
  .shot-actions {
    grid-template-columns: minmax(0, 1fr);
  }
  .shot-actions > .shot-generate-control,
  .shot-actions > .shot-generate,
  .shot-actions > .shot-copy,
  .shot-actions > .shot-upload,
  .shot-actions > .shot-narration-control {
    grid-column: 1;
    grid-row: auto;
  }
  .shot-actions > .shot-generate,
  .shot-actions > .shot-copy,
  .shot-actions > .shot-upload {
    margin-top: 0;
  }
}

/* Responsive studio shell.  The earlier 760px breakpoint left small tablets
   (and in-app mobile browser panes) with the desktop sidebar and a crowded
   header.  Collapse the shell at 900px so the content always has the full
   viewport width; the navigation remains swipeable rather than clipping. */
@media (max-width: 900px) {
  .topbar {
    height: 68px;
    padding: 0 14px;
    gap: 8px;
  }
  .topbar .brand {
    min-width: 0;
    max-width: 46%;
    flex: 1 1 auto;
    gap: 8px;
    font-size: clamp(16px, 2.4vw, 20px);
  }
  .topbar .brand-mark { width: 36px; height: 36px; }
  .topbar-right {
    min-width: 0;
    max-width: 54%;
    flex: 0 1 auto;
    gap: 6px;
  }
  .locale-control {
    min-height: 42px;
    padding: 2px 5px 2px 7px;
    gap: 4px;
    border-radius: 10px;
  }
  .locale-control > .ui-icon { width: 19px; height: 19px; }
  .locale-control .locale-select { width: 50px; height: 34px; padding: 0 3px; border-radius: 7px; font-size: 13px; }
  .icon-button { flex-basis: 38px; width: 38px; height: 38px; border-radius: 10px; }
  .user-menu { gap: 5px; }
  .studio-sidebar {
    position: sticky;
    top: 68px;
    width: auto;
    height: 62px;
    min-height: 0;
    flex-direction: row;
    align-items: center;
    padding: 8px 12px;
    margin: -20px -14px 20px;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: 0;
    border-bottom: 1px solid #2c2e39;
    scrollbar-width: none;
  }
  .studio-sidebar::-webkit-scrollbar { display: none; }
  .studio-sidebar .sidebar-heading,
  .studio-sidebar .sidebar-bottom { display: none; }
  .studio-sidebar .sidebar-new-project {
    width: auto;
    min-width: max-content;
    min-height: 40px;
    margin: 0 10px 0 0;
    padding: 8px 13px;
    white-space: nowrap;
    font-size: 12px;
  }
  .sidebar-nav { display: flex; gap: 5px; margin: 0; flex: 0 0 auto; }
  .side-link { white-space: nowrap; height: 40px; padding: 0 11px; gap: 8px; font-size: 12px; }
  .side-icon { width: 18px; height: 18px; }
  .studio { width: 100%; min-width: 0; margin-left: 0; padding: 20px 14px 70px; }
  .studio-page { min-height: 0; }
  .welcome-row { display: block; margin-bottom: 22px; }
  .welcome-row h1 { font-size: clamp(32px, 6vw, 45px); letter-spacing: -1.7px; }
  .welcome-row p { max-width: 38rem; }
  .quota-card { width: 100%; max-width: 420px; margin-top: 20px; }
  .studio-hero { grid-template-columns: 1fr; min-height: 0; }
  .hero-copy { padding: 25px clamp(20px, 5vw, 34px); }
  .hero-copy h2 { font-size: clamp(31px, 6vw, 44px); }
  .hero-visual { min-height: 235px; }
  .hero-visual img { width: min(230px, 58%); height: 215px; }
  .public-plans, .public-showcase { width: calc(100% - 28px); margin-left: auto; margin-right: auto; }
  .login-layout { width: min(100% - 28px, 720px); }
  .project-studio, .credit-shop { width: 100%; }
}

@media (max-width: 620px) {
  .topbar .brand { max-width: 43%; font-size: 17px; }
  .topbar-right { max-width: 57%; }
  #username-label { display: none; }
  .studio-sidebar { margin-left: -12px; margin-right: -12px; }
  .studio { padding-left: 12px; padding-right: 12px; }
  .studio-hero .hero-copy { padding: 23px 20px; }
  .hero-copy p { font-size: 12px; }
  .hero-visual { min-height: 210px; }
  .hero-visual img { height: 185px; }
  .public-plans, .public-showcase { width: calc(100% - 24px); padding: 18px; }
  .public-plans h2, .public-showcase h2 { font-size: 24px; }
  .public-package-grid { grid-template-columns: 1fr; }
  .login-layout { width: calc(100% - 24px); margin-top: 12px; }
}

/* The worksheet reader returns a teacher-reviewable answer sheet instead of
   silently turning a photographed exercise into a generic story. */
.math-solution-review {
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid #4d4770;
  border-radius: 13px;
  background: #181827;
  color: #e9e6f7;
}
.math-solution-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.math-solution-heading strong { color: #8fe8e4; font-size: 14px; }
.math-solution-heading span, .math-solution-confidence { color: #bcb5d1; font-size: 11px; }
.math-solution-review ol { margin: 0; padding-left: 22px; }
.math-solution-review-hint { margin: 0 0 10px; color: #bcb5d1; font-size: 12px; }
.math-solution-review li { margin: 10px 0 0; line-height: 1.45; }
.math-solution-item { padding: 12px 14px 14px; border: 1px solid #373453; border-radius: 12px; background: #121522; list-style-position: outside; }
.math-solution-item-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.math-solution-item-heading strong { color: #fff; font-size: 13px; font-weight: 750; }
.math-solution-editor { width: 100%; box-sizing: border-box; border: 1px solid #3d4668; border-radius: 8px; background: #0d1220; color: #f3f0ff; padding: 9px 10px; font: inherit; font-size: 12px; resize: vertical; }
.math-solution-editor:focus { outline: 2px solid #8fe8e4; outline-offset: 1px; }
.math-solution-question { min-height: 46px; margin-bottom: 8px; }
.math-solution-field-label { display: block; margin: 7px 0 4px; color: #bcb5d1; font-size: 11px; font-weight: 700; }
.math-solution-field-note { display: inline-block; margin-left: 6px; color: #8fe8e4; font-size: 10px; font-weight: 650; letter-spacing: .01em; }
.math-solution-answer { color: #d9c8ff; font-weight: 750; }
.math-solution-steps { color: #c9c5d7; min-height: 62px; }
.math-solution-confidence { display: inline-block; margin-top: 2px; color: #f2c674; }
.math-solution-action-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.math-solution-action { min-height: 36px; font-size: 12px; }
@media (max-width: 620px) {
  .math-solution-heading { align-items: flex-start; flex-direction: column; gap: 3px; }
  .math-solution-review { padding: 12px; }
  .math-solution-item { padding: 10px 11px 12px; }
  .math-solution-action-row { align-items: stretch; flex-direction: column; gap: 8px; }
  .math-solution-action { width: 100%; }
}

/* One-click storyboard generation: keep the action prominent without
   letting the progress text push the controls off-screen on mobile. */
.batch-generate-button { border-color: #8fe8e4aa; }
.batch-generate-button[aria-busy="true"] { cursor: wait; opacity: .82; }
.batch-generate-status { display: inline-flex; align-items: center; max-width: 19rem; min-height: 32px; color: #bcb5d1; font-size: 11px; line-height: 1.35; }
.batch-generate-status.error { color: #ffabab; }
.seedance-single-button { border-color: #b9a2ff99; }
.seedance-single-button[aria-busy="true"] { cursor: wait; opacity: .82; }
.seedance-single-status { color: #a9ebea; }
.seedance-single-status.error { color: #ffabab; }
@media (max-width: 780px) {
  .batch-generate-status { grid-column: 1 / -1; max-width: none; }
}

@media (max-width: 390px) {
  .topbar { padding-left: 9px; padding-right: 9px; }
  .topbar .brand { max-width: 40%; gap: 5px; font-size: 15px; }
  .topbar .brand-mark { width: 31px; height: 31px; }
  .topbar-right { max-width: 60%; gap: 4px; }
  .locale-control { padding-left: 5px; padding-right: 3px; }
  .locale-control > .ui-icon { width: 17px; height: 17px; }
  .locale-control .locale-select { width: 43px; }
  .icon-button { flex-basis: 35px; width: 35px; height: 35px; }
  .tour-open-button { display: none; }
}

/* On phones, keep the workspace navigation in a proper off-canvas menu.  A
   horizontal sidebar consumes the first screen and makes the actual page
   controls easy to miss. */
.mobile-menu-button { display: none; }
.mobile-menu-button[hidden] { display: none !important; }
@media (max-width: 900px) {
  .mobile-menu-button { display: inline-flex; }
  .studio-sidebar {
    position: fixed;
    top: 68px;
    right: auto;
    bottom: 0;
    left: 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: min(286px, 86vw);
    height: auto;
    min-height: 0;
    margin: 0;
    padding: 22px 14px 24px;
    overflow-x: hidden;
    overflow-y: auto;
    border-right: 1px solid #343752;
    border-bottom: 0;
    transform: translateX(-106%);
    transition: transform .2s ease;
  }
  .studio-sidebar .sidebar-heading,
  .studio-sidebar .sidebar-bottom { display: flex; }
  .studio-sidebar .sidebar-heading { flex: none; }
  .studio-sidebar .sidebar-heading-second { margin-top: 32px; }
  .studio-sidebar .sidebar-new-project { width: 100%; min-width: 0; margin: 0 0 24px; }
  .studio-sidebar .sidebar-nav { display: grid; flex: none; gap: 5px; margin-top: 13px; }
  .studio-sidebar .side-link { height: 44px; min-height: 44px; white-space: normal; }
  .studio-sidebar .sidebar-bottom { margin-top: auto; }
  body.mobile-menu-open { overflow: hidden; }
  body.mobile-menu-open::after {
    content: "";
    position: fixed;
    inset: 68px 0 0;
    z-index: 40;
    background: #02040bcc;
    backdrop-filter: blur(2px);
  }
  body.mobile-menu-open .studio-sidebar { transform: translateX(0); }
  .quota-card { width: 100%; max-width: none; }
  /* Put the visual starting point before the text fields on a phone.  On
     wider screens the reference panel stays in the right hand column. */
  .project-basics { grid-template-columns: 1fr; }
  .reference-panel { order: -1; }
}

/* On phones, let creators see the visual starting point before filling in
   the story fields. Keep the desktop two-column order unchanged. */
@media (max-width: 850px) {
  .project-basics {
    display: flex;
    flex-direction: column;
  }
  .project-basics .reference-panel {
    order: -1;
  }
}

/* Keep the storyboard heading readable before a narrow laptop or portrait
   browser pane can squeeze it into one-character lines. This block stays at
   the end so it wins over the desktop two-column heading rules above. */
@media (max-width: 1300px) {
  .create-step-panel .storyboard-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 13px;
  }
  .create-step-panel .storyboard-heading > div:first-child { min-width: 0; }
  .create-step-panel .storyboard-heading .project-controls {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }
}

/* The desktop two-column heading must keep enough room for its title.  An
   auto-sized controls track can otherwise consume almost the entire row and
   leave the first grid item a few pixels wide, which makes CJK text render one
   character per line (for example, "6 格分鏡"). */
@media (min-width: 1301px) {
  .create-step-panel .storyboard-heading {
    /* Keep the description full width. A long row of controls otherwise
       leaves the copy column too narrow and wraps every CJK phrase. */
    grid-template-columns: minmax(0, 1fr);
  }
  .create-step-panel .storyboard-heading > div:first-child {
    width: auto;
    min-width: 0;
  }
  .create-step-panel .storyboard-heading h3,
  .create-step-panel .storyboard-heading p {
    width: 100%;
    max-width: none;
    overflow-wrap: normal;
    word-break: keep-all;
  }
  .create-step-panel .storyboard-heading .project-controls {
    grid-column: 1;
    grid-row: 2;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }
}

/* Full-screen video editor workspace.  The editor is intentionally a page-like
   surface: the stage gets the visual priority while controls stay in a calm,
   scrollable inspector. */
body.video-editor-open { overflow: hidden; }
.video-editor-panel { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; margin: 0; padding: clamp(14px, 2.5vw, 34px); border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.video-editor-panel[hidden] { display: none; }
.video-editor-backdrop { position: absolute; inset: 0; background: #050711; }
.video-editor-shell { position: relative; z-index: 1; display: grid; grid-template-rows: auto minmax(0, 1fr); width: min(1480px, 100%); height: min(900px, calc(100vh - 28px)); min-height: 0; overflow: hidden; border: 1px solid #4a4d74; border-radius: 20px; background: linear-gradient(145deg, #161a2a, #0e111c 64%, #151326); box-shadow: 0 34px 110px #000c, 0 0 0 1px #8d78ff18, 0 0 50px #806cff25; }
.video-editor-topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 24px 18px; border-bottom: 1px solid #303451; background: #15182a; }
.video-editor-title-wrap { min-width: 0; }
.video-editor-kicker { display: block; margin-bottom: 7px; color: #a69aff; font-size: 10px; font-weight: 850; letter-spacing: .18em; }
.video-editor-title-line { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.video-editor-title-line h2 { margin: 0; color: #f7f5ff; font-size: clamp(20px, 2vw, 28px); letter-spacing: -.5px; }
.video-editor-title-line p, .video-editor-title-wrap p { margin: 5px 0 0; color: #9da4bb; font-size: 12px; }
.video-editor-save-state { padding: 5px 9px; border: 1px solid #3d756f; border-radius: 999px; color: #9feee9; background: #153434; font-size: 10px; font-weight: 750; }
.video-editor-close { flex: none; width: 42px; height: 42px; border-color: #454a70; background: #20243a; }
.video-editor-close:hover { color: #fff; border-color: #a395ff; background: #302950; }
.video-editor-workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(290px, 340px); gap: 18px; min-height: 0; padding: 18px; overflow: hidden; }
.video-editor-stage { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-width: 0; min-height: 0; gap: 12px; }
.video-editor-stage-toolbar, .video-editor-sidebar-head, .video-editor-timeline-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.video-editor-stage-toolbar { color: #dedcff; font-size: 12px; font-weight: 800; }
.video-editor-stage-tip, .video-editor-help { color: #858da8; font-size: 10px; font-weight: 600; }
.video-editor-canvas { position: relative; display: grid; place-items: center; min-height: 0; overflow: hidden; border: 1px solid #333b5f; border-radius: 14px; background: radial-gradient(circle at 50% 45%, #1b2035, #070a12 78%); box-shadow: inset 0 0 60px #0008; }
.video-editor-preview { width: 100%; height: 100%; max-height: none; border: 0; border-radius: 0; background: #05060a; object-fit: contain; }
.video-editor-canvas-label { position: absolute; top: 12px; left: 14px; padding: 4px 7px; border: 1px solid #ffffff1c; border-radius: 5px; color: #d9d5ff; background: #080a1288; font-size: 9px; font-weight: 850; letter-spacing: .16em; pointer-events: none; }
.video-editor-timeline-main { padding: 12px 14px 10px; border: 1px solid #343a5a; border-radius: 12px; background: #121626; }
.video-editor-timeline-head { color: #ccd0e6; font-size: 11px; font-weight: 800; }
.video-editor-timeline-main input[type="range"] { margin: 8px 0 1px; }
.video-editor-range-hint { display: flex; justify-content: space-between; color: #707895; font-size: 9px; }
.video-editor-sidebar { display: flex; flex-direction: column; gap: 12px; min-width: 0; min-height: 0; overflow: auto; padding: 4px 2px 4px 0; }
.video-editor-sidebar-head { padding: 0 3px 2px; }
.video-editor-section-label { color: #edeaff; font-size: 13px; font-weight: 850; }
.video-editor-card { padding: 14px; border: 1px solid #343956; border-radius: 12px; background: #151a2b; }
.video-editor-card h3 { margin: 0 0 5px; color: #e9e6ff; font-size: 12px; }
.video-editor-card p { margin: 0 0 12px; color: #878fa8; font-size: 10px; line-height: 1.45; }
.video-editor-media-storage { margin: -4px 0 9px; color: #9feee9; font-size: 10px; font-variant-numeric: tabular-nums; }
.video-editor-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.video-editor-card-badge { padding: 3px 6px; border: 1px solid #3c4670; border-radius: 999px; color: #9feee9; font-size: 9px; font-weight: 800; letter-spacing: .04em; }
.video-editor-media-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-bottom: 9px; }
.video-editor-media-picker { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 0; min-height: 32px; padding: 5px 7px; font-size: 10px; cursor: pointer; }
.video-editor-media-picker[aria-disabled="true"] { opacity: .55; pointer-events: none; }
.video-editor-media-picker input { display: none; }
.video-editor-media-dropzone { display: grid; gap: 3px; margin: 0 0 9px; padding: 10px 8px; border: 1px dashed #46527b; border-radius: 8px; color: #aeb4cf; background: #101525; text-align: center; cursor: pointer; transition: border-color .16s, background .16s, color .16s, box-shadow .16s; }
.video-editor-media-dropzone strong { color: #dedcff; font-size: 10px; font-weight: 800; }
.video-editor-media-dropzone span { color: #858da8; font-size: 9px; line-height: 1.4; }
.video-editor-media-dropzone:hover, .video-editor-media-dropzone:focus-visible, .video-editor-media-dropzone.is-drag-over { border-color: #58edf1; color: #efffff; background: #14253a; box-shadow: inset 0 0 0 2px #58edf122, 0 0 18px #58edf122; outline: 0; }
.video-editor-media-dropzone.is-drag-over strong, .video-editor-media-dropzone:focus-visible strong { color: #9feee9; }
.video-editor-media-list { display: grid; gap: 6px; max-height: 170px; overflow: auto; padding-right: 2px; }
.video-editor-media-empty { margin: 0 !important; padding: 8px 2px; color: #737c9c !important; font-size: 10px !important; }
.video-editor-media-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 7px; min-width: 0; padding: 7px 8px; border: 1px solid #303856; border-radius: 8px; background: #101525; cursor: grab; }
.video-editor-media-item:hover { border-color: #5b6ba6; background: #151c31; }
.video-editor-media-item.is-dragging { opacity: .52; cursor: grabbing; }
.video-editor-media-item-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 4px; }
.video-editor-media-identity { display: flex; align-items: center; gap: 7px; min-width: 0; }
.video-editor-media-icon { flex: none; width: 16px; height: 16px; color: #a69aff; }
.video-editor-media-details { display: grid; min-width: 0; gap: 2px; }
.video-editor-media-details strong { overflow: hidden; color: #e6e5f7; font-size: 10px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.video-editor-media-details span { color: #858da8; font-size: 9px; }
.video-editor-media-add { min-height: 28px; padding: 4px 7px; font-size: 9px; white-space: nowrap; }
.video-editor-media-mute, .video-editor-media-remove, .video-editor-media-delete { min-height: 28px; padding: 4px 6px; color: #aeb4cf; font-size: 9px; white-space: nowrap; }
.video-editor-media-delete { color: #f3b0c1; border-color: #5a3b55; }
.video-editor-segment.is-asset { border-color: #ae8cff; background: linear-gradient(135deg, #514180, #765bc0); }
.video-editor-track-row.video-editor-track-a2 .video-editor-track-name { color: #a7e9e2; }
.video-editor-card .video-editor-fields { gap: 9px; }
.video-editor-trim-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.video-editor-sidebar .video-editor-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-top: auto; padding-top: 4px; }
.video-editor-sidebar .video-editor-actions #video-editor-status { grid-column: 1 / -1; min-height: 16px; }
.video-editor-sidebar .video-editor-actions .primary-button { min-height: 40px; }
.video-editor-sidebar .video-editor-actions .outline-button { min-height: 40px; }
.video-editor-track-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.video-editor-edit-hint { color: #777f9d; font-size: 10px; font-weight: 600; }
.video-editor-timeline-toolbar { display: flex; flex-wrap: wrap; gap: 7px; margin: 9px 0 5px; }
.video-editor-timeline-toolbar .outline-button { min-height: 30px; padding: 5px 9px; font-size: 10px; }
.video-editor-timeline-toolbar .outline-button:disabled { opacity: .42; cursor: not-allowed; }
.video-editor-track-timeline { position: relative; display: grid; gap: 5px; min-height: 84px; padding: 8px 8px 8px 0; overflow: hidden; border: 1px solid #2f3657; border-radius: 9px; background: #0c101c; }
.video-editor-track-row { display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: stretch; min-height: 30px; gap: 8px; }
.video-editor-track-name { display: grid; place-items: center; color: #8f96b1; font-size: 10px; font-weight: 850; letter-spacing: .06em; }
.video-editor-track-lane { position: relative; min-height: 30px; overflow: hidden; border: 1px solid #29304e; border-radius: 5px; background: repeating-linear-gradient(90deg, #101629 0, #101629 calc(10% - 1px), #252d4b 10%); }
.video-editor-track-lane.is-drop-target { border-color: #57e9e9; box-shadow: inset 0 0 0 2px #57e9e955, 0 0 18px #57e9e933; }
.video-editor-segment { position: absolute; top: 3px; bottom: 3px; display: flex; align-items: center; justify-content: center; min-width: 22px; overflow: hidden; padding: 0 8px; border: 1px solid #5d6bb0; border-radius: 4px; color: #f3f4ff; background: linear-gradient(135deg, #3f4b86, #5366bf); font: inherit; font-size: 9px; font-weight: 750; white-space: nowrap; cursor: grab; touch-action: none; transition: border-color .16s, box-shadow .16s, filter .16s; }
.video-editor-segment:hover { border-color: #9d96ff; filter: brightness(1.12); }
.video-editor-segment:active { cursor: grabbing; }
.video-editor-segment-audio { border-color: #3b948e; color: #d8fffb; background: linear-gradient(135deg, #1e5b63, #2f948c); }
.video-editor-segment.is-selected { border-color: #58edf1; box-shadow: 0 0 0 2px #55e5ee40, 0 0 18px #53e8ed36; filter: brightness(1.16); z-index: 2; }
.video-editor-segment.is-muted { border-color: #755c73; color: #d0b7cd; background: repeating-linear-gradient(135deg, #493e58 0, #493e58 6px, #342e43 6px, #342e43 12px); }
.video-editor-playhead { position: absolute; top: 2px; bottom: 2px; width: 2px; border-radius: 2px; background: #ffbf75; box-shadow: 0 0 10px #ffb868aa; pointer-events: none; z-index: 3; }
.video-editor-selection-label { margin: 9px 0 0 !important; color: #8fe9e5 !important; font-size: 10px !important; }
@media (max-width: 900px) {
  .video-editor-shell { height: min(920px, calc(100vh - 18px)); }
  .video-editor-workspace { grid-template-columns: 1fr; overflow: auto; }
  .video-editor-stage { min-height: 52vh; }
  .video-editor-sidebar { overflow: visible; }
}
@media (max-width: 600px) {
  .video-editor-panel { padding: 0; }
  .video-editor-shell { width: 100%; height: 100%; border-radius: 0; border-left: 0; border-right: 0; }
  .video-editor-topbar { padding: 16px; }
  .video-editor-title-line h2 { font-size: 20px; }
  .video-editor-save-state { display: none; }
  .video-editor-workspace { padding: 12px; gap: 14px; }
  .video-editor-stage { min-height: 48vh; }
  .video-editor-stage-tip { display: none; }
  .video-editor-edit-hint { display: none; }
  .video-editor-track-timeline { min-height: 78px; }
  .video-editor-trim-fields { grid-template-columns: 1fr; }
  .video-editor-media-actions { grid-template-columns: 1fr; }
  .video-editor-media-item { grid-template-columns: 1fr; }
  .video-editor-media-item-actions { justify-content: flex-start; }
}

/* Size the phone header from its controls instead of percentage columns.
   The language picker and account buttons have a fixed intrinsic width; a
   percentage cap let them spill past the viewport on 393px / 430px phones. */
@media (max-width: 900px) {
  .topbar .brand { max-width: none; flex: 1 1 0; }
  .topbar-right { max-width: none; flex: 0 0 auto; }
  .topbar-right .locale-control,
  .topbar-right .user-menu { flex: none; }
}
@media (max-width: 540px) {
  .topbar .brand { flex: 0 0 36px; }
  .topbar .brand > span:last-child { display: none; }
  .topbar .brand-mark { width: 36px; height: 36px; }
  .topbar-right .icon-button { flex-basis: 44px; width: 44px; height: 44px; }
  .topbar-right .locale-control { min-height: 44px; }
}
@media (max-width: 760px) {
  .create-step-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .create-step-tab { min-width: 0; padding: 10px 5px; overflow-wrap: anywhere; }
  .finish-summary,
  .project-finish,
  .project-export { min-width: 0; max-width: 100%; }
  .project-finish { display: grid; grid-template-columns: minmax(0, 1fr); }
  .project-finish > * { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
  .project-finish .primary-button { width: 100%; margin-top: 0; white-space: normal; }
  .project-disclaimer { overflow-wrap: anywhere; }
}
