/* ============================================================================
   AUTOMOWER · Styrops Garden AI — UI shell
   Dark slate glass, Husqvarna orange accent, 8px spacing rhythm.
   ========================================================================== */

:root {
  --bg:          #070a0e;
  --bg-2:        #0d1218;
  --panel:       rgba(17, 23, 31, 0.66);
  --panel-solid: #121821;
  --line:        rgba(255, 255, 255, 0.09);
  --line-soft:   rgba(255, 255, 255, 0.05);
  --txt:         #e8eef5;
  --txt-dim:     #96a3b2;
  --txt-faint:   #63707e;

  --accent:      #ff6600;
  --accent-2:    #ff8a3d;
  --accent-dim:  rgba(255, 102, 0, 0.16);

  --ok:          #34d399;
  --info:        #7dd3fc;
  --warn:        #fbbf24;
  --bad:         #f87171;
  --violet:      #a78bfa;

  --r-lg: 16px;
  --r-md: 11px;
  --r-sm: 7px;

  --sh: 0 12px 40px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.4);
  --blur: saturate(150%) blur(18px);

  --sans: "Inter", "Inter var", -apple-system, BlinkMacSystemFont, "Segoe UI",
          Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", ui-monospace, Menlo, Consolas,
          "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%; overflow: hidden;
  background: var(--bg);
  color: var(--txt);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
.mono { font-family: var(--mono); font-variant-ligatures: none; }
.grow { flex: 1 1 auto; }

/* every glyph in this UI is inline SVG — no emoji font dependency */
.pal-item svg { width: 27px; height: 27px; display: block; pointer-events: none; }
.wx-ico svg   { width: 18px; height: 18px; display: block; }
.fc i svg     { width: 17px; height: 17px; display: block; }
.toast .ti svg{ width: 19px; height: 19px; display: block; }
.bolt svg     { width: 11px; height: 11px; display: block; }
.ai-mark svg, #chat-reopen svg { width: 15px; height: 15px; display: block; }
#chat-send svg { width: 16px; height: 16px; display: block; }
.toolchip .cog svg { width: 11px; height: 11px; display: block; }
#drag-ghost svg { width: 40px; height: 40px; display: block; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.2); }

/* ─────────────────────────── canvas ─────────────────────────── */

#view {
  position: fixed; inset: 0; width: 100%; height: 100%;
  display: block; touch-action: none;
}

#vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 1;
  background:
    radial-gradient(120% 90% at 50% 30%, transparent 45%, rgba(0,0,0,.42) 100%),
    linear-gradient(180deg, rgba(0,0,0,.30) 0%, transparent 22%, transparent 74%, rgba(0,0,0,.46) 100%);
}

/* ─────────────────────────── panels ─────────────────────────── */

.panel {
  background: var(--panel);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh);
}

/* ─────────────────────────── top bar ────────────────────────── */

#topbar {
  position: fixed; z-index: 20; top: 0; left: 0; right: 0; height: 60px;
  display: flex; align-items: center; gap: 24px; padding: 0 16px;
  background: linear-gradient(180deg, rgba(9,13,18,.92) 0%, rgba(9,13,18,.66) 70%, rgba(9,13,18,0) 100%);
  -webkit-backdrop-filter: saturate(150%) blur(14px);
  backdrop-filter: saturate(150%) blur(14px);
  border-bottom: 1px solid var(--line-soft);
}

.brand { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }

.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; position: relative;
  background: linear-gradient(150deg, var(--accent) 0%, #c43d00 100%);
  box-shadow: 0 0 18px rgba(255,102,0,.42), inset 0 1px 0 rgba(255,255,255,.35);
  display: grid; place-items: center;
}
.brand-mark span {
  width: 13px; height: 13px; border-radius: 4px 4px 6px 6px;
  background: #0a0d11; box-shadow: inset 0 -3px 0 rgba(255,255,255,.14);
}

.brand-text h1 {
  margin: 0; font-size: 14px; font-weight: 750; letter-spacing: .17em; line-height: 1.1;
}
.brand-text p {
  margin: 1px 0 0; font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--txt-faint);
}

.chips { display: flex; align-items: center; gap: 8px; flex: 1 1 auto; min-width: 0; }

