:root {
    --gold: #f5b800;
    --blue: #2f6fed;
    --black: #222;
    --green: #3aa655;
    --violet: #8e44ad;
    --red: #d93a3a;
  }
  * { margin: 0; padding: 0; box-sizing: border-box; }
  html, body { height: 100%; }
  body { font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
  #header {
    position: absolute; top: 0; left: 0; right: 0; z-index: 1100;
    background: rgba(255,255,255,.94); backdrop-filter: blur(6px);
    border-bottom: 1px solid #e3e3e3;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: clamp(8px, 1.2vw, 16px) clamp(14px, 2.5vw, 28px);
  }
  #header .brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
  #header h1 { font-size: clamp(15px, 1.6vw, 22px); font-weight: 700; color: #1a1a1a; white-space: nowrap; }
  #header .tag { font-size: clamp(10px, 1vw, 13px); color: #666; white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.35; }
  nav { display: flex; align-items: center; gap: clamp(8px, 1.2vw, 20px); flex-wrap: wrap; justify-content: flex-end; }
  nav a, nav button.lang {
    font-size: clamp(11px, 1.05vw, 15px); color: #333; text-decoration: none;
    padding: 4px 8px; border-radius: 6px; white-space: nowrap; transition: background .15s, color .15s;
  }
  nav a:hover, nav button.lang:hover { background: #f0f0f0; color: #000; }
  nav a.hidden { display: none; }
  nav button.lang { background: none; border: 1px solid #ccc; cursor: pointer; font-weight: 600; }
  /* lang FAB — fixed right circle, works same on all sizes */
  #lang-picker { position: fixed; right: 14px; z-index: 9999; }
  #lang-trigger {
    width: 44px; height: 44px; border-radius: 50%; cursor: pointer;
    background: rgba(255,255,255,.96); border: 2px solid var(--gold);
    box-shadow: 0 4px 18px rgba(0,0,0,.18);
    display: flex; align-items: center; justify-content: center;
    transition: transform .15s, background .15s;
    padding: 0; font-size: 14px; font-weight: 700; color: #333;
  }
  #lang-trigger:hover { background: #f5efe0; transform: scale(1.08); }
  #lang-trigger:active { transform: scale(.94); }
  #lang-dropdown {
    display: none; position: absolute; background: #fff; border: 1px solid #ddd; border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,.15); flex-direction: column; min-width: 68px; overflow: hidden; z-index: 1200;
  }
  #lang-dropdown.open { display: flex; }
  .lang-opt {
    background: none; border: none; padding: 10px 20px;
    font-size: 14px; font-weight: 600; cursor: pointer; text-align: center; letter-spacing: .5px;
  }
  .lang-opt:hover { background: #f5efe0; }
  .lang-opt.active { background: var(--gold); color: #fff; }
  /* right-side floating actions: share (top) + inbox (below), both small */
  .fab {
    position: fixed; right: 14px; z-index: 1500;
    width: 44px; height: 44px; border-radius: 50%; cursor: pointer;
    background: rgba(255,255,255,.96); border: 2px solid var(--gold);
    box-shadow: 0 4px 18px rgba(0,0,0,.18);
    display: flex; align-items: center; justify-content: center;
    font-size: 19px; line-height: 1; transition: transform .15s, background .15s;
  }
  .fab:hover { background: #f5efe0; transform: scale(1.08); }
  .fab:active { transform: scale(.94); }
  #inbox-fab { top: calc(50% - 52px); }
  #share-fab { top: calc(50% + 2px); }
  #lang-picker { top: calc(50% - 114px); }
  #lang-dropdown { bottom: calc(100% + 8px); right: -8px; }  /* desktop: opens upward */
  #inbox-badge {
    position: absolute; top: -4px; right: -4px; background: var(--red); color: #fff;
    border-radius: 10px; font-size: 11px; font-weight: 700; min-width: 19px; height: 19px;
    display: none; align-items: center; justify-content: center; padding: 0 5px;
    box-shadow: 0 1px 4px rgba(0,0,0,.25);
  }
  /* who's on the map — slideout filter with checkboxes + counts */
  #filter-panel {
    position: relative; z-index: 1000; display: flex; flex-direction: column; align-items: flex-start;
  }
  .pill-btn {
    background: var(--gold); border: none; border-radius: 9px; cursor: pointer;
    font-size: clamp(10px, 1vw, 13px); font-weight: 600; color: #1a1a1a; white-space: nowrap;
    padding: 0 14px; height: 34px; line-height: 1; box-sizing: border-box;
    box-shadow: 0 2px 10px rgba(0,0,0,.12); transition: filter .15s;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  }
  .pill-btn:hover { filter: brightness(1.06); }
  #filter-toggle b { background: #1a1a1a; color: var(--gold); border-radius: 8px; padding: 1px 7px; margin-left: 4px; font-size: .92em; line-height: 1; }
  #filter-body {
    display: none; position: absolute; bottom: calc(100% + 8px); left: 0; z-index: 1000;
    background: rgba(255,255,255,.97); border: 1px solid #ddd;
    border-radius: 10px; padding: 6px 12px; box-shadow: 0 6px 22px rgba(0,0,0,.18);
    font-size: clamp(11px, 1vw, 14px); min-width: 200px;
  }
  #filter-panel.open #filter-body { display: block; }
  #filter-body .frow { display: flex; align-items: center; gap: 8px; padding: 5px 0; cursor: pointer; user-select: none; }
  #filter-body .frow input { width: 16px; height: 16px; accent-color: var(--gold); cursor: pointer; }
  #filter-body .frow .flabel { flex: 1 1 auto; }
  #filter-body .fcount { color: #888; font-weight: 600; font-variant-numeric: tabular-nums; }
  #filter-body .frow.off .flabel { color: #aaa; text-decoration: line-through; }
  #filter-body .frow.off .fcount { color: #bbb; }
  #burger {
    display: none; background: none; border: none; cursor: pointer;
    width: 34px; height: 34px; border-radius: 8px; padding: 7px;
  }
  #burger:hover { background: #f0f0f0; }
  #burger span { display: block; height: 3px; border-radius: 2px; background: #333; margin: 5px 0; transition: transform .2s, opacity .2s; }
  #burger.open span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
  #burger.open span:nth-child(2) { opacity: 0; }
  #burger.open span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }
  #map { position: absolute; inset: 0; top: clamp(46px, 6.5vw, 68px); background: #e8e8e8; }
  .leaflet-tile { filter: saturate(.5) brightness(1.08) contrast(.9); }
  .person { width: 24px; height: 34px; }
  .person svg { width: 100%; height: 100%; display: block; }
  .you .person { width: 30px; height: 42px; filter: drop-shadow(0 2px 4px rgba(0,0,0,.4)); }
  .leaflet-interactive { cursor: pointer; }
  .marker-cluster-small, .marker-cluster-medium, .marker-cluster-large {
    background: rgba(245,184,0,.35); border: 2px solid var(--gold); border-radius: 50%;
  }
  .marker-cluster div {
    background: rgba(245,184,0,.85); color: #1a1a1a; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: 50%; margin: 7px; font-size: 13px;
  }
  #bottom-left {
    position: absolute; bottom: clamp(12px, 2vw, 20px); left: clamp(12px, 2vw, 20px);
    z-index: 1000; display: flex; align-items: flex-end; gap: 10px;
  }
  #what-btn.hidden { display: none; }
  #meet-bar {
    position: fixed; bottom: clamp(12px, 2vw, 16px); left: 50%; transform: translateX(-50%);
    z-index: 999;
  }
  #meet-btn {
    background: #fff; border: 2px solid var(--gold); border-radius: 9px; cursor: pointer;
    font-size: clamp(10px, 1vw, 13px); font-weight: 700; color: #1a1a1a; white-space: nowrap;
    padding: 0 16px; height: 34px; line-height: 1; box-sizing: border-box;
    box-shadow: 0 2px 10px rgba(0,0,0,.14); transition: filter .15s, background .15s;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  }
  #meet-btn:hover { background: #f5efe0; filter: brightness(1.03); }
  .meet-tbl { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 13px; }
  .meet-tbl th, .meet-tbl td { border: 1px solid #e3e3e3; padding: 8px 10px; text-align: left; }
  .meet-tbl th { background: #faf6ea; font-weight: 600; }
  .meet-link { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; word-break: break-all; color: var(--blue); }
  #meet-link-cell { display: flex; align-items: center; gap: 6px; }
  .meet-url { flex: 1 1 auto; word-break: break-all; }
  .meet-copy-btn { flex: 0 0 auto; background: none; border: none; cursor: pointer; font-size: 15px; padding: 2px 4px; line-height: 1; border-radius: 6px; }
  .meet-copy-btn:hover:not(:disabled) { background: #f0f0f0; }
  .meet-copy-btn:disabled { opacity: .35; cursor: default; }
  #meet-gen { background: var(--gold); border: none; border-radius: 8px; padding: 10px 18px; font-weight: 600; cursor: pointer; }
  #meet-gen:hover { filter: brightness(1.06); }
  .sw { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 0; vertical-align: -1px; flex: 0 0 auto; }
  #notify {
    position: fixed; top: clamp(56px, 7vw, 76px); left: 50%; transform: translateX(-50%);
    z-index: 3000; background: #333; color: #fff; border-radius: 10px;
    padding: 10px 18px; font-size: 13px; display: none; max-width: 90vw;
    box-shadow: 0 4px 16px rgba(0,0,0,.3);
  }
  #live-toast {
    position: fixed; bottom: clamp(70px, 12vh, 110px); left: 50%; transform: translateX(-50%);
    z-index: 3001; background: rgba(20,20,20,.93); color: #fff; border: 1px solid var(--gold);
    border-radius: 12px; padding: 9px 16px; font-size: 13px; display: none; max-width: 88vw;
    box-shadow: 0 4px 16px rgba(0,0,0,.35); pointer-events: none; text-align: center;
  }
  #modal {
    position: fixed; inset: 0; z-index: 2000; display: none;
    align-items: center; justify-content: center; background: rgba(0,0,0,.45);
  }
  #modal.open { display: flex; }
  #modal .box {
    background: #fff; border-radius: 14px; max-width: min(560px, 92vw);
    width: 100%; max-height: 80vh; overflow: auto;
    padding: clamp(16px, 2.5vw, 28px); box-shadow: 0 8px 40px rgba(0,0,0,.25);
  }
  #modal h2 { font-size: clamp(16px, 2vw, 24px); margin-bottom: 10px; color: #1a1a1a; }
  #modal p, #modal li, #modal .msg { font-size: clamp(12px, 1.3vw, 15px); color: #444; line-height: 1.65; }
  #modal ul { padding-left: 20px; margin: 8px 0; }
  #modal .close {
    float: right; border: none; background: #f0f0f0; border-radius: 8px; cursor: pointer;
    font-size: clamp(13px, 1.4vw, 17px); padding: 4px 12px; color: #333;
  }
  #modal .close:hover { background: #e0e0e0; }
  #chat-wrap { display: flex; flex-direction: column; height: min(60vh, 460px); min-height: 300px; }
  #chat-msgs { flex: 1; overflow-y: auto; border: 1px solid #eee; border-radius: 10px; padding: 10px; margin-bottom: 10px; background: #fafafa; display: flex; flex-direction: column; gap: 6px; }
  #chat-msgs .msg { padding: 7px 10px; border-radius: 10px; max-width: 80%; font-size: 14px; word-wrap: break-word; }
  #chat-msgs .mine { align-self: flex-end; background: var(--gold); color: #1a1a1a; }
  #chat-msgs .theirs { align-self: flex-start; background: #e9e9e9; color: #222; }
  #chat-msgs .sys { align-self: center; font-size: 11px; color: #999; font-style: italic; }
  #chat-input-row { display: flex; gap: 8px; }
  #chat-input { flex: 1; padding: 9px; border: 1px solid #ccc; border-radius: 8px; font-size: 14px; }
  #chat-send { background: var(--gold); border: none; border-radius: 8px; padding: 9px 16px; font-weight: 600; cursor: pointer; }
  .inbox-item { border-bottom: 1px solid #eee; padding: 9px 4px; }
  .inbox-item b { font-size: 13px; }
  .inbox-item .ib-actions { display: flex; gap: 8px; margin-top: 6px; }
  .inbox-item button { border: 1px solid #ccc; background: #fff; border-radius: 6px; padding: 4px 10px; cursor: pointer; font-size: 12px; }
  .inbox-item button:hover { background: #f0f0f0; }
  .chat-row { display: flex; gap: 10px; align-items: center; border-bottom: 1px solid #eee; padding: 10px 4px; cursor: pointer; }
  .chat-row:hover { background: #faf6ea; }
  .chat-row .cr-main { flex: 1; min-width: 0; }
  .chat-row .cr-name { font-size: 13px; font-weight: 700; }
  .chat-row .cr-last { font-size: 12px; color: #777; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .chat-row .cr-meta { text-align: right; flex: 0 0 auto; }
  .chat-row .cr-time { font-size: 11px; color: #999; }
  .chat-row .cr-unread { background: var(--red); color: #fff; border-radius: 9px; min-width: 18px; height: 18px; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; margin-top: 3px; }
  #search-input { width: 100%; padding: 9px; border: 1px solid #ccc; border-radius: 8px; font-size: 14px; margin-bottom: 10px; }
  .inbox-note {
    background: #faf6ea; border: 1px solid var(--gold); border-radius: 8px;
    padding: 8px 12px; font-size: 12px; color: #6a5b00; margin-bottom: 10px; line-height: 1.5;
  }
  .inbox-note a { color: var(--blue); font-weight: 600; text-decoration: underline; cursor: pointer; }
  .sr-row { display: flex; gap: 8px; align-items: center; border-bottom: 1px solid #eee; padding: 9px 4px; font-size: 13px; }
  .sr-row .sr-name { flex: 1; min-width: 0; }
  .sr-row button { border: 1px solid #ccc; background: #fff; border-radius: 6px; padding: 4px 10px; cursor: pointer; font-size: 12px; flex: 0 0 auto; }
  .sr-row button:hover { background: #f0f0f0; }
  .person.active-partner { border: 2px solid var(--green); border-radius: 10px; animation: partnerGlow 1.7s ease-in-out infinite; }
  @keyframes partnerGlow {
    0%, 100% { box-shadow: 0 0 8px 2px rgba(245,184,0,.55); }
    50% { box-shadow: 0 0 18px 7px rgba(245,184,0,.95); }
  }
  @media (max-width: 768px) {
    #header { flex-wrap: wrap; gap: 8px; }
    #header .brand { flex: 1 1 auto; min-width: 0; }
    #header h1 { white-space: nowrap; }
    #burger { display: block; }
    nav {
      display: none; flex-direction: column; align-items: stretch;
      flex: 0 0 100%; width: 100%; gap: 2px; padding: 8px 0 4px;
      border-top: 1px solid #eee; margin-top: 4px;
    }
    nav.open { display: flex; }
    nav a, nav button.lang { padding: 10px 8px; border-radius: 8px; font-size: clamp(13px, 3.6vw, 16px); }
    nav button.lang { border: none; text-align: left; background: none; }
    #map { top: clamp(46px, 12.5vw, 68px); }
    #bottom-left { flex-direction: column; align-items: flex-start; gap: 6px; }
    #what-btn { position: fixed; right: clamp(10px, 3vw, 16px); bottom: clamp(10px, 3vw, 16px); left: auto; z-index: 1001; }
    #meet-bar { bottom: clamp(56px, 9vh, 64px); }
    #filter-body { font-size: clamp(11px, 3.4vw, 14px); min-width: 170px; }
    .fab { width: 38px; height: 38px; font-size: 17px; }
    /* mobile: lang FAB smaller, dropdown opens downward */
    #lang-picker { top: calc(50% - 100px); }
    #lang-trigger { width: 38px; height: 38px; font-size: 12px; }
    #lang-dropdown { bottom: auto; top: calc(100% + 4px); right: -6px; }
  }