/* Kiosk page (templates/index.html). Builds on sphere.css tokens.

   Desktop >= 1180px: guide | route (map + steps) | chat
   900-1179px:        route | guide strip over chat
   < 900px:           one column (finder, map, steps); the guide floats as a
                      button that opens the chat as a bottom sheet. */

html, body { height: 100%; }
/* The kiosk fills exactly one screen, but never shrinks below a usable size:
   on a short window (or with browser zoom) the page scrolls instead of cutting
   off the mic, the map controls or the chat box. */
body.kiosk { overflow-x: hidden; overflow-y: auto; }

.shell {
  position: relative; z-index: var(--z-app);
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100dvh; min-height: 720px; padding-bottom: var(--osk-h, 0px);
}

.stage {
  display: grid; gap: 16px; padding: 16px; min-height: 0;
  grid-template-columns: minmax(236px, 270px) minmax(0, 1fr) minmax(300px, 350px);
  grid-template-areas: "guide route chat";
}
/* a gutter on the right for the floating feedback tab */
@media (min-width: 900px) { .stage { padding-right: 44px; } }
@media (min-width: 1600px) {
  .stage { gap: 20px; padding: 20px 48px 20px 20px; grid-template-columns: 330px minmax(0, 1fr) 420px; }
}

/* ── Guide column ───────────────────────────────────────────────────── */
.col-guide {
  grid-area: guide; min-height: 0;
  display: flex; flex-direction: column; align-items: stretch; gap: 14px;
  padding: 18px; overflow-x: hidden; overflow-y: auto;
}
.guide-fig {
  position: relative; flex: 1 1 auto; min-height: 150px;
  border-radius: 16px; overflow: hidden; cursor: pointer;
  background:
    radial-gradient(70% 60% at 50% 38%, var(--cobalt-wash), transparent 70%),
    linear-gradient(180deg, transparent 55%, var(--panel-2));
  -webkit-tap-highlight-color: transparent;
}
.guide-halo {
  position: absolute; left: 50%; top: 38%; width: 70%; aspect-ratio: 1; translate: -50% -50%;
  border-radius: 50%; border: 1px solid var(--line-2); pointer-events: none;
}
.guide-halo::before, .guide-halo::after {
  content: ''; position: absolute; inset: -14%; border-radius: 50%; border: 1px dashed var(--line-2);
  animation: haloSpin 60s linear infinite;
}
.guide-halo::after { inset: 12%; border-style: solid; border-color: var(--cobalt-wash); animation-duration: 0s; }
@keyframes haloSpin { to { transform: rotate(1turn); } }
.char-img {
  position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 100%;
  object-fit: contain; object-position: 50% 100%;
  opacity: 0; transition: opacity .35s var(--ease-out);
  -webkit-mask-image: linear-gradient(180deg, #000 78%, transparent 99%);
          mask-image: linear-gradient(180deg, #000 78%, transparent 99%);
  pointer-events: none;
}
.char-img.active { opacity: 1; }
.guide-fig.floating .char-img.active { animation: charFloat 4s var(--ease-in-out) infinite; }
@keyframes charFloat { 50% { transform: translateY(-6px); } }
.guide-fig.speaking .char-img.active { animation: charTalk .5s var(--ease-in-out) infinite alternate; }
@keyframes charTalk { to { transform: translateY(-2px) scale(1.006); } }

.guide-id { display: grid; gap: 2px; }
.guide-name { font: 800 1.125rem/1.2 var(--font-display); font-stretch: 112%; }
.guide-state { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-weight: 500; font-size: .9375rem; min-height: 1.5em; }
.guide-state .pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.guide-state[data-mode="busy"] .pulse { background: var(--cobalt); }
.guide-state[data-mode="rec"] .pulse { background: var(--stop); }

/* waveform: bars idle as a flat line, breathe while listening/speaking */
.wave { display: flex; align-items: center; justify-content: center; gap: 3px; height: 36px; }
.wave i {
  display: block; width: 4px; height: 100%; border-radius: 4px; background: var(--cobalt);
  transform: scaleY(.12); transform-origin: 50% 50%; opacity: .55;
  transition: transform .3s var(--ease-out), opacity .3s, background-color .3s;
}
.wave[data-mode="rec"] i, .wave[data-mode="speak"] i { opacity: 1; animation: waveBar .9s var(--ease-in-out) infinite alternate; animation-delay: calc(var(--b) * -73ms); }
.wave[data-mode="rec"] i { background: var(--stop); }
.wave[data-mode="busy"] i { opacity: .9; animation: waveBusy 1.1s var(--ease-in-out) infinite; animation-delay: calc(var(--b) * 45ms); }
@keyframes waveBar { 0% { transform: scaleY(.15); } 100% { transform: scaleY(var(--h, .8)); } }
@keyframes waveBusy { 0%, 100% { transform: scaleY(.12); } 30% { transform: scaleY(.55); } }

.mic-wrap { display: grid; justify-items: center; gap: 8px; }
.mic-btn {
  position: relative; width: 76px; height: 76px; border-radius: 50%; border: 0;
  display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, var(--cobalt-2), var(--cobalt));
  color: var(--on-cobalt);
  box-shadow: 0 10px 28px rgba(51, 96, 240, .38), inset 0 1px 0 rgba(255, 255, 255, .35);
  transition: transform var(--t-fast) var(--ease-out), box-shadow var(--t-base);
  touch-action: none; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none;
}
.mic-btn svg { width: 30px; height: 30px; }
.mic-btn:active { transform: scale(.93); }
.mic-btn::before, .mic-btn::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--cobalt);
  opacity: 0; pointer-events: none;
}
.mic-btn.recording { background: radial-gradient(circle at 35% 30%, #ff8593, var(--stop)); box-shadow: 0 10px 28px rgba(196, 43, 61, .4); }
.mic-btn.recording::before, .mic-btn.recording::after { border-color: var(--stop); animation: micRing 1.4s var(--ease-out) infinite; }
.mic-btn.recording::after { animation-delay: .7s; }
.mic-btn.speaking::before { animation: micRing 1.8s var(--ease-out) infinite; }
@keyframes micRing { from { transform: scale(1); opacity: .6; } to { transform: scale(1.7); opacity: 0; } }
.mic-hint { font-size: .875rem; color: var(--text-3); font-weight: 500; text-align: center; }

.guide-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.guide-lang { display: grid; gap: 8px; }
.guide-lang .seg { width: 100%; }
.guide-lang .seg button { min-width: 0; }

/* voice on/off switch: the thumb slides, the speaker icon morphs */
.switch {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 4px 0 0;
  border: 0; background: none; color: var(--text); font-weight: 600; font-size: .9375rem;
  -webkit-tap-highlight-color: transparent;
}
.switch-track {
  position: relative; width: 52px; height: 30px; border-radius: 999px; flex: none;
  background: var(--line-2); transition: background-color var(--t-base) var(--ease-out);
}
.switch-thumb {
  position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
  display: grid; place-items: center; color: var(--text-3);
  transition: transform var(--t-slow) var(--ease-spring), color var(--t-base);
}
.switch-thumb svg { width: 14px; height: 14px; }
.switch[aria-checked="true"] .switch-track { background: var(--cobalt); }
.switch[aria-checked="true"] .switch-thumb { transform: translateX(22px); color: var(--cobalt); }
.switch .sw-wave { transition: opacity var(--t-base), transform var(--t-base) var(--ease-out); transform-origin: 8px 12px; }
.switch[aria-checked="false"] .sw-wave { opacity: 0; transform: scale(.5); }
.switch .sw-x { opacity: 0; transition: opacity var(--t-base); }
.switch[aria-checked="false"] .sw-x { opacity: 1; }

/* ── Route column ───────────────────────────────────────────────────── */
.col-route {
  grid-area: route; min-width: 0; min-height: 0;
  display: grid; gap: 14px;
  grid-template-rows: auto minmax(0, 1fr);
  container-type: inline-size;
}

.finder { padding: 12px; display: grid; gap: 12px; }
.search { position: relative; display: flex; gap: 10px; align-items: center; }
.search-field { position: relative; flex: 1; min-width: 0; }
.search-field svg.s-ico { position: absolute; left: 16px; top: 50%; translate: 0 -50%; width: 20px; height: 20px; color: var(--text-3); pointer-events: none; }
.search-input {
  width: 100%; min-height: 52px; padding: 0 16px 0 46px;
  border-radius: 14px; border: 1px solid var(--line-2); background: var(--panel-solid);
  font-size: 1.0625rem; font-weight: 500; color: var(--text);
  transition: border-color var(--t-base), box-shadow var(--t-base);
}
.search-input::placeholder { color: var(--text-3); }
.search-input:focus-visible { outline: none; border-color: var(--amber); box-shadow: 0 0 0 4px var(--amber-wash); }
.search .btn { min-height: 52px; padding: 0 20px; }
.search .btn-reset { width: 52px; padding: 0; }

.search-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: var(--z-float);
  list-style: none; margin: 0; padding: 6px; max-height: 340px; overflow-y: auto;
  background: var(--panel-solid); border-radius: 16px; border: 1px solid var(--line);
  box-shadow: var(--shadow-3);
  transform-origin: 50% 0; animation: popIn .22s var(--ease-out);
}
@keyframes popIn { from { opacity: 0; transform: translateY(-6px) scale(.98); } }
.search-results[hidden] { display: none; }
.sr-item {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 12px; border-radius: 12px; cursor: pointer; min-height: 48px;
  transition: background-color var(--t-fast);
}
.sr-item:hover, .sr-item.active { background: var(--amber-wash); }
.sr-name { font-weight: 700; color: var(--text); }
.sr-floor { font-size: .875rem; font-weight: 600; color: var(--text-3); }
.sr-empty { padding: 12px; font-size: .9375rem; color: var(--text-2); }
.status-badge {
  margin-left: auto; padding: 4px 10px; border-radius: 8px;
  font-size: .8125rem; font-weight: 700; white-space: nowrap;
}
.status-closed { background: var(--stop-wash); color: var(--stop); }
.status-under_construction { background: var(--warn-wash); color: var(--warn); }

/* destination board: flap name + kinetic line + stats */
.dest { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 2px 4px 4px; }
.dest[hidden] { display: none; }
.dest-main { min-width: 0; display: grid; gap: 6px; container-type: inline-size; }
.dest-flap { --tile-w: min(26px, calc((100cqw - (var(--n, 12) - 1) * 3px) / var(--n, 12))); --tile-h: calc(var(--tile-w) * 1.42); --tile-fs: calc(var(--tile-w) * .78); max-width: 100%; }
.dest-sub { font: 600 1rem/1.35 var(--font-body); color: var(--text-2); min-height: 1.35em; overflow-wrap: anywhere; }
.dest-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 6px; margin: 0; }
.stat {
  display: grid; gap: 2px; padding: 10px 12px; border-radius: 12px;
  background: var(--panel-2); border: 1px solid var(--line); min-width: 0;
}
.stat dt { font-size: .75rem; font-weight: 600; color: var(--text-3); white-space: nowrap; }
.stat dd { margin: 0; font: 800 1rem/1.25 var(--font-display); font-stretch: 106%; font-variant-numeric: tabular-nums; text-wrap: balance; }
.stat.hot { background: var(--amber); border-color: transparent; }
.stat.hot dt { color: rgba(255, 255, 255, .8); }
.stat.hot dd { color: var(--on-amber); }

