/* RoadMate AI 2.8.0 — CLEAN UI REBASE
   One stylesheet. No stacked version hotfixes. */

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

:root{
  --bg:#050b16;
  --panel:#091427;
  --panel-2:#0c1a2b;
  --text:#f1f7ff;
  --muted:#8799ad;
  --line:rgba(123,174,224,.14);
  --green:#43dda0;
  --yellow:#f2c64d;
  --orange:#f28b4d;
  --red:#ff5267;
  --blue:#2b8dff;
  --cyan:#60dcff;

  --safe-top:env(safe-area-inset-top,0px);
  --safe-bottom:env(safe-area-inset-bottom,0px);

  --gap:9px;
  --pad-x:16px;
  --topbar-h:58px;
  --safety-h:44px;
  --controls-h:64px;
  --control-size:64px;
  --cta-h:62px;
  --message-h:clamp(112px,15dvh,132px);
  --robot-scale:.96;
  --tabbar-h:58px;
  --tabbar-space:calc(var(--tabbar-h) + var(--safe-bottom));
}

html,
body{
  width:100%;
  height:100%;
  min-height:100%;
  margin:0;
  overflow:hidden;
  background:var(--bg);
  color:var(--text);
  font-family:-apple-system,BlinkMacSystemFont,"SF Pro Display","SF Pro Text","Segoe UI",sans-serif;
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
}

body{
  position:fixed;
  inset:0;
  height:100dvh;
  min-height:100dvh;
  overscroll-behavior:none;
}

button,
input,
select,
textarea{
  font:inherit;
}

button{
  -webkit-user-select:none;
  user-select:none;
}

svg{display:block}
.hidden,.hidden-wave{display:none!important}
.sr-only{
  position:absolute;
  width:1px;
  height:1px;
  overflow:hidden;
  clip:rect(0,0,0,0);
  white-space:nowrap;
}

/* ---------- MAIN SCREEN ---------- */

.app-shell{
  position:fixed;
  top:0;
  bottom:0;
  left:50%;
  transform:translateX(-50%);
  width:min(720px,100%);
  height:100dvh;
  min-height:100dvh;
  padding:
    calc(var(--safe-top) + 7px)
    var(--pad-x)
    var(--tabbar-space);
  display:grid;
  grid-template-rows:
    var(--topbar-h)
    minmax(0,1fr)
    var(--safety-h)
    var(--controls-h)
    auto;
  gap:var(--gap);
  overflow:hidden;
}

.topbar{
  position:relative;
  z-index:100;
  height:var(--topbar-h);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.brand{
  font-size:23px;
  line-height:1;
  font-weight:900;
  letter-spacing:-.65px;
}
.brand span{color:var(--cyan)}

.status-line{
  display:flex;
  align-items:center;
  gap:7px;
  margin-top:5px;
  color:var(--muted);
  font-size:11px;
  font-weight:700;
}

.status-dot{
  width:7px;
  height:7px;
  border-radius:50%;
  background:#5e6877;
}
.status-dot.live{background:var(--green)}
.status-dot.warn{background:var(--yellow)}
.status-dot.danger,.status-dot.error{background:var(--red)}

.topbar-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
}

.camera-status-btn,
.settings-status-btn{
  position:relative;
  z-index:110;
  width:50px;
  height:50px;
  min-width:50px;
  min-height:50px;
  padding:0;
  display:grid;
  place-items:center;
  border-radius:16px;
  border:1px solid rgba(126,179,230,.16);
  background:#0a1423;
  color:#9badc0;
  box-shadow:0 8px 22px rgba(0,0,0,.16);
  touch-action:manipulation;
}
.settings-status-btn::after{
  content:"";
  position:absolute;
  inset:-8px;
}
.settings-status-btn:active,
.settings-status-btn.is-pressed{
  transform:scale(.94);
}
.settings-status-btn svg{
  width:25px;
  height:25px;
  fill:currentColor;
}

/* ---------- HERO / ROBOT ---------- */

.hero{
  position:relative;
  min-height:0;
  height:100%;
  overflow:hidden;
  display:grid;
  grid-template-rows:minmax(0,1fr) var(--message-h) auto auto;
  gap:8px;
}

.hero-bg{
  position:absolute;
  inset:0;
  pointer-events:none;
  background:
    radial-gradient(circle at 50% 31%,rgba(54,217,255,.085),transparent 30%);
}

.robot-card{
  position:relative;
  min-height:0;
  overflow:hidden;
  display:flex;
  align-items:center;
  justify-content:center;
}

.robot-halo{
  position:absolute;
  width:272px;
  height:272px;
  border-radius:50%;
  background:radial-gradient(circle,rgba(49,217,255,.15),rgba(43,109,255,.035) 54%,transparent 75%);
  transform:scale(var(--robot-scale));
  transition:filter .18s ease,opacity .18s ease;
}

.robot-card.speaking .robot-halo{
  filter:brightness(1.45);
}

.robot{
  position:relative;
  width:220px;
  height:255px;
  transform:scale(var(--robot-scale));
  transform-origin:center center;
  isolation:isolate;
}

