:root {
  --tea: #7b4a2b;
  --tea-dark: #4a2c1a;
  --milk: #f6ead6;
  --paper: #fbf4e6;
  --ink: #2b1d14;
  --muted: #8a7364;
  --line: #e5d5bc;
  --gold: #e2a530;
  --red: #c8372d;
  --green: #1f6b4a;
  --shadow: 0 6px 20px rgba(74, 44, 26, .15);
  font-family: 'Noto Sans Myanmar', 'Padauk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper);
  line-height: 1.6;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { line-height: 1.5; }

.screen { display: none; flex-direction: column; height: 100vh; height: 100dvh; }
.screen.active { display: flex; }

/* ---------- shared bits ---------- */

.btn {
  border: 0;
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 600;
  background: #efe0c6;
  white-space: nowrap;
  transition: transform .08s, filter .15s;
}
.btn:active { transform: scale(.97); }
.btn:hover { filter: brightness(1.05); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn.primary { background: var(--tea); color: var(--milk); box-shadow: 0 3px 0 var(--tea-dark); }
.btn.ghost { background: transparent; border: 1.5px solid currentColor; }
.btn.small { padding: 6px 12px; font-size: 14px; }
.btn.wide { width: 100%; }

.icon-btn {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, .14);
  font-size: 20px;
  line-height: 1;
}

.row { display: flex; gap: 8px; align-items: center; }
.row.end { justify-content: flex-end; flex-wrap: wrap; margin-top: 16px; }
.features-link { display: block; margin-top: 12px; text-align: center; font-size: 14px; font-weight: 600; color: var(--tea); }
.muted { color: var(--muted); }

.field { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 14px; }
.field input, .restore input, .dev-note {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-size: 16px;
  font-weight: 400;
}
.dev-note { resize: vertical; min-height: 110px; font-family: inherit; line-height: 1.6; }
.field input:focus, .restore input:focus, .composer input:focus, .name-under:focus, .dev-note:focus {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1.5px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 14px;
}
.chip.live { border-color: var(--gold); background: #fff6e0; }
.chip b { color: var(--red); }

.topbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 58px;
  padding: 8px 12px;
  padding-top: max(8px, env(safe-area-inset-top));
  background: var(--tea-dark);
  color: var(--milk);
  box-shadow: 0 2px 0 var(--gold);
  position: relative;
  z-index: 20;
}
.topbar h1 {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.title-sm { font-family: 'Padauk', 'Noto Sans Myanmar', sans-serif; color: #fff3c4; }

.pill {
  flex: none;
  background: rgba(255, 255, 255, .14);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 13px;
  white-space: nowrap;
}

.lang-toggle {
  flex: none;
  border: 1.5px solid currentColor;
  background: transparent;
  border-radius: 999px;
  min-height: 34px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 700;
}

.me-chip {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: rgba(255, 255, 255, .12);
  border-radius: 999px;
  padding: 3px 12px 3px 3px;
  max-width: 150px;
}
.me-chip .face {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--milk);
  overflow: hidden;
  display: block;
}
.me-chip .face svg { width: 100%; height: 100%; display: block; }
.me-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.me-chip.compact { padding-right: 3px; }
.me-chip.compact .me-name { display: none; }

/* ---------- start ---------- */

#screen-start {
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 16px;
  background:
    radial-gradient(circle at 20% 15%, rgba(226, 165, 48, .25), transparent 40%),
    radial-gradient(circle at 85% 90%, rgba(200, 55, 45, .25), transparent 45%),
    var(--tea-dark);
}
.start-card {
  width: min(440px, 100%);
  margin: auto;
  background: var(--paper);
  border-radius: 22px;
  padding: 18px 20px 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .35);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.start-card .row { justify-content: stretch; }
.start-card .row .btn { flex: 1; }
.lang-row { display: flex; justify-content: flex-end; color: var(--tea); }
.signboard {
  background: var(--green);
  border: 4px solid var(--gold);
  border-radius: 12px;
  padding: 10px 12px 6px;
  text-align: center;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .15), 0 6px 0 #14402c;
  display: flex;
  flex-direction: column;
}
.sign-title {
  font-family: 'Padauk', 'Noto Sans Myanmar', sans-serif;
  font-size: clamp(28px, 8vw, 38px);
  color: #fff3c4;
  line-height: 1.7;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .3);
}
.sign-sub { color: #cfe8d8; font-size: 12px; letter-spacing: 2px; text-transform: uppercase; }
.tagline { margin: 0; text-align: center; color: var(--muted); }
.start-avatar {
  height: 210px;
  display: flex;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 92%, rgba(123, 74, 43, .25), transparent 55%);
}
.start-avatar svg { height: 100%; }
.restore { font-size: 14px; color: var(--muted); }
.restore summary { cursor: pointer; }
.restore .row { margin-top: 8px; }
.restore input { text-transform: uppercase; letter-spacing: 1px; }

