:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #eef1f3;
  color: #121418;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  transition: background-color 500ms ease;
}

body.is-night {
  background: #080d1a;
}

button,
input {
  font: inherit;
}

select {
  font: inherit;
}

#scene {
  display: block;
  width: 100vw;
  height: 100vh;
  background: #edf0f1;
  cursor: grab;
}

#scene:active,
#scene.is-dragging {
  cursor: grabbing;
}

#scene.can-grab {
  cursor: grab;
}

.hud {
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 5;
  width: min(356px, calc(100vw - 36px));
  display: grid;
  gap: 12px;
  max-height: calc(100vh - 36px);
  padding: 12px;
  overflow-y: auto;
  border: 1px solid rgba(28, 33, 40, 0.12);
  border-radius: 8px;
  background: rgba(246, 248, 249, 0.72);
  box-shadow: 0 20px 70px rgba(31, 37, 45, 0.16);
  backdrop-filter: blur(18px);
  scrollbar-width: thin;
}

.hud-row,
.top-actions,
.control-line,
.toggle-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.hud-title {
  font-size: 13px;
  font-weight: 700;
  color: #191c22;
}

.mobile-controls-toggle,
.mobile-upload-button {
  display: none;
}

.mobile-controls-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 6px;
  color: #111827;
  background: rgba(24, 29, 36, 0.08);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

body.is-night .mobile-controls-close {
  color: #08111f;
  background: rgba(245, 249, 255, 0.9);
}

.mobile-controls-toggle img {
  display: none;
}

body.controls-collapsed .mobile-controls-toggle {
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 7;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  min-width: 46px;
  height: 46px;
  padding: 5px;
  border: 1px solid rgba(190, 215, 255, 0.32);
  border-radius: 8px;
  color: #f5f9ff;
  background: rgba(8, 13, 26, 0.88);
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(18px);
  cursor: pointer;
}

body.controls-collapsed .mobile-controls-toggle img {
  display: block;
  width: 34px;
  height: 34px;
  object-fit: contain;
}

body.controls-collapsed .mobile-controls-toggle span {
  display: none;
}

body.controls-collapsed .hud {
  transform: translateX(calc(-100% - 28px));
  opacity: 0;
  pointer-events: none;
}

#fps {
  color: #5f6b79;
  font-size: 11px;
  font-weight: 600;
}

.top-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: 8px;
  background: rgba(24, 29, 36, 0.08);
}

