/* ════════════════════════════════════════════════════════════════════
   mobile.css — PAM VECTOR LOGIC dedicated mobile face (served at /m)
   Fully self-contained. Does NOT load dashboard.css. The desktop site is
   never affected by anything in this file.
   Reuses: dashboard_chat.js, dashboard_pamrunner.js, /static/pamrunner.js
   ════════════════════════════════════════════════════════════════════ */

:root {
  --bg:      #030c16;
  --bg1:     #02080f;
  --bg2:     #061828;
  --bg3:     #0b2038;
  --panel:   #071525;
  --border:  #183d60;
  --border2: #265a80;
  --amber:   #ffaa22;
  --amber2:  #dd8800;
  --amber3:  rgba(255,170,34,0.12);
  --green:   #00ff88;
  --green2:  #00cc66;
  --green3:  rgba(0,255,136,0.12);
  --red:     #ff2266;
  --red2:    #cc1144;
  --cyan:    #00eeff;
  --cyan2:   #00bbdd;
  --cyan3:   rgba(0,238,255,0.12);
  --purple:  #8866ff;
  --text:    #eaf5ff;
  --text1:   #eaf5ff;
  --text2:   #8ec8e8;
  --text3:   #4a92b8;
  --mono:    'Share Tech Mono', monospace;
  --display: 'Orbitron', sans-serif;

  --topbar-h: 46px;
  --nav-h:    60px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  overscroll-behavior: none;
}

body {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% -10%, rgba(0,238,255,0.06), transparent 55%),
    var(--bg);
}

/* ── boot splash ───────────────────────────────────────────────── */
#m-boot {
  position: fixed; inset: 0; z-index: 9500;
  background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px;
  transition: opacity .4s ease;
}
#m-boot img { width: 84px; height: 84px; object-fit: contain; opacity: .95;
  filter: drop-shadow(0 0 14px rgba(0,238,255,.4)); }
#m-boot .bt { font-family: var(--display); font-weight: 900; letter-spacing: .2em;
  color: var(--amber); font-size: 15px; }
#m-boot .bs { font-size: 9px; letter-spacing: .35em; color: var(--text3); }
#m-boot .bbar { width: 160px; height: 3px; background: var(--bg3); border-radius: 2px; overflow: hidden; }
#m-boot .bfill { height: 100%; width: 0; background: linear-gradient(90deg,var(--cyan),var(--green));
  animation: mBoot 1.1s ease-out forwards; }
@keyframes mBoot { to { width: 100%; } }

/* ── top bar ───────────────────────────────────────────────────── */
#m-topbar {
  flex: 0 0 var(--topbar-h);
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px;
  background: linear-gradient(180deg, var(--bg2), var(--bg));
  border-bottom: 1px solid var(--border);
}
#m-topbar .logo { width: 24px; height: 24px; object-fit: contain; }
#m-topbar .ttl { font-family: var(--display); font-weight: 900; font-size: 13px;
  letter-spacing: .16em; color: var(--amber); white-space: nowrap; }
#m-topbar .spacer { flex: 1; }
#m-topbar .sysdot { width: 9px; height: 9px; border-radius: 50%; background: var(--text3);
  box-shadow: 0 0 6px currentColor; }
#m-topbar .sysdot.ok  { background: var(--green); }
#m-topbar .sysdot.warn{ background: var(--amber); }
#m-topbar .sysdot.bad { background: var(--red); }
#m-topbar a.deskbtn {
  font-family: var(--mono); font-size: 9px; letter-spacing: .1em;
  color: var(--text3); text-decoration: none;
  border: 1px solid var(--border); border-radius: 4px; padding: 4px 7px;
}

/* ── main view region ──────────────────────────────────────────── */
#m-main { flex: 1 1 auto; position: relative; min-height: 0; }
.m-view {
  position: absolute; inset: 0;
  display: none; flex-direction: column;
  min-height: 0;
}
.m-view.active { display: flex; }
.m-scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 14px; }

