/* AI Commander animated product tour (tour.js). Uses the shared.css tokens;
   every class is tr-prefixed so page styles never leak into the stage.
   Layout switches to the stacked narrow mode via .tr-narrow, which tour.js
   sets from the player's own width, not the viewport. */

.aic-tour {
  --tr-ok: #2E9E5B;
  --tr-grid-dot: #E2E0D9;
  --tr-stage-h: 640px;
  position: relative;
  font-family: var(--sans);
  color: var(--ink);
}
.aic-tour.tr-live .aic-tour-fallback {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Static scene list: shown without JS, visually hidden once the player runs */
.aic-tour-fallback { list-style: none; display: grid; gap: 14px; margin: 0; padding: 0; }
.aic-tour-fallback li { border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--card); padding: 16px 18px; }
.aic-tour-fallback strong { display: block; font-size: 15px; margin-bottom: 4px; }
.aic-tour-fallback strong span { font-family: var(--mono); font-size: 12px; color: var(--accent); margin-right: 8px; font-weight: 500; }
.aic-tour-fallback p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }

.tr-player { display: grid; gap: 14px; }
.tr-caption-row { display: flex; align-items: baseline; gap: 14px; min-height: 52px; }
.tr-chap-tag { font-family: var(--mono); font-size: 12px; color: var(--accent); white-space: nowrap; padding-top: 2px; }
.tr-caption { font-size: 18px; line-height: 1.4; color: var(--ink); max-width: 72ch; margin: 0; transition: opacity .35s ease, transform .35s ease; text-wrap: pretty; }
.tr-caption.swap { opacity: 0; transform: translateY(4px); }

.tr-stage {
  position: relative; border: 1px solid var(--border); border-radius: 18px; overflow: hidden;
  background-color: var(--bg-alt);
  background-image: radial-gradient(var(--tr-grid-dot) 1.2px, transparent 1.3px);
  background-size: 18px 18px;
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .52fr) minmax(0, 1.15fr);
  gap: 0 34px; padding: 26px 26px 42px; height: var(--tr-stage-h);
  text-align: left; line-height: 1.5; font-size: 15px;
}
.tr-wires { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.tr-wire { fill: none; stroke: var(--border); stroke-width: 2; stroke-dasharray: 3 6; transition: stroke .4s; }
.tr-wire.on { stroke: var(--accent-border); stroke-dasharray: none; }
.tr-wire.hot { stroke: var(--accent); }
.tr-pkt.req { fill: var(--accent-bright); filter: drop-shadow(0 0 6px var(--accent-bright)); }
.tr-pkt.res { fill: var(--amber); filter: drop-shadow(0 0 6px var(--amber)); }

.tr-col { position: relative; z-index: 1; min-width: 0; min-height: 0; }
.tr-col-label { font-family: var(--mono); font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }

/* Chat */
.tr-chat-col { display: flex; flex-direction: column; }
.tr-chat { flex: 1; min-height: 0; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; position: relative; }
.tr-chat-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.tr-client-mark { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; font-size: 12px; color: #fff; background: #8a6d5a; transition: background .4s; flex: none; }
.tr-client-name { font-weight: 600; font-size: 14px; }
.tr-mcp-chip { margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--accent-ink); background: var(--accent-bg); border: 1px solid var(--accent-border); border-radius: var(--radius-pill); padding: 2px 8px; white-space: nowrap; }
.tr-msgs { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; gap: 10px; padding: 14px; }
.tr-msg { max-width: 92%; font-size: 13.5px; line-height: 1.45; animation: trRise .35s ease both; }
.tr-msg.user { align-self: flex-end; background: var(--ink); color: var(--bg-alt); padding: 8px 12px; border-radius: 14px 14px 4px 14px; }
.tr-msg.ai { align-self: flex-start; color: var(--ink); }
.tr-msg.ai .w { opacity: 0; animation: trFadeW .3s ease forwards; }
.tr-msg.note { align-self: center; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.tr-thinking { align-self: flex-start; display: flex; gap: 4px; padding: 4px 0; }
.tr-thinking i { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); animation: trBlink 1s infinite; }
.tr-thinking i:nth-child(2) { animation-delay: .15s; }
.tr-thinking i:nth-child(3) { animation-delay: .3s; }

.tr-tool { align-self: stretch; border: 1px solid var(--border); border-radius: var(--radius-input); background: var(--bg-alt); font-family: var(--mono); font-size: 11.5px; overflow: hidden; animation: trRise .35s ease both; }
.tr-tool-h { display: flex; align-items: center; gap: 8px; padding: 7px 10px; color: var(--ink-2); }
.tr-tool-h b { color: var(--accent); font-weight: 700; }
.tr-tool-h .st { margin-left: auto; color: var(--muted); font-size: 10.5px; white-space: nowrap; }
.tr-tool.ok .tr-tool-h .st { color: var(--tr-ok); }
.tr-spin { width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--accent-border); border-top-color: var(--accent); animation: trSpin .8s linear infinite; flex: none; }
.tr-tool.ok .tr-spin { animation: none; border-color: var(--tr-ok); background: var(--tr-ok); box-shadow: inset 0 0 0 2px var(--bg-alt); }
.tr-tool-args { margin: 0; padding: 0 10px 8px 29px; color: var(--muted); white-space: pre-wrap; word-break: break-word; line-height: 1.5; font-family: var(--mono); font-size: 11.5px; background: none; border: 0; }
.tr-tool-args .k { color: var(--ink-2); }
.tr-tool-args .s { color: var(--accent-ink); }
.tr-tool-x { padding: 0 10px 10px 29px; }
.tr-xfer { display: grid; gap: 5px; color: var(--ink-2); }
.tr-xfer .row, .tr-jobbar .row { display: flex; justify-content: space-between; gap: 8px; }
.tr-bar { display: block; height: 5px; border-radius: 3px; background: var(--border); overflow: hidden; }
.tr-bar > i { display: block; height: 100%; width: 0; background: var(--amber); border-radius: 3px; transition: width .25s linear; }