.panel-button {
  min-width: 0;
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  color: #566270;
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.top-actions input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.panel-button.is-active {
  color: #101319;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 1px 2px rgba(25, 28, 34, 0.12);
}

.control-line,
.toggle-line {
  font-size: 12px;
  font-weight: 700;
  color: #343a44;
}

.control-line input {
  width: 172px;
  accent-color: #2567d4;
}

.toggle-line input {
  width: 18px;
  height: 18px;
  accent-color: #2567d4;
}

.control-group {
  display: grid;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(28, 33, 40, 0.1);
}

.group-title {
  color: #1f2630;
  font-size: 12px;
  font-weight: 800;
}

.subgroup-title {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid rgba(28, 33, 40, 0.1);
  color: #1f2630;
  font-size: 12px;
  font-weight: 800;
}

.coordinate-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.fan-actions,
.moon-color-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.coordinate-grid label {
  display: grid;
  gap: 5px;
  color: #566270;
  font-size: 11px;
  font-weight: 800;
}

.coordinate-grid input {
  width: 100%;
  min-height: 32px;
  padding: 0 8px;
  border: 1px solid rgba(28, 33, 40, 0.16);
  border-radius: 6px;
  color: #18202b;
  background: rgba(255, 255, 255, 0.72);
}

.moon-color-grid input[type="color"] {
  min-height: 34px;
  padding: 4px;
  cursor: pointer;
}

.status-strip {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid rgba(28, 33, 40, 0.12);
  border-radius: 8px;
  color: #3d4652;
  background: rgba(246, 248, 249, 0.72);
  box-shadow: 0 20px 70px rgba(31, 37, 45, 0.16);
  backdrop-filter: blur(18px);
  font-size: 12px;
  font-weight: 700;
}

.reset-fan-button {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  color: #fff;
  background: #111827;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

body.is-night .reset-fan-button {
  color: #08111f;
  background: #b8d8ff;
}

.reset-fan-button.is-active,
body.is-night .reset-fan-button.is-active {
  color: #fff;
  background: #2567d4;
}

.creator-card {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 5;
  display: flex;
  align-items: center;
  min-height: 76px;
  padding: 9px 10px;
  border: 1px solid rgba(28, 33, 40, 0.12);
  border-radius: 8px;
  color: #17202c;
  background: rgba(246, 248, 249, 0.9);
  box-shadow: 0 20px 70px rgba(31, 37, 45, 0.16);
  backdrop-filter: blur(18px);
}

.creator-content {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 10px;
  row-gap: 6px;
  width: 232px;
}

.creator-content > img {
  grid-column: 1;
  grid-row: 1 / span 2;
  width: 54px;
  height: 54px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 8px 20px rgba(23, 32, 44, 0.12);
}

.creator-content strong {
  display: block;
  min-width: 0;
  margin: 0;
  font-size: 13px;
  grid-column: 2;
  grid-row: 1;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.creator-content a {
  grid-column: 2;
  grid-row: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 6px;
  color: #fff;
  background: #111827;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.video-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.reset-fan-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

body.is-night .creator-card,
body.is-night .hud,
body.is-night .status-strip {
  border-color: rgba(190, 215, 255, 0.32);
  color: #f5f9ff;
  background: rgba(8, 13, 26, 0.88);
  box-shadow:
    0 20px 70px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

body.is-night .creator-card {
  border-color: rgba(205, 216, 230, 0.72);
  color: #17202c;
  background: rgba(246, 248, 249, 0.92);
}

body.is-night .hud-title,
body.is-night .group-title,
body.is-night .subgroup-title,
body.is-night .control-line,
body.is-night .toggle-line,
body.is-night .coordinate-grid label,
body.is-night #fps {
  color: #f3f7ff;
}

body.is-night .top-actions {
  background: rgba(255, 255, 255, 0.12);
}

body.is-night .panel-button {
  color: #cbd8ee;
}

body.is-night .panel-button.is-active {
  color: #08111f;
  background: rgba(255, 255, 255, 0.94);
}

body.is-night .coordinate-grid input {
  border-color: rgba(205, 224, 255, 0.42);
  color: #08111f;
  background: rgba(255, 255, 255, 0.9);
}

body.is-night .control-group {
  border-top-color: rgba(205, 224, 255, 0.24);
}

body.is-night .subgroup-title {
  border-top-color: rgba(205, 224, 255, 0.24);
}

body.is-night .creator-card a {
  color: #fff;
  background: #111827;
}

body:not(.is-night) .moon-controls {
  display: none;
}

.control-line select {
  width: 172px;
  min-height: 32px;
  padding: 0 8px;
  border: 1px solid rgba(28, 33, 40, 0.16);
  border-radius: 6px;
  color: #18202b;
  background: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 800;
}

body.is-night .control-line select {
  border-color: rgba(205, 224, 255, 0.42);
  color: #08111f;
  background: rgba(255, 255, 255, 0.9);
}

#status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #50d2ad;
  box-shadow: 0 0 0 5px rgba(80, 210, 173, 0.15);
}

#html-source {
  position: fixed;
  left: -10000px;
  top: 0;
  width: 1200px;
  height: 780px;
  pointer-events: none;
  contain: layout paint;
}

.page-shell {
  position: relative;
  width: 1200px;
  height: 780px;
  overflow: hidden;
  background:
    radial-gradient(circle at 22% 72%, rgba(50, 118, 181, 0.18), transparent 26%),
    radial-gradient(circle at 84% 16%, rgba(236, 176, 109, 0.2), transparent 24%),
    linear-gradient(114deg, rgba(255, 255, 255, 0.96), rgba(236, 246, 255, 0.76) 62%, rgba(255, 255, 255, 0.9));
  color: #15181d;
}

html[lang="zh"] .page-shell,
html[lang="ja"] .page-shell {
  font-family: Inter, "PingFang SC", "Hiragino Sans", "Noto Sans CJK SC", "Yu Gothic", sans-serif;
}

.page-shell::before {
  position: absolute;
  inset: 0;
  content: "";
  opacity: 0.32;
  background-image:
    radial-gradient(circle, rgba(28, 31, 38, 0.56) 0 1px, transparent 1.4px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.5), transparent 42%, rgba(255, 255, 255, 0.55));
  background-size: 7px 7px, 100% 100%;
  mix-blend-mode: multiply;
}

.source-nav {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 86px;
  padding: 0 78px;
  font-size: 18px;
}

.source-nav strong {
  font-weight: 800;
}

.source-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.source-brand img {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: cover;
}

.source-nav nav {
  display: flex;
  gap: 30px;
  color: #585f6a;
  font-size: 13px;
  font-weight: 600;
}

.site-content {
  position: relative;
  z-index: 2;
  width: 100%;
  height: calc(100% - 86px);
}

.page-view {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: translateY(28px) scale(0.985);
  transition: none;
}

.page-view.is-visible {
  opacity: 1;
  transform: translateY(var(--texture-scroll, 0px)) scale(1);
}

.hero-grid {
  width: 780px;
  margin: 164px auto 0;
  text-align: center;
}

.eyebrow {
  margin: 0 0 22px;
  color: #3076ce;
  font-size: 16px;
  font-weight: 800;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  color: #17191e;
  font-size: 82px;
  line-height: 0.95;
  font-weight: 800;
  letter-spacing: 0;
}

html[lang="zh"] h1,
html[lang="ja"] h1 {
  line-height: 1.08;
}

.lead {
  max-width: 650px;
  margin: 30px auto 0;
  color: #3f4651;
  font-size: 24px;
  line-height: 1.35;
  font-weight: 500;
}

.page-shell button {
  min-height: 52px;
  margin-top: 44px;
  padding: 0 34px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, #2376e5, #36a9f4);
  box-shadow: 0 18px 42px rgba(35, 118, 229, 0.28);
  font-size: 17px;
  font-weight: 800;
}

.feature-band {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 44px;
  width: 880px;
  margin: 90px auto 0;
}

.feature-band h2 {
  margin: 0 0 16px;
  font-size: 24px;
}

.feature-band p {
  margin: 0;
  color: #4f5966;
  font-size: 18px;
  line-height: 1.55;
}

.guide-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  width: 960px;
  margin: 78px auto 0;
  padding: 0;
  list-style: none;
}

