:root {
  color-scheme: dark;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --background: #09090d;
  --glass: rgba(10, 10, 14, .74);
  --line: rgba(255, 236, 198, .12);
  --well: rgba(0, 0, 0, .22);
  --wash: rgba(255, 236, 198, .055);
  --wash-hover: rgba(255, 221, 164, .105);
  --text: #fef6e4;
  --secondary: #bdb4a5;
  --muted: #9d9385;
  --accent: #f6cf82;
  --accent-ink: #25190b;
  --focus: #fce0a3;
  --status-glow: 0 1px 3px #000, 0 0 14px rgba(246, 207, 130, .35);
  --icon-glow: drop-shadow(0 0 7px rgba(255, 224, 150, .75)) drop-shadow(0 0 16px rgba(255, 198, 100, .38));
  --hud-bottom: max(18px, calc(env(safe-area-inset-bottom) + 9px));
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { width: 100%; height: 100%; overflow: hidden; background: var(--background); }
body { margin: 0; min-width: 290px; color: var(--text); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .49; }
button:focus-visible, input:focus-visible, a:focus-visible, label:focus-within {
  outline: 1px solid var(--focus);
  outline-offset: 3px;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
.symbols { position: absolute; height: 0; width: 0; pointer-events: none; }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }

html:has(body.gate-locked), body.gate-locked { background: #000; }
body.gate-locked > :is(main, dialog, .toast) { display: none; }
#accessGate {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: max(20px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: #000;
  transition: opacity .24s ease, visibility .24s;
}
#accessGate.is-unlocked { opacity: 0; visibility: hidden; pointer-events: none; }
.gate-card {
  width: min(100%, 380px);
  padding: clamp(26px, 7vw, 42px);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(232, 204, 155, .10), rgba(212, 183, 131, .04) 70%);
  box-shadow: inset 0 1px rgba(252, 227, 181, .06);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  text-align: center;
}
.gate-brand {
  padding-inline-start: .29em;
  color: #c9ac80;
  font-size: .67rem;
  font-weight: 650;
  letter-spacing: .29em;
}
.gate-card h1 {
  margin-top: 9px;
  padding-inline-start: .13em;
  color: #f7e6c8;
  font-family: "Songti SC", "Noto Serif CJK SC", "SimSun", serif;
  font-size: clamp(2.4rem, 12vw, 3.35rem);
  font-weight: 500;
  letter-spacing: .13em;
  line-height: 1.15;
}
.gate-prompt { margin-top: 12px; color: var(--secondary); font-size: .85rem; }
.gate-form { display: grid; gap: 10px; margin-top: 28px; }
.gate-form input:not([type="range"]):not([type="file"]) {
  width: 100%;
  min-height: 48px;
  border-color: rgba(255, 236, 198, .15);
  background: rgba(0, 0, 0, .34);
  text-align: center;
  font-size: 1rem;
}
#gateInviteCode { font-family: ui-monospace, monospace; letter-spacing: .23em; text-transform: uppercase; }
#gateInviteCode::placeholder { font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; }
.gate-form .button.primary { min-height: 44px; background: #e5c892; border-color: #e5c892; }
.gate-form .button.primary:hover:not(:disabled) { background: #f1d8a8; border-color: #f1d8a8; }
#gateError { margin-top: 10px; }
.gate-switch {
  min-height: 36px;
  margin-top: 9px;
  padding: 0 8px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--secondary);
  font-size: .78rem;
  transition: color .2s;
}
.gate-switch:is(:hover, :focus-visible) { color: #f7e6c8; }

#player, .stage, .stage-photo, .canvas-room { position: fixed; inset: 0; }
.stage { overflow: hidden; isolation: isolate; background: var(--background); }
.stage-photo { background: var(--background) center/cover no-repeat; }
body:not(.gate-locked) .stage-photo { background-image: url('/assets/auditorium.jpg'); }
.canvas-room { background: var(--background); }
.canvas-room canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; outline-offset: -4px; }
.canvas-room canvas:active { cursor: grabbing; }
.canvas-room canvas[data-interactive="true"] { cursor: pointer; }
.canvas-room canvas:focus-visible { outline: 1px solid rgba(246, 207, 130, .28); }
.canvas-room canvas:focus:not(:focus-visible) { outline: none; }
.projector { position: absolute; top: var(--screen-top, 16.78%); left: var(--screen-left, 19.66%); width: var(--screen-width, 60.67%); height: var(--screen-height, 48.15%); display: grid; place-items: center; overflow: hidden; clip-path: var(--screen-clip, none); pointer-events: none; }
.stage:not(.is-3d) .projector { pointer-events: auto; cursor: pointer; }
.projector video { display: none; width: 100%; height: 100%; object-fit: contain; background: #000; pointer-events: none; }
.projector.has-film video { display: block; }
.stage.is-3d:not(.flat-video) .projector video { opacity: 0; }
.stage[data-screen-visible="false"] .projector { visibility: hidden; }
.projection-note, .resume-button { position: absolute; z-index: 2; }
.projection-note {
  max-width: 86%;
  padding: 9px 12px;
  border-radius: 8px;
  background: rgba(10, 10, 14, .56);
  backdrop-filter: blur(9px);
  text-align: center;
  text-shadow: var(--status-glow);
  font-size: .9rem;
}
.resume-button { background: var(--glass); color: var(--text); pointer-events: auto; backdrop-filter: blur(9px); }
.resume-button:hover { color: var(--accent); }

.online-presence {
  position: fixed;
  top: max(17px, env(safe-area-inset-top));
  left: max(19px, env(safe-area-inset-left));
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 29px;
  padding: 3px;
  border: 0;
  background: transparent;
  color: rgba(254, 246, 228, .76);
  filter: drop-shadow(0 0 7px rgba(255, 224, 150, .24));
  transition: color .24s, filter .24s;
}
.online-presence:is(:hover, :focus-visible) { color: var(--text); filter: var(--icon-glow); }
.online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6ee7b7;
  box-shadow: 0 0 8px rgba(52, 211, 153, .82);
  animation: presence-pulse 3.25s ease-in-out infinite;
}
.online-count { min-width: 1ch; font-size: .8rem; font-weight: 600; font-variant-numeric: tabular-nums; }
@keyframes presence-pulse { 50% { opacity: .62; box-shadow: 0 0 12px #34d399; } }

.bare-icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  padding: 0;
  background: transparent;
  border: 0;
  color: rgba(254, 246, 228, .79);
  transition: opacity .35s ease, transform .32s cubic-bezier(.22, 1, .36, 1), color .24s, filter .24s;
}
.bare-icon-btn .icon { width: 21px; height: 21px; }
.bare-icon-btn:is(:hover, :focus-visible, .active) { color: var(--text); filter: var(--icon-glow); }
.bare-icon-btn:hover { transform: scale(1.11); }
.hud-bottom-left {
  position: fixed;
  bottom: var(--hud-bottom);
  left: max(18px, env(safe-area-inset-left));
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 5px;
}
.auto-hide-children .bare-icon-btn { opacity: .16; }
.auto-hide-children:is(:hover, :focus-within, .pinned) .bare-icon-btn { opacity: 1; }
.hud-bottom-left .bare-icon-btn.hint-glow {
  color: #fde8b2;
  opacity: .94;
  animation: projection-pulse 2.8s ease-in-out infinite;
}
.hud-bottom-left:is(:hover, :focus-within, .pinned) .bare-icon-btn.hint-glow { opacity: 1; }
@keyframes projection-pulse {
  0%, 100% { filter: drop-shadow(0 0 6px rgba(255, 215, 130, .54)); }
  50% { filter: var(--icon-glow); }
}
.stocking-hint {
  position: absolute;
  bottom: 38px;
  left: 4px;
  display: flex;
  align-items: flex-start;
  gap: 1px;
  margin: 0;
  padding: 2px 0 0;
  border: 0;
  background: transparent;
  color: rgba(254, 240, 200, .90);
  filter: drop-shadow(0 0 8px rgba(255, 210, 120, .45));
  white-space: nowrap;
  font-size: .77rem;
  letter-spacing: .045em;
  line-height: 16px;
  animation: hint-float 2.8s ease-in-out infinite;
  transition: opacity .38s, color .23s, filter .23s, visibility .38s;
}
.stocking-hint .hint-arrow { width: 22px; height: 22px; }
.stocking-hint:is(:hover, :focus-visible) { color: #fff8e2; filter: var(--icon-glow); }
.stocking-hint.is-dismissed { visibility: hidden; opacity: 0; pointer-events: none; animation: none; }
@keyframes hint-float { 50% { transform: translateY(-3px); } }

.chat-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 7px rgba(246, 207, 130, .85);
}
#hudChatDot { position: absolute; top: 8px; right: 6px; }
.auto-hide-children #hudPeople:has(.chat-dot:not([hidden])) { opacity: 1; }
.auto-hide-children #hudPeople:has(.chat-dot:not([hidden])) .icon { opacity: .16; transition: opacity .35s; }
.auto-hide-children:is(:hover, :focus-within, .pinned) #hudPeople:has(.chat-dot:not([hidden])) .icon { opacity: 1; }

.atmosphere-controls {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  padding-right: max(17px, env(safe-area-inset-right));
  pointer-events: none;
}
.atmosphere-controls > * { pointer-events: auto; }
.atmosphere-controls::after {
  position: fixed;
  inset: 0 0 0 auto;
  width: 10px;
  content: "";
  pointer-events: auto;
}
.dock-toggle { opacity: .44; }
.dock-toggle:is(:hover, :focus-visible, .active) { opacity: 1; }
.floating-dock {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 11px;
  max-height: calc(100dvh - 80px);
  overflow-y: auto;
  scrollbar-width: none;
  padding: 8px 4px;
}
.floating-dock::-webkit-scrollbar { display: none; }
.auto-hide {
  opacity: .12;
  transform: translateX(10px);
  transition: opacity .35s ease, transform .35s cubic-bezier(.22, 1, .36, 1);
}
.atmosphere-controls:hover .auto-hide, .auto-hide:is(:focus-within, .pinned) { opacity: 1; transform: translateX(0); }
.mood-orbs { display: grid; grid-template-columns: repeat(2, 38px); gap: 2px 6px; justify-items: center; }
.mood-orb {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 50%;
}
.mood-orb::before {
  content: "";
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle at 33% 29%, var(--orb-hi), var(--orb-mid) 42%, var(--orb-edge) 78%);
  box-shadow: 0 0 10px var(--orb-glow), inset 0 -2px 4px rgba(4, 3, 7, .4);
  transition: transform .23s, box-shadow .23s;
}
.mood-orb[data-mood="warm"] { --orb-hi: #fff1c9; --orb-mid: #dca460; --orb-edge: #633510; --orb-glow: rgba(222, 153, 66, .46); }
.mood-orb[data-mood="imax"] { --orb-hi: #d5edff; --orb-mid: #689fda; --orb-edge: #182e65; --orb-glow: rgba(111, 169, 237, .49); }
.mood-orb[data-mood="velvet"] { --orb-hi: #ead7ee; --orb-mid: #aa7da7; --orb-edge: #412341; --orb-glow: rgba(180, 124, 186, .40); }
.mood-orb[data-mood="dark"] { --orb-hi: #64717a; --orb-mid: #262d35; --orb-edge: #101216; --orb-glow: rgba(133, 150, 166, .28); }
.mood-orb:is(:hover, :focus-visible)::before { transform: scale(1.16); box-shadow: 0 0 16px var(--orb-glow); }
.mood-orb[aria-pressed="true"]::before {
  box-shadow: 0 0 0 1px rgba(254, 246, 228, .68), 0 0 0 4px var(--orb-glow), 0 0 17px var(--orb-glow);
}
.slider-stack { display: grid; gap: 3px; width: 104px; }
.mini-slider { display: flex; align-items: center; gap: 9px; color: rgba(254, 246, 228, .66); cursor: pointer; }
.mini-slider:is(:hover, :focus-within) { color: var(--accent); }
.mini-slider:focus-within { outline: none; }
.mini-slider .icon { width: 15px; height: 15px; }
.mini-slider .range {
  width: 100%;
  --range-track: linear-gradient(to right, rgba(246, 207, 130, .62) var(--progress), rgba(255, 236, 198, .24) var(--progress));
}

.scene-loading {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(8, 8, 11, .29);
  color: rgba(254, 246, 228, .86);
  text-shadow: var(--status-glow);
  font-size: .84rem;
  letter-spacing: .1em;
  pointer-events: none;
}
.scene-loading::before {
  content: "";
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1px solid rgba(246, 207, 130, .2);
  border-top-color: var(--accent);
  animation: loading-spin .9s linear infinite;
}
@keyframes loading-spin { to { transform: rotate(1turn); } }
.key-hint, .world-action, .toast {
  position: fixed;
  left: 50%;
  width: max-content;
  max-width: calc(100vw - 26px);
  transform: translateX(-50%);
  text-align: center;
  text-shadow: var(--status-glow);
  color: var(--text);
}
.key-hint {
  bottom: calc(var(--hud-bottom) + 12px);
  z-index: 3;
  color: rgba(254, 246, 228, .76);
  padding: 4px 8px;
  font-size: .79rem;
  pointer-events: none;
}
.world-action {
  z-index: 3;
  bottom: calc(var(--hud-bottom) + 48px);
  border: 0;
  border-radius: 8px;
  padding: 8px 13px;
  min-height: 35px;
  background: rgba(10, 10, 14, .26);
  backdrop-filter: blur(7px);
  font-size: .86rem;
  transition: color .24s, filter .24s;
}
.world-action:is(:hover, :focus-visible) { color: var(--accent); filter: var(--icon-glow); }
.touch-menu { position: fixed; right: max(12px, env(safe-area-inset-right)); bottom: var(--hud-bottom); z-index: 5; }
.toast {
  z-index: 10;
  bottom: calc(var(--hud-bottom) + 74px);
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(10, 10, 14, .22);
  backdrop-filter: blur(6px);
  font-size: .85rem;
  pointer-events: none;
}

.dialog {
  width: min(495px, calc(100% - 26px));
  max-height: min(89dvh, 850px);
  padding: 23px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--glass);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  color: var(--text);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .48);
}
.dialog::backdrop { background: rgba(0, 0, 0, .32); }
.dialog-head { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; margin-bottom: 20px; }
.dialog-head h2 { font-size: 1.3rem; letter-spacing: .03em; }
.dialog-head p { margin-top: 6px; font-size: .87rem; line-height: 1.55; color: var(--secondary); }
.dialog-head .close { margin: -6px -6px 0 0; }
.plain-icon {
  display: inline-grid;
  place-items: center;
  width: 33px;
  height: 33px;
  flex: none;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--secondary);
  transition: color .24s, filter .24s;
}
.plain-icon:is(:hover, :focus-visible) { color: var(--text); filter: var(--icon-glow); }
.plain-icon .icon { width: 19px; height: 19px; }
.button {
  min-height: 41px;
  padding: 0 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text);
  font-size: .875rem;
  font-weight: 650;
  white-space: nowrap;
  transition: background .2s, border-color .2s, color .2s;
}
.button.secondary { background: var(--wash); border-color: var(--line); }
.button.secondary:hover { background: var(--wash-hover); border-color: rgba(246, 207, 130, .26); }
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.button.primary:hover { background: var(--focus); border-color: var(--focus); }
.dialog-form { display: grid; gap: 9px; }
.dialog-form label, #avatarNameField label { font-size: .87rem; font-weight: 650; color: var(--text); }
input:not([type="range"]):not([type="file"]) { color: var(--text); border: 1px solid var(--line); background: var(--well); border-radius: 8px; padding: 9px 11px; min-height: 42px; }
input::placeholder { color: var(--muted); }
.field-group { display: grid; gap: 8px; }
.field-help, .form-error { font-size: .8rem; color: var(--secondary); line-height: 1.55; overflow-wrap: anywhere; }
.form-error { color: #ffb1a5; }
.dialog-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 9px; margin-top: 12px; }

.menu-dialog { width: min(411px, calc(100% - 26px)); }
.menu-room-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.admin-badge {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--wash-hover);
  color: var(--accent);
  font-size: .69rem;
  white-space: nowrap;
}
.scene-menu { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.scene-menu button { justify-content: flex-start; min-height: 45px; }
.control-help { margin-top: 16px; font-size: .8rem; color: var(--secondary); line-height: 1.5; }

.booth-dialog { width: min(585px, calc(100% - 26px)); overflow: auto; }
.source-strip { margin-bottom: 9px; padding: 13px 15px; min-height: 73px; display: flex; align-items: center; gap: 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--well); }
.source-icon { display: grid; place-items: center; width: 41px; height: 41px; color: var(--accent); flex: none; }
.source-summary { min-width: 0; }
.source-summary h2 { font-size: .97rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.source-summary p { font-size: .81rem; color: var(--secondary); margin-top: 4px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.source-strip > .button { margin-left: auto; }
.player-controls { height: 54px; display: flex; align-items: center; gap: clamp(4px, 1.1vw, 10px); padding: 0 13px; border: 1px solid var(--line); border-radius: 9px; background: var(--well); }
.timecode { font-size: .76rem; font-variant-numeric: tabular-nums; color: var(--secondary); white-space: nowrap; }
.time-end { color: var(--muted); }
.range {
  height: 22px;
  min-width: 0;
  margin: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
  --progress: 0%;
  --range-track: linear-gradient(to right, var(--accent) var(--progress), rgba(255, 236, 198, .18) var(--progress));
}
.range::-webkit-slider-runnable-track { height: 2px; border-radius: 999px; background: var(--range-track); }
.range::-moz-range-track { height: 2px; border-radius: 999px; background: var(--range-track); }
.range::-webkit-slider-thumb { appearance: none; height: 10px; width: 10px; border: 0; border-radius: 50%; margin-top: -4px; background: #fde29b; box-shadow: 0 0 8px rgba(253, 226, 155, .68); }
.range::-moz-range-thumb { height: 10px; width: 10px; border: 0; border-radius: 50%; background: #fde29b; box-shadow: 0 0 8px rgba(253, 226, 155, .68); }
.range:disabled { opacity: .54; cursor: default; }
.seek { flex: 1; }
.volume { width: clamp(25px, 5vw, 66px); }
.control-divider { height: 18px; width: 1px; background: var(--line); }
.booth-demo { margin-top: 12px; }
.library-panel {
  display: grid;
  gap: 9px;
  margin-top: 15px;
  padding: 13px;
  border: 1px solid rgba(246, 207, 130, .17);
  border-radius: 11px;
  background: linear-gradient(125deg, rgba(246, 207, 130, .09), rgba(246, 207, 130, .025) 75%);
}
.library-panel h3 { font-size: .9rem; color: var(--accent); }
.library-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }
.library-form input { width: 100%; font-size: .875rem; }
.library-form .button { padding-inline: clamp(7px, 2vw, 13px); }
.library-list {
  display: grid;
  gap: 6px;
  max-height: min(15rem, 32dvh);
  margin: 0;
  padding: 3px;
  overflow: auto;
  scrollbar-color: rgba(246, 207, 130, .35) transparent;
  list-style: none;
}
.library-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--well);
}
.library-item.is-current { border-color: rgba(246, 207, 130, .44); background: var(--wash-hover); }
.library-item-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .84rem; font-weight: 650; }
.library-detail { margin-top: 4px; color: var(--secondary); font-size: .74rem; line-height: 1.45; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.library-detail.form-error { color: #ffb1a5; }
.library-item.is-current .library-detail:not(.form-error) { color: var(--accent); }
.library-progress { height: 3px; overflow: hidden; margin-top: 6px; border-radius: 999px; background: var(--line); }
.library-progress span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .25s ease; }
.library-item-actions { display: flex; gap: 5px; }
.library-item-actions .button { min-height: 32px; padding-inline: 8px; font-size: .78rem; }
.library-item-actions .button[aria-disabled="true"] { opacity: .49; cursor: default; }

dialog.room-panel:not([open]) { display: none; }
.room-panel { display: flex; flex-direction: column; min-width: 0; width: min(385px, calc(100% - 26px)); padding: 0; overflow: auto; }
.side-heading { display: flex; align-items: center; gap: 12px; padding: 20px 17px 15px; }
.side-mark { width: 43px; height: 43px; flex: none; display: grid; place-items: center; color: var(--accent); }
.side-mark .icon { width: 21px; height: 21px; }
.side-heading h2 { font-size: 1.1rem; letter-spacing: .045em; }
.side-heading p { color: var(--secondary); margin-top: 3px; font-size: .8rem; }
.side-heading .close, .side-heading .panel-leave:not([hidden]) { margin-left: auto; }
.side-heading .panel-leave:not([hidden]) ~ .close { margin-left: 0; }
.side-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin: 0 17px 16px; border-radius: 9px; background: var(--well); border: 1px solid var(--line); }
.side-tabs button { min-height: 36px; display: flex; align-items: center; justify-content: center; gap: 7px; font-size: .88rem; font-weight: 600; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--secondary); }
.side-tabs button[aria-selected="true"] { color: var(--text); background: var(--wash-hover); border-color: var(--line); }
.side-tabs button .icon { width: 16px; height: 16px; }
.people-panel { display: flex; flex-direction: column; padding: 0 17px 17px; flex: 1; }
.people-list { display: flex; flex-direction: column; gap: 7px; max-height: 167px; overflow: auto; }
.member { display: flex; align-items: center; gap: 10px; min-height: 55px; padding: 6px 9px; background: var(--wash); border: 1px solid var(--line); border-radius: 8px; }
.member-avatar { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border: 1px solid var(--line); border-radius: 7px; background: var(--well); overflow: hidden; color: var(--accent); }
.member-avatar img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; padding: 4px; }
.member-details { min-width: 0; }
.member-details strong, .member-details small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member-details strong { font-size: .9rem; }
.member-details small { margin-top: 3px; font-size: .75rem; color: var(--secondary); }
.member-tag { margin-left: auto; color: var(--accent); padding: 4px 0 4px 7px; font-size: .73rem; white-space: nowrap; }
.people-add { margin-top: 8px; min-height: 40px; width: 100%; display: flex; align-items: center; gap: 8px; padding: 0 9px; font-size: .84rem; color: var(--secondary); background: transparent; border: 1px dashed var(--line); border-radius: 8px; }
.people-add:hover { background: var(--wash); color: var(--text); }
.people-add .icon { width: 16px; height: 16px; }
.end-chevron { margin-left: auto; opacity: .7; }
.seat-section { padding-top: 18px; margin-top: 18px; border-top: 1px solid var(--line); }
.seat-heading { display: flex; align-items: center; justify-content: space-between; gap: 7px; margin-bottom: 14px; }
.seat-heading > div { display: flex; align-items: center; gap: 8px; }
.seat-heading .icon { color: var(--accent); }
.seat-heading h3 { font-size: .93rem; }
.seat-heading > span { color: var(--secondary); font-size: .76rem; }
.mini-screen { width: 77%; height: 29px; margin: 0 auto 10px; display: grid; place-items: start center; position: relative; color: var(--secondary); font-size: .72rem; }
.mini-screen::before { content: ""; position: absolute; top: 0; inset-inline: 0; height: 18px; border-top: 1px solid rgba(246, 207, 130, .64); border-radius: 48% 48% 0 0; box-shadow: 0 -4px 14px rgba(246, 207, 130, .12); }
.mini-screen span { margin-top: 8px; }
.seat-map { display: grid; grid-template-columns: 12px repeat(3, minmax(11px, 1fr)) 4px repeat(8, minmax(11px, 1fr)) 4px repeat(3, minmax(11px, 1fr)); gap: 4px 1px; max-width: 343px; margin: 0 auto; align-items: center; }
.seat-row-name { color: var(--muted); font-size: .68rem; }
.seat { position: relative; height: 19px; display: grid; place-items: center; border: 0; background: transparent; border-radius: 4px; color: #847b6f; padding: 0; }
.seat > .icon { width: clamp(10px, 3.4vw, 16px); height: clamp(10px, 3.4vw, 16px); stroke-width: 1.8; }
.seat:hover { color: var(--text); background: var(--wash-hover); }
.seat.occupied { color: #c0877b; opacity: 1; }
.seat.mine { color: var(--accent); background: var(--wash-hover); }
.seat-legend { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; column-gap: 11px; row-gap: 5px; margin-top: 14px; color: var(--secondary); font-size: .71rem; }
.seat-legend span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.seat-legend i { width: 8px; height: 8px; border-radius: 2px; border: 1px solid #847b6f; background: var(--wash); }
.seat-legend span:nth-child(2) i { border-color: #c0877b; background: rgba(192, 135, 123, .25); }
.seat-legend span:nth-child(3) i { border-color: var(--accent); background: var(--wash-hover); }
.room-footer { display: flex; align-items: center; gap: 7px; padding: 13px 17px; border-top: 1px solid var(--line); color: var(--muted); font-size: .78rem; }
.room-footer .icon { width: 14px; height: 14px; color: var(--secondary); }
.chat-panel { flex: 1; display: flex; flex-direction: column; min-height: min(340px, 63dvh); padding: 0 13px 14px; }
.chat-messages { flex: 1; height: min(290px, 52dvh); min-height: 95px; overflow-y: auto; padding: 5px; }
.chat-empty { color: var(--secondary); font-size: .88rem; padding: 16px 4px; line-height: 1.6; }
.chat-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 8px; padding: 8px 0; }
.chat-line strong { font-size: .8rem; color: var(--accent); overflow: hidden; text-overflow: ellipsis; }
.chat-line time { color: var(--muted); font-size: .74rem; }
.chat-line p { grid-column: 1 / -1; padding: 8px 10px; border-radius: 7px; background: var(--wash); overflow-wrap: anywhere; font-size: .875rem; }
.chat-form { display: flex; gap: 8px; align-items: stretch; }
.chat-form input { min-width: 0; flex: 1; }
.chat-send { padding: 0 10px; }

.admin-invites { display: grid; justify-items: start; gap: 10px; }
.invite-code-list { display: grid; gap: 8px; width: 100%; padding: 0; margin: 0; list-style: none; }
.invite-code-list:empty { display: none; }
.invite-code-item { display: grid; gap: 8px; padding: 11px; border-radius: 9px; background: var(--wash); }
.invite-code-meta { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; }
.invite-code-meta code { color: var(--focus); font-family: ui-monospace, monospace; font-size: 1.06rem; letter-spacing: .12em; }
.invite-code-meta > :not(code) { color: var(--secondary); font-size: .76rem; }
.invite-code-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.invite-code-actions .button { min-height: 34px; padding: 0 9px; font-size: .76rem; }
.invite-code-item input { width: 100%; min-width: 0; }

.wardrobe-dialog { width: min(680px, calc(100% - 26px)); }
.wardrobe-content { display: grid; grid-template-columns: minmax(150px, 200px) minmax(0, 1fr); gap: 18px; }
.avatar-stage { min-height: 230px; position: relative; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: radial-gradient(ellipse at 50% 85%, rgba(176, 123, 67, .22), var(--well) 74%); }
.avatar-stage canvas { display: block; width: 100%; height: 100%; touch-action: pan-y; }
.avatar-stage > img { position: absolute; width: 76%; height: 76%; inset: 12%; object-fit: contain; image-rendering: pixelated; }
.wardrobe-options { min-width: 0; }
#avatarNameField { margin-bottom: 11px; }
.body-tabs { display: flex; gap: 7px; margin-bottom: 11px; }
.body-tabs .button { min-height: 36px; }
.body-tabs [aria-pressed="true"] { color: var(--accent); border-color: rgba(246, 207, 130, .38); background: var(--wash-hover); }
.outfits { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.outfit { position: relative; padding: 4px; min-width: 0; display: grid; place-items: center; gap: 3px; color: var(--secondary); border: 1px solid var(--line); background: var(--wash); border-radius: 8px; font-size: .67rem; line-height: 1.3; }
.outfit:hover, .outfit[aria-pressed="true"] { color: var(--text); border-color: rgba(246, 207, 130, .38); background: var(--wash-hover); }
.outfit img { width: 100%; height: 61px; object-fit: contain; image-rendering: pixelated; }
.outfit span { padding-bottom: 4px; text-align: center; }
.upload-actions { display: flex; gap: 7px; flex-wrap: wrap; margin: 12px 0 7px; }
.upload-actions .button { min-height: 34px; font-size: .79rem; }
.upload-button { cursor: pointer; position: relative; }
.upload-button input { opacity: 0; position: absolute; inset: 0; width: 100%; cursor: pointer; }
.uploaded-face { width: 27px; height: 27px; background-size: 216px 216px; background-position: -27px -27px; image-rendering: pixelated; }

.bullet-dialog { margin: auto auto max(23px, env(safe-area-inset-bottom)); width: min(510px, calc(100% - 26px)); padding: 8px; border-radius: 10px; }
.bullet-dialog::backdrop { background: rgba(0, 0, 0, .14); }
.danmaku { position: absolute; inset: 0; z-index: 1; overflow: hidden; pointer-events: none; }
.bullet { position: absolute; left: 100%; top: calc(7% + 12% * var(--lane)); display: inline-block; white-space: nowrap; color: #fffbf2; font-size: clamp(.8rem, 2.1vw, 1.38rem); font-weight: 650; text-shadow: 0 1px 3px #000, 0 0 6px #000; animation: drift 7.5s linear both; }
@keyframes drift { to { transform: translateX(calc(-100% - var(--screen-travel))); } }

@media (max-width: 1010px) {
  .key-hint { bottom: calc(var(--hud-bottom) + 72px); }
  .toast { bottom: calc(var(--hud-bottom) + 103px); }
}
@media (max-width: 520px) {
  .online-presence { left: max(10px, env(safe-area-inset-left)); }
  .hud-bottom-left { left: max(8px, env(safe-area-inset-left)); gap: 0; }
  .hud-bottom-left .bare-icon-btn { width: clamp(30px, 10vw, 38px); }
  .hud-bottom-left .icon { width: 19px; height: 19px; }
  .stocking-hint .hint-arrow { width: 20px; height: 20px; }
  .touch-menu { right: max(3px, env(safe-area-inset-right)); width: 30px; }
  .atmosphere-controls { padding-right: max(7px, env(safe-area-inset-right)); }
  .wardrobe-content { grid-template-columns: 1fr; gap: 12px; }
  .avatar-stage { min-height: 145px; height: 145px; }
  .outfit img { height: 48px; }
  .dialog { padding: 15px; }
  .room-panel { padding: 0; }
  .bullet-dialog { padding: 8px; }
  .booth-dialog .source-strip { min-height: 58px; padding: 8px; gap: 7px; }
  .booth-dialog .source-strip .button { min-height: 35px; padding: 0 7px; }
  .booth-dialog .source-icon { width: 32px; height: 32px; }
  .booth-dialog .player-controls { padding-inline: 4px; }
  .booth-dialog .player-controls .plain-icon { width: 27px; }
  .booth-dialog .timecode { font-size: .67rem; }
  .control-divider { display: none; }
}
@media (max-width: 390px) {
  #hudSource { display: none; }
}
@media (hover: none) {
  .atmosphere-controls::after { pointer-events: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
  .online-dot, .stocking-hint, .hud-bottom-left .bare-icon-btn.hint-glow, .scene-loading::before { animation: none; }
  .hud-bottom-left .bare-icon-btn.hint-glow { filter: var(--icon-glow); }
  .bullet { left: 8%; animation: bullet-hold 4s linear both; }
  @keyframes bullet-hold { 85% { opacity: 1; } to { opacity: 0; } }
}