/* ── bottom nav ────────────────────────────────────────────────── */
#m-nav {
  flex: 0 0 var(--nav-h);
  display: flex;
  background: linear-gradient(0deg, var(--bg2), var(--bg));
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.navbtn {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  background: none; border: none; cursor: pointer;
  color: var(--text3);
  font-family: var(--display); font-size: 9px; letter-spacing: .12em;
  position: relative;
  transition: color .15s;
}
.navbtn svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.navbtn.active { color: var(--cyan); }
.navbtn.active::before {
  content: ''; position: absolute; top: 0; left: 22%; right: 22%; height: 2px;
  background: var(--cyan); box-shadow: 0 0 8px var(--cyan); border-radius: 2px;
}

/* ════════════════ CHAT VIEW ════════════════ */
#view-chat { background: var(--bg); }
#m-chat {
  display: flex; flex-direction: column; height: 100%; min-height: 0;
}
#m-chat-modes {
  display: flex; align-items: stretch; flex-shrink: 0;
  background: var(--bg3); border-bottom: 1px solid var(--border);
}
#m-chat-modes button.mode {
  flex: 1; border: none; border-right: 1px solid var(--border2);
  padding: 11px 4px; background: rgba(20,52,88,.35); cursor: pointer;
  font-family: var(--display); font-size: 10px; letter-spacing: .06em;
  color: var(--text2);
}
#m-chat-modes button.mode:last-child { border-right: none; }
.chat-controls {
  display: flex; align-items: center; gap: 2px;
  flex-shrink: 0; padding: 0 6px; background: var(--bg3);
  border-bottom: 1px solid var(--border);
}
.chat-controls .grow { flex: 1; }
.chat-controls button, #voice-mic-btn, #voice-spk-btn {
  border: none; background: transparent; cursor: pointer; color: var(--cyan);
  padding: 8px 7px; font-size: 15px; opacity: .85;
}
#chat-clear-btn {
  border: 1px solid var(--amber3); border-radius: 4px; color: var(--amber);
  background: var(--bg2); font-family: var(--mono); font-size: 10px;
  letter-spacing: .08em; padding: 5px 10px; margin: 4px;
}
#voice-waveform { display: flex; align-items: center; gap: 2px; padding: 0 4px; opacity: 0; transition: opacity .2s; }
#voice-waveform .vbar { width: 2px; height: 4px; background: var(--cyan); border-radius: 1px; transition: height .1s; }

#chat-mode-desc {
  padding: 5px 12px; background: var(--bg1); flex-shrink: 0;
  font-family: var(--mono); font-size: 10px; color: var(--text3);
  border-bottom: 1px solid var(--border);
}
#pam-cooldown-bar {
  display: none; padding: 5px 12px; background: var(--bg1); flex-shrink: 0;
  font-family: var(--mono); font-size: 10px; color: var(--text3);
  border-bottom: 1px solid var(--border);
}
#pam-cooldown-val { color: var(--amber); }

.chat-log-pane {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 12px; display: none; flex-direction: column; gap: 8px;
  font-family: var(--mono); font-size: 14px; scroll-behavior: smooth;
}
.eliza-msg {
  max-width: 86%; padding: 9px 13px; border-radius: 9px; line-height: 1.5; word-break: break-word;
}
.eliza-msg--eliza { align-self: flex-start; background: var(--bg3); border: 1px solid var(--border); color: var(--green); }
.eliza-msg--user  { align-self: flex-end;  background: var(--bg1); border: 1px solid var(--cyan); color: var(--text1); }

#m-chat-inputrow {
  display: flex; gap: 8px; padding: 10px; flex-shrink: 0;
  border-top: 1px solid var(--border); background: var(--bg3);
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0));
}
#chat-input {
  flex: 1; background: var(--bg1); border: 1px solid var(--border); border-radius: 8px;
  padding: 11px 13px; color: var(--text1); font-family: var(--mono);
  font-size: 16px; /* ≥16px stops iOS auto-zoom */
}
#m-chat-send {
  border: 1px solid var(--green); border-radius: 8px; background: var(--green3);
  cursor: pointer; padding: 0 18px; font-family: var(--display); font-size: 12px;
  letter-spacing: .08em; color: var(--green);
}
#chat-register-row {
  display: none; gap: 6px; padding: 7px 10px; flex-shrink: 0;
  border-top: 1px solid var(--border); background: var(--bg2); align-items: center;
}
#chat-reg-input {
  flex: 1; background: var(--bg1); border: 1px solid var(--border); border-radius: 6px;
  padding: 8px 10px; color: var(--text2); font-family: var(--mono); font-size: 16px;
}
#chat-register-row button {
  border: 1px solid var(--border); border-radius: 6px; white-space: nowrap;
  background: var(--bg1); cursor: pointer; padding: 8px 10px;
  font-family: var(--mono); font-size: 11px; color: var(--amber);
}
#chat-reg-remain { font-family: var(--mono); font-size: 9px; color: var(--text3); white-space: nowrap; }

