/* Additions for the hosted site: the run-your-own panel and the note above the goal. */
.byok-open { background: var(--peel); color: var(--on-accent, #fff); border: 0; border-radius: 8px; padding: 9px 16px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.hosted-note { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin: 18px 32px 0; padding: 10px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); font-size: 14px; color: var(--muted); }
.hosted-note > span { flex: 1 1 280px; }
.hosted-note a, .linkish { color: var(--peel); font-weight: 600; text-decoration: none; background: none; border: 0; padding: 0; cursor: pointer; font-size: 14px; }
.hosted-note a:hover, .linkish:hover { text-decoration: underline; }
#byok { max-width: 520px; }
.byok h3 { margin: 0 0 6px; font-size: 20px; }
.byok-lede { margin: 0 0 14px; }
.byok label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 12px 0 0; }
.byok input:not([type=checkbox]), .byok select, .byok textarea { display: block; width: 100%; box-sizing: border-box; margin-top: 5px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--paper); font-size: 15px; font-weight: 400; color: var(--ink); }
.byok select { max-width: none; }
.byok-key { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-top: 12px; }
.byok-key .primary { background: var(--peel); padding: 8px 14px; }
.byok-key label:first-of-type { margin-top: 10px; }
.byok-hint { font-size: 13px !important; margin: 8px 0 0; }
.byok-hint a { color: var(--peel); font-weight: 600; }
.byok-check { display: flex !important; align-items: center; gap: 8px; font-weight: 400 !important; }
.byok-note { min-height: 1.4em; margin: 12px 0 0; color: var(--muted); }
.byok-note.bad { color: var(--rust); }
#byok-go:disabled { opacity: .55; cursor: default; }
@media (max-width: 720px) { .hosted-note { margin: 12px 16px 0; } .byok-open { padding: 8px 12px; } }
.hosted-note #byok-state.bad { color: var(--rust); }

/* ------------------------------------------------------------ landing (web/landing.js) */
.ld { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; overflow-y: auto; box-sizing: border-box;
  background: var(--paper); color: var(--ink); animation: ld-fade .25s ease-out; }
.ld[hidden] { display: none; }
body.ld-on { overflow: hidden; }
@keyframes ld-fade { from { opacity: 0; } }
.ld-top { display: flex; align-items: center; justify-content: space-between; padding: 16px 32px; }
.ld-brand { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.ld-dash { display: flex; align-items: center; gap: 6px; background: none; border: 1px solid var(--line); border-radius: 99px; padding: 7px 14px; color: var(--muted); font-size: 14px; cursor: pointer; }
.ld-dash:hover { color: var(--ink); border-color: var(--faint); }
.ld-dash .ld-arrow { width: 15px; height: 15px; }
.ld-card { margin: auto; width: 100%; max-width: 680px; box-sizing: border-box; min-width: 0; padding: 24px 24px 56px; animation: ld-rise .35s cubic-bezier(.2,.7,.2,1); }
.ld-card h1 { font-size: 40px !important; letter-spacing: -.015em; }
@keyframes ld-rise { from { transform: translateY(14px); opacity: 0; } }
.ld-card h1 { line-height: 1.15; margin: 0 0 12px; }
.ld-card h2 { font-size: 21px; margin: 0 0 6px; }
.ld-sub { color: var(--muted); font-size: 15px; margin: 0 0 16px; }
.ld textarea { width: 100%; box-sizing: border-box; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--paper);
  color: var(--ink); font: 17px/1.45 var(--sans); resize: vertical; transition: border-color .2s, box-shadow .2s; }
.ld textarea:focus { outline: none; border-color: var(--peel); box-shadow: 0 0 0 3px var(--peel-soft); }
.ld textarea.want { animation: ld-shake .4s; border-color: var(--rust); }
@keyframes ld-shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.ld-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin: 14px 0 6px; }
.ld-go { background: var(--peel); color: var(--on-accent); border: 0; border-radius: 9px; padding: 11px 22px; font-weight: 600; font-size: 15px; cursor: pointer; }
.ld-go:hover { filter: brightness(1.06); }
.ld-try { background: none; border: 1px solid var(--line); border-radius: 9px; padding: 10px 16px; color: var(--ink); font-size: 15px; cursor: pointer; }
.ld-try:hover { border-color: var(--peel); color: var(--peel); }
.ld-routes { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 2px; }
.ld-routes button, .ld-routes a { display: grid; grid-template-columns: 22px auto 1fr; align-items: baseline; gap: 8px; width: 100%; text-align: left;
  background: none; border: 0; border-radius: 8px; padding: 8px 10px; color: var(--ink); font-size: 15px; text-decoration: none; cursor: pointer; }
