/* Co-Browsing Rooms — TV-first (10-foot UI) */
:root {
  --bg: #0b0d10;
  --bg-elev: #141820;
  --bg-panel: #1a2030;
  --line: #2a3344;
  --text: #f2f4f7;
  --muted: #9aa3b2;
  --accent: #f0b429;
  --accent-dim: #c9921a;
  --ok: #3dd68c;
  --danger: #ff6b6b;
  --focus: #f0b429;
  --radius: 14px;
  --font: "Segoe UI", "Trebuchet MS", system-ui, sans-serif;
  --space: clamp(12px, 2vw, 28px);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; min-height: 100%;
  background: radial-gradient(1200px 600px at 20% -10%, #1c2436 0%, var(--bg) 55%);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }
button, input, textarea { font: inherit; color: inherit; }
button {
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 999px;
  background: var(--bg-elev);
  padding: 0.85rem 1.4rem;
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
button:hover { border-color: var(--line); }
button:focus-visible, .focusable:focus-visible, [tabindex="0"]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
button.primary { background: var(--accent); color: #1a1200; font-weight: 700; }
button.primary:hover { background: #ffc94a; }
button.ghost { background: transparent; border-color: var(--line); }
button.danger { background: #3a1518; color: #ffb4b4; border-color: #5a2228; }
button:disabled { opacity: .45; cursor: not-allowed; }

.input {
  width: 100%;
  background: var(--bg);
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 0.95rem 1.1rem;
}
.input:focus { border-color: var(--accent); outline: none; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: var(--space);
  padding: var(--space);
  max-width: 1400px;
  margin: 0 auto;
}

.brand {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
}
.brand h1 {
  margin: 0; font-size: clamp(1.4rem, 3vw, 2.2rem); letter-spacing: .02em;
}
.brand .tag {
  color: var(--muted); font-size: .95rem;
}

.card {
  background: color-mix(in srgb, var(--bg-panel) 88%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(16px, 2.5vw, 28px);
  backdrop-filter: blur(8px);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.4fr .9fr;
  gap: var(--space);
}
@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
}

.room-code {
  font-size: clamp(2.4rem, 8vw, 5rem);
  font-weight: 800;
  letter-spacing: .28em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.pad {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  max-width: 420px;
  margin: 0 auto;
}
.pad button {
  min-height: 72px;
  font-size: 1.6rem;
  font-weight: 700;
  border-radius: 16px;
  background: var(--bg-elev);
  border: 2px solid var(--line);
}
.pad button.wide { grid-column: span 2; }

.status-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: .4rem .85rem; border-radius: 999px;
  background: #132018; color: var(--ok); border: 1px solid #1f3a2a;
  font-size: .9rem;
}
.status-pill.warn { background: #2a2410; color: var(--accent); border-color: #4a3b12; }
.status-pill.off { background: #2a1518; color: var(--danger); border-color: #4a2228; }

.members {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.member-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: .35rem .7rem; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--line); font-size: .9rem;
}
.member-chip.host { border-color: var(--accent); color: var(--accent); }
.device-tv::before { content: "📺 "; }
.device-mobile::before { content: "📱 "; }
.device-desktop::before { content: "💻 "; }
.device-extension::before { content: "🧩 "; }

.stage {
  position: relative;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  min-height: clamp(240px, 48vh, 620px);
  border: 1px solid var(--line);
  display: grid; place-items: center;
}
.stage iframe, .stage video {
  width: 100%; height: 100%; min-height: inherit; border: 0; background: #000;
}
.stage-empty {
  text-align: center; padding: 2rem; color: var(--muted);
}
.stage-empty strong { display: block; color: var(--text); font-size: 1.4rem; margin-bottom: .4rem; }

.chat {
  display: flex; flex-direction: column; height: min(70vh, 720px);
}
.chat-log {
  flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 10px;
  padding-right: 4px; margin-bottom: 12px;
}
.msg {
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: .7rem .85rem;
}
.msg .nick { color: var(--accent); font-weight: 700; font-size: .85rem; }
.msg .text { margin-top: 2px; line-height: 1.35; word-break: break-word; }
.msg .time { color: var(--muted); font-size: .75rem; margin-top: 4px; }

.reactions {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.reactions button {
  min-width: 56px; min-height: 56px; font-size: 1.5rem; border-radius: 14px;
}

.floating-reaction {
  position: fixed; bottom: 12%; pointer-events: none; z-index: 50;
  font-size: clamp(2rem, 5vw, 3.5rem);
  animation: floatUp 2.2s ease-out forwards;
  filter: drop-shadow(0 8px 16px rgba(0,0,0,.45));
}
@keyframes floatUp {
  0% { transform: translateY(0) scale(.7); opacity: 0; }
  15% { opacity: 1; transform: translateY(-20px) scale(1); }
  100% { transform: translateY(-220px) scale(1.15); opacity: 0; }
}

.effect-overlay {
  position: fixed; inset: 0; z-index: 80; pointer-events: none;
  display: grid; place-items: center;
  background: rgba(180, 30, 30, .35);
  animation: flash 2.8s ease-out forwards;
}
.effect-overlay span {
  font-size: clamp(2.5rem, 8vw, 5rem); font-weight: 900; color: #fff;
  text-shadow: 0 6px 30px rgba(0,0,0,.6);
}
@keyframes flash {
  0%, 100% { opacity: 0; }
  15%, 70% { opacity: 1; }
}

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.footer-note { color: var(--muted); font-size: .85rem; text-align: center; }

/* TV scale boost */
body.is-tv .pad button { min-height: 88px; font-size: 1.9rem; }
body.is-tv button { min-height: 56px; font-size: 1.1rem; }
body.is-tv .chat { height: min(78vh, 860px); }

/* Remote compact */
body.is-remote .app-shell { max-width: 560px; }
