:root {
  color-scheme: dark;
  --bg: #111215;
  --surface: #18191f;
  --surface-hover: #22232b;
  --surface-active: #2b2c37;
  --surface-elevated: #20222a;
  --line: #2b2e38;
  --line-light: #363946;
  --text: #f4f5f8;
  --muted: #9ba0af;
  --subtle: #6b6f7e;

  /* Yandex / Google playful warm yellow */
  --accent: #ffcc00;
  --accent-hover: #ffd633;
  --accent-active: #f5c400;
  --accent-text: #111215;
  --accent-subtle: rgba(255, 204, 0, 0.12);

  --danger: #ff5252;
  --danger-bg: rgba(255, 82, 82, 0.12);
  --green: #2ed573;
  --green-bg: rgba(46, 213, 115, 0.12);
  --blue: #4a90e2;

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-pill: 9999px;

  font-family: -apple-system, BlinkMacSystemFont, "YS Text", "Google Sans", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-synthesis: none;
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select {
  font: inherit;
  border-radius: var(--radius-md);
}

button, a, input, textarea, select {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
  border: 0;
  background: transparent;
  color: inherit;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

button, a {
  touch-action: manipulation;
}

a {
  color: inherit;
  text-decoration: none;
}

button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

svg {
  width: 20px;
  height: 20px;
  vertical-align: middle;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

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

.muted {
  color: var(--muted);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-subtle);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.02em;
}

/* Brand */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
  color: var(--text);
}

.brand-symbol {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}

.brand small {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  background: var(--surface);
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  margin-left: 4px;
}

/* Top bar */
.topbar {
  height: 72px;
  max-width: 1440px;
  margin: auto;
  padding: 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.account {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  background: var(--surface);
  padding: 5px 12px 5px 6px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  display: inline-grid;
  place-items: center;
  background: #343744;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}

.avatar.small {
  width: 24px;
  height: 24px;
  font-size: 10px;
}

/* Buttons */
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  min-width: 38px;
  border-radius: var(--radius-md);
  color: var(--muted);
  transition: background 0.1s ease, color 0.1s ease;
}

.icon-button:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 18px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  border-radius: var(--radius-md);
  transition: background 0.1s ease, border-color 0.1s ease;
}

.button:hover {
  background: var(--surface-hover);
  border-color: var(--line-light);
}

.button.primary {
  color: var(--accent-text);
  background: var(--accent);
  border-color: var(--accent);
}

.button.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.button.quiet {
  background: transparent;
  border-color: transparent;
}

.button.quiet:hover {
  background: var(--surface-hover);
  border-color: var(--line);
}

.button.small {
  min-height: 32px;
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.button.danger {
  color: var(--danger);
}

.button.wide {
  width: 100%;
}

.text-button {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  transition: color 0.1s ease;
}

.text-button:hover {
  color: var(--text);
}

/* Landing / Welcome */
.welcome {
  max-width: 1280px;
  margin: 40px auto 0;
  padding: 0 40px;
}

.welcome-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 60px;
  align-items: center;
  padding: 20px 0 60px;
}

.welcome h1 {
  font-size: clamp(38px, 4.2vw, 56px);
  line-height: 1.1;
  letter-spacing: -0.035em;
  font-weight: 750;
  margin: 18px 0;
}

.welcome h1 span {
  color: var(--accent);
}

.welcome-copy {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
  max-width: 480px;
  margin: 0 0 28px;
}

.welcome .primary {
  padding: 12px 24px;
  min-height: 48px;
  font-size: 15px;
  border-radius: var(--radius-pill);
}

.signin-note {
  font-size: 12px;
  color: var(--subtle);
  margin-top: 14px;
}

/* Playful Mock Stage */
.mock-stage {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 20px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
}

.mock-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  font-size: 12px;
}

.mock-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 10px;
  background: rgba(255, 82, 82, 0.14);
  color: #ff6b6b;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 11px;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ff5252;
}

.mock-time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.mock-screen {
  aspect-ratio: 16/9;
  background: #0d0e11;
  border-radius: var(--radius-md);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #20222a;
}

