/* The join panel, the status bar and the toast: frosted glass over the scene like every HUD
   (PRD SP-11); the camera keeps the room clear of them through the page's insets(). */
:root { --accent: #e39a3b; --accent-ink: #1f1a15; --alert: #c8423a; }

.btn.primary { justify-content: center; border-color: color-mix(in srgb, var(--accent) 70%, #000); background: var(--accent); color: var(--accent-ink); font-weight: 650; }
.btn.primary:hover { border-color: var(--accent-ink); }
.btn:disabled { opacity: .45; cursor: default; }
.btn:disabled:hover { border-color: var(--line); }

/* ---- join panel: where the people panel sits, which it replaces while open */
.join { position: fixed; z-index: 16; right: var(--gap); top: calc(var(--bar, 50px) + 2 * var(--gap)); width: 340px; max-height: calc(100dvh - var(--bar, 50px) - 3 * var(--gap)); overflow-y: auto; overscroll-behavior: contain; padding: 18px 18px 16px; }
body.join-open .side, body.join-open .side-tab { display: none !important; }
.join h2 { margin: 0 0 4px; font-size: 19px; line-height: 1.25; }
.join-sub { margin: 0 0 12px; color: var(--hud-muted); font-size: 13px; }
.join-clock { margin: 0 0 14px; padding: 8px 10px; border-radius: 10px; background: color-mix(in srgb, var(--p-break) 13%, var(--panel)); font-size: 12.5px; }
.field { display: block; margin: 0 0 14px; }
.field > span { display: block; margin-bottom: 6px; font-size: 12.5px; font-weight: 600; }
.join input { width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--ink); font: inherit; font-size: 15px; }
.join input:focus-visible, .avatar:focus-visible, .switch:focus-visible { outline: 2px solid var(--tool); outline-offset: 2px; }
.avatars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.avatar { display: grid; place-items: center; aspect-ratio: 1; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--hud-muted); font: 600 13px/1 inherit; font-family: inherit; cursor: pointer; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar img:not([hidden]) + span { display: none; }
.avatar[aria-checked="true"] { border: 2px solid var(--tool); background: color-mix(in srgb, var(--tool) 10%, var(--panel)); }
.join-error { margin: 0 0 12px; padding: 8px 10px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--alert) 45%, transparent); background: color-mix(in srgb, var(--alert) 10%, var(--panel)); font-size: 13px; }
.join-actions { display: flex; gap: 8px; }
.join-actions .btn { min-height: 42px; font-size: 14px; }
.join-actions .primary { flex: 1; }
.join-privacy { margin: 10px 0 0; font-size: 12.5px; text-align: center; }
.join-privacy a { color: var(--hud-muted); }

