/* MAN JARVIS — AI Voice Core interface. Reuses dashboard.html's :root
   tokens (--bg, --border, --accent, ...). The hero AI Core is a canvas
   animated by jarvis.js; this file handles layout, chat and controls. */

.jv-root {
  --neon: #ffe600;
  --neon-soft: rgba(255, 230, 0, 0.14);
  --glass: rgba(12, 15, 21, 0.72);
  color: var(--text);
  background:
    radial-gradient(ellipse 60% 55% at 38% 42%, rgba(255, 214, 0, 0.07), transparent 70%),
    radial-gradient(ellipse 80% 60% at 50% 110%, rgba(56, 189, 248, 0.05), transparent 70%),
    #05070b;
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; font-size: 14px;
}

.jv-header { display: flex; align-items: center; gap: 12px; padding: 12px 22px; border-bottom: 1px solid rgba(255, 230, 0, 0.12); background: rgba(5, 7, 11, 0.85); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 5; }
.jv-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 15px; letter-spacing: 0.06em; white-space: nowrap; }
.jv-brand img { width: 30px; height: 30px; border-radius: 8px; }
.jv-brand b { color: var(--neon); }
.jv-header-actions { margin-left: auto; display: flex; gap: 8px; }
.jv-header button { font: inherit; background: var(--glass); border: 1px solid var(--border); color: var(--text); padding: 8px 14px; border-radius: 10px; cursor: pointer; font-size: 12.5px; }
.jv-header button:hover { border-color: var(--neon); }

/* ---------- Layout: AI Core stage + side chat ---------- */
.jv-main { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 380px; }
.jv-stage { position: relative; display: flex; flex-direction: column; align-items: center; min-height: 0; padding: 12px 20px 18px; gap: 8px; }
.jv-chat { display: flex; flex-direction: column; min-height: 0; border-left: 1px solid rgba(255, 230, 0, 0.12); background: rgba(8, 10, 15, 0.7); height: calc(100dvh - 55px); position: sticky; top: 55px; }
.jv-chat-head { padding: 14px 16px 10px; font-size: 11px; letter-spacing: 0.22em; color: var(--text-faint); border-bottom: 1px solid var(--border); }

/* ---------- MAN AI Core (hero) ----------
   Drawn entirely on <canvas id="jvCore"> by jarvis.js (coreFrame). The
   container only sizes it; all motion happens in the canvas loop. */
.jv-core { position: relative; flex: 1; width: 100%; min-height: 320px; }
.jv-core canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

@keyframes jv-spin { to { transform: rotate(360deg); } }

/* ---------- Voice dock ---------- */
.jv-dock { width: 100%; max-width: 620px; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 14px 16px 12px; border: 1px solid rgba(255, 230, 0, 0.16); border-radius: 22px; background: var(--glass); backdrop-filter: blur(10px); box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.35); }
.jv-dock-row { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }
.jv-dock-btn { font: inherit; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 58px; background: transparent; border: 1px solid var(--border); color: var(--text); padding: 7px 10px; border-radius: 12px; cursor: pointer; font-size: 15px; }
.jv-dock-btn span { font-size: 10.5px; color: var(--text-dim); letter-spacing: 0.04em; }
.jv-dock-btn:hover:not(:disabled) { border-color: var(--neon); }
.jv-dock-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.jv-dock-btn.on { border-color: var(--yellow); }
.jv-dock-btn.on span { color: var(--yellow); }

.jv-status { font-size: 13px; font-weight: 600; letter-spacing: 0.04em; color: var(--text-dim); display: flex; align-items: center; gap: 8px; min-height: 20px; }
.jv-status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px currentColor; }
.jv-root[data-state="listening"] .jv-status-dot { background: var(--red); }
.jv-root[data-state="searching"] .jv-status-dot,
.jv-root[data-state="thinking"] .jv-status-dot { background: var(--blue); }
.jv-root[data-state="speaking"] .jv-status-dot { background: var(--neon); }
.jv-root[data-state="error"] .jv-status-dot { background: var(--red); }