.dest-empty { display: flex; align-items: center; gap: 12px; padding: 4px 6px; color: var(--text-2); font-weight: 500; }
.dest-empty svg { width: 22px; height: 22px; color: var(--amber-ink); flex: none; }
.dest-empty[hidden] { display: none; }

.route-body { min-height: 0; display: grid; gap: 14px; grid-template-rows: minmax(0, 1fr) auto; }
/* steps sit beside the map whenever the route column is wide enough */
@container (min-width: 540px) {
  .route-body.has-route { grid-template-rows: none; grid-template-columns: minmax(0, 1fr) clamp(230px, 36cqw, 330px); }
  .route-body.has-route .steps { max-height: none; }
}

.map-card { position: relative; min-height: 220px; display: flex; flex-direction: column; overflow: hidden; padding: 0; }
.map-card .map-container { flex: 1; min-height: 0; }
.map-error { padding: 24px 16px; text-align: center; font-weight: 600; color: var(--text-2); }
.closure-banner {
  flex-shrink: 0; padding: 10px 16px; background: var(--warn-wash); color: var(--warn);
  border-bottom: 1px solid var(--line); font-size: .9375rem; font-weight: 700; line-height: 1.45;
}
.closure-banner p + p { margin-top: 2px; }
.map-card.is-full {
  position: fixed; inset: 12px; z-index: var(--z-sheet); min-height: 0;
  animation: maxIn .3s var(--ease-out);
}
@keyframes maxIn { from { transform: scale(.96); opacity: .6; } }
body.map-max::before { content: ''; position: fixed; inset: 0; z-index: calc(var(--z-sheet) - 1); background: rgba(6, 10, 20, .5); }

