/* Motu — stream-overlay HUD. The island is the hero: a slim top bar, corner toasts, a thin
   market tape and one drawer (Feed / Agents / Market / Top) that is closed by default. Phones: bottom sheet. */
:root {
  --ink: #2c2748;
  --ink-2: #4a4468;
  --muted: #625e80;
  --glass: rgba(255, 255, 255, 0.6);
  --glass-strong: rgba(255, 255, 255, 0.82);
  --edge: rgba(255, 255, 255, 0.75);
  --line: rgba(98, 84, 160, 0.14);
  --shadow: 0 6px 18px -8px rgba(60, 44, 120, 0.32), 0 1px 3px rgba(60, 44, 120, 0.08);
  --blur: blur(10px) saturate(1.5);
  --up: #12804f;
  --up-bg: #d7f5e6;
  --down: #c62f60;
  --down-bg: #ffe0ea;
  --gold: #9a5f00;
  --gold-bg: #fff1c7;
  --lav: #7c6cf0;
  --lav-ink: #4d3bd0;
  --lav-bg: #ece8ff;
  --mint: #4fd1a5;
  --pink: #ff8fb6;
  --r: 14px;
  --gap: 12px;
  --bar-h: 40px;
  --drawer-w: 320px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --ease-out: cubic-bezier(.2, .9, .25, 1);
  --spring: cubic-bezier(.3, 1.45, .45, 1);
  --mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;
}
/* Title font: DynaPuff 700 (SIL OFL), subset to the letters of "Motu" only. */
@font-face { font-family: 'DynaPuff'; src: url('fonts/dynapuff-motu.woff2') format('woff2'); font-weight: 700; font-display: swap; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; }
body {
  font-family: 'Nunito', ui-rounded, system-ui, -apple-system, sans-serif; color: var(--ink);
  background: linear-gradient(180deg, #a9e4ff 0%, #ffeedd 100%);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
#app { position: fixed; inset: 0; }
#app canvas { display: block; touch-action: none; }
#labels { position: fixed; inset: 0; pointer-events: none; }
#ui { position: fixed; inset: 0; pointer-events: none; z-index: 5; font-size: 12.5px; font-variant-numeric: tabular-nums; }
#ui button { font: inherit; color: inherit; }
.num, .tnum { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1; }
.coin { width: 1em; height: 1em; display: inline-block; vertical-align: -0.14em; flex: none; filter: drop-shadow(0 1px 0 rgba(150, 90, 0, .25)); }
.ico { width: 16px; height: 16px; flex: none; display: inline-block; }
svg.ico { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
button:focus-visible, [tabindex]:focus-visible { outline: 2px solid rgba(124, 108, 240, .8); outline-offset: 2px; }

/* ---------------- shared glass ---------------- */
.panel {
  position: fixed; pointer-events: auto;
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--edge); border-radius: var(--r); box-shadow: var(--shadow);
}
.iconbtn {
  border: 0; background: transparent; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
  cursor: pointer; color: var(--muted); transition: background .15s, color .15s;
}
.iconbtn:hover { background: rgba(124, 108, 240, .12); color: var(--ink); }
.iconbtn .ico { width: 14px; height: 14px; }
.chg { display: inline-flex; align-items: center; gap: 2px; font-size: 11px; font-weight: 900; padding: 1px 6px; border-radius: 999px; white-space: nowrap; }
.chg.up { color: var(--up); background: var(--up-bg); }
.chg.down { color: var(--down); background: var(--down-bg); }
.chg .tri { font-size: 7px; }
.spark { display: block; overflow: visible; }
.spark path.l { fill: none; stroke-width: 1.75; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark.up path.l { stroke: #1fa56a; }
.spark.down path.l { stroke: #e04a7a; }
.spdot { position: absolute; right: -3px; width: 6px; height: 6px; border-radius: 50%; background: #1fa56a; box-shadow: 0 0 0 2px #fff; pointer-events: none; transition: top .4s; }
.spdot.down { background: #e04a7a; }
.bar { position: relative; height: 6px; border-radius: 99px; background: rgba(124, 108, 240, .16); overflow: hidden; }
.bar > i { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 99px; background: linear-gradient(90deg, #a594ff, #ff9cc2, #ffd36e); transition: width .8s var(--ease-out); }
.fbadge { display: none; min-width: 15px; height: 15px; padding: 0 4px; border-radius: 99px; background: #ff4f86; color: #fff; font-size: 9.5px; font-weight: 900; line-height: 15px; text-align: center; }
.fbadge.show { display: inline-block; }
.empty { padding: 12px 12px 14px; font-size: 12px; font-weight: 700; color: var(--muted); }
@keyframes livePulse { 0% { box-shadow: 0 0 0 0 rgba(255, 61, 116, .55); } 70% { box-shadow: 0 0 0 6px rgba(255, 61, 116, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 61, 116, 0); } }

/* ---------------- top bar ---------------- */
#top { position: fixed; z-index: 4; left: calc(var(--gap) + var(--safe-l)); right: calc(var(--gap) + var(--safe-r)); top: calc(var(--gap) + var(--safe-t)); display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; pointer-events: none; }
#top .panel { position: relative; }
#bar { display: flex; align-items: center; gap: 9px; height: var(--bar-h); padding: 0 12px 0 10px; border-radius: 999px; min-width: 0; white-space: nowrap; font-weight: 800; }
.brand { display: inline-flex; align-items: center; gap: 6px; font-weight: 900; font-size: 13.5px; letter-spacing: -.005em; }
.brand b { font-family: 'DynaPuff', 'Nunito', sans-serif; font-weight: 700; font-size: 15px; letter-spacing: 0; }
.brand .coin { font-size: 20px; }
.live { display: inline-flex; align-items: center; gap: 4px; font-size: 9.5px; font-weight: 900; letter-spacing: .1em; color: #c4245a; background: #ffe1ea; padding: 2px 7px 2px 6px; border-radius: 999px; }
.live i { width: 6px; height: 6px; border-radius: 50%; background: #ff3d74; animation: livePulse 1.8s infinite; }
.live.off { color: #6f6590; background: #eee9f7; }
.live.off i { background: #b7aecb; animation: none; }
.sep { width: 1px; height: 18px; background: var(--line); flex: none; }
.era-chip { position: relative; display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 9px 0 4px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, .55); cursor: pointer; overflow: hidden; font-size: 12px; font-weight: 900; transition: background .2s; }
.era-chip:hover, .era-chip[aria-expanded="true"] { background: rgba(255, 255, 255, .9); }
.era-badge { font-size: 9px; font-weight: 900; letter-spacing: .07em; color: #fff; background: linear-gradient(135deg, #8f7cff, #ff8fb6); padding: 2px 6px; border-radius: 999px; }
.season { font-size: 9px; font-weight: 900; letter-spacing: .05em; color: #5a44b0; background: #e6defe; padding: 2px 6px; border-radius: 999px; }
.season[hidden] { display: none; }
.era-name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.era-pct { color: var(--lav-ink); font-size: 11px; }
.era-line { position: absolute; left: 10px; right: 10px; bottom: 2px; height: 2px; border-radius: 2px; background: rgba(124, 108, 240, .16); overflow: hidden; }
.era-line i { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, #a594ff, #ff9cc2, #ffd36e); transition: width .8s var(--ease-out); }
.ix { display: inline-flex; align-items: center; gap: 6px; cursor: default; }
.ix .sym { display: inline-flex; align-items: center; gap: 3px; color: var(--gold); background: var(--gold-bg); border-radius: 999px; padding: 1px 6px 1px 2px; font-size: 10.5px; font-weight: 900; }
.ix .sym .coin { font-size: 14px; }
.ix-val { font-size: 16px; font-weight: 900; letter-spacing: -.01em; min-width: 3.4em; }
.ix-sp { position: relative; width: 52px; height: 18px; }
.ix-sp .spark { width: 100%; height: 100%; }
.st { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 900; color: var(--ink); }
.st .ico { width: 14px; height: 14px; color: var(--lav); }
.st .coin { font-size: 14px; }
.st .stl { font-size: 10px; font-weight: 800; color: var(--muted); margin-left: -1px; }
@media (max-width: 1320px) { .st .stl { display: none; } }
.clock { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 800; color: var(--ink-2); }
.clock .ico { width: 15px; height: 15px; color: #e88a0c; }
.clock.night .ico { color: #7c6cf0; } .clock.rain .ico { color: #3f8fd6; } .clock.storm .ico { color: #8a62d8; }

/* controls (right) */
#toolbar { display: flex; align-items: center; gap: 3px; height: var(--bar-h); padding: 0 5px; border-radius: 999px; flex: none; }
.vsep { width: 1px; height: 18px; margin: 0 3px; background: var(--line); }
.seg { display: flex; background: rgba(124, 108, 240, .1); border-radius: 999px; padding: 2px; gap: 1px; }
.seg button { border: 0; background: transparent; cursor: pointer; font-weight: 900; font-size: 11.5px; height: 26px; padding: 0 8px; border-radius: 999px; color: var(--ink-2); min-width: 30px; transition: background .2s, color .2s; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: #fff; color: var(--lav-ink); box-shadow: 0 1px 4px -1px rgba(76, 58, 140, .35); }
.tbtn { position: relative; border: 0; cursor: pointer; height: 30px; min-width: 30px; padding: 0 7px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; background: transparent; color: var(--ink-2); font-weight: 900; font-size: 12px; transition: background .2s, color .2s, transform .2s var(--spring); }
.tbtn:hover { background: rgba(255, 255, 255, .85); color: var(--ink); }
.tbtn:active { transform: scale(.92); }
.tbtn .ico { width: 16px; height: 16px; }
.tbtn.on { background: #fff; color: var(--lav-ink); box-shadow: 0 1px 5px -1px rgba(76, 58, 140, .4); }
.tbtn.dir.on { background: linear-gradient(135deg, #8f7cff, #b48cff); color: #fff; box-shadow: 0 4px 10px -4px rgba(124, 108, 240, .9); }
.tbtn .rec { display: none; position: absolute; top: 4px; right: 4px; width: 6px; height: 6px; border-radius: 50%; background: #ffd1e1; animation: livePulse 1.8s infinite; }
.tbtn.dir.on .rec { display: block; }
.tbtn.muted { color: var(--down); }
.tbtn .fbadge { position: absolute; top: -3px; right: -4px; }
.drbtns { display: inline-flex; gap: 2px; }
.viewers { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 9px 0 7px; margin-right: 2px; border-radius: 999px; background: #ffe1ea; color: #c4245a; font-weight: 900; font-size: 11.5px; }
.viewers[hidden] { display: none; }
.viewers .ico { width: 14px; height: 14px; }
.viewers.off { color: #6f6590; background: #eee9f7; }
#ui.online #speed, #ui.online .sp-sep, #ui.online .spm { display: none; }

/* era popover */
#eraPop { z-index: 6; top: calc(var(--gap) + var(--safe-t) + var(--bar-h) + 6px); width: 290px; padding: 11px 12px 10px; background: var(--glass-strong); border-radius: 14px; animation: popIn .25s var(--ease-out); }
#eraPop[hidden] { display: none; }
@keyframes popIn { from { opacity: 0; transform: translateY(-6px); } }
.ep-top { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 900; margin-bottom: 7px; white-space: nowrap; }
.ep-top b { overflow: hidden; text-overflow: ellipsis; }
.era-next { color: var(--muted); font-weight: 800; font-size: 11.5px; }
.ep-goal { margin-top: 6px; font-size: 11.5px; font-weight: 700; color: var(--ink-2); line-height: 1.3; }
.project { display: flex; align-items: center; gap: 7px; margin-top: 8px; font-size: 11.5px; font-weight: 800; color: var(--ink-2); background: rgba(255, 243, 207, .8); border-radius: 10px; padding: 5px 8px; }
.project[hidden] { display: none; }
.project .ico { width: 14px; height: 14px; color: var(--gold); }
.project .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.project .bar { flex: 1; height: 5px; }
.project .pc { font-weight: 900; color: var(--gold); }
.ep-stats { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 8px; font-size: 11px; font-weight: 800; color: var(--muted); }
.ep-stats span { display: inline-flex; align-items: center; gap: 3px; }
.ep-stats .ico { width: 13px; height: 13px; color: var(--lav); }
.ep-stats b { color: var(--ink); font-weight: 900; }
.ep-foot { display: flex; justify-content: space-between; margin-top: 6px; font-size: 10.5px; font-weight: 800; color: var(--muted); }

/* ---------------- corner news toasts (bottom-left) ---------------- */
#ticker { position: fixed; z-index: 3; left: calc(var(--gap) + var(--safe-l)); bottom: calc(var(--gap) + var(--safe-b)); width: 300px; display: flex; flex-direction: column; align-items: flex-start; gap: 5px; pointer-events: none; }
.tk-list { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; width: 100%; }
.tt { pointer-events: auto; display: flex; align-items: flex-start; gap: 7px; max-width: 100%; padding: 5px 10px 5px 5px; border-radius: 12px; font-size: 12px; font-weight: 700; line-height: 1.3; color: var(--ink);
  background: var(--glass-strong); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border: 1px solid var(--edge); box-shadow: var(--shadow);
  animation: ttIn .45s var(--spring) both; transition: opacity .35s, transform .35s var(--ease-out); }
.tt.click { cursor: pointer; }
.tt.click:hover { background: #fff; }
.tt .bi { width: 22px; height: 22px; flex: none; border-radius: 8px; display: grid; place-items: center; font-size: 13px; background: #f1eefe; }
.tt.good .bi { background: #dcf7e9; } .tt.bad .bi { background: #ffe2ec; }
.tt.big { background: linear-gradient(135deg, rgba(255, 246, 214, .95), rgba(255, 230, 240, .92)); }
.tt.big .bi { background: linear-gradient(135deg, #ffe9a8, #ffc9dc); }
.tt .m { padding-top: 2px; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tt b, .tt strong { font-weight: 900; }
.tt .cnt, .dr-latest .cnt { font-size: 10px; font-weight: 900; color: #5a49d6; background: var(--lav-bg); border-radius: 999px; padding: 0 5px; }
.tt.out { opacity: 0; transform: translateX(-14px); }
@keyframes ttIn { from { opacity: 0; transform: translateY(8px) scale(.96); } }
.tk-more { pointer-events: auto; display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px 0 8px; border: 1px solid var(--edge); border-radius: 999px; cursor: pointer; font-size: 11px; font-weight: 900; letter-spacing: .02em; color: var(--ink-2);
  background: var(--glass); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); box-shadow: var(--shadow); transition: background .2s; }
.tk-more:hover { background: #fff; }
.tk-more .ico { width: 13px; height: 13px; color: var(--lav); }
#ui.dr-feed #ticker { display: none; }

/* ---------------- market tape (bottom centre) ---------------- */
#tape { z-index: 3; left: 50%; transform: translateX(-50%); bottom: calc(var(--gap) + var(--safe-b)); display: flex; align-items: center; gap: 2px; height: 32px; padding: 0 4px; border-radius: 999px; max-width: calc(100vw - 2 * 330px); }
.tp-head { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px 0 6px; border: 0; border-radius: 999px; background: transparent; cursor: pointer; font-size: 10px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); flex: none; }
.tp-head:hover { background: rgba(255, 255, 255, .8); color: var(--ink); }
.tp-head .ico { width: 13px; height: 13px; color: var(--lav); }
.tp-items { display: flex; gap: 1px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.tp-items::-webkit-scrollbar { display: none; }
.tp { flex: none; display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 7px; border: 0; border-radius: 999px; background: transparent; cursor: pointer; font-size: 12px; transition: background .2s, box-shadow .3s; }
.tp:hover { background: rgba(255, 255, 255, .85); }
.tp .em { font-size: 13px; }
.tp b { font-weight: 900; }
.tp .d { font-size: 10px; font-weight: 900; }
.tp .d.up { color: var(--up); } .tp .d.down { color: var(--down); }
.tp.jump-up { box-shadow: inset 0 0 0 1.5px rgba(31, 165, 106, .6); background: rgba(220, 247, 233, .8); }
.tp.jump-down { box-shadow: inset 0 0 0 1.5px rgba(224, 74, 122, .6); background: rgba(255, 226, 236, .8); }
#tape.collapsed .tp-items { display: none; }
#tape.collapsed .tp-head span { display: inline; }

/* ---------------- drawer (desktop: right side, closed by default) ---------------- */
#drawer { z-index: 4; right: calc(var(--gap) + var(--safe-r)); top: calc(var(--gap) + var(--safe-t) + var(--bar-h) + 8px); max-height: calc(100vh - 2 * var(--gap) - var(--safe-t) - var(--safe-b) - var(--bar-h) - 8px); max-height: calc(100dvh - 2 * var(--gap) - var(--safe-t) - var(--safe-b) - var(--bar-h) - 8px); width: var(--drawer-w);
  display: flex; flex-direction: column; background: var(--glass-strong); border-radius: 16px; overflow: hidden;
  transform: translateX(calc(100% + 24px)); visibility: hidden; transition: transform .38s var(--ease-out), visibility 0s .38s; }
#drawer.open { transform: none; visibility: visible; transition: transform .38s var(--ease-out), visibility 0s; }
.dr-handle { display: none; }
.dr-tabs { display: flex; align-items: center; gap: 2px; padding: 6px 6px 5px; border-bottom: 1px solid var(--line); flex: none; }
.dr-tabs [data-tab] { position: relative; border: 0; cursor: pointer; height: 28px; padding: 0 8px; border-radius: 999px; background: transparent; font-weight: 900; font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; transition: background .2s, color .2s; }
.dr-tabs [data-tab] .ico { width: 14px; height: 14px; }
.dr-tabs { gap: 1px; }
.dr-tabs [data-tab] { gap: 4px; font-size: 11.5px; }
.dr-tabs [data-tab]:hover { color: var(--ink); }
.dr-tabs [data-tab].on { background: var(--lav-bg); color: var(--lav-ink); }
.dr-tabs [data-tab][hidden], .tbtn[hidden] { display: none; }
.dr-tabs .sp { flex: 1; }
.spm { display: none; }
.dr-body { -webkit-mask-image: linear-gradient(#000 calc(100% - 26px), transparent); mask-image: linear-gradient(#000 calc(100% - 26px), transparent); padding-bottom: 14px; flex: 1 1 auto; min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(124, 108, 240, .3) transparent; overscroll-behavior: contain; }
.pane { display: none; }
.pane.active { display: block; }
.pane-h { display: flex; justify-content: space-between; padding: 9px 12px 3px; font-size: 9.5px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* feed list */
.events { padding: 5px 6px 8px; }
.ev { position: relative; display: flex; gap: 8px; align-items: flex-start; padding: 6px 7px; border-radius: 11px; font-size: 12.5px; font-weight: 700; line-height: 1.32; color: var(--ink); transition: background .2s; animation: evIn .45s var(--spring) both; }
.ev + .ev { margin-top: 1px; }
.ev.click { cursor: pointer; }
.ev.click:hover { background: rgba(255, 255, 255, .85); }
.ev .bi { width: 26px; height: 26px; flex: none; border-radius: 9px; display: grid; place-items: center; font-size: 14px; background: #f1eefe; }
.ev.good .bi { background: #dcf7e9; }
.ev.bad .bi { background: #ffe2ec; }
.ev.big .bi { background: linear-gradient(135deg, #ffe9a8, #ffc9dc); }
.ev.big { background: linear-gradient(135deg, rgba(255, 243, 207, .95), rgba(255, 228, 238, .9)); }
.ev .tx { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.ev .tx b, .ev .tx strong { font-weight: 900; }
.ev .meta { display: flex; align-items: center; gap: 5px; margin-top: 1px; font-size: 10.5px; font-weight: 800; color: var(--muted); }
.ev .meta .ico { width: 11px; height: 11px; opacity: .8; }
.ev .cnt { font-size: 10px; font-weight: 900; color: #5a49d6; background: var(--lav-bg); border-radius: 999px; padding: 0 5px; }
.ev .cnt.bump { animation: bump .5s var(--spring); }
.ev.fresh::after { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--lav); animation: fadeBar 2.5s forwards; }
.ev.good.fresh::after { background: var(--mint); } .ev.bad.fresh::after { background: var(--pink); } .ev.big.fresh::after { background: #ffb020; }
@keyframes fadeBar { to { opacity: 0; } }
@keyframes evIn { from { opacity: 0; transform: translateY(-8px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes bump { 40% { transform: scale(1.35); } }
.ev.out { animation: evOut .3s forwards; }
@keyframes evOut { to { opacity: 0; transform: translateX(20px); } }

/* market cards */
.goods { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 4px 8px 10px; }
.gd { background: rgba(255, 255, 255, .72); border-radius: 11px; padding: 6px 8px 5px; border: 1px solid rgba(255, 255, 255, .9); transition: transform .25s var(--spring), box-shadow .3s; min-width: 0; }
.gd .top { display: flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 900; color: var(--ink-2); }
.gd .em { font-size: 14px; }
.gd .gn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gd .stock { font-size: 10px; font-weight: 800; color: var(--muted); }
.gd .pr { display: flex; align-items: center; gap: 4px; margin-top: 2px; font-size: 14.5px; font-weight: 900; }
.gd .pr .coin { font-size: 13px; }
.gd .chg { font-size: 9.5px; padding: 1px 5px; margin-left: auto; }
.gd .spark { width: 100%; height: 20px; margin-top: 2px; }
.gd.jump-up { box-shadow: 0 0 0 2px rgba(31, 165, 106, .55); transform: translateY(-1px); }
.gd.jump-down { box-shadow: 0 0 0 2px rgba(224, 74, 122, .55); transform: translateY(-1px); }

/* top agents */
.ranks { position: relative; padding: 2px 6px 8px; }
.rk { position: relative; display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: transparent; padding: 5px 7px; border-radius: 10px; cursor: pointer; text-align: left; font-weight: 800; font-size: 12.5px; transition: background .2s; }
.rk.pnl { padding: 5px 7px 7px; }
.rk:hover { background: rgba(255, 255, 255, .85); }
.rk.sel { background: var(--lav-bg); }
.rk .pos { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; font-weight: 900; color: var(--muted); background: rgba(124, 108, 240, .1); flex: none; }
.rk:nth-child(1) .pos { background: linear-gradient(135deg, #ffe17a, #f7b23b); color: #6e4300; }
.rk:nth-child(2) .pos { background: linear-gradient(135deg, #eef1f8, #c5cde0); color: #3f4862; }
.rk:nth-child(3) .pos { background: linear-gradient(135deg, #ffd3b0, #e69a6a); color: #60320e; }
.av { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 900; color: #fff; flex: none; position: relative; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .08), 0 1px 4px -1px rgba(76, 58, 140, .4); text-shadow: 0 1px 1px rgba(0, 0, 0, .2); }
.av .jb { position: absolute; right: -5px; bottom: -4px; width: 15px; height: 15px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 9px; box-shadow: 0 1px 3px rgba(76, 58, 140, .3); text-shadow: none; }
.rk-main { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.rk .nm { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rk-sub { display: flex; align-items: center; gap: 5px; min-width: 0; font-size: 10px; font-weight: 800; color: var(--muted); }
.rk-sub:empty { display: none; }
.rk-nw { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
.rk-nw .coin { font-size: 10px; }
.rk-v { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; flex: none; }
.rk-v .v { display: inline-flex; align-items: center; gap: 3px; font-weight: 900; color: var(--gold); }
.rk-v .coin { font-size: 13px; }
.rk-v .v.up, .wr .pl.up { color: var(--up); } .rk-v .v.down, .wr .pl.down { color: var(--down); } .rk-v .v.flat, .wr .pl.flat { color: var(--ink-2); }
.rk-v .p24 { font-size: 10px; font-weight: 900; }
.rk-v .p24:empty { display: none; }
.rk-v .p24.up { color: var(--up); } .rk-v .p24.down { color: var(--down); } .rk-v .p24.flat { color: var(--muted); }
.rk-bar { position: absolute; left: 65px; right: 9px; bottom: 2px; height: 2px; border-radius: 2px; background: rgba(124, 108, 240, .08); overflow: hidden; }
.rk:not(.pnl) .rk-bar { display: none; }
.rk-bar > i { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 2px; transition: width .8s var(--ease-out); }
.rk-bar > i.up { background: linear-gradient(90deg, #8fe3c8, #1fa56a); } .rk-bar > i.down { background: linear-gradient(90deg, #ffb3cb, #e04a7a); } .rk-bar > i.flat, .rk-bar > i.gold { background: #ffcf5e; }

/* strategy badges (agents) */
.strat { flex: none; font-size: 8.5px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; padding: 1px 6px; border-radius: 999px; background: var(--lav-bg); color: #5a49d6; line-height: 1.5; }
.strat[hidden] { display: none; }
.strat.trader { background: #fff1c9; color: #7a4f00; } .strat.builder { background: #ffe6d6; color: #923f14; } .strat.saver { background: #dcf7e9; color: #12603f; }
.strat.hustler { background: #ffe2ec; color: #a22552; } .strat.homebody { background: #e5f2ff; color: #255f98; }

/* ---------------- agents: live decision log (drawer tab) ---------------- */
.ag-h { display: inline-flex; align-items: center; gap: 5px; }
.ag-dot { width: 6px; height: 6px; border-radius: 50%; background: #22b573; animation: livePulseG 1.8s infinite; }
@keyframes livePulseG { 0% { box-shadow: 0 0 0 0 rgba(34, 181, 115, .5); } 70% { box-shadow: 0 0 0 5px rgba(34, 181, 115, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 181, 115, 0); } }
.ag-rate { letter-spacing: .04em; }
.ag-rate b { color: var(--lav-ink); font-weight: 900; font-size: 11px; letter-spacing: 0; }
.ag-new { position: sticky; top: 4px; z-index: 2; display: flex; align-items: center; gap: 4px; margin: 2px auto -24px; height: 22px; padding: 0 10px 0 7px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--lav); color: #fff; font-size: 10.5px; font-weight: 900; box-shadow: 0 4px 10px -4px rgba(124, 108, 240, .9); animation: popIn .25s var(--ease-out); }
.ag-new[hidden] { display: none; }
.ag-new .ico { width: 12px; height: 12px; transform: rotate(180deg); }
.term { margin: 4px 8px 8px; padding: 3px; border-radius: 12px; background: rgba(44, 39, 72, .035); box-shadow: inset 0 0 0 1px var(--line); }
.term .empty { font-family: var(--mono); font-size: 11px; font-weight: 500; }
.term .empty::before { content: '› '; color: var(--lav); }
.dc { position: relative; display: flex; flex-direction: column; gap: 1px; width: 100%; border: 0; background: transparent; padding: 5px 7px 6px 8px; border-radius: 9px; cursor: pointer; text-align: left; color: var(--ink); transition: background .2s; animation: dcIn .42s var(--spring) both; }
.dc + .dc::before { content: ''; position: absolute; left: 8px; right: 8px; top: 0; border-top: 1px dashed rgba(98, 84, 160, .14); }
.dc:hover { background: rgba(255, 255, 255, .9); }
.dc:hover::before, .dc:hover + .dc::before { opacity: 0; }
@keyframes dcIn { from { opacity: 0; transform: translateY(-6px); } }
.dc.fresh::after { content: ''; position: absolute; left: 1px; top: 7px; bottom: 7px; width: 3px; border-radius: 3px; background: var(--k, var(--lav)); animation: fadeBar 2.4s forwards; }
.dc-hd { display: flex; align-items: center; gap: 5px; min-width: 0; font-size: 11px; line-height: 16px; }
.dc-tag { flex: none; font-family: var(--mono); font-size: 8.5px; font-weight: 700; letter-spacing: .04em; padding: 0 5px; border-radius: 5px; line-height: 15px; color: var(--k-ink, #5a49d6); background: var(--k-bg, var(--lav-bg)); }
.dc-nm { font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.dc-ad { flex: none; font-family: var(--mono); font-size: 9.5px; color: var(--muted); opacity: .85; }
.dc-t { margin-left: auto; flex: none; font-size: 9.5px; font-weight: 800; color: var(--muted); }
.dc-act { font-family: var(--mono); font-size: 11.5px; font-weight: 600; line-height: 1.35; color: var(--ink); overflow-wrap: anywhere; }
.dc-act::before { content: '› '; color: var(--k, var(--lav)); font-weight: 700; }
.dc-why { font-size: 11px; font-weight: 700; line-height: 1.3; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
/* kind colours: tag ink/bg + accent (prompt glyph, fresh bar) */
.k-buy { --k: #1fa56a; --k-ink: var(--up); --k-bg: var(--up-bg); }
.k-sell { --k: #e04a7a; --k-ink: var(--down); --k-bg: var(--down-bg); }
.k-switch { --k: #7c6cf0; --k-ink: var(--lav-ink); --k-bg: var(--lav-bg); }
.k-build { --k: #e8930c; --k-ink: var(--gold); --k-bg: var(--gold-bg); }
.k-hire { --k: #3f8fd6; --k-ink: #255f98; --k-bg: #e2f0ff; }
.k-save { --k: #1fb0a0; --k-ink: #0f6b62; --k-bg: #d6f6f1; }
.k-spend { --k: #f07a3a; --k-ink: #923f14; --k-bg: #ffe6d6; }
.k-move { --k: #8a90b0; --k-ink: #4d5370; --k-bg: #eceef6; }
.k-bankrupt { --k: #d92d5c; --k-ink: #fff; --k-bg: linear-gradient(135deg, #ff5d8c, #e0336b); }
.k-vote { --k: #a35fe0; --k-ink: #6b2fa8; --k-bg: #f1e4ff; }
.k-other { --k: #a594ff; --k-ink: var(--muted); --k-bg: #f0eef8; }
.dc.k-bankrupt { background: rgba(255, 226, 236, .55); }

/* state root chip (pulse panel + agents tab) */
.root { display: flex; align-items: center; gap: 5px; max-width: 100%; border: 0; background: transparent; cursor: copy; padding: 2px 6px 2px 4px; border-radius: 999px; font-size: 10px; font-weight: 800; color: var(--muted); transition: background .2s, color .2s; }
.root[hidden] { display: none; }
.root:hover { background: rgba(255, 255, 255, .85); color: var(--ink); }
.root > .ico { width: 11px; height: 11px; color: var(--lav); flex: none; }
.root .rl { white-space: nowrap; }
.root .rl b { font-weight: 900; color: var(--ink-2); }
.root code { font-family: var(--mono); font-size: 10px; font-weight: 600; color: var(--lav-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.rc { position: relative; width: 11px; height: 11px; flex: none; }
.rc .ico { position: absolute; inset: 0; width: 11px; height: 11px; transition: opacity .2s, transform .25s var(--spring); }
.rc .ico:last-child { opacity: 0; transform: scale(.4); color: var(--up); }
.ok .rc .ico:first-child { opacity: 0; transform: scale(.4); }
.ok .rc .ico:last-child { opacity: 1; transform: none; }
.pulse .root { margin: 5px -2px -3px; }
#agRoot { margin: 0 8px 0 7px; }

/* ---------------- cards (compact, bottom-right) ---------------- */
.card { z-index: 5; right: calc(var(--gap) + var(--safe-r)); bottom: calc(var(--gap) + var(--safe-b)); width: 252px; padding: 10px; background: var(--glass-strong); border-radius: 14px; transform-origin: bottom right; animation: cardIn .4s var(--spring); }
.card[hidden] { display: none; }
#ui.dr-open .card { right: calc(var(--gap) + var(--safe-r) + var(--drawer-w) + 8px); bottom: calc(var(--gap) + var(--safe-b) + 40px); }
@keyframes cardIn { from { opacity: 0; transform: translateY(12px) scale(.95); } to { opacity: 1; transform: none; } }
.card .x { position: absolute; right: 6px; top: 6px; }
.cd-head { display: flex; align-items: center; gap: 9px; padding-right: 22px; }
.cd-head .av { width: 34px; height: 34px; font-size: 14px; }
.cd-head .av .jb { width: 17px; height: 17px; font-size: 10px; right: -4px; bottom: -3px; }
.cd-name { font-size: 14.5px; font-weight: 900; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cd-sub { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; margin-top: 2px; font-size: 11px; font-weight: 800; color: var(--ink-2); }
.trait { font-size: 9px; font-weight: 900; letter-spacing: .05em; text-transform: uppercase; padding: 1px 6px; border-radius: 999px; background: var(--lav-bg); color: #5a49d6; }
.trait[hidden] { display: none; }
.trait.greedy { background: #fff1c9; color: #7a4f00; } .trait.lazy { background: #e5f2ff; color: #255f98; } .trait.social { background: #ffe2ec; color: #a22552; } .trait.ambitious { background: #ffe6d6; color: #923f14; } .trait.thrifty { background: #dcf7e9; color: #12603f; }
.mood { margin-left: auto; font-size: 20px; line-height: 1; animation: moodBob 2.4s ease-in-out infinite; }
@keyframes moodBob { 50% { transform: translateY(-2px) rotate(-6deg); } }
.cd-money { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-top: 8px; }
.cd-money > div { background: rgba(255, 255, 255, .78); border-radius: 10px; padding: 4px 8px; }
.cd-money small { display: block; font-size: 9px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.cd-money b { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 900; }
.cd-money b .ico { width: 14px; height: 14px; color: var(--lav); }
.cd-bars { display: grid; gap: 4px; margin-top: 7px; }
.cd-bar { display: grid; grid-template-columns: 44px 1fr 26px; align-items: center; gap: 6px; font-size: 10.5px; font-weight: 800; color: var(--ink-2); }
.cd-bar .bar { height: 6px; }
.cd-bar.food .bar > i { background: linear-gradient(90deg, #ffb48a, #ffd36e); }
.cd-bar.energy .bar > i { background: linear-gradient(90deg, #8cc8ff, #a594ff); }
.cd-bar.low .bar > i { background: linear-gradient(90deg, #ff6f9b, #ff9a7a); }
.cd-bar span:last-child { text-align: right; font-weight: 900; }
.cd-doing { display: flex; align-items: center; gap: 6px; margin-top: 7px; padding: 5px 8px; border-radius: 10px; background: rgba(236, 232, 255, .75); font-size: 11.5px; font-weight: 800; }
.cd-doing .dots i { display: inline-block; width: 3px; height: 3px; margin-left: 2px; border-radius: 50%; background: var(--lav); animation: dots 1.2s infinite; }
.cd-doing .dots i:nth-child(2) { animation-delay: .15s; } .cd-doing .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dots { 0%, 60%, 100% { opacity: .25; transform: none; } 30% { opacity: 1; transform: translateY(-2px); } }
.cd-doing .tx { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cd-hist { margin-top: 6px; display: flex; align-items: center; gap: 8px; font-size: 10.5px; font-weight: 800; }
.cd-hist .spark { flex: 1; height: 20px; }
.cd-hist small { font-size: 9px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.cd-home { display: inline-flex; align-items: center; gap: 3px; }
.cd-home .ico { width: 13px; height: 13px; color: var(--lav); }
.cd-actions { display: flex; gap: 6px; margin-top: 8px; }
.btn { flex: 1; border: 0; cursor: pointer; height: 30px; border-radius: 10px; font-weight: 900; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; background: rgba(124, 108, 240, .13); color: var(--lav-ink); transition: transform .2s var(--spring), background .2s; }
.btn:hover { background: rgba(124, 108, 240, .22); }
.btn:active { transform: scale(.95); }
.btn[hidden] { display: none; }
.btn.primary { background: linear-gradient(135deg, #7d68ff, #a77cff); color: #fff; box-shadow: 0 4px 10px -5px rgba(124, 108, 240, .9); }
.btn .ico { width: 14px; height: 14px; }
.bd-status { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 900; padding: 1px 7px; border-radius: 999px; background: #eef0f6; color: var(--muted); }
.bd-status i { width: 6px; height: 6px; border-radius: 50%; background: #b9bfd3; }
.bd-status.on { background: var(--up-bg); color: var(--up); }
.bd-status.on i { background: #22b573; animation: livePulse 1.6s infinite; }
.lvl { display: inline-flex; gap: 3px; }
.lvl i { width: 7px; height: 7px; border-radius: 2px; background: rgba(124, 108, 240, .2); transform: rotate(45deg); }
.lvl i.on { background: linear-gradient(135deg, #ffd36e, #ff9cc2); }
/* agent card */
.cd-nr { display: flex; align-items: center; gap: 6px; min-width: 0; }
.cd-nr .cd-name { min-width: 0; }
.addr { display: inline-flex; align-items: center; gap: 4px; border: 0; cursor: copy; height: 17px; padding: 0 6px; border-radius: 999px; background: rgba(124, 108, 240, .1); color: var(--lav-ink); transition: background .2s; }
.addr[hidden] { display: none; }
.addr:hover { background: rgba(124, 108, 240, .2); }
.addr code { font-family: var(--mono); font-size: 9.5px; font-weight: 600; }
.card.agent .cd-money { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 1fr; }
.card.agent .cd-money > div { padding: 4px 7px; min-width: 0; }
.card.agent .cd-money > div[hidden] { display: none; }
.card.agent .cd-money b { font-size: 13.5px; white-space: nowrap; }
.card.agent .cd-money small { white-space: nowrap; letter-spacing: .02em; font-size: 8.5px; overflow: hidden; text-overflow: ellipsis; }
.dr-tabs [data-tab] .fbadge { position: absolute; top: -3px; right: -4px; }
.dc-act:empty { display: none; }
.cd-money .up { color: var(--up); } .cd-money .down { color: var(--down); } .cd-money .flat { color: var(--ink-2); }
.cd-thought { position: relative; margin-top: 7px; padding: 5px 8px; border-radius: 10px; background: rgba(236, 232, 255, .75); font-size: 11.5px; font-weight: 800; line-height: 1.32; color: var(--ink-2); }
.cd-thought .tx { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cd-thought.q { padding-left: 22px; font-weight: 700; color: var(--ink); background: rgba(255, 255, 255, .78); box-shadow: inset 2px 0 0 var(--lav); }
.cd-thought.q::before { content: '“'; position: absolute; left: 7px; top: 1px; font: 900 22px/1 Georgia, serif; color: var(--lav); opacity: .7; }
.cd-decs { margin-top: 7px; }
.cd-decs[hidden] { display: none; }
.cd-decs small { display: block; margin: 0 1px 3px; font-size: 9px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.cd-decs .list { display: grid; gap: 2px; }
.cdd { display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 6px; padding: 2px 0; font-size: 11px; line-height: 1.3; min-width: 0; }
.cdd .dc-tag { justify-self: start; }
.cdd .a { font-family: var(--mono); font-size: 10.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cdd .w { grid-column: 2; font-size: 10px; font-weight: 700; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cdd + .cdd .w { display: none; }   /* only the newest keeps its reason on the card; the rest show it on hover */
.sp-do.is-thought { font-weight: 700; color: var(--ink); font-style: italic; }
.bd-icon { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; font-size: 18px; background: linear-gradient(135deg, #fff3cf, #ffe2ec); flex: none; }

/* ---------------- milestone: compact banner under the bar ---------------- */
#milestone { position: fixed; left: 50%; top: calc(var(--gap) + var(--safe-t) + var(--bar-h) + 8px); z-index: 8; transform: translate(-50%, -12px) scale(.96); pointer-events: none; width: max-content; max-width: min(400px, calc(100vw - 24px)); transition: transform .5s var(--spring), opacity .35s; opacity: 0; }
#milestone.show { transform: translate(-50%, 0); opacity: 1; }
.ms { position: relative; display: flex; align-items: center; gap: 10px; padding: 7px 14px 7px 7px; border-radius: 999px; overflow: hidden;
  background: linear-gradient(120deg, #fff6d8 0%, #ffe3ef 50%, #e9e4ff 100%); box-shadow: 0 10px 26px -10px rgba(124, 80, 160, .6), inset 0 0 0 1.5px rgba(255, 255, 255, .9); }
.ms::before { content: ''; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, .85) 48%, transparent 66%); background-size: 250% 100%; animation: sweep 2s .25s ease-in-out; }
@keyframes sweep { from { background-position: 160% 0; } to { background-position: -60% 0; } }
.ms .mi { position: relative; width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 19px; background: #fff; box-shadow: 0 3px 10px -4px rgba(124, 80, 160, .55); animation: msIcon .8s var(--spring) .1s both; }
@keyframes msIcon { from { transform: scale(0) rotate(-30deg); } to { transform: none; } }
.ms .mtx { position: relative; min-width: 0; }
.ms .mk { font-size: 9px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; color: #a63a70; }
.ms .mt { font-size: 14.5px; font-weight: 900; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms .mt2 { font-size: 11px; font-weight: 700; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms .conf { position: absolute; width: 5px; height: 8px; border-radius: 2px; top: -10px; animation: conf 1.6s ease-in forwards; }
@keyframes conf { to { transform: translate(var(--dx), 80px) rotate(var(--r)); opacity: 0; } }

/* ---------------- follow chip + caption + toast ---------------- */
#chip { position: fixed; left: 50%; top: calc(var(--gap) + var(--safe-t) + var(--bar-h) + 8px); transform: translateX(-50%); z-index: 6; display: flex; align-items: center; gap: 6px; padding: 3px 4px 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; animation: chipIn .35s var(--spring); }
#chip[hidden] { display: none; }
#chip .ico { width: 14px; height: 14px; color: var(--lav); }
#chip .iconbtn { width: 22px; height: 22px; border-radius: 50%; background: rgba(124, 108, 240, .12); }
@keyframes chipIn { from { opacity: 0; transform: translate(-50%, -6px) scale(.92); } }
#caption { position: fixed; left: 50%; bottom: calc(var(--gap) + var(--safe-b) + 42px); transform: translate(-50%, 8px); z-index: 2; pointer-events: none; opacity: 0; transition: opacity .5s, transform .5s var(--ease-out);
  display: flex; align-items: center; gap: 7px; padding: 4px 11px 4px 5px; border-radius: 999px; background: rgba(44, 39, 72, .66); color: #fff; font-size: 12px; font-weight: 800; white-space: nowrap; max-width: min(520px, calc(100vw - 32px)); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
#caption.show { opacity: 1; transform: translate(-50%, 0); }
#caption .tag { font-size: 8.5px; font-weight: 900; letter-spacing: .12em; background: #ff4f86; padding: 2px 6px; border-radius: 999px; }
#caption .tx { overflow: hidden; text-overflow: ellipsis; }
#toast { position: fixed; left: 50%; bottom: calc(var(--gap) + var(--safe-b) + 42px); transform: translate(-50%, 6px); z-index: 7; opacity: 0; transition: opacity .3s, transform .4s var(--spring); pointer-events: none;
  padding: 6px 12px; border-radius: 999px; background: rgba(44, 39, 72, .82); color: #fff; font-size: 12px; font-weight: 800; white-space: nowrap; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast kbd { font: inherit; background: rgba(255, 255, 255, .2); border-radius: 6px; padding: 0 5px; }

/* ---------------- intro ---------------- */
#intro { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 24px; pointer-events: auto;
  background: radial-gradient(120% 90% at 50% 30%, rgba(255, 255, 255, .55), rgba(255, 228, 240, .55) 50%, rgba(196, 226, 255, .7));
  -webkit-backdrop-filter: blur(8px) saturate(1.3); backdrop-filter: blur(8px) saturate(1.3); transition: opacity .7s, visibility .7s; }
#intro.gone { opacity: 0; visibility: hidden; }
.intro-card { text-align: center; max-width: 520px; animation: introIn 1s var(--ease-out) both; }
@keyframes introIn { from { opacity: 0; transform: translateY(18px); } }
.intro-hero { position: relative; width: 190px; height: 190px; margin: -10px auto 6px; }
.intro-hero img { position: relative; z-index: 1; width: 100%; height: 100%; display: block; user-select: none; transform-origin: 50% 92%;
  filter: drop-shadow(0 10px 14px rgba(170, 110, 20, .3)); animation: heroBob 2.6s ease-in-out infinite; }
.intro-hero .shadow { position: absolute; left: 22%; right: 22%; bottom: 2px; height: 14px; border-radius: 50%; background: rgba(90, 60, 120, .18); filter: blur(4px); animation: heroShadow 2.6s ease-in-out infinite; }
@keyframes heroBob { 0%, 100% { transform: translateY(0) scale(1.03, .97); } 45% { transform: translateY(-12px) scale(.98, 1.03); } 60% { transform: translateY(-12px) scale(.99, 1.01); } }
@keyframes heroShadow { 0%, 100% { transform: scaleX(1); opacity: 1; } 50% { transform: scaleX(.8); opacity: .6; } }
@media (prefers-reduced-motion: reduce) { .intro-hero img, .intro-hero .shadow { animation: none; } }
.intro-card h1 { margin: 0; font-family: 'DynaPuff', 'Nunito', sans-serif; font-size: clamp(44px, 9vw, 72px); font-weight: 700; letter-spacing: 0; line-height: 1; color: var(--ink);
  background: linear-gradient(120deg, #3b2f86 10%, #7c55e6 45%, #e2508a 80%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; padding-bottom: 6px; }
.intro-card p.tag { margin: 10px 0 0; font-size: clamp(17px, 3.6vw, 21px); font-weight: 800; color: var(--ink-2); }
.intro-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 18px 0 26px; }
.intro-chips span { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 800; color: var(--ink-2); background: rgba(255, 255, 255, .75); padding: 6px 12px; border-radius: 999px; box-shadow: 0 4px 12px -6px rgba(76, 58, 140, .35); }
.intro-chips .coin { font-size: 16px; }
.intro-chips .ico { width: 15px; height: 15px; color: var(--lav); }
#watch { position: relative; overflow: hidden; border: 0; cursor: pointer; height: 60px; padding: 0 34px 0 26px; border-radius: 999px; font: 900 20px 'Nunito', system-ui, sans-serif; color: #fff;
  background: linear-gradient(135deg, #7d68ff, #b07cff 55%, #ff86b2); box-shadow: 0 16px 30px -12px rgba(124, 90, 240, .85), inset 0 -3px 0 rgba(0, 0, 0, .1); display: inline-flex; align-items: center; gap: 12px; transition: transform .25s var(--spring), box-shadow .25s, filter .2s; }
#watch:hover:not(:disabled) { transform: translateY(-2px) scale(1.03); box-shadow: 0 22px 36px -14px rgba(124, 90, 240, .9); }
#watch:active:not(:disabled) { transform: scale(.96); }
#watch::after { content: ''; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .45) 50%, transparent 70%); background-size: 250% 100%; animation: sweep 2.8s 1s infinite; }
#watch:disabled { cursor: progress; filter: saturate(.55) brightness(1.05); }
#watch .play { width: 30px; height: 30px; border-radius: 50%; background: rgba(255, 255, 255, .25); display: grid; place-items: center; }
#watch .play svg { width: 14px; height: 14px; fill: #fff; margin-left: 2px; }
#watch .spin { display: none; width: 18px; height: 18px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .35); border-top-color: #fff; animation: rot 0.8s linear infinite; }
#watch:disabled .spin { display: block; }
#watch:disabled .play { display: none; }
@keyframes rot { to { transform: rotate(360deg); } }
.intro-hint { margin-top: 16px; font-size: 12px; font-weight: 700; color: var(--muted); }

/* ---------------- left column: pulse · top whales · spotlight (desktop only) ---------------- */
#col { position: fixed; z-index: 3; left: calc(var(--gap) + var(--safe-l)); top: calc(var(--gap) + var(--safe-t) + var(--bar-h) + 8px); width: 228px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; pointer-events: none; }
.col-tg { pointer-events: auto; display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px 0 5px; border: 1px solid var(--edge); border-radius: 999px; cursor: pointer; font-size: 9.5px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  background: var(--glass); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); box-shadow: var(--shadow); transition: background .2s, color .2s; }
.col-tg:hover { background: #fff; color: var(--ink); }
.col-tg .ico { width: 12px; height: 12px; transition: transform .25s var(--ease-out); }
#col.collapsed .col-tg .ico { transform: rotate(-90deg); }
#col.collapsed .col-body { display: none; }
.col-body { display: flex; flex-direction: column; gap: 6px; width: 100%; animation: popIn .3s var(--ease-out); }
.cc { pointer-events: auto; width: 100%; padding: 7px 8px 8px; border-radius: 13px; background: var(--glass); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border: 1px solid var(--edge); box-shadow: var(--shadow); }
.cc-h { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin: 0 1px 4px; font-size: 9.5px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.cc-h > span { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.cc-h .ico { width: 12px; height: 12px; color: var(--lav); }
.cc-more { border: 0; background: transparent; cursor: pointer; font-size: 10px; font-weight: 900; color: var(--lav-ink); padding: 1px 5px; border-radius: 999px; letter-spacing: 0; text-transform: none; }
.cc-more:hover { background: var(--lav-bg); }

/* pulse */
.pl-top { display: flex; align-items: center; gap: 8px; }
.ring { --p: 0; position: relative; width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(#a594ff 0, #ff9cc2 calc(var(--p) * .6%), #ffcf5e calc(var(--p) * 1%), rgba(124, 108, 240, .16) 0); }
.ring::before { content: ''; position: absolute; inset: 3.5px; border-radius: 50%; background: #fff; }
.ring span { position: relative; font-size: 9.5px; font-weight: 900; color: var(--lav-ink); }
.pl-tx { min-width: 0; flex: 1; }
.pl-era { display: flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 900; white-space: nowrap; }
.pl-era b { overflow: hidden; text-overflow: ellipsis; }
.pl-next { margin-top: 1px; font-size: 10.5px; font-weight: 800; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-proj { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 2px 6px; margin-top: 7px; padding: 5px 7px 6px; border-radius: 10px; background: rgba(255, 243, 207, .85); font-size: 11px; font-weight: 800; color: var(--ink-2); }
.pl-proj.goal { background: rgba(236, 232, 255, .8); }
.pl-ic { font-size: 13px; line-height: 1; }
.pl-lbl { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-pc { font-weight: 900; color: var(--gold); font-size: 10.5px; }
.pl-proj.goal .pl-pc { color: var(--lav-ink); }
.pl-proj .bar { grid-column: 1 / -1; height: 4px; }
.pl-proj:not(.goal) .bar > i { background: linear-gradient(90deg, #ffcf5e, #ff9f6e); }

/* top whales */
.wh-list { display: flex; flex-direction: column; gap: 1px; }
.wh-list .empty { padding: 4px 2px; font-size: 11px; }
.wr { display: flex; align-items: center; gap: 7px; width: 100%; border: 0; background: transparent; padding: 3px 4px; border-radius: 9px; cursor: pointer; text-align: left; font-size: 12px; font-weight: 800; transition: background .2s; }
.wr:hover { background: rgba(255, 255, 255, .85); }
.wr.sel { background: var(--lav-bg); }
.wr .pos { width: 15px; flex: none; font-size: 10px; font-weight: 900; color: var(--muted); text-align: center; }
.wr:nth-child(1) .pos { color: #c48a00; }
.wr .av { width: 22px; height: 22px; font-size: 10px; }
.wr .av .jb { width: 13px; height: 13px; font-size: 8px; right: -4px; bottom: -3px; }
.wr .nm { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wr .nw { display: inline-flex; align-items: center; gap: 3px; font-weight: 900; color: var(--gold); }
.wr .nw .coin { font-size: 12px; }

/* spotlight */
.sp-why { color: #b0457a; }
.sp-t { position: relative; width: 38px; height: 3px; border-radius: 3px; background: rgba(124, 108, 240, .16); overflow: hidden; }
.sp-t i { position: absolute; inset: 0; transform-origin: left; background: linear-gradient(90deg, #ff9cc2, #a594ff); animation: spT 20s linear forwards; }
@keyframes spT { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.spot.paused .sp-t i { animation-play-state: paused; }
.sp-body { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: rgba(255, 255, 255, .6); padding: 6px 7px; border-radius: 10px; cursor: pointer; text-align: left; transition: background .2s, transform .2s var(--spring); }
.sp-body:hover { background: #fff; }
.sp-body:active { transform: scale(.97); }
.sp-av { width: 32px; height: 32px; flex: none; border-radius: 50%; display: grid; place-items: center; position: relative; font-size: 13px; font-weight: 900; color: #fff; text-shadow: 0 1px 1px rgba(0, 0, 0, .2); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .08), 0 0 0 2px #fff, 0 2px 8px -2px rgba(176, 69, 122, .55); }
.sp-av .jb { position: absolute; right: -5px; bottom: -4px; width: 16px; height: 16px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 9.5px; box-shadow: 0 1px 3px rgba(76, 58, 140, .3); text-shadow: none; }
.sp-main { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.sp-name { font-size: 12.5px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-job { font-size: 10px; font-weight: 800; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-do { margin-top: 1px; font-size: 11px; font-weight: 700; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sp-side { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: none; }
.sp-mood { font-size: 16px; line-height: 1; }
.sp-coins { display: inline-flex; align-items: center; gap: 2px; font-size: 11px; font-weight: 900; color: var(--gold); }
.sp-coins .coin { font-size: 11px; }
/* short screens: keep the toasts clear of the column */
@media (max-height: 780px) { .pl-next { display: none; } .wr:nth-child(3) { display: none; } }
@media (max-height: 640px) { .spot { display: none; } }
@media (max-width: 860px) { #col { display: none; } }

/* ---------------- narrower desktops ---------------- */
@media (max-width: 1320px) { .brand b { display: none; } .era-name { max-width: 120px; } }
@media (max-width: 1080px) { .st.gdp, .ix-sp { display: none; } #tape { max-width: calc(100vw - 2 * 300px); } #ticker { width: 260px; } }
@media (min-width: 861px) and (max-width: 980px) { .clock, .sep.cl { display: none; } }

/* ---------------- phones: essentials bar + bottom sheet ---------------- */
@media (max-width: 860px) {
  :root { --gap: 8px; --bar-h: 36px; --sheet-h: 56px; }
  #top { gap: 6px; }
  #bar { flex: 1; gap: 5px; padding: 5px 8px 0 5px; overflow: hidden; flex-wrap: wrap; row-gap: 24px; align-content: flex-start; } /* items that do not fit wrap onto a hidden 2nd line instead of being half-clipped */
  .brand, .live .lt, .era-name, .era-pct, .sep, .ix-sp, .ix .symt, .st.gdp, .clock { display: none; }
  .live { padding: 0; width: 14px; height: 14px; justify-content: center; background: transparent; margin-left: 2px; }
  .era-chip { height: 24px; padding: 0 7px 0 3px; gap: 4px; flex: none; }
  .era-line { left: 6px; right: 6px; }
  .season { display: none !important; }
  .ix { gap: 4px; }
  .ix .sym { padding: 1px; }
  .ix-val { font-size: 14px; min-width: 0; letter-spacing: -.02em; }
  .chg { font-size: 10px; padding: 1px 5px; }
  .st { font-size: 12px; gap: 3px; }
  #toolbar { padding: 0 3px; gap: 2px; }
  #speed, .sp-sep, .drbtns, .drbtns + .vsep { display: none; }
  .tbtn { height: 30px; min-width: 30px; padding: 0 6px; }
  .viewers { height: 24px; padding: 0 6px 0 5px; gap: 3px; }
  .viewers .ico { width: 12px; height: 12px; }
  #toolbar .vsep { display: none; }
  .viewers .vl { display: none; }
  #ticker, #tape { display: none; }

  #drawer { left: calc(var(--gap) + var(--safe-l)); right: calc(var(--gap) + var(--safe-r)); top: auto; bottom: calc(var(--gap) + var(--safe-b)); width: auto; max-width: 560px; margin: 0 auto;
    height: auto; max-height: var(--sheet-h); transform: none; visibility: visible; border-radius: 18px; transition: max-height .35s var(--ease-out); }
  #drawer.open { max-height: min(62vh, 520px); max-height: min(62dvh, 520px); transition: max-height .35s var(--ease-out); }
  .dr-handle { display: flex; align-items: center; gap: 8px; position: relative; flex: none; height: 54px; width: 100%; padding: 8px 10px 4px 8px; border: 0; background: transparent; cursor: pointer; text-align: left; }
  .dr-handle .grip { position: absolute; left: 50%; top: 5px; width: 34px; height: 4px; margin-left: -17px; border-radius: 99px; background: rgba(98, 84, 160, .28); }
  .dr-latest { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; line-height: 1.25; color: var(--ink); }
  .dr-latest .bi { width: 28px; height: 28px; flex: none; border-radius: 9px; display: grid; place-items: center; font-size: 15px; background: #f1eefe; }
  .dr-latest .bi .ico { width: 14px; height: 14px; color: var(--lav); }
  .dr-latest .m { min-width: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .dr-latest b, .dr-latest strong { font-weight: 900; }
  .dr-chev { display: grid; place-items: center; width: 24px; height: 24px; color: var(--muted); transform: rotate(180deg); transition: transform .3s var(--ease-out); }
  .dr-chev .ico { width: 15px; height: 15px; }
  #drawer.open .dr-chev { transform: none; }
  #drawer.open .dr-handle { height: 40px; }
  #drawer.open .dr-latest { visibility: hidden; }
  #drawer.open .dr-handle .fbadge { display: none; }
  #drawer:not(.open) .dr-tabs, #drawer:not(.open) .dr-body { display: none; }
  .dr-tabs { padding: 0 6px 5px; }
  .dr-tabs [data-tab] { flex: 1; justify-content: center; height: 30px; padding: 0 6px; }
  .dr-tabs .sp, .dr-x { display: none; }
  .spm { display: inline-flex; background: rgba(124, 108, 240, .12); color: var(--lav-ink); min-width: 38px; height: 28px; font-size: 11.5px; }
  .goods { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }

  .card { left: calc(var(--gap) + var(--safe-l)); right: calc(var(--gap) + var(--safe-r)); width: auto; max-width: 420px; margin: 0 auto; bottom: calc(var(--gap) * 2 + var(--safe-b) + var(--sheet-h)); transform-origin: bottom center; max-height: 60vh; overflow-y: auto; }
  #ui.dr-open .card { right: calc(var(--gap) + var(--safe-r)); bottom: calc(var(--gap) * 2 + var(--safe-b) + var(--sheet-h)); z-index: 6; }
  #caption, #toast { bottom: calc(var(--gap) * 2 + var(--safe-b) + var(--sheet-h)); max-width: calc(100vw - 32px); }
  #ui.carded #caption { opacity: 0; }
  #ui.dr-open #caption { opacity: 0; }
  #milestone { max-width: calc(100vw - 16px); }
  .ms .mt { font-size: 13.5px; }
}
@media (max-width: 360px) { .st.tre { display: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* hide market price tags when zoomed out (toggled by main.js) */
/* market price tags (CSS2D labels from buildings.js), hidden when zoomed out (main.js toggles #labels.far) */
#labels .price { display: flex; align-items: center; gap: 3px; padding: 2px 7px 2px 4px; border-radius: 999px;
  background: #fffffff0; box-shadow: 0 2px 8px #7f6b9333; font: 900 11px Nunito, system-ui, sans-serif; color: #6b5b7b;
  white-space: nowrap; pointer-events: none; transition: opacity .35s; } /* never transition transform: CSS2DRenderer sets it every frame */
#labels .price .ico { font-size: 12px; }
#labels .price .arr { font-size: 8px; opacity: .7; }
#labels .price.up .arr { color: #2fb36b; opacity: 1; }
#labels .price.down .arr { color: #ef5f7f; opacity: 1; }
#labels .price.hot { animation: pricehot 1.6s ease-out; }
@keyframes pricehot { 0% { background: #ffd36e; } 100% { background: #fffffff0; } }
#labels.far .price { opacity: 0; }

/* ---------- Motu, the mascot (src/mascot.js) ----------
   Layers: .m-rig (entry / tuck) > .m-jump (hops, hover) > .m-body (breath) > .m-talk (talk jiggle) > .m-flip (turn squash) > sprites.
   Every layer animates transform/opacity only. The stage clips at the ground line so a tucked Motu peeks over it. */
#mascot { --m: 112px; --m-floor: calc(var(--gap) + var(--safe-b));
  position: fixed; z-index: 5; right: calc(var(--gap) + var(--safe-r) - 4px); bottom: 0; width: var(--m); pointer-events: none;
  opacity: 0; transition: opacity .45s, transform .45s var(--ease-out); }
#mascot.in { opacity: 1; }
#ui.carded #mascot { opacity: 0; transform: translateY(20px); }
#ui.carded #mascot * { pointer-events: none !important; }
.m-stage { position: relative; width: var(--m); height: calc(var(--m) + var(--m-floor)); clip-path: inset(-600px -600px 0 -600px); pointer-events: none; }
.m-rig { position: absolute; left: 0; right: 0; bottom: var(--m-floor); height: var(--m); transform-origin: 50% 100%; transition: transform .55s var(--spring); }
#mascot.tucked .m-rig { transform: translateY(calc(var(--m) * .5 + var(--m-floor))); transition: transform .38s cubic-bezier(.55, 0, .8, .2); }
#mascot.tucked .m-rig:hover { transform: translateY(calc(var(--m) * .42 + var(--m-floor))); transition: transform .3s var(--spring); }
.m-shadow { position: absolute; left: 20%; right: 20%; bottom: -5px; height: 13%; border-radius: 50%; transition: opacity .3s;
  background: radial-gradient(closest-side, rgba(58, 40, 96, .34), rgba(58, 40, 96, .12) 60%, rgba(58, 40, 96, 0)); }
#mascot.tucked .m-shadow { opacity: 0; }
.m-hit { position: absolute; inset: 0; padding: 0; border: 0; border-radius: 42%; background: none; cursor: pointer; pointer-events: auto;
  -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.m-jump, .m-body, .m-talk, .m-flip { position: absolute; inset: 0; display: block; transform-origin: 50% 100%; }
.m-jump { transition: transform .35s var(--spring); }
@media (hover: hover) { #mascot:not(.tucked) .m-hit:hover .m-jump { transform: translateY(-3px) scale(1.035); } }
.m-hit:active .m-jump { transform: scale(1.06, .93); transition-duration: .12s; }
.m-body { animation: mBreath 3.8s ease-in-out infinite; }
#mascot.tucked .m-body { animation: none; }
#mascot.talk .m-talk { animation: mTalk .38s ease-in-out infinite alternate; }
.m-flip img { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; user-select: none; -webkit-user-drag: none; }
.m-flip img.on { opacity: 1; }
@keyframes mBreath { 0%, 100% { transform: none; } 50% { transform: scale(.982, 1.026); } }
@keyframes mTalk { from { transform: scale(1.015, .985); } to { transform: scale(.99, 1.012); } }
.m-burst { position: absolute; left: 10%; top: 28%; width: 80%; aspect-ratio: 1; border-radius: 50%; pointer-events: none; opacity: 0;
  border: 3px solid #ffd36e; box-shadow: 0 0 0 4px rgba(255, 211, 110, .3), inset 0 0 12px rgba(255, 220, 140, .6); }
.m-dot { position: absolute; top: 7%; right: 20%; width: 13px; height: 13px; border-radius: 50%; background: #ff4f86; box-shadow: 0 0 0 2.5px #fff, 0 2px 6px rgba(200, 30, 90, .4);
  opacity: 0; transform: scale(0); transition: opacity .2s, transform .35s var(--spring); pointer-events: none; }
#mascot.news .m-dot { opacity: 1; transform: none; animation: mDot 1.8s ease-in-out .4s infinite; }
@keyframes mDot { 0%, 70%, 100% { transform: none; } 80% { transform: scale(1.25); } 90% { transform: scale(.92); } }
.m-hit:focus-visible { outline: 2px solid rgba(124, 108, 240, .8); outline-offset: -4px; }

/* small tuck control: shows on hover (desktop); phones use the bubble's chevron or a long press */
.m-tuck { position: absolute; left: 2px; bottom: calc(var(--m-floor) + var(--m) - 30px); width: 24px; height: 24px; padding: 0; display: grid; place-items: center; border-radius: 50%;
  background: var(--glass-strong); border: 1px solid var(--edge); box-shadow: var(--shadow); color: var(--muted); cursor: pointer;
  opacity: 0; transform: scale(.6); pointer-events: none; transition: opacity .15s, transform .25s var(--spring); }
.m-tuck svg, .m-x svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
@media (hover: hover) { #mascot:not(.tucked):hover .m-tuck { opacity: 1; transform: none; pointer-events: auto; } }
.m-tuck:hover { color: var(--lav-ink); }
.m-tuck:focus-visible { opacity: 1; transform: none; pointer-events: auto; }

/* speech bubble: solid card in the HUD style, curved tail pointing at Motu's mouth */
.m-bub { position: absolute; right: calc(100% - 2px); bottom: calc(var(--m-floor) + var(--m) * .36); width: max-content; min-width: 130px; max-width: 256px;
  padding: 7px 12px 11px 13px; border-radius: 16px 16px 6px 16px; background: #fff; color: var(--ink); font: 700 13px/1.42 Nunito, ui-rounded, system-ui, sans-serif; text-wrap: pretty;
  filter: drop-shadow(0 0 .6px rgba(98, 84, 160, .55)) drop-shadow(0 8px 14px rgba(60, 44, 120, .22));
  pointer-events: none; opacity: 0; transform-origin: 100% 85%; transform: translate(10px, 4px) scale(.6); transition: opacity .14s, transform .18s ease-in; }
.m-bub::after { content: ''; position: absolute; right: -13px; bottom: 7px; width: 16px; height: 14px; background: #fff;
  clip-path: path('M0 0 C2 6 7 10 15.5 12.5 C9 14.5 4 13.5 0 11 Z'); }
.m-bub.show { opacity: 1; transform: none; pointer-events: auto; transition: opacity .16s, transform .48s var(--spring); }
.m-hd { display: flex; align-items: center; gap: 6px; height: 17px; margin-bottom: 1px; }
.m-hd b { font-size: 9.5px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; color: var(--lav-ink); }
.m-x { margin: 0 -7px 0 auto; width: 22px; height: 18px; padding: 0; display: grid; place-items: center; border: 0; border-radius: 6px; background: none; color: var(--muted); opacity: .65; cursor: pointer; }
.m-x:hover { opacity: 1; background: var(--lav-bg); color: var(--lav-ink); }
.m-tx .w { display: inline-block; }
.m-bub.show .m-tx .w, .m-bub.show .m-go { animation: mWord .34s var(--ease-out) backwards; animation-delay: calc(var(--i) * var(--step, 40ms)); }
@keyframes mWord { from { opacity: 0; transform: translateY(5px); } }
.m-bub.go { cursor: pointer; }
.m-go { display: inline-flex; align-items: center; gap: 3px; margin-left: 3px; padding: 1px 7px 1px 8px; border-radius: 999px; vertical-align: 1px;
  background: var(--lav-bg); color: var(--lav-ink); font-size: 11px; font-weight: 900; white-space: nowrap; }
.m-go svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.m-bub.go:hover .m-go { background: var(--lav); color: #fff; }
.m-timer { position: absolute; left: 13px; right: 13px; bottom: 4px; height: 2px; border-radius: 2px; background: rgba(124, 108, 240, .3); transform-origin: left; transform: scaleX(0); }
.m-timer { display: none; }   /* read as a stray underline: auto-hide is enough */
.m-bub:hover .m-timer { animation-play-state: paused; }
@keyframes mTimer { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* leave the corner to Motu: the side drawer stops above him (and above a 4-line bubble) */
@media (min-width: 861px) { #drawer { max-height: calc(100dvh - 2 * var(--gap) - var(--safe-t) - var(--safe-b) - var(--bar-h) - 8px - 150px); } }
/* phones: smaller, standing on the top edge of the bottom sheet, gone while the sheet is open */
@media (max-width: 860px) {
  #mascot { --m: 72px; --m-floor: 0px; right: calc(var(--gap) + var(--safe-r) + 2px); bottom: calc(var(--gap) + var(--safe-b) + var(--sheet-h) + 3px); }
  .m-bub { bottom: calc(var(--m) * .42); max-width: calc(100vw - var(--m) - 2 * var(--gap) - var(--safe-l) - var(--safe-r) - 16px); min-width: 0; font-size: 12.5px; padding: 6px 11px 10px 12px; }
  .m-bub::after { bottom: 5px; }
  .m-tuck { display: none; }
  .m-dot { width: 11px; height: 11px; top: 4%; right: 16%; }
  #ui.dr-open #mascot { opacity: 0; transform: translateY(14px); }
  #ui.dr-open #mascot * { pointer-events: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  .m-body, #mascot.talk .m-talk, #mascot.news .m-dot { animation: none !important; }
  .m-bub.show .m-tx .w, .m-bub.show .m-go { animation: none !important; }
  .m-timer { display: none; }
}

/* review fixes: one tuck control at a time; keep the bubble off the market tape on narrow desktops */
#mascot:has(.m-bub.show) .m-tuck { display: none; }
@media (min-width: 861px) and (max-width: 1100px) { .m-bub { max-width: 220px; margin-bottom: 6px; } }
