/* ==========================================================================
   OpenMobile-2 — trajectory viewer. Class namespace: tv-.
   One player (phone + step panel) is shared by the viewer page, the homepage
   example cards and the GUI-only vs hybrid pair. GUI actions are drawn in the
   accent colour, app-native tool calls in the coral "pop" colour, matching
   the convention elsewhere on the page. The phone chrome repeats the live
   card's material (om2-live.css); keep the two in step.
   ========================================================================== */
.tv-player {
  --tv-bezel: var(--surface-2);
  --tv-rail-hi: color-mix(in srgb, var(--text-hi) 52%, var(--tv-bezel));
  --tv-rail-mid: color-mix(in srgb, var(--text-hi) 16%, var(--tv-bezel));
  --tv-rail-lo: color-mix(in srgb, var(--bg) 72%, var(--tv-bezel));
  --tv-sheen: 0.06;
  --tv-edge: 0.35;
  --tv-ground: 1;
  --tv-scale: 1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 24px 36px;
  align-items: start;
}
:root[data-theme="light"] .tv-player {
  --tv-bezel: var(--surface-3);
  --tv-rail-hi: var(--surface-3);
  --tv-rail-mid: color-mix(in srgb, var(--text-hi) 10%, var(--tv-bezel));
  --tv-rail-lo: color-mix(in srgb, var(--text-hi) 32%, var(--tv-bezel));
  --tv-sheen: 0.35;
  --tv-edge: 0.08;
  --tv-ground: 0.45;
}
.tv-player.is-stacked { grid-template-columns: 1fr; }

/* ------------------------------------------------------------------- phone */
.tv-stage { position: relative; z-index: 0; width: 380px; height: 820px; margin: 0 auto; }
.tv-scaler { position: absolute; left: 0; top: 0; width: 380px; height: 820px; transform-origin: 0 0; }
.tv-ground {
  position: absolute; z-index: -1; pointer-events: none;
  left: 18%; right: 18%; bottom: -16px; height: 34px;
  border-radius: 50%;
  background: radial-gradient(50% 50% at 50% 50%, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.26) 42%, transparent 72%);
  opacity: var(--tv-ground);
}
.tv-phone {
  position: relative;
  display: flex;
  width: 380px; height: 820px;
  padding: 2px;
  border-radius: 46px;
  background:
    linear-gradient(var(--tv-rail-hi), var(--tv-rail-hi)) 0 11% / 100% 1px no-repeat,
    linear-gradient(var(--tv-rail-hi), var(--tv-rail-hi)) 0 89% / 100% 1px no-repeat,
    linear-gradient(135deg, var(--tv-rail-hi), var(--tv-rail-mid) 32%, var(--tv-rail-lo));
  box-shadow: 0 34px 60px -30px rgba(0, 0, 0, 0.75), var(--shadow);
}
:root[data-theme="light"] .tv-phone { box-shadow: 0 28px 50px -30px rgba(0, 0, 0, 0.35), var(--shadow); }
.tv-bezel {
  flex: 1 1 auto; min-width: 0;
  display: flex;
  padding: 8px;
  border-radius: 44px;
  background: var(--tv-bezel);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.22);
}
.tv-sbtn { position: absolute; width: 3px; border-radius: 2px; background: linear-gradient(180deg, var(--tv-rail-hi), var(--tv-rail-lo)); }
.tv-vol1 { left: -3px; top: 17%; height: 6%; }
.tv-vol2 { left: -3px; top: 24.5%; height: 6%; }
.tv-pwr { right: -3px; top: 22%; height: 9%; }
.tv-screen {
  position: relative;
  width: 360px; height: 800px;
  border-radius: 36px;
  overflow: hidden;
  background: #0b0f14;
}
.tv-frame {
  position: absolute; inset: 0; z-index: 1;
  width: 100%; height: 100%;
  object-fit: contain;
  background: #000;
  opacity: 0;
  transition: opacity 0.22s ease;
}
.tv-frame.is-shown { opacity: 1; }
.tv-sheen {
  position: absolute; inset: 0; z-index: 6;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(115deg, rgba(255, 255, 255, var(--tv-sheen)), transparent 40%);
  box-shadow: inset 0 0 18px rgba(0, 0, 0, var(--tv-edge)), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}