.mock-play-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  display: grid;
  place-items: center;
  box-shadow: 0 6px 20px rgba(255, 204, 0, 0.35);
}

.mock-play-btn svg {
  width: 24px;
  height: 24px;
  margin-left: 2px;
}

.mock-pill-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.65);
  color: #eee;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  backdrop-filter: blur(4px);
}

.mock-bar {
  margin-top: 16px;
  position: relative;
  height: 6px;
  background: #2a2d37;
  border-radius: 3px;
  display: flex;
  align-items: center;
}

.mock-progress {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: var(--accent);
  border-radius: 3px;
}

.mock-avatars {
  position: absolute;
  right: 0;
  top: -12px;
  display: flex;
  gap: -6px;
}

.mock-av {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  border: 2px solid var(--surface);
  margin-left: -6px;
}

.mock-bubbles {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mock-bubble {
  padding: 8px 14px;
  background: var(--surface-hover);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  font-size: 12px;
  color: var(--text);
  align-self: flex-start;
  max-width: 90%;
}

.mock-bubble span {
  font-weight: 600;
  color: var(--accent);
  margin-right: 4px;
}

.mock-bubble.user {
  align-self: flex-end;
  background: var(--accent-subtle);
  border-color: rgba(255, 204, 0, 0.25);
}

.mock-bubble.user span {
  color: #ffd633;
}

/* Feature strip */
.feature-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  padding: 36px 0;
  border-top: 1px solid var(--line);
}

.feature-strip strong {
  display: block;
  font-size: 15px;
  font-weight: 650;
  margin-bottom: 6px;
  color: var(--text);
}

.feature-strip p {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
  line-height: 1.55;
}

.feature-number {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-subtle);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  margin-right: 8px;
  vertical-align: middle;
}

/* Footer */
.footer {
  max-width: 1280px;
  margin: 40px auto 24px;
  padding: 0 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--subtle);
  font-size: 12px;
  gap: 20px;
}

.footer button {
  font-size: inherit;
  color: inherit;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.footer button:hover {
  color: var(--muted);
}

/* Lobby */
.lobby {
  max-width: 1180px;
  padding: 40px 40px 30px;
  margin: auto;
}

.lobby-heading {
  margin-bottom: 30px;
}

.lobby h1 {
  font-size: 34px;
  letter-spacing: -0.03em;
  font-weight: 700;
  margin: 10px 0 6px;
}

.lobby-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.start-room {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 24px 28px;
  margin-bottom: 38px;
  border: 1px solid rgba(255, 204, 0, 0.25);
  background: linear-gradient(135deg, rgba(255, 204, 0, 0.08), rgba(255, 204, 0, 0.02));
  border-radius: var(--radius-lg);
}

.start-room h2 {
  font-size: 19px;
  font-weight: 650;
  margin: 0 0 4px;
  color: var(--text);
}

.start-room p {
  color: var(--muted);
  margin: 0;
  font-size: 13px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 32px 0 16px;
  gap: 20px;
}

.section-heading h2 {
  font-size: 18px;
  font-weight: 650;
  margin: 0;
}

.section-heading span {
  font-size: 12px;
  color: var(--subtle);
}

/* Room grid */
.room-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.room-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.1s ease;
}

.room-card:hover {
  border-color: var(--line-light);
}

.room-cover {
  height: 120px;
  background: #1f2129;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.room-cover svg {
  width: 32px;
  height: 32px;
  color: var(--muted);
}

.room-cover .provider-label {
  position: absolute;
  left: 12px;
  top: 12px;
}

.room-cover .cover-time {
  position: absolute;
  bottom: 10px;
  right: 12px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 7px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: var(--radius-xs);
  backdrop-filter: blur(4px);
}

.room-card-body {
  padding: 14px 16px;
}

.room-card h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-card p {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Empty list */
.empty-list {
  border-top: 1px solid var(--line);
  padding: 28px 0;
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--muted);
}

.empty-list svg {
  width: 26px;
  height: 26px;
  color: var(--subtle);
}

