/* Skipstone World (/world): a full-height 3D stage with the conversation beside it. Uses the site's dark tokens. */
.world-page .ai-fab { display: none; }              /* one conversation at a time on this page */
.world-page main { padding: 0; }
.world { position: relative; height: calc(100svh - 64px); min-height: 560px; overflow: hidden; background: #050608; color: var(--fg); isolation: isolate; }
.world canvas#world-stage { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity 1.2s var(--ease); touch-action: none; }
.world.ready canvas#world-stage { opacity: 1; }
#world-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 2; }

/* ---- glass ---- */
.w-top, .w-plan, .w-legend { z-index: 3; }
.w-plan, .w-views, .w-tele, .w-legend { background: color-mix(in srgb, #0a0d12 74%, transparent); backdrop-filter: blur(16px) saturate(140%); -webkit-backdrop-filter: blur(16px) saturate(140%); border: 1px solid var(--line); }

/* ---- top left: title, views, telemetry ---- */
.w-top { position: absolute; left: clamp(16px, 2.4vw, 32px); top: clamp(16px, 2.4vw, 28px); display: grid; gap: 14px; max-width: min(430px, 42vw); pointer-events: none; }
.w-top > * { pointer-events: auto; }
.w-top .eyebrow b { color: var(--amber); font-weight: 500; }
.w-title { font-size: clamp(30px, 3.4vw, 50px); line-height: .98; letter-spacing: -.035em; font-weight: 600; margin: 0; text-wrap: balance; }
.w-sub { margin: 0; color: var(--fg-2); font-size: 15px; line-height: 1.45; max-width: 36ch; }
.w-views { display: inline-flex; padding: 4px; border-radius: 999px; width: max-content; gap: 2px; }
.w-views button { font: 500 13px/1 var(--font); color: var(--fg-2); background: none; border: 0; padding: 0 14px; min-height: 36px; border-radius: 999px; cursor: pointer; transition: background .2s, color .2s; }
.w-views button:hover { color: var(--fg); }
.w-views button[aria-pressed="true"] { background: var(--fg); color: #0b0e12; }
.w-tele { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; margin: 0; padding: 12px 16px; border-radius: 14px; width: min(330px, 100%); font-size: 12px; }
.w-tele div { display: grid; gap: 3px; min-width: 0; }
.w-tele dt { color: var(--fg-3); text-transform: uppercase; letter-spacing: .12em; font-size: 10px; }
.w-tele dd { margin: 0; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- right: the conversation ---- */
.w-plan { position: absolute; right: clamp(12px, 1.6vw, 24px); top: clamp(12px, 1.6vw, 24px); bottom: clamp(12px, 1.6vw, 24px); width: min(400px, 34vw); border-radius: 22px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.45); }
.w-plan-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 12px; border-bottom: 1px solid var(--line); }
.w-status { margin: 0; display: flex; align-items: center; gap: 10px; font: 500 13px/1.2 var(--font); color: var(--fg-2); min-width: 0; }
.w-status span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-status i { width: 9px; height: 9px; border-radius: 50%; background: var(--ice); flex: none; box-shadow: 0 0 0 4px color-mix(in srgb, var(--ice) 18%, transparent); }
.w-status[data-state="think"] i, .w-status[data-state="busy"] i { background: var(--amber); box-shadow: 0 0 0 4px color-mix(in srgb, var(--amber) 22%, transparent); animation: wPulse 1.1s ease-in-out infinite; }
.w-status[data-state="listen"] i { background: var(--amber); animation: wPulse .7s ease-in-out infinite; }
.w-status[data-state="stop"] i { background: var(--bad); box-shadow: 0 0 0 4px color-mix(in srgb, var(--bad) 22%, transparent); }
.w-status[data-state="busy"] span, .w-status[data-state="think"] span { color: var(--fg); }
@keyframes wPulse { 50% { transform: scale(.7); opacity: .6; } }
.w-voice { font: 500 12px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--fg-3); background: none; border: 1px solid var(--line-2); border-radius: 999px; min-height: 30px; padding: 0 12px; cursor: pointer; }
.w-voice[aria-pressed="true"] { color: #0b0e12; background: var(--amber); border-color: var(--amber); }

.w-log { list-style: none; margin: 0; padding: 16px 16px 8px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; flex: 1; scrollbar-width: thin; }
.wmsg { max-width: 92%; width: fit-content; font-size: 15px; line-height: 1.45; animation: wIn .35s var(--ease); }
@keyframes wIn { from { opacity: 0; transform: translateY(6px); } }
.wmsg p { margin: 0; }
.wmsg.you { align-self: flex-end; background: color-mix(in srgb, var(--amber) 16%, transparent); border: 1px solid color-mix(in srgb, var(--amber) 34%, transparent); padding: 9px 14px; border-radius: 16px 16px 4px 16px; }
.wmsg.bot { align-self: stretch; max-width: 100%; display: flex; flex-direction: column; gap: 10px; }
.wmsg.bot > p::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--amber); margin-right: 9px; vertical-align: 1px; box-shadow: 0 0 10px var(--amber); }
.wmsg.refuse > p::before, .wmsg.unsure > p::before { background: var(--ice); box-shadow: 0 0 10px var(--ice); }
.wmsg.stop > p::before { background: var(--bad); box-shadow: 0 0 10px var(--bad); }
.wmsg .by { font: 11px/1.3 var(--mono); color: var(--fg-3); letter-spacing: .02em; }
.wmsg .by:empty { display: none; }

/* the plan: each step lights up as the robot does it */
.wsteps { list-style: none; counter-reset: s; margin: 0; padding: 4px 0 0 0; display: grid; gap: 2px; border-left: 1px solid var(--line-2); margin-left: 3px; }
.wsteps li { counter-increment: s; position: relative; padding: 6px 0 6px 30px; font-size: 14px; color: var(--fg-3); transition: color .3s; }
.wsteps li::before { content: counter(s, decimal-leading-zero); position: absolute; left: 12px; top: 8px; font: 10px/1 var(--mono); color: var(--fg-3); }
.wsteps li::after { content: ''; position: absolute; left: -4.5px; top: 11px; width: 8px; height: 8px; border-radius: 50%; background: #0a0d12; border: 1px solid var(--line-2); transition: .3s; }
.wsteps li[data-state="active"] { color: var(--fg); }
.wsteps li[data-state="active"]::after { background: var(--amber); border-color: var(--amber); box-shadow: 0 0 0 4px color-mix(in srgb, var(--amber) 22%, transparent); animation: wPulse 1s ease-in-out infinite; }
.wsteps li[data-state="done"] { color: var(--fg-2); }
.wsteps li[data-state="done"]::after { background: var(--ice); border-color: var(--ice); }
.wsteps li[data-state="failed"] { color: var(--bad); }
.wsteps li[data-state="failed"]::after { background: var(--bad); border-color: var(--bad); }
.wsteps li[data-state="cancelled"] { text-decoration: line-through; opacity: .55; }
.wsteps li em { display: block; font-style: normal; font-size: 13px; color: var(--fg-2); margin-top: 2px; }

.w-chips { display: flex; gap: 6px; padding: 8px 16px 4px; overflow-x: auto; scrollbar-width: none; mask-image: linear-gradient(90deg, #000 85%, transparent); }
.w-chips::-webkit-scrollbar { display: none; }
.wchip { flex: none; font: 500 13px/1 var(--font); color: var(--fg); background: color-mix(in srgb, var(--fg) 6%, transparent); border: 1px solid var(--line-2); border-radius: 999px; min-height: 34px; padding: 0 13px; cursor: pointer; transition: border-color .2s, background .2s; }
.wchip:hover, .wchip:focus-visible { border-color: var(--amber); background: color-mix(in srgb, var(--amber) 12%, transparent); }

.w-cmd { display: flex; align-items: center; gap: 6px; margin: 8px 12px 0; padding: 5px 5px 5px 16px; border-radius: 999px; background: color-mix(in srgb, var(--fg) 7%, transparent); border: 1px solid var(--line-2); transition: border-color .2s, box-shadow .2s; }
.w-cmd:focus-within { border-color: var(--amber); box-shadow: 0 0 0 4px color-mix(in srgb, var(--amber) 16%, transparent); }
.w-cmd input { flex: 1; min-width: 0; background: none; border: 0; color: var(--fg); font: 16px/1.2 var(--font); min-height: 40px; outline: none; }
.w-cmd input::placeholder { color: var(--fg-3); }
.w-cmd button { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; background: none; color: var(--fg-2); }
.w-cmd button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.w-cmd .w-send { background: var(--fg); color: #0b0e12; }
.w-cmd .w-mic[aria-pressed="true"] { color: #0b0e12; background: var(--amber); animation: wPulse 1s infinite; }
.w-stop { margin: 10px 12px 0; min-height: 48px; border-radius: 14px; border: 1px solid color-mix(in srgb, var(--bad) 55%, transparent); background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--fg); font: 600 15px/1 var(--font); display: flex; align-items: center; justify-content: center; gap: 10px; cursor: pointer; transition: background .2s; }
.w-stop:hover { background: color-mix(in srgb, var(--bad) 26%, transparent); }
.w-stop span { width: 12px; height: 12px; border-radius: 3px; background: var(--bad); }
.w-stop kbd { font: 11px/1 var(--mono); color: var(--fg-3); border: 1px solid var(--line-2); border-radius: 5px; padding: 3px 5px; }
.w-note { margin: 10px 16px 14px; font-size: 12px; line-height: 1.45; color: var(--fg-3); }

/* ---- labels in the scene ---- */
.wl { position: absolute; left: 0; top: 0; will-change: transform; }
.wl.tag { font: 500 11px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ice); background: rgba(5,6,8,.78); border: 1px solid color-mix(in srgb, var(--ice) 40%, transparent); padding: 5px 8px; border-radius: 999px; white-space: nowrap; }
.wl.tag.hot { color: #0b0e12; background: var(--amber); border-color: var(--amber); }
.wl.tag.you { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 55%, transparent); }
.wl.place { font: 500 10px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--fg-3); white-space: nowrap; }
.wl.det { border: 1.5px solid color-mix(in srgb, var(--ice) 85%, transparent); border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.25); }
.wl.det span { position: absolute; left: -1.5px; bottom: 100%; margin-bottom: 4px; white-space: nowrap; font: 500 11px/1 var(--mono); color: #0b0e12; background: var(--ice); padding: 4px 6px; border-radius: 3px; }
.wl.det span b { font-weight: 600; }
.wl.det.hot { border-color: var(--amber); box-shadow: 0 0 24px color-mix(in srgb, var(--amber) 40%, transparent); }
.wl.det.hot span { background: var(--amber); }
.wl.det.person { border-style: dashed; }

/* ---- the robot's eyes: a camera frame over the stage ---- */
.w-pov { position: absolute; inset: 0; pointer-events: none; z-index: 1; opacity: 0; transition: opacity .4s; }
.world[data-view="pov"] .w-pov { opacity: 1; }
.w-pov::before { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, rgba(147,203,226,.035) 0 1px, transparent 1px 3px), radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.55)); }
.w-pov .c { position: absolute; width: 34px; height: 34px; border: 2px solid rgba(147,203,226,.7); }
.w-pov .tl { left: 24px; top: 24px; border-right: 0; border-bottom: 0; } .w-pov .tr { right: calc(min(400px, 34vw) + 48px); top: 24px; border-left: 0; border-bottom: 0; }
.w-pov .bl { left: 24px; bottom: 24px; border-right: 0; border-top: 0; } .w-pov .br { right: calc(min(400px, 34vw) + 48px); bottom: 24px; border-left: 0; border-top: 0; }
.w-pov .cross { position: absolute; left: calc((100% - min(400px, 34vw) - 24px) / 2); top: 50%; width: 22px; height: 22px; transform: translate(-50%, -50%); border: 1.5px solid rgba(147,203,226,.6); border-radius: 50%; }
.w-pov-cap { position: absolute; left: 24px; bottom: 66px; margin: 0; color: var(--fg-2); text-transform: uppercase; letter-spacing: .14em; font-size: 11px; }
.w-pov-cap b { color: var(--ice); font-weight: 500; }
.world:is([data-view="pov"], [data-view="map"]) :is(.w-sub, .w-title) { display: none; }
.world[data-view="pov"] .w-top { gap: 10px; }