.chip {
  position: relative;
  display: flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 11px;
  background: rgba(255,255,255,.038);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  white-space: nowrap;
}
.chip-val { font-size: 12px; font-weight: 620; letter-spacing: .01em; }
.chip-unit, .chip-lbl { font-size: 9.5px; letter-spacing: .12em; color: var(--txt-faint); text-transform: uppercase; }

/* state chip */
.state-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--txt-dim); box-shadow: 0 0 0 0 currentColor;
}
#chip-state { min-width: 106px; }
#chip-state.s-mowing   { border-color: rgba(52,211,153,.4);  background: rgba(52,211,153,.10); }
#chip-state.s-mowing   .state-dot { background: var(--ok);   box-shadow: 0 0 10px var(--ok); animation: pulse 1.6s infinite; }
#chip-state.s-idle     .state-dot { background: var(--info); box-shadow: 0 0 8px var(--info); }
#chip-state.s-docking  { border-color: rgba(251,191,36,.35); }
#chip-state.s-docking  .state-dot { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
#chip-state.s-charging { border-color: rgba(34,211,238,.35); background: rgba(34,211,238,.09); }
#chip-state.s-charging .state-dot { background: #22d3ee; box-shadow: 0 0 10px #22d3ee; animation: pulse 2s infinite; }
#chip-state.s-stuck    { border-color: rgba(248,113,113,.55); background: rgba(248,113,113,.14); }
#chip-state.s-stuck    .state-dot { background: var(--bad); box-shadow: 0 0 12px var(--bad); animation: pulse .7s infinite; }
#chip-state.s-manual   .state-dot { background: var(--violet); box-shadow: 0 0 8px var(--violet); }
#chip-state.s-error    { border-color: rgba(239,68,68,.6); background: rgba(239,68,68,.16); }
#chip-state.s-error    .state-dot { background: #ef4444; box-shadow: 0 0 12px #ef4444; animation: pulse .5s infinite; }

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* battery */
.ico.batt { width: 26px; height: 14px; overflow: visible; }
.ico.batt rect, .ico.batt path { fill: none; stroke: var(--txt-dim); stroke-width: 1.2; }
.ico.batt .cap { fill: var(--txt-dim); stroke: none; }
.ico.batt .fill { fill: var(--ok); stroke: none; transition: width .5s ease, fill .5s ease; }
#chip-batt.low  .ico.batt .fill { fill: var(--warn); }
#chip-batt.crit .ico.batt .fill { fill: var(--bad); animation: pulse 1s infinite; }
#chip-batt.crit { border-color: rgba(248,113,113,.45); background: rgba(248,113,113,.1); }
.bolt { color: var(--warn); display: block; opacity: 0; transition: opacity .3s; text-shadow: 0 0 8px var(--warn); }
#chip-batt.charging .bolt { opacity: 1; animation: pulse 1.4s infinite; }

/* coverage ring */
.ring { width: 22px; height: 22px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 3; }
.ring-bg { stroke: rgba(255,255,255,.11); }
.ring-fg {
  stroke: var(--accent); stroke-linecap: round;
  stroke-dasharray: 56.55; stroke-dashoffset: 56.55;
  transition: stroke-dashoffset .6s cubic-bezier(.4,0,.2,1);
  filter: drop-shadow(0 0 4px rgba(255,102,0,.6));
}

/* weather + forecast popover */
.wx-ico { font-size: 15px; line-height: 1; }
#chip-weather { cursor: default; }
.forecast-pop {
  position: absolute; top: calc(100% + 10px); left: 50%; transform: translateX(-50%) translateY(-6px);
  display: flex; gap: 2px; padding: 8px; border-radius: var(--r-md);
  background: var(--panel-solid); border: 1px solid var(--line); box-shadow: var(--sh);
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s;
}
#chip-weather:hover .forecast-pop { opacity: 1; transform: translateX(-50%) translateY(0); }
.fc { display: grid; justify-items: center; gap: 2px; padding: 4px 7px; border-radius: var(--r-sm); }
.fc:hover { background: rgba(255,255,255,.05); }
.fc b { font-size: 10px; color: var(--txt-faint); font-weight: 600; }
.fc i { font-style: normal; font-size: 14px; }
.fc s { text-decoration: none; font-size: 11px; font-weight: 600; }

