/* ================================================================
   Lib Life — Design System v2
   - No hidden scrollbars (browser-native only, no scrollbar-width:none)
   - Map controls moved to HTML overlay (not canvas)
   - Unified spacing/typography tokens
   - Better touch targets (min 44px)
   - Cleaner dock, nav, topbar, phone, sheet, travel card
================================================================ */

/* ── Design tokens ─────────────────────────────────────────── */
:root {
  --navy:    #0b1f4d;
  --navy2:   #13306b;
  --red:     #bf0a30;
  --white:   #fff;
  --paper:   #fbfaf7;
  --ink:     #14213d;
  --mute:    #6b7690;
  --gold:    #f2b01e;
  --green:   #1fa463;
  --line:    #e6e8ee;
  --surface: #f8fafc;
  --border:  #e2e8f0;
  --radius:  14px;
  --shadow-sm: 0 1px 4px rgba(10,30,70,.10);
  --shadow:    0 2px 12px rgba(10,30,70,.16);
  --shadow-lg: 0 8px 30px rgba(10,30,70,.24);
  font-family: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--navy); color: var(--ink); overscroll-behavior: none; }
[hidden] { display: none !important; }
p, h1, h2, h3, h4, h5, h6, span, label, small, b, strong, td, th, a { overflow-wrap: break-word; word-break: break-word; }
pre, code { white-space: pre-wrap; word-break: break-all; max-width: 100%; }
img, canvas, video, svg { max-width: 100%; }
/* ── Custom Scrollbars ────────────────────────────────────────── */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(11, 31, 77, 0.28) rgba(11, 31, 77, 0.04);
}

*::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

*::-webkit-scrollbar-track {
  background: rgba(11, 31, 77, 0.03);
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb {
  background: rgba(11, 31, 77, 0.26);
  border-radius: 999px;
  border: 1.5px solid transparent;
  background-clip: padding-box;
  transition: background-color 0.15s ease;
}

*::-webkit-scrollbar-thumb:hover {
  background: rgba(191, 10, 48, 0.7);
}

*::-webkit-scrollbar-corner {
  background: transparent;
}

/* Dark mode, In-Game Phone, Game HUD, Bottom Drawers & Modals Custom Scrollbars */
#phoneScreen,
.phone-wrapper,
.phone,
.apps,
.ph-body,
.ph-tab-row,
#mapZoneDrawer,
#drawerVenuesList,
#mapFilterRow,
#modal,
#dock,
#cards,
#chatLog,
.phone-screen,
.card {
  scrollbar-width: thin;
  scrollbar-color: rgba(120, 217, 236, 0.38) rgba(255, 255, 255, 0.04);
}

#phoneScreen::-webkit-scrollbar-track,
.phone-wrapper::-webkit-scrollbar-track,
.phone::-webkit-scrollbar-track,
.apps::-webkit-scrollbar-track,
.ph-body::-webkit-scrollbar-track,
.ph-tab-row::-webkit-scrollbar-track,
#mapZoneDrawer::-webkit-scrollbar-track,
#drawerVenuesList::-webkit-scrollbar-track,
#mapFilterRow::-webkit-scrollbar-track,
#modal::-webkit-scrollbar-track,
#dock::-webkit-scrollbar-track,
#cards::-webkit-scrollbar-track,
#chatLog::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 999px;
}

#phoneScreen::-webkit-scrollbar-thumb,
.phone-wrapper::-webkit-scrollbar-thumb,
.phone::-webkit-scrollbar-thumb,
.apps::-webkit-scrollbar-thumb,
.ph-body::-webkit-scrollbar-thumb,
.ph-tab-row::-webkit-scrollbar-thumb,
#mapZoneDrawer::-webkit-scrollbar-thumb,
#drawerVenuesList::-webkit-scrollbar-thumb,
#mapFilterRow::-webkit-scrollbar-thumb,
#modal::-webkit-scrollbar-thumb,
#dock::-webkit-scrollbar-thumb,
#cards::-webkit-scrollbar-thumb,
#chatLog::-webkit-scrollbar-thumb {
  background: rgba(120, 217, 236, 0.38);
  border-radius: 999px;
  border: 1.5px solid transparent;
  background-clip: padding-box;
}

