/* The HUD (H1): the player plate top left, the room board top right, the dock of places on the left (a tab
   row on a phone) and the action bar at the bottom. Cards are the site's card2, a little see-through over the
   room; one accent; every icon in one of three square boxes and every count in one bubble. */

/* ---- the alignment rule, as tokens: three icon boxes, one count bubble, one chip height */
:root {
  --gap: 16px;
  --icon-xs: 16px;
  --icon-s: 24px;
  --icon-m: 32px;
  --badge-size: 18px;
  --badge-offset: 2px; /* the bubble's centre sits this far below its icon box's top right corner */
  --chip-h: 30px;
}
@media (max-width: 760px) { :root { --gap: 10px; --chip-h: 28px; } }

.ib { position: relative; flex: none; display: grid; place-items: center; }
.ib.s16 { width: var(--icon-xs); height: var(--icon-xs); }
.ib.s24 { width: var(--icon-s); height: var(--icon-s); }
.ib.s32 { width: var(--icon-m); height: var(--icon-m); }
.ib > img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .4)); }
/* "needs company": two people side by side in one box */
.ib.pair > img { inset: auto; top: 18.75%; left: 0; width: 62.5%; height: 62.5%; }
.ib.pair > img + img { left: 37.5%; }
.count { position: absolute; left: 100%; top: var(--badge-offset); transform: translate(-50%, -50%); min-width: var(--badge-size); height: var(--badge-size); padding: 0 5px; box-sizing: border-box; border-radius: calc(var(--badge-size) / 2); background: var(--accent); color: var(--accent-ink); font: 800 11px/var(--badge-size) "Plus Jakarta Sans", ui-sans-serif, sans-serif; font-style: normal; text-align: center; white-space: nowrap; font-variant-numeric: tabular-nums; box-shadow: 0 0 0 2px var(--panel); }
.count[hidden], .count:empty { display: none; }

.hud-chip { display: inline-flex; align-items: center; gap: 6px; height: var(--chip-h); padding: 0 11px 0 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--well); color: var(--ink); font-size: 13px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.hud-chip[hidden] { display: none; }
.pill, .resident-chip .chip-text b { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--well); color: var(--ink); font-size: 11px; font-weight: 700; line-height: 1; white-space: nowrap; }
.mini-bar { display: block; flex: none; width: 44px; height: 8px; overflow: hidden; border-radius: 4px; background: color-mix(in srgb, var(--ink) 12%, transparent); }
.mini-bar i { display: block; height: 100%; border-radius: 4px; background: var(--accent); transform-origin: left; transform: scaleX(0); transition: transform .4s ease; }

/* ---- the top: the plate on the left, the board on the right; between them clicks reach the room */
.hud-top { position: fixed; z-index: 20; top: var(--gap); left: var(--gap); right: var(--gap); display: flex; justify-content: space-between; align-items: flex-start; gap: var(--gap); pointer-events: none; }
.hud-top > * { pointer-events: auto; }