.steps { padding: 16px 14px 12px; display: grid; gap: 12px; max-height: 190px; min-height: 0; grid-template-rows: auto minmax(0, 1fr); align-content: start; }
.steps[hidden] { display: none; }
.steps-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.steps-head h2 { font-size: 1.0625rem; font-stretch: 108%; }
.steps-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.steps-actions .btn { min-height: 40px; padding: 0 14px; font-size: .875rem; }
.step-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; align-content: start; overflow-y: auto; min-height: 0; }
.step-list li {
  display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 12px; align-items: start;
  padding: 8px 6px; border-radius: 10px; font-weight: 500; line-height: 1.45;
  opacity: 0; transform: translateX(-10px); animation: stepIn .35s var(--ease-out) forwards;
  animation-delay: calc(min(var(--d, 0), 8) * 40ms + 80ms);
}
.step-list li:last-child .step-n { background: var(--amber); color: var(--on-amber); }
@keyframes stepIn { to { opacity: 1; transform: none; } }
.step-n {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
  background: var(--ink-band); color: var(--flap-ink); font: 700 .875rem/1 var(--font-mono);
}

/* ── Chat column ────────────────────────────────────────────────────── */
.col-chat {
  grid-area: chat; min-height: 0;
  display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto auto; overflow: hidden;
}
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 10px; }
.chat-head h2 { font-size: 1.125rem; display: flex; align-items: center; gap: 10px; }
.chat-head h2 .dot { width: 10px; height: 10px; border-radius: 3px; background: var(--cobalt); transform: rotate(45deg); }
.sheet-close { display: none; }
.thread {
  overflow-y: auto; padding: 4px 16px 12px; display: flex; flex-direction: column; gap: 10px;
  overscroll-behavior: contain; scroll-behavior: smooth;
}
.msg { max-width: 92%; animation: msgIn .35s var(--ease-out); }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px); } }
.msg.user {
  align-self: flex-end; padding: 10px 14px; border-radius: 16px 16px 4px 16px;
  background: var(--text); color: var(--ground); font-weight: 600; line-height: 1.45; overflow-wrap: anywhere;
}
.msg.bot {
  align-self: flex-start; padding: 12px 14px; border-radius: 4px 16px 16px 16px;
  background: var(--panel-solid); border: 1px solid var(--line); box-shadow: var(--shadow-1);
}
.msg-who { display: flex; align-items: center; gap: 6px; font-size: .75rem; font-weight: 700; color: var(--cobalt-ink); margin-bottom: 4px; }
.msg-who::before { content: ''; width: 7px; height: 7px; border-radius: 2px; background: var(--cobalt); transform: rotate(45deg); }
.msg-text { white-space: pre-line; overflow-wrap: anywhere; line-height: 1.5; font-weight: 500; }
.msg-meta { margin-top: 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .8125rem; color: var(--text-3); }
.msg-meta .conf { font-family: var(--font-mono); font-size: .75rem; }
.thumbs { display: inline-flex; gap: 6px; margin-left: auto; }
.thumb {
  min-height: 36px; min-width: 44px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line-2);
  background: transparent; color: var(--text-2); font-size: .8125rem; font-weight: 600;
  transition: background-color var(--t-fast), transform var(--t-fast) var(--ease-out);
}
.thumb:hover { background: var(--panel-2); }
.thumb:active { transform: scale(.94); }
.fb-done { color: var(--ok); font-weight: 600; }
.welcome-greet { font: 800 1.375rem/1.2 var(--font-display); font-stretch: 112%; margin-bottom: 4px; }
.welcome-sub { color: var(--text-2); font-weight: 500; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.thinking { display: inline-flex; gap: 5px; padding: 4px 0; }
.thinking span { width: 8px; height: 8px; border-radius: 50%; background: var(--cobalt); animation: think .9s var(--ease-in-out) infinite; }
.thinking span:nth-child(2) { animation-delay: .15s; }
.thinking span:nth-child(3) { animation-delay: .3s; }
@keyframes think { 0%, 80%, 100% { transform: scale(.7); opacity: .4; } 40% { transform: scale(1.1); opacity: 1; } }

.composer { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); }
.composer input {
  flex: 1; min-width: 0; min-height: 48px; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--line-2); background: var(--panel-solid); font-size: 1rem; font-weight: 500;
}
.composer input::placeholder { color: var(--text-3); }
.composer input:focus-visible { outline: none; border-color: var(--cobalt); box-shadow: 0 0 0 4px var(--cobalt-wash); }
.composer .btn { min-height: 48px; }
.composer .mic-mini { display: none; }