#phoneScreen::-webkit-scrollbar-thumb:hover,
.phone-wrapper::-webkit-scrollbar-thumb:hover,
.phone::-webkit-scrollbar-thumb:hover,
.apps::-webkit-scrollbar-thumb:hover,
.ph-body::-webkit-scrollbar-thumb:hover,
.ph-tab-row::-webkit-scrollbar-thumb:hover,
#mapZoneDrawer::-webkit-scrollbar-thumb:hover,
#drawerVenuesList::-webkit-scrollbar-thumb:hover,
#mapFilterRow::-webkit-scrollbar-thumb:hover,
#modal::-webkit-scrollbar-thumb:hover,
#dock::-webkit-scrollbar-thumb:hover,
#cards::-webkit-scrollbar-thumb:hover,
#chatLog::-webkit-scrollbar-thumb:hover {
  background: rgba(120, 217, 236, 0.85);
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ── Base UI elements ───────────────────────────────────────── */
button {
  font: inherit;
  font-weight: 700;
  border: 0;
  border-radius: var(--radius);
  padding: .65em 1em;
  min-height: 44px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
  transition: opacity .12s, transform .12s, background .15s;
}
button:active { transform: scale(0.97); opacity: .88; }
button.primary { background: var(--red); color: #fff; }
button.gold    { background: var(--gold); color: #241a00; }
button.dark    { background: var(--navy); color: #fff; }
button.big     { width: 100%; font-size: 1.05rem; }
button:disabled { opacity: .42; cursor: not-allowed; transform: none !important; }
button.link    { background: none; color: var(--mute); text-decoration: underline; font-weight: 500; min-height: 0; padding: .4em; }
button:focus-visible,
input:focus-visible,
select:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
input, select, textarea {
  width: 100%;
  font: inherit;
  padding: .8em;
  margin: .3em 0;
  background: #fff;
  color: var(--ink);
  border: 2px solid var(--line);
  border-radius: var(--radius);
}
h2, h3 { margin: .2em 0; }

/* ── Auth screen ────────────────────────────────────────────── */
#auth { min-height: 100%; background: linear-gradient(rgba(11,31,77,.86), rgba(11,31,77,.93)), url(/img/login-bg.jpg) center/cover; color: #fff; }
.screen { max-width: 440px; margin: 0 auto; padding: max(22px, env(safe-area-inset-top)) 22px 40px; }
.logo { display: block; margin: 6px auto 4px; border-radius: 28px; box-shadow: 0 10px 40px rgba(0,0,0,.45); width: min(54vw, 200px); height: auto; }
.tag { color: #d6def2; text-align: center; margin: .6em 0 1.2em; }
#auth input { background: rgba(255,255,255,.95); }
.seg { display: flex; gap: 8px; margin: .3em 0; overflow-x: auto; -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y; }
.seg button { flex: 1; background: rgba(255,255,255,.18); color: #fff; font-weight: 700; }
.seg button[aria-pressed=true] { background: var(--gold); color: #241a00; font-weight: 800; }
.ph-body .seg button, #sheet .seg button { background: #e2e8f0; color: #0f172a; border: 1px solid #cbd5e1; }
.ph-body .seg button[aria-pressed=true], #sheet .seg button[aria-pressed=true] { background: var(--gold); color: #241a00; border-color: #d97706; }
.err { color: #ffb3b3; min-height: 1.3em; }
.fine { color: #9fb0d6; font-size: .8rem; text-align: center; margin-top: 2em; }
.legal-label { display: flex; align-items: flex-start; gap: 8px; font-size: .78rem; color: #c8d3ee; margin: .6em 0; cursor: pointer; text-align: left; }
.legal-label input { width: auto; min-width: 18px; min-height: 18px; margin: 2px 0 0; cursor: pointer; accent-color: var(--gold); }
.legal-label a { color: var(--gold); text-decoration: underline; }
#auth .link { color: #c8d3ee; width: 100%; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }

/* ── App shell ──────────────────────────────────────────────── */
#app { position: fixed; inset: 0; background: #cfe5f7; overflow: hidden; }

/* ── Topbar ─────────────────────────────────────────────────── */
#topbar {
  position: absolute;
  z-index: 50;
  top: max(8px, env(safe-area-inset-top));
  left: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
#topbar::-webkit-scrollbar { display: none; }
#topbar .pill, #topbar #cashBtn {
  white-space: nowrap;
  flex-shrink: 0;
}
.pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.96);
  border-radius: 99px;
  padding: 7px 12px;
  font-weight: 700;
  font-size: .8rem;
  box-shadow: var(--shadow);
  min-height: 40px;
  border: 1px solid rgba(255,255,255,.8);
  backdrop-filter: blur(10px);
}
#clockPill { flex: 1; min-width: 0; overflow: hidden; }
#clock { white-space: nowrap; font-size: .8rem; }
#mood { color: var(--green); margin-left: auto; white-space: nowrap; font-size: .78rem; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); display: inline-block; flex-shrink: 0; }
/* Online pill: compact */
#onlinePill { gap: 5px; padding: 7px 10px; }
#online { font-size: .78rem; white-space: nowrap; }
#totalPlayersWrap { margin-left: 4px; opacity: .8; font-size: .72rem; white-space: nowrap; }
/* Cash pill */
.pill.cash { background: #fff; padding-right: 6px; }
.cash b { font-size: .88rem; }
.plus { width: 32px; height: 32px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; font-size: 1.2rem; flex-shrink: 0; }

/* ── Banner ─────────────────────────────────────────────────── */
#banner {
  position: absolute;
  z-index: 4;
  top: calc(max(8px, env(safe-area-inset-top)) + 50px);
  left: 8px;
  right: 8px;
  background: var(--navy);
  color: #fff;
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: .84rem;
  box-shadow: var(--shadow);
}

/* ── Stage (canvas area) ────────────────────────────────────── */
#stage { position: absolute; inset: 0; }
#room, #mapc { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }

/* ── Bottom Dock ────────────────────────────────────────────── */
#dock {
  position: fixed;
  z-index: 85;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 20px);
  max-width: 600px;
  bottom: calc(max(10px, env(safe-area-inset-bottom, 10px)) + 68px);
  max-height: min(340px, 44vh);
  overflow: hidden;
  background: rgba(255,255,255,.98);
  border-radius: 20px;
  padding: 8px 14px 10px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.12), 0 1px 4px rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
  transition: max-height .22s ease, padding .2s ease;
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,.8);
}
#dock.mini {
  max-height: 48px;
  padding: 6px 14px;
}
#dock.mini .dock-controls-bar,
#dock.mini .dock-needs-row,
#dock.mini #dockScrollArea,
#dock.mini .cards,
#dock.mini .chips,
#dock.mini .playerlist,
#dock.mini .chatlog,
#dock.mini #chatIn,
#dock.mini .say,
#dock.mini .mission,
#dock.mini .tip,
#dock.mini .dock-nav-tabs,
#dock.mini .dock-floor-bar {
  display: none !important;
}
#dockToggle {
  background: rgba(0,0,0,0.06);
  border: 0;
  border-radius: 99px;
  color: var(--navy);
  cursor: pointer;
  padding: 3px 9px;
  font-size: .85rem;
  font-weight: 800;
  margin-left: auto;
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .14s ease;
}
#dockToggle:hover,
#dockToggle:active {
  background: rgba(0,0,0,0.12);
}
.dockhead {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  flex-shrink: 0;
  width: 100%;
}
.dockhead-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}
.dockhead h2 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dockhead small {
  display: block;
  color: var(--mute);
  font-size: .74rem;
  line-height: 1.2;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dock-controls-bar {
  display: flex;
  gap: 6px;
  align-items: center;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  flex-shrink: 0;
  padding: 2px 0 4px;
  width: 100%;
}
.dock-controls-bar::-webkit-scrollbar {
  display: none;
}
.dock-controls-bar button,
.dock-controls-bar .chip,
.dock-controls-bar .pill {
  flex-shrink: 0;
  white-space: nowrap;
}
.dock-needs-row {
  display: flex;
  gap: 8px;
  font-size: .75rem;
  margin: 3px 0 5px;
  flex-wrap: wrap;
  align-items: center;
  flex-shrink: 0;
}

/* Dock tabs */
.dock-nav-tabs { display: flex; gap: 4px; margin: 4px 0 8px; background: #eef2f8; padding: 3px; border-radius: 12px; }
.dock-tab-btn { flex: 1; background: transparent; border: 0; border-radius: 8px; padding: 5px 8px; font-size: .78rem; font-weight: 700; color: var(--mute); min-height: 32px; cursor: pointer; transition: background .14s, color .14s; }
.dock-tab-btn[aria-pressed=true] { background: #fff; color: var(--navy); box-shadow: 0 1px 5px rgba(0,0,0,.09); }
#dockScrollArea { overflow-y: auto; flex: 1; padding-right: 2px; }

/* Cards grid */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin: 8px 0; }
.card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  text-align: left;
  position: relative;
  cursor: pointer;
  transition: transform .14s ease, border-color .14s ease, background .14s ease;
  min-height: 76px;
}
.card:hover { background: #fff; border-color: #cbd5e1; transform: translateY(-1px); }
.card:active { transform: scale(0.97); }
.card.lock { background: #f1f5f9; opacity: .75; border-style: dashed; }
.card.running { background: #ecfdf5; border-color: #10b981; }
.card .e { font-size: 1.45rem; margin-bottom: 4px; display: inline-block; }
.card b { font-size: .82rem; font-weight: 700; color: var(--navy); line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .meta { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; width: 100%; }
.tag2 { font-size: .65rem; font-weight: 700; padding: 2px 6px; border-radius: 6px; background: #e2e8f0; color: #334155; }
.tag2.free { background: #ecfdf5; color: #047857; }
.tag2.fee  { background: #fef2f2; color: #b91c1c; }
.tag2.pay  { background: #eff6ff; color: #1d4ed8; }
.tag2.sk   { background: #faf5ff; color: #7e22ce; }
.tag2.lock { background: #fef3c7; color: #92400e; }
.card .prog { position: absolute; bottom: 0; left: 0; right: 0; height: 4px; background: #e2e8f0; border-radius: 0 0 16px 16px; overflow: hidden; }
.card .prog i { display: block; height: 100%; background: #10b981; width: 0%; transition: width .2s linear; }

/* Chips (horizontal scroll — native scrollbar) */
.chips { display: flex; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y; overscroll-behavior-x: contain; padding-bottom: 6px; margin: 6px 0; }
.chip { background: #f1f5f9; color: #475569; border-radius: 99px; padding: 6px 14px; font-size: .8rem; font-weight: 700; white-space: nowrap; border: 1px solid var(--border); cursor: pointer; flex-shrink: 0; min-height: 36px; }
.chip[aria-pressed=true] { background: var(--navy); color: #fff; border-color: var(--navy); }

/* Chat */
.chatlog { max-height: 140px; overflow-y: auto; background: var(--surface); border-radius: var(--radius); padding: 8px 12px; font-size: .82rem; display: flex; flex-direction: column; gap: 5px; border: 1px solid var(--line); margin: 6px 0; }
.say { display: flex; gap: 6px; align-items: center; margin-top: 6px; }
.say input { margin: 0; flex: 1; min-height: 42px; border-radius: var(--radius); padding: 8px 12px; font-size: .85rem; }
.say button { min-height: 42px; border-radius: var(--radius); padding: 0 16px; }

/* ── Needs bar (nodock mode — map) ──────────────────────────── */
#needs {
  position: absolute;
  z-index: 6;
  left: 10px;
  bottom: calc(76px + env(safe-area-inset-bottom));
  display: none;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,.96);
  border-radius: 99px;
  padding: 6px 12px 6px 6px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
body.nodock #needs {
  display: flex;
  position: absolute;
  z-index: 41;
  top: calc(max(8px, env(safe-area-inset-top)) + 102px);
  left: 10px;
  bottom: auto;
  background: rgba(23, 24, 28, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #ffffff;
  border-radius: 99px;
  padding: 4px 10px 4px 4px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
}
body.nodock #needs .nb { color: #e2e8f0; }
body.nodock #needs .nb i { background: #334155; }
#meBtn { padding: 0; min-height: 0; width: 44px; height: 44px; border-radius: 50%; border: 2.5px solid var(--green); background: #fff; overflow: hidden; flex-shrink: 0; }
#meAvatar { width: 100%; height: 100%; }
#needBars { display: grid; grid-template-columns: auto auto; gap: 3px 8px; font-size: .72rem; }
.nb { display: flex; align-items: center; gap: 4px; }
.nb i { display: block; width: 44px; height: 6px; background: #e4e8f1; border-radius: 4px; overflow: hidden; }
.nb i b { display: block; height: 100%; background: var(--green); }
.nb.low i b { background: var(--red); }

/* ── Bottom Nav ─────────────────────────────────────────────── */
#nav {
  position: fixed;
  z-index: 80;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 20px);
  max-width: 600px;
  bottom: max(10px, env(safe-area-inset-bottom, 10px));
  display: flex;
  background: rgba(255,255,255,.97);
  border-radius: 20px;
  padding: 4px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,.8);
  gap: 2px;
}
#nav button {
  flex: 1;
  background: transparent;
  border: 0;
  border-radius: 15px;
  padding: 4px 2px;
  min-height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: .72rem;
  color: var(--mute);
  cursor: pointer;
  transition: background .14s, color .14s, transform .12s;
  position: relative;
}
#nav button[aria-pressed=true] { background: #eff6ff; color: #1d4ed8; font-weight: 800; }
#nav button i { font-style: normal; font-size: 1.28rem; }
/* Active nav indicator dot */
#nav button[aria-pressed=true]::after {
  content: '';
  position: absolute;
  bottom: 5px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #1d4ed8;
}


/* ── Travel Card ────────────────────────────────────────────── */
#travelCard {
  position: absolute;
  z-index: 12;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 20px);
  max-width: 600px;
  top: calc(max(10px, env(safe-area-inset-top, 10px)) + 96px);
  background: rgba(255,255,255,.98);
  border-radius: 18px;
  padding: 10px 14px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,.8);
}
#travelCard .prog { height: 8px; margin: 8px 0; background: #e2e8f0; border-radius: 99px; overflow: hidden; }
#travelCard .prog i { display: block; height: 100%; background: #10b981; border-radius: 99px; }
/* Travel card action buttons */
.travel-actions { display: flex; gap: 6px; margin-top: 6px; }
.travel-actions button { flex: 1; font-size: .78rem; padding: 6px 8px; border-radius: 12px; min-height: 40px; }

/* ── Darkness overlay ───────────────────────────────────────── */
#darkness { position: absolute; z-index: 9; inset: 0; background: rgba(5,8,20,.78); display: grid; place-items: center; color: #ffe9a8; font-weight: 800; text-align: center; pointer-events: none; font-size: 1.1rem; padding: 20px; }
.lock { opacity: .6; }

/* ── Sheet Modal (bottom) ───────────────────────────────────── */
#sheet { position: fixed; inset: 0; z-index: 200; background: rgba(8,18,44,.72); backdrop-filter: blur(10px); display: flex; align-items: flex-end; justify-content: center; animation: sheetFade .2s ease-out; }
#sheet[hidden] { display: none !important; }
.sheet-card {
  width: 100%;
  max-width: 540px;
  max-height: 86vh;
  background: #fff;
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -8px 40px rgba(0,0,0,.32);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: sheetSlide .26s cubic-bezier(.16,1,.3,1);
}
.sheet-card .grab { width: 40px; height: 4px; background: #cbd5e1; border-radius: 99px; margin: 10px auto 4px; }
.sheet-card header { display: flex; align-items: center; justify-content: space-between; padding: 8px 18px 10px; border-bottom: 1px solid var(--line); gap: 12px; }
.sheet-card header h2 { font-size: 1.12rem; font-weight: 800; color: var(--navy); margin: 0; flex: 1; min-width: 0; }
#sheetClose { background: #f1f5f9; color: #475569; border-radius: 99px; padding: 5px 14px; font-size: .82rem; font-weight: 700; text-decoration: none; cursor: pointer; border: 0; min-height: 34px; flex-shrink: 0; }
#sheetClose:hover { background: #e2e8f0; color: #0f172a; }
#sheetBody { padding: 14px 18px 24px; overflow-y: auto; flex: 1; }
@keyframes sheetFade  { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheetSlide { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* ── Phone Modal ────────────────────────────────────────────── */
#phoneModal {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(4,10,26,.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(10px, env(safe-area-inset-top)) 10px max(14px, env(safe-area-inset-bottom));
  backdrop-filter: blur(10px);
  animation: fadeIn .2s ease;
}
.phone-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.phone-floating-close {
  position: absolute;
  top: -46px;
  right: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  z-index: 50;
  transition: background .15s, transform .12s;
  min-height: 40px;
  padding: 0;
}
.phone-floating-close:hover {
  background: rgba(239,68,68,0.9);
  transform: scale(1.08);
}
.phone {
  position: relative;
  width: min(390px, 94vw);
  height: min(760px, 86vh);
  background: #0f1117;
  border-radius: 44px;
  padding: 10px 10px 6px;
  box-shadow: 0 24px 60px rgba(0,0,0,.85), inset 0 0 0 2px #2a2d3d;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all .2s ease;
}

/* Samsung Galaxy S24 Ultra Chassis (Iconic sharp titanium corners) */
.phone.phone-model-samsung_s24_ultra {
  border-radius: 14px;
  border: 4px solid #3c4048;
  box-shadow: 0 0 0 2px #1b1d22, 0 24px 70px rgba(0,0,0,0.92);
  background: #0b0c10;
  padding: 8px 8px 4px;
}
.phone.phone-model-samsung_s24_ultra #phoneScreen {
  border-radius: 8px;
}

/* iPhone 15 Pro Max Chassis (Titanium curved frame) */
.phone.phone-model-iphone_15_pro_max {
  border-radius: 46px;
  border: 4px solid #6c645c;
  box-shadow: 0 0 0 2px #262320, 0 24px 70px rgba(0,0,0,0.92);
}
.phone.phone-model-iphone_15_pro_max #phoneScreen {
  border-radius: 40px;
}

/* iPhone 11 Chassis */
.phone.phone-model-iphone_11 {
  border-radius: 42px;
  border: 4px solid #475569;
}
.phone.phone-model-iphone_11 #phoneScreen {
  border-radius: 36px;
}

/* Kpalava Feature Button Phone Chassis */
.phone.phone-model-basic_kpalava {
  border-radius: 24px;
  border: 6px solid #1e293b;
  background: #0f172a;
}
.phone.phone-model-basic_kpalava #phoneScreen {
  border-radius: 12px;
}

/* iPhone 16 Pro (Grade 5 Desert Titanium frame) */
.phone.phone-model-iphone_16_pro {
  border-radius: 48px;
  border: 4.5px solid #c4a482;
  box-shadow: 0 0 0 2px #574636, 0 0 20px rgba(196, 164, 130, 0.35), 0 24px 70px rgba(0,0,0,0.92);
  background: #1c1917;
}
.phone.phone-model-iphone_16_pro #phoneScreen {
  border-radius: 42px;
}

/* Samsung Galaxy Z Fold 6 (Dual hinge armor chassis) */
.phone.phone-model-galaxy_z_fold {
  border-radius: 20px;
  border: 4px solid #475569;
  box-shadow: -6px 0 0 2px #1e293b, 0 0 0 2px #334155, 0 0 20px rgba(56, 189, 248, 0.25), 0 24px 70px rgba(0,0,0,0.92);
  background: #0f172a;
}
.phone.phone-model-galaxy_z_fold #phoneScreen {
  border-radius: 14px;
}

/* Caviar 24K Solid Gold iPhone 16 Pro (Sinkor VIP Luxury) */
.phone.phone-model-caviar_gold_iphone {
  border-radius: 48px;
  border: 5px solid #eab308;
  box-shadow: 0 0 25px rgba(234, 179, 8, 0.6), 0 0 0 2.5px #713f12, 0 26px 80px rgba(0,0,0,0.95);
  background: linear-gradient(135deg, #fef08a, #ca8a04 45%, #713f12 100%);
}
.phone.phone-model-caviar_gold_iphone #phoneScreen {
  border-radius: 42px;
}

/* Tecno Camon 30 Premier 5G */
.phone.phone-model-tecno_camon30 {
  border-radius: 36px;
  border: 4px solid #1e293b;
  box-shadow: 0 0 0 2px #0f172a, 0 0 16px rgba(6, 182, 212, 0.25), 0 24px 70px rgba(0,0,0,0.92);
  background: #0f172a;
}
.phone.phone-model-tecno_camon30 #phoneScreen {
  border-radius: 30px;
}

/* Infinix Zero 40 5G */
.phone.phone-model-infinix_zero40 {
  border-radius: 38px;
  border: 4px solid #334155;
  box-shadow: 0 0 0 2px #1e293b, 0 0 16px rgba(245, 158, 11, 0.28), 0 24px 70px rgba(0,0,0,0.92);
  background: #18181b;
}
.phone.phone-model-infinix_zero40 #phoneScreen {
  border-radius: 32px;
}

/* Tecno Spark 20 */
.phone.phone-model-tecno_spark20 {
  border-radius: 34px;
  border: 4px solid #0284c7;
  box-shadow: 0 0 0 2px #0369a1, 0 24px 70px rgba(0,0,0,0.92);
}
.phone.phone-model-tecno_spark20 #phoneScreen { border-radius: 28px; }

/* Infinix Hot 40 Pro */
.phone.phone-model-infinix_hot40 {
  border-radius: 36px;
  border: 4px solid #059669;
  box-shadow: 0 0 0 2px #064e3b, 0 24px 70px rgba(0,0,0,0.92);
}
.phone.phone-model-infinix_hot40 #phoneScreen { border-radius: 30px; }

/* Samsung Galaxy A15 */
.phone.phone-model-samsung_a15 {
  border-radius: 36px;
  border: 4px solid #2563eb;
  box-shadow: 0 0 0 2px #1d4ed8, 0 24px 70px rgba(0,0,0,0.92);
}
.phone.phone-model-samsung_a15 #phoneScreen { border-radius: 30px; }

/* Itel A70 */
.phone.phone-model-itel_a70 {
  border-radius: 32px;
  border: 4px solid #1e293b;
  box-shadow: 0 0 0 2px #0f172a, 0 24px 70px rgba(0,0,0,0.92);
}
.phone.phone-model-itel_a70 #phoneScreen { border-radius: 26px; }

/* Under-display camera notch */
.phone.phone-notch-under_display .phone-cam-notch .notch-element {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(2px);
}

/* Phone Camera / Notch Area */
.phone-cam-notch {
  position: absolute;
  top: 8px;
  left: 0;
  right: 0;
  height: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none;
  z-index: 35;
}

/* S24 Ultra / Tecno hole-punch camera */
.phone.phone-notch-hole .phone-cam-notch .notch-element {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #050608;
  box-shadow: inset 0 0 2px rgba(255,255,255,0.4), 0 0 0 1px #111;
}

/* iPhone 15 Pro Max Dynamic Island */
.phone.phone-notch-dynamic_island .phone-cam-notch .notch-element {
  width: 95px;
  height: 24px;
  background: #000;
  border-radius: 99px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.6);
}