/* clock + speed */
.chip-clock { gap: 8px; padding-right: 9px; }
.sep { width: 1px; height: 16px; background: var(--line); }
.speeds { display: flex; gap: 2px; }
.spd {
  height: 21px; padding: 0 7px; border-radius: 6px; font-size: 10.5px; font-weight: 650;
  color: var(--txt-dim); background: rgba(255,255,255,.04); transition: all .15s;
}
.spd:hover { color: var(--txt); background: rgba(255,255,255,.09); }
.spd.on { color: #0a0d11; background: var(--accent); box-shadow: 0 0 12px rgba(255,102,0,.45); }
.spd-out { min-width: 34px; text-align: right; color: var(--accent-2); font-size: 11px; }

input[type=range] {
  -webkit-appearance: none; appearance: none; background: none; height: 16px; cursor: pointer;
}
input[type=range]::-webkit-slider-runnable-track {
  height: 3px; border-radius: 3px; background: rgba(255,255,255,.14);
}
input[type=range]::-moz-range-track { height: 3px; border-radius: 3px; background: rgba(255,255,255,.14); }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 12px; height: 12px; margin-top: -4.5px;
  border-radius: 50%; background: var(--accent); border: 2px solid #0d1218;
  box-shadow: 0 0 8px rgba(255,102,0,.6); transition: transform .12s;
}
input[type=range]::-moz-range-thumb {
  width: 12px; height: 12px; border-radius: 50%; background: var(--accent);
  border: 2px solid #0d1218; box-shadow: 0 0 8px rgba(255,102,0,.6);
}
input[type=range]:hover::-webkit-slider-thumb { transform: scale(1.2); }
#rng-speed { width: 76px; }

.link { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; }
#ws-text { font-size: 9.5px; letter-spacing: .14em; color: var(--txt-faint); }
.ws-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--bad);
  box-shadow: 0 0 10px var(--bad); transition: background .3s, box-shadow .3s;
}
.ws-dot.up { background: var(--ok); box-shadow: 0 0 10px var(--ok); }

/* ─────────────────────────── palette ────────────────────────── */

#palette {
  position: fixed; z-index: 15; left: 16px; top: 76px;
  width: 60px; padding: 8px 8px 6px;
  display: flex; flex-direction: column; gap: 6px; align-items: center;
}
.pal-title, .pal-hint {
  font-size: 8.5px; letter-spacing: .16em; color: var(--txt-faint); text-transform: uppercase;
}
.pal-hint { font-size: 8px; letter-spacing: .04em; text-align: center; margin-top: 2px; opacity: .7; }
.pal-item {
  width: 44px; height: 40px; border-radius: 10px; font-size: 20px; line-height: 1;
  background: rgba(255,255,255,.04); border: 1px solid var(--line-soft);
  display: grid; place-items: center;
  transition: transform .14s cubic-bezier(.34,1.56,.64,1), background .14s, border-color .14s;
}
.pal-item:hover {
  transform: translateY(-2px) scale(1.06);
  background: var(--accent-dim); border-color: rgba(255,102,0,.4);
}
.pal-item:active { transform: scale(.94); }

#drag-ghost {
  position: fixed; z-index: 60; left: 0; top: 0; pointer-events: none;
  line-height: 0; opacity: 0;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,.6));
  transform: translate(-50%, -50%) scale(.6); transition: opacity .12s;
}
#drag-ghost.on { opacity: 1; transform: translate(-50%, -50%) scale(1); }
body.dragging #view { cursor: crosshair; }

/* ─────────────────────────── controls ───────────────────────── */

#controls {
  position: fixed; z-index: 15; left: 88px; bottom: 16px; width: 296px;
  padding: 12px 14px 10px; display: flex; flex-direction: column; gap: 9px;
}
.ctl-head {
  font-size: 9px; letter-spacing: .18em; color: var(--txt-faint);
  text-transform: uppercase; margin-bottom: -1px;
}
.ctl-row { display: flex; align-items: center; gap: 8px; }
.ctl-row > label {
  flex: 0 0 38px; font-size: 10px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--txt-faint);
}
.btnrow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }

.btn {
  display: flex; align-items: center; justify-content: center; gap: 5px;
  height: 32px; padding: 0 8px; border-radius: var(--r-sm);
  font-size: 11.5px; font-weight: 600; color: var(--txt-dim);
  background: rgba(255,255,255,.045); border: 1px solid var(--line-soft);
  transition: all .15s;
}
.btn span { font-size: 9px; opacity: .8; }
.btn:hover { color: var(--txt); background: rgba(255,255,255,.1); border-color: var(--line); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  color: #120800; background: linear-gradient(160deg, var(--accent-2), var(--accent));
  border-color: rgba(255,138,61,.5); box-shadow: 0 3px 14px rgba(255,102,0,.35);
}
.btn.primary:hover { filter: brightness(1.12); box-shadow: 0 4px 20px rgba(255,102,0,.5); }
.btn.primary.active { animation: mowpulse 2s infinite; }
@keyframes mowpulse {
  0%,100% { box-shadow: 0 3px 14px rgba(255,102,0,.35); }
  50%     { box-shadow: 0 3px 22px rgba(255,102,0,.75); }
}
.btn.ghost { color: var(--txt-faint); background: transparent; }
.btn.danger { color: #fff; background: rgba(248,113,113,.2); border-color: rgba(248,113,113,.5); }
.btn.danger:hover { background: rgba(248,113,113,.36); }
.btn.sm { height: 25px; font-size: 10.5px; padding: 0 10px; }

select {
  flex: 1 1 auto; height: 30px; padding: 0 26px 0 9px; border-radius: var(--r-sm);
  background: rgba(255,255,255,.045) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6'><path d='M0 0l5 6 5-6z' fill='%2396a3b2'/></svg>") no-repeat right 9px center;
  border: 1px solid var(--line-soft); appearance: none; -webkit-appearance: none;
  font-size: 12px; cursor: pointer; transition: border-color .15s;
}
select:hover { border-color: var(--line); }
select:focus { outline: none; border-color: rgba(255,102,0,.5); }
select option { background: var(--panel-solid); color: var(--txt); }

#rng-cut { flex: 1 1 auto; }
#out-cut { flex: 0 0 auto; font-size: 11px; color: var(--accent-2); min-width: 48px; text-align: right; }

.toggles { gap: 5px; }
.tgl {
  flex: 1 1 0; height: 24px; border-radius: 6px; font-size: 10px; font-weight: 600;
  letter-spacing: .02em; color: var(--txt-faint);
  background: rgba(255,255,255,.035); border: 1px solid var(--line-soft); transition: all .15s;
}
.tgl:hover { color: var(--txt-dim); }
.tgl.on { color: var(--accent-2); background: var(--accent-dim); border-color: rgba(255,102,0,.34); }

.ctl-foot {
  border-top: 1px solid var(--line-soft); padding-top: 7px; margin-top: 1px;
  font-size: 10.5px; color: var(--txt-faint); min-height: 15px;
}
.ctl-foot b { color: var(--accent-2); font-weight: 600; }

/* ───────────────────────── log drawer ───────────────────────── */

#logdrawer {
  position: fixed; z-index: 14; left: 400px; right: 372px; bottom: 16px;
  display: flex; flex-direction: column; overflow: hidden;
  height: 208px; transition: height .28s cubic-bezier(.4,0,.2,1);
}
#logdrawer.collapsed { height: 34px; }
#log-head {
  display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px;
  flex: 0 0 34px; cursor: pointer; user-select: none;
  border-bottom: 1px solid transparent;
}
#logdrawer:not(.collapsed) #log-head { border-bottom-color: var(--line-soft); }
.log-led { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.log-led.blink { animation: blink .35s; }
@keyframes blink { 0% { transform: scale(2.2); opacity: .3; } 100% { transform: scale(1); opacity: 1; } }
.log-title { font-size: 9px; letter-spacing: .18em; color: var(--txt-faint); }
.log-meta { font-size: 9.5px; color: var(--txt-faint); }
.log-last { font-size: 10px; color: var(--txt-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46%; }
#logdrawer:not(.collapsed) .log-last { opacity: 0; }
.chev {
  width: 22px; height: 22px; border-radius: 6px; color: var(--txt-faint);
  display: grid; place-items: center; font-size: 10px; transition: all .2s;
}
.chev:hover { color: var(--txt); background: rgba(255,255,255,.07); }
#logdrawer.collapsed #log-toggle { transform: rotate(180deg); }

#log-body { flex: 1 1 auto; overflow-y: auto; padding: 5px 0 7px; font-size: 10.5px; }
.lrow { display: flex; gap: 9px; padding: 1.5px 12px; line-height: 1.5; }
.lrow:hover { background: rgba(255,255,255,.035); }
.lt { color: var(--txt-faint); flex: 0 0 54px; text-align: right; opacity: .75; }
.ls { flex: 0 0 58px; color: var(--info); opacity: .85; overflow: hidden; text-overflow: ellipsis; }
.lm { flex: 1 1 auto; color: var(--txt-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lf { color: var(--txt-faint); opacity: .7; }
.lrow.warn  .lm { color: var(--warn); }
.lrow.error .lm { color: var(--bad); }
.lrow.error { background: rgba(248,113,113,.07); }
.lrow.debug .lm { color: var(--txt-faint); }

/* ─────────────────────────── chat ───────────────────────────── */

#chat {
  position: fixed; z-index: 16; right: 16px; top: 76px; bottom: 16px; width: 340px;
  display: flex; flex-direction: column; overflow: hidden;
  transition: transform .32s cubic-bezier(.4,0,.2,1), opacity .24s;
}
#chat.hidden { transform: translateX(calc(100% + 24px)); opacity: 0; pointer-events: none; }

#chat-head {
  display: flex; align-items: center; gap: 9px; padding: 11px 12px;
  border-bottom: 1px solid var(--line-soft); flex: 0 0 auto;
}
.ai-mark {
  width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
  color: #120800;
  background: linear-gradient(150deg, var(--accent-2), var(--accent));
  box-shadow: 0 0 16px rgba(255,102,0,.45);
}
.chat-title { display: flex; flex-direction: column; line-height: 1.25; flex: 1 1 auto; min-width: 0; }
.chat-title b { font-size: 12.5px; font-weight: 650; }
.chat-title small { font-size: 10px; color: var(--txt-faint); }
.chat-title small.busy { color: var(--accent-2); }
#chat-toggle { font-size: 14px; }

#chat-log {
  flex: 1 1 auto; overflow-y: auto; overflow-x: hidden;
  padding: 12px 12px 4px; display: flex; flex-direction: column; gap: 8px;
  scroll-behavior: smooth;
}

.chat-hero { position: relative; padding: 18px 6px 8px; text-align: center; }
.hero-glow {
  position: absolute; top: -30px; left: 50%; transform: translateX(-50%);
  width: 170px; height: 110px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255,102,0,.24), transparent);
  filter: blur(14px); pointer-events: none;
}
.chat-hero p { position: relative; margin: 0 0 12px; color: var(--txt-dim); font-size: 12px; }
.hero-chips { display: flex; flex-direction: column; gap: 5px; }
.sugg {
  padding: 7px 10px; border-radius: 9px; font-size: 11.5px; text-align: left;
  color: var(--txt-dim); background: rgba(255,255,255,.04);
  border: 1px solid var(--line-soft); transition: all .15s;
}
.sugg:hover { color: var(--txt); background: var(--accent-dim); border-color: rgba(255,102,0,.35); transform: translateX(2px); }