/* ---- status bar: your clock, the room's clock, the rhythm switch, Start and the presence buttons */
.status-bar { position: fixed; z-index: 14; left: 50%; bottom: var(--gap); transform: translateX(-50%); display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 14px; width: max-content; max-width: calc(100vw - 2 * var(--gap)); padding: 8px 10px 8px 8px; }
.own { display: flex; align-items: center; gap: 10px; min-width: 200px; }
.ring { position: relative; flex: none; width: 50px; height: 50px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 4; }
.ring .track { stroke: color-mix(in srgb, var(--ink) 14%, transparent); }
.ring .arc { stroke: var(--c, var(--faint)); stroke-linecap: round; stroke-dasharray: 119.38; transition: stroke-dashoffset .5s; }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.own-text b, .room-clock b { display: block; font-size: 14px; }
.own-text small, .room-clock small { display: block; color: var(--hud-muted); font-size: 12px; white-space: nowrap; }
.room-clock { display: flex; align-items: center; gap: 8px; padding-left: 14px; border-left: 1px solid var(--hud-line); }
.room-clock b { font-size: 17px; font-variant-numeric: tabular-nums; }
.switch { display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 4px 10px 4px 6px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--ink); font: inherit; font-size: 12.5px; white-space: nowrap; cursor: pointer; }
.switch i { position: relative; flex: none; width: 30px; height: 18px; border-radius: 9px; background: color-mix(in srgb, var(--ink) 22%, transparent); transition: background .2s; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px #0004; transition: transform .2s; }
.switch[aria-checked="true"] i { background: var(--tool); }
.switch[aria-checked="true"] i::after { transform: translateX(12px); }
.switch:disabled { opacity: .45; cursor: default; }
.acts { display: flex; flex-wrap: wrap; gap: 6px; }
.acts .btn[aria-pressed="true"] { border-color: var(--c); background: color-mix(in srgb, var(--c) 16%, var(--panel)); font-weight: 650; opacity: 1; }

.toast { position: fixed; z-index: 30; left: 50%; bottom: calc(var(--bottom-hud, 0px) + 2 * var(--gap)); transform: translateX(-50%); max-width: min(520px, calc(100vw - 2 * var(--gap))); margin: 0; padding: 9px 14px; font-size: 13px; text-align: center; }

/* In the room the bar's buttons carry the presence colours, so the legend steps aside and the dock sits above the bar. */
body.in-room .dock { bottom: calc(var(--bottom-hud, 0px) + 2 * var(--gap)); }
body.in-room .side { bottom: calc(var(--bottom-hud, 0px) + 2 * var(--gap)); }
body.in-room .legend { display: none; }

@media (max-width: 760px) {
  .join { left: var(--gap); right: var(--gap); top: auto; bottom: var(--gap); width: auto; max-height: 72dvh; }
  .status-bar { left: var(--gap); right: var(--gap); transform: none; width: auto; justify-content: flex-start; }
  .own { min-width: 0; }
  /* The room clock's label wraps here, so the clock shares its row with the rhythm switch. */
  .room-clock { flex: 1 1 170px; min-width: 0; padding-left: 10px; }
  .room-clock small { white-space: normal; }
}

/* ---- the building: its name in the top bar, the veil while a full building sends the guest on, the invite note */
.rn-short { display: none; }
h1 small { transition: opacity .25s ease; }
h1 small.pending { opacity: 0; }
#inviteBtn { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); background: color-mix(in srgb, var(--accent) 22%, var(--panel)); }
#inviteBtn:hover { border-color: var(--accent); }
.invite-pop { position: fixed; z-index: 26; left: 50%; top: calc(var(--bar, 50px) + 2 * var(--gap)); display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 2 * var(--gap))); margin: 0; padding: 10px 14px; font-size: 13px; color: var(--ink); opacity: 0; visibility: hidden; transform: translate(-50%, -6px); transition: opacity .25s ease, transform .25s ease, visibility 0s .25s; }
.invite-pop.on { opacity: 1; visibility: visible; transform: translate(-50%, 0); transition-delay: 0s; }
.invite-pop input { width: 100%; min-height: 34px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); color: var(--ink); font: inherit; font-size: 13px; }
.moving { position: fixed; z-index: 40; inset: 0; display: grid; place-items: center; padding: var(--gap); background: color-mix(in srgb, var(--bg) 45%, transparent); -webkit-backdrop-filter: blur(10px) saturate(1.1); backdrop-filter: blur(10px) saturate(1.1); opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .3s ease, visibility 0s .3s; }
.moving.on { opacity: 1; visibility: visible; pointer-events: auto; transition-delay: 0s; }
.moving-card { display: flex; align-items: center; gap: 14px; width: min(400px, 100%); min-height: 76px; padding: 16px 20px; color: var(--ink); }
.moving-card p { margin: 0; font-size: 14.5px; line-height: 1.45; }
.moving .spin { flex: none; }
@media (max-width: 760px) {
  .rn-long { display: none; }
  /* Clear of the people tab, which sits at the same height on the right. */
  .invite-pop { top: calc(var(--bar, 50px) + 2 * var(--gap) + 44px); }
  .rn-short { display: inline; }
}
@media (prefers-reduced-motion: reduce) { h1 small, .invite-pop, .moving { transition: none; } }
body.pip .invite-pop, body.pip .moving, body.pip #inviteBtn,
body.record .invite-pop, body.record .moving, body.record #inviteBtn { display: none !important; }

