:root {
  color-scheme: dark;
  font-family: "Trebuchet MS", system-ui, sans-serif;
  color: #f3efda;
  background: #181913;
  --lime: #e4efac;
  --muted: #bcbba5;
  --line: #454637;
  --hud-top: max(12px, env(safe-area-inset-top));
  --hud-right: max(12px, env(safe-area-inset-right));
  --hud-bottom: max(12px, env(safe-area-inset-bottom));
  --hud-left: max(12px, env(safe-area-inset-left));
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; overflow: hidden; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 4px; }
.shell { position: relative; isolation: isolate; width: 100%; height: 100vh; height: 100dvh; overflow: hidden; }
.stage { position: absolute; inset: 0; z-index: -1; background: #33341f; }
#room { display: block; width: 100%; height: 100%; cursor: crosshair; touch-action: manipulation; }
#room:focus-visible { outline-offset: -5px; }
.topbar {
  position: absolute;
  inset: var(--hud-top) var(--hud-right) auto var(--hud-left);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}
.room-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px 10px 10px;
  border: 1px solid #eee1af33;
  border-radius: 12px;
  background: #1b1b14ed;
}
h1 {
  margin: 0;
  color: #f4efdb;
  font: 850 clamp(1.1rem, 2.1vw, 1.6rem)/1.05 system-ui, sans-serif;
  letter-spacing: -.045em;
}
.room-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 9px;
  align-items: center;
  margin-top: 5px;
  color: var(--muted);
  font-size: .77rem;
}
.swarm-count {
  white-space: nowrap;
}
.bug-mark {
  width: 31px;
  height: 31px;
  border-radius: 10px;
  background: var(--lime);
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: none;
}
.bug-mark i { background: #292c1d; width: 5px; height: 15px; border-radius: 100%; transform: rotate(-14deg); }
.bug-mark::before, .bug-mark::after {
  content: "";
  position: absolute;
  height: 7px;
  width: 10px;
  top: 10px;
  background: #454831;
  border-radius: 80% 70% 25% 70%;
}
.bug-mark::before { left: 6px; transform: rotate(26deg); }
.bug-mark::after { right: 5px; transform: rotate(-32deg) scaleX(-1); }
.top-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.top-actions .button { pointer-events: auto; background: #222419eb; }
.top-actions .button:hover { background: #373a2a; }
.status {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  white-space: nowrap;
}
.status i { width: 7px; height: 7px; border-radius: 100%; background: #aaa37e; }
.status.live i { background: #d5ed91; box-shadow: 0 0 9px #b1d75681; }
.button {
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #23251c;
  color: #f0edd7;
  font-weight: 650;
  font-size: .9rem;
  white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.button:hover { background: #313426; border-color: #777a59; }
.button span { margin-right: 4px; font-size: 1.08em; }
.speaker { color: var(--lime); }
.icon-button { display: grid; place-items: center; width: 42px; padding-inline: 0; }
.icon-button .fullscreen-icon {
  display: block;
  margin: 0;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  clip-path: polygon(0 0, 35% 0, 35% 35%, 65% 35%, 65% 0, 100% 0, 100% 35%, 65% 35%, 65% 65%, 100% 65%, 100% 100%, 65% 100%, 65% 65%, 35% 65%, 35% 100%, 0 100%, 0 65%, 35% 65%, 35% 35%, 0 35%);
}
#fullscreen[aria-pressed="true"] .fullscreen-icon { width: 12px; height: 12px; }
.controls {
  position: absolute;
  inset: auto var(--hud-right) var(--hud-bottom) var(--hud-left);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  pointer-events: none;
}
.controls button { pointer-events: auto; }
.identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  background: #22241bf2;
  border: 1px solid #eee1af33;
  border-radius: 12px;
  min-height: 77px;
  padding: 8px 10px 8px 8px;
}
#portrait { width: 73px; height: 57px; background: #363923; border-radius: 8px; flex: none; }
.identity-text { display: grid; gap: 1px; min-width: 126px; max-width: 230px; }
.identity-header { display: flex; align-items: center; gap: 8px; }
.rename { border: 0; padding: 1px 4px; min-height: 24px; border-radius: 5px; background: none; color: var(--lime); font-size: .7rem; white-space: nowrap; }
.rename:hover { background: #414533; }
.caption { font: 750 .62rem/1.25 system-ui, sans-serif; color: #c6cf95; letter-spacing: .12em; }
.identity strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 780 1.22rem/1.15 system-ui, sans-serif; letter-spacing: -.03em; }
#mood, .hint { color: var(--muted); font-size: .83rem; line-height: 1.35; }
.play-actions { display: flex; gap: 15px; align-items: center; }
.hint { text-align: right; color: #f3efda; text-shadow: 0 1px 3px #16150e, 0 0 6px #16150e; }
.buzz { background: var(--lime); color: #242618; border-color: var(--lime); min-height: 46px; padding-inline: 20px; font-weight: 800; }
.buzz:hover { background: #f0f6cd; border-color: #f0f6cd; }
.notice {
  position: fixed;
  bottom: calc(var(--hud-bottom) + 84px);
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 24px);
  width: max-content;
  border: 1px solid var(--line);
  background: #282b20;
  color: var(--lime);
  padding: 11px 18px;
  border-radius: 10px;
  z-index: 3;
  margin: 0;
}
dialog {
  width: min(460px, calc(100% - 32px));
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #23251b;
  padding: 22px;
  color: #f3efda;
}
dialog::backdrop { background: #0c0e09b5; }
dialog h2 { margin: 0; padding-right: 35px; font-size: 1.55rem; }
dialog p { color: var(--muted); line-height: 1.4; }
dialog label { display: block; margin-bottom: 6px; font-size: .85rem; }
.close { position: absolute; right: 12px; top: 12px; border: 0; border-radius: 8px; background: #34372b; color: inherit; width: 36px; height: 36px; font-size: 1.4rem; }
.share-link { display: flex; gap: 8px; }
.share-link input { width: 100%; min-width: 0; padding: 9px; border: 1px solid var(--line); border-radius: 8px; color: #f3efda; background: #181913; }
#copy-result:empty { display: none; }
.nickname { width: 100%; padding: 11px 12px; border: 1px solid #797c5c; border-radius: 8px; background: #181913; color: #f3efda; }
#name-dialog h2 { margin-bottom: 17px; }
.name-buttons { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
dialog .name-error { color: #f3b3a5; font-size: .86rem; margin-bottom: 0; }
@media (max-width: 700px) {
  .controls { gap: 8px; }
  .identity { flex: 1; gap: 8px; }
  .identity-text { min-width: 0; margin-right: auto; }
  .hint { display: none; }
  .play-actions .buzz { padding-inline: 12px; }
  .look { padding-inline: 8px; }
}
@media (max-width: 430px) {
  .topbar { flex-wrap: wrap; }
  .room-heading { gap: 7px; padding: 7px 9px 7px 7px; }
  .room-meta { font-size: .68rem; gap: 2px 6px; }
  .status { gap: 4px; }
  .top-actions { margin-left: auto; gap: 4px; }
  .top-actions .button { min-height: 36px; font-size: .73rem; padding-inline: 6px; }
  .top-actions .icon-button { width: 32px; padding: 0; }
  .top-actions .button .speaker, .top-actions .invite span { display: none; }
  #portrait { width: 48px; height: 44px; }
  #mood { font-size: .71rem; }
  .caption { font-size: .54rem; }
  .identity-header { gap: 3px; }
  .rename span:first-child { font-size: 1rem; }
  .rename span:last-child { display: none; }
  .identity strong { font-size: 1.08rem; }
  .look { font-size: .73rem; }
  .look span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .button { transition: none; }
}