/* ---------- avatar editor ---------- */

.avatar-layout { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.avatar-stage {
  flex: none;
  height: 34vh; /* for phones too old for dvh */
  height: 34dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px;
  background:
    radial-gradient(ellipse at 50% 95%, rgba(123, 74, 43, .3), transparent 50%),
    linear-gradient(#3f8f8a 0 60%, #efe3cf 60%);
}
.avatar-preview { flex: 1; min-height: 0; display: flex; justify-content: center; }
.avatar-preview svg { height: 100%; }
.name-under {
  margin-top: 4px;
  text-align: center;
  border: 0;
  border-radius: 999px;
  padding: 4px 14px;
  background: rgba(255, 255, 255, .85);
  font-weight: 700;
  width: min(220px, 80%);
  font-size: 16px;
}
.avatar-options {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 12px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}
.tabs { display: flex; gap: 6px; overflow-x: auto; flex: none; scrollbar-width: none; }
.tab {
  flex: none;
  border: 1.5px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 4px 14px;
  font-size: 14px;
}
.tab.active { background: var(--tea); color: var(--milk); border-color: var(--tea); }
.avatar-panel { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.option-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 14px;
}
.option.active { border-color: var(--gold); background: #fff6e0; box-shadow: 0 0 0 2px rgba(226, 165, 48, .3); }
.option-art { display: flex; justify-content: center; height: 84px; }
.option-art svg { height: 100%; }
.option-label { font-size: 13px; text-align: center; line-height: 1.4; }
.swatch-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.swatch-title { font-size: 13px; color: var(--muted); width: 100%; }
.swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid #fff;
  background: var(--sw);
  box-shadow: 0 0 0 1.5px var(--line);
}
.swatch.active { box-shadow: 0 0 0 3px var(--gold); }
.code-box { background: #fff6e0; border: 1.5px dashed var(--gold); border-radius: 12px; padding: 8px 12px; }
.code-box small { color: var(--muted); display: block; }
.code-box code { flex: 1; font-size: 18px; font-weight: 700; letter-spacing: 2px; color: var(--tea); }
.code-box .btn { color: var(--tea); }

/* ---------- map ---------- */

.map-layout { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.map-scroll { flex: 1; min-height: 0; overflow: auto; background: #e6dcc6; -webkit-overflow-scrolling: touch; }
.map-svg { display: block; height: auto; margin: 0 auto; }
.cell { stroke: #fff8ec; stroke-width: 3; stroke-linejoin: round; cursor: pointer; transition: filter .15s; }
.cell:hover { filter: brightness(1.07) saturate(1.15); }
.cell.selected { filter: brightness(1.1) saturate(1.3); }
.sel-outline { fill: none; stroke: var(--tea-dark); stroke-width: 5; stroke-linejoin: round; pointer-events: none; }
.river { fill: none; stroke: #8ec5d6; stroke-width: 46; stroke-linecap: round; }
.river.creek { stroke-width: 16; }
.river-label { font-size: 14px; fill: #3d7f92; font-style: italic; text-anchor: middle; }
.lake { fill: #8ec5d6; stroke: #6fb0c4; stroke-width: 2; pointer-events: none; }
.lake-label { font-size: 10px; fill: #24606f; text-anchor: middle; pointer-events: none; }
.label { cursor: pointer; }
.label text { text-anchor: middle; paint-order: stroke; stroke: #fff8ec; stroke-linejoin: round; }
.label-my { font-size: 17px; font-weight: 700; fill: var(--ink); stroke-width: 4px; }
.label-en { font-size: 11px; fill: #6b5444; stroke-width: 3px; }
.label.small .label-my { font-size: 12.5px; }
.label.small .label-en { font-size: 9px; }
.badge rect { fill: var(--red); }
.badge text { fill: #fff; stroke: none; font-size: 12px; font-weight: 700; }
.landmark { pointer-events: none; }
.landmark-label { font-size: 11px; font-weight: 700; text-anchor: middle; fill: #8a5a14; paint-order: stroke; stroke: #fff8ec; stroke-width: 3px; }

.panel {
  flex: none;
  max-height: 44vh;
  max-height: 44dvh;
  overflow: auto;
  background: var(--paper);
  border-radius: 18px 18px 0 0;
  margin-top: -14px;
  position: relative;
  box-shadow: 0 -6px 20px rgba(74, 44, 26, .2);
  padding: 12px 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}
.panel h2 { margin: 0 0 4px; font-size: 18px; }
.panel h3 { margin: 14px 0 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.panel-head { display: flex; align-items: center; gap: 10px; }
.panel-head .icon-btn { background: #efe0c6; color: var(--tea-dark); }
.panel-head h2 { margin: 0; }
.shop-list { display: flex; flex-direction: column; gap: 8px; }
.shop-card {
  display: grid;
  grid-template-columns: 58px 1fr auto;
  gap: 10px;
  align-items: center;
  text-align: left;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 8px;
}
.shop-card:hover { border-color: var(--gold); }
.shop-card-sign {
  height: 58px;
  border-radius: 10px;
  background: var(--sign);
  border: 2px solid var(--gold);
  color: #fff3c4;
  font-family: 'Padauk', 'Noto Sans Myanmar', sans-serif;
  font-size: 13px;
  line-height: 1.5;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 2px;
  overflow: hidden;
}
.shop-card-body { display: flex; flex-direction: column; min-width: 0; line-height: 1.5; }
.shop-card-body strong { font-size: 15px; }
.shop-card-body small { font-size: 12px; }
.shop-card-count { display: flex; flex-direction: column; font-size: 12px; text-align: right; color: var(--muted); }

/* ---------- shop ---------- */

.shop-sign {
  flex: 1;
  min-width: 0;
  background: var(--sign, var(--green));
  border: 2px solid var(--gold);
  border-radius: 8px;
  padding: 0 10px;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
}
.shop-sign strong {
  font-family: 'Padauk', 'Noto Sans Myanmar', sans-serif;
  font-size: 19px;
  color: #fff3c4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.shop-sign span { font-size: 11px; color: rgba(255, 255, 255, .8); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- shop room ---------- */

.room-layout { flex: 1; min-height: 0; display: flex; position: relative; }
.room-wrap { position: relative; flex: 1; min-width: 0; background: #2c211a; overflow: hidden; }
#room-canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: pointer; }

.hud-top {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}
.hud-top > * { pointer-events: auto; }
.zoom { display: flex; gap: 6px; }
.hud-left { display: flex; gap: 6px; align-items: center; min-width: 0; }
.sky-pill { font-size: 13px; padding: 6px 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-btn {
  border: 0;
  border-radius: 999px;
  background: rgba(43, 29, 20, .82);
  color: var(--milk);
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}
.zoom .hud-btn { width: 38px; height: 38px; padding: 0; font-size: 18px; }

/* how badly you need the toilet; tap to walk there */
.hud-btn.bladder { position: absolute; top: 58px; left: 10px; font-size: 13px; }
.kick-btn {
  position: absolute;
  left: 50%;
  bottom: 74px;
  transform: translateX(-50%);
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 4px solid #fff;
  background: #2fa564;
  color: #fff;
  font-size: 38px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .35);
  z-index: 6;
}
.kick-btn:active { transform: translateX(-50%) scale(.92); }
.hud-btn.bladder.full { background: #c8372d; animation: urgent 0.6s ease-in-out infinite alternate; }
@keyframes urgent { from { transform: translateX(-2px); } to { transform: translateX(2px); } }

.toilet-overlay {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  background: rgba(36, 54, 60, .82);
}
.toilet-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: #f4f7f6;
  border-radius: 20px;
  padding: 22px 28px;
  min-width: 240px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
.toilet-icon { font-size: 54px; line-height: 1.2; animation: urgent 1.2s ease-in-out infinite alternate; }
.toilet-bar { width: 100%; height: 10px; border-radius: 999px; background: #d7e2e0; overflow: hidden; }
.toilet-bar span { display: block; height: 100%; width: 0; background: #2fa564; transition: width .25s linear; }

.key-help {
  position: absolute;
  left: 50%;
  top: 58px; /* under the top buttons, clear of the time pill */
  transform: translateX(-50%);
  max-width: min(560px, calc(100% - 340px));
  text-align: center;
  background: rgba(43, 29, 20, .7);
  color: #f3e6cf;
  font-size: 12px;
  border-radius: 10px;
  padding: 4px 10px;
  pointer-events: none;
  transition: opacity .6s;
}
.key-help.faded { opacity: 0; }
.say-toggle { display: none; }

.joystick {
  display: none;
  position: absolute;
  left: 18px;
  bottom: 18px;
  width: 116px;
  height: 116px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .16);
  border: 2px solid rgba(255, 255, 255, .35);
  touch-action: none;
}
.stick {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 52px;
  height: 52px;
  margin: -26px;
  border-radius: 50%;
  background: rgba(246, 234, 214, .85);
  box-shadow: 0 3px 10px rgba(0, 0, 0, .3);
  pointer-events: none;
}

.hud-actions {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.hud-actions.seated { display: none; }
.action-btn {
  border: 0;
  border-radius: 999px;
  min-width: 52px;
  height: 52px;
  padding: 0 16px;
  background: rgba(246, 234, 214, .95);
  color: var(--tea-dark);
  font-size: 22px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .3);
}
.action-btn.spit-btn { display: none; } /* phones only, while chewing */
.action-btn.primary { background: var(--tea); color: var(--milk); font-size: 16px; box-shadow: 0 4px 0 var(--tea-dark), 0 6px 14px rgba(0, 0, 0, .3); }
.action-btn kbd {
  font: inherit;
  font-size: 11px;
  background: rgba(255, 255, 255, .2);
  border-radius: 6px;
  padding: 1px 6px;
  margin-left: 4px;
}
.emote-menu {
  position: absolute;
  right: 0;
  bottom: 62px;
  display: grid;
  grid-template-columns: repeat(4, 64px);
  gap: 6px;
  background: rgba(43, 29, 20, .9);
  border-radius: 16px;
  padding: 8px;
}
.emote-btn {
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, .1);
  color: #fff;
  font-size: 24px;
  padding: 4px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.3;
}
.emote-btn small { font-size: 10px; color: #f3e6cf; }
.emote-btn:hover { background: rgba(255, 255, 255, .22); }

.say-bar {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  width: min(440px, calc(100% - 330px));
  display: flex;
  gap: 6px;
}
.say-bar input {
  flex: 1;
  min-width: 0;
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 16px;
  background: rgba(255, 255, 255, .95);
  box-shadow: 0 3px 10px rgba(0, 0, 0, .25);
}

/* table chat panel: side column on wide screens, bottom sheet on phones */
.table-panel {
  display: flex;
  flex-direction: column;
  background: var(--paper);
  width: 380px;
  flex: none;
  border-left: 2px solid var(--gold);
  min-height: 0;
}
.tp-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}
.tp-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.45; }
.tp-title strong { font-size: 14px; }
.tp-title span { font-size: 13px; color: var(--tea); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.voice-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: #f2f7f0;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.voice-bar small { font-size: 11px; }
/* voice and the people at the table: stacked on wide screens, one row on phones */
.tp-row { display: contents; }
.btn.voice-join { background: #1f6b4a; color: #fff; }
.bill-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px 12px;
  background: #fff6e0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.bill-mine { flex: 1; font-weight: 600; color: var(--tea); }
.btn.treat { background: #2fa564; color: #fff; }
.sys.treat { color: #1f6b4a; font-weight: 700; }
.menu-item .price { font-size: 12px; color: var(--tea); }
.pill.wallet { background: rgba(226, 165, 48, .25); }
.menu-item.day.active { border-color: #7a1f2c; background: #fbe9ec; }
.fortune-card { display: flex; flex-direction: column; gap: 10px; }
.fc-day { display: flex; align-items: center; gap: 12px; }
.fc-day h2 { margin: 0; }
.fc-emoji { font-size: 44px; }
.fc-stars b { color: #e2a530; font-size: 20px; letter-spacing: 2px; }
.fc-reading { margin: 0; font-size: 18px; font-weight: 700; color: #7a1f2c; background: #fbe9ec; border-radius: 12px; padding: 10px 14px; }
.fc-row { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dashed var(--line); padding-bottom: 6px; }
.fc-row b { display: flex; align-items: center; gap: 6px; text-align: right; }
.fc-swatch { width: 16px; height: 16px; border-radius: 50%; background: var(--c); border: 1.5px solid rgba(0,0,0,.2); display: inline-block; }
.fc-number { font-size: 20px; color: #7a1f2c; }
.fixture { display: flex; align-items: center; justify-content: center; gap: 14px; font-size: 18px; margin: 6px 0 4px; }
.fixture b { font-size: 22px; }
.team { display: flex; align-items: center; gap: 6px; font-weight: 700; }
.team i { width: 14px; height: 14px; border-radius: 4px; background: var(--c); border: 1px solid rgba(0,0,0,.25); }
.picks { flex-direction: row; }
.picks .btn { flex: 1; }
.carry { display: flex; flex-direction: column; gap: 10px; }
.mic-help ol { margin: 4px 0 8px; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.mic-help p { margin: 6px 0; }
.carry-row { font-size: 26px; text-align: center; }
.carry-amount { color: var(--tea); }
.carry input[type=range] { width: 100%; accent-color: var(--tea); }
.btn.mic-on { background: #2fa564; color: #fff; }
.members {
  flex: none;
  display: flex;
  gap: 6px;
  padding: 6px 10px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}
.member {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 62px;
  border: 0;
  background: transparent;
  padding: 2px;
  border-radius: 10px;
  position: relative;
}
.member:hover { background: #f3e6cf; }
.member-face { width: 38px; height: 38px; border-radius: 50%; background: var(--milk); overflow: hidden; }
.member-face svg { width: 100%; height: 100%; display: block; }
.member.me .member-face { box-shadow: 0 0 0 2px var(--gold); }
.member.blocked { opacity: .45; }
.member-name { font-size: 11px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.5; }
.member-voice { position: absolute; top: 0; right: 6px; font-size: 12px; }
.msg-more {
  flex: none;
  align-self: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  padding: 0 4px;
  opacity: .5;
}
.msg:hover .msg-more { opacity: 1; }

/* login */
.login-box { display: flex; flex-direction: column; gap: 6px; }
.login-buttons { display: flex; flex-direction: column; gap: 8px; align-items: stretch; text-align: center; }
.btn.login {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  border: 1.5px solid var(--line);
  background: #fff;
}
.btn.login .g {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-family: system-ui, sans-serif;
  color: #fff;
}
.btn.login .g { background: conic-gradient(#ea4335 0 25%, #fbbc05 0 50%, #34a853 0 75%, #4285f4 0); }
.logged-in {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
  background: #eef7f0;
  border: 1.5px solid #bfe0c8;
  border-radius: 12px;
  padding: 6px 10px;
  font-size: 13px;
}
.logged-in .btn { color: var(--tea); }

/* gender toggle */
.gender-toggle { flex: none; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.gender-toggle button {
  border: 2px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 6px;
  font-weight: 700;
}
.gender-toggle button.active { border-color: var(--gold); background: #fff6e0; }

/* person menu, report, table list */
.pm-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.pm-face { width: 76px; height: 96px; flex: none; background: var(--milk); border-radius: 14px; overflow: hidden; }
.pm-face svg { width: 100%; height: 100%; }
.pm-head h2 { margin: 0; }
.pm-actions { display: flex; flex-direction: column; gap: 8px; }
.btn.danger { background: #f8e3de; color: var(--red); border: 1.5px solid var(--red); }
.tl-items { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.tl-item {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 8px 10px;
}
.tl-item:hover { border-color: var(--gold); }
.tl-num { width: 32px; height: 32px; border-radius: 50%; background: var(--tea); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.tl-body { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.5; }
.tl-body small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-count { font-weight: 700; color: var(--tea); }

@media (pointer: coarse) {
  .joystick { display: block; }
  .key-help { display: none; }
}

/* phones and touch screens: the say bar folds away behind 💬 */
@media (pointer: coarse), (max-width: 899px) {
  .say-toggle { display: block; }
  /* walking on a phone: just talk and act; emotes live in the table chat */
  #btn-emotes, .emote-menu { display: none; }
  .action-btn.spit-btn:not([hidden]) { display: block; }
  .kick-btn { left: auto; right: 16px; bottom: 80px; transform: none; }
  .kick-btn:active { transform: scale(.92); }
  .say-bar { display: none; top: 104px; bottom: auto; width: calc(100% - 20px); }
  .say-bar.open { display: flex; }
}

@media (max-width: 899px) {
  .table-panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    height: 56%;
    border-left: 0;
    border-top: 2px solid var(--gold);
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -6px 20px rgba(0, 0, 0, .3);
    z-index: 5;
  }
  .room-layout.seated .joystick { display: none; }
  .key-help { display: none; }
  /* the reactions scroll sideways: fade the edge so it's clear there are more */
  .chat-actions { padding-right: 30px; mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); }

  /* a compact table panel, so more of the chat (and the room) fits */
  .table-panel { height: 52%; }
  .tp-head { padding: 5px 10px; gap: 6px; }
  .tp-title { flex-direction: row; align-items: baseline; gap: 6px; }
  .tp-title strong { flex: none; font-size: 13px; }
  .tp-title span { font-size: 12px; }
  .tp-head .btn.small { padding: 3px 10px; font-size: 12px; }
  .tp-row { display: flex; align-items: center; border-bottom: 1px solid var(--line); background: #f2f7f0; min-height: 0; }
  .tp-row .voice-bar { flex: none; padding: 4px 4px 4px 10px; border-bottom: 0; flex-wrap: nowrap; gap: 4px; }
  .tp-row .voice-bar small { display: none; }
  .tp-row .voice-bar .btn.small { padding: 4px 10px; font-size: 12px; }
  .tp-row .members { flex: 1; min-width: 0; border-bottom: 0; padding: 3px 6px; gap: 2px; }
  .member { width: 42px; padding: 1px; }
  .member-face { width: 28px; height: 28px; }
  .member-name { font-size: 9.5px; line-height: 1.4; }
  .member-voice { right: 2px; font-size: 10px; }
  .bill-bar { padding: 3px 10px; font-size: 12px; }
  .bill-bar .btn.small { padding: 3px 10px; font-size: 12px; }
  .chat-log { padding: 6px 10px; gap: 4px; }
  .msg { gap: 6px; }
  .msg-face { width: 26px; height: 26px; }
  .msg-body { padding: 1px 10px 3px; font-size: 14px; }
  .msg-name { font-size: 11px; }
  .sys { font-size: 12px; }
  .chat-actions { padding-top: 4px; padding-bottom: 4px; padding-left: 8px; gap: 4px; }
  .btn.waiter { padding: 2px 10px; font-size: 12px; }
  .react-btn { width: 32px; height: 32px; font-size: 16px; }
  .composer { padding: 5px 8px; padding-bottom: max(5px, env(safe-area-inset-bottom)); gap: 6px; }
  .composer input { padding: 6px 14px; } /* stays 16px: smaller text makes iPhones zoom in */
  .composer .btn { padding: 6px 14px; }
}

/* phones held sideways: the chat sits beside the room instead of covering it */
@media (max-width: 899px) and (orientation: landscape) {
  .table-panel {
    top: 0;
    left: auto;
    width: min(380px, 52%);
    height: auto;
    border-top: 0;
    border-left: 2px solid var(--gold);
    border-radius: 18px 0 0 18px;
    box-shadow: -6px 0 20px rgba(0, 0, 0, .3);
  }
}

/* chat (table panel) */

.chat-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.msg { display: flex; gap: 8px; align-items: flex-start; }
.msg-face {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--milk);
  overflow: hidden;
}
.msg-face svg { width: 100%; height: 100%; display: block; }
.msg-body {
  min-width: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px 14px 14px 14px;
  padding: 2px 12px 4px;
}
.msg.mine .msg-body { background: #fde9c8; border-color: #f3d39b; }
.msg-name { font-size: 12px; font-weight: 700; color: var(--tea); }
.msg-name time { font-weight: 400; color: var(--muted); margin-left: 8px; font-size: 11px; }
.msg-body p { margin: 0; overflow-wrap: anywhere; }
.sys { text-align: center; font-size: 12.5px; color: var(--muted); }
.sys.order { color: var(--tea); }
.sys.welcome { background: #fff6e0; border-radius: 10px; padding: 4px 10px; align-self: center; }
.chat-actions {
  flex: none;
  display: flex;
  gap: 6px;
  padding: 6px 10px;
  border-top: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.btn.waiter { background: #fde9c8; border: 1.5px solid var(--gold); padding: 4px 12px; font-size: 13px; }
.reactions { display: flex; gap: 4px; }
.react-btn {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 18px;
  line-height: 1;
}
.react-btn:active { transform: scale(.9); }
.composer {
  flex: none;
  display: flex;
  gap: 8px;
  padding: 8px 10px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
}
.composer input {
  flex: 1;
  min-width: 0;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 9px 16px;
  background: #fff;
  font-size: 16px;
}

/* ---------- modal / toast ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(30, 18, 10, .5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.modal-card {
  width: min(560px, 100%);
  max-height: 86vh;
  max-height: 86dvh;
  overflow: auto;
  background: var(--paper);
  border-radius: 20px 20px 0 0;
  padding: 18px;
  padding-bottom: max(18px, env(safe-area-inset-bottom));
  animation: slide-up .2s ease-out;
}
@keyframes slide-up { from { transform: translateY(30px); opacity: 0; } }
.modal-card h2 { margin: 0 0 10px; font-size: 20px; }
.modal-card h3 { margin: 14px 0 6px; font-size: 14px; color: var(--muted); }
.create-form { display: flex; flex-direction: column; gap: 12px; }
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.menu-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 8px 6px;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  line-height: 1.5;
}
.menu-item:hover { border-color: var(--gold); background: #fff6e0; }
.menu-emoji { font-size: 28px; }
.menu-name { font-weight: 700; font-size: 14px; }
.menu-item small { font-size: 10.5px; color: var(--muted); text-align: center; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 100;
  max-width: 90vw;
  background: var(--tea-dark);
  color: var(--milk);
  border: 1.5px solid var(--gold);
  border-radius: 999px;
  padding: 6px 18px;
  box-shadow: var(--shadow);
  text-align: center;
  animation: pop-toast .2s ease-out;
}
@keyframes pop-toast { from { transform: translate(-50%, 10px); opacity: 0; } }
.conn {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 101;
  background: var(--red);
  color: #fff;
  padding: 2px 14px;
  border-radius: 0 0 10px 10px;
  font-size: 13px;
}

/* ---------- wider screens ---------- */

@media (min-width: 900px) {
  .avatar-layout { flex-direction: row; }
  .avatar-stage { height: auto; width: 40%; padding: 24px; }
  .avatar-options { padding: 20px 24px; }

  .map-layout { flex-direction: row; }
  .panel {
    width: 380px;
    max-height: none;
    margin: 0;
    border-radius: 0;
    box-shadow: -4px 0 16px rgba(74, 44, 26, .15);
    padding: 18px 20px;
  }

  .me-chip.compact { padding-right: 12px; }
  .me-chip.compact .me-name { display: inline; }

  .modal { align-items: center; }
  .modal-card { border-radius: 20px; }
}
