: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;
  --showroom: #090d10;
  --panel: rgb(21 26 31 / 88%);
  --panel-soft: rgb(14 19 23 / 72%);
  --line: rgb(170 194 205 / 22%);
  --ink: #f1f3f4;
  --muted: #aab2b9;
  --accent: #83d8ff;
  --coolant: #1679bd;
  --amber: #9b640f;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--showroom);
}

button {
  color: inherit;
  font: 600 12px/1.2 Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  cursor: pointer;
}

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

#app {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 53% 39%, rgb(91 108 118 / 14%), transparent 36%),
    linear-gradient(180deg, #10161a, var(--showroom) 72%);
}

#app::before {
  position: absolute;
  z-index: 0;
  inset: 0;
  background:
    linear-gradient(90deg, transparent 49.94%, rgb(173 190 199 / 5%) 50%, transparent 50.06%),
    linear-gradient(180deg, transparent 65%, rgb(255 255 255 / 3%) 65.1%, transparent 65.25%);
  content: "";
  pointer-events: none;
}

#stage,
.poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

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

.poster {
  z-index: 2;
  object-fit: cover;
  opacity: 1;
  background: var(--showroom);
  filter: saturate(.92) contrast(1.05) brightness(.74);
  transition: opacity 420ms ease;
}

.poster.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.intro,
.mode-panel,
.process-status,
.focus-panel,
.step-rail,
.actions,
.truth-bar {
  position: absolute;
  z-index: 10;
}

.intro {
  top: 30px;
  left: 32px;
  max-width: min(540px, 48vw);
}

.intro h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(26px, 2.35vw, 38px);
  font-weight: 720;
  letter-spacing: -.045em;
  line-height: 1.08;
  text-shadow: 0 8px 28px rgb(0 0 0 / 38%);
}

.intro p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .035em;
}

.mode-panel,
.process-status,
.focus-panel,
.step-rail {
  border: 1px solid var(--line);
  background: var(--panel-soft);
  box-shadow: 0 18px 54px rgb(0 0 0 / 28%);
  backdrop-filter: blur(16px);
}

.mode-panel {
  top: 116px;
  left: 32px;
  width: min(360px, 29vw);
  padding: 7px;
  border-radius: 12px;
}

.mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.mode-tabs button,
.focus-controls button,
.step-rail button,
.actions button {
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgb(255 255 255 / 4%);
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease;
}

.mode-tabs button {
  min-height: 42px;
  color: #8f999f;
  font-size: 14px;
  font-weight: 650;
}

button[aria-pressed="true"] {
  border-color: rgb(131 216 255 / 58%);
  color: var(--ink);
  background: linear-gradient(180deg, rgb(88 116 132 / 60%), rgb(38 53 62 / 56%));
  box-shadow: inset 0 -2px 0 rgb(131 216 255 / 58%);
}

.step-copy {
  padding: 13px 11px 9px;
}

.step-copy > p:first-child {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .16em;
}

.step-copy h2 {
  margin: 0 0 7px;
  color: var(--ink);
  font-size: 19px;
}

.step-copy > p:nth-of-type(2) {
  min-height: 38px;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
}

.progress {
  height: 2px;
  margin-top: 11px;
  overflow: hidden;
  background: rgb(206 230 239 / 13%);
}

.progress i {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #b5e4ee);
  transform: scaleX(0);
  transform-origin: left;
}

.process-status {
  top: 56px;
  right: 32px;
  width: min(280px, 23vw);
  padding: 17px;
  border-radius: 14px;
}

.process-status > p,
.focus-panel > p {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
}

.process-status > p {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.process-status > p i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #5bd48c;
  box-shadow: 0 0 13px rgb(91 212 140 / 75%);
}

.process-status dl {
  display: grid;
  gap: 0;
  margin: 0;
}

.process-status dl div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-top: 1px solid rgb(170 194 205 / 12%);
}

.process-status dt {
  color: #858f95;
  font-size: 10px;
}

.process-status dd {
  margin: 0;
  color: #d7dde0;
  font-size: 10px;
  text-align: right;
}

.focus-panel {
  top: 295px;
  right: 32px;
  width: min(280px, 23vw);
  padding: 14px;
  border-radius: 13px;
}

.focus-controls {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
}

.focus-controls button {
  min-height: 31px;
  padding: 4px 5px;
  color: #9fa8ad;
  font-size: 10px;
  font-weight: 560;
}

.step-rail {
  right: 350px;
  bottom: 62px;
  left: 32px;
  display: flex;
  gap: 6px;
  padding: 8px;
  overflow-x: auto;
  border-radius: 12px;
  scrollbar-width: none;
}

.step-rail::-webkit-scrollbar { display: none; }

.step-rail button {
  display: grid;
  min-width: 96px;
  min-height: 54px;
  padding: 7px 10px;
  color: #8f999f;
  text-align: left;
}

.step-rail b {
  color: var(--accent);
  font-size: 9px;
  letter-spacing: .12em;
}

.step-rail span {
  margin-top: 4px;
  font-size: 10px;
  white-space: nowrap;
}

.actions {
  right: 32px;
  bottom: 62px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 300px;
}

.actions button {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-color: var(--line);
  color: #d9dfe2;
  font-size: 11px;
  background: var(--panel);
  backdrop-filter: blur(14px);
}

.actions svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
}

.actions button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.truth-bar {
  right: 32px;
  bottom: 17px;
  left: 32px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  color: #929da3;
  font-size: 9px;
  line-height: 1.45;
}

.fallback {
  position: absolute;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgb(5 9 12 / 58%);
}

