:root {
  color: #56382b;
  background: #fff9ef;
  font: 700 14px / 1.45 ui-rounded, "Hiragino Maru Gothic ProN", "Yu Gothic", sans-serif;
  --ink: #56382b;
  --paper: #fdf8ed;
  --shadow: 0 4px 0 #5a3a2e45;
  --teal: #28ac9a;
  --green: #3cb758;
  --dock-width: 852px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; overflow: hidden; }
button, input, select, textarea { color: inherit; font: inherit; }
button, input, select, textarea {
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--paper);
}
button { cursor: pointer; }
button:enabled:hover { filter: brightness(1.045); }
button:active { translate: 0 1px; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid #256b60; outline-offset: 2px; }
h1, h2, p { margin: 0; }
small { font-size: 11px; }
canvas[data-glyph] { display: block; width: 22px; height: 22px; }

.stage {
  position: relative;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  isolation: isolate;
  border: 3px solid var(--ink);
  box-shadow: inset 0 0 0 3px #fff8eb;
}
.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 60;
  border: 4px solid #fff6e7;
  pointer-events: none;
}
.map-view { position: absolute; inset: 4px; overflow: hidden; background: #d9ded0; touch-action: none; image-rendering: pixelated; }
#map {
  position: absolute;
  left: 0;
  top: 0;
  width: 1440px;
  height: 900px;
  transform-origin: 0 0;
  cursor: crosshair;
  isolation: isolate;
  background-color: #e0e9d8;
  background-size: var(--tile-size, 128px) var(--tile-size, 128px);
  image-rendering: pixelated;
  outline-offset: -8px;
}
#map.in-room { background-color: #be8356; }
#scenery, #people { position: absolute; inset: 0; pointer-events: none; }
#scenery button, #people button { pointer-events: auto; }
.sprite, .patch, .zone-label, .landmark, .voice-range, .rug {
  position: absolute;
}
.sprite { object-fit: contain; image-rendering: pixelated; }
.room-building { object-fit: fill; }
.patch { background-size: var(--tile-size, 128px) var(--tile-size, 128px); }
.zone-label {
  transform: translateX(-50%);
  padding: 3px 15px;
  border: 2px solid #704b37;
  border-radius: 5px;
  color: #fff7e9;
  background: #c68a4d;
  box-shadow: 0 2px #67463052;
  text-shadow: 0 1px #674630;
  font-size: 12px;
  white-space: nowrap;
}
.landmark {
  transform: translateX(-50%);
  min-height: 42px;
  padding: 6px 13px;
  border-width: 3px;
  border-radius: 13px;
  background: var(--teal);
  box-shadow: 0 3px 0 var(--ink);
  color: #2f2720;
  font-weight: 900;
  white-space: nowrap;
}
.landmark.locked { background: #fff3dc; }
.voice-range {
  width: 320px;
  height: 320px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px solid #62514035;
  background: #e6ead31f;
}
.voice-range.group {
  width: 340px;
  height: 250px;
  border: 4px solid #38a69680;
  background: #3ed2bd12;
}
.rug {
  border: 2px solid #f6dfbd;
  box-shadow: 0 0 0 2px #4d7699;
  background: repeating-linear-gradient(135deg, #fff5 0 3px, transparent 3px 13px),
    repeating-linear-gradient(0deg, #71a4c6 0 8px, #9ac0dd 8px 12px, #5095c3 12px 16px);
  color: #f7eee6;
  display: grid;
  place-items: center;
  font-size: 28px;
  letter-spacing: 5px;
}
.picnic {
  border: 2px solid #90432e;
  background-color: #f2e7da;
  background-image: repeating-linear-gradient(0deg, transparent 0 10px, #bf453d75 10px 20px),
    repeating-linear-gradient(90deg, transparent 0 10px, #bf453d95 10px 20px);
}
.avatar {
  position: absolute;
  width: 66px;
  height: 66px;
  padding: 4px;
  transform: translate(-50%, -50%);
  border: 4px solid #60422e;
  border-radius: 50%;
  background: var(--ring, var(--green));
  box-shadow: 0 3px 0 #63423452;
}
.avatar img, .member-portrait img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}
.avatar .portrait, .member-portrait {
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--badge, #f3ca4f);
  border: 1px solid #fff3d9;
  border-radius: 50%;
}
.avatar .portrait img { scale: .84; }
.avatar .name {
  position: absolute;
  top: calc(100% + 5px);
  left: 50%;
  transform: translateX(-50%);
  padding: 1px 9px;
  white-space: nowrap;
  max-width: 148px;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  box-shadow: 0 2px 0 #56382b40;
  font-size: 12px;
}
.avatar .mic-off, .member-mic {
  display: grid;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
}
.avatar .mic-off { position: absolute; right: -10px; bottom: -7px; width: 23px; height: 23px; }
.avatar .mic-off::after { content: ""; height: 3px; width: 21px; background: var(--ink); rotate: -46deg; }
.avatar .bubble {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  translate: -50%;
  font-size: 30px;
  animation: appear .2s ease-out;
}
@keyframes appear { from { opacity: 0; scale: .7; } to { opacity: 1; scale: 1; } }
.away { --ring: #e98f42; }
.focus { --ring: #489bd0; }
.available { --ring: var(--green); }

.wood {
  background-color: #cd7a34;
  background-image: var(--wood-grain);
  background-size: 256px 106px;
  box-shadow: inset 0 -4px 0 #97532770, 0 4px 0 #75482783;
}
.floor-hud, .top-actions { position: absolute; top: 14px; z-index: 12; }
.floor-hud { left: 17px; width: 425px; }
#floors {
  width: 100%;
  min-height: 61px;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  border: 3px solid var(--ink);
  border-radius: 17px;
}
#floors button {
  border: 3px solid transparent;
  box-shadow: none;
  border-radius: 11px;
  background: transparent;
  color: #fff8e9;
  min-height: 44px;
  padding: 3px 17px;
  white-space: nowrap;
  text-shadow: 0 1px var(--ink), 1px 0 var(--ink), -1px 0 var(--ink);
  font-weight: 900;
}
#floors button[aria-pressed="true"] { color: var(--ink); border-color: var(--ink); background: var(--paper); text-shadow: none; }
#floors button small { margin-left: 6px; }
.floor-sub { display: flex; align-items: stretch; gap: 6px; margin-top: 6px; white-space: nowrap; }
.floor-caption, .today, .greeting, .demo-note, .room-bar {
  border: 3px solid var(--ink);
  border-radius: 13px;
  background: var(--paper);
  box-shadow: var(--shadow);
}
.floor-caption, .today { display: flex; align-items: center; min-height: 43px; padding: 3px 14px; font-size: 13px; }
.today { background: #ffe4d8; font-weight: 900; }
.greeting { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 9px; margin-top: 6px; }
.greeting > img { width: 33px; height: 44px; object-fit: contain; image-rendering: pixelated; flex: none; }
.greeting > div { flex: 1; }
.greeting b, .greeting small { display: block; }
.greeting small { margin-top: 3px; }
.teal, .orange { min-height: 40px; padding: 4px 11px; background: var(--teal); color: #32261f; font-weight: 900; }
.orange { background: #ff805e; }
.text-button { padding: 4px 7px; background: none; border: 0; }
.greeting .text-button { min-height: 38px; font-size: 12px; }
.top-actions { right: 17px; display: flex; align-items: center; gap: 9px; }
.round, .pill, .top-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 4px 11px;
  box-shadow: var(--shadow);
  background: var(--paper);
}
.round { padding: 0; width: 44px; height: 44px; }
.pill [data-icon="help"] canvas { width: 19px; height: 19px; }
.pill [data-icon="chevron"] canvas { width: 15px; height: 15px; }
.demo-note {
  position: absolute;
  z-index: 8;
  top: 73px;
  left: 50%;
  translate: -50%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 13px 6px 7px;
  border-radius: 999px;
  border-color: #d56856;
  background: #ffe9e1;
  min-height: 43px;
  white-space: nowrap;
  font-size: 12px;
}
.demo-note > span { padding: 4px 9px; border-radius: 999px; background: #ffb39d; }
.zoom {
  position: absolute;
  bottom: 13px;
  left: 17px;
  z-index: 12;
  display: grid;
  justify-items: center;
  gap: 5px;
  padding: 5px;
  width: 60px;
  border: 3px solid var(--ink);
  border-radius: 15px;
}
.zoom button { width: 44px; min-height: 43px; border-width: 3px; font-size: 19px; }
.zoom output { line-height: 1; color: white; text-shadow: 0 1px var(--ink); font-size: 11px; }
#zoom-all { min-height: 56px; font-size: 10px; line-height: 1.2; }
#zoom-all canvas { margin: 0 auto 2px; width: 16px; height: 16px; }

.dock {
  position: absolute;
  z-index: 15;
  left: 50%;
  bottom: 13px;
  translate: -50%;
  width: min(var(--dock-width), calc(100% - 36px));
  min-height: 103px;
  padding: 9px 11px 8px;
  border: 3px solid var(--ink);
  border-radius: 22px 21px 19px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}
.dock-action {
  min-width: 58px;
  min-height: 73px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 2px 0;
  border: 0;
  background: none;
  color: #fff9ee;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.2;
  text-shadow: 0 1px var(--ink), 1px 0 var(--ink), -1px 0 var(--ink);
  white-space: nowrap;
}
.dock-action > span:first-child {
  width: 55px;
  height: 55px;
  display: grid;
  place-items: center;
  border: 4px solid var(--ink);
  border-radius: 50%;
  box-shadow: 0 2px #6746309c;
  background: var(--paper);
  color: var(--ink);
  text-shadow: none;
}
.dock-action[aria-expanded="true"] > span:first-child { background: #f7c842; }
.dock-action:disabled { opacity: .61; }
.dock-action > span.push-key {
  border-radius: 13px;
  font-size: 11px;
  line-height: 1.25;
}
.dock-meter { color: #986131; letter-spacing: -1px; }
.dock-divider { align-self: center; height: 64px; width: 1px; background: #77462665; }
.status-dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--ink); background: var(--ring, var(--green)); flex: none; }
.dock .status-dot { width: 28px; height: 28px; border-width: 3px; }

.popover, .side-panel {
  position: absolute;
  z-index: 16;
  border: 3px solid var(--ink);
  border-radius: 17px;
  background: var(--paper);
  box-shadow: var(--shadow);
}
.popover { padding: 9px; }
.popover > button, #status-options > button {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  text-align: left;
}
.popover p { margin: 4px; line-height: 1.65; }
.top-popover { right: 17px; top: 64px; max-width: min(330px, calc(100% - 28px)); }
.today-popover { left: 17px; top: 199px; width: min(395px, calc(100% - 34px)); }
.room-bar { position: absolute; z-index: 12; top: 126px; left: 50%; translate: -50%; padding: 6px 11px; display: flex; gap: 14px; align-items: center; white-space: nowrap; }
.room-bar button { min-height: 38px; }
.status-picker { bottom: 121px; left: min(calc(50% + 135px), calc(100% - 248px)); width: 228px; }
.status-picker button { width: 100%; border: 0; }
#status-options button[aria-pressed="true"] { background: #eadfca; }
.area-picker { bottom: 121px; left: min(calc(50% + 210px), calc(100% - 238px)); width: 218px; display: grid; gap: 5px; }
.reaction-picker {
  bottom: 121px;
  left: 50%;
  translate: -50%;
  width: min(528px, calc(100% - 30px));
  display: grid;
  grid-template-columns: repeat(8, minmax(0,1fr));
  gap: 6px;
}
.reaction-picker button { min-height: 47px; font-size: 25px; }

.side-panel {
  right: 17px;
  top: 73px;
  bottom: 127px;
  z-index: 15;
  width: 336px;
  display: flex;
  flex-direction: column;
  padding: 9px 10px 10px;
  overflow: hidden;
}
.panel-mobile-head { display: none; }
.panel-tabs { flex: none; min-height: 46px; display: flex; gap: 4px; border-bottom: 2px solid var(--ink); }
.panel-tabs button:not(.text-button) {
  flex: 1;
  padding: 5px 7px;
  border: 2px solid var(--ink);
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  font-size: 12px;
  white-space: nowrap;
}
.panel-tabs button.active { background: var(--ink); color: var(--paper); }
#member-count { font-size: 11px; }
#panel-close { padding-inline: 8px; font-size: 20px; }
.panel-content { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: auto; }
#member-search { min-height: 40px; width: 100%; padding: 6px 11px; margin: 8px 0 6px; background: #fff; font-size: 13px; font-weight: 500; flex: none; }
.member {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 52px;
  padding: 5px 6px;
  border: 0;
  background: none;
  text-align: left;
}
.member:hover, .member[aria-pressed="true"] { background: #eee4d3; }
.member-portrait { flex: none; width: 36px; height: 36px; border: 2px solid var(--ink); box-shadow: inset 0 0 0 3px var(--ring); padding: 5px; }
.member .meta { display: flex; flex-direction: column; flex: 1; }
.member b { font-size: 13px; }
.member small { color: #765f51; font-weight: 500; }
.member-mic { width: 22px; height: 22px; }
.member-mic canvas { width: 14px; height: 14px; }
.detail, .role-card { padding: 11px; margin: 5px 0; border: 2px solid #c7a98a; border-radius: 12px; background: #efe3d0; font-size: 12px; }
.detail p, .role-card p { margin: 5px 0; }
.detail button, .role-card button { min-height: 34px; margin: 4px 4px 0 0; padding: 3px 8px; font-size: 11px; }
.chat-scopes { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 0 4px; flex: none; }
.chat-scopes button { white-space: nowrap; border-radius: 999px; flex-grow: 1; min-height: 36px; padding: 3px 9px; font-size: 11px; }
.chat-scopes button[aria-pressed="true"] { color: var(--paper); background: var(--ink); }
#chat-log { flex: 1; min-height: 44px; overflow: auto; }
.message { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px; margin: 7px 0 11px; font-size: 13px; }
.message.mine { justify-content: end; }
.message small, .message b, .muted { color: #765f51; font-weight: 500; }
.message .chat-bubble { width: 100%; display: flex; }
.message.mine .chat-bubble { justify-content: end; }
.message p { max-width: 100%; padding: 8px 10px; border: 2px solid var(--ink); border-radius: 13px; font-weight: 500; white-space: pre-wrap; overflow-wrap: anywhere; }
.message.mine p { background: #ff8d71; }
.muted { margin: 8px; font-size: 12px; }
#chat-form { flex: none; display: grid; gap: 4px; margin-top: 5px; padding-top: 5px; }
#chat-form label { justify-self: start; border: 2px solid var(--ink); border-radius: 999px; padding: 1px 10px; background: #ffe6a1; font-size: 11px; }
#chat-form > div { display: flex; gap: 5px; }
#chat-form textarea { width: 100%; min-width: 0; min-height: 40px; padding: 8px 9px; background: #fff; font-weight: 500; resize: vertical; }
#chat-form button { flex: none; }
#chat-form small { margin: 2px 0; }
#toast {
  position: absolute;
  z-index: 30;
  left: 50%;
  bottom: 127px;
  translate: -50%;
  width: max-content;
  max-width: calc(100% - 32px);
  text-align: center;
  padding: 8px 17px;
  border-radius: 999px;
  background: var(--ink);
  color: white;
  box-shadow: var(--shadow);
  pointer-events: none;
  font-size: 12px;
}

dialog {
  margin: auto;
  width: 480px;
  max-width: calc(100vw - 28px);
  max-height: calc(100dvh - 26px);
  padding: 17px;
  border: 3px solid var(--ink);
  border-radius: 18px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
}
dialog::backdrop { background: #36241b77; }
.dialog-title { display: flex; align-items: center; justify-content: space-between; border-bottom: 2px solid #ceb69b; padding-bottom: 8px; margin-bottom: 14px; }
.dialog-title h1 { font-size: 19px; }
dialog h2 { font-size: 15px; margin-bottom: 10px; }
dialog label { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
dialog select { min-width: 150px; padding: 7px; }
dialog p { font-size: 12px; margin-top: 11px; }
.avatar-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.avatar-grid button { min-width: 0; padding: 5px; display: grid; justify-items: center; }
.avatar-grid button[aria-pressed="true"] { background: #ffdc71; }
.avatar-grid img { width: 41px; height: 41px; object-fit: contain; image-rendering: pixelated; }
.mobile-only, #mobile-floor { display: none !important; }

@media (max-width: 1100px) and (min-width: 761px) {
  .zoom { bottom: 122px; }
  .greeting { display: none; }
  .top-actions { gap: 6px; }
  #floors { width: 390px; }
  #floors button { padding-inline: 12px; }
}
@media (max-width: 760px), (max-height: 500px) and (pointer: coarse) {
  .desktop-only { display: none !important; }
  .mobile-only, #mobile-floor { display: inline-flex !important; }
  .stage { border: 0; }
  .stage::after { content: none; }
  .map-view { inset: 0; }
  .floor-hud, .top-actions { top: max(10px, env(safe-area-inset-top)); }
  .floor-hud { left: 14px; width: auto; }
  .floor-sub, .greeting { display: none; }
  #mobile-floor {
    align-items: center;
    gap: 4px;
    min-height: 40px;
    color: #fff9ee;
    border: 3px solid var(--ink);
    border-radius: 13px;
    padding: 4px 8px;
    font-size: 13px;
    text-shadow: 0 1px var(--ink), 1px 0 var(--ink);
    white-space: nowrap;
  }
  #mobile-floor small { font-size: 10px; }
  #floors { display: none; position: absolute; top: 48px; left: 0; width: min(180px, calc(100vw - 28px)); }
  #floors.is-open { display: grid; }
  #floors button { text-align: left; }
  .top-actions { right: 14px; gap: 6px; }
  .top-actions button { min-height: 41px; padding: 0 6px; font-size: 12px; }
  .top-actions button.round, #help-open { width: 41px; height: 41px; }
  .top-actions canvas { width: 19px; height: 19px; }
  #help-open span:first-child canvas { width: 22px; height: 22px; }
  .demo-note { top: max(62px, calc(env(safe-area-inset-top) + 52px)); padding: 5px 9px 5px 5px; min-height: 34px; font-size: 11px; }
  .top-popover, .today-popover { top: max(57px, calc(env(safe-area-inset-top) + 47px)); }
  .side-panel {
    inset: 0;
    width: auto;
    border: 0;
    border-radius: 0;
    z-index: 21;
    padding: max(12px, env(safe-area-inset-top)) 14px max(10px, env(safe-area-inset-bottom));
  }
  .panel-mobile-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
  .panel-mobile-head h1 { font-size: 20px; }
  .panel-tabs { display: none; }
  #member-search { margin-top: 0; min-height: 44px; }
  .member { min-height: 55px; }
  .chat-scopes { padding-top: 0; padding-bottom: 8px; }
  .chat-scopes button { padding: 5px 10px; min-height: 42px; font-size: 12px; }
  #chat-form { margin-inline: -14px; padding: 8px 14px 4px; border-top: 3px solid var(--ink); }
  #chat-form textarea { min-height: 58px; font-size: 16px; }
  #chat-form button { padding-inline: 13px; }
  .dock {
    bottom: 0;
    left: 0;
    right: 0;
    translate: 0;
    width: auto;
    min-height: 151px;
    border-width: 3px 0 0;
    border-radius: 0;
    align-items: end;
    justify-content: space-around;
    gap: 3px;
    padding: 4px 9px max(19px, env(safe-area-inset-bottom));
  }
  .dock-action { flex: 1 1 0; min-width: 0; min-height: 66px; font-size: clamp(9px, 2.75vw, 11px); }
  .dock-action > span:first-child { width: 49px; height: 49px; border-width: 3px; }
  .dock .status-dot { width: 22px; height: 22px; }
  #push-talk { position: absolute; bottom: 88px; left: 50%; translate: -50%; padding: 0; }
  #push-talk .push-key {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border-width: 4px;
    box-shadow: 0 6px 0 var(--ink);
    background: #ff815f;
    font-size: 16px;
  }
  .mobile-find { position: absolute; z-index: 15; right: 14px; bottom: 170px; width: 48px; height: 48px; }
  .reaction-picker, .status-picker, .area-picker { bottom: 216px; left: 14px; right: 14px; width: auto; translate: 0; }
  .reaction-picker { grid-template-columns: repeat(4, minmax(0,1fr)); }
  #toast { bottom: 224px; }
  .room-bar { top: 102px; }
  .avatar { width: 77px; height: 77px; }
  .avatar .name { font-size: 16px; }
  .landmark { font-size: 16px; min-height: 56px; }
}
@media (max-width: 360px) {
  .top-actions button { min-height: 36px; }
  .top-actions button.round, #help-open { width: 36px; height: 36px; }
  .top-actions { gap: 4px; }
  .top-actions .mobile-only#mobile-today { display: none !important; }
  .dock-action > span:first-child { width: 44px; height: 44px; }
}
@media (max-width: 760px) and (orientation: landscape), (max-height: 500px) and (pointer: coarse) and (orientation: landscape) {
  .dock { top: 0; left: auto; width: 75px; min-height: 0; border-width: 0 0 0 3px; flex-direction: column; align-items: center; padding: 6px; }
  .dock-action { flex: none; min-height: 52px; font-size: 9px; }
  .dock-action > span:first-child { width: 38px; height: 38px; }
  #push-talk { left: auto; right: 86px; bottom: 14px; translate: 0; }
  #push-talk .push-key { width: 77px; height: 77px; font-size: 13px; }
  .top-actions { right: 88px; }
  .mobile-find { right: 93px; bottom: 100px; }
  .reaction-picker, .status-picker, .area-picker { bottom: 15px; right: 182px; }
  #toast { bottom: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