/* Teardrop / U-Notch */
.phone.phone-notch-waterdrop .phone-cam-notch,
.phone.phone-notch-u_notch .phone-cam-notch {
  top: 0;
}
.phone.phone-notch-waterdrop .phone-cam-notch .notch-element,
.phone.phone-notch-u_notch .phone-cam-notch .notch-element {
  width: 22px;
  height: 14px;
  background: #000;
  border-radius: 0 0 12px 12px;
}

/* Classic Wide Notch */
.phone.phone-notch-wide_notch .phone-cam-notch {
  top: 0;
}
.phone.phone-notch-wide_notch .phone-cam-notch .notch-element {
  width: 120px;
  height: 22px;
  background: #000;
  border-radius: 0 0 16px 16px;
}

.phone-home-bar-area { display: flex; justify-content: center; align-items: center; padding: 6px 0 2px; cursor: pointer; min-height: 24px; }
.phone-home-bar { width: 125px; height: 4.5px; background: rgba(255,255,255,.7); border-radius: 99px; transition: all .15s ease; }
.phone-home-bar-area:hover .phone-home-bar,
.phone-home-bar-area:active .phone-home-bar { background: #fff; transform: scale(1.08); }

#phoneScreen {
  width: 100%;
  flex: 1;
  min-height: 0;
  border-radius: 34px;
  overflow: hidden;
  background: linear-gradient(180deg, #4338ca, #7c3aed 55%, #ea580c);
  color: #fff;
  display: flex;
  flex-direction: column;
}

/* Real Modern Status Bar */
.ph-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px 4px;
  font-size: .78rem;
  font-weight: 700;
  color: #fff;
  user-select: none;
  flex-shrink: 0;
}
.ph-status-left {
  display: flex;
  align-items: center;
  gap: 7px;
}
.ph-status-time {
  font-weight: 800;
  font-size: .84rem;
  letter-spacing: -0.2px;
}
.ph-status-notifications {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .74rem;
}
.ph-notif-msg {
  background: #ef4444;
  color: #fff;
  border-radius: 99px;
  padding: 0 4px;
  font-size: .62rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.ph-status-right {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ph-net-type {
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: 0.2px;
  opacity: .95;
}
.ph-signal-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 1.5px;
  height: 12px;
  vertical-align: middle;
}
.sig-bar {
  width: 2.5px;
  background: currentColor;
  border-radius: 0.5px;
}
.sig-bar.bar-1 { height: 3px; }
.sig-bar.bar-2 { height: 5.5px; }
.sig-bar.bar-3 { height: 8.5px; }
.sig-bar.bar-4 { height: 11.5px; }

.ph-wifi-icon {
  display: inline-flex;
  align-items: center;
  opacity: .95;
}

.ph-battery-wrap {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.ph-battery-level {
  font-size: .66rem;
  font-weight: 700;
  opacity: .9;
}
.ph-battery-body {
  width: 20px;
  height: 10px;
  border: 1.2px solid currentColor;
  border-radius: 2.5px;
  padding: 1px;
  display: flex;
  align-items: center;
  position: relative;
  background: rgba(0,0,0,.15);
}
.ph-battery-charge {
  height: 100%;
  background: #22c55e;
  border-radius: 1px;
}
.ph-battery-nub {
  position: absolute;
  right: -2.5px;
  top: 2px;
  width: 1.5px;
  height: 4px;
  background: currentColor;
  border-radius: 0 1px 1px 0;
}

/* Phone Home Clock & Date Header */
.ph-home-header {
  padding: 8px 20px 4px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex-shrink: 0;
}
.ph-clock-time {
  font-size: 2.6rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.5px;
}
.ph-clock-date {
  font-size: .78rem;
  font-weight: 500;
  opacity: .88;
  margin-top: 4px;
}
/* Phone tab row: Compact sleek pill chips */
.ph-tab-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 14px 6px;
  margin-bottom: 2px;
  scrollbar-width: none;
  flex-shrink: 0;
}
.ph-tab-row::-webkit-scrollbar { display: none; }
.ph-tab-chip {
  background: rgba(255,255,255,.14);
  color: rgba(255,255,255,.9);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 99px;
  padding: 3px 11px;
  font-size: .70rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  min-height: 26px;
  transition: all .15s ease;
  backdrop-filter: blur(8px);
  flex-shrink: 0;
}
.ph-tab-chip.active {
  background: #ffffff;
  color: #0f172a;
  border-color: #ffffff;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

/* Phone apps grid: Locked 52x52 squircles with comfortable row spacing */
.apps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px 6px;
  row-gap: 16px;
  padding: 8px 12px 32px;
  overflow-y: auto;
  flex: 1;
  align-content: start;
  justify-items: center;
  min-height: 0;
}
.app {
  background: transparent !important;
  color: #fff !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 5px !important;
  padding: 0 !important;
  border: 0 !important;
  min-height: 76px !important;
  width: 100% !important;
  max-width: 68px !important;
  cursor: pointer !important;
  position: relative !important;
  text-align: center !important;
  flex-shrink: 0 !important;
}
.app:active { transform: scale(0.92); }
.app i {
  font-style: normal !important;
  width: 52px !important;
  height: 52px !important;
  min-width: 52px !important;
  min-height: 52px !important;
  max-width: 52px !important;
  max-height: 52px !important;
  aspect-ratio: 1 / 1 !important;
  border-radius: 15px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 1.55rem !important;
  box-shadow: 0 4px 14px rgba(0,0,0,.4) !important;
  flex-shrink: 0 !important;
  flex-grow: 0 !important;
  transition: transform .12s cubic-bezier(0.2, 0.8, 0.2, 1) !important;
}
.app:hover i { transform: scale(1.06); }
.app b.badge {
  position: absolute;
  top: -3px;
  right: 4px;
  background: var(--red);
  color: #fff;
  border-radius: 99px;
  font-size: .62rem;
  font-weight: 800;
  padding: 1px 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,.5);
  z-index: 2;
}
.app .app-title {
  display: block !important;
  font-size: .68rem !important;
  font-weight: 600 !important;
  color: rgba(255,255,255,.95) !important;
  line-height: 1.2 !important;
  max-width: 66px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  text-align: center !important;
  text-shadow: 0 1px 3px rgba(0,0,0,.85) !important;
  letter-spacing: -0.1px !important;
}
/* Phone app screen */
.ph-app { background: var(--paper); color: var(--ink); flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.ph-top { background: var(--navy); color: #fff; display: flex; align-items: center; gap: 8px; padding: 34px 12px 10px; }
.ph-top button { background: rgba(255,255,255,.15); color: #fff; min-height: 34px; padding: .3em .8em; border-radius: 10px; }
.ph-top h3 { margin: 0; flex: 1; font-size: 1rem; }
.ph-body { overflow-y: auto; padding: 12px; flex: 1; }
/* Phone messages */
.msgs { display: flex; flex-direction: column; gap: 6px; }
.m { max-width: 80%; padding: 8px 12px; border-radius: 16px; background: #e9ecf4; font-size: .9rem; align-self: flex-start; }
.m.me { background: var(--navy); color: #fff; align-self: flex-end; }
.m.sys { align-self: center; background: #fff1d6; font-size: .8rem; }
.m small { display: block; opacity: .7; font-size: .68rem; }
.m.req { background: #eaf7ef; }
.compose { display: flex; gap: 6px; padding: 8px; background: #fff; border-top: 1px solid var(--line); }
.compose input { margin: 0; }
.bubbles { display: grid; gap: 8px; }
.cashcard { background: linear-gradient(135deg, #0b1f4d, #13306b); color: #fff; border-radius: 18px; padding: 14px; }
.cashcard b { font-size: 1.5rem; display: block; }

/* ── Food eating modal ──────────────────────────────────────── */
.card.dish-card { padding: 10px; border-radius: 18px; min-height: 185px; display: flex; flex-direction: column; justify-content: space-between; }
.dish-media { position: relative; width: 100%; height: 115px; border-radius: 14px; overflow: hidden; background: #f0f2f5; margin-bottom: 6px; }
.dish-media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s ease; }
.card.dish-card:hover .dish-media img { transform: scale(1.06); }
.dish-hunger-badge { position: absolute; bottom: 6px; right: 6px; background: rgba(16,185,129,.92); color: #fff; font-size: .7rem; font-weight: 800; padding: 2px 8px; border-radius: 99px; backdrop-filter: blur(4px); box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.dish-desc { font-size: .74rem; color: var(--mute); line-height: 1.25; margin: 2px 0 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
#eatModal { position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.68); display: flex; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(6px); animation: fadeIn .25s ease; }
.eat-card { background: #fff; border-radius: 28px; padding: 26px 20px 20px; width: min(360px, 94vw); text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,.45); animation: popIn .32s cubic-bezier(0.175,0.885,0.32,1.275); }
.eat-img-wrap { position: relative; width: 145px; height: 145px; margin: 0 auto 12px; border-radius: 50%; overflow: hidden; border: 4px solid var(--gold); box-shadow: 0 8px 24px rgba(242,176,30,.35); }
.eat-img-wrap img { width: 100%; height: 100%; object-fit: cover; animation: chewBounce 1.4s infinite ease-in-out; }
.eat-steam { font-size: 2rem; animation: steamRise 1.2s infinite ease-out; display: inline-block; }
.eat-restore { display: flex; justify-content: center; gap: 8px; margin: 12px 0; flex-wrap: wrap; }
.eat-pill { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; font-weight: 800; font-size: .82rem; padding: 4px 12px; border-radius: 99px; }

/* ── Animations ─────────────────────────────────────────────── */
@keyframes fadeIn    { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn     { from { transform: scale(.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes chewBounce{ 0%, 100% { transform: scale(1); } 50% { transform: scale(0.92) rotate(-3deg); } }
@keyframes steamRise { 0% { transform: translateY(0) scale(0.9); opacity: .8; } 50% { transform: translateY(-8px) scale(1.1); opacity: 1; } 100% { transform: translateY(-16px) scale(0.8); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ── Reusable sheet panel components ─────────────────────────── */
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.row .grow { flex: 1; min-width: 0; overflow-wrap: break-word; word-break: break-word; }
.row .grow b, .row .grow strong { display: block; font-size: .95rem; color: var(--navy); }
.row .grow small { display: block; color: var(--mute); font-size: .78rem; margin-top: 2px; }
.pillb { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 99px; font-size: .74rem; font-weight: 700; background: #eef2f8; color: var(--ink); white-space: nowrap; flex-shrink: 0; }
.pillb.ok   { background: #ecfdf5; color: #047857; }
.pillb.bad  { background: #fef2f2; color: #b91c1c; }
.pillb.warn { background: #fffbeb; color: #b45309; }
.sec { font-size: .85rem; font-weight: 800; color: var(--navy); text-transform: uppercase; letter-spacing: .04em; margin: 16px 0 8px; display: flex; align-items: center; gap: 6px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin: 8px 0; }
.mission { background: var(--surface); border-left: 4px solid var(--gold); border-radius: 12px; padding: 12px 14px; margin: 10px 0; font-size: .88rem; color: var(--ink); box-shadow: var(--shadow-sm); overflow-wrap: break-word; word-break: break-word; }
.mission b { display: block; font-size: .95rem; color: var(--navy); margin-bottom: 3px; }
.mission small { display: block; color: var(--mute); font-size: .75rem; margin-bottom: 2px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.sw { width: 38px; height: 38px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.2); padding: 0; min-height: 0; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease; }
.sw[aria-pressed=true] { transform: scale(1.15); border-color: var(--gold); box-shadow: 0 0 0 2px var(--navy); }
.comic-dialogue-box p { overflow-wrap: break-word; word-break: break-word; }
/* Player list in dock chat */
.playerlist { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0; }
.pl { background: #eef2f8; color: var(--navy); border-radius: 99px; padding: 4px 10px; font-size: .78rem; font-weight: 700; border: 0; cursor: pointer; min-height: 32px; }

/* ── Toast ──────────────────────────────────────────────────── */
#toast {
  position: fixed;
  z-index: 300;
  bottom: calc(80px + max(10px, env(safe-area-inset-bottom)));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(14,24,50,.92);
  color: #fff;
  padding: 9px 18px;
  border-radius: 99px;
  font-size: .84rem;
  font-weight: 700;
  opacity: 0;
  transition: opacity .22s, transform .22s;
  pointer-events: none;
  white-space: nowrap;
  max-width: calc(100vw - 40px);
  overflow: hidden;
  text-overflow: ellipsis;
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Wide screen ────────────────────────────────────────────── */
@media (min-width: 760px) {
  #dock { left: 50%; transform: translateX(-50%); width: 640px; }
}

/* ── Small screen ───────────────────────────────────────────── */
@media (max-width: 480px) {
  #topbar { gap: 4px; top: max(6px, env(safe-area-inset-top)); }
  .pill { padding: 4px 8px; font-size: .72rem; min-height: 34px; }
  #dock {
    width: calc(100% - 16px);
    bottom: calc(max(8px, env(safe-area-inset-bottom, 8px)) + 62px);
    padding: 6px 10px;
    max-height: 42vh;
  }
  #nav {
    width: calc(100% - 16px);
    bottom: max(8px, env(safe-area-inset-bottom, 8px));
    padding: 3px;
  }
  #nav button {
    min-height: 44px;
    font-size: .68rem;
    padding: 3px 2px;
  }
  #clockPill { overflow: hidden; }
  #clock { font-size: .74rem; }
  #mood { font-size: .72rem; }
  .cash b { font-size: .8rem; }
  .plus { width: 28px; height: 28px; font-size: 1rem; }
  #phoneModal .phone { width: min(390px, 98vw); height: min(760px, 90vh); padding: 8px 8px 4px; }
  .cards { grid-template-columns: repeat(auto-fill, minmax(125px, 1fr)); gap: 6px; }
  .card { padding: 8px 10px; min-height: 70px; }
  .card .e { font-size: 1.3rem; }
  .card b { font-size: .78rem; }
  .dock-nav-tabs { margin-bottom: 6px; }
  .dock-tab-btn { padding: 4px 6px; font-size: .73rem; }
  .sheet-card { max-height: 90vh; }
  #sheetBody { padding: 12px 14px 24px; }
  .map-fab-cluster { right: 8px; gap: 6px; }
  .map-fab { width: 40px; height: 40px; font-size: .9rem; }
  .sv-btn { font-size: .78rem; min-height: 44px; }
}


/* ── Authentic Dishes Menu & Food Gallery ────────────────────── */
.dishes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin: 12px 0;
}
.dish-card {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .14s, box-shadow .14s, border-color .14s;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.dish-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: #f2b01e;
}
.dish-thumb {
  width: 100%;
  height: 95px;
  object-fit: cover;
  background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
}
.dish-info {
  padding: 8px 10px 10px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.dish-name {
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--navy);
  line-height: 1.25;
  margin-bottom: 4px;
}
.dish-desc {
  font-size: 0.72rem;
  color: var(--mute);
  line-height: 1.3;
  margin-bottom: 8px;
  flex: 1;
}
.dish-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}
.dish-price {
  font-weight: 800;
  color: #1fa463;
  font-size: 0.84rem;
}

/* ── Transfer Quick Chips ────────────────────────────────────── */
.chip-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 10px 0 14px;
}
.chip-btn {
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  padding: 8px 4px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #1e293b;
  cursor: pointer;
  transition: all .12s;
  text-align: center;
}
.chip-btn:hover {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1d4ed8;
}
.chip-btn.active {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #ffffff;
}

/* ── Playable Games App: Tic Tac Toe & UNO ────── */
.game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 0;
}
.game-board-3x3 {
  display: grid;
  grid-template-columns: repeat(3, 85px);
  grid-template-rows: repeat(3, 85px);
  gap: 8px;
  background: #1e293b;
  padding: 10px;
  border-radius: 18px;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.5), 0 8px 24px rgba(0,0,0,0.25);
}
.game-cell {
  background: #334155;
  border: 2px solid #475569;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  font-weight: 900;
  cursor: pointer;
  user-select: none;
  transition: all .12s ease;
  color: #fff;
}
.game-cell:hover:not(.taken) {
  background: #475569;
  border-color: #38bdf8;
  transform: scale(1.02);
}
.game-cell.x { color: #38bdf8; text-shadow: 0 0 10px rgba(56,189,248,0.5); }
.game-cell.o { color: #f43f5e; text-shadow: 0 0 10px rgba(244,63,94,0.5); }
.game-status-banner {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 8px 16px;
  font-weight: 700;
  font-size: 0.92rem;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Comic Story Dialogue ────────────────────────────────────── */
.comic-dialogue-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.comic-speech-bubble {
  background: #ffffff;
  border: 2.5px solid #0b1f4d;
  border-radius: 18px;
  padding: 14px 18px;
  position: relative;
  box-shadow: 4px 4px 0 #0b1f4d;
}
.comic-speech-bubble::before {
  content: '';
  position: absolute;
  top: -12px;
  left: 28px;
  border-width: 0 12px 12px 12px;
  border-style: solid;
  border-color: transparent transparent #0b1f4d transparent;
}
.comic-speech-bubble::after {
  content: '';
  position: absolute;
  top: -9px;
  left: 30px;
  border-width: 0 10px 10px 10px;
  border-style: solid;
  border-color: transparent transparent #ffffff transparent;
}

/* ── 2.5D Map Indicator and Controls ─────────────────────────── */
.map-mode-badge {
  position: absolute;
  top: calc(max(10px, env(safe-area-inset-top, 10px)) + 52px);
  left: 12px;
  z-index: 55;
  background: rgba(11, 31, 77, 0.88);
  color: #fff;
  padding: 6px 12px;
  border-radius: 99px;
  font-size: 0.76rem;
  font-weight: 800;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}

/* ── Highway Travel Cutscene Overlay ───────────────────────── */
#travelCutsceneOverlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 95;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
#travelCutsceneOverlay[hidden] {
  display: none !important;
}
.travel-top-hud {
  pointer-events: auto;
  margin-top: calc(56px + max(8px, env(safe-area-inset-top, 8px)));
  padding: 0 14px;
}
.travel-dest-badge {
  background: rgba(15, 157, 88, 0.95);
  backdrop-filter: blur(8px);
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  border-radius: 14px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #ffffff;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  max-width: 600px;
  margin: 0 auto;
}
.travel-dest-badge .dest-icon {
  font-size: 1.6rem;
}
.travel-dest-badge .dest-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.travel-dest-badge .dest-info strong {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.travel-dest-badge .dest-info small {
  font-size: 0.78rem;
  opacity: 0.92;
  font-weight: 600;
}
.travel-gas-badge {
  background: rgba(0, 0, 0, 0.35);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 800;
  white-space: nowrap;
}
.travel-action-bar {
  pointer-events: auto;
  margin-bottom: max(16px, env(safe-area-inset-bottom, 16px));
  padding: 0 14px;
  display: flex;
  justify-content: center;
  gap: 12px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}
.travel-btn {
  flex: 1;
  height: 48px;
  border-radius: 14px;
  border: 1.5px solid transparent;
  font-size: 0.92rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
  transition: transform 0.12s ease, filter 0.12s ease;
}
.travel-btn:active {
  transform: scale(0.96);
}
.travel-btn.horn {
  background: #1a73e8;
  color: #ffffff;
  border-color: #60a5fa;
}
.travel-btn.map {
  background: #ffffff;
  color: #1e293b;
  border-color: #cbd5e1;
}
.travel-btn.skip {
  background: #ea4335;
  color: #ffffff;
  border-color: #f87171;
}
body.in-cutscene #needs {
  display: none !important;
}

/* ── Interior Design Room Templates ───────────────────────── */
.room-templates-container {
  padding: 4px 0 12px 0;
}
.template-card {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.template-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

/* ── Top-Left Activity Circular Progress Indicator (White Pill) ── */
#actCircleLoader {
  position: absolute;
  z-index: 65;
  top: calc(max(8px, env(safe-area-inset-top)) + 48px);
  left: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #ffffff;
  color: #0f172a;
  padding: 6px 16px 6px 7px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 6px 22px rgba(15, 23, 42, 0.22);
  animation: actCirclePopIn 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.15);
  cursor: pointer;
  user-select: none;
}

#actCircleLoader:active {
  transform: scale(0.97);
}

@keyframes actCirclePopIn {
  0% { transform: scale(0.65) translateY(-8px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

.act-circle-ring-wrap {
  position: relative;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.act-circle-svg {
  position: absolute;
  inset: 0;
  width: 44px;
  height: 44px;
  transform: rotate(-90deg);
}

.act-circle-track {
  fill: #f8fafc;
  stroke: #e2e8f0;
  stroke-width: 4.5;
}

.act-circle-fill {
  fill: none;
  stroke: #16a34a;
  stroke-width: 4.5;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.15s linear;
}

.act-circle-emoji {
  position: relative;
  z-index: 1;
  font-size: 1.25rem;
  line-height: 1;
}

.act-circle-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.22;
  max-width: 195px;
}

.act-circle-meta b {
  font-size: 0.88rem;
  font-weight: 800;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.act-circle-meta small {
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
}

/* ── Hide #needs when travelling so it never overlaps #travelCard ── */
body.travelling #needs {
  display: none !important;
}

/* ── Lady K Night Club Hype Man / DJ Shoutout Banner ───────────── */
#hypeShoutoutBanner {
  position: fixed;
  z-index: 260;
  top: calc(max(12px, env(safe-area-inset-top)) + 64px);
  left: 50%;
  transform: translateX(-50%);
  width: min(92vw, 430px);
  pointer-events: auto;
  animation: hypePopIn 0.32s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

@keyframes hypePopIn {
  0% { transform: translateX(-50%) scale(0.75) translateY(-16px); opacity: 0; }
  100% { transform: translateX(-50%) scale(1) translateY(0); opacity: 1; }
}

.hype-banner-card {
  background: rgba(18, 8, 36, 0.96);
  border: 2.5px solid #ec4899;
  border-radius: 26px;
  padding: 20px 18px;
  text-align: center;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.65), 0 0 24px rgba(236, 72, 153, 0.45);
  backdrop-filter: blur(12px);
}

.hype-banner-sub {
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: #f472b6;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.hype-banner-title {
  font-size: 1.48rem;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 0.03em;
  line-height: 1.15;
  margin-bottom: 6px;
}

.hype-banner-user {
  font-size: 1.55rem;
  font-weight: 900;
  color: #fde047;
  line-height: 1.2;
}

.hype-banner-user span.bang {
  color: #ffffff;
}