.msg { max-width: 88%; animation: rise .3s cubic-bezier(.2,.8,.3,1); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.msg.user {
  align-self: flex-end; padding: 8px 11px; border-radius: 13px 13px 4px 13px;
  background: linear-gradient(155deg, rgba(255,102,0,.9), rgba(214,77,0,.85));
  color: #180a00; font-weight: 500; white-space: pre-wrap; word-break: break-word;
  box-shadow: 0 3px 12px rgba(255,102,0,.24);
}
.msg.bot {
  align-self: flex-start; padding: 9px 12px; border-radius: 13px 13px 13px 4px;
  background: rgba(255,255,255,.055); border: 1px solid var(--line-soft);
  word-break: break-word;
}
.msg.bot.streaming::after {
  content: ''; display: inline-block; width: 7px; height: 13px; margin-left: 3px;
  background: var(--accent); vertical-align: -2px; animation: caret 1s steps(2) infinite;
}
@keyframes caret { 50% { opacity: 0; } }

.msg.bot p { margin: 0 0 7px; } .msg.bot p:last-child { margin-bottom: 0; }
.msg.bot ul, .msg.bot ol { margin: 0 0 7px; padding-left: 18px; }
.msg.bot li { margin: 1px 0; }
.msg.bot code {
  font-family: var(--mono); font-size: 11px; padding: 1px 5px; border-radius: 4px;
  background: rgba(0,0,0,.42); color: var(--accent-2);
}
.msg.bot strong { color: #fff; font-weight: 650; }
.msg.bot em { color: var(--txt-dim); }

.msg.note {
  align-self: center; max-width: 96%; text-align: center;
  font-size: 10.5px; color: var(--txt-faint); font-style: italic; padding: 2px 0;
}

.toolchip {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 20px; font-family: var(--mono); font-size: 10px;
  color: var(--info); background: rgba(125,211,252,.09);
  border: 1px solid rgba(125,211,252,.22); animation: rise .3s;
}
.toolchip .cog { animation: spin 2.4s linear infinite; display: inline-block; }
.toolchip.done .cog { animation: none; opacity: .55; }
@keyframes spin { to { transform: rotate(360deg); } }

.think {
  align-self: stretch; border-radius: 10px; overflow: hidden;
  background: rgba(255,255,255,.028); border: 1px solid var(--line-soft); animation: rise .3s;
}
.think > summary {
  list-style: none; cursor: pointer; padding: 5px 10px;
  display: flex; align-items: center; gap: 7px;
  font-size: 10.5px; color: var(--txt-faint); user-select: none;
}
.think > summary::-webkit-details-marker { display: none; }
.think > summary:hover { color: var(--txt-dim); }
.think .dots { display: inline-flex; gap: 2.5px; }
.think .dots i {
  width: 3.5px; height: 3.5px; border-radius: 50%; background: var(--accent);
  animation: bob 1.1s infinite;
}
.think .dots i:nth-child(2) { animation-delay: .16s; }
.think .dots i:nth-child(3) { animation-delay: .32s; }
@keyframes bob { 0%,60%,100% { opacity: .25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2.5px); } }
.think.done .dots { display: none; }
.think .tbody {
  padding: 2px 10px 8px; font-size: 11px; font-style: italic;
  color: var(--txt-faint); line-height: 1.55; white-space: pre-wrap; word-break: break-word;
  max-height: 190px; overflow-y: auto;
}

#chat-input-wrap {
  flex: 0 0 auto; display: flex; align-items: flex-end; gap: 7px;
  padding: 9px 10px 10px; border-top: 1px solid var(--line-soft);
  background: rgba(0,0,0,.18);
}
#chat-input {
  flex: 1 1 auto; resize: none; max-height: 110px; padding: 8px 10px;
  border-radius: 10px; background: rgba(255,255,255,.05);
  border: 1px solid var(--line-soft); font-size: 12.5px; line-height: 1.4;
  transition: border-color .15s, background .15s;
}
#chat-input:focus { outline: none; border-color: rgba(255,102,0,.5); background: rgba(255,255,255,.075); }
#chat-input:disabled { opacity: .45; }
#chat-send {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(155deg, var(--accent-2), var(--accent));
  box-shadow: 0 2px 12px rgba(255,102,0,.35); transition: all .15s;
}
#chat-send svg { fill: #150800; }
#chat-send:hover { filter: brightness(1.13); }
#chat-send:disabled { opacity: .35; cursor: default; filter: grayscale(.6); }