.tr-composer { margin: 0 12px 12px; border: 1px solid var(--border); border-radius: 12px; padding: 9px 10px 9px 12px; display: flex; align-items: center; gap: 8px; font-size: 13.5px; min-height: 42px; }
.tr-txt { flex: 1; min-width: 0; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tr-txt:empty::before { content: "Message…"; color: var(--faint); }
.tr-caret { width: 1.5px; height: 16px; background: var(--accent); animation: trBlink 1s steps(1) infinite; }
.tr-send { width: 26px; height: 26px; border-radius: 8px; background: var(--border); display: grid; place-items: center; flex: none; transition: background .2s; }
.tr-send svg { width: 12px; height: 12px; stroke: var(--card); }
.tr-send.ready { background: var(--ink); }

.tr-veil { position: absolute; inset: 0; background: rgba(255, 255, 255, .86); backdrop-filter: blur(3px); display: grid; place-content: center; text-align: center; gap: 6px; opacity: 0; pointer-events: none; transition: opacity .5s; }
.tr-chat.closed .tr-veil { opacity: 1; }
.tr-veil b { font-size: 15px; }
.tr-veil span { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }

/* Relay */
.tr-relay-col { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 14px; }
.tr-relay { background: var(--term-bg); color: var(--term-text); border-radius: 16px; padding: 16px 14px 14px; width: 100%; max-width: 168px; display: grid; justify-items: center; gap: 6px; text-align: center; box-shadow: 0 0 0 1px var(--term-border), 0 18px 40px rgba(0, 60, 70, .18); position: relative; }
.tr-relay img { width: 40px; height: 40px; border-radius: 10px; background: var(--bg); padding: 5px; }
.tr-relay b { font-family: var(--mono); font-size: 12px; font-weight: 500; }
.tr-relay small { font-family: var(--mono); font-size: 10px; color: var(--term-muted); letter-spacing: .06em; text-transform: uppercase; }
.tr-relay::after { content: ""; position: absolute; inset: -1px; border-radius: 16px; opacity: 0; }
.tr-relay.ping::after { animation: trPing .6s ease-out; }
.tr-relay-note { font-family: var(--mono); font-size: 10.5px; color: var(--muted); text-align: center; line-height: 1.5; max-width: 170px; }
.tr-clock { font-family: var(--mono); font-size: 12px; color: var(--ink); background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 5px 12px; display: flex; gap: 8px; align-items: center; opacity: 0; transform: translateY(-4px); transition: opacity .4s, transform .4s; font-variant-numeric: tabular-nums; }
.tr-clock.show { opacity: 1; transform: none; }
.tr-moon { width: 10px; height: 10px; border-radius: 50%; box-shadow: inset -3px -1px 0 0 var(--amber); }

/* Fleet */
.tr-fleet-col { display: flex; flex-direction: column; }
.tr-fleet { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.tr-mach { background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; flex: 0 0 50px; min-height: 50px; transition: flex-grow .55s cubic-bezier(.2, .8, .2, 1), flex-basis .55s cubic-bezier(.2, .8, .2, 1), border-color .3s; }
.tr-mach.active { flex: 1 1 0; border-color: var(--accent-border); }
.tr-mach-h { display: flex; align-items: center; gap: 10px; padding: 0 12px; height: 48px; flex: none; }
.tr-os { font-family: var(--mono); font-size: 9.5px; font-weight: 700; letter-spacing: .04em; color: var(--muted); border: 1px solid var(--border); border-radius: var(--radius-tag); padding: 3px 5px; width: 40px; text-align: center; flex: none; }
.tr-mach-name { font-family: var(--mono); font-weight: 700; font-size: 13px; }
.tr-mach-spec { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tr-status { margin-left: auto; display: flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 10.5px; color: var(--muted); white-space: nowrap; flex: none; }
.tr-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.tr-mach[data-st="online"] .tr-status i { background: var(--tr-ok); box-shadow: 0 0 0 3px rgba(46, 158, 91, .2); }
.tr-mach[data-st="busy"] .tr-status i { background: var(--amber); animation: trBlink 1.2s infinite; }
.tr-mach-b { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; padding: 0 10px 10px; opacity: 0; transition: opacity .3s; }
.tr-mach.active .tr-mach-b { opacity: 1; }
.tr-term { flex: 1; min-height: 0; background: var(--term-bg); border-radius: 8px; padding: 9px 11px; font-family: var(--mono); font-size: 11.5px; line-height: 1.55; color: var(--term-text); overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; }
.tr-term div { white-space: pre-wrap; word-break: break-all; animation: trRise .25s ease both; }
.tr-term .p { color: var(--term-blue); }
.tr-term .dim { color: var(--term-muted); }
.tr-term .ok { color: var(--term-green); }
.tr-term .warn { color: var(--term-yellow); }
.tr-term .code { color: var(--on-accent); background: var(--accent-bright); border-radius: 4px; padding: 1px 6px; display: inline-block; font-weight: 700; margin-top: 2px; }
.tr-extra:empty { display: none; }
.tr-jobbar { display: grid; gap: 5px; font-family: var(--mono); font-size: 11px; color: var(--ink-2); }
.tr-jobbar .tr-bar > i { background: var(--accent); }

/* Mini screenshot */
.tr-shot { aspect-ratio: 16 / 9; width: 100%; max-width: 100%; border-radius: 6px; background: linear-gradient(135deg, #2b5f73, #1a3140 60%, #243d2f); position: relative; overflow: hidden; }
.tr-win { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); width: 64%; background: #f3f3f3; border-radius: 5px; box-shadow: 0 6px 20px rgba(0, 0, 0, .35); font-family: 'Segoe UI', var(--sans); color: #1b1b1b; }
.tr-tb { font-size: 7.5px; padding: 4px 7px; background: #fff; border-radius: 5px 5px 0 0; border-bottom: 1px solid #e3e3e3; display: flex; justify-content: space-between; }
.tr-bd { padding: 7px 8px 8px; font-size: 8px; line-height: 1.35; }
.tr-bd b { font-size: 9px; display: block; margin-bottom: 2px; }
.tr-bt { display: flex; gap: 4px; justify-content: flex-end; margin-top: 6px; }
.tr-bt span { font-size: 7px; padding: 2px 6px; border-radius: 3px; background: #e6e6e6; }
.tr-bt span:first-child { background: #0f6cbd; color: #fff; }
.tr-task { position: absolute; left: 0; right: 0; bottom: 0; height: 9%; background: rgba(20, 24, 28, .85); }
.tr-chat .tr-shot { max-width: 260px; margin-top: 4px; }

.tr-legend { position: absolute; left: 26px; bottom: 12px; z-index: 1; display: flex; gap: 16px; font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.tr-legend span { display: flex; align-items: center; gap: 6px; }
.tr-legend i { width: 8px; height: 8px; border-radius: 50%; }
.tr-dot-req { background: var(--accent-bright); }
.tr-dot-res { background: var(--amber); }

/* Controls */
.tr-controls { display: flex; gap: 10px; align-items: stretch; }
.tr-play { flex: none; width: 46px; min-height: 46px; border-radius: 12px; border: 1px solid var(--border); background: var(--card); color: var(--ink); cursor: pointer; display: grid; place-items: center; }
.tr-play:hover { border-color: var(--accent-border); }
.tr-play svg { width: 14px; height: 14px; fill: currentColor; }
.tr-chapters { flex: 1; display: grid; gap: 8px; }
.tr-chap { text-align: left; border: 1px solid var(--border); background: var(--card); border-radius: 12px; padding: 10px 12px 11px; cursor: pointer; display: grid; gap: 7px; color: var(--muted); font: inherit; transition: border-color .2s, color .2s; }
.tr-chap:hover { border-color: var(--accent-border); color: var(--ink); }
.tr-chap.cur { color: var(--ink); border-color: var(--accent); }
.tr-chap .n { font-family: var(--mono); font-size: 10.5px; color: var(--accent); }
.tr-chap .t { font-size: 13.5px; font-weight: 600; line-height: 1.25; }
.tr-chap .tr-bar > i { background: var(--accent); transition: none; }
.tr-more { align-self: center; margin-left: auto; padding: 0 6px; font-size: 15px; font-weight: 600; color: var(--accent); text-decoration: none; white-space: nowrap; }
.tr-more:hover { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; }

@keyframes trRise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes trFadeW { to { opacity: 1; } }
@keyframes trBlink { 50% { opacity: .25; } }
@keyframes trSpin { to { transform: rotate(360deg); } }
@keyframes trPing { 0% { opacity: .9; box-shadow: 0 0 0 0 var(--accent-bright); } 100% { opacity: 0; box-shadow: 0 0 0 14px var(--accent-bright); } }

/* Narrow: stack chat, relay, fleet */
.tr-narrow .tr-stage { grid-template-columns: minmax(0, 1fr); height: auto; gap: 26px 0; padding: 18px 16px 40px; }
.tr-narrow .tr-chat { height: 340px; flex: none; }
.tr-narrow .tr-relay-col { flex-direction: row; justify-content: center; flex-wrap: wrap; }
.tr-narrow .tr-relay { grid-template-columns: auto auto; grid-template-rows: auto auto; column-gap: 10px; max-width: none; width: auto; padding: 10px 16px; text-align: left; justify-items: start; }
.tr-narrow .tr-relay img { grid-row: span 2; width: 34px; height: 34px; }
.tr-narrow .tr-relay-note { display: none; }
.tr-narrow .tr-clock:not(.show) { display: none; }
.tr-narrow .tr-fleet-col { padding-left: 22px; }
.tr-narrow .tr-fleet { flex: none; }
.tr-narrow .tr-mach, .tr-narrow .tr-mach.active { flex: none; }
.tr-narrow .tr-mach-b { display: none; }
.tr-narrow .tr-mach.active .tr-mach-b { display: flex; height: 190px; }
.tr-narrow .tr-mach-spec { display: none; }
.tr-narrow .tr-legend { left: 16px; }
.tr-narrow .tr-chap .t { display: none; }
.tr-narrow .tr-chap { padding: 9px 10px; }
.tr-narrow .tr-caption { font-size: 16px; }
.tr-narrow .tr-caption-row { flex-direction: column; gap: 4px; min-height: 78px; }
.tr-narrow .tr-controls { flex-wrap: wrap; }
.tr-narrow .tr-more { margin-left: 0; }

/* Paused (play button, hidden tab, offscreen): freeze every CSS animation too */
.aic-tour.tr-paused *, .aic-tour.tr-paused *::before, .aic-tour.tr-paused *::after { animation-play-state: paused !important; }
.tr-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

@media (prefers-reduced-motion: reduce) {
  .aic-tour *, .aic-tour *::before, .aic-tour *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ── /how-it-works/ page ── */
.hiw-top { max-width: 1180px; margin: 0 auto; padding: 3.5rem 2rem 1rem; }
.hiw-top h1 { font-size: clamp(1.9rem, 4.2vw, 2.7rem); font-weight: 700; letter-spacing: -0.04em; line-height: 1.1; margin-bottom: 0.7rem; }
.hiw-top .uc-lede { margin-bottom: 1.75rem; }
.hiw-top .aic-tour { margin-bottom: 1rem; }
.hiw-scenes { list-style: none; display: grid; gap: 0.9rem; margin: 0 0 1rem; padding: 0; counter-reset: none; }
.hiw-scenes li { border-left: 2px solid var(--accent-border); padding-left: 1rem; }
.hiw-scenes strong { display: block; color: var(--text); }
.hiw-scenes p { margin: 0.2rem 0 0; }
@media (max-width: 720px) { .hiw-top { padding: 2.5rem 1.25rem 1rem; } }