#fallback[hidden] { display: none; }

.fallback-card {
  width: min(560px, 92vw);
  padding: 30px;
  border: 1px solid rgb(170 194 205 / 27%);
  border-radius: 16px;
  background: rgb(15 21 25 / 94%);
  box-shadow: 0 28px 74px rgb(0 0 0 / 42%);
}

.fallback-card h1 {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 28px;
}

.fallback-card p,
.fallback-card li {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.75;
}

.fallback-card ol { padding-left: 20px; }
.truth-note { color: #dbe2e5 !important; }

.poster-mode .intro,
.poster-mode .mode-panel,
.poster-mode .process-status,
.poster-mode .focus-panel,
.poster-mode .step-rail,
.poster-mode .actions,
.poster-mode .truth-bar,
.poster-mode #stage,
.poster-mode .fallback { display: none; }

.static-mode #stage { display: none; }
.static-mode .poster { opacity: 1; }
.static-mode .fallback { place-items: center start; background: linear-gradient(90deg, rgb(5 9 12 / 88%), transparent 82%); }

.static-mode .intro,
.static-mode .mode-panel,
.static-mode .process-status,
.static-mode .focus-panel,
.static-mode .step-rail,
.static-mode .actions,
.static-mode .truth-bar,
#app[data-fallback="true"] .intro,
#app[data-fallback="true"] .mode-panel,
#app[data-fallback="true"] .process-status,
#app[data-fallback="true"] .focus-panel,
#app[data-fallback="true"] .step-rail,
#app[data-fallback="true"] .actions,
#app[data-fallback="true"] .truth-bar { display: none; }

.embed-mode .intro { display: none; }
.embed-mode .mode-panel { top: 20px; }
.embed-mode .process-status { top: 20px; }

.bottom-ui { display: contents; }

@media (max-width: 640px) {
  #app { min-height: 0; }
  .intro { top: 18px; right: 12px; left: 12px; max-width: none; text-align: center; }
  .intro h1 { font-size: clamp(19px, 5.7vw, 24px); letter-spacing: -.03em; }
  .intro p { margin-top: 7px; font-size: 9px; }
  .mode-panel { top: 78px; right: 12px; left: 12px; width: auto; padding: 5px; }
  .mode-tabs button { min-height: 34px; font-size: 12px; }
  .step-copy { display: none; }
  .process-status { top: auto; right: auto; bottom: 170px; left: 12px; width: 178px; padding: 11px 12px; }
  .process-status > p { margin-bottom: 6px; font-size: 9px; }
  .process-status dl div { padding: 5px 0; }
  .process-status dl div:nth-child(2),
  .process-status dl div:nth-child(4) { display: none; }
  .process-status dt,
  .process-status dd { font-size: 8px; }
  .focus-panel { display: none; }
  .step-rail { right: 12px; bottom: 64px; left: 12px; padding: 5px; border-radius: 10px; }
  .step-rail button { min-width: 82px; min-height: 44px; padding: 6px 8px; }
  .step-rail span { font-size: 9px; }
  .actions { right: 12px; bottom: 12px; left: 12px; gap: 6px; width: auto; }
  .actions button { min-height: 42px; font-size: 10px; }
  .actions svg { width: 16px; height: 16px; }
  .truth-bar { display: none; }
  .fallback-card { padding: 22px; }
  .fallback-card h1 { font-size: 23px; }
  .embed-mode .mode-panel { top: 12px; }
  .embed-mode .process-status { bottom: 170px; }
}

@media (max-height: 620px) and (min-width: 641px) {
  .intro { top: 18px; }
  .mode-panel { top: 86px; transform: scale(.9); transform-origin: top left; }
  .process-status { top: 20px; transform: scale(.88); transform-origin: top right; }
  .focus-panel { display: none; }
  .step-rail { bottom: 53px; }
  .actions { bottom: 53px; }
  .truth-bar { bottom: 10px; }
}

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

.truth-bar,
.truth-note {
  font-size: var(--truth-font-desktop);
}

@media (max-width: 640px) {
  .truth-bar,
  .truth-note {
    font-size: var(--truth-font-mobile);
  }

  .truth-bar {
    right: 10px;
    bottom: 4px;
    left: 10px;
    display: block;
    padding: 3px 7px;
    background: rgba(8, 16, 20, 0.86);
    line-height: 1.25;
    text-align: center;
  }

  .truth-bar span {
    display: block;
  }

  .actions {
    bottom: 42px;
  }

  .step-rail {
    bottom: 92px;
  }

  .mode-panel { top: 104px; }

  .bottom-ui {
    position: absolute;
    z-index: 10;
    right: 12px;
    bottom: max(10px, env(safe-area-inset-bottom));
    left: 12px;
    display: grid;
    gap: 8px;
    pointer-events: none;
  }

  .bottom-ui > .process-status,
  .bottom-ui > .step-rail,
  .bottom-ui > .actions,
  .bottom-ui > .truth-bar {
    position: static;
    width: auto;
    margin: 0;
    transform: none;
  }

  .bottom-ui > .process-status {
    width: 178px;
  }

  .bottom-ui > .step-rail,
  .bottom-ui button {
    pointer-events: auto;
  }

  .bottom-ui .actions button {
    min-height: 44px;
  }

  .bottom-ui > .truth-bar {
    line-height: 1.4;
  }
}

@media (max-width: 640px) and (max-height: 500px) {
  .process-status { display: none; }
}

@media (min-width: 641px) and (max-height: 500px) {
  .intro p { display: none; }
  #stepDescription { display: none; }
}