.guide-steps li,
.instruction-card {
  border: 1px solid rgba(20, 24, 30, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: 0 18px 42px rgba(26, 42, 66, 0.08);
}

.guide-steps li {
  display: grid;
  gap: 18px;
  min-height: 172px;
  padding: 26px;
}

.guide-steps strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: #fff;
  background: #111827;
  font-size: 24px;
}

.guide-steps span {
  color: #3f4651;
  font-size: 20px;
  line-height: 1.45;
  font-weight: 700;
}

.performance-copy {
  width: 760px;
  margin: 120px auto 0;
  text-align: center;
}

.performance-copy h1 {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 76px;
  font-style: italic;
}

html[lang="zh"] .performance-copy h1,
html[lang="ja"] .performance-copy h1 {
  font-family: Inter, "PingFang SC", "Hiragino Sans", "Yu Gothic", sans-serif;
  font-style: normal;
  font-size: 72px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  width: 920px;
  margin: 70px auto 0;
}

.metric-grid div {
  display: grid;
  gap: 10px;
  padding: 34px;
  border: 1px solid rgba(20, 24, 30, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.54);
}

.metric-grid strong {
  font-size: 44px;
}

.metric-grid span,
.link-list span {
  color: #4c5663;
  font-size: 16px;
  font-weight: 700;
}

.docs-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 470px;
  align-items: center;
  gap: 54px;
  width: 980px;
  margin: 126px auto 0;
}

.docs-grid h1 {
  font-size: 70px;
}

pre {
  margin: 0;
  padding: 34px;
  overflow: hidden;
  border-radius: 8px;
  color: #d7ecff;
  background: rgba(14, 18, 26, 0.86);
  box-shadow: 0 28px 80px rgba(26, 42, 66, 0.18);
  font-size: 18px;
  line-height: 1.5;
}

.instruction-card {
  display: grid;
  gap: 18px;
  padding: 34px;
}

.instruction-card span {
  display: block;
  padding-left: 24px;
  border-left: 4px solid #2f7de1;
  color: #394352;
  font-size: 22px;
  line-height: 1.42;
  font-weight: 800;
}

.link-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  width: 980px;
  margin: 70px auto 0;
}

.link-list span {
  display: block;
  padding: 22px;
  border: 1px solid rgba(20, 24, 30, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.56);
}

