: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;
  --ink: #eff8f7;
  --muted: #a6b8bb;
  --line: rgb(170 218 218 / 16%);
  --panel: rgb(7 20 25 / 78%);
  --accent: #78cbd3;
  --warm: #d7aa6d;
}

* { box-sizing: border-box; }

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

button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible { outline: 2px solid #91e0e7; outline-offset: 3px; }

#app {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 52% 23%, rgb(235 255 250 / 30%), transparent 28%),
    linear-gradient(145deg, #406269, #182a30 61%, #0b171c);
}

#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; filter: saturate(0.9) contrast(1.06) brightness(0.68); transition: opacity 420ms ease; }
.poster.is-hidden { opacity: 0; pointer-events: none; }

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

.topbar {
  top: 0; left: 0; right: 0; height: 74px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 30px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, rgb(5 17 21 / 80%), transparent);
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark { display: grid; width: 36px; height: 36px; place-items: center; border: 1px solid rgb(167 231 232 / 45%); border-radius: 10px; background: #20414a; font-weight: 800; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 13px; letter-spacing: .15em; }
.brand small { margin-top: 3px; color: #90a8ad; font-size: 8px; letter-spacing: .18em; }
.demo-status { display: flex; align-items: center; gap: 8px; color: #a0bcc0; font-size: 9px; letter-spacing: .18em; }
.demo-status i { width: 7px; height: 7px; border-radius: 50%; background: #69c5a3; box-shadow: 0 0 11px #69c5a3; }

.intro,
.mode-panel,
.process-status,
.focus-panel { border: 1px solid var(--line); background: var(--panel); box-shadow: 0 20px 52px rgb(0 0 0 / 24%); backdrop-filter: blur(14px); }
.intro { top: 102px; left: 30px; width: min(320px, 25vw); padding: 20px; border-radius: 16px; }
.intro h1 { margin: 0; font-size: clamp(26px, 2.25vw, 37px); line-height: 1.08; letter-spacing: -.045em; }
.intro > p { margin: 11px 0 16px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.confirmed-specs { display: grid; grid-template-columns: 1fr; gap: 6px; }
.confirmed-specs span { padding: 8px 9px; border: 1px solid rgb(168 218 218 / 12%); border-radius: 8px; color: #9eb3b6; background: rgb(2 13 16 / 32%); font-size: 10px; }
.confirmed-specs strong { display: inline-block; min-width: 100px; color: #e5f3f0; font-size: 11px; }

.mode-panel { top: 102px; right: 30px; width: min(310px, 24vw); padding: 17px; border-radius: 15px; }
.mode-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 4px; border-radius: 9px; background: rgb(0 9 12 / 38%); }
.mode-tabs button,
.focus-controls button,
.actions button,
.step-rail button { border: 1px solid transparent; border-radius: 8px; background: rgb(255 255 255 / 4%); transition: background .18s ease, border-color .18s ease, color .18s ease; }
.mode-tabs button { min-height: 36px; color: #9ab0b4; font-size: 11px; }
button[aria-pressed="true"] { border-color: rgb(113 208 216 / 45%); color: #f1faf9; background: linear-gradient(145deg, rgb(65 149 157 / 35%), rgb(20 62 69 / 32%)); }
.mode-panel > p { margin: 16px 0 5px; color: var(--accent); font-size: 9px; font-weight: 700; letter-spacing: .18em; }
.mode-panel h2 { margin: 0 0 7px; font-size: 20px; }
.mode-panel > p:last-of-type { margin: 0; color: var(--muted); font-size: 12px; font-weight: 400; line-height: 1.6; letter-spacing: 0; }
.progress { height: 2px; margin-top: 15px; overflow: hidden; background: rgb(200 240 240 / 14%); }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, #6bb9c5, #d6b070); transform: scaleX(0); transform-origin: left; }

.process-status { top: 340px; right: 30px; width: min(310px, 24vw); padding: 15px 17px; border-radius: 14px; }
.process-status > p, .focus-panel > p { margin: 0 0 10px; color: #87c9d2; font-size: 9px; font-weight: 700; letter-spacing: .18em; }
.process-status dl { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; }
.process-status dl div { padding: 7px 0; border-top: 1px solid rgb(174 220 220 / 10%); }
.process-status dt { color: #839ba0; font-size: 9px; }
.process-status dd { margin: 3px 0 0; color: #e4f0ef; font-size: 11px; }
.process-status .optional-signal { padding: 4px 0; }
.process-status .optional-signal dd { color: var(--muted); }

.focus-panel { bottom: 110px; left: 30px; width: min(320px, 25vw); padding: 15px; border-radius: 14px; }
.focus-controls { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.focus-controls button { min-height: 32px; padding: 4px 3px; color: #a5babd; font-size: 10px; }

.step-rail { right: 30px; bottom: 110px; left: 372px; display: flex; gap: 6px; padding: 8px; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: rgb(5 18 22 / 80%); box-shadow: 0 16px 44px rgb(0 0 0 / 18%); backdrop-filter: blur(13px); scrollbar-width: none; }
.step-rail::-webkit-scrollbar { display: none; }
.step-rail button { display: grid; min-width: 96px; min-height: 48px; padding: 7px 9px; text-align: left; color: #91a9ad; }
.step-rail b { color: #7ec8d1; font-size: 9px; letter-spacing: .12em; }
.step-rail span { margin-top: 3px; font-size: 10px; white-space: nowrap; }

.actions { right: 30px; bottom: 54px; display: flex; gap: 7px; }
.actions button { min-height: 36px; padding: 0 13px; border-color: var(--line); color: #d4e6e5; font-size: 11px; background: rgb(5 18 21 / 74%); }
.actions button:disabled { cursor: not-allowed; opacity: .45; }
.truth-bar { right: 30px; bottom: 16px; left: 30px; display: flex; justify-content: space-between; gap: 16px; color: #acc2c5; font-size: 9px; line-height: 1.4; }

@media (min-width: 641px) {
  html:lang(en) .intro { padding: 16px; }
  html:lang(en) .intro h1 { font-size: 24px; }
  html:lang(en) .confirmed-specs strong { margin-right: 6px; }
}

.fallback { position: absolute; z-index: 20; inset: 0; display: grid; place-items: center; padding: 24px; background: rgb(4 13 16 / 45%); }
#fallback[hidden] { display: none; }
.fallback-card { width: min(510px, 92vw); padding: 30px; border: 1px solid rgb(170 222 220 / 25%); border-radius: 18px; background: rgb(8 25 30 / 92%); box-shadow: 0 28px 70px rgb(0 0 0 / 35%); }
.fallback-card h1 { margin: 6px 0 10px; font-size: 30px; }
.fallback-card p, .fallback-card li { color: #b5c7c8; font-size: 13px; line-height: 1.7; }
.fallback-kicker { color: #84ccd4 !important; font-size: 9px !important; font-weight: 700; letter-spacing: .17em; }
.fallback-card dl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin: 18px 0; }
.fallback-card dl div { padding: 10px; border: 1px solid var(--line); border-radius: 9px; }
.fallback-card dt { color: #95abb0; font-size: 9px; }
.fallback-card dd { margin: 4px 0 0; color: #eef8f6; font-size: 12px; }
.truth-note { color: #d6e7e5 !important; }

.embed-mode .topbar, .embed-mode .intro { display: none; }
.embed-mode .mode-panel { top: 22px; }
.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 .topbar { display: none; }
.poster-mode #stage { display: none; }
.poster-mode .fallback { display: none; }
.static-mode #stage { display: none; }
.static-mode .poster { opacity: 1; }
.static-mode .fallback { background: linear-gradient(90deg, rgb(4 12 15 / 84%), transparent); place-items: center start; }
.static-mode .topbar,
.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"] .topbar,
#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; }

@media (max-width: 640px) {
  #app { min-height: 0; }
  .topbar { height: 58px; padding: 0 14px; }
  .brand-mark { width: 30px; height: 30px; }
  .demo-status { font-size: 7px; letter-spacing: .12em; }
  .intro { display: none; }
  .mode-panel { top: 68px; right: 12px; left: 12px; width: auto; padding: 10px 13px; }
  .mode-tabs button { min-height: 32px; }
  .mode-panel > p { margin: 9px 0 3px; }
  .mode-panel h2 { margin-bottom: 4px; font-size: 17px; }
  .mode-panel > p:last-of-type { display: block; font-size: 11px; line-height: 1.5; }
  .mode-panel .progress { margin-top: 8px; }
  .focus-panel { display: none; }
  .process-status { top: auto; right: 12px; bottom: 151px; left: 12px; width: auto; padding: 7px 12px; border-radius: 10px; }
  .process-status > p { margin-bottom: 4px; font-size: 8px; letter-spacing: .05em; }
  .process-status dl { gap: 3px 12px; }
  .process-status dl div { padding: 3px 0; }
  .process-status dd { font-size: 10px; }
  .process-status .optional-signal { display: none; }
  .step-rail { right: 12px; bottom: 91px; left: 12px; padding: 6px; border-radius: 10px; }
  .step-rail button { min-width: 88px; min-height: 42px; }
  .actions { right: 12px; bottom: 49px; left: 12px; justify-content: space-between; }
  .actions button { min-height: 33px; padding: 0 8px; font-size: 10px; }
  .truth-bar { right: 12px; bottom: 9px; left: 12px; display: block; font-size: 8px; }
  .truth-bar span { display: block; }
  .fallback-card { padding: 22px; }
  .fallback-card dl { grid-template-columns: 1fr; }
  .embed-mode .mode-panel { top: 12px; }
}

@media (max-width: 640px) and (max-height: 640px) {
  .topbar { display: none; }
  .mode-panel { top: 10px; }
  .process-status { bottom: 139px; }
  .process-status dl div:nth-child(n+3) { display: none; }
  .process-status > p { display: none; }
  .truth-bar { font-size: 8px; }
}

/* Reserve the extra footer lines without reducing English disclaimer text. */
@media (max-width: 640px) {
  html:lang(en) .actions { bottom: 69px; }
  html:lang(en) .step-rail { bottom: 111px; }
  html:lang(en) .process-status { bottom: 171px; }
}

@media (max-width: 640px) and (max-height: 640px) {
  html:lang(en) .process-status { bottom: 159px; }
}

@media (max-height: 620px) and (min-width: 641px) {
  .intro { top: 82px; transform: scale(.88); transform-origin: top left; }
  .mode-panel { top: 84px; transform: scale(.9); transform-origin: top right; }
  .process-status { top: 290px; transform: scale(.86); transform-origin: top right; }
  .focus-panel { display: none; }
}

@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 {
    line-height: 1.25;
  }
}

/* Product-page embeds are wide but shallow; keep status above the controls. */
@media (min-width: 641px) and (max-height: 620px) {
  .embed-mode .mode-panel { top: 12px; right: 12px; width: min(280px, 42vw); padding: 10px 13px; transform: none; }
  .embed-mode .mode-panel > p { margin: 8px 0 3px; }
  .embed-mode .mode-panel h2 { font-size: 17px; }
  .embed-mode .mode-panel > p:last-of-type { margin: 0; font-size: 10px; line-height: 1.5; }
  .embed-mode .mode-panel .progress { margin-top: 8px; }
  .embed-mode .process-status { top: auto; right: auto; bottom: 160px; left: 12px; width: 220px; padding: 7px 10px; transform: none; }
  .embed-mode .process-status > p { margin-bottom: 4px; font-size: 8px; letter-spacing: .05em; }
  .embed-mode .process-status dl div { padding: 3px 0; }
  .embed-mode .process-status dl div:nth-child(n+3) { display: none; }
  .embed-mode .process-status dd { font-size: 10px; }
  .embed-mode .step-rail { right: 12px; bottom: 88px; left: 12px; padding: 6px; }
  .embed-mode .step-rail button { min-width: 88px; min-height: 42px; }
  .embed-mode .actions { right: 12px; bottom: 47px; }
  .embed-mode .actions button { min-height: 33px; padding: 0 10px; font-size: 10px; }
  .embed-mode .truth-bar { right: 12px; bottom: 9px; left: 12px; font-size: 10px; }
}