#chat-reopen {
  position: fixed; z-index: 16; right: 16px; top: 76px;
  width: 40px; height: 40px; border-radius: 12px; color: #120800;
  display: grid; place-items: center;
  background: linear-gradient(150deg, var(--accent-2), var(--accent));
  box-shadow: 0 4px 18px rgba(255,102,0,.45);
  opacity: 0; pointer-events: none; transform: scale(.7); transition: all .25s;
}
#chat-reopen.show { opacity: 1; pointer-events: auto; transform: scale(1); }

/* ───────────────── SLAM estimate overlay label ──────────────── */

#slam-label {
  position: fixed; z-index: 12; display: none; align-items: center; gap: 7px;
  padding: 3px 9px 3px 8px; border-radius: 20px; pointer-events: none;
  transform: translate(-50%, -50%); white-space: nowrap;
  background: rgba(8, 24, 33, .74);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  border: 1px solid rgba(90, 217, 255, .45);
  box-shadow: 0 0 20px rgba(90, 217, 255, .20);
  font-size: 10px; letter-spacing: .05em; color: #9fe8ff;
}
#slam-label.show { display: flex; }
#slam-label b { font-weight: 650; }
#slam-label i {
  font-style: normal; font-family: var(--mono); font-size: 9.5px;
  color: #5ad9ff; opacity: .85;
}
.sl-dot {
  width: 5px; height: 5px; border-radius: 50%; background: #5ad9ff;
  box-shadow: 0 0 9px #5ad9ff; animation: pulse 1.6s infinite;
}