.jv-mic {
  position: relative; width: 78px; height: 78px; border-radius: 50%; cursor: pointer; margin: 0 6px;
  border: 2px solid rgba(255, 230, 0, 0.55); background: radial-gradient(circle at 35% 30%, #232a36, #0b0e13);
  color: var(--neon); display: grid; place-items: center; box-shadow: 0 0 26px rgba(255, 214, 0, 0.16);
  transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.jv-mic:hover { transform: scale(1.04); box-shadow: 0 0 40px rgba(255, 214, 0, 0.28); }
.jv-mic:disabled { cursor: not-allowed; opacity: 0.45; transform: none; }
.jv-mic svg { width: 32px; height: 32px; }
.jv-mic::after { content: ''; position: absolute; inset: -8px; border-radius: 50%; border: 2px solid transparent; }
.jv-root[data-state="listening"] .jv-mic { border-color: var(--neon); background: radial-gradient(circle at 50% 50%, rgba(255, 230, 0, 0.25), #0b0e13 70%); box-shadow: 0 0 46px rgba(255, 214, 0, 0.55); }
.jv-root[data-state="listening"] .jv-mic::after { border-color: rgba(255, 230, 0, 0.6); animation: jv-pulse 1.2s ease-out infinite; }
.jv-root[data-state="searching"] .jv-mic::after,
.jv-root[data-state="thinking"] .jv-mic::after { border-color: rgba(56, 189, 248, 0.6) transparent; animation: jv-spin 1s linear infinite; }
@keyframes jv-pulse { from { transform: scale(0.95); opacity: 1; } to { transform: scale(1.3); opacity: 0; } }
.jv-hint { font-size: 11px; color: var(--text-faint); text-align: center; }

.jv-rate { display: flex; gap: 4px; padding: 3px; border: 1px solid var(--border); border-radius: 999px; }
.jv-rate button { font: inherit; font-size: 11.5px; background: transparent; border: none; color: var(--text-dim); padding: 5px 10px; border-radius: 999px; cursor: pointer; }
.jv-rate button:hover { color: var(--text); }
.jv-rate button.on { color: #111; background: var(--neon); font-weight: 700; }

/* ---------- Chat ---------- */
.jv-log { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 14px; }
.jv-empty { margin: auto; text-align: center; color: var(--text-faint); line-height: 1.8; }
.jv-empty b { color: var(--text-dim); }
.jv-msg { max-width: 90%; padding: 10px 13px; border-radius: 14px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; font-size: 13.5px; }
.jv-msg.user { align-self: flex-end; background: rgba(255, 230, 0, 0.1); border: 1px solid rgba(255, 230, 0, 0.3); }
.jv-msg.assistant { align-self: flex-start; background: rgba(20, 25, 34, 0.9); border: 1px solid var(--border); border-left: 2px solid var(--neon); }
.jv-msg.error { align-self: center; background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.4); color: #fca5a5; font-size: 12.5px; }
.jv-msg.interim { opacity: 0.6; font-style: italic; }
.jv-sources { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.jv-source { font-size: 10.5px; color: var(--text-dim); background: var(--bg-elev); border: 1px solid var(--border); border-radius: 999px; padding: 2px 8px; }
.jv-source.none { color: var(--yellow); }

.jv-form { display: flex; gap: 8px; padding: 12px 14px 14px; border-top: 1px solid var(--border); }
.jv-form input { flex: 1; min-width: 0; font: inherit; background: #0b0e13; border: 1px solid var(--border); color: var(--text); padding: 10px 13px; border-radius: 12px; }
.jv-form input:focus { outline: none; border-color: var(--neon); }
.jv-form button { font: inherit; background: var(--neon); color: #111; border: none; font-weight: 700; padding: 0 16px; border-radius: 12px; cursor: pointer; }
.jv-form button:disabled { opacity: 0.5; cursor: not-allowed; }

.jv-notice { width: 100%; max-width: 620px; font-size: 12px; color: var(--yellow); background: rgba(250, 204, 21, 0.08); border: 1px solid rgba(250, 204, 21, 0.3); border-radius: 10px; padding: 8px 12px; }

/* ---------- Mobile / tablet ---------- */
@media (max-width: 900px) {
  .jv-root:not(.jv-fixed) .jv-main { display: flex; flex-direction: column; }
  .jv-root:not(.jv-fixed) .jv-stage { padding: 8px 16px 12px; }
  .jv-root:not(.jv-fixed) .jv-core { flex: none; height: 44vh; min-height: 260px; }
  .jv-root:not(.jv-fixed) .jv-chat { position: static; height: auto; border-left: none; border-top: 1px solid rgba(255, 230, 0, 0.12); }
  .jv-root:not(.jv-fixed) .jv-log { max-height: 42vh; min-height: 120px; }
}
@media (max-width: 480px) {
  .jv-root:not(.jv-fixed) .jv-header { padding: 10px 16px; }
  .jv-root:not(.jv-fixed) .jv-header button { padding: 7px 10px; }
  .jv-root:not(.jv-fixed) .jv-header .jv-hide-sm { display: none; }
  .jv-root:not(.jv-fixed) .jv-dock { padding: 12px 10px 10px; border-radius: 18px; }
  .jv-root:not(.jv-fixed) .jv-dock-row { gap: 8px; }
  .jv-root:not(.jv-fixed) .jv-dock-btn { min-width: 50px; padding: 6px 8px; }
  .jv-root:not(.jv-fixed) .jv-mic { width: 68px; height: 68px; }
  .jv-root:not(.jv-fixed) .jv-rate { order: 5; }
}

@media (prefers-reduced-motion: reduce) {
  .jv-mic::after { animation: none !important; }
}

/* ---------- Mini Games (placeholder view; MAN MEMORY plugs in later) ---------- */
.jv-header .jv-game-btn { border-color: rgba(255, 230, 0, 0.35); }
.jv-header .jv-game-btn.on { background: var(--neon); color: #111; font-weight: 700; }
.jv-games { flex: 1; width: 100%; max-width: 980px; margin: 0 auto; padding: 22px 16px 32px; }
.jv-games-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.jv-games-head h2 { margin: 0; font-size: 20px; letter-spacing: 0.04em; }
.jv-back { font: inherit; font-size: 12.5px; background: var(--glass); border: 1px solid var(--border); color: var(--text); padding: 8px 14px; border-radius: 10px; cursor: pointer; }
.jv-back:hover { border-color: var(--neon); }
/* ---------- Mini Games lobby: cute arcade cards ----------
   Per-game theme via .jv-gc--<theme>; games supply their own inline SVG art.
   Hover lifts the card and animates elements marked .gc-float / .gc-flame. */
.jv-games-intro { margin: -8px 0 18px; color: var(--text-dim); font-size: 13.5px; }
.jv-games-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; }
.jv-game-card {
  --gc-bg: linear-gradient(160deg, #2a2f38, #0c0e12); --gc-ink: #f8fafc; --gc-sub: #aab3c5; --gc-accent: #ffe600; --gc-accent-ink: #111; --gc-glow: rgba(255, 230, 0, 0.3); --gc-art-bg: rgba(255, 255, 255, 0.05);
  font: inherit; font-family: ui-rounded, 'SF Pro Rounded', 'Noto Sans Thai', system-ui, sans-serif; text-align: left;
  display: flex; flex-direction: column; padding: 0; overflow: hidden; border-radius: 26px; border: 2px solid rgba(255, 255, 255, 0.14);
  background: var(--gc-bg); color: var(--gc-ink); cursor: pointer; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.3, 1.2), box-shadow 0.25s ease, border-color 0.25s ease;
}
.jv-game-card:hover:not(:disabled), .jv-game-card:focus-visible { transform: translateY(-6px); border-color: var(--gc-accent); box-shadow: 0 16px 36px rgba(0, 0, 0, 0.4), 0 0 26px var(--gc-glow); outline: none; }
.jv-game-card:disabled { cursor: default; opacity: 0.7; }
.jv-gc-art { display: block; height: 170px; margin: 12px 12px 0; border-radius: 18px; background: var(--gc-art-bg); overflow: hidden; }
.jv-gc-art svg { width: 100%; height: 100%; display: block; transition: transform 0.35s ease; }
.jv-game-card:hover:not(:disabled) .jv-gc-art svg { transform: scale(1.05); }
.jv-gc-emoji { display: grid; place-items: center; height: 100%; font-size: 64px; }
.jv-gc-body { display: flex; flex-direction: column; gap: 6px; padding: 14px 18px 18px; }
.jv-gc-badge { align-self: flex-start; font-size: 10.5px; font-weight: 900; letter-spacing: 0.14em; padding: 3px 10px; border-radius: 999px; background: var(--gc-accent); color: var(--gc-accent-ink); }
.jv-gc-title { font-size: 19px; font-weight: 900; letter-spacing: 0.06em; }
.jv-gc-sub { font-size: 13.5px; color: var(--gc-sub); }
.jv-gc-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.jv-gc-best { font-size: 12px; color: var(--gc-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jv-gc-play { flex-shrink: 0; font-size: 13px; font-weight: 900; letter-spacing: 0.12em; padding: 8px 16px; border-radius: 999px; background: var(--gc-accent); color: var(--gc-accent-ink); box-shadow: 0 4px 0 rgba(0, 0, 0, 0.25); transition: transform 0.15s ease; }
.jv-game-card:hover:not(:disabled) .jv-gc-play { transform: scale(1.06); }
.jv-game-card:active:not(:disabled) .jv-gc-play { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25); }

/* themes */
.jv-gc--memory {
  --gc-bg: linear-gradient(155deg, #fff6d8 0%, #fbe8ff 60%, #eadcff 100%); --gc-ink: #3b2466; --gc-sub: #6d5a8f;
  --gc-accent: #ffd84d; --gc-accent-ink: #3b2466; --gc-glow: rgba(179, 136, 255, 0.55); --gc-art-bg: radial-gradient(circle at 50% 45%, #fff9e8, #f3e3ff);
  border-color: rgba(124, 77, 255, 0.35);
}
.jv-gc--memory .jv-gc-badge { background: #7c4dff; color: #fff; }
.jv-gc--space {
  --gc-bg: linear-gradient(160deg, #15204d 0%, #1d1247 70%, #2a1250 100%); --gc-ink: #ffffff; --gc-sub: #b9c6ff;
  --gc-accent: #ff6fa8; --gc-accent-ink: #fff; --gc-glow: rgba(34, 227, 255, 0.5);
  --gc-art-bg: radial-gradient(circle at 30% 20%, rgba(94, 231, 255, 0.18), transparent 55%), radial-gradient(circle at 80% 90%, rgba(255, 111, 168, 0.18), transparent 55%), #0e1640;
  border-color: rgba(34, 227, 255, 0.35);
}
.jv-gc--space .jv-gc-badge { background: #22e3ff; color: #0e1640; }
.jv-gc--space .jv-gc-play { background: #ffd93d; color: #15204d; }

/* art motion: only on hover, so the lobby stays calm */
.jv-gc-art .gc-float, .jv-gc-art .gc-ship, .jv-gc-art .gc-tilt-l, .jv-gc-art .gc-tilt-r { transform-box: fill-box; transform-origin: center; }
.jv-game-card:hover:not(:disabled) .gc-float { animation: gc-bob 1.6s ease-in-out infinite; }
.jv-game-card:hover:not(:disabled) .gc-d2 { animation-delay: -0.5s; }
.jv-game-card:hover:not(:disabled) .gc-d3 { animation-delay: -1s; }
.jv-game-card:hover:not(:disabled) .gc-ship { animation: gc-bob 1.2s ease-in-out infinite; }
.jv-game-card:hover:not(:disabled) .gc-flame { animation: gc-flame 0.18s steps(2) infinite; }
.jv-game-card:hover:not(:disabled) .gc-tilt-l { animation: gc-wiggle-l 1.4s ease-in-out infinite; }
.jv-game-card:hover:not(:disabled) .gc-tilt-r { animation: gc-wiggle-r 1.4s ease-in-out infinite; }
@keyframes gc-bob { 50% { transform: translateY(-6px); } }
@keyframes gc-flame { 50% { opacity: 0.55; } }
@keyframes gc-wiggle-l { 50% { transform: rotate(-3deg) translateY(-3px); } }
@keyframes gc-wiggle-r { 50% { transform: rotate(3deg) translateY(-3px); } }

@media (max-width: 640px) {
  .jv-games-grid { grid-template-columns: 1fr; }
  .jv-gc-art { height: 150px; }
}
@media (prefers-reduced-motion: reduce) {
  .jv-game-card, .jv-gc-art svg { transition: none; }
  .jv-game-card:hover:not(:disabled) { transform: none; }
  .jv-gc-art * { animation: none !important; }
}
.jv-game-host { min-height: 60vh; border: 1px solid var(--border); border-radius: 16px; background: rgba(8, 10, 15, 0.7); }

/* ---------- Admin › JARVIS Knowledge ---------- */
.jv-header #jvKbBtn.on { background: var(--neon); color: #111; font-weight: 700; }
.jv-kb .kb-admin { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: rgba(255, 230, 0, 0.15); color: var(--neon); vertical-align: middle; }
.kb-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 12px; }
.kb-card { padding: 12px 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--glass); }
.kb-card span { display: block; font-size: 11px; letter-spacing: 0.08em; color: var(--text-faint); text-transform: uppercase; }
.kb-card b { display: block; font-size: 22px; color: var(--neon); margin: 2px 0; }
.kb-card b.kb-sm { font-size: 14px; color: var(--text); }
.kb-card small { color: var(--text-dim); font-size: 11.5px; }
.kb-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.kb-btn { font: inherit; font-size: 13px; background: var(--glass); border: 1px solid var(--border); color: var(--text); padding: 8px 14px; border-radius: 10px; cursor: pointer; }
.kb-btn:hover:not(:disabled) { border-color: var(--neon); }
.kb-h { margin: 18px 0 8px; font-size: 15px; }
.kb-muted { color: var(--text-dim); font-size: 12.5px; line-height: 1.6; }
.kb-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
.kb-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.kb-table th, .kb-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.kb-table th { color: var(--text-faint); font-weight: 600; background: rgba(255, 255, 255, 0.03); }
.kb-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--red); }
.kb-dot.connected { background: var(--green); }
.kb-search { display: flex; gap: 8px; }
.kb-search input { flex: 1; min-width: 0; font: inherit; background: #0b0e13; border: 1px solid var(--border); color: var(--text); padding: 9px 12px; border-radius: 10px; }
.kb-results { padding-left: 18px; font-size: 13px; }
.kb-results li { margin-bottom: 10px; }
.kb-results p { margin: 2px 0 0; color: var(--text-dim); font-size: 12px; }
.kb-errors { font-size: 12px; color: #fca5a5; padding-left: 18px; }

/* =========================================================
   Command-centre layout (MAN JARVIS main view)
   Left intro + quick menu · centre AI Core + HUD cards + voice
   console · right conversation. Space backdrop is pure CSS.
   ========================================================= */
.jv-root { --gold: #ffd900; background: #03050a; }
.jv-header { height: 60px; padding: 0 22px; background: rgba(3, 4, 8, 0.94); border-bottom: 1px solid rgba(255, 217, 0, 0.38); box-shadow: 0 1px 22px rgba(255, 217, 0, 0.08); }
.jv-header button { background: rgba(14, 18, 28, 0.85); border-color: rgba(255, 255, 255, 0.12); }
.jv-header button:hover { border-color: var(--gold); box-shadow: 0 0 14px rgba(255, 217, 0, 0.18); }

.jv-main.jv-cc { position: relative; display: grid; grid-template-columns: 300px minmax(0, 1fr) 380px; min-height: calc(100dvh - 60px); overflow: hidden; }
.jv-cc > section, .jv-cc > aside { position: relative; z-index: 1; }

/* MAN 3D command-centre backdrop (jv-scene.js). Far/mid/front layers share a
   2400x1500 design space with its vanishing point (1200,560) pinned behind
   the AI Core; --px/--py (pointer parallax, desktop only) shift each layer by
   a different amount. Decoration only: pointer-events none, aria-hidden. */
.jv-space { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; background: #03050a;
  --vx: calc(300px + (100% - 680px) / 2); --vy: 292px; --rs: 1; }
.jv-main.jv-cc { --px: 0; --py: 0; }
.jv-scene { position: absolute; left: var(--vx); top: var(--vy); width: 2400px; height: 1500px; margin: -560px 0 0 -1200px;
  transform-origin: 1200px 560px; transform: scale(var(--rs)); }
.jv-layer { position: absolute; inset: 0; transition: translate 0.8s cubic-bezier(0.2, 0.7, 0.2, 1); will-change: translate; }
.jv-far { background: url(/jarvis/jv-cc-far.svg) 0 0 / 100% 100% no-repeat; opacity: 0.92; translate: calc(var(--px) * -6px) calc(var(--py) * -4px); }
.jv-mid { perspective: 1400px; translate: calc(var(--px) * -14px) calc(var(--py) * -9px); }
.jv-front { translate: calc(var(--px) * -24px) calc(var(--py) * -14px); }
.jv-cc .jv-hud { translate: calc(var(--px) * -8px) calc(var(--py) * -5px); transition: translate 0.8s cubic-bezier(0.2, 0.7, 0.2, 1); }

/* mid: floating holographic panels (ambient, intentionally no numbers) */
.jv-holo { position: absolute; padding: 12px 14px; border-radius: 10px; opacity: 0.6; overflow: hidden; contain: layout paint;
  background: linear-gradient(160deg, rgba(20, 34, 62, 0.55), rgba(6, 10, 20, 0.35)); border: 1px solid rgba(255, 210, 74, 0.32);
}
.jv-holo-l { transform: rotateY(20deg); transform-origin: 100% 50%; }
.jv-holo-r { transform: rotateY(-20deg); transform-origin: 0 50%; }
.jv-holo-far { opacity: 0.4; }
@media (max-width: 1679px) { .jv-holo-l { display: none; } }
.jv-holo b { display: block; font: 700 10px/1 Inter, system-ui, sans-serif; letter-spacing: 0.28em; color: #ffd24a; opacity: 0.85; margin-bottom: 10px; }
.jv-holo svg { display: block; width: 100%; height: calc(100% - 22px); overflow: hidden; }
.jv-holo .b { fill: rgba(255, 196, 0, 0.28); }
.jv-holo .ln { fill: none; stroke: #ffd24a; stroke-width: 2; }
.jv-flow { animation: jv-flow 8s linear infinite; }
.jv-holo .lk { fill: none; stroke: rgba(143, 180, 255, 0.35); stroke-width: 1.2; }
.jv-holo .nd { fill: #ffd24a; animation: jv-blink 2.7s ease-in-out infinite; }
.jv-feed { display: flex; flex-direction: column; gap: 10px; }
.jv-feed i { display: block; height: 6px; border-radius: 3px; background: linear-gradient(90deg, rgba(255, 210, 74, 0.55), rgba(255, 210, 74, 0.08)); animation: jv-blink 3.5s ease-in-out infinite; }
.jv-gauges { position: relative; height: calc(100% - 22px); }
.jv-gauges span { position: absolute; left: 50%; top: 50%; border-radius: 50%; border: 2px solid rgba(255, 210, 74, 0.15); border-top-color: rgba(255, 210, 74, 0.8); animation: jv-spin linear infinite; }
.jv-gauges span:nth-child(1) { width: 110px; height: 110px; margin: -55px 0 0 -55px; }
.jv-gauges span:nth-child(2) { width: 78px; height: 78px; margin: -39px 0 0 -39px; border-top-color: rgba(143, 180, 255, 0.7); animation-direction: reverse; }
.jv-gauges span:nth-child(3) { width: 46px; height: 46px; margin: -23px 0 0 -23px; }
.jv-stream { position: relative; height: calc(100% - 22px); overflow: hidden; }
.jv-stream i { position: absolute; top: -30%; width: 3px; height: 30%; border-radius: 2px; background: linear-gradient(180deg, transparent, rgba(255, 210, 74, 0.8)); animation: jv-drop 2.4s linear infinite; }
.jv-timeline { display: flex; flex-direction: column; gap: 12px; }
.jv-timeline i { display: block; height: 8px; border-radius: 4px; background: rgba(143, 180, 255, 0.28); border-left: 3px solid #ffd24a; }

/* front: energy platform under the core + console silhouettes */
.jv-plat { contain: layout paint; position: absolute; left: 1200px; top: 860px; width: 820px; height: 170px; margin: -85px 0 0 -410px; }
.jv-plat-disc { position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(ellipse at 50% 40%, rgba(255, 214, 80, 0.3), rgba(40, 32, 8, 0.5) 45%, rgba(8, 10, 16, 0.9) 70%, transparent 72%); }
.jv-plat-ring { position: absolute; inset: 6% 8%; transform: scaleY(0.2); transform-origin: 50% 50%; }
.jv-plat-ring i { position: absolute; left: 50%; top: 50%; width: 640px; height: 640px; margin: -320px 0 0 -320px; border-radius: 50%;
  border: 3px dashed rgba(255, 210, 74, 0.6); animation: jv-spin 60s linear infinite; }
.jv-plat-ring2 i { width: 760px; height: 760px; margin: -380px 0 0 -380px; border: 1.5px solid rgba(255, 210, 74, 0.35); border-style: solid dotted; animation: none; }
.jv-beam { position: absolute; left: 1200px; top: 300px; width: 560px; height: 560px; margin-left: -280px;
  background: radial-gradient(ellipse 50% 60% at 50% 100%, rgba(255, 210, 74, 0.14), transparent 70%); }
.jv-console { position: absolute; top: 1040px; width: 520px; height: 260px; border-radius: 40px 40px 0 0;
  background: linear-gradient(180deg, #121826, #05070c 60%); border-top: 2px solid rgba(255, 210, 74, 0.45); }
.jv-console::after { content: ''; position: absolute; left: 10%; right: 10%; top: 26px; height: 3px; border-radius: 2px; background: linear-gradient(90deg, transparent, rgba(255, 210, 74, 0.5), transparent); }
.jv-console-l { left: 420px; transform: perspective(900px) rotateX(38deg) rotateZ(6deg); }
.jv-console-r { left: 1460px; transform: perspective(900px) rotateX(38deg) rotateZ(-6deg); }
@keyframes jv-flow { to { transform: translateX(-240px); } }
@keyframes jv-blink { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
@keyframes jv-drop { to { transform: translateY(460%); } }
.jv-glow { position: absolute; left: var(--vx); top: var(--vy); width: calc(760px * var(--rs)); aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 217, 0, 0.16) 0%, rgba(255, 180, 0, 0.06) 42%, transparent 70%); animation: jv-breathe 6s ease-in-out infinite alternate; }
@keyframes jv-breathe { from { opacity: 0.65; } to { opacity: 1; } }
.jv-space::after { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse 75% 70% at var(--vx) var(--vy), transparent 45%, rgba(0, 0, 0, 0.55) 100%); }
.jv-frame { position: absolute; top: 0; bottom: 0; width: 70px; background: linear-gradient(90deg, rgba(12, 14, 20, 0.95), rgba(12, 14, 20, 0)); }
.jv-frame::after { content: ''; position: absolute; top: 12%; bottom: 12%; width: 1px; background: linear-gradient(180deg, transparent, rgba(255, 217, 0, 0.5), transparent); }
.jv-frame-l { left: 0; } .jv-frame-l::after { left: 12px; }
.jv-frame-r { right: 0; transform: scaleX(-1); } .jv-frame-r::after { left: 12px; }

/* left: intro + quick menu */
.jv-left { padding: 40px 22px 24px 34px; display: flex; flex-direction: column; gap: 28px; }
.jv-eyebrow { font-size: 11.5px; font-weight: 700; letter-spacing: 0.34em; color: var(--gold); }
.jv-intro h1 { margin: 12px 0 14px; font-family: 'Inter', system-ui, sans-serif; line-height: 1.02; }
.jv-intro h1 span { display: block; }
.jv-intro h1 span:first-child { font-size: 46px; font-weight: 300; letter-spacing: 0.08em; color: #fff; }
.jv-intro h1 span:last-child { font-size: 34px; font-weight: 800; letter-spacing: 0.04em; color: #fff; white-space: nowrap; }
.jv-intro h1 b { color: var(--gold); text-shadow: 0 0 18px rgba(255, 217, 0, 0.55); }
.jv-intro p { margin: 0; color: #a9b3c7; font-size: 14.5px; line-height: 1.6; }
.jv-quick { display: flex; flex-direction: column; gap: 4px; padding: 8px; border-radius: 18px; background: rgba(9, 13, 22, 0.58); border: 1px solid rgba(255, 217, 0, 0.22); backdrop-filter: blur(10px); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); }
.jv-q { font: inherit; display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px; background: transparent; border: 1px solid transparent; color: #fff; cursor: pointer; text-align: left; transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease; }
.jv-q:hover, .jv-q:focus-visible { background: rgba(255, 217, 0, 0.07); border-color: rgba(255, 217, 0, 0.35); box-shadow: 0 0 16px rgba(255, 217, 0, 0.12); outline: none; }
.jv-q-ic { width: 40px; height: 40px; flex-shrink: 0; display: grid; place-items: center; font-size: 18px; border-radius: 11px; background: linear-gradient(145deg, #1d222c, #0b0e14); border: 1px solid rgba(255, 217, 0, 0.35); }
.jv-q-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.jv-q-tx b { font-size: 12.5px; letter-spacing: 0.14em; }
.jv-q-tx small { font-size: 12px; color: #8f9ab0; }
.jv-q-arrow { color: var(--gold); font-size: 20px; opacity: 0.7; }

/* centre: core + HUD + console */
.jv-cc .jv-stage { padding: 8px 18px 20px; justify-content: flex-start; gap: 0; }
.jv-core-wrap { position: relative; width: min(560px, 100%); aspect-ratio: 1; margin: 4px auto 0; flex-shrink: 0; }
.jv-cc .jv-core { position: absolute; inset: 0; min-height: 0; height: auto; flex: none; }
.jv-hud { position: absolute; z-index: 2; min-width: 150px; padding: 12px 14px; border-radius: 16px; font-size: 12px; color: #cfd6e4; background: rgba(8, 12, 22, 0.62); border: 1px solid rgba(255, 217, 0, 0.35); backdrop-filter: blur(8px); box-shadow: 0 0 22px rgba(255, 217, 0, 0.1); display: flex; flex-direction: column; gap: 4px; }
.jv-hud b { font-size: 11px; letter-spacing: 0.16em; color: var(--gold); display: flex; align-items: center; gap: 7px; }
.jv-hud small { color: #8f9ab0; font-size: 11px; }
.jv-hud-online { left: -6%; top: 44%; }
.jv-hud-sys { right: -9%; top: 9%; }
.jv-hud-voice { right: -9%; bottom: 13%; }
.jv-hud ul { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 4px; }
.jv-hud li { display: flex; align-items: center; gap: 8px; }
.jv-hud li i, .jv-live { width: 7px; height: 7px; border-radius: 50%; background: #64748b; flex-shrink: 0; }
.jv-hud li.on i, .jv-live { background: #22c55e; box-shadow: 0 0 8px #22c55e; }
.jv-hud li.off i { background: #ef4444; box-shadow: 0 0 6px rgba(239, 68, 68, 0.6); }
.jv-live { animation: jv-live 2s ease-in-out infinite; }
@keyframes jv-live { 50% { opacity: 0.4; } }
.jv-root[data-state="listening"] .jv-live { background: #ff4d4d; box-shadow: 0 0 8px #ff4d4d; }
.jv-root[data-state="thinking"] .jv-live, .jv-root[data-state="searching"] .jv-live { background: #38bdf8; box-shadow: 0 0 8px #38bdf8; }
.jv-root[data-state="speaking"] .jv-live { background: var(--gold); box-shadow: 0 0 8px var(--gold); }
.jv-root[data-state="error"] .jv-live { background: #ff4d4d; box-shadow: 0 0 8px #ff4d4d; }

.jv-cc .jv-dock { width: min(720px, 100%); margin-top: -18px; position: relative; z-index: 3; padding: 14px 18px 12px; border-radius: 22px; background: rgba(8, 11, 20, 0.72); border: 1px solid rgba(255, 217, 0, 0.38); backdrop-filter: blur(12px); box-shadow: 0 0 30px rgba(255, 217, 0, 0.1), 0 18px 44px rgba(0, 0, 0, 0.55); }
.jv-cc .jv-mic { width: 86px; height: 86px; border-color: var(--gold); box-shadow: 0 0 28px rgba(255, 217, 0, 0.35), inset 0 0 18px rgba(255, 217, 0, 0.12); }
.jv-cc .jv-dock-btn { border-color: rgba(255, 255, 255, 0.14); background: rgba(16, 20, 30, 0.8); }
.jv-cc .jv-rate { border-color: rgba(255, 217, 0, 0.25); }
.jv-cc .jv-rate button.on { background: var(--gold); color: #111; }

/* right: conversation */
.jv-cc .jv-chat { position: relative; top: auto; height: auto; max-height: calc(100dvh - 60px); background: rgba(6, 9, 18, 0.74); border-left: 1px solid rgba(255, 217, 0, 0.2); backdrop-filter: blur(10px); }
.jv-cc .jv-chat-head { display: flex; align-items: baseline; justify-content: space-between; padding: 16px 16px 12px; color: #fff; }
.jv-cc .jv-chat-head b { font-size: 12px; letter-spacing: 0.22em; }
.jv-cc .jv-chat-head small { color: #8f9ab0; font-size: 11.5px; letter-spacing: 0.04em; }
.jv-cc .jv-msg { border-radius: 14px; }
.jv-cc .jv-msg.assistant { background: rgba(14, 20, 38, 0.86); border: 1px solid rgba(120, 140, 180, 0.22); border-left: 3px solid var(--gold); }
.jv-cc .jv-msg.user { background: rgba(120, 96, 0, 0.35); border: 1px solid rgba(255, 217, 0, 0.35); }
.jv-cc .jv-form button { background: var(--gold); }

/* Fixed desktop canvas (jarvis.js fitCanvas): the assistant view never
   reflows. Below DESKTOP_W the 1440px canvas is scaled to the viewport
   width; --jv-vh replaces vh so heights follow the unscaled canvas. */
.jv-fit { overflow: hidden; background: #03050a; min-height: 100vh; min-height: 100dvh; }
.jv-fit > .jv-root.jv-fixed { width: 1440px; min-height: calc(var(--jv-vh) * 100); transform-origin: 0 0; transform: scale(var(--jv-scale, 1));
  margin: 0 var(--jv-mr, 0px) var(--jv-mb, 0px) var(--jv-left, 0px); }
.jv-fit .jv-main.jv-cc { min-height: calc(var(--jv-vh) * 100 - 60px); }
.jv-fit .jv-cc .jv-chat { max-height: calc(var(--jv-vh) * 100 - 60px); }
/* touch targets: --jv-tap is 44 real px expressed in canvas px */
.jv-fit:not(.jv-portrait) .jv-fixed .jv-mic { width: max(86px, var(--jv-tap)); height: max(86px, var(--jv-tap)); }
.jv-fit:not(.jv-portrait) .jv-fixed .jv-dock-btn { min-width: max(58px, var(--jv-tap)); min-height: var(--jv-tap); justify-content: center; }
.jv-fit:not(.jv-portrait) .jv-fixed .jv-rate button { min-width: var(--jv-tap); min-height: var(--jv-tap); }
.jv-fit:not(.jv-portrait) .jv-fixed .jv-form input, .jv-fit:not(.jv-portrait) .jv-fixed .jv-form button { min-height: var(--jv-tap); }
/* phone portrait: real-size conversation + voice console under the canvas */
.jv-companion { display: none; }
.jv-fit.jv-portrait > .jv-companion { display: block; min-height: 0; background: #03050a; }
.jv-companion > .jv-cc { display: flex; flex-direction: column; gap: 10px; padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); height: calc(100dvh - var(--jv-ch, 244px)); min-height: 420px; box-sizing: border-box; }
.jv-companion .jv-chat { flex: 1; min-height: 0; max-height: none; height: auto; border: 1px solid rgba(255, 217, 0, 0.2); border-radius: 16px; overflow: hidden; }
.jv-companion .jv-chat-head { padding: 10px 14px 8px; }
.jv-companion .jv-form input, .jv-companion .jv-form button { min-height: 44px; font-size: 16px; }
.jv-companion .jv-dock { width: 100%; margin: 0; padding: 10px 8px 8px; gap: 6px; box-sizing: border-box; }
.jv-companion .jv-dock-row { gap: 6px; flex-wrap: nowrap; }
.jv-companion .jv-dock-btn { min-width: 44px; min-height: 44px; padding: 4px 6px; justify-content: center; }
.jv-companion .jv-mic { width: 60px; height: 60px; margin: 0 2px; flex-shrink: 0; }
.jv-companion .jv-mic svg { width: 26px; height: 26px; }
.jv-companion .jv-rate button { min-width: 44px; min-height: 44px; padding: 0 6px; }
.jv-companion .jv-hint { display: none; }
@media (prefers-reduced-motion: reduce) {
  .jv-glow, .jv-live, .jv-flow, .jv-holo .nd, .jv-feed i, .jv-gauges span, .jv-stream i, .jv-plat-ring i { animation: none; }
  .jv-layer, .jv-cc .jv-hud { translate: none; }
}
/* fixed-canvas follow-ups: companion rate row wraps under the mic; enlarged
   in-canvas rate buttons keep a pill shape instead of turning into circles */
.jv-companion .jv-dock-row { flex-wrap: wrap; row-gap: 6px; }
.jv-companion .jv-rate { flex-basis: 100%; justify-content: center; border: none; padding: 0; }
.jv-companion .jv-rate button { flex: 1; max-width: 80px; border: 1px solid rgba(255, 217, 0, 0.25); }
.jv-fit:not(.jv-portrait) .jv-fixed .jv-rate { border-radius: 18px; }
.jv-fit:not(.jv-portrait) .jv-fixed .jv-rate button { border-radius: 14px; }
.jv-source.act-ok { color: #4ade80; }
.jv-hud .jv-cur { display: block; max-width: 190px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jv-msg.progress { align-self: flex-start; font-size: 12.5px; line-height: 1.7; background: rgba(56, 189, 248, 0.06); border: 1px dashed rgba(56, 189, 248, 0.35); }

/* ---------- Phone layout (<= 768px, jarvis.js isMobileLayout) ----------
   Real reflow instead of the scaled 1440px canvas: header, quick chips,
   robot, conversation (fills the rest), voice console pinned at the bottom.
   --jv-app-h = visual viewport height so the keyboard never covers input. */
/* class-driven (jarvis.js isMobileLayout), not a media query: Chrome's
   Desktop-site mode reports a ~980px layout width on phones. */
  .jv-root.jv-mobile { height: 100vh; height: var(--jv-app-h, 100dvh); min-height: 0; width: 100%; max-width: 100vw; overflow-x: hidden; overflow-y: auto; overscroll-behavior-y: contain; box-sizing: border-box;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); font-size: 15px; }
  .jv-root.jv-mobile .jv-header { position: relative; flex-shrink: 0; height: auto; min-height: 52px; padding: 4px 10px; gap: 8px; }
  .jv-root.jv-mobile .jv-brand { font-size: 15px; gap: 8px; min-width: 0; }
  .jv-root.jv-mobile .jv-header-actions { margin-left: auto; display: flex; gap: 6px; }
  .jv-root.jv-mobile .jv-header .jv-hide-sm { display: none; }
  .jv-root.jv-mobile .jv-header button { min-width: 44px; min-height: 44px; padding: 0 10px; font-size: 17px; }
  .jv-root.jv-mobile .jv-main.jv-cc { display: flex; flex-direction: column; flex: 1 0 auto; min-height: 0; overflow: hidden; }
  .jv-root.jv-mobile .jv-space { --vx: 50%; --vy: 24%; --rs: 0.55; }
  .jv-root.jv-mobile .jv-stage { display: contents; }
  .jv-root.jv-mobile .jv-left { order: 0; flex-shrink: 0; padding: 8px 10px 0; gap: 0; }
  .jv-root.jv-mobile .jv-intro { display: none; }
  .jv-root.jv-mobile .jv-quick { flex-direction: row; overflow-x: auto; gap: 6px; padding: 4px; border-radius: 14px; scrollbar-width: none; overscroll-behavior-x: contain; }
  .jv-root.jv-mobile .jv-quick::-webkit-scrollbar { display: none; }
  .jv-root.jv-mobile .jv-q { flex: 0 0 auto; min-height: 44px; padding: 4px 12px 4px 4px; gap: 8px; }
  .jv-root.jv-mobile .jv-q-ic { width: 34px; height: 34px; font-size: 16px; }
  .jv-root.jv-mobile .jv-q-tx small, .jv-root.jv-mobile .jv-q-arrow { display: none; }
  .jv-root.jv-mobile .jv-notice { order: 1; position: relative; z-index: 1; width: auto; margin: 8px 10px 0; font-size: 13px; }
  .jv-root.jv-mobile .jv-core-wrap { order: 1; position: relative; z-index: 1; height: clamp(130px, 26dvh, 260px); width: auto; max-width: 100%; aspect-ratio: 1; margin: 4px auto 0; }
  .jv-root.jv-mobile .jv-core { position: absolute; inset: 0; height: auto; min-height: 0; }
  .jv-root.jv-mobile .jv-hud-sys, .jv-root.jv-mobile .jv-hud-voice { display: none; }
  .jv-root.jv-mobile .jv-hud-online { top: auto; bottom: -2px; left: 50%; translate: -50% 0; min-width: 0; padding: 4px 12px; display: flex; gap: 8px; align-items: center; white-space: nowrap; font-size: 12.5px; }
  .jv-root.jv-mobile .jv-chat { order: 2; position: relative; z-index: 1; top: auto; flex: 1; min-height: 220px; height: auto; max-height: none; margin: 8px 10px 0; border: 1px solid rgba(255, 217, 0, 0.2); border-radius: 16px; overflow: hidden; }
  .jv-root.jv-mobile .jv-chat-head { padding: 8px 14px 6px; }
  .jv-root.jv-mobile .jv-log { max-height: none; min-height: 0; padding: 10px 12px; }
  .jv-root.jv-mobile .jv-msg { max-width: 88%; font-size: 15px; line-height: 1.6; }
  .jv-root.jv-mobile .jv-form { padding: 8px 10px 10px; }
  .jv-root.jv-mobile .jv-form input { flex: 1; min-width: 0; min-height: 48px; font-size: 16px; }
  .jv-root.jv-mobile .jv-form button { min-height: 48px; min-width: 64px; font-size: 16px; }
  .jv-root.jv-mobile .jv-dock { order: 3; position: relative; z-index: 2; flex-shrink: 0; width: auto; margin: 8px 10px calc(8px + env(safe-area-inset-bottom)); padding: 8px 8px 10px; gap: 6px; border-radius: 18px; box-sizing: border-box; }
  .jv-root.jv-mobile .jv-status { font-size: 13px; justify-content: center; }
  .jv-root.jv-mobile .jv-dock-row { flex-wrap: wrap; justify-content: space-evenly; gap: 6px; row-gap: 8px; }
  .jv-root.jv-mobile .jv-dock-btn { min-width: 52px; min-height: 52px; padding: 4px 6px; justify-content: center; font-size: 18px; }
  .jv-root.jv-mobile .jv-dock-btn span { font-size: 11px; }
  .jv-root.jv-mobile .jv-mic { width: 68px; height: 68px; margin: 0; flex-shrink: 0; }
  .jv-root.jv-mobile .jv-mic svg { width: 28px; height: 28px; }
  .jv-root.jv-mobile .jv-rate { order: 5; flex-basis: 100%; justify-content: center; border: none; padding: 0; }
  .jv-root.jv-mobile .jv-rate button { flex: 1; max-width: 84px; min-height: 44px; font-size: 13px; border: 1px solid rgba(255, 217, 0, 0.25); }
  .jv-root.jv-mobile .jv-hint { display: none; }
  /* keyboard open: give the conversation the whole visible height */
  .jv-kb .jv-root.jv-mobile .jv-left, .jv-kb .jv-root.jv-mobile .jv-core-wrap,
  .jv-kb .jv-root.jv-mobile .jv-notice, .jv-kb .jv-root.jv-mobile .jv-dock { display: none; }
  .jv-kb .jv-root.jv-mobile .jv-chat { margin-bottom: 4px; }
/* Desktop-site mode: real-size phone layout inside the 980px layout viewport */
.jv-dsite .jv-root.jv-mobile { zoom: var(--jv-zoom, 1); width: var(--jv-dw, 100%); max-width: none; }

/* QR Download & Share dialog (jv-share.js) — MAN PHOTO BOOTH / MAN TAROT */
.jv-share { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); background: rgba(3, 5, 10, 0.78); backdrop-filter: blur(6px); overflow-y: auto; }
.jv-share-card { width: min(420px, 100%); display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 22px 20px; border-radius: 22px; background: #0a0e18; border: 1px solid rgba(255, 217, 0, 0.45); box-shadow: 0 0 40px rgba(255, 217, 0, 0.12); color: #e8ecf4; text-align: center; font-family: system-ui, 'Noto Sans Thai', sans-serif; }
.jv-share-card h3 { margin: 0; font-size: 17px; letter-spacing: 0.08em; color: #ffd900; }
.jv-share-qr { width: min(260px, 70vw); aspect-ratio: 1; padding: 0; border-radius: 14px; background: #fff; overflow: hidden; }
.jv-share-qr svg { display: block; width: 100%; height: 100%; }
.jv-share-hint { margin: 0; font-size: 14px; }
.jv-share-link { max-width: 100%; font-size: 12px; color: #8f9ab0; word-break: break-all; }
.jv-share-note { margin: 0; font-size: 12px; color: #8f9ab0; }
.jv-share-err { margin: 0; color: #ff8080; font-size: 14px; }
.jv-share-wait { display: flex; align-items: center; gap: 10px; min-height: 120px; font-size: 15px; }
.jv-share-spin { width: 22px; height: 22px; border-radius: 50%; border: 3px solid rgba(255, 217, 0, 0.25); border-top-color: #ffd900; animation: jv-spin 0.9s linear infinite; }
.jv-share-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
.jv-share-btn { min-height: 48px; padding: 0 12px; border-radius: 14px; border: 1px solid rgba(255, 217, 0, 0.4); background: #10141e; color: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.jv-share-btn:hover { border-color: #ffd900; }
.jv-share-pri { grid-column: 1 / -1; background: #ffd900; color: #111; border-color: #ffd900; }
.tr-qr-note { display: block; margin-top: 6px; text-align: center; color: #8f9ab0; font-size: 12px; }

.jv-share-exit { grid-column: 1 / -1; }

/* Mic diagnostics + conversation toggle (jarvis.js paintMicDiag / toggleConversation) */
.jv-dock-btn.on { border-color: var(--neon, #ffe600); color: var(--neon, #ffe600); box-shadow: 0 0 12px rgba(255, 230, 0, 0.25); }
.jv-diag { width: 100%; margin-top: 6px; font-size: 12px; color: #a9b3c7; text-align: left; }
.jv-diag summary { cursor: pointer; text-align: center; list-style: none; padding: 4px; color: #8f9ab0; }
.jv-diag summary::-webkit-details-marker { display: none; }
.jv-diag[open] summary { color: #ffd900; }
.jv-diag-body { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 3px 12px; margin: 6px 0 0; padding: 10px 12px; border-radius: 12px; background: rgba(5, 8, 15, 0.7); border: 1px solid rgba(255, 217, 0, 0.18); }
.jv-diag-body dt { color: #8f9ab0; }
.jv-diag-body dd { margin: 0; color: #e8ecf4; overflow-wrap: anywhere; }
.jv-root.jv-mobile .jv-diag { order: 6; flex-basis: 100%; font-size: 13px; }

/* Mini Game player profile / Leaderboard / My Statistics (jv-player.js) */
.jv-player-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: -6px 0 16px; padding: 10px 14px; border-radius: 16px; background: rgba(12, 15, 21, 0.72); border: 1px solid rgba(255, 230, 0, 0.18); }
.jv-pb-who { font-size: 14px; color: var(--text-dim, #a9b3c7); min-width: 0; overflow-wrap: anywhere; }
.jv-pb-who b { color: var(--neon, #ffe600); }
.jv-pb-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.jv-player-bar button, .jv-lb-tabs button, .jv-lb-opts button { min-height: 40px; padding: 0 14px; border-radius: 12px; border: 1px solid rgba(255, 230, 0, 0.3); background: rgba(16, 20, 30, 0.85); color: #e8ecf4; font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer; }
.jv-player-bar button:hover:not(:disabled), .jv-lb-tabs button:hover, .jv-lb-opts button:hover { border-color: var(--neon, #ffe600); }
.jv-player-bar button:disabled { opacity: 0.45; cursor: default; }
.jv-lb-tabs button.on, .jv-lb-opts button.on { background: var(--neon, #ffe600); color: #111; border-color: var(--neon, #ffe600); }
.jv-pf { max-width: 420px; margin: 24px auto; padding: 26px 22px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; border-radius: 20px; background: rgba(10, 14, 24, 0.9); border: 1px solid rgba(255, 230, 0, 0.35); color: #e8ecf4; }
.jv-pf-icon { font-size: 40px; }
.jv-pf h3 { margin: 0; font-size: 20px; color: var(--neon, #ffe600); letter-spacing: 0.04em; }
.jv-pf p { margin: 0; font-size: 13.5px; color: #a9b3c7; }
.jv-pf-input { width: 100%; box-sizing: border-box; min-height: 48px; padding: 0 14px; border-radius: 14px; border: 1px solid rgba(255, 230, 0, 0.35); background: #070a12; color: #fff; font: inherit; font-size: 16px; text-align: center; }
.jv-pf-input:focus { outline: none; border-color: var(--neon, #ffe600); box-shadow: 0 0 0 3px rgba(255, 230, 0, 0.15); }
.jv-pf .jv-pf-err { min-height: 1.2em; color: #ff8080; }
.jv-pf-actions { display: flex; gap: 10px; width: 100%; }
.jv-pf-btn { flex: 1; min-height: 48px; border-radius: 14px; border: 1px solid rgba(255, 230, 0, 0.35); background: #10141e; color: #fff; font: inherit; font-weight: 800; font-size: 15px; cursor: pointer; }
.jv-pf-pri { background: var(--neon, #ffe600); color: #111; border-color: var(--neon, #ffe600); }
.jv-pf-btn:disabled { opacity: 0.6; cursor: wait; }
.jv-game-page { min-height: 50vh; }
.jv-lb-tabs, .jv-lb-opts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.jv-lb-sp { flex: 1; }
.jv-lb-body { border-radius: 16px; border: 1px solid rgba(255, 230, 0, 0.18); background: rgba(8, 10, 15, 0.75); overflow-x: auto; }
.jv-lb-table, .jv-st-table { width: 100%; border-collapse: collapse; font-size: 14px; color: #e8ecf4; }
.jv-lb-table th, .jv-st-table th { text-align: left; font-size: 12px; letter-spacing: 0.06em; color: #8f9ab0; font-weight: 700; padding: 10px 12px; border-bottom: 1px solid rgba(255, 230, 0, 0.15); }
.jv-lb-table td, .jv-st-table td { padding: 10px 12px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.jv-lb-table tr.me td { background: rgba(255, 230, 0, 0.1); }
.jv-lb-table tr.me .jv-lb-name { color: var(--neon, #ffe600); font-weight: 800; }
.jv-lb-name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jv-lb-empty { margin: 0; padding: 28px 16px; text-align: center; color: #8f9ab0; }
.jv-st-who { margin: 0 0 12px; font-size: 15px; color: #a9b3c7; } .jv-st-who b { color: var(--neon, #ffe600); }
.jv-st-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.jv-st-card { padding: 16px; border-radius: 16px; background: rgba(12, 15, 21, 0.8); border: 1px solid rgba(255, 230, 0, 0.18); color: #e8ecf4; min-width: 0; }
.jv-st-card h4 { margin: 0 0 10px; font-size: 15px; color: var(--neon, #ffe600); }
.jv-st-card dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 14px; margin: 0; font-size: 14px; }
.jv-st-card dt { color: #8f9ab0; } .jv-st-card dd { margin: 0; font-weight: 700; }
.jv-st-table { margin-top: 10px; font-size: 13px; } .jv-st-table th, .jv-st-table td { padding: 6px 8px; }
.jv-st-list { margin: 10px 0 0; font-size: 13px; color: #a9b3c7; }
.jv-st-days { margin-top: 12px; } .jv-st-days ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.jv-st-days li { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: 10px; font-size: 14px; }
.jv-st-days li span:first-child { color: #8f9ab0; }
@media (max-width: 640px) {
  .jv-player-bar { padding: 10px; }
  .jv-pb-actions { width: 100%; }
  .jv-pb-actions button { flex: 1 1 auto; min-height: 44px; }
  .jv-lb-hide { display: none; }
  .jv-lb-table td, .jv-lb-table th { padding: 10px 8px; }
  .jv-lb-name { max-width: 130px; }
  .jv-st-days li { grid-template-columns: 92px minmax(0, 1fr) auto; font-size: 13px; }
}

/* ---------- Mobile layout (≤768px .jv-mobile), stable + preview ----------
   Only the conversation scrolls; header, robot, chat input and voice
   controls always stay inside the visible viewport (--jv-app-h follows the
   visual viewport, so the on-screen keyboard and safe areas are respected).
   Before: .jv-main grew with the chat (flex 1 0 auto), the whole screen
   scrolled and the MIC / input fell below the fold on long chats. */
.jv-root.jv-mobile { overflow: hidden; }
.jv-root.jv-mobile .jv-main.jv-cc { flex: 1 1 0; min-height: 0; }
.jv-root.jv-mobile .jv-left, .jv-root.jv-mobile .jv-core-wrap, .jv-root.jv-mobile .jv-notice, .jv-root.jv-mobile .jv-dock, .jv-root.jv-mobile .jv-header { flex-shrink: 0; }
.jv-root.jv-mobile .jv-core-wrap { height: clamp(88px, calc(var(--jv-app-h, 100dvh) * 0.2), 230px); }
.jv-root.jv-mobile .jv-chat { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; }
.jv-root.jv-mobile .jv-log { flex: 1 1 0; min-height: 0; max-height: none; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.jv-root.jv-mobile .jv-form { flex-shrink: 0; }
.jv-root.jv-mobile .jv-dock { margin-bottom: max(8px, env(safe-area-inset-bottom)); padding: 6px 8px 8px; gap: 4px; }
.jv-root.jv-mobile .jv-status { font-size: 12.5px; }
.jv-root.jv-mobile .jv-dock-row { row-gap: 6px; }
.jv-root.jv-mobile .jv-dock-btn { min-width: 48px; min-height: 48px; }
.jv-root.jv-mobile .jv-mic { width: 64px; height: 64px; }
.jv-root.jv-mobile .jv-rate button { min-height: 36px; }
.jv-root.jv-mobile .jv-diag[open] .jv-diag-body { max-height: 30vh; overflow-y: auto; }
/* short screens: give the conversation the room */
@media (max-height: 720px) {
  .jv-root.jv-mobile .jv-quick { padding: 2px; }
  .jv-root.jv-mobile .jv-q { min-height: 40px; }
  .jv-root.jv-mobile .jv-core-wrap { height: clamp(72px, calc(var(--jv-app-h, 100dvh) * 0.14), 140px); margin-top: 2px; }
  .jv-root.jv-mobile .jv-hud-online { display: none; }
}
@media (max-height: 580px) {
  .jv-root.jv-mobile .jv-left, .jv-root.jv-mobile .jv-core-wrap { display: none; }
  .jv-root.jv-mobile .jv-rate { display: none; }
}
/* compact dock + chat header on phones so the conversation keeps most of the height */
.jv-root.jv-mobile .jv-chat-head { padding: 6px 12px 5px; }
.jv-root.jv-mobile .jv-dock-row { gap: 4px; row-gap: 5px; }
.jv-root.jv-mobile .jv-dock-btn { min-height: 44px; padding: 2px 4px; }
.jv-root.jv-mobile .jv-dock-btn span { font-size: 10.5px; }
.jv-root.jv-mobile .jv-mic { width: 58px; height: 58px; }
.jv-root.jv-mobile .jv-rate button { min-height: 32px; font-size: 12.5px; }
.jv-root.jv-mobile .jv-diag { margin-top: 0; font-size: 11.5px; }
.jv-root.jv-mobile .jv-diag summary { padding: 0; }
.jv-root.jv-mobile .jv-status { line-height: 1.3; }
@media (max-height: 720px) {
  .jv-root.jv-mobile .jv-q-ic { width: 30px; height: 30px; font-size: 15px; }
  .jv-root.jv-mobile .jv-q { min-height: 38px; }
}
/* Pinned to the VISIBLE viewport: the mobile dashboard is position:fixed at
   the visual viewport (jarvis.js syncViewport sets --jv-app-h / --jv-app-top,
   following the keyboard on Android + iOS), so chat content can never grow the
   page or push the MIC panel down — only .jv-log scrolls. */
.jv-root.jv-mobile { position: fixed; left: 0; right: 0; top: var(--jv-app-top, 0px); z-index: 2; height: var(--jv-app-h, 100vh); overscroll-behavior: none; }
@supports (height: 100dvh) { .jv-root.jv-mobile { height: var(--jv-app-h, 100dvh); } }
.jv-root.jv-mobile .jv-msg { overflow-wrap: anywhere; }


/* Conversation timestamps — day separator + HH:mm น. under each bubble (2026-10-18) */
.jv-day { align-self: stretch; display: flex; align-items: center; gap: 10px; margin: 6px 0 2px; color: var(--text-faint); font-size: 11px; letter-spacing: 0.06em; }
.jv-day::before, .jv-day::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.jv-day span { padding: 2px 10px; border: 1px solid var(--border); border-radius: 999px; background: rgba(255, 230, 0, 0.05); white-space: nowrap; }
.jv-time { display: block; margin-top: 4px; font-size: 10.5px; line-height: 1.2; letter-spacing: 0.03em; opacity: 0.55; font-variant-numeric: tabular-nums; white-space: nowrap; }
.jv-msg.user .jv-time { text-align: right; }
.jv-msg.error .jv-time { text-align: center; }
.jv-time.unknown { font-style: italic; }

/* News sources — clickable chips + live/cache line (2026-10-18) */
a.jv-source.link { color: var(--text); text-decoration: none; cursor: pointer; transition: border-color .15s, color .15s; }
a.jv-source.link:hover, a.jv-source.link:focus-visible { border-color: var(--neon, #ffe600); color: var(--neon, #ffe600); outline: none; }
.jv-source.meta { background: transparent; border-style: dashed; color: var(--text-faint); letter-spacing: normal; font-family: inherit; }
