:root {
  --truth-font-desktop: 11px;
  --truth-font-mobile: 10px;
  color-scheme: dark;
  font-family:
    Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", system-ui,
    sans-serif;
  color: #edf6f6;
  background: #061015;
  font-synthesis: none;
  --accent: #7bd4de;
  --accent-strong: #b8f3f5;
  --text: #edf6f6;
  --muted: #8da5aa;
  --quiet: #6c858b;
  --line: rgb(139 197 205 / 18%);
  --surface: rgb(5 17 22 / 88%);
  --surface-soft: rgb(10 27 33 / 72%);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 53% 38%, #18343c 0, transparent 46%),
    linear-gradient(145deg, #061015, #09171c 58%, #040b0f);
}

body,
#app {
  max-width: 100%;
  overflow-x: hidden;
}

button {
  border: 0;
  color: inherit;
  font: inherit;
}

button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 520px;
  isolation: isolate;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgb(2 9 12 / 46%), transparent 29%),
    linear-gradient(0deg, rgb(2 9 12 / 34%), transparent 34%);
}

#stage,
.static-fallback {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

#stage {
  z-index: 1;
  touch-action: none;
}

.static-fallback {
  z-index: 2;
  object-fit: cover;
  object-position: center;
  background:
    radial-gradient(circle at center, #1d3941, transparent 48%),
    #061015;
  filter: saturate(0.84) brightness(0.74);
  opacity: 1;
  transition:
    opacity 420ms ease,
    visibility 420ms ease;
}

[data-ready="true"] .static-fallback,
.static-fallback[hidden] {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

[data-fallback="true"] #stage {
  pointer-events: none;
}

[data-fallback="true"] .process-summary,
[data-fallback="true"] .process-rail-shell,
[data-fallback="true"] .specification-panel {
  display: none;
}

.process-topline,
.process-summary,
.process-rail-shell,
.specification-panel,
.truth-strip {
  position: absolute;
  z-index: 5;
}

.process-topline {
  top: 20px;
  right: clamp(18px, 2.5vw, 40px);
  left: clamp(18px, 2.5vw, 40px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  pointer-events: none;
  text-shadow: 0 2px 16px rgb(0 0 0 / 58%);
}

.process-topline strong {
  color: #dcebed;
  font-size: 13px;
  font-weight: 620;
  letter-spacing: 0.08em;
}

.process-topline span {
  color: #789298;
  font-size: 10px;
  letter-spacing: 0.08em;
}

.process-summary {
  top: 92px;
  left: clamp(18px, 3vw, 48px);
  width: min(calc(100% - 36px), 360px);
  max-width: 360px;
  padding: 8px 30px 10px 16px;
  border-left: 2px solid rgb(123 212 222 / 64%);
  background: linear-gradient(90deg, rgb(2 11 15 / 68%), transparent 92%);
  pointer-events: none;
  text-shadow: 0 2px 18px rgb(0 0 0 / 54%);
}

.process-summary small {
  display: block;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.17em;
}

.process-summary h1 {
  margin: 9px 0 7px;
  color: var(--text);
  font-size: clamp(27px, 2.4vw, 38px);
  font-weight: 620;
  letter-spacing: -0.035em;
  line-height: 1.08;
}

.process-summary p {
  margin: 0;
  color: #a1b4b8;
  font-size: 12px;
  line-height: 1.65;
}

.enter-selection-button {
  min-height: 44px;
  margin-top: 16px;
  padding: 10px 14px;
  cursor: pointer;
  border: 1px solid rgb(123 212 222 / 54%);
  border-radius: 9px;
  color: #efffff;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.03em;
  background:
    linear-gradient(135deg, rgb(62 145 157 / 52%), rgb(20 69 78 / 72%)),
    var(--surface);
  box-shadow: 0 12px 28px rgb(0 0 0 / 22%);
  pointer-events: auto;
  transition:
    border-color 180ms ease,
    background 180ms ease,
    transform 180ms ease;
}

.enter-selection-button:hover {
  border-color: var(--accent);
  background:
    linear-gradient(135deg, rgb(75 168 181 / 68%), rgb(25 84 94 / 82%)),
    var(--surface);
  transform: translateY(-1px);
}

.enter-selection-button[hidden],
.specification-panel[hidden] {
  display: none;
}

.specification-panel {
  top: 80px;
  right: clamp(18px, 2.5vw, 40px);
  display: none;
  width: min(390px, calc(100% - 36px));
  max-height: calc(100% - 120px);
  gap: 16px;
  overflow-y: auto;
  padding: 18px;
  border: 1px solid rgb(139 197 205 / 24%);
  border-radius: 15px;
  background:
    linear-gradient(145deg, rgb(21 49 57 / 48%), transparent 44%),
    rgb(5 17 22 / 94%);
  box-shadow: 0 24px 64px rgb(0 0 0 / 36%);
  backdrop-filter: blur(18px);
}

[data-experience-mode="selection"] .specification-panel {
  display: grid;
}

.specification-header {
  display: grid;
  gap: 10px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.specification-header small {
  color: var(--accent);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.specification-header h2 {
  margin: 5px 0 0;
  color: var(--text);
  font-size: 22px;
  font-weight: 620;
  letter-spacing: -0.02em;
}

#currentSpecification {
  margin: 0;
  color: #dffbfc;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: 0.035em;
}

.specification-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 12px;
}

.specification-groups fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.specification-groups fieldset:first-child,
.specification-groups fieldset:last-child {
  grid-column: 1 / -1;
}

.specification-groups legend {
  margin-bottom: 7px;
  color: #8da5aa;
  font-size: 10px;
}

.specification-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.specification-button {
  min-width: 48px;
  min-height: 42px;
  padding: 8px 10px;
  cursor: pointer;
  border: 1px solid rgb(136 185 192 / 20%);
  border-radius: 8px;
  color: #9db3b6;
  font-size: 11px;
  background: rgb(18 39 46 / 76%);
  transition:
    border-color 160ms ease,
    color 160ms ease,
    background 160ms ease;
}

.specification-button:hover,
.specification-button[aria-pressed="true"] {
  border-color: rgb(121 209 220 / 62%);
  color: #efffff;
  background: rgb(26 79 88 / 76%);
}

.selection-qualification {
  margin: 0;
  color: #789398;
  font-size: 10px;
  line-height: 1.6;
}

.selection-actions {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 8px;
}

.selection-actions button,
.selection-actions a {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  padding: 9px 12px;
  cursor: pointer;
  border: 1px solid rgb(123 212 222 / 28%);
  border-radius: 9px;
  color: #bfd4d7;
  font-size: 11px;
  font-weight: 620;
  text-align: center;
  text-decoration: none;
  background: rgb(16 38 45 / 84%);
}

.selection-actions a {
  border-color: rgb(123 212 222 / 58%);
  color: #efffff;
  background: rgb(29 91 101 / 82%);
}

.selection-actions button:hover,
.selection-actions a:hover {
  border-color: var(--accent);
  color: #fff;
}

.process-rail-shell {
  right: clamp(18px, 2.5vw, 40px);
  bottom: 40px;
  left: clamp(18px, 2.5vw, 40px);
  display: flex;
  align-items: stretch;
  gap: 12px;
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgb(19 42 49 / 34%), transparent),
    var(--surface);
  box-shadow: 0 20px 54px rgb(0 0 0 / 28%);
  backdrop-filter: blur(16px);
}

.stage-rail {
  display: grid;
  min-width: 0;
  flex: 1;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
}

.stage-button {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 50px;
  align-items: center;
  padding: 9px 10px 8px;
  cursor: pointer;
  border-radius: 8px;
  text-align: left;
  background: transparent;
  transition:
    color 180ms ease,
    background 180ms ease;
}

.stage-button::before {
  position: absolute;
  top: 0;
  right: 10px;
  left: 10px;
  height: 1px;
  background: transparent;
  content: "";
}

.stage-button strong {
  overflow: hidden;
  color: #92a7ac;
  font-size: 11px;
  font-weight: 560;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage-button span {
  display: none;
}

.stage-button:hover {
  background: rgb(30 58 65 / 42%);
}

.stage-button[aria-pressed="true"] {
  background: rgb(25 66 74 / 54%);
}

.stage-button[aria-pressed="true"]::before {
  background: var(--accent);
  box-shadow: 0 0 14px rgb(123 212 222 / 42%);
}

.stage-button[aria-pressed="true"] strong {
  color: #ecffff;
}

.process-actions {
  display: grid;
  flex: none;
  grid-template-columns: repeat(4, auto);
  gap: 5px;
}

.process-actions button {
  min-width: 58px;
  min-height: 50px;
  padding: 0 11px;
  cursor: pointer;
  border: 1px solid rgb(139 197 205 / 13%);
  border-radius: 8px;
  color: #a6b9bc;
  background: rgb(17 36 42 / 72%);
  font-size: 10px;
  font-weight: 570;
  letter-spacing: 0.03em;
  transition:
    border-color 180ms ease,
    color 180ms ease,
    background 180ms ease;
}

.process-actions button:hover {
  border-color: rgb(123 212 222 / 42%);
  color: #ecffff;
  background: rgb(25 58 65 / 82%);
}

.process-actions #autoTourButton {
  border-color: rgb(123 212 222 / 30%);
  color: #d9f6f7;
}

.process-actions button:disabled {
  cursor: default;
  opacity: 0.58;
}

.truth-strip {
  right: clamp(18px, 2.5vw, 40px);
  bottom: 11px;
  left: clamp(18px, 2.5vw, 40px);
  overflow: hidden;
  color: #6f888e;
  font-size: var(--truth-font-desktop);
  line-height: 1.35;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}

.poster-mode .process-topline,
.poster-mode .process-summary,
.poster-mode .process-rail-shell,
.poster-mode .specification-panel,
.poster-mode .truth-strip,
.static-mode .process-summary,
.static-mode .process-rail-shell,
.static-mode .specification-panel {
  display: none;
}

.poster-mode #app {
  width: 100vw;
  height: 100vh;
  min-height: 0;
  background: #061015;
}