/* a coral edge while a tool call is the current step: the screen did not
   change, the action went through the tool channel */
.tv-screen::after {
  content: "";
  position: absolute; inset: 0; z-index: 5;
  pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 0 0 2px var(--pop-400), inset 0 0 40px color-mix(in srgb, var(--pop-400) 30%, transparent);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.tv-screen.is-tool::after { opacity: 1; }

/* ---------------------------------------------------------- action markers */
.tv-overlay { position: absolute; inset: 0; z-index: 3; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.tv-overlay .m-dot { fill: var(--accent-300); stroke: #fff; stroke-width: 2; }
.tv-overlay .m-ring { fill: none; stroke: var(--accent-300); stroke-width: 2.5; transform-box: fill-box; transform-origin: center; animation: tv-ripple 1.1s ease-out infinite; }
.tv-overlay .m-ring2 { animation-delay: 0.35s; }
.tv-overlay .m-hold { fill: none; stroke: var(--accent-300); stroke-width: 3; stroke-dasharray: 6 5; transform-box: fill-box; transform-origin: center; animation: tv-spin 2.4s linear infinite; }
.tv-overlay .m-path { fill: none; stroke: var(--accent-300); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 10 8; animation: tv-dash 0.9s linear infinite; filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.6)); }
.tv-overlay .m-head { fill: var(--accent-300); stroke: #fff; stroke-width: 1.5; }
.tv-overlay .m-shadow { fill: none; stroke: rgba(0, 0, 0, 0.55); stroke-width: 7; stroke-linecap: round; }
@keyframes tv-ripple { 0% { transform: scale(0.5); opacity: 0.9; } 100% { transform: scale(1.7); opacity: 0; } }
@keyframes tv-spin { to { transform: rotate(360deg); } }
@keyframes tv-dash { to { stroke-dashoffset: -18; } }

/* chips and banners drawn over the screen */
.tv-chips { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.tv-chip {
  position: absolute; left: 50%;
  transform: translateX(-50%);
  max-width: 300px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(10, 14, 19, 0.82);
  color: #fff;
  font: 500 12.5px/1.25 var(--font-body);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14), 0 8px 20px -8px rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: tv-chip-in 0.25s ease;
}
.tv-chip b { font-weight: 600; color: var(--accent-300); margin-right: 6px; }
.tv-chip.at-top { top: 54px; }
.tv-chip.at-bottom { bottom: 58px; }
.tv-chip.is-type { max-width: 320px; white-space: normal; text-align: left; border-radius: 14px; font-family: var(--font-mono); font-size: 12px; }
.tv-chip.is-type b { font-family: var(--font-body); }
.tv-chip.is-done b { color: var(--ok); }
.tv-chip.is-fail b { color: var(--bad); }
.tv-banner {
  position: absolute; left: 12px; right: 12px; top: 48px;
  padding: 10px 12px 11px;
  border-radius: 14px;
  background: rgba(10, 14, 19, 0.86);
  color: #fff;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--pop-400) 70%, transparent), 0 10px 26px -10px rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: tv-chip-in 0.25s ease;
}
.tv-banner-k { display: block; font: 600 10.5px/1 var(--font-body); letter-spacing: 0.18em; text-transform: uppercase; color: var(--pop-300); margin-bottom: 6px; }
.tv-banner-n { display: block; font: 500 13px/1.3 var(--font-mono); color: #fff; word-break: break-all; }
.tv-banner-a { display: block; margin-top: 4px; font: 400 11.5px/1.4 var(--font-mono); color: rgba(255, 255, 255, 0.7); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tv-banner.is-err { box-shadow: 0 0 0 1px var(--bad), 0 10px 26px -10px rgba(0, 0, 0, 0.85); }
.tv-banner.is-err .tv-banner-k { color: var(--bad); }
@keyframes tv-chip-in { from { opacity: 0; transform: translate(-50%, 4px); } }
.tv-banner { animation-name: tv-banner-in; }
@keyframes tv-banner-in { from { opacity: 0; transform: translateY(-4px); } }

/* -------------------------------------------------------------- side panel */
.tv-side { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.tv-title { margin: 0 0 6px; font: 600 20px/1.3 var(--font-display); letter-spacing: -0.01em; color: var(--text-hi); }
.tv-instr { margin: 0 0 10px; font-size: 14px; line-height: 1.6; color: var(--text-dim); }
.tv-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.tv-tag {
  display: inline-flex; align-items: center; gap: 5px;
  height: 24px; padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--hairline-cool);
  background: var(--chart-track);
  color: var(--text);
  font: 500 11.5px/1 var(--font-mono);
  white-space: nowrap;
}
.tv-tag.is-app { font-family: var(--font-body); font-size: 12px; }
.tv-tag.is-mode-hybrid { color: var(--pop-300); border-color: color-mix(in srgb, var(--pop-400) 45%, transparent); }
.tv-tag.is-ok { color: var(--ok); }
.tv-tag.is-bad { color: var(--bad); }
.tv-tag.is-model { color: var(--text-dim); }
.tv-pairlink { margin-left: auto; }

/* step strip */
.tv-strip { display: flex; flex-wrap: wrap; gap: 4px; list-style: none; margin: 0; padding: 0; }
.tv-mark {
  width: 14px; height: 22px; padding: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  background: color-mix(in srgb, var(--accent-400) 32%, transparent);
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease;
}
.tv-mark:hover { background: color-mix(in srgb, var(--accent-400) 60%, transparent); }
.tv-mark.is-tool { background: color-mix(in srgb, var(--pop-400) 55%, transparent); height: 26px; margin-top: -2px; }
.tv-mark.is-tool:hover { background: var(--pop-400); }
.tv-mark.is-nav { background: color-mix(in srgb, var(--text-dim) 30%, transparent); }
.tv-mark.is-fail { box-shadow: inset 0 0 0 1.5px var(--bad); }
.tv-mark.is-end { background: color-mix(in srgb, var(--ok) 50%, transparent); border-radius: 50%; width: 14px; }
.tv-mark[aria-current="step"] { transform: scaleY(1.18); border-color: var(--text-hi); background: var(--accent-400); }
.tv-mark.is-tool[aria-current="step"] { background: var(--pop-400); }
.tv-mark.is-end[aria-current="step"] { background: var(--ok); }
.tv-mark:focus-visible { outline: 2px solid var(--accent-400); outline-offset: 2px; }
.tv-mark.is-past { opacity: 0.55; }
.tv-mark[aria-current="step"].is-past { opacity: 1; }

/* controls */
.tv-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tv-controls .wt-count { margin-left: 4px; }
.tv-kbd { margin-left: auto; font: 500 11px var(--font-mono); color: var(--text-faint); }
.tv-kbd kbd { font: inherit; padding: 1px 5px; border: 1px solid var(--hairline-cool); border-radius: 4px; }

/* current step */
.tv-step {
  padding: 16px 18px 18px;
  border-radius: var(--r);
  border: 1px solid var(--hairline-cool);
  background: var(--surface-1b);
  box-shadow: inset 0 1px 0 var(--edge-hi);
  min-height: 180px;
}
.tv-step-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.tv-badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 10px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent-400) 18%, transparent);
  color: var(--accent-200);
  font: 600 11.5px/1 var(--font-mono);
  letter-spacing: 0.04em;
}
.tv-badge.is-tool { background: color-mix(in srgb, var(--pop-400) 20%, transparent); color: var(--pop-300); }
.tv-badge.is-end { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.tv-badge.is-fail { background: color-mix(in srgb, var(--bad) 18%, transparent); color: var(--bad); }
.tv-step-app { font: 500 12px var(--font-mono); color: var(--text-dim); }
.tv-step-app::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 6px; background: var(--accent-400); vertical-align: 1px; }
.tv-thought { margin: 0; font-size: 14.5px; line-height: 1.6; color: var(--text-hi); }
.tv-action { margin: 8px 0 0; font-size: 13.5px; line-height: 1.55; color: var(--text-dim); }
.tv-args { margin: 10px 0 0; font: 500 12.5px/1.5 var(--font-mono); color: var(--accent-300); word-break: break-word; }
.tv-tool { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--hairline-cool); }
.tv-tool-name { font: 600 13.5px/1.3 var(--font-mono); color: var(--pop-300); word-break: break-all; }
.tv-tool-name::before { content: "tool"; display: inline-block; margin-right: 8px; padding: 2px 6px; border-radius: 4px; background: color-mix(in srgb, var(--pop-400) 20%, transparent); font: 600 10px/1 var(--font-body); letter-spacing: 0.14em; text-transform: uppercase; vertical-align: 2px; }
.tv-kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 3px 12px; margin: 8px 0 0; font: 400 12.5px/1.5 var(--font-mono); }
.tv-kv dt { color: var(--text-dim); } .tv-kv dd { margin: 0; color: var(--text); word-break: break-word; }
.tv-result { margin-top: 10px; }
.tv-result summary { cursor: pointer; font: 500 12.5px/1.4 var(--font-mono); color: var(--text-dim); list-style: none; display: flex; align-items: center; gap: 8px; }
.tv-result summary::-webkit-details-marker { display: none; }
.tv-result summary::before { content: ""; width: 0; height: 0; border: 4px solid transparent; border-left: 5px solid currentColor; transition: transform 0.15s ease; }
.tv-result[open] summary::before { transform: rotate(90deg); }
.tv-result .is-ok { color: var(--ok); } .tv-result .is-err { color: var(--bad); }
.tv-result pre {
  margin: 8px 0 0; padding: 10px 12px;
  max-height: 260px; overflow: auto;
  border-radius: 8px;
  border: 1px solid var(--hairline-cool);
  background: var(--surface-3);
  font: 400 11.5px/1.5 var(--font-mono);
  color: var(--text);
  white-space: pre-wrap; word-break: break-word;
}
.tv-result small { display: block; margin-top: 6px; font-size: 11.5px; color: var(--text-faint); }
.tv-end { font-size: 14px; line-height: 1.6; color: var(--text); margin: 0; }

