/* Living-room device (room-picker.js): the profile picker like a TV app, the PIN pad, the
   "who is listening" chip in the title bar. Plus the "Tap to play" button (autoplay blocked).
   Kept plain on purpose (no nesting, no :has()) - the kiosk tablet runs an older Chrome. */

.room-screen {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 46;
  display: flex; flex-direction: column; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 24px 32px 32px; background: var(--bg); color: var(--text);
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
  animation: fadeIn .25s ease;
}
.room-screen.out { animation: fadeOut .2s ease forwards; }
.room-screen [hidden] { display: none !important; }
.room-top { position: relative; display: flex; align-items: center; gap: 12px; min-height: 48px; }
.room-logo { width: 38px; height: 38px; filter: drop-shadow(0 6px 18px var(--accent-mid)); }
.room-brand { font-family: var(--font-display); font-weight: 700; font-size: 22px; letter-spacing: -.02em; }
.room-place { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 16px; font-weight: 600; }
.room-place:empty { display: none; }
.room-body { position: relative; flex: 1; display: flex; align-items: center; justify-content: center; padding: 16px 0; }

/* ---------- grid of profiles ---------- */
.room-grid-view { width: 100%; max-width: 1100px; text-align: center; }
.room-grid-view h1 { margin: 0 0 36px; font-family: var(--font-display); font-size: 40px; font-weight: 700; letter-spacing: -.02em; }
.room-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 28px 36px; }
.room-profile {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 14px; width: 168px; padding: 10px 6px 12px;
  border: 0; border-radius: 22px; background: none; color: var(--text); cursor: pointer; font: inherit;
  transition: transform .15s ease, background .15s ease;
}
.room-profile:active { transform: scale(.95); }
.room-profile:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
.room-avatar {
  position: relative; display: flex; align-items: center; justify-content: center; flex: none; overflow: hidden;
  width: 136px; height: 136px; border-radius: 50%; color: #fff; font-weight: 800; font-size: 56px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .35), inset 0 0 0 1px rgba(255, 255, 255, .12); text-shadow: 0 2px 10px rgba(0, 0, 0, .25);
}
.room-avatar img { width: 100%; height: 100%; object-fit: cover; }
.room-avatar.sm { width: 96px; height: 96px; font-size: 40px; }
.room-avatar.xs { width: 30px; height: 30px; font-size: 14px; box-shadow: none; text-shadow: none; }
.room-profile:hover .room-avatar { box-shadow: 0 0 0 4px var(--accent-mid), 0 14px 34px rgba(0, 0, 0, .35); }
.room-pname { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; font-size: 20px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-lock { display: inline-flex; color: var(--text-2); }
.room-lock .i { width: 18px; height: 18px; }
.room-profile .spinner { display: none; position: absolute; top: 62px; left: 50%; margin-left: -12px; width: 24px; height: 24px; border-color: rgba(255, 255, 255, .35); border-top-color: #fff; }
.room-profile.busy .spinner { display: block; }
.room-profile.busy .room-avatar span { opacity: .25; }
.room-empty { display: flex; flex-direction: column; align-items: center; gap: 14px; max-width: 560px; margin: 0 auto; color: var(--text-2); font-size: 17px; line-height: 1.55; }
.room-empty .i { width: 64px; height: 64px; color: var(--accent); }
.room-empty p { margin: 0; }
.room-empty b { display: block; margin-bottom: 6px; color: var(--text); font-size: 21px; }
.room-msg { min-height: 26px; margin-top: 22px; color: #f2555a; font-size: 16px; font-weight: 600; }

/* ---------- PIN pad ---------- */
.room-pin-view { display: flex; flex-direction: column; align-items: center; width: 100%; max-width: 420px; }
.room-pin-who { display: flex; flex-direction: column; align-items: center; gap: 10px; font-size: 22px; font-weight: 700; }
.room-pin-lead { margin: 14px 0 12px; color: var(--text-2); font-size: 16px; }
.room-dots { display: flex; gap: 14px; height: 20px; align-items: center; }
.room-dots span { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--text-3); transition: background .12s, border-color .12s; }
.room-dots span.on { background: var(--text); border-color: var(--text); }
.room-dots.shake { animation: roomShake .38s ease; }
@keyframes roomShake { 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }
.room-pin-view .room-msg { margin-top: 10px; text-align: center; }
.room-pad { display: grid; grid-template-columns: repeat(3, 88px); gap: 14px 22px; margin-top: 6px; }
.room-key {
  position: relative; display: flex; align-items: center; justify-content: center; width: 88px; height: 88px; border-radius: 50%;
  border: 1px solid var(--border-2); background: var(--surface); color: var(--text); font: inherit; font-size: 32px; font-weight: 600; cursor: pointer;
  transition: background .1s, transform .1s;
}
.room-key:active { background: var(--accent-soft); transform: scale(.94); }
.room-key:disabled { opacity: .35; }
.room-key .i { width: 30px; height: 30px; }
.room-key.fn { border-color: transparent; background: none; }
.room-key.ok { border-color: transparent; background: var(--accent); color: var(--on-accent); }
.room-key.ok .spinner { display: none; position: absolute; width: 30px; height: 30px; }
.room-key.ok.busy .spinner { display: block; }
.room-key.ok.busy .i { opacity: 0; }
.room-back { display: inline-flex; align-items: center; gap: 8px; margin-top: 22px; padding: 12px 16px; font-size: 16px; }
.room-back .i { width: 18px; height: 18px; }

/* ---------- connecting / switching ---------- */
.room-cover { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.room-cover .spinner { width: 34px; height: 34px; }
.room-cover h1 { margin: 10px 0 0; font-family: var(--font-display); font-size: 30px; }
.room-cover p { margin: 0; color: var(--text-2); font-size: 16px; }

/* small or short screens */
@media (max-width: 640px), (max-height: 560px) {
  .room-screen { padding: 14px 16px 20px; }
  .room-grid-view h1 { font-size: 28px; margin-bottom: 22px; }
  .room-grid { gap: 18px 14px; }
  .room-profile { width: 120px; }
  .room-avatar { width: 96px; height: 96px; font-size: 40px; }
  .room-avatar.sm { width: 64px; height: 64px; font-size: 28px; }
  .room-profile .spinner { top: 42px; }
  .room-pname { font-size: 16px; }
  .room-pad { grid-template-columns: repeat(3, 68px); gap: 10px 16px; }
  .room-key { width: 68px; height: 68px; font-size: 26px; }
}

/* ---------- room mode in the app ---------- */
.room-chip {
  display: inline-flex; align-items: center; gap: 10px; margin-left: auto; max-width: 260px; height: 42px; padding: 0 16px 0 6px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
  -webkit-app-region: no-drag;
}
.room-chip:active { background: var(--hover); }
.room-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html.l-phone .room-chip { height: 36px; padding-right: 6px; }
html.l-phone .room-chip-name { display: none; }
/* this device's name is the room's name there (set when pairing) */
html.room-mode #setDevice { display: none !important; }
.acct .room-avatar { width: 40px; height: 40px; font-size: 16px; box-shadow: none; }
.room-setup { margin-top: 4px; }

/* ---------- autoplay blocked: one big button ---------- */
.tap-to-play {
  position: fixed; left: 50%; top: 50%; z-index: 58; display: flex; align-items: center; gap: 18px; max-width: calc(100% - 32px);
  padding: 20px 30px 20px 22px; transform: translate(-50%, -50%); border: 0; border-radius: 999px;
  background: var(--accent); color: var(--on-accent); font: inherit; text-align: left; cursor: pointer;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .45); animation: popIn .2s ease;
}
.tap-to-play > .i { flex: none; width: 40px; height: 40px; }
.tap-to-play b { display: block; font-size: 22px; }
.tap-to-play span span { display: block; max-width: 60vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .8; font-size: 15px; }

/* "Add profile": a dashed tile next to the profiles, and its sign-in form */
.room-avatar-add { background: transparent !important; border: 3px dashed var(--text-3); color: var(--text-2); box-shadow: none; text-shadow: none; }
.room-avatar-add span { font-size: 64px; font-weight: 300; line-height: 1; }
.room-add:hover .room-avatar-add { border-color: var(--accent); color: var(--accent); box-shadow: none; }
.room-add .room-pname { color: var(--text-2); }
.room-hint { max-width: 520px; margin: 18px auto 0; color: var(--text-2); font-size: 15px; line-height: 1.5; }
.room-add-view { display: flex; flex-direction: column; gap: 14px; width: min(420px, 100%); margin: 0 auto; text-align: left; }
.room-add-view h1 { text-align: center; margin-bottom: 0; }
.room-add-view .room-pin-lead, .room-add-view .room-hint, .room-add-view .room-msg { text-align: center; margin: 0; }
.room-field .input { font-size: 17px; padding: 12px 14px; }
.room-field small { font-weight: 500; color: var(--text-3); }
.room-add-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.room-add-actions .room-back { margin-top: 0; }
