/* ruletka.vip / Chatroulette-style dual stage */

/* Hidden SVG sprite host */
.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

/* Unified stroke icons (currentColor) */
.icon {
  width: 1.2rem;
  height: 1.2rem;
  display: block;
  flex-shrink: 0;
  color: currentColor;
}
.icon-sm {
  width: 1.05rem;
  height: 1.05rem;
  opacity: 0.92;
}
.icon-empty {
  width: 1.7rem;
  height: 1.7rem;
  color: #8b9bb0;
  opacity: 0.85;
}
.icon-next {
  width: 1rem;
  height: 1rem;
  color: #fff;
}

/* Full-bleed live page: override shared style.css body padding/max layout */
html:has(.stage-body),
html.stage-html {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #0a0b0e;
}

.stage-body {
  margin: 0 !important;
  /* style.css sets body padding — kill it so cams fill the viewport */
  padding: 0 !important;
  width: 100%;
  max-width: none !important;
  min-height: 100vh;
  min-height: 100dvh;
  height: 100%;
  height: 100dvh;
  background: #0a0b0e !important;
  /* Drop decorative gradients from style.css so stage is edge-to-edge */
  background-image: none !important;
  color: #eef2f7;
  font-family: var(--sans, "Inter", "Noto Sans", system-ui, "Segoe UI", sans-serif);
  overflow: hidden;
  /* Better Cyrillic line metrics */
  font-feature-settings: "kern" 1;
  text-rendering: optimizeLegibility;
}

/* Language switcher */
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: #8b9bb0;
}

.lang-switch select {
  background: #141a22;
  color: #e8eef7;
  border: 1px solid #2a3548;
  border-radius: 6px;
  padding: 0.15rem 0.35rem;
  font: inherit;
  cursor: pointer;
}

.lang-switch .icon {
  width: 0.95rem;
  height: 0.95rem;
  opacity: 0.9;
  color: #9aa8bc;
}

/* Language chip (placed last in .stage-top-actions = top-right) */
.lang-top-right {
  flex: 0 0 auto;
  margin-left: 0.15rem;
  padding: 0.2rem 0.4rem;
  border-radius: 999px;
  background: #141a22;
  border: 1px solid #2a3548;
}
.lang-top-right select {
  font-weight: 600;
  min-width: 2.5rem;
}

/* Chat: allow full Unicode (Cyrillic) */
.bottom-chat input {
  font-family: inherit;
  unicode-bidi: plaintext;
}

.arch-pill {
  font-size: 0.68rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  border: 1px solid rgba(61, 214, 140, 0.35);
  color: #7ddea8;
  background: rgba(20, 48, 36, 0.55);
  white-space: nowrap;
}

.pool-hint {
  font-size: 0.72rem;
  color: #9ec5ff;
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* First-run rules gate */
.rules-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(6, 8, 12, 0.88);
  backdrop-filter: blur(8px);
}
.rules-overlay[hidden] { display: none !important; }
.rules-card {
  width: min(26rem, 100%);
  background: #121820;
  border: 1px solid #2a3548;
  border-radius: 16px;
  padding: 1.35rem 1.4rem 1.25rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
}
.rules-card h2 {
  margin: 0 0 0.85rem;
  font-size: 1.2rem;
  font-weight: 650;
}
.rules-list {
  margin: 0 0 1rem;
  padding-left: 1.15rem;
  color: #b8c5d6;
  font-size: 0.92rem;
  line-height: 1.45;
}
.rules-list li { margin-bottom: 0.4rem; }
.rules-check { margin-bottom: 1rem; font-size: 0.95rem; }
.rules-accept {
  width: 100%;
  justify-content: center;
  padding: 0.7rem 1rem;
  font-size: 1rem;
}
.rules-accept:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.arch-pill.p2p-live {
  border-color: rgba(91, 157, 255, 0.45);
  color: #9ec5ff;
  background: rgba(20, 32, 56, 0.65);
}

.room-field {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  color: #8b9bb0;
}

.room-field input {
  width: 7.5rem;
  background: #141a22;
  color: #e8eef7;
  border: 1px solid #2a3548;
  border-radius: 8px;
  padding: 0.35rem 0.5rem;
  font: inherit;
}

.room-field.room-in-tile input {
  border: none;
  border-radius: 0;
  background: transparent;
}

.room-field input:focus {
  outline: 1px solid #5b9dff;
  border-color: #5b9dff;
}

.pill.tight {
  padding: 0.35rem 0.55rem;
  min-width: 2rem;
}

.check-row {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
}

.check-row input {
  width: auto !important;
  accent-color: #5b9dff;
}

