/* G SYNDICATE — shared UI chrome. Signal red on near-black studio ground. */
:root {
  --bg: #0c0c0d;
  --panel: rgba(12, 12, 13, 0.86);
  --ink: #f2f0ec;
  --dim: #8b8b8b;
  --faint: #555555;
  --line: rgba(242, 240, 236, 0.16);
  --red: #ff1a16;
  --sans: 'Helvetica Neue', Helvetica, Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; width: 100%; height: 100%; overflow: hidden;
  background: var(--bg); color: var(--ink);
  font: 12px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}
canvas { display: block; }
button, a, input, select { font: inherit; color: inherit; }
button {
  border: 0; background: none; cursor: pointer;
  padding: 8px 12px; min-height: 44px;
  font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  border: 1px solid transparent;
}
button:hover { color: var(--red); }
button.active { color: var(--red); border-color: var(--red); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 1px solid var(--red); outline-offset: 3px;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--red); }

header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 22px calc(14px + env(safe-area-inset-top, 0px)) 22px;
  padding-top: max(14px, env(safe-area-inset-top, 0px));
  background: linear-gradient(rgba(12,12,13,0.92), rgba(12,12,13,0));
}
.wordmark { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.wordmark strong { font-size: 15px; font-weight: 700; letter-spacing: 0.18em; white-space: nowrap; }
.wordmark .g { color: var(--red); }
.wordmark small { font-family: var(--mono); font-size: 10px; color: var(--dim); letter-spacing: 0.08em; white-space: nowrap; }
nav { display: flex; gap: 2px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.nav-link {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  padding: 8px 12px; min-height: 44px; border: 1px solid transparent;
  font-size: 10px; letter-spacing: .14em; text-transform: uppercase; white-space: nowrap;
}
.booking-link { color: var(--red); border-color: rgba(255, 26, 22, .45); }
.booking-link:hover { background: rgba(255, 26, 22, .12); }

.blink { animation: blinker 3s linear infinite; color: var(--red); }
@keyframes blinker { 50% { opacity: 0.15; } }

/* --- rails --- */
#info {
  position: fixed; left: 22px; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); z-index: 4;
  max-width: 320px; font-size: 11px; background: var(--panel); padding: 10px 12px;
  border-left: 1px solid var(--line);
}
#info .counts { font-family: var(--mono); font-size: 10px; color: var(--dim); display: block; }
#info small { display: block; color: var(--faint); font-size: 10px; margin-top: 4px; }
#stage {
  position: fixed; left: 22px; top: calc(64px + env(safe-area-inset-top, 0px)); z-index: 4;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; color: var(--dim);
}
#part {
  position: fixed; right: 22px; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); z-index: 4;
  max-width: 300px; text-align: right; font-size: 11px; background: var(--panel);
  padding: 10px 12px; border-right: 1px solid var(--line);
}
#part .pid { font-family: var(--mono); font-size: 10px; color: var(--red); letter-spacing: 0.1em; display: block; }
#part strong { font-weight: 600; font-size: 12px; display: block; margin: 2px 0; }
#part .sys { font-size: 10px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.12em; }
#part p { margin: 6px 0 0; color: var(--dim); font-size: 11px; }

/* --- assembly bar --- */
#assemblyBar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(20px + env(safe-area-inset-bottom, 0px)); z-index: 5;
  display: flex; align-items: center; gap: 10px;
  background: var(--panel); border: 1px solid var(--line); padding: 4px 10px;
  backdrop-filter: blur(8px);
}
#assemblyBar input[type="range"] { width: min(300px, 34vw); accent-color: var(--red); height: 44px; }
#assemblyStage { font-family: var(--mono); font-size: 10px; color: var(--dim); min-width: 120px; letter-spacing: 0.08em; }

/* --- catalog --- */
#catalog {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 6;
  width: min(340px, 92vw);
  background: rgba(12, 12, 13, 0.97); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 16px;
  padding-top: max(16px, env(safe-area-inset-top, 0px));
  padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
}
#catalog[hidden] { display: none; }
.catalog-heading { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.catalog-heading strong { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; }
#catalogClose { font-size: 18px; padding: 4px 10px; }
#partSearch, #systemFilter {
  width: 100%; background: #161617; border: 1px solid var(--line); color: var(--ink);
  padding: 10px; font-size: 12px; margin-bottom: 8px; border-radius: 0;
  min-height: 44px;
}
#partSearch::placeholder { color: var(--faint); }
#catalogCount { font-family: var(--mono); font-size: 10px; color: var(--dim); margin: 4px 0 8px; }
#catalogList { overflow-y: auto; flex: 1; scrollbar-width: thin; }
.cat-item {
  display: block; width: 100%; text-align: left; padding: 8px 6px;
  border-bottom: 1px solid rgba(242,240,236,0.07); min-height: 44px;
  text-transform: none; letter-spacing: 0; font-size: 11px;
}
.cat-item .cid { font-family: var(--mono); font-size: 10px; color: var(--red); display: block; }
.cat-item:hover { background: rgba(255, 26, 22, 0.08); color: var(--ink); }
.cat-item.sel { background: rgba(255, 26, 22, 0.14); }