.empty-list strong {
  display: block;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.empty-list p {
  font-size: 12px;
  margin: 3px 0 0;
  color: var(--muted);
}

/* Bookmarks */
.bookmark-list {
  border-top: 1px solid var(--line);
}

.bookmark-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.bookmark-time {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-subtle);
  border-radius: var(--radius-sm);
  min-width: 58px;
  text-align: center;
  padding: 6px 8px;
}

.bookmark-info {
  min-width: 0;
  flex: 1;
}

.bookmark-info strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
}

.bookmark-info span {
  font-size: 11px;
  color: var(--muted);
}

.provider-label {
  font-size: 11px;
  font-weight: 600;
  color: #cfd2dc;
  background: rgba(255, 255, 255, 0.08);
  padding: 3px 8px;
  border-radius: var(--radius-pill);
}

/* Room Shell */
.room-shell {
  max-width: 1600px;
  margin: auto;
  padding: 0 24px 24px;
}

.room-topbar {
  height: 64px;
  padding: 0;
  max-width: none;
}

.room-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.room-heading .divider {
  height: 18px;
  width: 1px;
  background: var(--line);
}

.room-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-topbar .topbar-right {
  gap: 10px;
}

.connection-label {
  color: var(--muted);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
}

.connection-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}

.connection-dot.offline {
  background: var(--danger);
}

/* Watch layout */
.watch-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: start;
}

.watch-main {
  min-width: 0;
}

/* Player Stage */
.player-stage {
  position: relative;
  aspect-ratio: 16/9;
  background: #0a0b0d;
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
}

.player-stage iframe, .player-stage video {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
}

.player-mount {
  position: absolute;
  inset: 0;
}

.player-empty {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}

.empty-orbit {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent-subtle);
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  color: var(--accent);
}

.empty-orbit svg {
  height: 28px;
  width: 28px;
  margin-left: 2px;
}

.player-empty h2 {
  font-weight: 650;
  font-size: 20px;
  margin: 0 0 8px;
}

.player-empty p {
  font-size: 13px;
  color: var(--muted);
  max-width: 360px;
  margin: 0 0 20px;
  line-height: 1.5;
}

.player-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 12px;
  text-align: center;
  background: rgba(11, 12, 14, 0.9);
  color: var(--muted);
  font-size: 13px;
  pointer-events: none;
}

.player-loading .spinner {
  margin: auto;
}