/* Vertical split when stranger sees a party of 2 */
.remote-stack {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
}
.remote-stack .vid {
  position: relative;
  width: 100%;
  height: 100%;
  flex: 1;
  object-fit: cover;
  background: #000;
}
.remote-stack.split .vid {
  height: 50%;
  flex: 1 1 50%;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.remote-stack.split .vid.remote-b {
  border-bottom: none;
}
.remote-stack .vid[hidden] {
  display: none !important;
}

.pill.accent {
  background: linear-gradient(135deg, #0d9488, #3dd68c);
  border-color: transparent;
  color: #04120c;
  font-weight: 600;
}
.pill.danger {
  border-color: rgba(243, 18, 96, 0.5);
  color: #ff8aab;
}

.row-inline {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}
.row-inline input { flex: 1; }

.friends-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-height: 240px;
  overflow: auto;
}
.friend-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.55rem;
  border-radius: 10px;
  background: #0e131a;
  border: 1px solid #243041;
  font-size: 0.85rem;
}
.friend-row .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4a5568;
  flex-shrink: 0;
}
.friend-row.online .dot,
.friend-row .dot.online {
  background: #3dd68c;
  box-shadow: 0 0 8px #3dd68c;
}
.friend-row .meta { flex: 1; min-width: 0; }
.friend-row .meta strong { display: block; }
.friend-row .meta span { color: #8b9bb0; font-size: 0.72rem; }
.friend-row .friend-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  justify-content: flex-end;
  max-width: 55%;
}
.friend-row .friend-actions .pill { font-size: 0.72rem; }
.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.pill.primary {
  background: linear-gradient(135deg, #ff2d55, #ff6b35);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 18px rgba(255, 45, 85, 0.28);
}

/* Only present in DOM while a real call is ringing (created in JS) */
.call-toast {
  position: fixed;
  bottom: max(5.5rem, 18vh);
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  padding: 0.85rem 1.1rem;
  border-radius: 14px;
  background: rgba(20, 24, 36, 0.96);
  border: 1px solid rgba(91, 157, 255, 0.45);
  box-shadow: 0 12px 40px rgba(0,0,0,0.45);
  max-width: min(420px, 92vw);
}
.call-toast-actions { display: flex; gap: 0.4rem; }

/* Flash partner tile on match */
.tile.match-flash {
  box-shadow: inset 0 0 0 2px #3dd68c, 0 0 28px rgba(61, 214, 140, 0.35);
  animation: matchFlash 0.85s ease-out;
}

@keyframes matchFlash {
  0% { box-shadow: inset 0 0 0 3px #3dd68c, 0 0 40px rgba(61, 214, 140, 0.55); }
  100% { box-shadow: inset 0 0 0 0 transparent, 0 0 0 transparent; }
}

@media (max-width: 900px) {
  .arch-pill { display: none; }
  .pool-hint { display: none; }
}

.stage-app {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: none; /* was 1400px — left empty side gutters until browser zoom */
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  position: relative;
  overflow: hidden;
}

/* Top bar */
.stage-top {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.5rem 0.85rem;
  border-bottom: 1px solid #1c2230;
  background: rgba(10, 12, 16, 0.92);
  backdrop-filter: blur(8px);
  z-index: 5;
  flex-shrink: 0;
}

.brand {
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.brand-mark {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: #ff2d55;
  box-shadow: 0 0 0 3px rgba(255, 45, 85, 0.18);
  flex-shrink: 0;
  display: inline-block;
}
.brand-logo {
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 0.4rem;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.pool-bar {
  display: flex;
  gap: 0.9rem;
  font-family: ui-monospace, monospace;
  font-size: 0.75rem;
  color: #8b9bb0;
  flex: 1;
}

.pool-bar strong { color: #e8eef7; }

.pool-bar .searching {
  color: #f5a524;
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.stage-top-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.8rem;
  margin-left: auto; /* push whole action cluster (lang last) to the right */
  flex-shrink: 0;
}

/* Display name chip (top bar) */
.name-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.45rem 0.15rem 0.55rem;
  border-radius: 999px;
  border: 1px solid #2a3548;
  background: #141a22;
  font-size: 0.75rem;
  color: #8b9bb0;
}
.name-chip-lbl {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.65rem;
}
.name-chip input {
  width: 7.5rem;
  max-width: 28vw;
  border: none;
  background: transparent;
  color: #e8eef7;
  font: inherit;
  font-weight: 600;
  padding: 0.15rem 0.2rem;
  outline: none;
}
.name-chip input:focus {
  color: #fff;
}
.name-chip input::placeholder {
  color: #5a6a80;
  font-weight: 500;
}
.name-on-tile {
  color: #9ec5ff;
  font-weight: 600;
  margin-left: 0.25rem;
}

/* Room lobby chip in pool bar */
.room-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #cfe0ff;
  background: rgba(91, 157, 255, 0.14);
  border: 1px solid rgba(91, 157, 255, 0.3);
  max-width: 10rem;
}
.room-chip[hidden] { display: none !important; }
.room-chip .icon { width: 0.85rem; height: 0.85rem; opacity: 0.85; }
#room-chip-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Match session timer on partner tile */
.match-timer {
  font-variant-numeric: tabular-nums;
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(232, 238, 248, 0.85);
  background: rgba(0, 0, 0, 0.45);
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
  margin-left: 0.25rem;
}
.match-timer[hidden] { display: none !important; }

/* Long-wait tips (bottom chip, non-blocking) */
.wait-tips {
  position: fixed;
  left: 50%;
  bottom: max(5.5rem, calc(env(safe-area-inset-bottom) + 4.5rem));
  transform: translateX(-50%);
  z-index: 40;
  width: min(420px, calc(100vw - 1.5rem));
  pointer-events: none;
}
.wait-tips[hidden] { display: none !important; }
.wait-tips-card {
  pointer-events: auto;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  background: rgba(18, 22, 30, 0.94);
  border: 1px solid rgba(91, 157, 255, 0.35);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
}
.wait-tips-card strong {
  display: block;
  font-size: 0.92rem;
  margin-bottom: 0.3rem;
  color: #cfe0ff;
}
.wait-tips-card p {
  margin: 0 0 0.65rem;
  font-size: 0.84rem;
  line-height: 1.4;
  color: #9aa8bc;
}
.wait-tips-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* Keyboard shortcuts overlay */
.keys-help {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}
.keys-help[hidden] { display: none !important; }
.keys-help-card {
  width: min(360px, 100%);
  padding: 1rem 1.1rem 1.15rem;
  border-radius: 16px;
  background: #12161e;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
}
.keys-help-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}
.keys-help-head h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}
.keys-help-list {
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
}
.keys-help-list li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.35rem 0;
  font-size: 0.88rem;
  color: #b0bccf;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.keys-help-list li:last-child { border-bottom: none; }
.keys-help-list kbd {
  flex: 0 0 auto;
  min-width: 2.4rem;
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  background: #1a2230;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e8eef7;
}

/* Friend presence toast */
.presence-toast {
  position: fixed;
  top: max(1rem, env(safe-area-inset-top));
  right: max(1rem, env(safe-area-inset-right));
  z-index: 50;
  max-width: min(320px, calc(100vw - 2rem));
  padding: 0.7rem 0.9rem;
  border-radius: 12px;
  background: rgba(18, 28, 22, 0.95);
  border: 1px solid rgba(61, 214, 140, 0.4);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  color: #d8f5e6;
  font-size: 0.88rem;
  line-height: 1.35;
  animation: presence-in 0.25s ease;
}
.presence-toast strong { color: #fff; }
@keyframes presence-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Network hub settings */
.hub-url.mono,
#hub-current-url {
  margin: 0 0.75rem 0.75rem;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  word-break: break-all;
  color: #b8c4d6;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.settings-row.static {
  pointer-events: none;
  opacity: 0.9;
}

/* Failed-call coach overlay */
.call-coach {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 1rem;
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}
.call-coach[hidden] { display: none !important; }
.call-coach-card {
  width: min(420px, 100%);
  padding: 1.1rem 1.15rem 1.15rem;
  border-radius: 18px;
  background: #12161e;
  border: 1px solid rgba(245, 165, 36, 0.35);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
}
.call-coach-card h3 {
  margin: 0 0 0.45rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffd58a;
}
.call-coach-lead {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  line-height: 1.45;
  color: #b0bccf;
}
.call-coach-tips {
  margin: 0 0 0.75rem;
  padding-left: 1.15rem;
  color: #9aa8bc;
  font-size: 0.84rem;
  line-height: 1.45;
}
.call-coach-tips li { margin-bottom: 0.3rem; }
.call-coach-meta {
  margin: 0 0 0.85rem;
  font-size: 0.75rem;
  color: #6a7a90;
}
.call-coach-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.call-coach-actions .pill.ghost {
  background: transparent;
  border-color: transparent;
  color: #8b9bb0;
}
@media (min-width: 700px) {
  .call-coach {
    align-items: center;
  }
}

/* Connection strip — pill overlay (position set near docks styles) */
.conn-strip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: #8b9bb0;
}
.conn-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #5a6a80;
  flex-shrink: 0;
}
.conn-strip.ok .conn-dot { background: #3dd68c; box-shadow: 0 0 8px #3dd68c88; }
.conn-strip.warn .conn-dot { background: #f5a524; box-shadow: 0 0 8px #f5a52488; }
.conn-strip.bad .conn-dot { background: #f31260; box-shadow: 0 0 8px #f3126088; }
.conn-strip.call .conn-dot { background: #5b9dff; box-shadow: 0 0 8px #5b9dff88; }
.conn-ice { display: none; }
.conn-strip.idle,
.conn-strip[hidden] { display: none; }

/* Chat panel — floats inside partner tile above dock */
.chat-panel {
  position: absolute;
  left: 0.65rem;
  right: 0.65rem;
  bottom: 5.25rem;
  width: auto;
  max-width: none;
  max-height: min(32vh, 240px);
  display: flex;
  flex-direction: column;
  background: rgba(14, 18, 28, 0.92);
  border: 1px solid #2a3548;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.45);
  z-index: 6;
  overflow: hidden;
  backdrop-filter: blur(10px);
}
.chat-panel[hidden] { display: none !important; }
.chat-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.65rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #8b9bb0;
  border-bottom: 1px solid #243041;
}
.chat-clear {
  border: none;
  background: transparent;
  color: #8b9bb0;
  cursor: pointer;
  font-size: 0.9rem;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.55rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-height: 80px;
  max-height: min(32vh, 260px);
}
.chat-bubble {
  max-width: 92%;
  padding: 0.4rem 0.6rem;
  border-radius: 10px;
  font-size: 0.85rem;
  line-height: 1.35;
  word-break: break-word;
}
.chat-bubble .who {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
  opacity: 0.85;
}
.chat-bubble.theirs {
  align-self: flex-start;
  background: #1a2434;
  color: #e8eef7;
  border: 1px solid #2a3548;
}
.chat-bubble.mine {
  align-self: flex-end;
  background: linear-gradient(135deg, #2563eb55, #4f46e555);
  border: 1px solid #3b82f688;
  color: #eef4ff;
}
.chat-bubble.sys {
  align-self: center;
  font-size: 0.75rem;
  color: #8b9bb0;
  background: transparent;
  border: none;
  padding: 0.2rem;
}

@media (max-width: 900px) {
  .chat-panel {
    left: 0.5rem;
    right: 0.5rem;
    width: auto;
    bottom: 6.5rem;
    max-height: 28vh;
  }
  .name-chip { display: none; }
}

.stage-top-actions .phase {
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: #1c2430;
  color: #8b9bb0;
}

.stage-top-actions .phase.waiting,
.stage-top-actions .phase.claiming { color: #f5a524; background: #2a2418; }
.stage-top-actions .phase.matched { color: #3dd68c; background: #14261c; }

.pid {
  font-family: ui-monospace, monospace;
  color: #5b9dff;
  font-size: 0.78rem;
}

.status-pill {
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
  color: #8b9bb0;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Dual cameras — fills remaining viewport under header (no external footer) */
.stage {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 0;
  width: 100%;
  height: 100%;
  background: #05060a;
  border-bottom: none;
}

.tile {
  position: relative;
  overflow: hidden;
  background: #0c0f14;
  min-height: 0; /* fill grid cell; don't force 280px that can break full-height layout */
  width: 100%;
  height: 100%;
}

.tile-remote {
  border-right: 1px solid #1c2230;
}

.vid {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #0a0d12;
}

.vid.local {
  transform: scaleX(-1);
}

/* Partner blur (manual safety) */
.tile-remote.partner-blurred .vid.remote {
  filter: blur(28px) saturate(0.85);
  transform: scale(1.08);
}
.tile-remote.partner-blurred .remote-stack {
  overflow: hidden;
}

/* Click partner video for actions (not fullscreen) */
.tile-remote.partner-clickable {
  cursor: pointer;
}
.tile-remote.partner-clickable .vid.remote {
  cursor: pointer;
}

/* Partner action sheet */
.partner-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
}
.partner-menu-backdrop[hidden],
.partner-menu[hidden] {
  display: none !important;
}
.partner-menu {
  position: fixed;
  left: 50%;
  bottom: max(1.25rem, env(safe-area-inset-bottom, 0px) + 0.75rem);
  transform: translateX(-50%);
  z-index: 46;
  width: min(360px, calc(100vw - 1.5rem));
  padding: 0.85rem 0.9rem 0.75rem;
  border-radius: 16px;
  background: rgba(16, 20, 30, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.partner-menu-head {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.15rem 0.35rem 0.35rem;
}
.partner-menu-head strong {
  font-size: 0.95rem;
  color: #eef2f7;
}
.partner-menu-name {
  font-size: 0.8rem;
  color: #8b9bb0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.partner-menu-hint {
  margin: 0 0 0.25rem;
  padding: 0 0.25rem;
  font-size: 0.8rem;
  color: #9aa8bc;
}
.partner-menu-actions {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.partner-menu-btn {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(36, 42, 56, 0.9);
  color: #eef2f7;
  font-size: 0.92rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.partner-menu-btn:hover:not(:disabled) {
  background: rgba(52, 62, 82, 0.95);
  border-color: rgba(91, 157, 255, 0.35);
}
.partner-menu-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.partner-menu-btn .pm-ico {
  width: 1.35rem;
  height: 1.35rem;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.partner-menu-btn .pm-ico .icon {
  width: 1.15rem;
  height: 1.15rem;
  color: currentColor;
}
.partner-menu-btn.warn {
  border-color: rgba(245, 165, 36, 0.35);
  color: #ffd58a;
}
.partner-menu-btn.danger {
  border-color: rgba(243, 18, 96, 0.35);
  color: #ff8fb0;
}
.partner-menu-btn.ghost {
  background: transparent;
  border-color: transparent;
  color: #9aa8bc;
  justify-content: center;
  font-weight: 400;
}
.partner-menu-btn.ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.05);
  border-color: transparent;
  color: #eef2f7;
}

.tile-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  /* Keep copy clear of side rails + in-tile docks */
  padding: 2.5rem 3.75rem 5.5rem;
  box-sizing: border-box;
  text-align: center;
  color: #9aa8bc;
  background: radial-gradient(ellipse at center, #141a24 0%, #0a0c10 70%);
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.tile-empty.hidden { display: none; }

/* Looping brand loading video behind idle partner copy */
.empty-bg-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  z-index: 0;
  pointer-events: none;
  /* subtle scale so edges don’t flash letterbox on some aspect ratios */
  transform: scale(1.02);
}
.empty-bg-scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 60% at 50% 45%, rgba(8, 10, 14, 0.25) 0%, rgba(8, 10, 14, 0.72) 100%),
    linear-gradient(180deg, rgba(6, 8, 12, 0.35) 0%, rgba(6, 8, 12, 0.55) 100%);
}
.empty-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  max-width: 18rem;
}
#remote-empty .empty-title {
  color: #f2f5fa;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.75);
}
#remote-empty .empty-sub {
  color: rgba(200, 210, 224, 0.9);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.7);
}
#remote-empty .empty-icon {
  background: rgba(0, 0, 0, 0.35);
  border-color: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(6px);
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  opacity: 1;
}
.enable-cam-btn {
  margin-top: 0.85rem;
  pointer-events: auto;
  z-index: 2;
  position: relative;
  border: none;
  border-radius: 999px;
  padding: 0.7rem 1.25rem;
  font: inherit;
  font-weight: 650;
  font-size: 0.95rem;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, #ff2d55, #ff6b35);
  box-shadow: 0 8px 24px rgba(255, 45, 85, 0.35);
}
.enable-cam-btn:active { transform: scale(0.98); }
.enable-cam-btn[hidden] { display: none !important; }
.tile-empty .enable-cam-btn { margin-top: 1rem; }
.empty-title { font-size: 1.05rem; font-weight: 600; color: #e8eef7; }
.empty-sub { font-size: 0.85rem; color: #7a8a9e; }

.tile-tag {
  position: absolute;
  top: 0.65rem;
  left: 0.75rem;
  z-index: 3;
  display: flex;
  gap: 0.4rem;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 600;
  /* Names only — no role labels, no ALL CAPS */
  text-transform: none;
  letter-spacing: 0;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.7);
  pointer-events: none;
  max-width: calc(100% - 4.5rem);
}
.tile-tag[hidden] {
  display: none !important;
}
.tile-tag .name-on-tile {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.quality {
  font-family: ui-monospace, monospace;
  font-size: 0.65rem;
  text-transform: none;
  letter-spacing: 0;
  color: #3dd68c;
}

.quality.warn { color: #f5a524; }
.quality.bad { color: #f31260; }

/* ICE media path badge (Direct P2P vs TURN) */
.ice-path {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(20, 24, 32, 0.65);
  color: #9aa8bc;
  white-space: nowrap;
}
.ice-path.path-direct {
  color: #3dd68c;
  border-color: rgba(61, 214, 140, 0.4);
  background: rgba(61, 214, 140, 0.12);
}
.ice-path.path-relay {
  color: #f5a524;
  border-color: rgba(245, 165, 36, 0.4);
  background: rgba(245, 165, 36, 0.12);
}
.ice-path.path-unknown {
  color: #8b9bb0;
}
.arch-pill.path-direct {
  color: #3dd68c;
}
.arch-pill.path-relay {
  color: #f5a524;
}
.settings-security .sec-row {
  flex-wrap: wrap;
  gap: 0.35rem;
}
.settings-security .sec-value {
  color: #9aa8bc;
  font-size: 0.8rem;
  text-align: right;
  max-width: 58%;
}
.settings-security .sec-note .sec-value {
  max-width: 100%;
  text-align: left;
  color: #7a8a9e;
  font-size: 0.78rem;
  line-height: 1.35;
}

.mic-pill {
  font-size: 0.65rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: rgba(0,0,0,0.45);
  text-transform: none;
  letter-spacing: 0;
}

.mic-pill.hot { background: rgba(61, 214, 140, 0.35); color: #3dd68c; }
.mic-pill.muted { background: rgba(243, 18, 96, 0.35); color: #ff6b9d; }

/* Side rails — floating circular controls (vertical stack, parked low above docks) */
.side-rail {
  position: absolute;
  top: auto;
  bottom: 5.5rem; /* clear Spin/Next + chat docks */
  transform: none;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  padding: 0.35rem;
}

.side-rail-right { right: 0.65rem; }
.side-rail-left { left: 0.65rem; }

.side-btn {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(20, 24, 32, 0.72);
  backdrop-filter: blur(10px);
  color: #eef2f7;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 0;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
}

.side-btn:hover {
  background: rgba(40, 48, 64, 0.9);
  border-color: rgba(255,255,255,0.22);
}

.side-btn:active { transform: scale(0.96); }

.side-btn .ico {
  position: relative;
  width: 1.25rem;
  height: 1.25rem;
  display: grid;
  place-items: center;
  line-height: 0;
}
.side-btn .ico .icon {
  width: 1.2rem;
  height: 1.2rem;
  grid-area: 1 / 1;
}
.side-btn .ico .icon-off {
  display: none;
}
/* Muted / off state swaps SVG glyphs */
.side-btn.muted-on .ico .icon-on {
  display: none;
}
.side-btn.muted-on .ico .icon-off {
  display: block;
  color: #ff6b9d;
}
.side-btn.muted-on {
  border-color: rgba(243, 18, 96, 0.35);
  background: rgba(60, 20, 36, 0.72);
}
.side-btn.active .ico .icon-on {
  display: none;
}
.side-btn.active .ico .icon-off {
  display: block;
  color: #8eb6ff;
}
.side-btn.active {
  border-color: rgba(91, 157, 255, 0.4);
  background: rgba(30, 42, 68, 0.85);
}
.side-btn .lbl {
  font-size: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #9aa8bc;
  margin-top: 2px;
}

.side-btn {
  position: relative;
}
.friends-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 1.05rem;
  height: 1.05rem;
  padding: 0 0.28rem;
  border-radius: 999px;
  background: #ff2d55;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.05rem;
  text-align: center;
  box-shadow: 0 0 0 2px rgba(20, 24, 32, 0.9);
}
.friends-badge[hidden] { display: none !important; }

.req-panel {
  border: 1px solid rgba(61, 214, 140, 0.35);
  border-radius: 12px;
  padding: 0.45rem;
  background: rgba(20, 48, 36, 0.35);
}
.req-title {
  color: #9ee6b8 !important;
  margin-bottom: 0.35rem;
}
.req-row .pill.primary {
  font-weight: 700;
  min-width: 4.5rem;
}
.friend-req-toast .toast-sub {
  display: block;
  font-size: 0.75rem;
  color: #8b9bb0;
  margin-top: 0.2rem;
  max-width: 16rem;
}

.side-btn.active {
  border-color: rgba(61, 214, 140, 0.55);
  background: rgba(20, 48, 36, 0.85);
}

.side-btn.muted-on {
  border-color: rgba(243, 18, 96, 0.55);
  background: rgba(48, 16, 28, 0.85);
}

/* Vertical volume / meter */
.side-vol {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 0.45rem 0.3rem;
  border-radius: 999px;
  background: rgba(20, 24, 32, 0.72);
  border: 1px solid rgba(255,255,255,0.12);
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
}

.side-vol .lbl {
  font-size: 0.55rem;
  text-transform: uppercase;
  color: #9aa8bc;
}

.side-vol input[type="range"] {
  writing-mode: vertical-lr;
  direction: rtl;
  width: 22px;
  height: 100px;
  padding: 0;
  margin: 0;
  accent-color: #5b9dff;
  cursor: pointer;
  background: transparent;
}

/* vertical mic meter — fill uses transform scaleY (more reliable than %) */
.meter-v {
  width: 10px;
  height: 88px;
  border-radius: 999px;
  background: #1c2430;
  overflow: hidden;
  border: 1px solid #2a3548;
  position: relative;
}

.meter-v > span {
  display: block;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  transform-origin: bottom center;
  transform: scaleY(0);
  background: linear-gradient(to top, #3dd68c 0%, #5b9dff 70%, #a8d4ff 100%);
  transition: transform 0.05s linear;
  will-change: transform;
}

/* In-tile docks — same glass language as side rails */
.tile-dock {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.55rem 0.65rem max(0.55rem, env(safe-area-inset-bottom));
  pointer-events: none;
  background: linear-gradient(
    to top,
    rgba(6, 8, 12, 0.82) 0%,
    rgba(6, 8, 12, 0.45) 55%,
    transparent 100%
  );
}
.tile-dock > * { pointer-events: auto; }

.dock-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.dock-row-context {
  justify-content: flex-start;
  min-height: 0;
}
.dock-row-context:empty { display: none; }
.dock-row-main {
  gap: 0.5rem;
  align-items: center;
}
.stop-in-tile {
  flex: 0 0 auto;
  min-width: 4.25rem;
  font-weight: 650;
}
#btn-stop.dock-pill.danger {
  border-color: rgba(243, 18, 96, 0.4);
  background: rgba(48, 16, 28, 0.88);
  color: #ffb3c9;
}
#btn-stop.dock-pill.danger:hover {
  border-color: rgba(255, 80, 120, 0.65);
  background: rgba(70, 20, 36, 0.95);
  color: #fff;
}

.dock-pill {
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(20, 24, 32, 0.78);
  backdrop-filter: blur(10px);
  color: #e8eef7;
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  white-space: nowrap;
}
.dock-pill:hover {
  border-color: rgba(91, 157, 255, 0.55);
  background: rgba(36, 44, 58, 0.9);
}
.dock-pill:active { transform: scale(0.97); }
.dock-pill.ghost {
  background: rgba(14, 18, 26, 0.55);
  color: #c5d0e0;
  font-weight: 500;
}
.dock-pill.danger {
  border-color: rgba(243, 18, 96, 0.45);
  background: rgba(48, 16, 28, 0.82);
  color: #ffb3c9;
}
.dock-pill.accent {
  border-color: rgba(91, 157, 255, 0.45);
  background: rgba(20, 36, 64, 0.85);
  color: #9ec5ff;
}
.dock-pill.tight {
  padding: 0.35rem 0.55rem;
  font-size: 0.75rem;
}
.dock-pill[hidden] { display: none !important; }

/* Sheets / friends still use .pill */
.pill {
  font: inherit;
  border: 1px solid #2a3548;
  background: #141a22;
  color: #e8eef7;
  border-radius: 999px;
  padding: 0.5rem 0.95rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.pill:hover { border-color: #5b9dff; }
.pill.primary {
  background: linear-gradient(135deg, #ff2d55, #ff6b35);
  border-color: transparent;
  font-weight: 600;
  color: #fff;
  box-shadow: 0 6px 18px rgba(255, 45, 85, 0.28);
}
.pill.ghost {
  background: transparent;
  color: #8b9bb0;
}
.pill.danger {
  border-color: rgba(243, 18, 96, 0.45);
  background: rgba(48, 16, 28, 0.85);
  color: #ffb3c9;
}
.pill.accent {
  border-color: rgba(91, 157, 255, 0.45);
  background: rgba(20, 36, 64, 0.85);
  color: #9ec5ff;
}
.pill.tight {
  padding: 0.35rem 0.6rem;
  font-size: 0.78rem;
}

.next-big {
  font: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  border: none;
  border-radius: 999px;
  padding: 0.55rem 1.25rem;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, #ff2d55, #ff6b35);
  box-shadow: 0 6px 22px rgba(255, 45, 85, 0.4);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: transform 0.1s, box-shadow 0.15s;
}
.next-big.next-in-tile {
  min-width: 7.5rem;
  justify-content: center;
}
.next-big:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 28px rgba(255, 45, 85, 0.5);
}
.next-big:active { transform: scale(0.98); }

/* Settings gear — bottom-right of local footer dock */
.dock-settings {
  flex: 0 0 auto;
  width: 2.65rem;
  height: 2.65rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(20, 24, 32, 0.78);
  backdrop-filter: blur(10px);
  color: #eef2f7;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  margin-left: 0.1rem;
  order: 10; /* always last = bottom-right in the dock row */
}
.dock-settings .icon {
  width: 1.2rem;
  height: 1.2rem;
  color: #e8eef7;
}
.dock-settings:hover {
  background: rgba(40, 48, 64, 0.92);
  border-color: rgba(255, 255, 255, 0.22);
}
.dock-settings:active {
  transform: scale(0.96);
}

.tile-dock-local {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding-left: 0.55rem;
  /* room for right side-rail (cam/mic); settings lives in this dock now */
  padding-right: 3.4rem;
}
.room-in-tile {
  flex: 0 0 auto;
  padding: 0.2rem 0.35rem 0.2rem 0.5rem;
  border-radius: 999px;
  background: rgba(20, 24, 32, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
}
.room-in-tile span {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.room-in-tile input {
  width: 5.5rem;
  background: transparent;
  border: none;
  padding: 0.25rem 0.2rem;
  color: #e8eef7;
}
.room-in-tile input:focus {
  outline: none;
}

.bottom-chat,
.dock-chat {
  display: flex;
  gap: 0.35rem;
  min-width: 0;
  flex: 1 1 10rem;
}
.bottom-chat input,
.dock-chat input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(14, 18, 26, 0.82);
  backdrop-filter: blur(10px);
  color: #e8eef7;
  border-radius: 999px;
  padding: 0.45rem 0.75rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
}
.bottom-chat input:focus,
.dock-chat input:focus {
  outline: none;
  border-color: rgba(91, 157, 255, 0.55);
}

/* Conn strip: in header (not bottom — avoids overlap with Room field) */
.stage-top .conn-strip {
  position: static;
  left: auto;
  bottom: auto;
  transform: none;
  z-index: 1;
  flex: 0 1 auto;
  min-width: 0;
  max-width: min(36vw, 14rem);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  padding: 0.22rem 0.65rem;
  background: rgba(14, 18, 26, 0.88);
  backdrop-filter: blur(10px);
  box-shadow: none;
  pointer-events: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stage-top .conn-strip #conn-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.stage-top .conn-retry {
  pointer-events: auto;
  flex-shrink: 0;
}

/* Log drawer */
.log-drawer {
  margin: 0 1rem 1rem;
  border: 1px solid #1c2230;
  border-radius: 12px;
  background: #0e131a;
  color: #8b9bb0;
  font-size: 0.85rem;
}

.log-drawer summary {
  cursor: pointer;
  padding: 0.55rem 0.85rem;
  user-select: none;
}

.log-drawer .log {
  max-height: 160px;
  overflow-y: auto;
  padding: 0 0.85rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.log .sys {
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
  color: #7a8a9e;
}

.log .bubble {
  max-width: 90%;
  padding: 0.35rem 0.65rem;
  border-radius: 10px;
  background: #1c2533;
  border: 1px solid #2a3548;
  color: #e8eef7;
}

.log .bubble.mine {
  align-self: flex-end;
  background: #1a2a44;
}

/* Settings sheet — clean hub + sub-pages */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(8px);
  z-index: 40;
}
/* Animate only settings (friends sheet shares .sheet-backdrop class) */
#sheet-backdrop {
  opacity: 0;
  transition: opacity 0.18s ease;
}
#sheet-backdrop.is-open {
  opacity: 1;
}

.sheet {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  width: min(400px, calc(100vw - 1.25rem));
  max-height: min(88dvh, 640px);
  overflow: hidden;
  z-index: 50;
  background: #0c0f14;
  border: 1px solid #222a38;
  border-radius: 22px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.65);
  display: flex;
  flex-direction: column;
}

.sheet.settings-app {
  padding: 0;
  right: 0.75rem;
  bottom: 0.75rem;
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  transition: opacity 0.18s ease, transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sheet.settings-app.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.sheet[hidden],
.sheet-backdrop[hidden] {
  display: none !important;
}

.sheet header,
.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0.55rem;
  border-bottom: 1px solid #161b24;
  flex-shrink: 0;
  background: rgba(12, 14, 18, 0.96);
  backdrop-filter: blur(10px);
}

.sheet header h3,
.settings-header h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-align: center;
  flex: 1;
}

.sheet-close,
.sheet-nav-btn {
  border: none;
  background: transparent;
  color: #c5d0e0;
  font-size: 1.55rem;
  line-height: 1;
  cursor: pointer;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sheet-nav-btn:hover { background: #161b24; }
.sheet-nav-spacer { width: 2.25rem; }

.settings-view {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}
.settings-view[hidden] { display: none !important; }

.settings-body {
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.75rem 1rem 0.6rem !important;
  gap: 0 !important;
  flex: 1 1 auto;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #2a3548 transparent;
}
.settings-body-main {
  /* Hub is short — less scroll clutter */
  padding-bottom: 0.25rem !important;
}

/* Profile hero */
.settings-hero {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 0.95rem;
  margin-bottom: 0.75rem;
  border-radius: 16px;
  background: linear-gradient(145deg, #161c28 0%, #12161f 100%);
  border: 1px solid #243041;
}
.settings-hero-avatar {
  width: 5rem;
  height: 5rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(255, 45, 85, 0.12);
  border: 1px solid rgba(255, 107, 53, 0.35);
  color: #ffb4a8;
  flex-shrink: 0;
  position: relative;
}
.settings-hero-avatar .icon,
.settings-hero-avatar .settings-hero-letter {
  grid-area: 1 / 1;
}
.settings-hero-avatar .icon {
  width: 1.75rem;
  height: 1.75rem;
}
.settings-hero-letter {
  display: none;
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #dce9ff;
  line-height: 1;
}
.settings-hero-avatar.has-letter .settings-hero-letter {
  display: block;
}
.settings-hero-avatar.has-letter .settings-hero-fallback {
  display: none;
}
.settings-hero-text {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.settings-hero-name {
  width: 100%;
  border: none;
  background: transparent;
  color: #f2f6fc;
  font: inherit;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  padding: 0;
  outline: none;
}
.settings-hero-name::placeholder {
  color: #5a6a80;
  font-weight: 600;
}
.settings-hero-sub {
  margin: 0;
  font-size: 0.75rem;
  color: #6a7a90;
}

.settings-section-label {
  margin: 1rem 0 0.4rem 0.45rem;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #6a7a90;
  font-weight: 600;
}
.settings-section-label:first-child { margin-top: 0.2rem; }

.settings-group {
  background: #151a22;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid #222b3a;
  margin-bottom: 0.15rem;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  width: 100%;
  min-height: 3.15rem;
  padding: 0.72rem 0.95rem;
  border: none;
  border-bottom: 1px solid rgba(28, 36, 48, 0.95);
  background: transparent;
  color: #eef2f7;
  font: inherit;
  font-size: 0.94rem;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
  box-sizing: border-box;
}
.settings-group .settings-row:last-child { border-bottom: none; }
.settings-row:hover { background: rgba(255, 255, 255, 0.035); }
.settings-row:active { background: rgba(255, 255, 255, 0.05); }

.settings-row .row-left {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  flex: 1 1 auto;
}
.settings-row .row-ico {
  width: 1.35rem;
  height: 1.35rem;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: #8b9bb0;
}
.settings-row .row-ico .icon {
  width: 1.05rem;
  height: 1.05rem;
}
.settings-row-danger .row-ico {
  color: #ff8fab;
}
.settings-row .row-flag { font-size: 1.15rem; line-height: 1; width: 1.35rem; text-align: center; }
.settings-row .row-right {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: #8b9bb0;
  font-size: 0.86rem;
  flex: 0 1 auto;
  max-width: 48%;
  min-width: 0;
  justify-content: flex-end;
}
.settings-row .row-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: min(11rem, 42vw);
  color: #9aa8bc;
  font-weight: 500;
}
.settings-row .chev {
  color: #4a5568;
  font-size: 1.2rem;
  font-weight: 300;
  flex-shrink: 0;
  line-height: 1;
}

.settings-row-input {
  cursor: default;
}
.settings-row-input:hover { background: transparent; }
.settings-inline-input,
.row-right-input input {
  border: none;
  background: transparent;
  color: #8eb6ff;
  font: inherit;
  font-weight: 600;
  text-align: right;
  min-width: 0;
  width: 9rem;
  max-width: 42vw;
  outline: none;
}
.row-right-input {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}
.settings-icon-btn {
  border: none;
  background: #1c2430;
  color: #c5d0e0;
  border-radius: 999px;
  width: 1.85rem;
  height: 1.85rem;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.settings-icon-btn:hover { background: #273244; }
.settings-icon-btn .icon {
  width: 0.95rem;
  height: 0.95rem;
}
.sheet-close-x {
  font-size: 1.05rem !important;
  color: #9aa8bc !important;
}
.settings-row-actions-loose {
  margin-top: 0.75rem;
  border-radius: 14px;
  border: 1px solid #222b3a;
  background: #151a22;
}

/* Mini actions under devices */
.settings-row-actions {
  display: flex;
  gap: 0.45rem;
  padding: 0.55rem 0.75rem 0.7rem;
  border-top: 1px solid rgba(28, 36, 48, 0.95);
  background: rgba(0, 0, 0, 0.12);
}
.settings-mini-btn {
  flex: 1;
  border: 1px solid #243041;
  background: #1a202a;
  color: #c5d0e0;
  border-radius: 10px;
  padding: 0.5rem 0.45rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 550;
  cursor: pointer;
}
.settings-mini-btn:hover { background: #222a36; border-color: #334155; }

.settings-row-static {
  cursor: default;
}
.settings-row-static:hover { background: transparent; }
.settings-vol-row {
  gap: 1rem;
}
.settings-vol-row input[type="range"] {
  flex: 1 1 auto;
  width: auto;
  max-width: none;
  min-width: 5rem;
  accent-color: #5b9dff;
  height: 1.25rem;
}

/* iOS-like switches */
.settings-row-toggle {
  cursor: pointer;
  align-items: center;
  gap: 0.85rem;
}
.settings-row-toggle:hover { background: rgba(255, 255, 255, 0.02); }
.settings-row-toggle .toggle-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.12rem;
  min-width: 0;
}
.settings-row-toggle .toggle-title {
  font-size: 0.94rem;
  color: #eef2f7;
  line-height: 1.25;
}
.settings-row-toggle .toggle-hint {
  font-size: 0.72rem;
  color: #6a7a90;
  line-height: 1.25;
}
.switch {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  width: 2.75rem;
  height: 1.55rem;
}
.switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
  z-index: 2;
}
.switch-ui {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: #2a3344;
  border: 1px solid #3a4558;
  transition: background 0.15s, border-color 0.15s;
  position: relative;
}
.switch-ui::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(1.55rem - 6px);
  height: calc(1.55rem - 6px);
  border-radius: 999px;
  background: #eef2f7;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s;
}
.switch input:checked + .switch-ui {
  background: #2db87a;
  border-color: #2db87a;
}
.switch input:checked + .switch-ui::after {
  transform: translateX(1.15rem);
}
.switch input:focus-visible + .switch-ui {
  outline: 2px solid #5b9dff;
  outline-offset: 2px;
}

/* Compact connection status */
.settings-status-card {
  background: #12161e;
  border: 1px solid #1e2634;
  border-radius: 14px;
  padding: 0.65rem 0.85rem 0.6rem;
  margin-top: 0.85rem;
}
.settings-status-compact {
  margin-top: 0.75rem;
  margin-bottom: 0.25rem;
}
.settings-status-label {
  margin: 0 0 0.4rem;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6a7a90;
  font-weight: 600;
}
.status-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.status-pill-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 0.26rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #3dd68c;
  background: rgba(61, 214, 140, 0.1);
  border: 1px solid rgba(61, 214, 140, 0.28);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.status-pill-chip.muted {
  color: #9aa8bc;
  background: rgba(255, 255, 255, 0.04);
  border-color: #2a3548;
}
.status-note {
  margin: 0.45rem 0 0;
  font-size: 0.72rem;
  line-height: 1.35;
  color: #6a7a90;
}

.settings-row-danger {
  color: #ff8fab;
}
.settings-row-danger .row-left { color: #ff8fab; }

/* Sticky footer Done */
.settings-footer {
  flex-shrink: 0;
  padding: 0.65rem 0.9rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #161b24;
  background: rgba(10, 12, 16, 0.96);
  backdrop-filter: blur(10px);
}
.settings-done-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 0;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, #ff2d55, #ff6b35);
  color: #fff;
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(255, 45, 85, 0.32);
}
.settings-done-btn:hover { filter: brightness(1.06); }
.settings-done-btn:active { transform: scale(0.99); }

.settings-choice .choice-check {
  color: #3dd68c;
  font-weight: 700;
  opacity: 0;
}
.settings-choice.is-selected .choice-check { opacity: 1; }

.settings-hidden-select { display: none !important; }

/* Old security rows (if any remain) */
.settings-security .sec-row { flex-wrap: wrap; gap: 0.35rem; }
.settings-security .sec-value {
  color: #9aa8bc;
  font-size: 0.8rem;
  text-align: right;
  max-width: 58%;
}

@media (max-width: 560px) {
  .sheet.settings-app {
    right: 0;
    bottom: 0;
    left: 0;
    top: 0;
    width: 100%;
    max-height: none;
    height: 100%;
    height: 100dvh;
    border-radius: 0;
    border: none;
  }
  .settings-row .row-value { max-width: 9rem; }
}

.sheet-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Friends sheet still uses classic labels */
#friends-sheet .sheet-body label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.72rem;
  color: #8b9bb0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

#friends-sheet .sheet-body select,
#friends-sheet .sheet-body input[type="text"],
#friends-sheet .sheet-body input[type="range"] {
  font: inherit;
  text-transform: none;
  letter-spacing: normal;
  border: 1px solid #2a3548;
  background: #0e131a;
  color: #e8eef7;
  border-radius: 10px;
  padding: 0.45rem 0.6rem;
  pointer-events: auto;
  width: 100%;
  max-width: 100%;
  cursor: pointer;
}

.sheet-body input[type="range"] {
  padding: 0.35rem 0;
  accent-color: #5b9dff;
}

.sheet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.hint-inline {
  font-size: 0.78rem;
  color: #7a8a9e;
  line-height: 1.45;
  text-transform: none;
  letter-spacing: 0;
}

.hint-inline kbd {
  font-family: ui-monospace, monospace;
  font-size: 0.7rem;
  border: 1px solid #2a3548;
  border-radius: 4px;
  padding: 0.05rem 0.3rem;
  background: #0e131a;
}

/* —— Phone / narrow: icon-only rails, thumb-friendly docks —— */
@media (max-width: 900px) {
  .stage-body {
    /* Avoid mobile browser chrome jumps */
    min-height: 100dvh;
  }
  .stage-app {
    height: 100dvh;
    max-height: 100dvh;
  }
  .stage-top {
    padding: 0.35rem 0.5rem;
    gap: 0.4rem;
  }
  .brand { font-size: 0.92rem; }
  .brand .badge { display: none; }
  .pid,
  .phase,
  .arch-pill,
  .pool-hint,
  .name-chip {
    display: none !important;
  }
  .pool-bar {
    font-size: 0.68rem;
    gap: 0.55rem;
    flex: 1 1 auto;
    min-width: 0;
  }
  .status-pill {
    font-size: 0.68rem;
    max-width: min(11rem, 36vw);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .lang-top-right .lang-ico { display: none; }
  .lang-top-right {
    /* Stay visible on phone (name/phase hidden) — last item = top-right */
    display: inline-flex !important;
    padding: 0.15rem 0.3rem;
  }

  .stage {
    /* Partner gets more vertical room (match / Next live here) */
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1.15fr) minmax(0, 0.85fr);
  }
  .tile {
    min-height: 0;
  }
  .tile-remote { border-right: none; border-bottom: 1px solid #1c2230; }

  .tile-empty {
    padding: 1.75rem 3.25rem 4.75rem;
  }
  .empty-icon { font-size: 1.25rem; }
  .empty-title { font-size: 0.95rem; }
  .empty-sub { font-size: 0.78rem; }

  .tile-tag {
    top: 0.45rem;
    left: 0.5rem;
    font-size: 0.65rem;
    max-width: calc(100% - 3.5rem);
  }
  .name-on-tile {
    max-width: 5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Icon-only controls, parked above the dock for thumbs */
  .side-rail {
    top: auto;
    bottom: 3.85rem;
    transform: none;
    gap: 0.32rem;
    padding: 0.2rem;
  }
  .side-rail-right { right: 0.35rem; }
  .side-rail-left { left: 0.35rem; }
  .side-btn {
    width: 40px;
    height: 40px;
  }
  .side-btn .lbl,
  .side-vol .lbl {
    display: none;
  }
  /* Mic meter is tall — rely on mic pill + settings on phone */
  .mic-meter-rail {
    display: none;
  }
  .side-vol {
    padding: 0.35rem 0.2rem;
  }
  .side-vol input[type="range"] {
    height: 56px;
    width: 18px;
  }

  .tile-dock {
    padding: 0.35rem 0.4rem max(0.4rem, env(safe-area-inset-bottom));
    gap: 0.3rem;
  }
  .tile-dock-remote {
    /* leave clear strip for side rail icons */
    padding-left: 3.1rem;
    padding-right: 0.4rem;
  }
  .tile-dock-local {
    padding-right: 3.1rem;
    padding-left: 0.4rem;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.35rem;
  }
  .dock-row-main {
    width: 100%;
  }
  .dock-chat {
    width: auto;
    flex: 1 1 auto;
    min-width: 0;
  }
  .dock-chat input {
    font-size: 0.8rem;
    padding: 0.4rem 0.65rem;
  }
  .room-in-tile {
    flex: 0 0 auto;
    max-width: 42%;
  }
  .room-in-tile span { display: none; } /* icon/field only */
  .room-in-tile input {
    width: 4.25rem;
    font-size: 0.8rem;
  }
  .next-big.next-in-tile {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }
  .dock-pill {
    font-size: 0.7rem;
    padding: 0.32rem 0.6rem;
  }
  .dock-row-context {
    gap: 0.3rem;
  }
  /* Shorter labels for context pills on narrow screens */
  #btn-browse-together {
    max-width: 9.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .chat-panel {
    left: 0.4rem;
    right: 0.4rem;
    bottom: 4.25rem;
    max-height: min(20vh, 140px);
  }
  .stage-top .conn-strip {
    max-width: min(42vw, 11rem);
    font-size: 0.68rem;
    padding: 0.18rem 0.5rem;
  }
  .call-toast {
    bottom: max(4rem, 12vh);
    width: min(420px, 94vw);
    padding: 0.7rem 0.85rem;
  }
}

/* Very small phones */
@media (max-width: 380px) {
  .side-btn {
    width: 36px;
    height: 36px;
  }
  .side-btn .ico { font-size: 0.95rem; }
  .room-in-tile { display: none; } /* room still in URL / settings if needed — free chat space */
  .tile-dock-local { padding-right: 2.85rem; }
  .next-big.next-in-tile { font-size: 0.85rem; padding: 0.45rem 0.75rem; }
}

/* Landscape phones: side-by-side again, compact */
@media (max-width: 900px) and (orientation: landscape) {
  .stage {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr;
  }
  .tile-remote { border-bottom: none; border-right: 1px solid #1c2230; }
  .side-rail {
    bottom: 3.5rem;
  }
  .mic-meter-rail { display: none; }
  .tile-empty { padding: 1.25rem 3rem 4rem; }
}

/* ═══════════════════════════════════════════════════════════
   Visual polish — align live stage with homepage metallic / glass
   ═══════════════════════════════════════════════════════════ */

html:has(.stage-body),
html.stage-html {
  background: #07080c;
  color-scheme: dark;
}

.stage-body {
  background: #07080c !important;
  color-scheme: dark;
}

/* Keyboard focus — match product coral, not browser default blue */
.stage-body :is(button, a, input, select, textarea, .settings-row, .dock-pill, .side-btn, .home-cta):focus {
  outline: none;
}
.stage-body :is(button, a, input, select, textarea, .settings-row, .dock-pill, .side-btn):focus-visible {
  outline: 2px solid rgba(255, 107, 53, 0.85);
  outline-offset: 2px;
}

.stage-app {
  background:
    radial-gradient(900px 400px at 10% -10%, rgba(91, 157, 255, 0.08) 0%, transparent 55%),
    radial-gradient(700px 360px at 95% 0%, rgba(255, 45, 85, 0.06) 0%, transparent 50%),
    #07080c;
}

/* Top chrome — frosted glass */
.stage-top {
  padding: 0.55rem 0.95rem;
  border-bottom: 1px solid transparent;
  background: linear-gradient(
    180deg,
    rgba(10, 12, 18, 0.92) 0%,
    rgba(10, 12, 18, 0.78) 100%
  );
  backdrop-filter: blur(16px) saturate(1.15);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04);
}
.stage-top::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  pointer-events: none;
}
.stage-app > .stage-top {
  position: relative;
}

.brand {
  font-weight: 750;
  letter-spacing: -0.025em;
}
.brand-logo {
  border-radius: 0.45rem;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.12),
    0 4px 12px rgba(0, 0, 0, 0.4);
}
.brand .badge {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
  background: rgba(255, 45, 85, 0.15);
  color: #ff8fab;
  border: 1px solid rgba(255, 45, 85, 0.35);
}

.pool-bar {
  gap: 0.55rem;
  font-family: inherit;
  font-size: 0.76rem;
  color: #8b9bb0;
  flex-wrap: wrap;
  align-items: center;
}
.pool-bar > span:not(.room-chip):not(.arch-pill):not(.ice-path):not(.pool-hint) {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
}
.pool-bar strong {
  color: #f0f4fa;
  font-variant-numeric: tabular-nums;
}

.room-chip {
  background: rgba(91, 157, 255, 0.12);
  border-color: rgba(91, 157, 255, 0.32);
}

.arch-pill {
  font-size: 0.66rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border: 1px solid rgba(61, 214, 140, 0.32);
  color: #8ee4b4;
  background: rgba(20, 48, 36, 0.5);
}

.name-chip {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(8px);
}
.name-chip input {
  background: transparent;
  border: none;
  color: #eef2f7;
  font-weight: 600;
}
.name-chip input:focus {
  outline: none;
}

.lang-top-right {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
}

.stage-top-actions .phase {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}
.stage-top-actions .phase.waiting,
.stage-top-actions .phase.claiming {
  color: #f5c56b;
  background: rgba(245, 165, 36, 0.12);
  border-color: rgba(245, 165, 36, 0.28);
}
.stage-top-actions .phase.matched,
.stage-top-actions .phase.friend_call {
  color: #6ee7a8;
  background: rgba(61, 214, 140, 0.12);
  border-color: rgba(61, 214, 140, 0.3);
}

.status-pill {
  font-family: inherit;
  font-size: 0.72rem;
  color: #7a8a9e;
  max-width: 11rem;
}

/* Stage tiles */
.stage {
  background: #05060a;
  gap: 0;
}
.tile {
  background: #0a0c12;
}
.tile-remote {
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}
.tile::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

/* Side rails — denser glass */
.side-btn {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(14, 18, 28, 0.72);
  backdrop-filter: blur(14px) saturate(1.1);
  box-shadow:
    0 6px 20px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.side-btn:hover {
  background: rgba(30, 38, 54, 0.88);
  border-color: rgba(126, 182, 255, 0.35);
}

/* Docks */
.tile-dock {
  background: linear-gradient(
    to top,
    rgba(5, 7, 12, 0.9) 0%,
    rgba(5, 7, 12, 0.55) 50%,
    transparent 100%
  );
  padding-top: 1.5rem;
}
.dock-pill {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(16, 20, 30, 0.78);
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}
.dock-pill:hover {
  border-color: rgba(126, 182, 255, 0.5);
  background: rgba(28, 36, 52, 0.9);
}

/* Next — homepage coral CTA */
.next-big {
  font-weight: 750;
  letter-spacing: -0.01em;
  padding: 0.62rem 1.4rem;
  background: linear-gradient(135deg, #ff2d55 0%, #ff5c3a 55%, #ff7a3b 100%);
  box-shadow:
    0 8px 28px rgba(255, 45, 85, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.next-big:hover {
  transform: translateY(-2px);
  box-shadow:
    0 12px 36px rgba(255, 45, 85, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.next-big.next-in-tile {
  min-width: 8rem;
}

.dock-settings {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(16, 20, 30, 0.8);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}
.dock-settings:hover {
  border-color: rgba(126, 182, 255, 0.4);
}

/* Chat glass */
.chat-panel {
  background: rgba(12, 16, 26, 0.9);
  border-color: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(14px);
  border-radius: 14px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}
.chat-bubble.mine {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.45), rgba(99, 102, 241, 0.4));
  border-color: rgba(99, 102, 241, 0.45);
}

/* Name chip on video */
.tile-tag .name-on-tile {
  background: rgba(0, 0, 0, 0.5);
  border-color: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  padding: 0.28rem 0.65rem;
}
.match-timer {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(6px);
}

/* Sheets / menus */
.partner-menu {
  background: rgba(14, 18, 28, 0.96);
  border-color: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(16px);
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
}
.sheet {
  border-color: rgba(255, 255, 255, 0.1);
  background: #0e121a;
}
.sheet header {
  border-bottom-color: rgba(255, 255, 255, 0.07);
}

/* Pills in sheets */
.pill {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
}
.pill:hover {
  border-color: rgba(126, 182, 255, 0.45);
}
.pill.primary {
  background: linear-gradient(135deg, #ff2d55, #ff6b35);
  box-shadow: 0 6px 20px rgba(255, 45, 85, 0.3);
  color: #fff;
}

/* Conn strip */
.conn-strip {
  backdrop-filter: blur(10px);
  background: rgba(12, 16, 24, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 0.28rem 0.55rem 0.28rem 0.7rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  max-width: min(92vw, 28rem);
}
.conn-strip #conn-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.conn-retry {
  flex: 0 0 auto;
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 45, 85, 0.18);
  color: #ffd0d8;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 650;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}
.conn-retry:hover {
  background: rgba(255, 45, 85, 0.32);
  color: #fff;
}
.conn-retry[hidden] {
  display: none !important;
}

/* Federated match (nextface-fed/1) — media still P2P */
.fed-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: #c4e0ff;
  background: rgba(59, 130, 246, 0.18);
  border: 1px solid rgba(96, 165, 250, 0.35);
  white-space: nowrap;
}

/* Settings hub polish hooks */
.settings-sheet,
#settings-sheet {
  border-color: rgba(255, 255, 255, 0.1);
}

/* Mobile: keep glass but slightly denser header */
@media (max-width: 700px) {
  .stage-top {
    padding: 0.45rem 0.65rem;
  }
  .pool-bar > span:not(.room-chip):not(.arch-pill):not(.ice-path):not(.pool-hint) {
    padding: 0.15rem 0.4rem;
    font-size: 0.7rem;
  }
  .arch-pill {
    display: none; /* free space on narrow; still in settings */
  }
}

/* PWA install banner */
#pwa-install-banner {
  position: fixed;
  left: 50%;
  bottom: max(4.75rem, calc(env(safe-area-inset-bottom) + 4.25rem));
  transform: translateX(-50%);
  z-index: 12000;
  width: min(440px, calc(100vw - 1.5rem));
  pointer-events: auto;
}
.pwa-install-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.75rem 0.7rem 0.85rem;
  border-radius: 16px;
  background: rgba(14, 16, 22, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(14px);
}
.pwa-install-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex-shrink: 0;
}
.pwa-install-copy {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  flex: 1;
  font-size: 0.8rem;
  line-height: 1.3;
  color: #b8becf;
}
.pwa-install-copy strong {
  color: #f2f3f7;
  font-size: 0.88rem;
  font-weight: 650;
}
.pwa-install-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}
.pwa-install-btn {
  border: 0;
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 650;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, #ff7a6a, #e84d3d);
}
.pwa-install-x {
  border: 0;
  background: transparent;
  color: #9aa0b4;
  font-size: 1.25rem;
  line-height: 1;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  cursor: pointer;
}
.pwa-install-x:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

/* ═══════════════════════════════════════════════════════════
   Themes — dark (default) · light · saloon (western)
   Applied via html[data-theme="…"] (see live.js applyTheme)
   ═══════════════════════════════════════════════════════════ */

.theme-pick .row-left {
  align-items: center;
  gap: 0.55rem;
}
.theme-swatch {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 0.4rem;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.theme-swatch-dark {
  background: linear-gradient(145deg, #1a2030, #07080c 70%);
}
.theme-swatch-light {
  background: linear-gradient(145deg, #ffffff, #d8dee8 70%);
  border-color: rgba(0, 0, 0, 0.12);
}
.theme-swatch-saloon {
  background: linear-gradient(145deg, #c9a227, #3b2412 55%, #1a1008);
  border-color: rgba(201, 162, 39, 0.45);
}
.theme-pick-copy {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
  text-align: left;
}
.theme-pick-title {
  font-weight: 650;
  font-size: 0.95rem;
}
.theme-pick-sub {
  font-size: 0.72rem;
  color: #8b9bb0;
  font-weight: 500;
}
.theme-choice-list .settings-choice.is-selected {
  background: rgba(91, 157, 255, 0.1);
}

/* ─── Light theme ─── */
html[data-theme="light"] {
  color-scheme: light;
}
html[data-theme="light"].stage-html,
html[data-theme="light"]:has(.stage-body) {
  background: #e8ecf2;
  color-scheme: light;
}
html[data-theme="light"] .stage-body {
  background: #e8ecf2 !important;
  color: #152033;
  color-scheme: light;
}
html[data-theme="light"] .stage-app {
  background:
    radial-gradient(900px 400px at 10% -10%, rgba(91, 157, 255, 0.12) 0%, transparent 55%),
    radial-gradient(700px 360px at 95% 0%, rgba(255, 107, 53, 0.08) 0%, transparent 50%),
    #e8ecf2;
}
html[data-theme="light"] .stage-top {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.94) 0%,
    rgba(245, 247, 252, 0.9) 100%
  );
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.06);
}
html[data-theme="light"] .stage-top::after {
  background: linear-gradient(90deg, transparent, rgba(15, 23, 42, 0.1), transparent);
}
html[data-theme="light"] .brand {
  color: #0f172a;
}
html[data-theme="light"] .brand .badge {
  background: rgba(255, 45, 85, 0.1);
  color: #c2183a;
  border-color: rgba(255, 45, 85, 0.28);
}
html[data-theme="light"] .brand-logo {
  box-shadow:
    0 0 0 1px rgba(15, 23, 42, 0.08),
    0 4px 12px rgba(15, 23, 42, 0.1);
}
html[data-theme="light"] .pool-bar {
  color: #5a6b82;
}
html[data-theme="light"] .pool-bar > span:not(.room-chip):not(.arch-pill):not(.ice-path):not(.pool-hint) {
  background: rgba(15, 23, 42, 0.04);
  border-color: rgba(15, 23, 42, 0.08);
}
html[data-theme="light"] .pool-bar strong {
  color: #0f172a;
}
html[data-theme="light"] .name-chip {
  border-color: rgba(15, 23, 42, 0.1);
  background: rgba(255, 255, 255, 0.75);
}
html[data-theme="light"] .name-chip input {
  color: #0f172a;
}
html[data-theme="light"] .lang-top-right {
  background: rgba(255, 255, 255, 0.8);
  border-color: rgba(15, 23, 42, 0.1);
}
html[data-theme="light"] .lang-switch {
  color: #5a6b82;
}
html[data-theme="light"] .lang-switch select {
  background: #fff;
  color: #0f172a;
  border-color: rgba(15, 23, 42, 0.12);
}
html[data-theme="light"] .stage-top-actions .phase {
  border-color: rgba(15, 23, 42, 0.1);
  background: rgba(15, 23, 42, 0.04);
  color: #334155;
}
html[data-theme="light"] .status-pill {
  color: #64748b;
}
html[data-theme="light"] .stage {
  background: #dce2eb;
}
html[data-theme="light"] .tile {
  background: #0a0c12;
}
html[data-theme="light"] .tile-remote {
  border-right-color: rgba(15, 23, 42, 0.12);
}
html[data-theme="light"] .side-btn {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.14);
  color: #f8fafc;
}
html[data-theme="light"] .side-btn:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(91, 157, 255, 0.55);
}
html[data-theme="light"] .tile-dock {
  background: linear-gradient(
    to top,
    rgba(8, 10, 16, 0.88) 0%,
    rgba(8, 10, 16, 0.45) 55%,
    transparent 100%
  );
}
html[data-theme="light"] .dock-pill {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.16);
  color: #f8fafc;
}
html[data-theme="light"] .dock-pill:hover {
  background: rgba(255, 255, 255, 0.24);
  border-color: rgba(126, 182, 255, 0.55);
}
html[data-theme="light"] .dock-settings {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.18);
  color: #f8fafc;
}
html[data-theme="light"] .dock-chat input {
  background: rgba(255, 255, 255, 0.92);
  color: #0f172a;
  border-color: rgba(15, 23, 42, 0.12);
}
html[data-theme="light"] .dock-chat input::placeholder {
  color: #94a3b8;
}
html[data-theme="light"] .room-in-tile,
html[data-theme="light"] .room-field {
  color: #e2e8f0;
}
html[data-theme="light"] .room-field input {
  background: rgba(255, 255, 255, 0.9);
  color: #0f172a;
  border-color: rgba(15, 23, 42, 0.12);
}
html[data-theme="light"] .chat-panel {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(15, 23, 42, 0.1);
  color: #0f172a;
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.18);
}
html[data-theme="light"] .chat-panel-head {
  color: #0f172a;
  border-bottom-color: rgba(15, 23, 42, 0.08);
}
html[data-theme="light"] .chat-bubble.mine {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.18), rgba(99, 102, 241, 0.16));
  border-color: rgba(99, 102, 241, 0.35);
  color: #0f172a;
}
html[data-theme="light"] .sheet,
html[data-theme="light"] .settings-sheet,
html[data-theme="light"] #settings-sheet,
html[data-theme="light"] #friends-sheet {
  background: #f7f8fb;
  border-color: rgba(15, 23, 42, 0.1);
  color: #0f172a;
}
html[data-theme="light"] .sheet header,
html[data-theme="light"] .settings-header {
  border-bottom-color: rgba(15, 23, 42, 0.08);
  color: #0f172a;
}
html[data-theme="light"] .settings-section-label {
  color: #64748b;
}
html[data-theme="light"] .settings-group {
  background: #fff;
  border-color: rgba(15, 23, 42, 0.08);
}
html[data-theme="light"] .settings-row {
  color: #0f172a;
  border-bottom-color: rgba(15, 23, 42, 0.06);
}
html[data-theme="light"] .settings-row:hover {
  background: rgba(15, 23, 42, 0.03);
}
html[data-theme="light"] .settings-row .row-value,
html[data-theme="light"] .settings-row .chev,
html[data-theme="light"] .theme-pick-sub {
  color: #64748b;
}
html[data-theme="light"] .settings-hero-name,
html[data-theme="light"] .settings-row-input input,
html[data-theme="light"] input.settings-hero-name {
  color: #0f172a;
  background: transparent;
}
html[data-theme="light"] .settings-hero-sub,
html[data-theme="light"] .hint-inline {
  color: #64748b;
}
html[data-theme="light"] .settings-status-card {
  background: #fff;
  border-color: rgba(15, 23, 42, 0.08);
}
html[data-theme="light"] .status-pill-chip {
  background: rgba(15, 23, 42, 0.05);
  color: #334155;
  border-color: rgba(15, 23, 42, 0.08);
}
html[data-theme="light"] .settings-done-btn {
  background: linear-gradient(135deg, #ff2d55, #ff6b35);
  color: #fff;
}
html[data-theme="light"] .partner-menu {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(15, 23, 42, 0.1);
  color: #0f172a;
}
html[data-theme="light"] .rules-overlay {
  background: rgba(232, 236, 242, 0.88);
}
html[data-theme="light"] .rules-card {
  background: #fff;
  border-color: rgba(15, 23, 42, 0.1);
  color: #0f172a;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.15);
}
html[data-theme="light"] .rules-list {
  color: #475569;
}
html[data-theme="light"] .conn-strip {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(15, 23, 42, 0.1);
  color: #0f172a;
}
html[data-theme="light"] .friend-row {
  background: #fff;
  border-color: rgba(15, 23, 42, 0.08);
  color: #0f172a;
}
html[data-theme="light"] .friend-row .meta span {
  color: #64748b;
}
html[data-theme="light"] .pill {
  border-color: rgba(15, 23, 42, 0.1);
  background: rgba(15, 23, 42, 0.04);
  color: #0f172a;
}
html[data-theme="light"] .theme-choice-list .settings-choice.is-selected {
  background: rgba(37, 99, 235, 0.08);
}
html[data-theme="light"] .stage-body :is(button, a, input, select, textarea, .settings-row, .dock-pill, .side-btn):focus-visible {
  outline-color: rgba(37, 99, 235, 0.75);
}

/* ─── Saloon (western) theme ─── */
html[data-theme="saloon"] {
  color-scheme: dark;
}
html[data-theme="saloon"].stage-html,
html[data-theme="saloon"]:has(.stage-body) {
  background: #120c07;
  color-scheme: dark;
}
html[data-theme="saloon"] .stage-body {
  background: #120c07 !important;
  color: #f3e6c8;
  color-scheme: dark;
  font-family: "Source Serif 4", "Noto Sans", Georgia, serif;
}
html[data-theme="saloon"] .stage-app {
  background:
    radial-gradient(800px 380px at 12% -8%, rgba(201, 162, 39, 0.14) 0%, transparent 55%),
    radial-gradient(640px 320px at 100% 0%, rgba(139, 58, 28, 0.18) 0%, transparent 50%),
    radial-gradient(500px 280px at 50% 100%, rgba(61, 36, 18, 0.35) 0%, transparent 55%),
    #120c07;
}
html[data-theme="saloon"] .stage-top {
  background: linear-gradient(
    180deg,
    rgba(36, 22, 12, 0.95) 0%,
    rgba(26, 16, 8, 0.88) 100%
  );
  box-shadow:
    0 1px 0 rgba(201, 162, 39, 0.18),
    0 8px 24px rgba(0, 0, 0, 0.35);
}
html[data-theme="saloon"] .stage-top::after {
  background: linear-gradient(
    90deg,
    transparent,
    rgba(201, 162, 39, 0.45),
    transparent
  );
}
html[data-theme="saloon"] .brand {
  font-family: "Rye", "Source Serif 4", serif;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: #f6e7c1;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.45);
}
html[data-theme="saloon"] .brand .badge {
  font-family: "Source Serif 4", serif;
  background: rgba(201, 162, 39, 0.18);
  color: #f0d78c;
  border-color: rgba(201, 162, 39, 0.45);
}
html[data-theme="saloon"] .brand-logo {
  border-radius: 0.35rem;
  box-shadow:
    0 0 0 1px rgba(201, 162, 39, 0.35),
    0 4px 14px rgba(0, 0, 0, 0.5);
  filter: sepia(0.35) saturate(1.15);
}
html[data-theme="saloon"] .pool-bar {
  color: #c4a882;
}
html[data-theme="saloon"] .pool-bar > span:not(.room-chip):not(.arch-pill):not(.ice-path):not(.pool-hint) {
  background: rgba(201, 162, 39, 0.08);
  border-color: rgba(201, 162, 39, 0.22);
}
html[data-theme="saloon"] .pool-bar strong {
  color: #f6e7c1;
}
html[data-theme="saloon"] .room-chip {
  background: rgba(201, 162, 39, 0.14);
  border-color: rgba(201, 162, 39, 0.4);
  color: #f0d78c;
}
html[data-theme="saloon"] .arch-pill {
  border-color: rgba(201, 162, 39, 0.35);
  color: #e8c96a;
  background: rgba(61, 40, 18, 0.65);
}
html[data-theme="saloon"] .arch-pill.p2p-live {
  border-color: rgba(201, 162, 39, 0.45);
  color: #f0d78c;
  background: rgba(61, 40, 18, 0.7);
}
html[data-theme="saloon"] .name-chip {
  border-color: rgba(201, 162, 39, 0.28);
  background: rgba(36, 22, 12, 0.75);
}
html[data-theme="saloon"] .name-chip input {
  color: #f6e7c1;
}
html[data-theme="saloon"] .lang-top-right {
  background: rgba(36, 22, 12, 0.8);
  border-color: rgba(201, 162, 39, 0.28);
}
html[data-theme="saloon"] .lang-switch select {
  background: #24160c;
  color: #f6e7c1;
  border-color: rgba(201, 162, 39, 0.3);
}
html[data-theme="saloon"] .stage-top-actions .phase {
  border-color: rgba(201, 162, 39, 0.22);
  background: rgba(36, 22, 12, 0.7);
  color: #e8d4b0;
}
html[data-theme="saloon"] .stage-top-actions .phase.waiting,
html[data-theme="saloon"] .stage-top-actions .phase.claiming {
  color: #f0d78c;
  background: rgba(201, 162, 39, 0.14);
  border-color: rgba(201, 162, 39, 0.4);
}
html[data-theme="saloon"] .stage-top-actions .phase.matched,
html[data-theme="saloon"] .stage-top-actions .phase.friend_call {
  color: #9fd98a;
  background: rgba(46, 80, 36, 0.35);
  border-color: rgba(120, 180, 90, 0.35);
}
html[data-theme="saloon"] .status-pill {
  color: #b89a72;
}
html[data-theme="saloon"] .stage {
  background: #0c0805;
}
html[data-theme="saloon"] .tile {
  background: #100b07;
}
html[data-theme="saloon"] .tile-remote {
  border-right: 1px solid rgba(201, 162, 39, 0.15);
}
html[data-theme="saloon"] .tile::after {
  box-shadow: inset 0 0 0 1px rgba(201, 162, 39, 0.06);
}
html[data-theme="saloon"] .side-btn {
  border-color: rgba(201, 162, 39, 0.32);
  background: rgba(36, 22, 12, 0.78);
  color: #f0d78c;
  box-shadow:
    0 6px 20px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(201, 162, 39, 0.12);
}
html[data-theme="saloon"] .side-btn:hover {
  background: rgba(58, 36, 18, 0.92);
  border-color: rgba(201, 162, 39, 0.55);
  color: #ffe9a8;
}
html[data-theme="saloon"] .side-btn .lbl {
  color: #e8d4b0;
}
html[data-theme="saloon"] .tile-dock {
  background: linear-gradient(
    to top,
    rgba(18, 10, 5, 0.94) 0%,
    rgba(18, 10, 5, 0.55) 50%,
    transparent 100%
  );
}
html[data-theme="saloon"] .dock-pill {
  border-color: rgba(201, 162, 39, 0.3);
  background: rgba(36, 22, 12, 0.85);
  color: #f3e6c8;
  font-family: "Source Serif 4", serif;
}
html[data-theme="saloon"] .dock-pill:hover {
  border-color: rgba(201, 162, 39, 0.55);
  background: rgba(58, 36, 18, 0.95);
}
html[data-theme="saloon"] .dock-pill.accent {
  background: linear-gradient(135deg, #8b3a1c, #c45c26);
  border-color: transparent;
  color: #fff6e0;
}
html[data-theme="saloon"] .dock-pill.danger {
  border-color: rgba(196, 70, 40, 0.5);
  color: #ffb4a0;
}
html[data-theme="saloon"] .next-big {
  font-family: "Rye", "Source Serif 4", serif;
  font-weight: 400;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, #8b3a1c 0%, #c45c26 45%, #d4a017 100%);
  box-shadow:
    0 8px 28px rgba(139, 58, 28, 0.5),
    inset 0 1px 0 rgba(255, 230, 160, 0.25);
  border: 1px solid rgba(240, 215, 140, 0.35);
  color: #fff8e8;
}
html[data-theme="saloon"] .next-big:hover {
  box-shadow:
    0 12px 36px rgba(196, 92, 38, 0.55),
    inset 0 1px 0 rgba(255, 230, 160, 0.3);
}
html[data-theme="saloon"] .icon-next {
  color: #fff8e8;
}
html[data-theme="saloon"] .dock-settings {
  border-color: rgba(201, 162, 39, 0.35);
  background: rgba(36, 22, 12, 0.88);
  color: #f0d78c;
}
html[data-theme="saloon"] .dock-settings:hover {
  border-color: rgba(201, 162, 39, 0.55);
  color: #ffe9a8;
}
html[data-theme="saloon"] .dock-chat input {
  background: rgba(26, 16, 8, 0.9);
  color: #f3e6c8;
  border: 1px solid rgba(201, 162, 39, 0.28);
  font-family: "Source Serif 4", serif;
}
html[data-theme="saloon"] .dock-chat input::placeholder {
  color: #a89070;
}
html[data-theme="saloon"] .room-field {
  color: #c4a882;
}
html[data-theme="saloon"] .room-field input {
  background: rgba(26, 16, 8, 0.9);
  color: #f3e6c8;
  border-color: rgba(201, 162, 39, 0.28);
}
html[data-theme="saloon"] .chat-panel {
  background: rgba(26, 16, 8, 0.94);
  border-color: rgba(201, 162, 39, 0.28);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
  color: #f3e6c8;
}
html[data-theme="saloon"] .chat-bubble.mine {
  background: linear-gradient(135deg, rgba(139, 58, 28, 0.55), rgba(201, 162, 39, 0.28));
  border-color: rgba(201, 162, 39, 0.4);
}
html[data-theme="saloon"] .tile-empty .empty-title {
  font-family: "Rye", serif;
  color: #f0d78c;
}
html[data-theme="saloon"] .tile-empty .empty-sub {
  color: #c4a882;
}
html[data-theme="saloon"] .icon-empty {
  color: #c9a227;
}
html[data-theme="saloon"] .sheet,
html[data-theme="saloon"] .settings-sheet,
html[data-theme="saloon"] #settings-sheet,
html[data-theme="saloon"] #friends-sheet {
  background: #1c120a;
  border-color: rgba(201, 162, 39, 0.28);
  color: #f3e6c8;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}
html[data-theme="saloon"] .sheet header,
html[data-theme="saloon"] .settings-header {
  border-bottom-color: rgba(201, 162, 39, 0.18);
  font-family: "Rye", "Source Serif 4", serif;
  font-weight: 400;
  color: #f0d78c;
}
html[data-theme="saloon"] .settings-section-label {
  color: #b89a72;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.68rem;
}
html[data-theme="saloon"] .settings-group {
  background: rgba(36, 22, 12, 0.75);
  border: 1px solid rgba(201, 162, 39, 0.18);
  border-radius: 12px;
  overflow: hidden;
}
html[data-theme="saloon"] .settings-row {
  color: #f3e6c8;
  border-bottom-color: rgba(201, 162, 39, 0.1);
}
html[data-theme="saloon"] .settings-row:hover {
  background: rgba(201, 162, 39, 0.08);
}
html[data-theme="saloon"] .settings-row .row-value,
html[data-theme="saloon"] .settings-row .chev,
html[data-theme="saloon"] .theme-pick-sub {
  color: #b89a72;
}
html[data-theme="saloon"] .settings-row .row-ico {
  color: #c9a227;
}
html[data-theme="saloon"] .settings-hero-name {
  color: #f6e7c1;
  font-family: "Rye", serif;
}
html[data-theme="saloon"] .settings-hero-sub,
html[data-theme="saloon"] .hint-inline {
  color: #b89a72;
}
html[data-theme="saloon"] .settings-hero-avatar {
  background: linear-gradient(145deg, #3b2412, #1a1008);
  border-color: rgba(201, 162, 39, 0.4);
  color: #f0d78c;
}
html[data-theme="saloon"] .settings-status-card {
  background: rgba(36, 22, 12, 0.7);
  border-color: rgba(201, 162, 39, 0.2);
}
html[data-theme="saloon"] .status-pill-chip {
  background: rgba(201, 162, 39, 0.1);
  color: #e8d4b0;
  border-color: rgba(201, 162, 39, 0.22);
}
html[data-theme="saloon"] .settings-done-btn {
  font-family: "Rye", serif;
  font-weight: 400;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, #8b3a1c, #c45c26 50%, #d4a017);
  color: #fff8e8;
  border: 1px solid rgba(240, 215, 140, 0.3);
}
html[data-theme="saloon"] .partner-menu {
  background: rgba(28, 18, 10, 0.97);
  border-color: rgba(201, 162, 39, 0.3);
  color: #f3e6c8;
}
html[data-theme="saloon"] .rules-overlay {
  background: rgba(12, 8, 5, 0.9);
}
html[data-theme="saloon"] .rules-card {
  background: #1c120a;
  border: 1px solid rgba(201, 162, 39, 0.35);
  color: #f3e6c8;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}
html[data-theme="saloon"] .rules-card h2 {
  font-family: "Rye", serif;
  color: #f0d78c;
}
html[data-theme="saloon"] .rules-list {
  color: #c4a882;
}
html[data-theme="saloon"] .conn-strip {
  background: rgba(36, 22, 12, 0.88);
  border-color: rgba(201, 162, 39, 0.28);
  color: #f3e6c8;
}
html[data-theme="saloon"] .conn-retry {
  background: rgba(139, 58, 28, 0.35);
  border-color: rgba(201, 162, 39, 0.35);
  color: #f0d78c;
}
html[data-theme="saloon"] .friend-row {
  background: rgba(36, 22, 12, 0.8);
  border-color: rgba(201, 162, 39, 0.2);
  color: #f3e6c8;
}
html[data-theme="saloon"] .friend-row .meta span {
  color: #b89a72;
}
html[data-theme="saloon"] .pill {
  border-color: rgba(201, 162, 39, 0.25);
  background: rgba(201, 162, 39, 0.08);
  color: #f3e6c8;
}
html[data-theme="saloon"] .pill.primary {
  background: linear-gradient(135deg, #8b3a1c, #c45c26);
  color: #fff8e8;
  box-shadow: 0 6px 20px rgba(139, 58, 28, 0.35);
}
html[data-theme="saloon"] .pill.accent {
  background: linear-gradient(135deg, #8b4513, #c9a227);
  color: #1a1008;
}
html[data-theme="saloon"] .fed-chip {
  color: #f0d78c;
  background: rgba(201, 162, 39, 0.14);
  border-color: rgba(201, 162, 39, 0.4);
}
html[data-theme="saloon"] .theme-choice-list .settings-choice.is-selected {
  background: rgba(201, 162, 39, 0.14);
}
html[data-theme="saloon"] .stage-body :is(button, a, input, select, textarea, .settings-row, .dock-pill, .side-btn):focus-visible {
  outline-color: rgba(201, 162, 39, 0.85);
}
html[data-theme="saloon"] .settings-row-danger .row-left,
html[data-theme="saloon"] .settings-row-danger .row-ico {
  color: #ffb4a0;
}
html[data-theme="saloon"] .enable-cam-btn {
  font-family: "Rye", serif;
  background: linear-gradient(135deg, #8b3a1c, #c45c26);
  border-color: rgba(240, 215, 140, 0.3);
  color: #fff8e8;
}

/* ─── Flag picker (cosmetic, not location) ─── */
.flag-choice-list {
  max-height: min(52vh, 28rem);
  overflow: auto;
}
.flag-emoji-lg {
  font-size: 1.35rem;
  line-height: 1;
  width: 1.75rem;
  text-align: center;
  flex-shrink: 0;
}
.flag-pick-copy {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  min-width: 0;
  text-align: left;
}
.flag-pick-title {
  font-weight: 600;
  font-size: 0.92rem;
}
.flag-pick-sub {
  font-size: 0.7rem;
  color: #8b9bb0;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.name-on-tile {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  max-width: min(70vw, 16rem);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
html[data-theme="light"] .flag-pick-sub {
  color: #64748b;
}
html[data-theme="saloon"] .flag-pick-sub {
  color: #b89a72;
}

/* ─── Avatar photo (settings + tiles) ─── */
.settings-hero-avatar {
  cursor: pointer;
  overflow: hidden;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
}
.settings-hero-avatar:hover {
  border-color: rgba(255, 107, 53, 0.55);
  filter: brightness(1.05);
}
.settings-hero-avatar:focus-visible {
  outline: 2px solid rgba(255, 107, 53, 0.85);
  outline-offset: 2px;
}
.settings-hero-img {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 999px;
  display: block;
}
.settings-hero-avatar.has-photo .settings-hero-letter,
.settings-hero-avatar.has-photo .settings-hero-fallback {
  display: none !important;
}
.settings-hero-cam {
  grid-area: 1 / 1;
  align-self: end;
  justify-self: end;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 999px;
  background: rgba(10, 12, 18, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: grid;
  place-items: center;
  color: #eef2f7;
  transform: translate(12%, 12%);
  pointer-events: none;
}
.settings-hero-cam .icon {
  width: 0.82rem !important;
  height: 0.82rem !important;
  opacity: 1 !important;
}
.settings-hero-avatar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.2rem;
}
.settings-link-btn {
  appearance: none;
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 650;
  color: #7eb6ff;
  cursor: pointer;
  text-decoration: none;
}
.settings-link-btn:hover {
  color: #a8ceff;
  text-decoration: underline;
}
.settings-link-btn[hidden] {
  display: none !important;
}
.tile-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.tile-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  background: #141a22;
}
.tile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.tile-avatar[hidden] {
  display: none !important;
}
html[data-theme="light"] .settings-link-btn {
  color: #2563eb;
}
html[data-theme="light"] .settings-link-btn:hover {
  color: #1d4ed8;
}
html[data-theme="saloon"] .settings-link-btn {
  color: #f0d78c;
}
html[data-theme="saloon"] .settings-hero-cam {
  background: rgba(26, 16, 8, 0.9);
  border-color: rgba(201, 162, 39, 0.45);
  color: #f0d78c;
}
html[data-theme="saloon"] .tile-avatar {
  border-color: rgba(201, 162, 39, 0.4);
}

/* Avatar attach row */
.avatar-attach-group {
  margin-bottom: 0.65rem;
}
.avatar-attach-copy {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
  text-align: left;
}
.avatar-attach-hint {
  font-size: 0.72rem;
  font-weight: 500;
  color: #8b9bb0;
  line-height: 1.25;
}
.settings-hero.is-drop-target {
  outline: 2px dashed rgba(126, 182, 255, 0.75);
  outline-offset: 2px;
  background: linear-gradient(145deg, #1a2438 0%, #141a28 100%);
}
html[data-theme="light"] .avatar-attach-hint {
  color: #64748b;
}
html[data-theme="light"] .settings-hero.is-drop-target {
  outline-color: rgba(37, 99, 235, 0.65);
  background: #eef2ff;
}
html[data-theme="saloon"] .avatar-attach-hint {
  color: #b89a72;
}
html[data-theme="saloon"] .settings-hero.is-drop-target {
  outline-color: rgba(201, 162, 39, 0.7);
  background: linear-gradient(145deg, #2a1a0c, #1a1008);
}
