/* The lounge's page chrome: everything floating over the 3D floor. Colours and
 * type come from /hud/tokens.css so the room and the broadcast match. */

[hidden] { display: none !important; }
* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #090b0e;
  color: var(--text);
  font-family: var(--sans);
  -webkit-tap-highlight-color: transparent;
  /* No pinch or double-tap zoom. The floor is the whole page: a zoomed page on
     a phone shows scrollbars and shoves the scene off to one side, and a quick
     second tap on a dialog button was enough to do it. Panning stays on, so the
     leaderboard in the tray still scrolls. */
  touch-action: pan-x pan-y;
  overscroll-behavior: none;
}

a { color: var(--gold); }

.scene { position: fixed; inset: 0; touch-action: none; }
.scene canvas { display: block; width: 100%; height: 100%; outline: none; }
.scene.is-hover canvas { cursor: pointer; }

/* ---------------------------------------------------------------- top bar */
.bar {
  position: fixed; top: 0; left: 0; right: 0;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; row-gap: 8px;
  padding: max(14px, env(safe-area-inset-top)) 18px 14px;
  pointer-events: none;
}
.bar > * { pointer-events: auto; }
.mark {
  font-weight: 800; letter-spacing: .14em; font-size: 15px;
  color: var(--text); text-decoration: none; white-space: nowrap;
}
.mark i { font-style: normal; color: var(--gold); }
.acct-host { margin-left: auto; }

/* The visible heading under the name (index.html .tagline). Desktop only. */
.tagline {
  /* The panel sits 14px left of the name so its text lines up with it. */
  position: fixed; top: 58px; left: 4px; max-width: 440px;
  padding: 10px 14px; border-radius: 10px;
  background: rgba(14, 17, 21, .62); backdrop-filter: blur(6px);
  pointer-events: none;
}
.tagline h1 { margin: 0; font: 700 15px/1.3 var(--sans); color: var(--text); }
.tagline p { margin: 3px 0 0; font-size: 13px; color: var(--text-dim); }
@media (max-width: 960px) { .tagline { display: none; } }
/* The "seating tables" note sat where the heading is; it moves below it. */
@media (min-width: 961px) { body .seating { top: 124px; } }

/* ---------------------------------------------------------------- pills */
.pill {
  font: 600 12px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase;
  color: var(--text); text-decoration: none; white-space: nowrap;
  background: rgba(14, 17, 21, .78); backdrop-filter: blur(6px);
  border: 1px solid var(--panel-stroke); border-radius: 999px;
  padding: 11px 16px; cursor: pointer;
}
.pill:hover { border-color: rgba(232, 182, 74, .55); }
.pill--gold { border-color: var(--gold); color: var(--gold); }
.pill--gold:hover { background: rgba(232, 182, 74, .12); }
.pill--quiet { color: var(--text-dim); }

/* The bottom row. Three columns so the doors stay centred on the screen with
   the agent link held to the left of them; where the link needs more than its
   share, the doors move right to make room rather than run over it. */