/* --- loading --- */
#loading {
  position: fixed; inset: 0; display: grid; place-items: center; z-index: 9;
  background: var(--bg); letter-spacing: 0.22em; font-size: 11px; text-transform: uppercase;
  transition: opacity 0.6s ease;
}
#loading.done { opacity: 0; pointer-events: none; }
.rig-fallback {
  position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px;
  padding: 24px; background: var(--bg); text-align: center; max-width: none;
}
.rig-fallback a { color: var(--red); text-decoration: underline; min-height: 44px; padding: 10px; }

/* --- journey specifics --- */
#chapterText {
  position: fixed; z-index: 4; right: 26px; top: 50%; transform: translateY(-50%);
  max-width: 330px; background: var(--panel); border-right: 1px solid var(--red);
  padding: 18px 20px;
}
#chapterText .num { font-family: var(--mono); color: var(--red); font-size: 11px; letter-spacing: 0.14em; }
#chapterText h1 { font-size: 21px; margin: 6px 0 8px; font-weight: 700; letter-spacing: 0.04em; line-height: 1.2; }
#chapterText p { margin: 0; color: var(--dim); font-size: 12px; line-height: 1.75; }
#chapterBar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(20px + env(safe-area-inset-bottom, 0px)); z-index: 5;
  display: flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--line); padding: 4px 10px;
  backdrop-filter: blur(8px);
}
#chapterBar input[type="range"] { width: min(280px, 32vw); accent-color: var(--red); height: 44px; }
#chapterLabel { font-family: var(--mono); font-size: 10px; color: var(--dim); min-width: 64px; text-align: center; }
#chapterNav {
  position: fixed; left: 22px; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); z-index: 4;
  display: flex; flex-direction: column; gap: 2px; max-height: 46vh; overflow-y: auto;
}
#chapterNav button {
  display: flex; align-items: baseline; width: 100%; min-width: 178px;
  text-align: left; font-size: 10px; padding: 6px 10px; min-height: 34px;
  color: var(--dim); border-left: 1px solid var(--line);
}
#chapterNav button.active { color: var(--red); border-left-color: var(--red); border-top: 0; border-right: 0; border-bottom: 0; }
#chapterNav .cnum { font-family: var(--mono); margin-right: 8px; }

@media (max-width: 720px) {
  header { padding: 10px 12px; gap: 6px; flex-direction: column; align-items: flex-start; }
  .wordmark strong { font-size: 13px; }
  .wordmark small { display: none; }
  nav { gap: 0; flex-wrap: nowrap; overflow-x: auto; width: 100%; justify-content: flex-start; scrollbar-width: none; }
  nav::-webkit-scrollbar { display: none; }
  nav button, nav a button { flex: 0 0 auto; }
  .nav-link { font-size: 9px; padding: 6px 8px; }
  #onair { display: none; }
  button { padding: 6px 8px; font-size: 9px; }
  #info { left: 14px; bottom: calc(128px + env(safe-area-inset-bottom, 0px)); max-width: 44vw; padding: 8px 10px; font-size: 10px; }
  #part { right: 14px; bottom: calc(128px + env(safe-area-inset-bottom, 0px)); max-width: 44vw; font-size: 10px; }
  #stage { display: none; }
  #assemblyBar, #chapterBar { width: calc(100vw - 20px); justify-content: center; flex-wrap: wrap; gap: 4px; }
  #assemblyBar input[type="range"], #chapterBar input[type="range"] { flex: 1; min-width: 110px; width: auto; }
  #assemblyStage { min-width: 0; }
  #chapterText {
    right: 12px; left: 12px; top: auto; bottom: calc(176px + env(safe-area-inset-bottom, 0px));
    transform: none; max-width: none; padding: 12px 14px;
  }
  #chapterText h1 { font-size: 17px; }
  #chapterText p { font-size: 11px; }
  #chapterNav { left: 12px; right: 12px; top: calc(100px + env(safe-area-inset-top, 0px)); bottom: auto; flex-direction: row; max-width: none; overflow-x: auto; max-height: none; }
  #chapterNav button { border-left: 0; border-top: 1px solid var(--line); white-space: nowrap; min-width: 0; width: auto; }
  #chapterNav button span.ctitle { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .blink { opacity: 1; }
}

/* Keep the rig header at its existing height while sharing the approved brand artwork. */
.wordmark{align-items:center}.wordmark>a{display:block;flex-shrink:0}
.wordmark-logo{display:block;width:100px;height:44px;object-fit:contain;mix-blend-mode:lighten}
@media(max-width:720px){#chapterNav{top:calc(124px + env(safe-area-inset-top,0px))}}