/* ════════════════ GAME VIEW ════════════════ */
#view-game { align-items: center; justify-content: center; }
.game-card {
  margin: auto; text-align: center; padding: 30px 26px;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  max-width: 340px;
}
.game-card .gtitle {
  font-family: var(--display); font-weight: 900; font-size: 28px; letter-spacing: .12em;
  color: var(--cyan); text-shadow: 0 0 18px rgba(0,238,255,.4); line-height: 1.1;
}
.game-card .gsub { font-family: var(--mono); font-size: 11px; color: var(--text3); letter-spacing: .14em; }
.game-card .gart {
  width: 130px; height: 130px; border-radius: 50%;
  border: 1px solid var(--border2);
  background: radial-gradient(circle at 38% 32%, rgba(0,238,255,.18), transparent 60%), var(--bg2);
  display: flex; align-items: center; justify-content: center; font-size: 56px;
  box-shadow: 0 0 30px rgba(0,238,255,.12) inset;
}
.game-card .play {
  margin-top: 6px;
  border: 1.5px solid var(--green); border-radius: 10px; background: var(--green3);
  color: var(--green); font-family: var(--display); font-weight: 700; font-size: 17px;
  letter-spacing: .12em; padding: 15px 44px; cursor: pointer;
  box-shadow: 0 0 22px rgba(0,255,136,.18);
}
.game-card .play:active { transform: scale(.97); }
.game-card .ghint {
  font-family: var(--mono); font-size: 10px; color: var(--amber2);
  display: flex; align-items: center; gap: 6px;
}

/* ════════════════ SYSTEM VIEW ════════════════ */
.sys-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 16px; margin-bottom: 12px;
}
.sys-card h3 {
  margin: 0 0 10px; font-family: var(--display); font-size: 11px; letter-spacing: .16em;
  color: var(--amber); font-weight: 700;
}
.sys-row { display: flex; justify-content: space-between; align-items: baseline;
  padding: 6px 0; border-bottom: 1px dashed rgba(38,90,128,.35); font-size: 13px; }
.sys-row:last-child { border-bottom: none; }
.sys-row .k { color: var(--text3); font-size: 11px; letter-spacing: .06em; }
.sys-row .v { color: var(--text); font-family: var(--mono); }
.sys-row .v.good { color: var(--green); }
.sys-row .v.warn { color: var(--amber); }
.sys-row .v.bad  { color: var(--red); }
.sys-row .v.dim  { color: var(--text3); }
/* BRAIN view (2026-07-04): CL-SDK note + dream prompt text */
.clnote { font-size: 10px; color: var(--text3); font-style: italic; margin-top: 8px; letter-spacing: .04em; }
.dreamtext { font-size: 11.5px; color: var(--text2); font-family: var(--mono); line-height: 1.55; margin-top: 8px;
  border-left: 2px solid var(--cyan3); padding-left: 10px; }
.sys-links a {
  display: block; text-align: center; text-decoration: none;
  border: 1px solid var(--border2); border-radius: 8px; padding: 12px;
  margin-bottom: 10px; color: var(--cyan); font-family: var(--display);
  font-size: 12px; letter-spacing: .12em;
}

/* ════════════════ PAMRUNNER OVERLAY (game) ════════════════ */
/* The overlay markup is reused from desktop; here we style the on-screen
   gamepad (desktop hides it). Overlay itself is positioned via inline styles. */