@media (max-width: 720px) {
  #scene {
    touch-action: none;
  }

  .mobile-controls-toggle {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 7;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 106px;
    min-height: 42px;
    padding: 0 14px;
    border: 1px solid rgba(28, 33, 40, 0.12);
    border-radius: 8px;
    color: #111827;
    background: rgba(246, 248, 249, 0.86);
    box-shadow: 0 12px 34px rgba(31, 37, 45, 0.18);
    backdrop-filter: blur(18px);
    font-size: 13px;
    font-weight: 800;
  }

  .mobile-controls-toggle img {
    display: none;
  }

  body.controls-collapsed .mobile-controls-toggle {
    top: 10px;
    left: 10px;
    width: auto;
    min-width: 106px;
    height: auto;
    padding: 0 14px;
  }

  body.controls-collapsed .mobile-controls-toggle img {
    display: none;
  }

  body.controls-collapsed .mobile-controls-toggle span {
    display: inline;
  }

  .mobile-upload-button {
    position: fixed;
    top: 10px;
    left: 126px;
    z-index: 7;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 136px;
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid rgba(28, 33, 40, 0.12);
    border-radius: 8px;
    color: #fff;
    background: #111827;
    box-shadow: 0 12px 34px rgba(31, 37, 45, 0.18);
    font-size: 12px;
    font-weight: 800;
  }

  body.is-night .mobile-upload-button {
    color: #08111f;
    background: #b8d8ff;
  }

  body.is-night .mobile-controls-toggle,
  body.is-night .mobile-controls-close {
    border-color: rgba(190, 215, 255, 0.3);
    color: #08111f;
    background: rgba(245, 249, 255, 0.9);
  }

  body.is-night.mobile-controls-open .top-actions {
    border-bottom-color: rgba(205, 224, 255, 0.24);
    background: rgba(8, 13, 26, 0.96);
  }

  .reset-fan-button {
    min-height: 34px;
    font-size: 11px;
  }

  body.mobile-controls-open .top-actions {
    position: sticky;
    top: 0;
    left: auto;
    z-index: 2;
    width: 100%;
    gap: 8px;
    padding: 0 0 8px;
    border-bottom: 1px solid rgba(28, 33, 40, 0.1);
    box-shadow: none;
    background: rgba(246, 248, 249, 0.92);
  }

  body.mobile-controls-open .panel-button {
    min-height: 38px;
    color: #343a44;
    background: rgba(24, 29, 36, 0.08);
  }

  body.is-night.mobile-controls-open .panel-button {
    color: #f5f9ff;
    background: rgba(255, 255, 255, 0.16);
  }

  body.mobile-controls-open .panel-button.is-active,
  body.is-night.mobile-controls-open .panel-button.is-active {
    color: #08111f;
    background: rgba(255, 255, 255, 0.94);
  }

  .hud {
    top: auto;
    right: 10px;
    bottom: calc(78px + env(safe-area-inset-bottom, 0px));
    left: 10px;
    width: auto;
    max-height: min(62vh, 520px);
    padding: 12px;
    border-radius: 10px;
    transform: translateY(calc(100% + 96px));
    opacity: 0;
    pointer-events: none;
    transition:
      transform 260ms ease,
      opacity 180ms ease;
  }

  body.mobile-controls-open .hud {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  body.controls-collapsed .hud {
    transform: translateY(calc(100% + 96px));
    opacity: 0;
    pointer-events: none;
  }

  .hud-title {
    grid-template-columns: minmax(0, 1fr) 34px auto;
  }

  .mobile-controls-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 6px;
    color: #111827;
    background: rgba(24, 29, 36, 0.08);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
  }

  .status-strip {
    right: 10px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    min-height: 34px;
    max-width: calc(100vw - 150px);
    padding: 0 11px;
    font-size: 11px;
  }

  .creator-card {
    top: 10px;
    right: 10px;
    left: auto;
    bottom: auto;
    max-width: min(188px, calc(100vw - 274px));
    min-height: 44px;
    padding: 6px;
  }

  .creator-content {
    grid-template-columns: 34px minmax(0, 1fr);
    width: min(174px, calc(100vw - 286px));
    row-gap: 4px;
  }

  .creator-content > img {
    grid-row: 1 / span 2;
    width: 34px;
    height: 34px;
  }

  .creator-content strong {
    font-size: 10px;
  }

  .creator-content a {
    min-height: 24px;
    padding: 0 7px;
    font-size: 9px;
  }

  .control-line input {
    width: min(45vw, 172px);
  }

  .control-line select {
    width: min(45vw, 172px);
  }

  .top-actions {
    min-height: 34px;
  }

  .panel-button {
    min-height: 34px;
  }
}

@media (max-width: 430px) {
  .creator-content strong {
    font-size: 9px;
  }

  .creator-card {
    top: 62px;
    max-width: min(180px, calc(100vw - 20px));
  }

  .creator-content a {
    width: 100%;
    padding: 0 6px;
    font-size: 8.5px;
  }

  .creator-content > img {
    width: 30px;
    height: 30px;
  }

  .creator-content {
    width: min(168px, calc(100vw - 34px));
  }
}