/* ---- the player plate */
.plate { position: relative; display: flex; align-items: center; gap: 14px; min-width: 0; padding: 12px 16px 12px 12px; }
.plate[hidden] { display: none; }
.plate-face { position: relative; flex: none; width: 68px; height: 68px; border-radius: 50%; background: var(--panel); box-shadow: inset 0 0 0 5px color-mix(in srgb, var(--ink) 14%, transparent); }
.plate-face img { position: absolute; left: 5px; top: 5px; width: 58px; height: 58px; border-radius: 50%; object-fit: cover; }
.plate-face img[hidden] { display: none; }
.plate-main { display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.plate-name { display: flex; align-items: center; gap: 8px; height: 22px; white-space: nowrap; }
.plate-who { font-size: 19px; font-weight: 800; line-height: 22px; letter-spacing: -.01em; }
.plate-wells { display: flex; align-items: center; gap: 8px; }
/* The resident chip (resident-ui.js) is the level pill and the days line; its ring is drawn round the
   picture: the plate, not the chip, is the ring's containing block. */
.plate .resident-chip { position: static; display: none; align-items: center; gap: 0; min-width: 0; height: auto; padding: 0; border: 0; border-radius: 0; background: none; color: inherit; font: inherit; cursor: pointer; animation: none; }
.plate .resident-chip.on { display: inline-flex; }
.plate .resident-chip:hover, .plate .resident-chip[aria-expanded="true"] { background: none; }
.plate .resident-chip:hover .chip-text b, .plate .resident-chip[aria-expanded="true"] .chip-text b { border-color: var(--accent); }
.plate .resident-chip .chip-ring { position: absolute; left: 12px; top: 50%; width: 68px; height: 68px; margin-top: -34px; pointer-events: none; }
.plate .resident-chip .chip-ring b { display: none; }
.plate .resident-chip .chip-ring .track { stroke: color-mix(in srgb, var(--ink) 14%, transparent); }
.plate .resident-chip .chip-ring .arc { stroke: var(--accent); }
.plate .resident-chip .chip-text { flex-direction: row; align-items: center; gap: 10px; }
.plate .resident-chip .chip-text small { color: var(--hud-muted); font-size: 12px; font-weight: 600; }
.plate .bean-chip { display: none; align-items: center; gap: 8px; min-width: 0; height: auto; padding: 0; border: 0; border-radius: 0; background: none; color: inherit; font: inherit; cursor: pointer; animation: none; }
.plate .bean-chip.on { display: inline-flex; }
.plate .bean-chip:hover .hud-chip { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.plate .bean-chip.full .chest { border-color: var(--accent); }
.plate .bean-chip b, .plate .bean-chip small { color: var(--ink); font-size: 13px; font-weight: 700; }

/* ---- the room board: the building, the room's clock, who is here, the shared hour, then the settings */
.board { position: relative; flex: none; width: 268px; margin-left: auto; padding: 0; box-shadow: inset 0 3px 0 var(--accent), var(--shadow-card); }
.board h1 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.board .summary { display: none; }
.board .band { position: static; display: flex; align-items: center; gap: 8px; height: auto; padding: 12px 14px 0; border-radius: 0; background: none; color: var(--ink); }
.board .band[hidden] { display: none; }
.band-text { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; font-size: 15px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.band-icon { display: contents; }
#bandShort { display: none; }
#bandNo { margin-left: auto; }
/* The Beach has no number. */
#bandNo:empty { display: none; }
.band-text:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 2px; }
.board .rc { position: relative; display: flex; align-items: center; gap: 14px; padding: 10px 14px 0; }
.board .rc[hidden] { display: none; }
.board .rc-ring { width: 60px; height: 60px; }
.board .rc-ring circle { stroke-width: 4.4; }
.board .rc-ring .track { stroke: color-mix(in srgb, var(--ink) 14%, transparent); }
.board .rc-ring .ib { position: absolute; inset: 0; margin: auto; }
.board .rc-text { gap: 3px; }
.board .rc-label { color: var(--hud-muted); font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.board .rc-time { font-size: 28px; font-weight: 800; line-height: 30px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.board .rc-sub { display: none; }
.board-people { margin: 0; padding: 2px 14px 14px 88px; color: var(--hud-muted); font-size: 12px; }
.board-people:empty { display: none; }
.board .shared-pill { margin: -4px 14px 12px; border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-soft); color: var(--ink); }
.board .shared-pill i { background: var(--accent); }
/* "Invite a friend" and "Pop out" keep their words inside the button: the icon buttons and the row's edges give the room. */
.board .controls { display: flex; align-items: center; justify-content: flex-end; gap: 6px; padding: 8px; border-top: 1px solid var(--line); }
.board .controls .btn { justify-content: center; min-width: 32px; min-height: 32px; padding: 4px 7px; border-radius: 10px; white-space: nowrap; }
.board #langName, .board #settingsMenu > summary [data-t], .board .menu > summary::after { display: none; }

/* ---- the dock: Phòng, Bảng, Túi đồ, Huy hiệu, Việc, Đổi tòa */
.nav-dock { position: fixed; z-index: 15; left: var(--gap); top: calc(var(--plate, 110px) + var(--gap)); display: flex; flex-direction: column; gap: 4px; padding: 6px; }
.nav-dock[hidden] { display: none; }
.dk { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; width: 68px; height: 64px; padding: 0; border: 0; border-radius: 14px; background: none; color: color-mix(in srgb, var(--ink) 84%, transparent); font: 700 11px/1 "Plus Jakarta Sans", ui-sans-serif, sans-serif; cursor: pointer; }
.dk[hidden] { display: none; }
.dk:hover { background: var(--well); }
.dk.on, .dk[aria-expanded="true"] { background: var(--accent-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent); }
.dk:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 1px; }
/* A long name ("Switch building", "Gebäude wechseln") takes two lines inside its tile, never the next tile's room. */
.dk-label { max-width: calc(100% - 4px); line-height: 1.1; text-align: center; overflow-wrap: break-word; }

/* ---- the action bar: Start, then the presence buttons, each a neutral card with its thing */
.status-bar.hud { left: 50%; bottom: var(--gap); transform: translateX(-50%); flex-wrap: nowrap; gap: 8px; padding: 8px; border-radius: 24px; }
.status-bar .own, .status-bar .room-clock { display: none; }
.status-bar .acts { flex-wrap: nowrap; gap: 8px; }
.status-bar .acts .btn { gap: 8px; height: 52px; min-height: 52px; padding: 0 16px 0 10px; border-radius: 16px; font-size: 14px; font-weight: 700; }
.status-bar .acts .btn:disabled { opacity: .45; }
.status-bar .acts .act[aria-pressed="true"] { opacity: 1; border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-soft); color: var(--accent); }
.status-bar .acts [data-act="done"][aria-pressed="true"] { border-color: color-mix(in srgb, var(--green) 45%, transparent); background: color-mix(in srgb, var(--green) 12%, transparent); color: var(--green); }
.status-bar .acts .go { padding: 0 20px 0 12px; border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.status-bar .acts .go:hover { border-color: var(--accent-hi); background: var(--accent-hi); }
.status-bar.has-start [data-act="focus"] { display: none; }
.go-play { flex: none; width: 24px; height: 24px; margin: 0 4px; fill: currentColor; }
.go-text { display: flex; flex-direction: column; gap: 2px; text-align: left; }
.go-text b { font-size: 16px; line-height: 18px; }
.go-text small { font-size: 12px; font-weight: 600; line-height: 14px; opacity: .78; font-variant-numeric: tabular-nums; }
.done-check { width: 75%; height: 75%; fill: none; stroke: var(--green); stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; }
.acts .lbl-short { display: none; }
.status-bar .switch { min-height: 52px; border-radius: 16px; background: var(--btn); }
.status-bar .switch[aria-checked="true"] i { background: var(--accent); }
.status-bar .own-rhythm { min-height: 52px; border-radius: 16px; background: var(--btn); }
.demo-note { max-width: 300px; }

/* ---- a phone: a compact plate and board on top, the action bar over the dock's tab row */
@media (max-width: 760px) {
  .plate { display: grid; grid-template-columns: 54px minmax(0, 1fr); align-items: start; gap: 9px 10px; width: 206px; padding: 10px 12px 10px 10px; border-radius: 18px; }
  .plate-face { width: 54px; height: 54px; box-shadow: inset 0 0 0 4px color-mix(in srgb, var(--ink) 14%, transparent); }
  .plate-face img { left: 4px; top: 4px; width: 46px; height: 46px; }
  .plate-main { display: contents; }
  .plate-name { align-items: flex-start; gap: 6px; height: auto; min-height: 54px; min-width: 0; padding-top: 7px; }
  .plate-who { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 15px; line-height: 20px; }
  /* The name keeps the row: the level pill gives way to the level on the picture's ring, a coin as on the
     name plates over people's heads (web/nameplate.js), and the picture opens the progress panel. A new
     resident has no level to show. */
  .plate .resident-chip { position: absolute; left: 10px; top: 10px; width: 54px; height: 54px; border-radius: 50%; }
  .plate .resident-chip .chip-ring { left: 0; top: 0; width: 54px; height: 54px; margin-top: 0; }
  .plate .resident-chip .chip-text { gap: 4px; }
  .plate .resident-chip .chip-text b { display: none; }
  .plate .resident-chip .chip-ring b { position: absolute; right: -4px; bottom: -4px; display: grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; box-sizing: border-box; border-radius: 10px; background: var(--ink); color: var(--panel); font: 800 11px/1 "Plus Jakarta Sans", ui-sans-serif, sans-serif; box-shadow: 0 0 0 2px var(--panel); }
  .plate .resident-chip[data-level="0"] .chip-ring b { display: none; }
  /* The days line takes the row under the name. */
  .plate .resident-chip .chip-text small { position: absolute; left: 64px; top: 31px; font-size: 11px; white-space: nowrap; }
  .plate-wells { grid-column: 1 / -1; display: grid; grid-template-columns: auto auto 1fr; gap: 6px; }
  .plate .bean-chip.on { display: contents; }
  .plate .bean-chip .hud-chip, .plate-streak { height: var(--chip-h); padding-right: 9px; font-size: 12px; }
  .plate .bean-chip .chest { grid-column: 1 / -1; grid-row: 2; justify-content: space-between; padding-right: 10px; }
  .plate .bean-chip .chest .mini-bar { flex: 1; width: auto; }
  .plate .bean-chip b, .plate .bean-chip small { font-size: 12px; }

  .board { width: 150px; border-radius: 18px; }
  .board .band { gap: 6px; padding: 11px 10px 0; }
  .band-text { font-size: 13px; }
  #bandLong { display: none; }
  #bandShort { display: inline; }
  #bandNo { padding: 0 7px; }
  .board .rc { display: grid; grid-template-columns: 24px 1fr; align-items: center; gap: 7px 6px; padding: 7px 10px 0; }
  .board .rc-text { display: contents; }
  .board .rc-label { grid-column: 1 / -1; grid-row: 1; font-size: 10px; letter-spacing: .03em; }
  .board .rc-ring { grid-column: 1; grid-row: 2; width: 24px; height: 24px; }
  .board .rc-ring svg { display: none; }
  .board .rc-time { grid-column: 2; grid-row: 2; font-size: 24px; line-height: 26px; }
  .board .rc-mini { grid-column: 1 / -1; font-size: 10.5px; }
  .board-people { padding: 7px 10px 10px; font-size: 11px; }
  .board .shared-pill { margin: -2px 8px 10px; padding: 4px 8px; border-radius: 10px; font-size: 10.5px; line-height: 1.25; white-space: normal; }
  .board .controls { justify-content: space-between; padding: 6px 8px; }
  .board .controls .btn { min-width: 30px; min-height: 30px; padding: 3px 6px; }

  .nav-dock { top: auto; left: var(--gap); right: var(--gap); bottom: var(--gap); flex-direction: row; justify-content: space-between; padding: 6px 8px; border-radius: 22px; }
  /* the join sheet sits on the tab row while the row is up */
  body.join-open:has(#navDock:not([hidden])) .join { bottom: calc(var(--gap) + 74px); }
  /* six fit a 390 px phone: Phòng, Bảng, Túi đồ, Huy hiệu, Việc, Đổi tòa */
  .dk { width: 56px; height: 56px; }
  .dk .ib.s32 { width: var(--icon-s); height: var(--icon-s); }

  .status-bar.hud { left: var(--gap); right: var(--gap); bottom: calc(var(--gap) + 74px); transform: none; width: auto; flex-wrap: wrap; justify-content: flex-start; gap: 7px; padding: 7px; border-radius: 22px; }
  .status-bar .acts { flex: 1 1 100%; flex-wrap: nowrap; gap: 7px; }
  .status-bar .acts .btn { height: 54px; min-height: 54px; }
  .status-bar .acts .go { flex: 1; min-width: 0; gap: 7px; padding: 0 10px 0 8px; }
  .status-bar .acts .act { flex: 0 1 58px; flex-direction: column; justify-content: center; gap: 4px; min-width: 48px; width: auto; padding: 0 2px; font-size: 10.5px; line-height: 1.1; text-align: center; }
  .go-play { width: 20px; height: 20px; margin: 0 2px; }
  .go-text small { font-size: 11px; }
  .status-bar .acts .act .ib.s32 { width: var(--icon-s); height: var(--icon-s); }
  .acts .lbl { display: none; }
  .acts .lbl-short { display: inline; }
  /* the rhythm switch (and an own rhythm) is a short row over the buttons */
  .status-bar .switch, .status-bar .own-rhythm { min-height: 34px; border-radius: 12px; }
}
@media (prefers-reduced-motion: reduce) { .mini-bar i { transition: none; } }
body.pip .plate, body.record .plate { display: none !important; }