/* ───────────────────────── toasts ───────────────────────────── */

#toasts {
  position: fixed; z-index: 40; top: 70px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 15px 9px 12px; border-radius: 12px; pointer-events: auto;
  background: rgba(17,23,31,.9);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--line); box-shadow: var(--sh);
  animation: drop .34s cubic-bezier(.2,1.2,.4,1);
  transition: opacity .3s, transform .3s;
  max-width: 460px;
}
@keyframes drop { from { opacity: 0; transform: translateY(-14px) scale(.96); } to { opacity: 1; transform: none; } }
.toast.out { opacity: 0; transform: translateY(-10px) scale(.96); }
.toast .ti { font-size: 17px; line-height: 1; }
.toast .tx b { display: block; font-size: 12px; font-weight: 650; }
.toast .tx span { font-size: 11px; color: var(--txt-dim); }
.toast.warn  { border-color: rgba(251,191,36,.5); box-shadow: var(--sh), 0 0 26px rgba(251,191,36,.16); }
.toast.warn  .tx b { color: var(--warn); }
.toast.bad   { border-color: rgba(248,113,113,.55); box-shadow: var(--sh), 0 0 26px rgba(248,113,113,.18); }
.toast.bad   .tx b { color: var(--bad); }
.toast.good  { border-color: rgba(52,211,153,.45); }
.toast.good  .tx b { color: var(--ok); }
.toast.party { border-color: rgba(255,102,0,.55); box-shadow: var(--sh), 0 0 34px rgba(255,102,0,.3); }
.toast.party .tx b { color: var(--accent-2); }

/* ─────────────── obstacle selection popover ─────────────────── */

#obs-pop {
  position: fixed; z-index: 30; display: none; align-items: center; gap: 9px;
  padding: 6px 8px 6px 12px; border-radius: 11px; transform: translate(-50%, -130%);
}
#obs-pop.show { display: flex; animation: rise .18s; }
.obs-name { font-size: 11px; color: var(--txt-dim); text-transform: capitalize; }

/* ───────────────────────── boot veil ────────────────────────── */

#boot {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center;
  background: radial-gradient(120% 100% at 50% 40%, #0d1218, #05070a);
  transition: opacity .55s ease, visibility .55s;
}
#boot.gone { opacity: 0; visibility: hidden; }
.boot-inner { display: grid; justify-items: center; gap: 16px; }
.boot-inner span { font-size: 10px; letter-spacing: .3em; text-transform: uppercase; color: var(--txt-faint); }
.boot-ring {
  width: 46px; height: 46px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.08); border-top-color: var(--accent);
  animation: spin .9s linear infinite; box-shadow: 0 0 26px rgba(255,102,0,.28);
}

/* ──────────────────────── responsive ────────────────────────── */

@media (max-width: 1500px) {
  .log-last { max-width: 30%; }
}
@media (max-width: 1400px) {
  #chat { width: 320px; }
  #logdrawer { right: 352px; }
}
@media (max-width: 1340px) {
  #topbar { gap: 14px; padding: 0 12px; }
  .chips { gap: 6px; }
  .chip { padding: 0 9px; gap: 6px; }
  #chip-state { min-width: 92px; }
  #rng-speed { width: 56px; }
  .brand-text p { display: none; }
  #logdrawer { left: 392px; }
  #controls { width: 286px; }
}
@media (max-height: 840px) {
  #logdrawer { height: 168px; }
  .chat-hero { padding-top: 8px; }
}