.chat-foot { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 0 12px 12px; }
.room-status, .qr-card { border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line); padding: 12px; min-width: 0; }
.room-status h3, .qr-card h3 { font: 700 .875rem/1.2 var(--font-body); color: var(--text-2); margin-bottom: 8px; letter-spacing: 0; }
.rs-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rs-list li { display: grid; gap: 1px; font-size: .875rem; line-height: 1.35; }
.rs-list b { font-weight: 700; overflow-wrap: anywhere; }
.rs-tag { font-size: .75rem; font-weight: 700; }
.rs-tag.closed { color: var(--stop); }
.rs-tag.under_construction { color: var(--warn); }
.rs-ok { display: flex; align-items: center; gap: 8px; font-size: .875rem; font-weight: 600; color: var(--ok); }
.rs-ok svg { width: 18px; height: 18px; flex: none; }
.qr-card { width: 128px; display: grid; justify-items: center; align-content: start; gap: 6px; text-align: center; }
.qr-card h3 { margin: 0; }
.qr-btn {
  width: 92px; height: 92px; padding: 6px; border-radius: 10px; border: 0; background: #fff;
  display: grid; place-items: center; box-shadow: var(--shadow-1);
  transition: transform var(--t-fast) var(--ease-out);
}
.qr-btn img { width: 100%; height: 100%; image-rendering: pixelated; }
.qr-btn[disabled] { background: var(--panel-solid); cursor: default; box-shadow: none; border: 1px dashed var(--line-2); }
.qr-btn svg { width: 34px; height: 34px; color: var(--text-3); }
.qr-note { font-size: .75rem; color: var(--text-3); line-height: 1.3; }