#pamgamepad { display: block; }
#pamgp-dpad { width: 168px; height: 168px; }
.gp-btn {
  -webkit-appearance: none; appearance: none;
  background: rgba(0,219,255,.10);
  border: 1.5px solid rgba(0,219,255,.55);
  color: #00dbff;
  width: 54px; height: 54px; border-radius: 12px;
  font-size: 20px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.gp-btn:active { background: rgba(0,219,255,.30); }
#pamgp-dpad .gp-btn { position: relative; margin: 2px auto; display: flex; }
.gp-mid-row { display: flex; align-items: center; justify-content: center; gap: 4px; }
.gp-center { width: 54px; height: 54px; }
.gp-fire {
  width: 92px; height: 92px; border-radius: 50%;
  background: rgba(255,34,102,.14); border-color: rgba(255,34,102,.6);
  color: #ff5588; font-family: var(--display); font-weight: 700; font-size: 16px; letter-spacing: .08em;
}
.gp-fire:active { background: rgba(255,34,102,.34); }

/* In landscape, gamepad sits flush at the bottom corners (inline-positioned). */
@media (orientation: portrait) {
  /* game is landscape-only; the built-in #pamrunner-portrait-hint covers the screen */
  #pamgamepad { display: none; }
}

/* ══ MOBILE WAVE (2026-07-01) ══════════════════════════════════════════ */

/* Notch/safe-area: viewport-fit=cover means the topbar must clear the sensor
   housing (bottom insets were already handled on nav + input row). */
#m-topbar {
  flex-basis: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
}

/* Keyboard focus ring — parity with desktop UX.5, same palette. */
:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Touch targets: icon buttons in the chat control strip were ~31px tall. */
.chat-controls button, #voice-mic-btn, #voice-spk-btn { min-height: 44px; min-width: 40px; }
#eliza-info-btn { font-size: 16px; color: var(--cyan); }
#m-topbar a.deskbtn { padding: 8px 10px; }
#m-topbar .topbtn {
  border: 1px solid var(--border); border-radius: 4px; background: var(--bg2);
  color: var(--cyan); font-family: var(--mono); font-size: 13px; line-height: 1;
  padding: 7px 11px; cursor: pointer;
}

/* Connection-honesty banner (mobile.js drives it). */
#m-offline {
  display: none; flex-shrink: 0;
  background: linear-gradient(90deg, #3d0011, #5c0019, #3d0011);
  border-bottom: 1px solid var(--red2);
  color: var(--red); font-family: var(--mono); font-size: 11px;
  letter-spacing: .08em; text-align: center; padding: 6px 10px;
}
#m-offline.on { display: block; }

/* SYSTEM view additions. */
.sys-card h3 { display: flex; align-items: center; justify-content: space-between; }
.sys-card .refbtn {
  border: 1px solid var(--border2); border-radius: 6px; background: var(--bg2);
  color: var(--cyan); font-size: 15px; line-height: 1; padding: 7px 12px; cursor: pointer;
}
.about-teaser {
  margin: 0 0 12px; font-family: var(--mono); font-size: 12px;
  line-height: 1.65; color: var(--text2);
}
.aboutbtn {
  width: 100%; border: 1px solid var(--cyan2); border-radius: 8px;
  background: var(--cyan3); color: var(--cyan); font-family: var(--display);
  font-size: 11px; letter-spacing: .1em; padding: 12px; cursor: pointer;
}

/* Help / about sheet (bottom sheet on phones). */
#m-sheet {
  display: none; position: fixed; inset: 0; z-index: 9300;
  background: rgba(2, 5, 12, .82); backdrop-filter: blur(2px);
  align-items: flex-end; justify-content: center;
}
#m-sheet.on { display: flex; }
#m-sheet-box {
  position: relative; width: 100%; max-width: 560px;
  max-height: 84dvh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 14px 14px 0 0; padding: 22px 20px;
  padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px));
}
#m-sheet-close {
  position: absolute; top: 8px; right: 8px; background: none; border: none;
  color: var(--text3); font-size: 17px; line-height: 1; cursor: pointer; padding: 10px;
}
#m-sheet-body h1, #m-sheet-body h2 {
  font-family: var(--display); font-size: 13px; color: var(--cyan);
  letter-spacing: .12em; margin: 0 0 12px;
}
#m-sheet-body h3 {
  font-family: var(--display); font-size: 10px; color: var(--amber);
  letter-spacing: .1em; margin: 16px 0 6px;
}
#m-sheet-body p, #m-sheet-body li {
  font-family: var(--mono); font-size: 12px; line-height: 1.7; color: var(--text2);
}
#m-sheet-body ul { margin: 4px 0 4px 16px; padding: 0; }
#m-sheet-body b { color: var(--text); }

/* Reduced motion — parity with desktop UX.7. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