.player-error {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  padding: 14px 18px;
  background: rgba(30, 20, 20, 0.95);
  border: 1px solid rgba(255, 82, 82, 0.35);
  border-radius: var(--radius-md);
  font-size: 13px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.player-error span {
  color: #ff9e9e;
}

/* Timeline */
.timeline-section {
  position: relative;
  padding-top: 14px;
}

.timeline-rail {
  position: relative;
  height: 28px;
  display: flex;
  align-items: center;
}

.seek-input {
  width: 100%;
  height: 5px;
  margin: 0;
  cursor: pointer;
  appearance: none;
  background: linear-gradient(to right, var(--accent) var(--progress, 0%), #31343f var(--progress, 0%));
  border-radius: 3px;
}

.seek-input::-webkit-slider-thumb {
  appearance: none;
  height: 14px;
  width: 14px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.seek-input::-moz-range-thumb {
  height: 14px;
  width: 14px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
}

.timeline-markers {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.timeline-marker {
  position: absolute;
  top: -4px;
  width: 20px;
  height: 20px;
  transform: translateX(-50%);
  pointer-events: auto;
  display: grid;
  place-items: center;
  padding: 0;
}

.timeline-marker:after {
  content: "";
  height: 6px;
  width: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.timeline-popover {
  position: absolute;
  bottom: 50px;
  width: 280px;
  max-width: 90%;
  padding: 14px;
  background: var(--surface-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  z-index: 5;
}

.timeline-popover h3 {
  font-size: 12px;
  color: var(--accent);
  margin: 0 0 8px;
  font-weight: 600;
}

.timeline-preview {
  font-size: 12px;
  padding: 4px 0;
}

.timeline-preview strong {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  display: block;
}

.timeline-preview p {
  margin: 2px 0;
  color: var(--text);
  overflow-wrap: anywhere;
}

.timeline-popover .button {
  margin-top: 8px;
}

/* Player controls */
.player-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 40px;
  margin-top: 4px;
}

.controls-left, .controls-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.play-button {
  color: var(--text);
  width: 38px;
  height: 38px;
}

.time-display {
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--text);
  margin: 0 6px;
}

.time-display span {
  color: var(--subtle);
  margin-left: 2px;
}

.volume-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.volume-input {
  width: 60px;
  height: 4px;
  accent-color: var(--accent);
}

.rate-select {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 8px;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

/* Media Meta */
.media-meta {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 20px;
  margin-top: 16px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
}

.media-title {
  font-size: 18px;
  line-height: 1.35;
  font-weight: 650;
  margin: 4px 0 6px;
  overflow-wrap: anywhere;
}

.media-subtitle {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}

.media-subtitle a {
  color: var(--accent);
}

.media-subtitle a:hover {
  text-decoration: underline;
}

/* Participants */
.participants-section {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.participants-heading {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
}

.participants-heading span {
  color: var(--muted);
  font-weight: 400;
  font-size: 12px;
  margin-left: 4px;
}

.participants {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.participant {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
}

.participant-avatar {
  position: relative;
}

.status-dot {
  position: absolute;
  right: -1px;
  bottom: 0;
  width: 8px;
  height: 8px;
  border: 2px solid var(--surface);
  background: var(--green);
  border-radius: 50%;
}

.status-dot.buffering, .status-dot.loading {
  background: var(--accent);
}

.status-dot.disconnected {
  background: var(--subtle);
}

.participant-name {
  font-size: 12px;
  font-weight: 600;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.participant-status {
  font-size: 11px;
  color: var(--muted);
}

.participant.disconnected {
  opacity: 0.5;
}

/* Waiting banner */
.waiting-banner {
  display: flex;
  align-items: start;
  gap: 12px;
  background: rgba(255, 204, 0, 0.1);
  color: var(--accent);
  border: 1px solid rgba(255, 204, 0, 0.25);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 13px;
  margin-bottom: 16px;
}

.waiting-banner strong {
  display: block;
  font-weight: 600;
}

.waiting-banner p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

/* Chat Panel */
.chat-panel {
  height: calc(100dvh - 90px);
  max-height: 860px;
  min-height: 520px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
  position: sticky;
  top: 16px;
}

.chat-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.chat-heading h2 {
  font-size: 15px;
  font-weight: 650;
  margin: 0;
}

.chat-heading small {
  font-size: 11px;
  color: var(--muted);
  display: block;
  margin-top: 2px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px 4px 12px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--line-light) transparent;
}

.chat-empty {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  height: 100%;
  color: var(--subtle);
  padding: 20px;
}

.chat-empty svg {
  width: 32px;
  height: 32px;
  margin-bottom: 12px;
  color: var(--subtle);
}

.chat-empty strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.chat-empty p {
  font-size: 12px;
  line-height: 1.5;
  max-width: 220px;
  margin: 6px 0 0;
}

.chat-message {
  margin-bottom: 14px;
  display: flex;
  align-items: start;
  gap: 10px;
}

.chat-message-body {
  flex: 1;
  min-width: 0;
}

.chat-message-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  line-height: 1.3;
  margin-bottom: 3px;
}

.chat-message-name {
  font-size: 12px;
  font-weight: 650;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.chat-message-clock {
  font-size: 10px;
  color: var(--subtle);
  margin-left: auto;
}

.chat-message p {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.timestamp-chip {
  padding: 2px 6px;
  margin: 0 6px 0 0;
  border-radius: var(--radius-xs);
  color: var(--accent-text);
  background: var(--accent);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.chat-system {
  display: flex;
  gap: 6px;
  align-items: start;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
  margin: 6px 0 12px;
}

/* Chat Compose */
.chat-compose {
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.compose-field {
  display: flex;
  align-items: end;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--bg);
  padding: 6px 8px;
  border-radius: var(--radius-md);
}

.compose-field:focus-within {
  border-color: var(--accent);
}

.compose-field textarea {
  resize: none;
  background: transparent;
  border: 0;
  width: 100%;
  padding: 6px 4px;
  color: var(--text);
  font-size: 13px;
  max-height: 100px;
  min-height: 32px;
  outline: none;
}

.send-button {
  background: var(--accent);
  color: var(--accent-text);
  height: 32px;
  min-width: 32px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
}

.send-button:hover {
  background: var(--accent-hover);
}

.send-button svg {
  width: 16px;
  height: 16px;
}

.compose-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--subtle);
}

.timestamp-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--muted);
}

.timestamp-toggle input {
  accent-color: var(--accent);
  height: 14px;
  width: 14px;
  margin: 0;
}

.new-messages {
  align-self: center;
  position: absolute;
  bottom: 100px;
  border: 1px solid var(--line);
  background: var(--surface-elevated);
  color: var(--accent);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.room-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: var(--subtle);
  font-size: 11px;
  margin-top: 24px;
}

.room-footer button {
  font-size: inherit;
  color: inherit;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.room-footer button:hover {
  color: var(--muted);
}

/* Modal */
.modal {
  width: 460px;
  max-width: calc(100vw - 32px);
  max-height: 90dvh;
  overflow: auto;
  background: var(--surface-elevated);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.65);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 4px;
}

.modal h2 {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
}

.modal-description {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  margin: 4px 0 20px;
}

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin: 14px 0 6px;
  color: var(--text);
}

.text-input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  padding: 10px 14px;
  font-size: 14px;
  min-height: 42px;
  border-radius: var(--radius-md);
}

.text-input:focus {
  border-color: var(--accent);
  outline: none;
}

.text-input::placeholder {
  color: var(--subtle);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.field-feedback {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
  min-height: 18px;
}

.field-feedback.error {
  color: var(--danger);
}

.field-feedback.success {
  color: var(--green);
}

.provider-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.provider-pill {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
}

.help-note {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.help-note strong {
  color: var(--text);
  font-weight: 600;
}

.help-note a {
  color: var(--accent);
  text-decoration: underline;
}

.permission-option {
  display: flex;
  gap: 12px;
  align-items: start;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.permission-option input {
  accent-color: var(--accent);
  margin-top: 3px;
}

.permission-option strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
}

.permission-option small {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.modal-bookmarks {
  max-height: 320px;
  overflow: auto;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 10px 20px;
  background: var(--surface-elevated);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  z-index: 20;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  text-align: center;
}

.boot {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.boot .brand-symbol {
  width: 44px;
  height: 44px;
  font-size: 24px;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.fatal {
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  padding: 24px;
}

.fatal h1 {
  font-size: 24px;
  font-weight: 700;
  margin: 12px 0 6px;
}

.fatal p {
  color: var(--muted);
  max-width: 380px;
  margin: 0 0 20px;
  font-size: 14px;
}

/* Fullscreen */
.room-shell:fullscreen {
  background: var(--bg);
  padding: 0 20px;
  max-width: none;
  overflow: auto;
}

.room-shell:fullscreen .chat-panel {
  height: calc(100dvh - 80px);
  max-height: none;
}

/* Responsive */
@media (max-width: 1024px) {
  .topbar { padding: 0 24px; }
  .welcome, .lobby { padding-left: 24px; padding-right: 24px; }
  .welcome-grid { gap: 36px; }
  .watch-layout { grid-template-columns: 1fr; }
  .chat-panel { position: relative; top: 0; height: 420px; min-height: 360px; }
  .room-shell { padding: 0 16px 20px; }
}

@media (max-width: 768px) {
  .welcome-grid { grid-template-columns: 1fr; }
  .feature-strip { grid-template-columns: 1fr; gap: 20px; }
  .room-grid { grid-template-columns: 1fr; }
  .start-room { flex-direction: column; align-items: stretch; }
  .start-room .button { width: 100%; }
}