/* QR enlarge dialog */
.qr-dialog { width: min(380px, calc(100vw - 32px)); padding: 24px; border: 1px solid var(--line); border-radius: 22px; background: var(--panel-solid); color: var(--text); text-align: center; box-shadow: var(--shadow-3); }
.qr-dialog::backdrop { background: rgba(6, 10, 20, .55); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.qr-dialog[open] { animation: dlgIn var(--t-slow) var(--ease-out); }
.qr-dialog h2 { font-size: 1.375rem; margin-bottom: 14px; }
.qr-dialog img { width: 240px; height: 240px; margin: 0 auto; image-rendering: pixelated; background: #fff; padding: 10px; border-radius: 12px; }
.qr-dialog p { margin: 12px 0 18px; color: var(--text-2); }

@media (hover: hover) and (pointer: fine) {
  .mic-btn:hover { transform: translateY(-2px) scale(1.03); }
  .qr-btn:not([disabled]):hover { transform: scale(1.04); }
}

/* ── Mobile: chat FAB + bottom sheet ────────────────────────────────── */
.chat-fab, .sheet-scrim { display: none; }

/* ── On-screen keyboard ─────────────────────────────────────────────── */
.osk {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-keyboard);
  padding: 10px max(16px, calc((100vw - 1100px) / 2)) 14px;
  background: var(--ink-band); border-top: 2px solid var(--amber);
  box-shadow: 0 -16px 40px rgba(5, 10, 20, .35);
  transform: translateY(105%); transition: transform .3s var(--ease-out);
  display: grid; gap: 8px; user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
.osk[hidden] { display: none; }
.osk-open .osk { transform: none; }
.osk-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 36px; }
.osk-note { color: var(--on-band-2); font-size: .875rem; }
.osk-close { width: 56px; height: 36px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, .08); color: var(--on-band); display: grid; place-items: center; }
.osk-close svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.osk-row { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.osk-key {
  min-height: 58px; border: 0; border-radius: 12px;
  background: var(--flap-bg); color: var(--on-band); font: 600 1.375rem/1 var(--font-mono);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), 0 2px 0 rgba(0, 0, 0, .4);
  transition: transform 80ms var(--ease-out), background-color 80ms;
}
.osk-key svg { width: 26px; height: 26px; margin: auto; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.osk-key.down { transform: translateY(2px) scale(.97); background: var(--ink-band-2); }
.osk-space { grid-column: span 7; font: 600 1rem/1 var(--font-body); color: var(--on-band-2); }
.osk-enter { grid-column: span 3; background: var(--amber); color: var(--on-amber); font: 800 1.125rem/1 var(--font-display); }
.osk-row:last-child { grid-template-columns: 7fr 3fr; grid-auto-flow: row; }

/* ── 900-1179px: guide strip on top of the chat column ──────────────── */
@media (max-width: 1179px) and (min-width: 900px) {
  .stage {
    grid-template-columns: minmax(0, 1fr) 340px;
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas: "route guide" "route chat";
  }
  .col-guide { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; grid-template-areas: "fig id mic" "fig lang lang"; gap: 8px 12px; padding: 12px; align-items: center; }
  .guide-fig { grid-area: fig; min-height: 0; height: 112px; }
  .guide-id { grid-area: id; }
  .wave, .mic-hint, .guide-row { display: none; }
  .mic-wrap { grid-area: mic; }
  .mic-btn { width: 56px; height: 56px; }
  .mic-btn svg { width: 24px; height: 24px; }
  .guide-lang { grid-area: lang; }
  .guide-lang .label { display: none; }
  .guide-halo { display: none; }
}

/* ── < 900px: phones and portrait tablets ───────────────────────────── */
@media (max-width: 899px) {
  html, body { height: auto; }
  body.kiosk { overflow: visible; }
  .shell { height: auto; min-height: 100dvh; padding-bottom: 0; z-index: auto; }
  .sheet-open .chat-fab, .sheet-open .fb-tab { visibility: hidden; }
  .stage { display: block; padding: 12px 12px 96px; }
  .col-guide { display: none; }
  .col-route { display: grid; grid-template-rows: none; gap: 12px; }
  .finder { padding: 10px; }
  .search { flex-wrap: nowrap; }
  .search .btn-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .search .btn { padding: 0; width: 52px; }
  .dest { grid-template-columns: 1fr; }
  .dest-stats { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .route-body { grid-template-rows: none; }
  .map-card { height: 62svh; min-height: 340px; }
  .steps { max-height: none; }
  .step-list { overflow: visible; }

  .chat-fab {
    position: fixed; right: 14px; bottom: 16px; z-index: var(--z-float);
    display: grid; place-items: center; width: 64px; height: 64px; padding: 0; border-radius: 50%;
    border: 3px solid var(--cobalt); background: var(--panel-solid); overflow: hidden;
    box-shadow: 0 10px 28px rgba(51, 96, 240, .4);
    transition: transform var(--t-fast) var(--ease-out);
  }
  .chat-fab:active { transform: scale(.92); }
  .chat-fab canvas { width: 100%; height: 100%; object-fit: cover; }
  .chat-fab .fab-badge {
    position: absolute; right: 2px; bottom: 2px; width: 22px; height: 22px; border-radius: 50%;
    background: var(--cobalt); color: var(--on-cobalt); display: grid; place-items: center;
    box-shadow: 0 0 0 2px var(--panel-solid);
  }
  .chat-fab .fab-badge svg { width: 12px; height: 12px; }
  .chat-fab[data-mode="rec"] { border-color: var(--stop); }
  .chat-fab[data-mode="busy"] { animation: fabBusy 1s var(--ease-in-out) infinite alternate; }
  @keyframes fabBusy { to { box-shadow: 0 10px 34px rgba(51, 96, 240, .7); } }

  .col-chat {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-sheet);
    height: min(86dvh, 720px); border-radius: 22px 22px 0 0;
    background: var(--panel-solid);
    transform: translateY(105%); visibility: hidden;
    transition: transform .38s var(--ease-out), visibility 0s .38s;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .sheet-open .col-chat { transform: none; visibility: visible; transition: transform .38s var(--ease-out); }
  .col-chat::before { content: ''; position: absolute; top: 8px; left: 50%; width: 42px; height: 5px; margin-left: -21px; border-radius: 3px; background: var(--line-2); }
  .chat-head { padding-top: 20px; }
  .sheet-close { display: inline-flex; }
  .sheet-scrim { display: block; position: fixed; inset: 0; z-index: calc(var(--z-sheet) - 1); background: rgba(6, 10, 20, .5); opacity: 0; pointer-events: none; transition: opacity .3s; }
  .sheet-open .sheet-scrim { opacity: 1; pointer-events: auto; }
  .composer .mic-mini { display: inline-flex; }
  .chat-foot { grid-template-columns: 1fr; }
  .qr-card { display: none; }
  .fb-tab { bottom: 24px; }
  .ticker { height: 44px; }
}
@media (max-width: 420px) {
  .dest-stats .stat { padding: 8px 10px; }
  .stat dd { font-size: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  .guide-halo::before, .guide-fig.floating .char-img.active, .guide-fig.speaking .char-img.active,
  .wave i, .mic-btn::before, .mic-btn::after, .thinking span, .chat-fab { animation: none !important; }
  .wave[data-mode="rec"] i, .wave[data-mode="speak"] i { transform: scaleY(.5); }
  .step-list li { animation: stepFade .3s ease forwards; transform: none; animation-delay: 0s; }
  .msg { animation: none; }
  .osk, .col-chat { transition: none; }
}
@keyframes stepFade { to { opacity: 1; } }

/* small transitions so state changes never teleport */
.steps:not([hidden]) { animation: panelSlide .3s var(--ease-out); }
@keyframes panelSlide { from { opacity: 0; transform: translateX(12px); } }
.qr-btn img { animation: qrIn .25s var(--ease-out); }
@keyframes qrIn { from { opacity: 0; transform: scale(.96); } }
@media (prefers-reduced-motion: reduce) {
  .steps:not([hidden]) { animation: fadeOnly .2s ease; }
  .qr-btn img { animation: fadeOnly .2s ease; }
}
@keyframes fadeOnly { from { opacity: 0; } }

/* ── Calm pass: fewer boxes, less motion at rest ────────────────────── */
.col-guide { background: none; border: 0; box-shadow: none; padding: 8px 4px; }
.guide-fig { background: radial-gradient(60% 40% at 50% 96%, var(--cobalt-wash), transparent 70%); border-radius: 0; }
.guide-fig .char-img { -webkit-mask-image: linear-gradient(180deg, #000 82%, transparent 100%); mask-image: linear-gradient(180deg, #000 82%, transparent 100%); }
.guide-name { font-size: 1.25rem; }
/* the waveform only exists while listening or speaking */
.wave { transition: opacity .25s var(--ease-out); }
.wave[data-mode="idle"] { opacity: 0; }

/* one quiet line for room status instead of two cards */
.rs-line {
  display: flex; align-items: center; gap: 8px; margin: 0; padding: 0 16px 14px;
  font-size: .875rem; font-weight: 500; color: var(--text-3); min-height: 24px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rs-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.rs-line.has-closure { color: var(--text-2); }
.rs-line.has-closure .rs-dot { background: var(--warn); }

/* calm footer: one static line, no marquee */
.kiosk .ticker { height: 36px; border-top-width: 1px; font-size: .8125rem; }
.kiosk .ticker-view { -webkit-mask: none; mask: none; padding-left: 8px; }
.kiosk .ticker-track { animation: none; }
.kiosk .ticker-item b { font-weight: 600; }