.robot-head{
  position:absolute;
  z-index:5;
  left:26px;
  top:18px;
  width:168px;
  height:132px;
  border-radius:42%;
  background:linear-gradient(145deg,#f8fcff,#acbac9);
  box-shadow:
    inset -10px -10px 18px rgba(17,35,54,.24),
    inset 8px 8px 18px rgba(255,255,255,.78);
}

.face{
  position:absolute;
  inset:18px 16px 16px;
  border-radius:33%;
  background:radial-gradient(circle at 50% 18%,#1d3a56,#06101a 68%);
  border:2px solid rgba(123,226,255,.28);
}

.eye{
  position:absolute;
  top:38px;
  width:28px;
  height:30px;
  border-radius:50%;
  border-top:5px solid #59dfff;
}
.eye.left{left:30px}
.eye.right{right:30px}

.robot-card.listening .eye{
  filter:drop-shadow(0 0 6px rgba(89,223,255,.62));
}

.mouth{
  position:absolute;
  left:50%;
  bottom:20px;
  transform:translateX(-50%);
  width:36px;
  height:16px;
  border-bottom:4px solid #59dfff;
  border-radius:0 0 18px 18px;
}
.robot-card.speaking .mouth{
  height:22px;
  border:3px solid #59dfff;
  border-top:0;
}

.ear{
  position:absolute;
  top:40px;
  width:22px;
  height:48px;
  border-radius:16px;
  background:#64798a;
  box-shadow:inset 0 0 0 4px #dbe7ef;
}
.ear.left{left:-16px}
.ear.right{right:-16px}
.robot-card.listening .ear{
  box-shadow:
    inset 0 0 0 4px #dbe7ef,
    0 0 14px rgba(89,223,255,.38);
}

.antenna{
  position:absolute;
  z-index:4;
  left:50%;
  top:-13px;
  width:28px;
  height:38px;
  transform:translateX(-50%);
}
.antenna-stem{
  position:absolute;
  left:50%;
  bottom:0;
  width:4px;
  height:27px;
  transform:translateX(-50%);
  border-radius:4px;
  background:#879bab;
}
.antenna-tip{
  position:absolute;
  left:50%;
  top:0;
  width:11px;
  height:11px;
  transform:translateX(-50%);
  border-radius:50%;
  background:#60dcff;
  box-shadow:0 0 13px rgba(96,220,255,.52);
}

.robot-neck{
  position:absolute;
  z-index:2;
  left:50%;
  top:144px;
  width:62px;
  height:28px;
  transform:translateX(-50%);
  border-radius:12px;
  background:#27384a;
}

.robot-body{
  position:absolute;
  z-index:3;
  left:28px;
  bottom:0;
  width:164px;
  height:100px;
  border-radius:40px 40px 18px 18px;
  background:linear-gradient(145deg,#edf4fa,#8799ab);
  box-shadow:inset -10px -10px 18px rgba(18,38,59,.28);
}

.core{
  position:absolute;
  left:50%;
  top:22px;
  width:58px;
  height:58px;
  transform:translateX(-50%);
  border-radius:18px;
  background:radial-gradient(circle,#0a1630 16%,#08121e 64%);
  border:1px solid rgba(255,255,255,.08);
}
.core::after{
  content:"";
  position:absolute;
  left:50%;
  top:50%;
  width:26px;
  height:10px;
  transform:translate(-50%,-50%);
  border-left:4px solid #46ddff;
  border-right:4px solid #46ddff;
  border-bottom:4px solid #46ddff;
  border-radius:0 0 12px 12px;
}

.robot-arm{
  position:absolute;
  z-index:1;
  top:164px;
  width:44px;
  height:74px;
}
.robot-arm.left{left:5px;transform:rotate(13deg)}
.robot-arm.right{right:5px;transform:rotate(-13deg)}
.arm-segment{
  position:absolute;
  inset:0 8px 17px;
  border-radius:18px;
  background:linear-gradient(145deg,#e7eef5,#8395a7);
}
.robot-hand{
  position:absolute;
  left:8px;
  bottom:0;
  width:28px;
  height:28px;
  border-radius:50%;
  background:#c7d2dc;
  box-shadow:inset -5px -5px 8px rgba(26,43,58,.18);
}

/* ---------- AI MESSAGE ---------- */

.message-card{
  position:relative;
  z-index:2;
  width:100%;
  height:100%;
  min-height:0;
  padding:13px 14px;
  display:grid;
  grid-template-columns:40px minmax(0,1fr) 28px;
  gap:12px;
  align-items:center;
  overflow:hidden;
  border:1px solid rgba(81,169,255,.23);
  border-radius:21px;
  background:linear-gradient(145deg,rgba(12,49,91,.98),rgba(7,28,53,.98));
  box-shadow:0 14px 34px rgba(0,0,0,.18);
}

.message-icon{
  width:40px;
  height:40px;
  display:grid;
  place-items:center;
  border-radius:13px;
  background:rgba(80,190,255,.11);
  color:#72dcff;
}
.message-icon svg{
  width:23px;
  height:23px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.8;
}

.message-content{
  min-width:0;
  min-height:0;
  max-height:100%;
  overflow-y:auto;
  -webkit-overflow-scrolling:touch;
  overscroll-behavior:contain;
  scrollbar-width:none;
}
.message-content::-webkit-scrollbar{display:none}

.message-title{
  margin:0;
  color:#f1f7ff;
  font-size:15px;
  line-height:1.28;
  font-weight:850;
}
.message-sub{
  margin-top:5px;
  color:#a8bfd3;
  font-size:12px;
  line-height:1.4;
  font-weight:550;
}

.message-audio{
  height:30px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:2px;
}
.message-audio span{
  width:3px;
  height:9px;
  border-radius:3px;
  background:#57dfff;
  opacity:.55;
}
.robot-card.speaking ~ .message-card .message-audio span,
.message-card.is-talking .message-audio span{
  opacity:1;
}

/* ---------- ROUTE ---------- */

.route-strip{
  width:100%;
  min-height:52px;
  padding:8px 11px;
  display:grid;
  grid-template-columns:34px minmax(0,1fr) 18px;
  gap:9px;
  align-items:center;
  border:1px solid rgba(83,171,229,.16);
  border-radius:16px;
  background:#071522;
  color:#e9f6ff;
  text-align:left;
  touch-action:manipulation;
}
.route-pin{
  width:34px;
  height:34px;
  display:grid;
  place-items:center;
  border-radius:11px;
  background:rgba(66,202,255,.1);
  color:#59dfff;
}
.route-pin svg{
  width:20px;
  height:20px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.8;
}
.route-copy{min-width:0}
.route-copy strong,
.route-copy span{
  display:block;
  overflow:hidden;
  white-space:nowrap;
  text-overflow:ellipsis;
}
.route-copy strong{font-size:12px}
.route-copy span{
  margin-top:2px;
  color:#8299ac;
  font-size:10px;
}
.route-chevron{
  color:#6d8497;
  font-size:24px;
  line-height:1;
}

/* ---------- LISTENING WAVE ---------- */

.wave{
  height:10px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:4px;
}
.wave span{
  width:4px;
  height:5px;
  border-radius:4px;
  background:#59dfff;
}

/* ---------- SAFETY ---------- */

.safety-zone{
  width:100%;
  height:var(--safety-h);
  min-height:var(--safety-h);
  overflow:hidden;
}

.safety-bar{
  position:relative;
  width:100%;
  height:100%;
  overflow:hidden;
  border-radius:16px;
  background:#0b1725;
  border:1px solid rgba(125,176,220,.12);
}

.safety-fill{
  position:absolute;
  inset:0;
  transform-origin:left center;
  background:linear-gradient(90deg,rgba(67,221,160,.72),rgba(69,196,167,.64));
  opacity:.72;
}

.safety-label{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  color:#eafbf4;
  font-size:11px;
  font-weight:900;
  letter-spacing:1.2px;
}

.safety-bar.level-yellow .safety-fill{background:var(--yellow)}
.safety-bar.level-orange .safety-fill{background:var(--orange)}
.safety-bar.level-red .safety-fill{background:var(--red)}
.safety-bar.level-paused .safety-fill{background:#59687a;opacity:.4}

.warning-banner{
  width:100%;
  height:100%;
  padding:0 12px;
  display:flex;
  align-items:center;
  gap:8px;
  border-radius:16px;
  background:#2c2413;
  border:1px solid rgba(242,198,77,.25);
  color:#ffe59c;
  font-size:11px;
  font-weight:700;
}
.warning-banner svg{
  width:20px;
  height:20px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.8;
}

/* ---------- CONTROLS ---------- */

.controls{
  width:100%;
  height:var(--controls-h);
  display:grid;
  grid-template-columns:repeat(4,var(--control-size));
  gap:14px;
  align-items:center;
  justify-content:center;
}

.control-btn{
  position:relative;
  width:var(--control-size);
  height:var(--control-size);
  min-width:var(--control-size);
  min-height:var(--control-size);
  padding:0;
  display:grid;
  place-items:center;
  border-radius:20px;
  border:1px solid rgba(67,221,160,.20);
  background:rgba(67,221,160,.10);
  color:var(--green);
  touch-action:manipulation;
}
.control-btn:active{transform:scale(.96)}
.control-btn.off,
.control-btn.is-disabled,
.control-btn:disabled{
  opacity:.35;
  filter:saturate(.5);
  box-shadow:none;
}
.control-btn svg{
  width:30px;
  height:30px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.8;
  stroke-linecap:round;
  stroke-linejoin:round;
}
.control-btn .icon-off{display:none}
.control-btn.off .icon-on{display:none}
.control-btn.off .icon-off{display:block}
.pause-control .resume-icon{display:none}
.pause-control.paused .pause-icon{display:none}
.pause-control.paused .resume-icon{display:block}

.control-camera-dot{
  position:absolute;
  right:9px;
  top:9px;
  width:8px;
  height:8px;
  border-radius:50%;
  background:var(--green);
  border:2px solid #0d1c20;
}
.control-camera-dot.off{background:#647282}

/* ---------- PRIMARY CTA ---------- */

.bottom-action{
  width:calc(100% + (var(--pad-x) * 2));
  margin-left:calc(var(--pad-x) * -1);
  padding:
    8px
    var(--pad-x)
    8px;
  background:var(--bg);
  border-top:1px solid rgba(123,174,224,.08);
}

.start-btn{
  width:100%;
  height:var(--cta-h);
  min-height:var(--cta-h);
  margin:0;
  padding:0 16px;

  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;

  border:1px solid rgba(100,177,255,.45);
  border-radius:20px;
  background:linear-gradient(180deg,#2f92ff,#1764cf);
  color:#fff;
  box-shadow:
    0 10px 28px rgba(28,111,224,.24),
    0 0 18px rgba(72,155,255,.10),
    inset 0 1px 0 rgba(255,255,255,.15);

  font-size:13px;
  font-weight:900;
  letter-spacing:.45px;
  touch-action:manipulation;
}
.start-btn:active{transform:scale(.985)}

.start-btn.active{
  background:#281319;
  border-color:rgba(255,82,103,.30);
}
.start-btn.paused{
  background:#181e27;
  border-color:rgba(255,255,255,.08);
  color:#98a5b4;
}
.start-icon svg{
  width:22px;
  height:22px;
  fill:currentColor;
}
.live-divider,.live-time{display:none}
.start-btn.active .live-divider{
  display:block;
  width:1px;
  height:20px;
  background:rgba(255,255,255,.18);
}
.start-btn.active .live-time{
  display:block;
  color:#ffd9dd;
  font-size:12px;
  font-variant-numeric:tabular-nums;
}

/* ---------- EMERGENCY ---------- */

.emergency-overlay{
  position:fixed;
  inset:0;
  z-index:200000;
  padding:
    calc(var(--safe-top) + 18px)
    18px
    calc(var(--safe-bottom) + 18px);
  display:grid;
  place-items:center;
  background:rgba(26,2,7,.92);
  backdrop-filter:blur(12px);
}

.emergency-panel{
  width:min(520px,100%);
  padding:26px 20px 20px;
  border:1px solid rgba(255,82,103,.36);
  border-radius:24px;
  background:#190b10;
  box-shadow:0 24px 70px rgba(0,0,0,.5);
  text-align:center;
}

.emergency-title{
  color:#ff6679;
  font-size:22px;
  font-weight:950;
  letter-spacing:.5px;
}
.emergency-reason{
  margin-top:12px;
  color:#fff;
  font-size:17px;
  line-height:1.35;
  font-weight:800;
}
.emergency-instruction{
  margin-top:18px;
  color:#ffb8c1;
  font-size:13px;
}
.emergency-sub{
  margin-top:9px;
  color:#bbaab0;
  font-size:11px;
  line-height:1.5;
}
.emergency-confirm-btn{
  width:100%;
  min-height:62px;
  margin-top:20px;
  border:0;
  border-radius:18px;
  background:#ff5267;
  color:#fff;
  font-size:15px;
  font-weight:950;
  touch-action:manipulation;
}

/* ---------- MAP & CAMERA SCREENS ---------- */

dialog{
  color:var(--text);
}

.map-dialog,
.camera-dialog{
  width:min(680px,calc(100% - 24px));
  max-height:calc(100dvh - var(--safe-top) - var(--safe-bottom) - 24px);
  padding:0;
  overflow:hidden;
  border:1px solid rgba(123,174,224,.16);
  border-radius:22px;
  background:#081421;
  color:var(--text);
  box-shadow:0 24px 70px rgba(0,0,0,.45);
}
.map-dialog::backdrop,
.camera-dialog::backdrop{
  background:rgba(1,6,12,.76);
  backdrop-filter:blur(8px);
}

.camera-head{
  min-height:64px;
  padding:10px 12px 10px 16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  border-bottom:1px solid rgba(123,174,224,.10);
}
.camera-head small{
  display:block;
  color:var(--cyan);
  font-size:9px;
  font-weight:900;
  letter-spacing:1.3px;
}
.camera-head strong{
  display:block;
  margin-top:2px;
  font-size:18px;
}

.close-btn{
  width:46px;
  height:46px;
  padding:0;
  display:grid;
  place-items:center;
  border:1px solid rgba(123,174,224,.14);
  border-radius:14px;
  background:#0d1b2a;
  color:#c8d5e1;
  font-size:28px;
  touch-action:manipulation;
}

.camera-body,
.map-dialog-body{
  padding:14px;
}

.camera-box{
  position:relative;
  width:100%;
  aspect-ratio:4/3;
  overflow:hidden;
  border-radius:17px;
  background:#030810;
}
.camera-box video{
  width:100%;
  height:100%;
  object-fit:cover;
}
.camera-placeholder{
  position:absolute;
  inset:0;
  display:grid;
  place-items:center;
  color:#6f8296;
  font-size:12px;
}

.camera-ai-status,
.camera-config-summary,
.map-route-meta{
  margin-top:10px;
  color:#9cafc0;
  font-size:11px;
  line-height:1.4;
}

.camera-toggle-btn,
.map-open-btn{
  width:100%;
  min-height:52px;
  margin-top:12px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  border:1px solid rgba(67,221,160,.22);
  border-radius:15px;
  background:#0b2330;
  color:#dffdf1;
  font-weight:850;
  text-decoration:none;
  touch-action:manipulation;
}
.camera-toggle-btn.off{
  border-color:rgba(123,174,224,.13);
  background:#0a1724;
  color:#9badbd;
}

.map-frame-wrap{
  position:relative;
  width:100%;
  height:min(55dvh,430px);
  overflow:hidden;
  border-radius:17px;
  background:#030810;
}
#routeMapFrame{
  width:100%;
  height:100%;
  border:0;
}
.map-unavailable{
  position:absolute;
  inset:0;
  display:grid;
  place-items:center;
  padding:20px;
  color:#8398aa;
  text-align:center;
}

/* ---------- SETTINGS SPA ---------- */

.settings-panel{
  --s-bg:#050b16;
  --s-panel:#0a1422;
  --s-line:rgba(149,177,207,.14);
  --s-text:#eff6ff;
  --s-muted:#8293a8;
  --s-accent:#58dbff;

  position:fixed;
  inset:0;
  z-index:150000;
  width:100%;
  height:100dvh;
  background:var(--s-bg);
  color:var(--s-text);
  transform:translate3d(100%,0,0);
  transition:transform .26s cubic-bezier(.2,.8,.2,1);
  will-change:transform;
  visibility:hidden;
  pointer-events:none;
  overflow:hidden;
}
.settings-panel.is-open{
  transform:translate3d(0,0,0);
  visibility:visible;
  pointer-events:auto;
}
.settings-panel.is-open *{pointer-events:auto}

.settings-panel-shell{
  width:100%;
  height:100%;
  overflow-y:auto;
  overflow-x:hidden;
  -webkit-overflow-scrolling:touch;
  overscroll-behavior-y:contain;
  padding:
    calc(var(--safe-top) + 76px)
    14px
    calc(var(--safe-bottom) + 34px);
}

.settings-shell{
  width:min(720px,100%);
  min-height:max-content;
  margin:0 auto;
}

.settings-head{
  position:fixed;
  top:0;
  left:50%;
  z-index:20;
  width:min(720px,100%);
  min-height:72px;
  transform:translateX(-50%);
  padding:
    calc(var(--safe-top) + 10px)
    14px
    9px;
  display:grid;
  grid-template-columns:54px 1fr;
  gap:11px;
  align-items:center;
  background:rgba(5,11,22,.98);
  border-bottom:1px solid rgba(255,255,255,.07);
}
.settings-head small{
  color:var(--s-accent);
  font-size:9px;
  font-weight:900;
  letter-spacing:1.4px;
}
.settings-head h1{
  margin:2px 0 0;
  font-size:23px;
  line-height:1.05;
}

.back-btn{
  width:50px;
  height:50px;
  padding:0;
  display:grid;
  place-items:center;
  border:1px solid var(--s-line);
  border-radius:15px;
  background:#0b1625;
  color:#d8e3ee;
  font-size:29px;
  line-height:1;
  touch-action:manipulation;
}
.back-btn:active,
.back-btn.is-pressed{transform:scale(.94)}

.group{
  margin-top:11px;
  overflow:hidden;
  border:1px solid var(--s-line);
  border-radius:17px;
  background:var(--s-panel);
}
.group:first-of-type{margin-top:0}

.group-title{
  padding:12px 13px 7px;
  color:#718399;
  font-size:9px;
  font-weight:900;
  letter-spacing:1.25px;
}

.row{
  min-height:55px;
  padding:8px 13px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  border-top:1px solid var(--s-line);
  color:var(--s-text);
  font-size:13px;
}
.group-title + .row{border-top:0}
.row > span:first-child{
  flex:1 1 auto;
  min-width:0;
}

.row select,
.row input{
  width:min(250px,58%);
  min-height:44px;
  padding:0 11px;
  border:1px solid rgba(149,177,207,.18);
  border-radius:12px;
  background:#07111e;
  color:var(--s-text);
  outline:none;
}

.row.info span:last-child{
  max-width:58%;
  color:#b7c7d8;
  text-align:right;
  word-break:break-word;
}

.settings-panel textarea{
  display:block;
  width:calc(100% - 26px);
  min-height:120px;
  margin:8px 13px 13px;
  padding:12px;
  resize:vertical;
  border:1px solid rgba(149,177,207,.18);
  border-radius:13px;
  background:#07111e;
  color:var(--s-text);
  outline:none;
}

.note{
  padding:0 13px 13px;
  color:#8396aa;
  font-size:11px;
  line-height:1.45;
}

.action-btn,
.save-btn{
  width:calc(100% - 26px);
  min-height:50px;
  margin:10px 13px 13px;
  border:1px solid rgba(88,219,255,.22);
  border-radius:14px;
  background:#0b2034;
  color:#e9f7ff;
  font-weight:800;
  touch-action:manipulation;
}

.save-btn{
  width:100%;
  min-height:58px;
  margin:16px 0 0;
  border-color:rgba(91,175,255,.38);
  background:linear-gradient(180deg,#258cf2,#1768d3);
  box-shadow:0 8px 24px rgba(20,100,220,.22);
}

.action-btn:active,
.save-btn:active{transform:scale(.985)}

.settings-shell::after{
  content:"";
  display:block;
  height:calc(var(--safe-bottom) + 22px);
}

body.settings-open{overflow:hidden!important}



/* =========================================================
   V2.8.2 — ROBOT MOTION
   Listening waves, natural blink, real-audio mouth + halo glow.
   ========================================================= */

/* Natural blinking is always alive, including idle/listening/speaking. */
.eye{
  animation:rmRobotBlink 3.8s ease-in-out infinite;
  transform-origin:center center;
  will-change:transform,opacity;
}
.eye.right{animation-delay:.035s}

@keyframes rmRobotBlink{
  0%,84%,90%,100%{
    transform:scaleY(1);
    opacity:1;
  }
  86.2%,87.8%{
    transform:scaleY(.04);
    opacity:.42;
  }
}

/* Listening: ears emit two expanding cyan waves on each side. */
.ear::before,
.ear::after{
  content:"";
  position:absolute;
  top:50%;
  width:18px;
  height:18px;
  border:2px solid rgba(89,223,255,.82);
  border-radius:50%;
  opacity:0;
  pointer-events:none;
  will-change:transform,opacity;
}
.ear.left::before,
.ear.left::after{
  left:-12px;
  --rm-ear-x:-100%;
}
.ear.right::before,
.ear.right::after{
  right:-12px;
  --rm-ear-x:100%;
}
.robot-card.listening:not(.is-talking) .ear::before{
  animation:rmEarWave 1.08s ease-out infinite;
}
.robot-card.listening:not(.is-talking) .ear::after{
  animation:rmEarWave 1.08s ease-out .31s infinite;
}
@keyframes rmEarWave{
  0%{
    opacity:0;
    transform:translate(var(--rm-ear-x),-50%) scale(.42);
  }
  26%{opacity:.82}
  100%{
    opacity:0;
    transform:translate(var(--rm-ear-x),-50%) scale(1.72);
  }
}


.ear{
  overflow:visible!important;
  z-index:20;
}
.ear::before,
.ear::after{
  z-index:30;
  width:24px;
  height:36px;
  border:3px solid rgba(89,223,255,.94);
  box-shadow:0 0 9px rgba(89,223,255,.32);
}
.ear.left::before,
.ear.left::after{
  left:-17px;
  border-right-color:transparent;
  --rm-ear-x:-72%;
}
.ear.right::before,
.ear.right::after{
  right:-17px;
  border-left-color:transparent;
  --rm-ear-x:72%;
}
.robot-card.listening .ear::before{
  animation:rmEarWaveStrong .95s ease-out infinite!important;
}
.robot-card.listening .ear::after{
  animation:rmEarWaveStrong .95s ease-out .28s infinite!important;
}
@keyframes rmEarWaveStrong{
  0%{
    opacity:0;
    transform:translate(var(--rm-ear-x),-50%) scale(.45);
  }
  20%{opacity:1}
  100%{
    opacity:0;
    transform:translate(var(--rm-ear-x),-50%) scale(1.72);
  }
}

/* Listening gets a soft breathing halo rather than a static glow. */
.robot-card.listening:not(.is-talking) .robot-halo{
  animation:rmHaloListen 1.85s ease-in-out infinite;
}
@keyframes rmHaloListen{
  0%,100%{
    opacity:.72;
    filter:brightness(1);
  }
  50%{
    opacity:1;
    filter:brightness(1.22) blur(1px);
  }
}

/* Real speaking:
   app.js already toggles .is-talking from audio.onplay / SpeechSynthesis.onstart.
*/
.robot-card.is-talking .mouth,
.robot-card.speaking .mouth{
  animation:rmMouthTalk .16s linear infinite!important;
  will-change:width,height,transform;
}
@keyframes rmMouthTalk{
  0%{
    width:34px;
    height:7px;
    border:0;
    border-bottom:4px solid #59dfff;
    border-radius:0 0 18px 18px;
    transform:translateX(-50%) scaleY(.55);
  }
  34%{
    width:24px;
    height:25px;
    border:3px solid #59dfff;
    border-top:0;
    border-radius:0 0 15px 15px;
    transform:translateX(-50%) scaleY(1.08);
  }
  68%{
    width:31px;
    height:14px;
    border:2px solid #59dfff;
    border-top:0;
    border-radius:0 0 14px 14px;
    transform:translateX(-50%) scaleY(.78);
  }
  100%{
    width:21px;
    height:21px;
    border:3px solid #59dfff;
    border-top:0;
    border-radius:0 0 13px 13px;
    transform:translateX(-50%) scaleY(1);
  }
}

/* Keep responsive base scale separate from the animated transform.
   Individual 'scale' preserves the robot-size CSS variable while transform pulses.
*/
.robot-halo{
  transform:none;
  scale:var(--robot-scale);
  transform-origin:center center;
  will-change:transform,filter,opacity;
}
.robot-card.is-talking .robot-halo,
.robot-card.speaking .robot-halo{
  animation:rmHaloSpeak .84s ease-in-out infinite;
}
@keyframes rmHaloSpeak{
  0%,100%{
    transform:scale(1);
    opacity:.72;
    filter:brightness(1.05) blur(0);
  }
  50%{
    transform:scale(1.16);
    opacity:1;
    filter:brightness(1.68) blur(2px)
      drop-shadow(0 0 26px rgba(73,218,255,.72));
  }
}

.robot-card.is-talking .robot-head,
.robot-card.is-talking .robot-body,
.robot-card.speaking .robot-head,
.robot-card.speaking .robot-body{
  filter:drop-shadow(0 0 10px rgba(85,220,255,.34));
}

.robot-card.is-talking .antenna-tip,
.robot-card.speaking .antenna-tip{
  animation:rmAntennaTalk .62s ease-in-out infinite alternate;
}
@keyframes rmAntennaTalk{
  from{
    box-shadow:0 0 10px rgba(96,220,255,.42);
    filter:brightness(1);
  }
  to{
    box-shadow:0 0 22px rgba(96,220,255,.95);
    filter:brightness(1.5);
  }
}

/* The tiny bars in the AI card move only while real audio is playing. */
.robot-card.is-talking ~ .message-card .message-audio span,
.robot-card.speaking ~ .message-card .message-audio span{
  opacity:1;
  animation:rmAudioBar .52s ease-in-out infinite alternate;
}
.robot-card.is-talking ~ .message-card .message-audio span:nth-child(2),
.robot-card.speaking ~ .message-card .message-audio span:nth-child(2){
  animation-delay:.12s;
}
.robot-card.is-talking ~ .message-card .message-audio span:nth-child(3),
.robot-card.speaking ~ .message-card .message-audio span:nth-child(3){
  animation-delay:.24s;
}
@keyframes rmAudioBar{
  from{height:7px;filter:brightness(.9)}
  to{height:22px;filter:brightness(1.35)}
}





/* =========================================================
   V2.8.5 — TRIP START GREETING
   The class exists only during the welcome speech.
   ========================================================= */

.robot-card.trip-greeting .robot-arm.right{
  z-index:12;
  transform-origin:50% 10%;
  animation:rmGreetingArm 1.05s ease-in-out infinite;
  will-change:transform;
}


.robot-card.trip-greeting .robot-arm.right .arm-segment{
  box-shadow:
    inset -5px -5px 9px rgba(26,43,58,.18),
    0 0 7px rgba(89,223,255,.10);
}

@keyframes rmGreetingArm{
  0%,100%{
    transform:translate(2px,-2px) rotate(-118deg);
  }
  18%{
    transform:translate(4px,-4px) rotate(-142deg);
  }
  36%{
    transform:translate(4px,-5px) rotate(-126deg);
  }
  54%{
    transform:translate(4px,-5px) rotate(-146deg);
  }
  72%{
    transform:translate(4px,-4px) rotate(-128deg);
  }
  88%{
    transform:translate(3px,-3px) rotate(-140deg);
  }
}

.robot-card.trip-greeting .robot-hand{
  box-shadow:
    inset -5px -5px 8px rgba(26,43,58,.18),
    0 0 10px rgba(89,223,255,.20);
}

.robot-card.trip-greeting .antenna{
  transform-origin:50% 100%;
  animation:rmGreetingAntenna .56s ease-in-out infinite alternate;
  will-change:transform;
}

@keyframes rmGreetingAntenna{
  from{
    transform:translateX(-50%) rotate(-11deg);
  }
  to{
    transform:translateX(-50%) rotate(11deg);
  }
}

.robot-card.trip-greeting .antenna-tip{
  animation:rmGreetingAntennaTip .56s ease-in-out infinite alternate;
}

@keyframes rmGreetingAntennaTip{
  from{
    filter:brightness(1);
    box-shadow:0 0 10px rgba(96,220,255,.42);
  }
  to{
    filter:brightness(1.55);
    box-shadow:0 0 22px rgba(96,220,255,.92);
  }
}

.robot-card.trip-greeting{
  animation:rmGreetingBody 1.7s ease-in-out infinite;
}

@keyframes rmGreetingBody{
  0%,100%{translate:0 0}
  50%{translate:0 -3px}
}



/* =========================================================
   V2.9.0 — ROBOT STATE PERSONALITY
   ========================================================= */

/* Waiting for wake word: calm, awake, tiny antenna sway. */
.robot-card.wake-ready .antenna{
  transform-origin:50% 100%;
  animation:rmWakeAntenna 2.4s ease-in-out infinite;
}
.robot-card.wake-ready .antenna-tip{
  animation:rmWakeTip 1.8s ease-in-out infinite;
}
.robot-card.wake-ready .ear{
  border-color:rgba(89,223,255,.48);
  box-shadow:0 0 10px rgba(89,223,255,.12);
}
@keyframes rmWakeAntenna{
  0%,100%{transform:translateX(-50%) rotate(-3deg)}
  50%{transform:translateX(-50%) rotate(3deg)}
}
@keyframes rmWakeTip{
  0%,100%{filter:brightness(.9);box-shadow:0 0 8px rgba(89,223,255,.30)}
  50%{filter:brightness(1.35);box-shadow:0 0 15px rgba(89,223,255,.62)}
}

/* Thinking: eyes glance upward while antenna "searches". */
.robot-card.thinking .eye{
  animation:rmThinkingEyes 1.4s ease-in-out infinite;
}
.robot-card.thinking .antenna{
  transform-origin:50% 100%;
  animation:rmThinkingAntenna .9s ease-in-out infinite alternate;
}
.robot-card.thinking .robot-halo{
  animation:rmThinkingHalo 1.3s ease-in-out infinite;
}
@keyframes rmThinkingEyes{
  0%,100%{transform:translate(0,0) scaleY(1)}
  45%{transform:translate(4px,-3px) scaleY(.82)}
  70%{transform:translate(-3px,-2px) scaleY(.88)}
}
@keyframes rmThinkingAntenna{
  from{transform:translateX(-50%) rotate(-10deg)}
  to{transform:translateX(-50%) rotate(10deg)}
}
@keyframes rmThinkingHalo{
  0%,100%{opacity:.58;filter:brightness(.95)}
  50%{opacity:.92;filter:brightness(1.28)}
}

/* Error/alert: visibly serious without replacing the emergency UI. */
.robot-card.alert .eye{
  height:7px;
  border-radius:8px;
  box-shadow:0 0 12px rgba(255,82,103,.52);
}
.robot-card.alert .robot-halo{
  filter:hue-rotate(130deg) saturate(1.7);
  opacity:.88;
}
.robot-card.alert .antenna-tip{
  background:#ff5267;
  box-shadow:0 0 18px rgba(255,82,103,.78);
}

/* ---------- RESPONSIVE ---------- */

@media (max-height:720px){
  :root{
    --gap:6px;
    --topbar-h:52px;
    --safety-h:39px;
    --controls-h:56px;
    --control-size:56px;
    --cta-h:54px;
    --message-h:96px;
    --robot-scale:.74;
  }
}

@media (min-height:721px) and (max-height:810px){
  :root{
    --message-h:108px;
    --robot-scale:.84;
  }
}

@media (min-height:811px) and (max-height:900px){
  :root{
    --message-h:118px;
    --robot-scale:.94;
  }
}

@media (min-height:901px) and (max-height:980px){
  :root{
    --message-h:124px;
    --robot-scale:1.02;
  }
}

@media (min-height:981px){
  :root{
    --message-h:130px;
    --robot-scale:1.08;
  }
}

@media (max-width:430px){
  .row{gap:9px}
  .row select,
  .row input{width:56%}
}

@media (min-width:760px){
  :root{--pad-x:24px}
}


@media (max-height:720px){
  .bottom-action{
    padding-top:6px;
    padding-bottom:max(6px,var(--safe-bottom));
  }
}


.start-icon{
  width:44px;
  height:44px;
  flex:0 0 44px;
  display:grid;
  place-items:center;
  border-radius:50%;
  background:rgba(255,255,255,.16);
  border:1px solid rgba(255,255,255,.32);
  box-shadow:
    0 4px 14px rgba(0,0,0,.18),
    inset 0 1px 0 rgba(255,255,255,.18);
}
.start-icon svg{
  width:22px;
  height:22px;
  fill:currentColor;
  stroke:none;
  transform:translateX(1px);
}


/* V2.8.7 — CTA play + live indicator */
.live-dot{
  position:relative;

  /* Same slot where LIVE used to be */
  width:32px;
  min-width:32px;
  height:14px;
  flex:0 0 32px;

  display:none;
  place-items:center;

  opacity:0;
}.live-dot::before,

.start-btn.active .live-dot{
  display:grid;
  opacity:1;
}.start-btn.active .live-dot::before{
  animation:rmLiveDotRing 1.45s ease-out infinite;
}

@keyframes rmLiveDotCore{
  from{
    filter:brightness(.92);
    box-shadow:
      0 0 0 4px rgba(255,59,79,.14),
      0 0 10px rgba(255,59,79,.72);
  }
  to{
    filter:brightness(1.35);
    box-shadow:
      0 0 0 6px rgba(255,59,79,.18),
      0 0 18px rgba(255,59,79,1),
      0 0 30px rgba(255,59,79,.68);
  }
}

@keyframes rmLiveDotRing{
  0%{
    opacity:.78;
    transform:translate(-50%,-50%) scale(.8);
  }
  100%{
    opacity:0;
    transform:translate(-50%,-50%) scale(2.2);
  }
}

.start-btn.active .start-icon{
  background:rgba(255,255,255,.12);
  border-color:rgba(255,255,255,.25);
  box-shadow:
    0 0 0 4px rgba(255,255,255,.04),
    0 4px 14px rgba(0,0,0,.18);
}


.start-btn.paused .live-dot{
  display:none!important;
  opacity:0!important;
  animation:none!important;
}

/* V2.8.9 — pulse sits exactly where LIVE used to sit */
.live-dot::before{
  content:"";
  width:12px;
  height:12px;
  border-radius:50%;
  background:#ff3b4f;
  box-shadow:
    0 0 0 4px rgba(255,59,79,.14),
    0 0 13px rgba(255,59,79,.92),
    0 0 24px rgba(255,59,79,.58);
  opacity:0;
}

.live-dot::after{
  content:"";
  position:absolute;
  inset:50% auto auto 50%;
  width:12px;
  height:12px;
  border-radius:50%;
  border:2px solid rgba(255,72,91,.68);
  transform:translate(-50%,-50%) scale(.8);
  opacity:0;
  pointer-events:none;
}

.start-btn.active .live-dot::before{
  opacity:1;
  animation:rmLiveDotCore .9s ease-in-out infinite alternate;
}

.start-btn.active .live-dot::after{
  animation:rmLiveDotRing 1.45s ease-out infinite;
}


.nav-diag-result{
  line-height:1.55;
  word-break:break-word;
}


/* ============================================================
   V2.9.8 — iOS Settings navigation, rebuilt from clean V2.9.6
   ============================================================ */

.settings-panel-shell{
  position:relative;
  overflow-y:auto;
  overflow-x:hidden;
  -webkit-overflow-scrolling:touch;
  overscroll-behavior-y:contain;
  touch-action:pan-y;
}

.ios-native-select{
  position:absolute!important;
  width:1px!important;
  height:1px!important;
  overflow:hidden!important;
  clip:rect(0 0 0 0)!important;
  clip-path:inset(50%)!important;
  white-space:nowrap!important;
  opacity:0!important;
  pointer-events:none!important;
}

.settings-panel .row{
  min-height:54px;
  gap:12px;
}

/* iPhone-style switches */
.ios-switch-wrap{
  margin-left:auto;
  display:flex;
  align-items:center;
  justify-content:flex-end;
  flex:0 0 auto;
}

.ios-switch{
  position:relative;
  width:51px;
  height:31px;
  min-width:51px;
  padding:0;
  border:0;
  border-radius:999px;
  background:#3a414c;
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.06);
  cursor:pointer;
  transition:background .2s ease;
  -webkit-tap-highlight-color:transparent;
  touch-action:manipulation;
}

.ios-switch-knob{
  position:absolute;
  left:2px;
  top:2px;
  width:27px;
  height:27px;
  border-radius:50%;
  background:#fff;
  box-shadow:0 2px 5px rgba(0,0,0,.32);
  transition:transform .2s cubic-bezier(.2,.8,.2,1);
}

.ios-switch.is-on{
  background:#34c759;
}

.ios-switch.is-on .ios-switch-knob{
  transform:translateX(20px);
}

/* iOS disclosure rows */
.ios-choice-wrap{
  margin-left:auto;
  min-width:0;
  max-width:58%;
  display:flex;
  justify-content:flex-end;
}

.ios-choice-trigger{
  min-width:0;
  width:100%;
  min-height:42px;
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:7px;
  padding:0;
  border:0;
  background:transparent;
  color:inherit;
  cursor:pointer;
  -webkit-tap-highlight-color:transparent;
  touch-action:manipulation;
}

.ios-choice-value{
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  text-align:right;
  font-size:14px;
  font-weight:600;
  color:#9aa7b8;
}

.ios-chevron{
  flex:0 0 auto;
  color:#697688;
  font-size:27px;
  font-weight:400;
  line-height:1;
  transform:translateY(-1px);
}

/* Full internal iOS settings subpage */
.settings-choice-page{
  position:fixed;
  inset:0;
  z-index:40;
  display:flex;
  flex-direction:column;
  background:var(--bg,#07111d);
  transform:translateX(102%);
  visibility:hidden;
  pointer-events:none;
  transition:transform .24s cubic-bezier(.2,.8,.2,1),visibility 0s linear .24s;
}

.settings-choice-page.open{
  transform:translateX(0);
  visibility:visible;
  pointer-events:auto;
  transition:transform .24s cubic-bezier(.2,.8,.2,1),visibility 0s;
}

.settings-choice-head{
  flex:0 0 auto;
  min-height:64px;
  padding:
    max(8px,env(safe-area-inset-top))
    12px
    8px;
  display:grid;
  grid-template-columns:48px 1fr 48px;
  align-items:end;
  border-bottom:1px solid rgba(255,255,255,.07);
  background:rgba(7,17,29,.96);
  backdrop-filter:blur(18px);
  -webkit-backdrop-filter:blur(18px);
}

.settings-choice-head .settings-choice-back{
  width:42px;
  height:42px;
  justify-self:start;
}

.settings-choice-head h2{
  margin:0;
  align-self:center;
  text-align:center;
  font-size:17px;
  line-height:1.2;
  font-weight:750;
  color:#f3f7fc;
}

.settings-choice-head-spacer{
  width:42px;
  height:42px;
}

.settings-choice-body{
  flex:1 1 auto;
  min-height:0;
  overflow:auto;
  padding:18px 14px max(24px,env(safe-area-inset-bottom));
  -webkit-overflow-scrolling:touch;
}

.settings-choice-list{
  overflow:hidden;
  border-radius:14px;
  background:rgba(255,255,255,.045);
  border:1px solid rgba(255,255,255,.055);
}

.settings-choice-option{
  width:100%;
  min-height:54px;
  display:grid;
  grid-template-columns:1fr 26px;
  align-items:center;
  gap:10px;
  padding:0 16px;
  border:0;
  border-bottom:1px solid rgba(255,255,255,.06);
  background:transparent;
  color:#e8eff8;
  text-align:left;
  font:inherit;
  font-size:15px;
  cursor:pointer;
  -webkit-tap-highlight-color:transparent;
}

.settings-choice-option:last-child{
  border-bottom:0;
}

.settings-choice-option:active{
  background:rgba(255,255,255,.065);
}

.settings-choice-check{
  justify-self:end;
  color:#0a84ff;
  font-size:20px;
  font-weight:800;
  opacity:0;
}

.settings-choice-option.selected .settings-choice-check{
  opacity:1;
}

/* Compact system status */
.system-status-row{
  min-height:48px!important;
}

.system-pulse{
  margin-left:auto;
  display:block;
  width:10px;
  height:10px;
  flex:0 0 10px;
  border-radius:50%;
  background:#8e8e93;
  box-shadow:0 0 0 3px rgba(142,142,147,.10);
}

.system-pulse.ok{
  background:#34c759;
  box-shadow:0 0 0 3px rgba(52,199,89,.11),0 0 12px rgba(52,199,89,.58);
  animation:rmStatusPulse 1.8s ease-in-out infinite;
}

.system-pulse.error{
  background:#ff453a;
  box-shadow:0 0 0 3px rgba(255,69,58,.11),0 0 12px rgba(255,69,58,.52);
}

.system-pulse.pending{
  background:#8e8e93;
  opacity:.7;
}

@keyframes rmStatusPulse{
  0%,100%{box-shadow:0 0 0 3px rgba(52,199,89,.10),0 0 8px rgba(52,199,89,.38)}
  50%{box-shadow:0 0 0 5px rgba(52,199,89,.14),0 0 15px rgba(52,199,89,.68)}
}

@media (max-width:390px){
  .ios-choice-wrap{max-width:55%}
  .ios-choice-value{font-size:13px}
}


/* V2.9.9 — scroll ownership */
.settings-panel.choice-open .settings-panel-shell{
  overflow-y:hidden;
  touch-action:none;
}

.settings-panel.choice-open .settings-choice-body{
  overflow-y:auto;
  touch-action:pan-y;
}


/* =========================================================
   V2.10.0 — Alarm sound UX
   ========================================================= */

.alarm-volume-row{
  padding:12px 2px 4px;
}

.alarm-volume-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin:0 2px 9px;
  font-size:14px;
  color:#dbe6f3;
}

.alarm-volume-head strong{
  min-width:46px;
  text-align:right;
  color:#9eabbc;
  font-size:13px;
  font-variant-numeric:tabular-nums;
}

.ios-volume-range{
  --rm-volume:100%;
  width:100%;
  height:30px;
  margin:0;
  appearance:none;
  -webkit-appearance:none;
  background:transparent;
  touch-action:pan-x;
}

.ios-volume-range::-webkit-slider-runnable-track{
  height:5px;
  border-radius:999px;
  background:
    linear-gradient(
      to right,
      #0a84ff 0,
      #0a84ff var(--rm-volume),
      #35404f var(--rm-volume),
      #35404f 100%
    );
}

.ios-volume-range::-webkit-slider-thumb{
  width:27px;
  height:27px;
  margin-top:-11px;
  border:0;
  border-radius:50%;
  appearance:none;
  -webkit-appearance:none;
  background:#fff;
  box-shadow:0 2px 7px rgba(0,0,0,.34);
}

.ios-volume-range::-moz-range-track{
  height:5px;
  border:0;
  border-radius:999px;
  background:#35404f;
}

.ios-volume-range::-moz-range-progress{
  height:5px;
  border-radius:999px;
  background:#0a84ff;
}

.ios-volume-range::-moz-range-thumb{
  width:27px;
  height:27px;
  border:0;
  border-radius:50%;
  background:#fff;
  box-shadow:0 2px 7px rgba(0,0,0,.34);
}


/* =========================================================
   V2.10.1 — Dedicated Camera AI engine
   IMPORTANT: do NOT use display:none / visibility:hidden.
   Safari must keep this video rendering frames for MediaPipe.
   ========================================================= */
.camera-engine-video{
  position:fixed;
  left:1px;
  top:1px;
  width:12px;
  height:12px;
  opacity:.001;
  pointer-events:none;
  object-fit:cover;
  z-index:0;
}

.settings-status-btn{display:none!important}

.app-tabbar{
  position:fixed;left:50%;bottom:0;z-index:170000;width:min(720px,100%);
  height:var(--tabbar-space);min-height:var(--tabbar-space);transform:translateX(-50%);
  padding:4px 8px var(--safe-bottom);
  display:grid;grid-template-columns:1fr 1.35fr 1fr;align-items:start;gap:4px;
  background:rgba(5,11,22,.98);border-top:1px solid rgba(123,174,224,.12);
  backdrop-filter:blur(20px);-webkit-backdrop-filter:blur(20px)
}
.app-tab{
  min-width:0;height:52px;padding:4px 4px 3px;border:0;border-radius:12px;background:transparent;
  color:#718398;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;
  font-size:10px;line-height:1;font-weight:750;white-space:nowrap;touch-action:manipulation
}
.app-tab svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.75;stroke-linecap:round;stroke-linejoin:round}
.app-tab.active{color:#58dbff;background:rgba(88,219,255,.07)}
.app-tab.active svg{filter:drop-shadow(0 0 8px rgba(88,219,255,.26))}
.settings-panel,.journal-panel{inset:0 0 var(--tabbar-space) 0!important;height:auto!important}
.settings-head{grid-template-columns:1fr!important}
.settings-head>.back-btn{display:none!important}
.settings-choice-page{bottom:var(--tabbar-space)!important}

.journal-panel{
  position:fixed;z-index:145000;width:100%;background:#050b16;color:#eff6ff;
  transform:translate3d(100%,0,0);transition:transform .26s cubic-bezier(.2,.8,.2,1);
  visibility:hidden;pointer-events:none;overflow:hidden
}
.journal-panel.is-open{transform:translate3d(0,0,0);visibility:visible;pointer-events:auto}
.journal-shell{width:min(720px,100%);height:100%;margin:0 auto;display:flex;flex-direction:column;min-height:0}
.journal-head{
  flex:0 0 auto;min-height:76px;padding:calc(var(--safe-top) + 12px) 16px 11px;
  display:flex;align-items:flex-end;justify-content:space-between;gap:12px;
  background:rgba(5,11,22,.98);border-bottom:1px solid rgba(255,255,255,.07)
}
.journal-head small{display:block;color:#58dbff;font-size:9px;font-weight:900;letter-spacing:1.4px}
.journal-head h1{margin:3px 0 0;font-size:23px;line-height:1.05}
.journal-count{margin-bottom:2px;color:#8293a8;font-size:12px;font-weight:700}
.journal-body{flex:1 1 auto;min-height:0;overflow-y:auto;-webkit-overflow-scrolling:touch;overscroll-behavior-y:contain;padding:14px 14px 24px}
.journal-current{
  margin-bottom:12px;min-height:58px;padding:11px 13px;display:flex;align-items:center;gap:11px;
  border:1px solid rgba(52,199,89,.20);border-radius:15px;background:rgba(52,199,89,.07)
}
.journal-current>div{min-width:0;display:flex;flex-direction:column;gap:4px}
.journal-current strong{font-size:14px}
.journal-current span:not(.journal-live-dot){color:#90a0b3;font-size:12px;font-variant-numeric:tabular-nums}
.journal-live-dot{width:10px;height:10px;flex:0 0 10px;border-radius:50%;background:#34c759;box-shadow:0 0 0 4px rgba(52,199,89,.10),0 0 12px rgba(52,199,89,.52);animation:rmJournalLive 1.5s ease-in-out infinite}
@keyframes rmJournalLive{50%{box-shadow:0 0 0 6px rgba(52,199,89,.05),0 0 17px rgba(52,199,89,.66)}}
.journal-list{display:grid;gap:10px}
.journal-card{padding:14px;border-radius:16px;border:1px solid rgba(149,177,207,.11);background:#0a1422}
.journal-card-head{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;margin-bottom:9px}
.journal-card-title{min-width:0;display:flex;flex-direction:column;gap:3px}
.journal-card-title strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:15px}
.journal-card-title span,.journal-card-time{color:#8193a8;font-size:11px}
.journal-card-time{flex:0 0 auto;font-variant-numeric:tabular-nums}
.journal-card-meta{display:flex;flex-wrap:wrap;gap:7px}
.journal-chip{min-height:27px;padding:6px 9px;border-radius:999px;background:rgba(255,255,255,.045);color:#a6b5c7;font-size:11px;line-height:1}
.journal-chip.safety{background:rgba(255,82,103,.07);color:#ff9aa7}
.journal-empty{min-height:42dvh;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:7px;color:#73869a;text-align:center}
.journal-empty.hidden{display:none!important}
.journal-empty-icon{width:48px;height:48px;margin-bottom:4px;display:grid;place-items:center;border-radius:15px;background:rgba(88,219,255,.06);color:#58dbff}
.journal-empty-icon svg{width:26px;height:26px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
.journal-empty strong{color:#c2cfdd;font-size:14px}
.journal-empty span{max-width:250px;font-size:12px;line-height:1.45}

.alarm-volume-row.compact{
  width:100%;padding:10px 2px 5px;display:grid;
  grid-template-columns:72px minmax(110px,210px) 44px;align-items:center;justify-content:space-between;gap:10px
}
.alarm-volume-row.compact .alarm-volume-label{color:#dbe6f3;font-size:14px}
.alarm-volume-row.compact .ios-volume-range{width:100%;min-width:0}
.alarm-volume-row.compact>strong{text-align:right;color:#9eabbc;font-size:12px;font-variant-numeric:tabular-nums}
.alarm-volume-head{display:none!important}
@media (max-width:370px){
 .app-tab{font-size:9px}
 .alarm-volume-row.compact{grid-template-columns:66px minmax(90px,170px) 40px;gap:8px}
}


/* =========================================================
   V2.11.1 — Day / Night
   ========================================================= */

.topbar-actions{
  display:flex;
  align-items:center;
  gap:8px;
}

.theme-toggle{
  width:58px;
  height:32px;
  padding:0;
  border:0;
  background:transparent;
  flex:0 0 58px;
  -webkit-tap-highlight-color:transparent;
  touch-action:manipulation;
}

.theme-toggle-track{
  position:relative;
  display:block;
  width:58px;
  height:32px;
  border-radius:999px;
  background:#192737;
  border:1px solid rgba(255,255,255,.09);
  box-shadow:inset 0 0 0 1px rgba(0,0,0,.08);
  transition:background .22s ease,border-color .22s ease;
}

.theme-toggle-knob{
  position:absolute;
  left:3px;
  top:3px;
  width:26px;
  height:26px;
  z-index:3;
  border-radius:50%;
  background:#fff;
  box-shadow:0 2px 7px rgba(0,0,0,.28);
  transition:transform .22s cubic-bezier(.2,.8,.2,1);
}

.theme-toggle.is-light .theme-toggle-knob{
  transform:translateX(26px);
}

.theme-symbol{
  position:absolute;
  top:5px;
  width:21px;
  height:21px;
  display:grid;
  place-items:center;
  pointer-events:none;
}

.theme-symbol svg{
  width:16px;
  height:16px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.8;
  stroke-linecap:round;
  stroke-linejoin:round;
}

.theme-symbol.sun{
  left:5px;
  color:#79899b;
}

.theme-symbol.moon{
  right:5px;
  color:#9cc9ff;
}

.theme-toggle.is-light .theme-toggle-track{
  background:#dceeff;
  border-color:rgba(26,93,151,.12);
}

.theme-toggle.is-light .theme-symbol.sun{
  color:#f1a51e;
}

.theme-toggle.is-light .theme-symbol.moon{
  color:#8798aa;
}

/* Light palette — V2.11.2 synchronized */
body.light-theme{
  --bg:#eef5fb;
  --panel:#ffffff;
  --panel-2:#f3f7fb;
  --text:#10263d;
  --muted:#61778e;
  --line:rgba(28,69,104,.11);
  --green:#15966b;
  --yellow:#c78a00;
  --orange:#d86b26;
  --red:#e13d55;
  --blue:#087fe8;
  --cyan:#148fd3;
  color-scheme:light;
  background:#eef5fb!important;
  color:#10263d!important;
}

body.light-theme .app-shell,
body.light-theme .settings-panel,
body.light-theme .journal-panel{
  background:#eef5fb!important;
  color:#10263d!important;
}

/* Header / footer */
body.light-theme .topbar,
body.light-theme .app-tabbar,
body.light-theme .settings-head,
body.light-theme .journal-head,
body.light-theme .settings-choice-head{
  background:rgba(248,252,255,.98)!important;
  border-color:rgba(28,69,104,.10)!important;
}

body.light-theme .topbar{
  box-shadow:0 7px 22px rgba(39,75,108,.035);
}

body.light-theme .brand{
  color:#10263d!important;
}

body.light-theme .brand span{
  color:#087fe8!important;
}

body.light-theme .status-line{
  color:#6e8296!important;
}

body.light-theme .app-tabbar{
  box-shadow:0 -8px 26px rgba(35,70,104,.07);
}

body.light-theme .app-tab{
  color:#71859a;
}

body.light-theme .app-tab.active{
  color:#087fe8;
  background:rgba(8,127,232,.08);
}

body.light-theme .app-tab.active svg{
  filter:drop-shadow(0 0 7px rgba(8,127,232,.16));
}

/* Hero */
body.light-theme .hero-bg{
  opacity:1;
  background:
    radial-gradient(circle at 50% 31%,rgba(48,166,231,.14),transparent 31%),
    linear-gradient(180deg,rgba(238,248,255,.55),transparent 62%);
}

/* AI message card — no dark leftover */
body.light-theme .message-card{
  border-color:rgba(36,126,191,.17)!important;
  background:
    linear-gradient(145deg,#ffffff 0%,#f1f8fd 58%,#eaf4fb 100%)!important;
  box-shadow:0 12px 30px rgba(44,83,116,.08)!important;
}

body.light-theme .message-icon{
  background:#e3f4fd!important;
  color:#087fc5!important;
}

body.light-theme .message-title{
  color:#10263d!important;
}

body.light-theme .message-sub{
  color:#5d748b!important;
}

body.light-theme .message-audio span{
  background:#129bd9!important;
}

/* Route card */
body.light-theme .route-strip{
  border-color:rgba(32,111,166,.13)!important;
  background:#ffffff!important;
  color:#17314a!important;
  box-shadow:0 7px 20px rgba(42,78,108,.055);
}

body.light-theme .route-pin{
  background:#e7f5fd!important;
  color:#087fc5!important;
}

body.light-theme .route-copy strong{
  color:#17314a!important;
}

body.light-theme .route-copy span{
  color:#667d92!important;
}

body.light-theme .route-chevron{
  color:#8aa0b4!important;
}

/* Safety */
body.light-theme .safety-bar{
  background:#e6edf4!important;
  border-color:rgba(31,72,107,.10)!important;
}

body.light-theme .safety-label{
  color:#143349!important;
  text-shadow:0 1px 0 rgba(255,255,255,.45);
}

body.light-theme .warning-banner{
  background:#fff6d9!important;
  border-color:rgba(184,127,0,.18)!important;
  color:#785600!important;
}

/* Control buttons */
body.light-theme .control-btn{
  border-color:rgba(21,150,107,.17)!important;
  background:#eaf8f2!important;
  color:#13875f!important;
  box-shadow:0 7px 18px rgba(36,92,74,.045);
}

body.light-theme .control-camera-dot{
  border-color:#eaf8f2!important;
}

body.light-theme .bottom-action{
  background:#eef5fb!important;
  border-top-color:rgba(28,69,104,.08)!important;
}

/* Settings: replace dark custom variables */
body.light-theme .settings-panel{
  --s-bg:#eef5fb;
  --s-panel:#ffffff;
  --s-line:rgba(28,69,104,.10);
  --s-text:#122a42;
  --s-muted:#687f95;
  --s-accent:#087fe8;
}

body.light-theme .settings-panel-shell{
  background:#eef5fb!important;
}

body.light-theme .settings-head small{
  color:#087fe8!important;
}

body.light-theme .settings-head h1{
  color:#10263d!important;
}

body.light-theme .group{
  background:#ffffff!important;
  border-color:rgba(28,69,104,.10)!important;
  box-shadow:0 6px 20px rgba(40,75,106,.045);
}

body.light-theme .group-title{
  color:#647a90!important;
}

body.light-theme .settings-panel .row{
  color:#142c44!important;
  border-color:rgba(28,69,104,.09)!important;
}

body.light-theme .settings-panel .row > span:first-child{
  color:#142c44!important;
}

body.light-theme .row.info span:last-child{
  color:#5d748a!important;
}

body.light-theme .row input,
body.light-theme .row select,
body.light-theme .settings-panel textarea{
  background:#f4f8fc!important;
  border-color:rgba(34,79,118,.13)!important;
  color:#15314b!important;
  box-shadow:none!important;
}

body.light-theme .row input::placeholder,
body.light-theme .settings-panel textarea::placeholder{
  color:#94a5b6!important;
}

body.light-theme .note{
  color:#667d92!important;
}

body.light-theme .action-btn{
  background:#edf6fd!important;
  border-color:rgba(8,127,232,.16)!important;
  color:#126da9!important;
}

body.light-theme .save-btn{
  color:#ffffff!important;
  border-color:rgba(8,110,219,.28)!important;
  background:linear-gradient(180deg,#2d99f5,#0d75dd)!important;
  box-shadow:0 8px 22px rgba(13,117,221,.18)!important;
}

body.light-theme .back-btn{
  background:#ffffff!important;
  border-color:rgba(28,69,104,.11)!important;
  color:#2d5879!important;
}

/* iOS controls */
body.light-theme .ios-switch{
  background:#cbd6e0;
  box-shadow:inset 0 0 0 1px rgba(38,75,106,.05);
}

body.light-theme .ios-switch.is-on{
  background:#34c759!important;
}

body.light-theme .ios-choice-value{
  color:#58728a!important;
}

body.light-theme .ios-chevron{
  color:#8aa0b4!important;
}

/* Selection subpage */
body.light-theme .settings-choice-page{
  background:#eef5fb!important;
}

body.light-theme .settings-choice-head h2{
  color:#10263d!important;
}

body.light-theme .settings-choice-list{
  background:#ffffff!important;
  border-color:rgba(28,69,104,.09)!important;
  box-shadow:0 7px 22px rgba(42,77,107,.045);
}

body.light-theme .settings-choice-option{
  color:#183149!important;
  border-color:rgba(28,69,104,.08)!important;
}

body.light-theme .settings-choice-option:active{
  background:#edf6fd!important;
}

/* Alarm volume */
body.light-theme .alarm-volume-label,
body.light-theme .alarm-volume-row.compact > strong{
  color:#526d85!important;
}

body.light-theme .ios-volume-range::-webkit-slider-runnable-track{
  background:
    linear-gradient(
      to right,
      #0a84ff 0,
      #0a84ff var(--rm-volume),
      #cbd6e2 var(--rm-volume),
      #cbd6e2 100%
    )!important;
}

/* Journal */
body.light-theme .journal-head small{
  color:#087fe8!important;
}

body.light-theme .journal-head h1,
body.light-theme .journal-card-title strong,
body.light-theme .journal-empty strong,
body.light-theme .journal-current strong{
  color:#10263d!important;
}

body.light-theme .journal-card,
body.light-theme .journal-current{
  background:#ffffff!important;
  border-color:rgba(28,69,104,.10)!important;
  box-shadow:0 7px 22px rgba(42,77,107,.045);
}

body.light-theme .journal-current{
  background:#effaf5!important;
  border-color:rgba(21,150,107,.15)!important;
}

body.light-theme .journal-card-title span,
body.light-theme .journal-card-time,
body.light-theme .journal-count,
body.light-theme .journal-current span:not(.journal-live-dot),
body.light-theme .journal-empty{
  color:#687f95!important;
}

body.light-theme .journal-chip{
  background:#eff4f8!important;
  color:#5c748a!important;
}

body.light-theme .journal-chip.safety{
  background:#fff0f2!important;
  color:#c84153!important;
}

/* Status indicators */
body.light-theme .system-pulse.pending{
  background:#8797a8;
}

/* Dialog surfaces */
body.light-theme .camera-dialog,
body.light-theme .map-dialog{
  background:#f8fbfe!important;
  color:#10263d!important;
}

body.light-theme .camera-head{
  border-color:rgba(28,69,104,.09)!important;
}

body.light-theme .map-route-meta{
  color:#5f768c!important;
}

/* Day/night switch in light mode */
body.light-theme .theme-toggle-track{
  background:#dceeff;
  border-color:rgba(26,93,151,.12);
}

body.light-theme .theme-toggle.is-light .theme-symbol.sun{
  color:#e69812;
}

body.light-theme .theme-toggle.is-light .theme-symbol.moon{
  color:#8798aa;
}


/* =====================================================================
   V2.13.1 — BỐI BỐI LAYOUT ARCHITECTURE
   Based on the uploaded Bối Bối Fashion mobile structure.
   ===================================================================== */

:root{
  --rm-nav-visible-h:58px;
  --rm-nav-content-reserve:104px;
}

/* Bối Bối principle: normal document + mobile viewport container. */
html,
body{
  width:100%;
  height:100%;
  min-height:100%;
  margin:0;
  padding:0;
  background:var(--bg);
  overflow-x:hidden;
}

body{
  position:static;
  inset:auto;
  min-height:100%;
  height:auto;
  overscroll-behavior:none;
}

/*
  Main RoadMate container = Bối Bối .app-container:
  flex column and exactly one mobile viewport tall.
*/
.roadmate-app{
  width:100vw;
  height:100dvh;
  max-width:720px;
  margin:0 auto;
  display:flex;
  flex-direction:column;
  position:relative;
  overflow:hidden;
  background:var(--bg);
  color:var(--text);
}

/*
  Header = Bối Bối .app-header:
  normal flow, never fixed, never absolute.
  We intentionally do NOT add safe-area-top here.
*/
.roadmate-header{
  position:relative!important;
  inset:auto!important;
  transform:none!important;
  width:100%!important;
  height:auto!important;
  min-height:68px!important;
  flex:0 0 auto!important;
  margin:0!important;
  padding:10px var(--pad-x)!important;
  display:flex!important;
  align-items:center!important;
  justify-content:space-between!important;
  gap:12px!important;
  background:var(--bg)!important;
  border-bottom:1px solid rgba(123,174,224,.08)!important;
  box-shadow:none!important;
  z-index:10!important;
}

.roadmate-header > div:first-child,
.roadmate-header .topbar-actions{
  margin:0!important;
  padding:0!important;
}

/*
  Main = Bối Bối .app-body:
  flex:1 consumes the available space.
  It reserves a FIXED amount for the overlaid fixed nav,
  exactly like Bối Bối page-section reserves 120px.
  No env(safe-area-inset-bottom) is used here.
*/
.roadmate-dashboard{
  position:relative!important;
  inset:auto!important;
  transform:none!important;
  width:100%!important;
  height:auto!important;
  min-height:0!important;
  flex:1 1 auto!important;
  margin:0!important;
  padding:
    10px
    var(--pad-x)
    var(--rm-nav-content-reserve)!important;
  overflow:hidden!important;
  display:grid!important;
  grid-template-rows:
    minmax(0,1fr)
    var(--safety-h)
    var(--controls-h)
    auto!important;
  gap:var(--gap)!important;
  background:var(--bg)!important;
  box-sizing:border-box!important;
}

.roadmate-dashboard .hero{
  min-height:0!important;
  height:auto!important;
  overflow:hidden!important;
}

/* CTA remains inside content, not part of the screen footer. */
.trip-action{
  position:relative!important;
  inset:auto!important;
  width:100%!important;
  margin:0!important;
  padding:6px 0 0!important;
  background:transparent!important;
  border:0!important;
  box-sizing:border-box!important;
}

/*
  Bottom nav = Bối Bối .app-nav:
  one fixed surface, bottom:0, width:100%.
  This is the ONLY main-layout owner of safe-area-inset-bottom.
*/
.roadmate-bottom-nav{
  position:fixed!important;
  left:50%!important;
  right:auto!important;
  bottom:0!important;
  transform:translateX(-50%)!important;
  width:min(720px,100%)!important;
  height:auto!important;
  min-height:0!important;
  margin:0!important;
  padding:4px 8px!important;
  padding-bottom:calc(4px + env(safe-area-inset-bottom))!important;
  display:grid!important;
  grid-template-columns:1fr 1.35fr 1fr!important;
  align-items:center!important;
  gap:4px!important;
  background:#050b16!important;
  border-top:1px solid rgba(123,174,224,.12)!important;
  box-shadow:0 -2px 15px rgba(0,0,0,.10)!important;
  z-index:170000!important;
  box-sizing:border-box!important;
}

.roadmate-bottom-nav .app-tab{
  height:var(--rm-nav-visible-h)!important;
  min-height:var(--rm-nav-visible-h)!important;
  margin:0!important;
  padding:4px 4px 3px!important;
  align-self:center!important;
  box-sizing:border-box!important;
}

/* Old shell is not part of V2.13 DOM; make sure it cannot own layout. */
.app-shell{
  position:static!important;
  inset:auto!important;
  width:auto!important;
  height:auto!important;
  min-height:0!important;
  margin:0!important;
  padding:0!important;
  transform:none!important;
  display:block!important;
  overflow:visible!important;
}

/*
  Settings / Journal are fullscreen content layers, but they stop above
  a FIXED reserve comparable to Bối Bối's 120px page bottom padding.
  Safe-area is still owned only by the nav itself.
*/
.settings-panel,
.journal-panel{
  bottom:var(--rm-nav-content-reserve)!important;
}

/* LIGHT MODE */
body.light-theme .roadmate-app,
body.light-theme .roadmate-header,
body.light-theme .roadmate-dashboard{
  background:#eef5fb!important;
}

body.light-theme .roadmate-header{
  border-bottom-color:rgba(28,69,104,.09)!important;
  box-shadow:none!important;
}

body.light-theme .roadmate-bottom-nav{
  background:#ffffff!important;
  border-top-color:rgba(28,69,104,.10)!important;
  box-shadow:0 -2px 15px rgba(35,70,104,.08)!important;
}

/* Do not let the old light topbar rule become a floating white card. */
body.light-theme .topbar{
  background:#eef5fb!important;
  box-shadow:none!important;
}

/* Short-screen compaction, while preserving Bối Bối architecture. */
@media (max-height:780px){
  :root{
    --rm-nav-visible-h:54px;
    --rm-nav-content-reserve:96px;
    --gap:8px;
    --safety-h:50px;
    --controls-h:62px;
  }

  .roadmate-header{
    min-height:62px!important;
    padding-top:7px!important;
    padding-bottom:7px!important;
  }

  .roadmate-dashboard{
    padding-top:7px!important;
  }

  .message-card{
    padding:11px!important;
  }

  .roadmate-bottom-nav .app-tab{
    font-size:9px!important;
  }
}

@media (max-height:700px){
  :root{
    --rm-nav-visible-h:50px;
    --rm-nav-content-reserve:90px;
    --gap:6px;
    --safety-h:46px;
    --controls-h:58px;
  }

  .roadmate-header{
    min-height:58px!important;
  }

  .roadmate-dashboard{
    padding-top:5px!important;
  }
}


/* =====================================================================
   V2.13.2 — BỐI BỐI EXACT VIEWPORT FIX
   The uploaded Bối Bối HTML DOES NOT use viewport-fit=cover.
   RoadMate now matches that behavior.
   ===================================================================== */

/*
  With viewport-fit=cover removed, iOS keeps the web viewport out of the
  unsafe status-bar / home-indicator regions. The main header therefore
  must NOT add env(safe-area-inset-top).
*/
.roadmate-header{
  padding:10px var(--pad-x)!important;
}

/*
  Match Bối Bối app-nav behavior literally.
  env(safe-area-inset-bottom) remains here, but when iOS constrains the
  viewport it naturally resolves appropriately instead of being combined
  with a cover-layout viewport.
*/
.roadmate-bottom-nav{
  bottom:0!important;
  padding:10px 8px!important;
  padding-bottom:calc(10px + env(safe-area-inset-bottom))!important;
}

/*
  Bối Bối page sections reserve fixed visual space for the fixed nav.
  RoadMate does the same. No safe-area calculation in content.
*/


/* Light mode follows same surfaces. */
body.light-theme .roadmate-header{
  background:#eef5fb!important;
}

body.light-theme .roadmate-bottom-nav{
  background:#ffffff!important;
}


/* =====================================================================
   V2.13.4 — ADAPTIVE TABBAR
   Real rendered TabBar height is measured on each device.
   No fixed 120px reserve.
   ===================================================================== */

:root{
  --rm-nav-box-h:88px; /* startup fallback only; runtime replaces it */
}

/* Main content reserves exactly the measured nav height + a small visual gap. */
.roadmate-dashboard{
  padding-bottom:calc(var(--rm-nav-box-h) + 10px)!important;
}

/* Overlay pages stop exactly at the measured top edge of TabBar. */
.settings-panel,
.journal-panel{
  bottom:var(--rm-nav-box-h)!important;
  margin-bottom:0!important;
}

.settings-choice-page{
  bottom:0!important;
}

/* Bối Bối-style active tab: icon + text only, no tile background. */
.roadmate-bottom-nav .app-tab{
  background:transparent!important;
  box-shadow:none!important;
  transition:color .18s ease!important;
}

.roadmate-bottom-nav .app-tab.active{
  background:transparent!important;
  box-shadow:none!important;
  color:#58dbff!important;
}

.roadmate-bottom-nav .app-tab svg{
  transition:transform .18s ease,color .18s ease!important;
}

.roadmate-bottom-nav .app-tab.active svg{
  transform:translateY(-3px)!important;
  filter:none!important;
}

@media (hover:hover) and (pointer:fine){
  .roadmate-bottom-nav .app-tab:hover{
    color:#58dbff!important;
    background:transparent!important;
  }

  .roadmate-bottom-nav .app-tab:hover svg{
    transform:translateY(-2px)!important;
  }
}

body.light-theme .roadmate-bottom-nav .app-tab.active{
  color:#0d6efd!important;
  background:transparent!important;
}

@media (hover:hover) and (pointer:fine){
  body.light-theme .roadmate-bottom-nav .app-tab:hover{
    color:#0d6efd!important;
  }
}


/* =====================================================================
   V2.13.5 — SETTINGS ALARM VOLUME SPACING
   Align with the same 13px horizontal inset used by Settings rows.
   ===================================================================== */

.alarm-volume-row.compact{
  width:100%!important;
  padding:10px 13px 5px!important;
  grid-template-columns:72px minmax(0,1fr) 44px!important;
  gap:10px!important;
  box-sizing:border-box!important;
}

.alarm-volume-row.compact .alarm-volume-label{
  justify-self:start!important;
}

.alarm-volume-row.compact .ios-volume-range{
  width:100%!important;
  max-width:210px!important;
  min-width:0!important;
  justify-self:center!important;
}

.alarm-volume-row.compact > strong{
  min-width:44px!important;
  justify-self:end!important;
  text-align:right!important;
}

@media (max-width:370px){
  .alarm-volume-row.compact{
    padding-left:13px!important;
    padding-right:13px!important;
    grid-template-columns:66px minmax(0,1fr) 40px!important;
    gap:8px!important;
  }
}