.ld-routes button:hover, .ld-routes a:hover { background: var(--paper); }
.ld-routes span { color: var(--muted); font-size: 14px; }
.ld-arrow { width: 18px; height: 18px; align-self: center; color: var(--faint); transition: color .2s, transform .2s; }
.ld-routes li:hover .ld-arrow { color: var(--peel); transform: translateX(3px); }
.ld.typed .ld-arrow { color: var(--peel); }
.ld-routes.nudge li .ld-arrow { animation: ld-nudge .9s ease-in-out 2; }
.ld-routes.nudge li:nth-child(2) .ld-arrow { animation-delay: .08s; }
.ld-routes.nudge li:nth-child(3) .ld-arrow { animation-delay: .16s; }
.ld-routes.nudge li:nth-child(4) .ld-arrow { animation-delay: .24s; }
@keyframes ld-nudge { 50% { transform: translateX(6px); } }
.ld-mcp { font-size: 14px; color: var(--muted); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 8px 0 0; }
.ld-mcp p { margin: 0 0 10px; }
.ld-mcp-state { padding-left: 18px; position: relative; }
.ld-mcp-state::before { content: ""; position: absolute; left: 0; top: .5em; width: 9px; height: 9px; border-radius: 50%; background: var(--faint); }
.ld-mcp-state.on::before { background: var(--leaf, #5d7a3e); box-shadow: 0 0 0 3px var(--leaf-soft, #e3ecd6); }
.ld-mcp-state b, .ld-mcp-h { color: var(--ink); }
.ld-mcp-btns { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
.ld-mcp-b { display: inline-block; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; font: inherit; font-size: 14px; font-weight: 600; color: var(--ink) !important; text-decoration: none; cursor: pointer; }
.ld-mcp-b:hover { border-color: var(--peel); color: var(--peel) !important; }
.ld-mcp p.ld-mcp-note { margin: 0; font-size: 13px; }
.ld-mcp code { font-size: 13px; background: var(--line); padding: 1px 5px; border-radius: 4px; }
.ld-mcp a { color: var(--peel); font-weight: 600; }
.ld-samples { margin: 34px 0 0; }
.ld-samples-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0 0 12px; }
.ld-card .ld-samples-head h2 { font-size: 15px; font-weight: 500; color: var(--muted); margin: 0; }
.ld-all { background: none; border: 0; padding: 0; color: var(--muted); font-size: 14px; cursor: pointer; }
.ld-all:hover { color: var(--ink); }
.ld-row { display: grid; grid-auto-flow: column; grid-auto-columns: 30%; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory;
  padding-bottom: 6px; scrollbar-width: thin; }
.ld-sc { scroll-snap-align: start; display: flex; flex-direction: column; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 8px 8px 12px; cursor: pointer; color: var(--ink); font: inherit; transition: border-color .2s, transform .2s; min-width: 0; }
.ld-sc:hover { border-color: var(--faint); transform: translateY(-2px); }
.ld-sc:focus-visible { outline: 2px solid var(--peel); outline-offset: 2px; }
.ld-thumb { display: block; aspect-ratio: 16 / 10; box-shadow: inset 0 0 0 1px rgba(255,255,255,.07); border-radius: 8px; overflow: hidden; padding: 12px 12px 0; box-sizing: border-box; }
.ld-thumb-doc { display: grid; gap: 6px; height: 100%; padding: 10px 10px 0; box-sizing: border-box; border-radius: 6px 6px 0 0; background: rgba(255,255,255,.08);
  box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.ld-thumb-row { display: flex; gap: 6px; align-items: baseline; font-size: 12px; line-height: 1.3; min-width: 0; }
.ld-thumb-row em { font-style: normal; font-weight: 700; flex: none; }
.ld-thumb-row > span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; opacity: .85; }
.ld-thumb-row:first-child > span { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-weight: 600; opacity: 1; }
.ld-thumb.t0 { background: #2a2420; color: #f3ead9; } .ld-thumb.t0 em { color: #e7743f; }
.ld-thumb.t1 { background: #d9531e; color: #fff6ee; }
.ld-thumb.t2 { background: #4f6140; color: #eef2e4; } .ld-thumb.t2 em { color: #c8dba9; }
.ld-thumb.t3 { background: #f1d9c8; color: #3a2a20; } .ld-thumb.t3 .ld-thumb-doc { background: #fbf4ec; }
.ld-thumb.t3 em { color: #d9531e; }
.ld-thumb.t4 { background: #3b2519; color: #f6e6d8; } .ld-thumb.t4 em { color: #f0a070; }
.ld-sc-title { font-weight: 600; font-size: 15px; margin: 10px 4px 0; line-height: 1.3; }
.ld-sc-meta { font-size: 13px; color: var(--muted); margin: 2px 4px 0; }
.ld-ok { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; margin: 0 0 12px; padding: 10px 14px; border-radius: 10px; font-size: 15px;
  background: var(--leaf-soft, #e3ecd6); color: var(--ink); animation: ld-deal .4s cubic-bezier(.2,.7,.2,1); }
.ld-ok[hidden] { display: none; }
.ld-ok b { color: var(--leaf, #5d7a3e); }
.ld-via { font-size: 14px; color: var(--muted); }
.ld-via .linkish { font-size: 14px; }
.ld-skip { display: block; margin: 18px auto 0; background: none; border: 0; color: var(--muted); font-size: 14px; cursor: pointer; }
.ld-skip:hover { color: var(--ink); text-decoration: underline; }
.ld-steps { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0 0 22px; counter-reset: s; }
.ld-steps li { flex: 1; font-size: 13px; color: var(--faint); border-top: 3px solid var(--line); padding-top: 6px; transition: color .3s, border-color .3s; }
.ld-steps li.done { color: var(--muted); border-color: var(--peel-soft); }
.ld-steps li.on { color: var(--ink); border-color: var(--peel); font-weight: 600; }
.ld-stage { min-height: 470px; }
.ld-typed { font-size: 21px; line-height: 1.4; font-weight: 600; padding: 16px 18px; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; min-height: 64px; }
.ld-typed.caret::after { content: ""; display: inline-block; width: 2px; height: 1.1em; margin-left: 2px; vertical-align: -3px; background: var(--peel); animation: ld-blink 1s steps(1) infinite; }
@keyframes ld-blink { 50% { opacity: 0; } }
.ld-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.ld-list li { display: flex; justify-content: space-between; gap: 14px; align-items: baseline; padding: 9px 12px; background: var(--paper); border: 1px solid var(--line);
  border-radius: 8px; opacity: 0; animation: ld-deal .4s cubic-bezier(.2,.7,.2,1) forwards; }
.ld-list b { font-weight: 500; font-size: 15px; }
.ld-list span { color: var(--muted); font-size: 13px; white-space: nowrap; }
.ld-rank em { font-style: normal; color: var(--peel); font-weight: 700; margin-right: 4px; }
@keyframes ld-deal { from { opacity: 0; transform: translateY(8px) rotate(-1deg); } to { opacity: 1; transform: none; } }
.ld-stage mark { background: var(--peel-soft); color: var(--peel); font-weight: 700; padding: 0 5px; border-radius: 5px; font-variant-numeric: tabular-nums; }
.ld-live { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; font-size: 15px; color: var(--ink); }
.ld-live i { width: 14px; height: 14px; flex: none; border-radius: 50%; border: 2px solid var(--peel-soft); border-top-color: var(--peel); animation: ld-turn .8s linear infinite; }
.ld-live.done i { animation: none; border-color: var(--leaf, #5d7a3e); background: var(--leaf, #5d7a3e); }
@keyframes ld-turn { to { transform: rotate(360deg); } }
.ld-counts { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 14px; font-size: 16px; color: var(--muted); }
.ld-pop { animation: ld-deal .4s cubic-bezier(.2,.7,.2,1); }
.ld-feed li { align-items: center; }
.ld-feed li b { min-width: 0; }
.ld-feed li b .t { white-space: normal; color: inherit; font-size: inherit; }
.ld-st { display: flex; gap: 5px; flex: none; }
.ld-st i { font-style: normal; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--line); color: var(--muted); }
.ld-st i.r { background: var(--peel-soft); color: var(--peel); animation: ld-blink 1s steps(1) infinite; }
.ld-st i.d { display: none; background: var(--leaf-soft, #e3ecd6); color: var(--leaf, #5d7a3e); }
.ld-feed li.ok .ld-st i.r { display: none; }
.ld-feed li.ok .ld-st i.d { display: inline; }
.ld-st i.v { animation: tb-pop-ld .3s cubic-bezier(.3,1.6,.5,1); }
.ld-st i.v.keep, .ld-st i.v.accept { background: var(--leaf-soft, #e3ecd6); color: var(--leaf, #5d7a3e); }
.ld-st i.v.kill, .ld-st i.v.reject { background: var(--rust-soft, #f4d8d4); color: var(--rust, #b3403a); }
.ld-st i.v.revise { background: var(--peel-soft); color: var(--peel); }
.ld-st i.elo { background: var(--ink); color: var(--paper); }
@keyframes tb-pop-ld { from { transform: scale(.3); opacity: 0; } }
.ld-feed li { transition: border-color .15s, background-color .15s, box-shadow .15s; }
.ld-feed li.vs { border-color: var(--faint); }
.ld-feed li.win { border-color: var(--peel); box-shadow: 0 0 0 2px var(--peel-soft); }
.ld-feed li.ld-more { background: none; border-style: dashed; }
.ld-feed li.ld-more b { color: var(--muted); }
.ld-nav { display: flex; justify-content: space-between; margin-top: 22px; }
.ld-back { background: none; border: 1px solid var(--line); border-radius: 9px; padding: 10px 18px; color: var(--ink); cursor: pointer; font-size: 15px; }
.ld-home-link { cursor: pointer; }
@media (max-width: 600px) {
  .ld-top { padding: 14px 16px; }
  .ld-card { padding: 16px 16px 40px; }
  .ld-card h1 { font-size: 28px !important; }
  .ld-routes button, .ld-routes a { grid-template-columns: 22px 1fr; }
  .ld-routes span { grid-column: 2; }
  .ld-list li { flex-direction: column; gap: 2px; }
  .ld-row { grid-auto-columns: 72%; }
  .ld-feed li { align-items: flex-start; gap: 6px; }
}
@media (prefers-reduced-motion: reduce) { .ld, .ld-card, .ld-list li, .ld-routes.nudge li .ld-arrow { animation: none !important; opacity: 1; } }

/* ------------------------------------------------------------ sign-in pop-up */
.sp { position: fixed; inset: 0; z-index: 60; background: rgba(16, 14, 12, .55); padding: 16px; animation: ld-fade .25s ease-out; }
.sp[hidden] { display: none; }
.sp-card { display: flex; gap: 18px; align-items: flex-start; max-width: 1240px; margin: 4px auto 0; box-sizing: border-box; background: var(--card);
  color: var(--ink); border: 1px solid var(--line); border-radius: 18px; padding: 22px 26px 24px; box-shadow: 0 18px 50px rgba(0, 0, 0, .3);
  animation: sp-drop .4s cubic-bezier(.2,.7,.2,1); }
@keyframes sp-drop { from { transform: translateY(-16px); opacity: 0; } }
.sp-body { max-width: 460px; }
.sp h2 { font-size: 19px; margin: 2px 0 6px; }
.sp p { color: var(--muted); font-size: 15px; margin: 0 0 16px; }
.sp-row { display: flex; align-items: flex-start; gap: 4px; }
.sp-go { background: var(--ink); color: var(--paper); border: 0; border-radius: 10px; padding: 13px 18px; font-weight: 700; font-size: 15px; cursor: pointer; white-space: nowrap; }
.sp-go:hover { filter: brightness(1.15); }
.sp-curve { width: 64px; height: 50px; color: var(--peel); margin-top: 18px; animation: sp-wiggle 1.6s ease-in-out .5s 3; transform-origin: 0 30%; }
@keyframes sp-wiggle { 50% { transform: translateX(-5px) rotate(-3deg); } }
.sp-alt { display: block; background: none; border: 0; padding: 10px 0 0; color: var(--muted); font-size: 14px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.sp-alt:hover { color: var(--ink); }
@media (max-width: 600px) { .sp-card { padding: 18px; gap: 12px; } .sp-card > img { width: 34px; height: 34px; } }
@media (prefers-reduced-motion: reduce) { .sp, .sp-card, .sp-curve { animation: none !important; } }

/* ------------------------------------------------------------ the full-screen card table (guided sample) */
.th { position: fixed; inset: 0; z-index: 55; background: var(--paper); animation: ld-fade .25s ease-out; }
.th[hidden] { display: none; }
body.th-on { overflow: hidden; }
.th-frame { position: absolute; left: 0; top: 0; width: 100vw; height: 100vh; height: 100dvh; display: flex; flex-direction: column; box-sizing: border-box; padding: 12px 16px 16px; gap: 10px; }
.th-bar { display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; min-width: 0; }
.th-bar button { font: inherit; font-size: 14px; cursor: pointer; border-radius: 8px; }
.th-play { background: var(--ink); color: var(--paper); border: 0; padding: 7px 16px; font-weight: 600 !important; min-width: 84px; }
.th-speed { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.th-speed button { background: var(--card); border: 0; border-right: 1px solid var(--line); border-radius: 0 !important; padding: 6px 10px; color: var(--muted); }
.th-speed button:last-child { border-right: 0; }
.th-speed button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.th-where { flex: 1; min-width: 0; color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.th-x { background: none; border: 1px solid var(--line); padding: 6px 14px; color: var(--ink); }
.th-body { flex: 1; min-height: 0; display: flex; align-items: center; }
.th-body .lv-table { width: 100%; }
@media (orientation: portrait) and (max-width: 700px) {
  .th-frame { width: 100vh; width: 100dvh; height: 100vw; transform: rotate(90deg) translateY(-100%); transform-origin: 0 0; padding: 10px 14px 12px; }
  .th-where { display: none; }
  .th-next { padding: 7px 10px; }
}
.th-next { background: var(--peel); color: var(--on-accent, #fff); border: 0; padding: 7px 14px; font-weight: 600 !important; white-space: nowrap; }

/* ------------------------------------------------------------ the results tour after the replay */
.tour { position: fixed; z-index: 45; left: 50%; bottom: 20px; transform: translateX(-50%); width: min(560px, calc(100vw - 32px)); box-sizing: border-box;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 18px 16px; box-shadow: 0 12px 40px rgba(20, 16, 12, .22); }
.tour[hidden] { display: none; }
.tour.tour-in { animation: tour-in .35s cubic-bezier(.2,.7,.2,1); }
@keyframes tour-in { from { transform: translate(-50%, 16px); opacity: 0; } }
.tour-top { display: flex; justify-content: space-between; align-items: center; }
.tour-n { font-size: 13px; color: var(--muted); font-weight: 600; }
.tour-x { background: none; border: 0; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; padding: 2px 0; }
.tour-x:hover { color: var(--ink); }
.tour h3 { margin: 2px 0 4px; font-size: 19px; }
.tour p { margin: 0 0 12px; color: var(--muted); font-size: 15px; }
.tour mark { white-space: nowrap; background: var(--peel-soft); color: var(--peel); font-weight: 700; padding: 0 4px; border-radius: 4px; }
.tour-nav { display: flex; justify-content: space-between; }
body.tour-active { padding-bottom: 220px; }
.tabs button.tour-on { color: var(--peel) !important; border-color: var(--peel) !important; box-shadow: inset 0 -3px 0 var(--peel); }
@media (max-width: 720px) {
  .tour { bottom: 10px; padding: 10px 14px 12px; }
  .tour h3 { font-size: 17px; }
  .tour p { font-size: 14px; margin-bottom: 10px; }
  .tour-nav button { padding: 8px 16px; }
}