/* compact player (pairs, side-by-side): smaller phone, caption beside it */
.tv-player.is-compact { --tv-scale: 0.74; gap: 14px 22px; }
.tv-player.is-compact .tv-stage { width: calc(380px * var(--tv-scale)); height: calc(820px * var(--tv-scale)); }
.tv-player.is-compact .tv-scaler { transform: scale(var(--tv-scale)); }
.tv-player.is-compact .tv-step { min-height: 0; padding: 14px 16px; }
.tv-player.is-compact .tv-thought { font-size: 13.5px; }
.tv-player.is-compact .tv-chip { font-size: 14px; }
.tv-player.is-compact .tv-banner-n { font-size: 14px; }
.tv-player.is-compact .tv-banner-a { font-size: 12.5px; }
.tv-lane-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 0 0 10px; }
.tv-lane-head h4 { margin: 0; font: 600 15px/1.3 var(--font-body); color: var(--text-hi); }
.tv-lane-head .tv-tag { height: 22px; }

/* pairs card */
.tv-pairs .wt-tabs { margin-bottom: 18px; }
.tv-pairs-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.tv-pairs-grid > div { min-width: 0; }
.tv-pairs .tv-task { margin: 0 0 16px; font-size: 14.5px; line-height: 1.6; color: var(--text); max-width: 900px; }
.tv-pairs .tv-task span { color: var(--text-dim); }
.tv-pairs-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
@media (max-width: 1100px) { .tv-pairs-grid { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------ viewer page */
.tv-page .section-head .eyebrow::after { display: none; }
.tv-page .section-head { margin-bottom: 26px; }
.tv-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.tv-filters .wt-tabs { margin: 0; }
.tv-filters .tv-sep { width: 1px; height: 22px; background: var(--hairline-cool); margin: 0 4px; }
.tv-select, .tv-search {
  height: 32px; padding: 0 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--hairline-cool);
  background: var(--surface-2);
  color: var(--text-hi);
  font: 500 13px/1 var(--font-body);
}
.tv-search { width: 220px; }
.tv-search::placeholder { color: var(--text-faint); }
.tv-select:focus-visible, .tv-search:focus-visible { outline: 2px solid var(--accent-400); outline-offset: 1px; }
.tv-filters .wt-count { margin-left: auto; }
.tv-body { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 28px; align-items: start; }
.tv-list { list-style: none; margin: 0; padding: 0; max-height: 860px; overflow: auto; border: 1px solid var(--hairline-cool); border-radius: var(--r); background: var(--surface-1b); box-shadow: inset 0 1px 0 var(--edge-hi); }
.tv-item { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 12px; width: 100%; padding: 11px 12px; border: 0; border-top: 1px solid var(--hairline-cool); border-left: 3px solid transparent; background: transparent; color: inherit; text-align: left; cursor: pointer; font: inherit; }
.tv-item:first-child { border-top: 0; }
.tv-item:hover { background: var(--chart-track); }
.tv-item[aria-current="true"] { border-left-color: var(--accent-400); background: var(--chart-track); }
.tv-item img { width: 44px; height: 98px; object-fit: cover; object-position: top; border-radius: 6px; background: #0b0f14; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3); }
.tv-item-t { margin: 0 0 5px; font: 600 13.5px/1.4 var(--font-body); color: var(--text-hi); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tv-item-m { margin: 0; font: 500 11.5px/1.5 var(--font-mono); color: var(--text-dim); }
.tv-item-m i { font-style: normal; color: var(--pop-300); }
.tv-item-g { display: inline-block; margin-top: 5px; padding: 2px 6px; border-radius: 4px; background: var(--chart-track); font: 500 10.5px/1.2 var(--font-mono); color: var(--text-faint); letter-spacing: 0.04em; }
.tv-empty { padding: 32px 16px; text-align: center; font-size: 13.5px; color: var(--text-faint); }
.tv-main { min-width: 0; }
.tv-main > .tv-player { padding: 26px 30px 24px; border-radius: var(--r-lg); border: 1px solid var(--hairline-cool); background: var(--surface-1); }
.tv-loading { padding: 40px; text-align: center; color: var(--text-faint); font-size: 13.5px; }
@media (max-width: 1180px) {
  .tv-body { grid-template-columns: 1fr; }
  .tv-list { max-height: 360px; }
}
@media (max-width: 900px) {
  .tv-main > .tv-player { padding: 18px; }
  .tv-filters .wt-count { margin-left: 0; width: 100%; }
}

/* ---------------------------------------------------- homepage example cards */
.tv-cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
.tv-card {
  position: relative;
  display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 0;
  min-height: 176px;
  border-radius: var(--r);
  border: 1px solid var(--hairline-cool);
  background: var(--surface-1);
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  box-shadow: inset 0 1px 0 var(--edge-hi), 0 1px 2px var(--edge-lo);
}
.tv-card:hover { transform: translateY(-3px); border-color: var(--hairline-strong); box-shadow: inset 0 1px 0 var(--edge-hi), 0 1px 2px var(--edge-lo), 0 22px 40px -24px rgba(0, 0, 0, 0.8); }
.tv-card:focus-visible { outline: 2px solid var(--accent-400); outline-offset: 2px; }
.tv-card-shot { position: relative; background: #0b0f14; overflow: hidden; }
.tv-card-shot img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; transition: transform 0.4s ease; }
.tv-card:hover .tv-card-shot img { transform: scale(1.04); }
.tv-card-shot::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent 70%, color-mix(in srgb, var(--surface-1) 70%, transparent)); pointer-events: none; }
.tv-card-body { display: flex; flex-direction: column; gap: 8px; padding: 14px 14px 12px; min-width: 0; }
.tv-card-n { font: 500 11px/1 var(--font-mono); color: var(--text-faint); letter-spacing: 0.08em; }
.tv-card-t { margin: 0; font: 600 13.5px/1.4 var(--font-body); color: var(--text-hi); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tv-card-apps { display: flex; flex-wrap: wrap; gap: 4px; margin-top: auto; }
.tv-card-apps span { padding: 2px 7px; border-radius: 999px; background: var(--chart-track); border: 1px solid var(--hairline-cool); font: 500 11px/1.4 var(--font-body); color: var(--text-dim); }
.tv-card-m { font: 500 11.5px/1.4 var(--font-mono); color: var(--text-dim); }
.tv-card-m i { font-style: normal; color: var(--pop-300); }
@media (max-width: 1280px) { .tv-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .tv-cards { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .tv-cards { grid-template-columns: 1fr; } }

@media (prefers-reduced-motion: reduce) {
  .tv-frame { transition: none; }
  .tv-overlay .m-ring, .tv-overlay .m-hold, .tv-overlay .m-path { animation: none; }
  .tv-chip, .tv-banner { animation: none; }
  .tv-card, .tv-card-shot img { transition: none; }
}