/* ---- the map's legend ---- */
.w-legend { position: absolute; left: clamp(16px, 2.4vw, 32px); bottom: 84px; display: none; align-items: center; gap: 8px 10px; flex-wrap: wrap; padding: 10px 14px; border-radius: 12px; font-size: 11px; color: var(--fg-2); max-width: min(560px, calc(100% - min(400px, 34vw) - 80px)); }
.world[data-view="map"] .w-legend { display: flex; }
.w-legend .k { width: 14px; height: 10px; border-radius: 2px; display: inline-block; margin-left: 6px; }
.w-legend .k:first-child { margin-left: 0; }
.w-legend .grown { background: rgba(147,203,226,.35); } .w-legend .seen { background: rgba(242,182,90,.4); }
.w-legend .path { height: 0; border-top: 2px dashed var(--ice); }

/* ---- no WebGL ---- */
.w-nogl { display: none; position: absolute; inset: 0; place-content: center; text-align: center; gap: 18px; padding: 24px; z-index: 4; }
.world.no-gl .w-nogl { display: grid; }
.world.no-gl .w-plan, .world.no-gl .w-views, .world.no-gl .w-tele { display: none; }

/* ---- still mode: nothing pulses ---- */
html.a11y-still .world *, html.a11y-still .world *::before, html.a11y-still .world *::after { animation: none !important; transition: none !important; }

/* ---- narrow screens: the conversation becomes a sheet at the bottom ---- */
@media (max-width: 860px) {
  .world { height: calc(100svh - 64px); min-height: 640px; }
  .w-top { max-width: calc(100% - 32px); gap: 10px; }
  .w-sub, .w-tele { display: none; }
  .w-title { font-size: 28px; }
  .w-plan { left: 10px; right: 10px; top: auto; bottom: 10px; width: auto; height: min(50svh, 470px); border-radius: 20px; }
  .w-note { display: none; }
  .w-pov .tr, .w-pov .br { right: 24px; }
  .w-pov .bl, .w-pov .br { bottom: calc(min(50svh, 470px) + 34px); }
  .w-pov .cross { left: 50%; top: calc((100% - min(50svh, 470px)) / 2); }
  .w-pov-cap { bottom: calc(min(50svh, 470px) + 76px); }
  .w-legend { bottom: calc(min(50svh, 470px) + 22px); max-width: calc(100% - 32px); }
  .a11y-btn { bottom: calc(min(50svh, 470px) + 22px) !important; }
}