body.pip .join, body.pip .status-bar, body.pip .toast,
body.record .join, body.record .status-bar, body.record .toast { display: none !important; }

/* ---- the building's type: a coloured band along the top of the bar (building-hud.js). --t is the type's colour. */
body.typed { --band-h: 27px; }
body.typed header { padding-top: calc(7px + var(--band-h)); border-color: color-mix(in srgb, var(--t) 45%, var(--hud-line)); }
/* The band says what the label beside the title used to. */
body.typed h1 small { display: none; }
.band { position: absolute; left: -1px; right: -1px; top: -1px; height: var(--band-h); display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 5px 0 16px; border-radius: 14px 14px 0 0; background: var(--t); color: #fff; font-size: 12.5px; letter-spacing: .01em; }
.band[hidden] { display: none; }
.band-text { min-width: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; font-weight: 600; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: default; }
#bandShort { display: none; }
.band-switch { flex: none; display: inline-flex; align-items: center; gap: 5px; height: 21px; padding: 0 10px 0 8px; border: 1px solid #ffffff8c; border-radius: 999px; background: #ffffff2e; color: #fff; font: inherit; font-size: 12px; font-weight: 650; white-space: nowrap; cursor: pointer; }
.band-switch:hover { background: #ffffff4d; }
.band-switch[hidden] { display: none; }
.band-switch .ui-ico { width: 13px; height: 13px; }
.band-text:focus-visible, .band-switch:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
.band-traits { position: fixed; z-index: 26; left: var(--gap); top: calc(var(--bar, 50px) + 2 * var(--gap)); display: flex; flex-direction: column; gap: 6px; max-width: min(340px, calc(100vw - 2 * var(--gap))); padding: 10px 14px; font-size: 13px; color: var(--ink); border-color: color-mix(in srgb, var(--t) 45%, var(--hud-line)); }
.band-traits[hidden] { display: none; }
.band-chips, .b-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.band-chips span, .b-chips span { padding: 1px 7px; border: 1px solid color-mix(in srgb, var(--t) 35%, transparent); border-radius: 999px; background: color-mix(in srgb, var(--t) 13%, var(--panel)); color: color-mix(in srgb, var(--t) 62%, var(--ink)); font-size: 11px; font-weight: 600; white-space: nowrap; }
.moving-icon { flex: none; font-size: 28px; line-height: 1; }
.moving-icon:empty { display: none; }
.moving-card { border-color: color-mix(in srgb, var(--t, var(--hud-line)) 55%, var(--hud-line)); }
.own-rhythm { min-height: 34px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--ink); font: inherit; font-size: 12.5px; font-variant-numeric: tabular-nums; cursor: pointer; }
.own-rhythm[hidden] { display: none; }

/* ---- Đổi tòa: the buildings as cards (building-switch.js); on a phone, a sheet from the bottom */
.switch-dim { position: fixed; z-index: 19; inset: 0; background: #14110d59; }
.switch-dim[hidden], .switch-panel[hidden] { display: none; }
.switch-panel { position: fixed; z-index: 27; right: var(--gap); top: calc(var(--bar, 50px) + 2 * var(--gap)); display: flex; flex-direction: column; width: min(720px, calc(100vw - 2 * var(--gap))); max-height: calc(100dvh - var(--bar, 50px) - 3 * var(--gap)); overflow: hidden; color: var(--ink); }
.switch-panel .grab { display: none; }
.switch-head { flex: none; display: flex; align-items: center; gap: 10px; padding: 10px 10px 8px 16px; border-bottom: 1px solid var(--hud-line); }
.switch-head b { flex: 1; font-size: 14px; }
.switch-note { flex: none; margin: 10px 10px 0; padding: 8px 10px; border-radius: 10px; background: color-mix(in srgb, var(--p-break) 13%, var(--panel)); font-size: 12.5px; }
.switch-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 10px; overflow-y: auto; overscroll-behavior: contain; }
.b-card { display: flex; flex-direction: column; min-width: 0; padding: 0; overflow: hidden; border: 1px solid var(--hud-line); border-radius: 12px; background: var(--panel); color: var(--ink); font: inherit; text-align: left; cursor: pointer; transition: border-color .15s ease, transform .15s ease; }
.b-card:not(:disabled):hover { border-color: var(--t); transform: translateY(-1px); }
.b-card:focus-visible { outline: 2px solid var(--tool); outline-offset: 2px; }
.b-card:disabled { cursor: default; }
.b-card.here { border-color: var(--t); box-shadow: 0 0 0 1px var(--t); }
.b-card.full .b-body { opacity: .55; }
.b-thumb { position: relative; flex: none; display: block; height: 78px; background: color-mix(in srgb, var(--t) 25%, var(--panel)); }
.b-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.b-card.full .b-thumb img { filter: grayscale(.7); }
.b-tag { position: absolute; left: 8px; top: 8px; padding: 2px 8px; border-radius: 999px; background: #fffffff0; color: #2a241d; font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.b-fullov { position: absolute; inset: 0; display: grid; place-items: center; background: #1e1e1c80; color: #fff; font-size: 14px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.b-body { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 9px 10px 10px; }
.b-title { font-size: 13.5px; font-weight: 700; line-height: 1.3; }
.b-rhythm { display: none; }
.b-seats { color: var(--hud-muted); font-size: 12px; }
.b-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }
.b-phase { display: inline-flex; align-items: center; gap: 6px; min-width: 0; font-size: 12px; white-space: nowrap; }
.b-phase i { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--p-focus); }
.b-phase[data-p="break"] i { background: var(--p-break); }
.b-phase b { font-variant-numeric: tabular-nums; }
.b-go { flex: none; padding: 5px 12px; border: 1px solid var(--line); border-radius: 9px; font-size: 12.5px; white-space: nowrap; }
.b-go.go { border-color: color-mix(in srgb, var(--accent) 70%, #000); background: var(--accent); color: var(--accent-ink); font-weight: 650; }
@media (max-width: 900px) { .switch-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  body.typed { --band-h: 32px; }
  .band { padding-left: 12px; font-size: 13px; }
  .band-text { cursor: pointer; }
  #bandLong { display: none; }
  #bandShort { display: inline; }
  .band-switch { height: 26px; font-size: 12.5px; }
  .band-traits { right: var(--gap); max-width: none; }
  /* The Invite button keeps its icon; its words would push the room clock onto the title. */
  #inviteLabel { display: none; }
  .switch-panel { left: 0; right: 0; bottom: 0; top: auto; width: auto; max-height: calc(100dvh - var(--bar, 50px) - 2 * var(--gap)); border-bottom: 0; border-radius: 18px 18px 0 0; }
  .switch-panel .grab { display: block; flex: none; width: 38px; height: 4px; margin: 8px auto 0; border-radius: 4px; background: var(--faint); opacity: .6; }
  .switch-grid { grid-template-columns: 1fr; gap: 7px; padding: 8px 10px calc(12px + env(safe-area-inset-bottom)); }
  .b-card { flex-direction: row; }
  .b-thumb { width: 88px; height: auto; align-self: stretch; }
  .b-tag { display: none; }
  .b-rhythm { display: inline; }
  .b-fullov { font-size: 12px; }
  .b-body { gap: 4px; padding: 7px 10px 8px; }
  /* The whole card is the button here; only the guest's own building keeps its label. */
  .b-go { display: none; }
  .b-card.here .b-go { display: block; padding: 3px 10px; }
  .b-thumb img { position: absolute; inset: 0; }
}
@media (prefers-reduced-motion: reduce) { .b-card { transition: none; } }
body.pip .band, body.pip .band-traits, body.pip .switch-panel, body.pip .switch-dim,
body.record .band, body.record .band-traits, body.record .switch-panel, body.record .switch-dim { display: none !important; }

/* The room clock floats where the invite note used to sit, so on a wide screen the note goes under it. */
@media (min-width: 761px) { body.rc-on .invite-pop { top: calc(var(--bar, 50px) + 2 * var(--gap) + 78px); } }