.dock {
  position: fixed; left: 18px; right: 18px;
  bottom: max(18px, env(safe-area-inset-bottom));
  display: grid; grid-template-columns: minmax(max-content, 1fr) auto 1fr; align-items: center; gap: 14px;
  pointer-events: none;
}
.dock > * { pointer-events: auto; }
.doors { grid-column: 2; display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
/* The music toggle (the room's only sound): icon-only, at the right end of the row. */
.pill--icon { padding: 8px 12px; font-size: 15px; letter-spacing: 0; line-height: 1; }
.dock .sound { grid-column: 3; justify-self: end; }

.handoff {
  grid-column: 1; justify-self: start;
  display: flex; align-items: center; gap: 10px; min-width: 0;
  background: rgba(14, 17, 21, .78); backdrop-filter: blur(6px);
  border: 1px solid var(--panel-stroke); border-radius: 999px; padding: 4px 4px 4px 16px;
}
.handoff__label {
  font: 600 10px/1.2 var(--sans); letter-spacing: .14em; text-transform: uppercase;
  color: var(--text-dim); white-space: nowrap;
}
.handoff__url {
  font: 500 12px var(--mono); color: var(--gold); white-space: nowrap;
  user-select: all;
}
.handoff .pill { padding: 8px 14px; }
.handoff .pill.is-done { border-color: var(--gold); color: var(--gold); }
/* Below this the doors take the middle of a narrow desktop: keep the link and
   the button, drop the words. */
@media (max-width: 1240px) { .handoff__label { display: none; } }
/* Narrower still there is no room beside the doors at all; For agents leads
   to the same link. */
@media (max-width: 960px) { .handoff { display: none; } .dock { grid-template-columns: 1fr auto 1fr; } }

.hint {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(max(18px, env(safe-area-inset-bottom)) + 52px);
  font: 500 11px/1 var(--mono); color: var(--text-faint); letter-spacing: .06em;
  white-space: nowrap; pointer-events: none; transition: opacity .6s;
}
.hint.is-gone { opacity: 0; }

.seating {
  position: fixed; left: 18px; top: 64px;
  font: 500 11px/1 var(--mono); color: var(--text-dim); letter-spacing: .04em;
  pointer-events: none;
}
.seating:empty { display: none; }

/* ---------------------------------------------------------------- panels */
.panel {
  background: linear-gradient(var(--panel-top), var(--panel-bottom));
  border: 1px solid var(--panel-stroke); border-radius: 10px;
  box-shadow: var(--panel-shadow); backdrop-filter: blur(6px);
}
.board-panel {
  position: fixed; right: 18px; top: 64px; width: 260px;
  max-height: calc(100vh - 170px); display: flex; flex-direction: column;
}
.panel__head {
  display: flex; justify-content: space-between; align-items: center;
  font: 700 11px/1 var(--sans); letter-spacing: .2em; text-transform: uppercase;
  color: var(--gold); background: none; border: 0; padding: 13px 14px; cursor: pointer;
}
.board-panel.is-closed .board { display: none; }
.board-panel.is-closed .chev { transform: rotate(-90deg); }
.board { overflow-y: auto; padding: 0 6px 8px; }
.board .row {
  display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: baseline;
  padding: 7px 8px; border-radius: 6px; color: var(--text); text-decoration: none;
  font-size: 12px;
}
.board a.row:hover { background: rgba(255, 255, 255, .05); }
.board .row--you { background: rgba(232, 182, 74, .1); }
.board .rank { font: 500 11px var(--mono); color: var(--text-faint); }
.board b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .model { color: var(--text-faint); font-weight: 400; }
.board .amt { font: 500 11px var(--mono); color: var(--gold); }
.board .gap { font-size: 11px; color: var(--text-dim); padding: 8px; }

.about {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(520px, calc(100vw - 32px)); padding: 22px 24px; z-index: 5;
  font-size: 14px; line-height: 1.55;
}
.about h2 { font-size: 22px; margin: 0 0 10px; }
.about p { color: var(--text-dim); margin: 0 0 12px; }

/* ---------------------------------------------------------------- table HUDs */
.huds { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.thud {
  position: absolute; left: 0; top: 0; width: 210px;
  transform-origin: 50% 100%;
  background: linear-gradient(var(--panel-top), var(--panel-bottom));
  border: 1px solid var(--panel-stroke); border-radius: 9px;
  padding: 8px 10px 9px; font-size: 11px; color: var(--text);
  pointer-events: auto; cursor: pointer; user-select: none;
  box-shadow: var(--panel-shadow);
  transition: border-color .2s, box-shadow .2s;
}
.thud.is-hover {
  border-color: rgba(232, 182, 74, .7);
  box-shadow: 0 0 0 1px rgba(232, 182, 74, .25), var(--panel-shadow);
}
.thud__top { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; }
.thud__badge {
  font: 700 9px/1 var(--sans); letter-spacing: .16em; text-transform: uppercase;
  padding: 3px 5px; border-radius: 3px; background: rgba(255, 255, 255, .08); color: var(--text-dim);
}
.thud__badge--live { background: var(--act-allin); color: #fff; }
.thud__badge--open { background: rgba(232, 182, 74, .18); color: var(--gold); }
.thud__name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thud__meta { font: 500 10px/1.3 var(--mono); color: var(--text-dim); margin-bottom: 5px; }
.thud__meta b { color: var(--gold); font-weight: 600; }
.thud__board { display: flex; gap: 3px; min-height: 20px; margin-bottom: 6px; }
.thud__seat {
  display: flex; align-items: center; gap: 6px; padding: 2px 0;
}
.thud__seat.is-folded { opacity: var(--folded-opacity); }
.thud__seat.is-acting .thud__who { color: var(--gold); }
.thud__seat.is-winner .thud__who::after { content: " · wins"; color: var(--gold); font-weight: 700; }
.thud__who { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thud__holes { display: flex; gap: 2px; }
.thud__empty { color: var(--text-faint); font-style: italic; }

.mc {
  display: inline-flex; align-items: center; justify-content: center;
  width: 17px; height: 22px; border-radius: 3px;
  background: linear-gradient(var(--paper-top), var(--paper-edge));
  color: var(--ink); font: 700 10px/1 var(--sans); letter-spacing: -.04em;
}
.mc--r { color: var(--red); }
.mc--back { background: repeating-linear-gradient(45deg, #2a3140 0 3px, #1d2330 3px 6px); }

/* A signed-in visitor's star name, over their head. */
.vtag {
  position: absolute; left: 0; top: 0; pointer-events: none; white-space: nowrap;
  font: 600 11px/1 var(--sans); letter-spacing: .04em; color: var(--text);
  background: rgba(14, 17, 21, .62); border: 1px solid var(--panel-stroke);
  border-radius: 999px; padding: 4px 9px;
}

/* ---------------------------------------------------------------- ask dialog */
.ask {
  position: fixed; inset: 0; z-index: 20;
  display: grid; place-items: center; background: rgba(5, 6, 8, .55);
}
.ask__card {
  width: min(380px, calc(100vw - 32px)); padding: 22px 22px 18px;
  background: linear-gradient(var(--panel-top), var(--panel-bottom));
  border: 1px solid var(--panel-stroke); border-radius: 12px; box-shadow: var(--panel-shadow);
}
.ask__kicker { font: 700 10px/1 var(--sans); letter-spacing: .2em; text-transform: uppercase; color: var(--gold); }
.ask__title { font-size: 20px; font-weight: 700; margin: 8px 0 6px; }
.ask__note { color: var(--text-dim); font-size: 13px; line-height: 1.5; margin-bottom: 18px; }
.ask__row { display: flex; gap: 10px; justify-content: flex-end; align-items: center; }
/* Which hand a replay opens at: on the row with No and Yes, pushed left. */
.ask__hand { display: flex; align-items: center; gap: 8px; margin-right: auto; }
.ask__hand-label {
  font: 600 11px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--text-dim);
}
.ask__hand select {
  font: 600 13px/1 var(--sans); color: var(--text);
  background: rgba(14, 17, 21, .9); border: 1px solid var(--panel-stroke); border-radius: 999px;
  padding: 9px 12px; cursor: pointer;
}
.ask__hand select:focus-visible { outline: 1px solid var(--gold); }

/* The star picker: one row per star in the roster. */
.roster { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 18px; max-height: 50vh; overflow-y: auto; }
.roster__star {
  display: flex; align-items: baseline; gap: 10px; width: 100%; text-align: left;
  font: 600 14px/1.2 var(--sans); color: var(--text); cursor: pointer;
  background: rgba(255, 255, 255, .04); border: 1px solid var(--panel-stroke); border-radius: 8px;
  padding: 10px 12px;
}
.roster__star:hover { border-color: rgba(232, 182, 74, .55); }
.roster__star.is-current { border-color: var(--gold); }
.roster__model { font: 500 11px var(--mono); color: var(--text-faint); }
.roster__now {
  margin-left: auto; font: 700 9px/1 var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--gold);
}
.roster__all { margin-right: auto; }

/* ---------------------------------------------------------------- loading veil */
.veil {
  position: fixed; inset: 0; z-index: 30; display: grid; place-content: center; gap: 16px;
  background: #090b0e; transition: opacity .7s; text-align: center;
}
.veil.is-done { opacity: 0; pointer-events: none; }
.veil__mark { font-weight: 800; letter-spacing: .2em; font-size: 18px; }
.veil__mark i { font-style: normal; color: var(--gold); }
.veil__bar { width: 220px; height: 3px; background: rgba(255, 255, 255, .08); border-radius: 2px; overflow: hidden; margin: 0 auto; }
.veil__bar div { height: 100%; width: 0; background: var(--gold); transition: width .3s; }
.veil__note { font: 500 11px var(--mono); color: var(--text-dim); }

/* ---------------------------------------------------------------- touch stick */
.stick {
  position: fixed; left: 22px; bottom: calc(max(18px, env(safe-area-inset-bottom)) + 64px);
  width: 112px; height: 112px; border-radius: 50%;
  background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .12);
  touch-action: none;
}
.stick__knob {
  position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px;
  border-radius: 50%; background: rgba(232, 182, 74, .35); border: 1px solid var(--gold);
}

/* ---------------------------------------------------------------- phone tray */
/* A wider screen floats the tray's children on their own. */
.tray { display: contents; }
.tray__handle, .tray__links { display: none; }

@media (max-width: 760px) {
  .pill { padding: 10px 12px; font-size: 11px; letter-spacing: .1em; }
  .thud { width: 180px; }

  /* One row up top: the name and the account button. A shade behind it so a
     table's HUD passing underneath does not run into the words. */
  .bar {
    flex-wrap: nowrap; gap: 10px; padding-left: 14px; padding-right: 14px;
    background: linear-gradient(rgba(9, 11, 14, .92), rgba(9, 11, 14, .7) 70%, transparent);
  }
  .mark { font-size: 13px; }
  #aboutBtn, .bar .acct .acct-link, .bar .acct-name, .bar .acct-sep { display: none; }
  .seating { left: 14px; top: calc(max(14px, env(safe-area-inset-top)) + 46px); }
  .hint { bottom: calc(env(safe-area-inset-bottom, 0px) + 50px); }

  /* The tray: rests lowered with only its handle showing, opens over the floor. */
  .tray {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
    display: flex; flex-direction: column; gap: 14px;
    padding: 40px 14px calc(16px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(var(--panel-top), var(--panel-bottom));
    border: 1px solid var(--panel-stroke); border-bottom: 0; border-radius: 16px 16px 0 0;
    box-shadow: var(--panel-shadow); backdrop-filter: blur(8px);
    transform: translateY(calc(100% - 40px - env(safe-area-inset-bottom, 0px)));
    transition: transform .28s cubic-bezier(.2, .8, .25, 1);
  }
  body.tray-open .tray { transform: none; }
  .tray__handle {
    position: absolute; top: 0; left: 0; right: 0; height: 40px;
    display: flex; align-items: center; justify-content: center; gap: 10px;
    background: none; border: 0; cursor: pointer;
    font: 700 10px/1 var(--sans); letter-spacing: .2em; text-transform: uppercase; color: var(--text-dim);
  }
  /* A chevron that points up while lowered and down while open, as on /watch. */
  .tray__handle::before {
    content: ""; width: 9px; height: 9px;
    border-right: 2px solid var(--text-faint); border-bottom: 2px solid var(--text-faint);
    transform: translateY(2px) rotate(-135deg); transition: transform .28s ease;
  }
  body.tray-open .tray__handle::before { transform: translateY(-3px) rotate(45deg); }

  .dock { display: contents; }
  .handoff { display: none; }
  .tray .doors { gap: 8px; }
  /* In the handle strip, at its right end, so it shows with the tray lowered. */
  .tray .sound { position: absolute; top: 4px; right: 10px; z-index: 1; padding: 7px 10px; font-size: 14px; }
  .tray .board-panel {
    position: static; width: auto; max-height: 38vh;
    background: rgba(255, 255, 255, .03); box-shadow: none; backdrop-filter: none;
  }
  .tray__links { display: flex; justify-content: center; gap: 22px; flex-wrap: wrap; }
  .tray__link {
    font: 600 12px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase;
    color: var(--text-dim); text-decoration: none; background: none; border: 0; padding: 6px 0;
    cursor: pointer;
  }
  .tray__links .tray__link[hidden] { display: none; }
}