.static-mode #stage {
  display: none;
}

.static-mode .static-fallback {
  filter: none;
}

.reduced-motion *,
.reduced-motion *::before,
.reduced-motion *::after {
  scroll-behavior: auto !important;
  transition-duration: 0.01ms !important;
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
}

@media (max-width: 920px) {
  .process-rail-shell {
    flex-direction: column;
  }

  .process-actions {
    align-self: flex-end;
  }

  .stage-button,
  .process-actions button {
    min-height: 44px;
  }
}

@media (max-width: 640px) {
  #app {
    min-height: 0;
    background:
      linear-gradient(180deg, rgb(2 9 12 / 54%), transparent 28%),
      linear-gradient(0deg, rgb(2 9 12 / 64%), transparent 42%);
  }

  .process-topline {
    top: 14px;
    right: 14px;
    left: 14px;
  }

  .process-topline strong {
    font-size: 11px;
  }

  .process-topline span {
    max-width: 48%;
    overflow: hidden;
    font-size: 8px;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .process-summary {
    top: 58px;
    left: 14px;
    width: calc(100% - 28px);
    max-width: calc(100% - 28px);
    padding: 6px 20px 7px 12px;
  }

  .process-summary small {
    font-size: 8px;
  }

  .process-summary h1 {
    margin: 6px 0 4px;
    font-size: clamp(23px, 7.4vw, 30px);
  }

  .process-summary p {
    max-width: 320px;
    font-size: 10px;
    line-height: 1.45;
  }

  .enter-selection-button {
    min-height: 42px;
    margin-top: 11px;
    font-size: 10px;
  }

  [data-experience-mode="selection"] .process-summary {
    max-width: calc(100% - 28px);
  }

  [data-experience-mode="selection"] .process-summary h1 {
    font-size: 24px;
  }

  .specification-panel {
    top: auto;
    right: 10px;
    bottom: 10px;
    left: 10px;
    width: auto;
    max-height: 48vh;
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
  }

  .specification-header {
    grid-template-columns: 1fr auto;
    align-items: end;
    gap: 8px;
    padding-bottom: 10px;
  }

  .specification-header h2 {
    font-size: 17px;
  }

  #currentSpecification {
    font-size: 12px;
    text-align: right;
  }

  .specification-groups {
    gap: 12px 8px;
  }

  .specification-options {
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
  }

  .specification-button {
    flex: 0 0 auto;
    min-height: 40px;
  }

  .selection-actions button,
  .selection-actions a {
    min-height: 44px;
    font-size: 10px;
  }

  .process-rail-shell {
    right: 10px;
    bottom: 36px;
    left: 10px;
    gap: 7px;
    padding: 7px;
    border-radius: 10px;
  }

  .stage-rail {
    display: grid;
    grid-auto-columns: minmax(124px, 42vw);
    grid-auto-flow: column;
    grid-template-columns: none;
    gap: 4px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    scroll-snap-type: x proximity;
  }

  .stage-button {
    min-height: 44px;
    scroll-snap-align: start;
  }

  .process-actions {
    width: 100%;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .process-actions button {
    min-width: 0;
    min-height: 44px;
    padding-inline: 5px;
    font-size: 9px;
  }

  .truth-strip {
    right: 12px;
    bottom: 10px;
    left: 12px;
    font-size: var(--truth-font-mobile);
  }
}

@media (min-width: 641px) and (max-height: 620px) {
  .process-topline {
    top: 13px;
  }

  .process-summary {
    top: 54px;
  }

  .process-summary h1 {
    margin-block: 5px 4px;
    font-size: 25px;
  }

  .process-rail-shell {
    bottom: 33px;
    padding: 6px;
  }

  .stage-button,
  .process-actions button {
    min-height: 44px;
  }

  .truth-strip {
    bottom: 8px;
  }
}

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