@font-face {
  font-family: "Inter";
  src: url("/assets/inter-regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --black: #000;
  --oled-950: #030303;
  --oled-900: #070707;
  --oled-850: #0b0b0b;
  --oled-800: #101010;
  --oled-750: #151515;
  --oled-700: #1b1b1b;
  --text: #f5f5f5;
  --text-soft: #c8c8c8;
  --muted: #8a8a8a;
  --faint: #787878;
  --line: rgba(255, 255, 255, 0.10);
  --line-soft: rgba(255, 255, 255, 0.065);
  --line-strong: rgba(255, 255, 255, 0.22);
  --fill: rgba(255, 255, 255, 0.045);
  --fill-hover: rgba(255, 255, 255, 0.085);
  --fill-strong: rgba(255, 255, 255, 0.14);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.62);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --header-h: 76px;
  --page-max: 1560px;
  --ease: cubic-bezier(.2, .72, .25, 1);
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 300px;
  min-height: 100%;
  background: var(--black);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(55rem 28rem at 50% -18rem, rgba(255,255,255,.055), transparent 70%),
    var(--black);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.modal-open {
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

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

button,
a {
  touch-action: manipulation;
}

button {
  border: 0;
}

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

code {
  padding: .08rem .32rem;
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  background: var(--fill);
  color: var(--text-soft);
  font: .88em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

[hidden] {
  display: none !important;
}

::selection {
  background: #fff;
  color: #000;
}

:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--black);
}

::-webkit-scrollbar-thumb {
  border: 3px solid var(--black);
  border-radius: 99px;
  background: #353535;
}

.app-shell {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  flex-direction: column;
}

.site-header {
  position: relative;
  z-index: 30;
  display: flex;
  width: min(100%, var(--page-max));
  min-height: var(--header-h);
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) clamp(18px, 3vw, 48px) 12px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line-soft);
}

.brand {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: #fff;
  color: #000;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: -.05em;
}

.brand-copy {
  display: grid;
  gap: 1px;
}

.brand-copy strong {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -.015em;
}

.brand-copy small {
  color: var(--muted);
  font-size: 11px;
}

.header-actions,
.room-actions,
.control-group,
.state-actions,
.modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.connection-pill,
.viewer-count,
.sync-badge,
.step-badge,
.storage-note {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--oled-900);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.connection-pill,
.viewer-count {
  padding: 5px 11px;
}

.status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #5b5b5b;
}

.connection-pill[data-state="connected"] .status-dot,
.viewer-count .status-dot {
  background: #ececec;
  box-shadow: 0 0 0 3px rgba(255,255,255,.08), 0 0 12px rgba(255,255,255,.32);
}

.connection-pill[data-state="connecting"] .status-dot {
  animation: pulse 1.2s ease-in-out infinite;
  background: #aaa;
}

.connection-pill[data-state="offline"] {
  border-style: dashed;
  color: #d0d0d0;
}

.view {
  width: min(100%, var(--page-max));
  margin: 0 auto;
  padding: clamp(34px, 5vw, 76px) clamp(18px, 3vw, 48px) 64px;
  animation: view-in .35s var(--ease) both;
}

.home-view {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(340px, .75fr);
  gap: clamp(30px, 6vw, 96px);
  align-items: center;
}

.hero {
  max-width: 800px;
  padding: clamp(26px, 6vw, 84px) 0;
}

.eyebrow,
.kicker {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.hero h1,
.gate-card h1,
.state-card h1,
.admin-heading h1 {
  margin: 0;
  font-size: clamp(3rem, 7.5vw, 7.6rem);
  font-weight: 800;
  letter-spacing: -.075em;
  line-height: .91;
}

.hero h1 span,
.admin-heading h1 {
  background: linear-gradient(180deg, #fff 12%, #727272 92%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-copy {
  max-width: 660px;
  margin: 28px 0 0;
  color: var(--muted);
  font-size: clamp(16px, 1.7vw, 21px);
  line-height: 1.65;
}

.surface {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(255,255,255,.033), rgba(255,255,255,.012));
  box-shadow: inset 0 1px rgba(255,255,255,.025);
}

.create-card,
.auth-card {
  padding: clamp(24px, 4vw, 40px);
}

.section-heading,
.panel-head,
.room-heading,
.admin-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.section-heading {
  margin-bottom: 28px;
}

.section-heading.compact {
  margin-bottom: 18px;
}

.section-heading h2,
.panel-head h2,
.auth-card h2,
.modal h2 {
  margin: 0;
  font-size: clamp(22px, 2.2vw, 30px);
  letter-spacing: -.045em;
}

.step-badge {
  min-width: 42px;
  justify-content: center;
  padding: 5px 10px;
}

.stack-form {
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 8px;
}

.field > span {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 600;
}

.field small {
  color: var(--faint);
  font-size: 11px;
}

input,
textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  outline: 0;
  background: var(--oled-900);
  color: var(--text);
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

input {
  padding: 0 14px;
}

textarea {
  padding: 12px 14px;
  resize: none;
}

input:hover,
textarea:hover {
  border-color: var(--line-strong);
}

input:focus,
textarea:focus {
  border-color: rgba(255,255,255,.38);
  background: var(--oled-850);
  box-shadow: 0 0 0 4px rgba(255,255,255,.045);
}

input:disabled {
  color: var(--muted);
  cursor: not-allowed;
}

input::placeholder,
textarea::placeholder {
  color: #767676;
}

.button,
.icon-button,
.player-button,
.rail-tab,
.copy-inline {
  cursor: pointer;
  user-select: none;
  transition: transform .16s var(--ease), border-color .16s ease, background .16s ease, color .16s ease, opacity .16s ease;
}

.button {
  display: inline-flex;
  min-height: 46px;
  padding: 0 18px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
}

.button svg {
  width: 17px;
  height: 17px;
}

.button:hover,
.icon-button:hover,
.player-button:hover {
  transform: translateY(-1px);
}

.button:active,
.icon-button:active,
.player-button:active {
  transform: translateY(0) scale(.98);
}

.button.primary {
  border-color: #fff;
  background: #fff;
  color: #000;
}

.button.primary:hover {
  background: #dedede;
}

.button.secondary {
  background: var(--fill);
  color: var(--text-soft);
}

.button.secondary:hover {
  border-color: var(--line-strong);
  background: var(--fill-hover);
  color: var(--text);
}

.button.wide {
  width: 100%;
}

.button.mini,
.compact-button {
  min-height: 44px;
  padding: 0 12px;
  font-size: 11px;
}

.button:disabled,
.icon-button:disabled,
.player-button:disabled {
  cursor: not-allowed;
  opacity: .38;
  transform: none;
}

.icon-button,
.player-button {
  display: inline-grid;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--fill);
  color: var(--text-soft);
}

.icon-button:hover,
.player-button:hover {
  border-color: var(--line-strong);
  background: var(--fill-hover);
  color: var(--text);
}

.icon-button.small {
  width: 44px;
  height: 44px;
}

.icon-button.light,
.primary-control {
  border-color: #fff;
  background: #fff;
  color: #000;
}

.form-error {
  min-height: 20px;
  margin: -6px 0 0;
  color: #d7d7d7;
  font-size: 12px;
}

.principles {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line-soft);
}

.principles article {
  min-height: 160px;
  padding: 28px 28px 8px 0;
}

.principles article + article {
  padding-left: 28px;
  border-left: 1px solid var(--line-soft);
}

.principle-index {
  display: block;
  margin-bottom: 26px;
  color: var(--faint);
  font-size: 11px;
}

.principles h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.principles p {
  max-width: 350px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.join-view,
.state-view {
  display: grid;
  flex: 1;
  place-items: center;
}

.gate-card,
.state-card {
  width: min(100%, 560px);
  padding: clamp(28px, 5vw, 52px);
}

.gate-card h1,
.state-card h1 {
  font-size: clamp(2.6rem, 6vw, 5rem);
}

.gate-copy,
.state-card > p:not(.kicker),
.auth-card > p {
  margin: 22px 0 30px;
  color: var(--muted);
}

.gate-icon,
.state-symbol {
  display: grid;
  width: 52px;
  height: 52px;
  margin-bottom: 32px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--fill);
  color: var(--text-soft);
}

.state-symbol {
  font-size: 24px;
  font-weight: 300;
}

.state-actions {
  flex-wrap: wrap;
}

.room-view {
  padding-top: 28px;
}

.room-heading {
  margin-bottom: 22px;
}

.room-heading-copy {
  min-width: 0;
}

.room-heading h1 {
  max-width: 900px;
  margin: 0;
  overflow: hidden;
  font-size: clamp(26px, 3vw, 42px);
  letter-spacing: -.05em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-heading .kicker {
  display: flex;
  align-items: center;
  gap: 8px;
}

.copy-inline {
  min-height: 44px;
  padding: 0 8px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: transparent;
  color: var(--faint);
  font-size: 9px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.copy-inline:hover {
  border-color: var(--line-strong);
  color: var(--text-soft);
}

.room-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 390px);
  gap: 18px;
  align-items: start;
}

.watch-column {
  display: grid;
  min-width: 0;
  gap: 18px;
}

.player-shell {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-lg);
  background: #000;
  isolation: isolate;
}

.player-shell:fullscreen {
  width: 100vw;
  height: 100vh;
  border: 0;
  border-radius: 0;
}

.player-shell video {
  display: block;
  width: 100%;
  height: 100%;
  background: #000;
  object-fit: contain;
}

.player-empty,
.player-state,
.autoplay-gate {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  padding: clamp(20px, 5vw, 60px);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
}

.player-empty,
.player-state {
  background:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px),
    #030303;
  background-size: 44px 44px;
}

.player-empty h2 {
  margin: 0 0 8px;
  font-size: clamp(20px, 3vw, 34px);
  letter-spacing: -.04em;
}

.player-empty > p:last-child,
.player-state span:last-child {
  max-width: 460px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.empty-reel,
.drop-icon,
.autoplay-icon {
  display: grid;
  width: 58px;
  height: 58px;
  margin-bottom: 24px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--fill);
}

.empty-reel svg,
.drop-icon svg,
.autoplay-icon svg {
  width: 26px;
  height: 26px;
}

.player-state {
  gap: 9px;
  background: rgba(0,0,0,.91);
}

.player-state strong {
  font-size: 16px;
}

.autoplay-gate {
  border: 0;
  background: rgba(0,0,0,.86);
  color: var(--text);
  cursor: pointer;
  backdrop-filter: blur(12px);
}

.autoplay-gate strong {
  margin-bottom: 4px;
  font-size: 18px;
}

.autoplay-gate small {
  color: var(--muted);
}

.player-topbar {
  position: absolute;
  inset: 0 0 auto;
  z-index: 3;
  display: flex;
  padding: 18px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  background: linear-gradient(180deg, rgba(0,0,0,.86), transparent);
  pointer-events: none;
  transition: opacity .2s ease;
}

.player-topbar > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.player-topbar strong,
.player-topbar small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-topbar strong {
  font-size: 13px;
}

.player-topbar small {
  color: rgba(255,255,255,.58);
  font-size: 10px;
}

.sync-badge {
  min-height: 26px;
  padding: 4px 9px;
  border-color: rgba(255,255,255,.16);
  background: rgba(0,0,0,.45);
  color: rgba(255,255,255,.68);
}

.player-controls {
  position: absolute;
  inset: auto 0 0;
  z-index: 5;
  padding: 34px 18px 16px;
  background: linear-gradient(0deg, rgba(0,0,0,.94), transparent);
  transition: opacity .2s ease, transform .2s ease;
}

.player-shell.controls-hidden .player-controls,
.player-shell.controls-hidden .player-topbar {
  opacity: 0;
  pointer-events: none;
}

.player-shell.controls-hidden .player-controls {
  transform: translateY(8px);
}

.timeline-field {
  position: relative;
  display: flex;
  height: 44px;
  margin-bottom: 5px;
  align-items: center;
  cursor: pointer;
}

.timeline-field input,
.volume-control input {
  position: relative;
  z-index: 2;
  height: 4px;
  min-height: 4px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 99px;
  appearance: none;
  background: rgba(255,255,255,.25);
  cursor: pointer;
}

.timeline-field input::-webkit-slider-thumb,
.volume-control input::-webkit-slider-thumb {
  width: 14px;
  height: 14px;
  border: 2px solid #000;
  border-radius: 50%;
  appearance: none;
  background: #fff;
}

.timeline-field input::-moz-range-thumb,
.volume-control input::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 2px solid #000;
  border-radius: 50%;
  background: #fff;
}

.buffer-track {
  position: absolute;
  z-index: 1;
  left: 0;
  width: 0;
  height: 4px;
  border-radius: 99px;
  background: rgba(255,255,255,.38);
  pointer-events: none;
}

.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.control-group.end {
  justify-content: flex-end;
}

.player-button {
  width: 44px;
  height: 44px;
  border-color: transparent;
  background: transparent;
}

.player-button:hover {
  border-color: rgba(255,255,255,.15);
  background: rgba(255,255,255,.09);
}

.primary-control {
  border-color: #fff;
  background: #fff;
}

.primary-control:hover {
  border-color: #fff;
  background: #ddd;
  color: #000;
}

.primary-control .pause-icon,
.primary-control.playing .play-icon {
  display: none;
}

.primary-control.playing .pause-icon {
  display: block;
}

.time-readout {
  display: flex;
  gap: 5px;
  color: rgba(255,255,255,.58);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.volume-control {
  display: flex;
  min-height: 44px;
  width: 118px;
  align-items: center;
  gap: 8px;
}

.volume-control svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.upload-card {
  padding: clamp(18px, 3vw, 28px);
}

.rights-check {
  display: flex;
  min-height: 44px;
  margin: -4px 0 12px;
  padding: 8px 10px;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
}

.rights-check:hover {
  border-color: var(--line-strong);
  color: var(--text-soft);
}

.rights-check input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
  padding: 0;
  flex: 0 0 auto;
  border-radius: 5px;
  accent-color: #fff;
}

.storage-note {
  padding: 5px 10px;
  font-weight: 400;
}

.dropzone {
  display: flex;
  min-height: 118px;
  padding: 20px;
  align-items: center;
  gap: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,.018);
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, transform .18s var(--ease);
}

.dropzone:hover,
.dropzone.dragging {
  border-color: rgba(255,255,255,.48);
  background: var(--fill);
}

.dropzone.dragging {
  transform: scale(.995);
}

.dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.drop-icon {
  width: 50px;
  height: 50px;
  margin: 0;
  flex: 0 0 auto;
  border-radius: 15px;
}

.drop-copy {
  display: grid;
  min-width: 0;
  flex: 1;
  gap: 4px;
}

.drop-copy strong {
  font-size: 13px;
}

.drop-copy small {
  color: var(--muted);
  font-size: 11px;
}

.upload-queue {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.upload-item {
  position: relative;
  display: grid;
  overflow: hidden;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px 16px;
  padding: 13px 14px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  background: var(--oled-900);
}

.upload-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.upload-copy strong,
.media-copy strong {
  overflow: hidden;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-copy small,
.media-copy small,
.person-copy small,
.admin-room-copy small {
  color: var(--muted);
  font-size: 10px;
}

.upload-cancel {
  min-width: 44px;
  min-height: 44px;
  margin: -7px -7px -7px 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.upload-cancel:hover {
  background: var(--fill-hover);
  color: var(--text);
}

.upload-progress {
  grid-column: 1 / -1;
  overflow: hidden;
  height: 3px;
  border-radius: 99px;
  background: var(--oled-700);
}

.upload-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #eee;
  transition: width .18s ease;
}

.upload-item[data-status="error"] {
  border-style: dashed;
}

.room-rail {
  position: sticky;
  top: 16px;
  display: grid;
  overflow: hidden;
  height: min(760px, calc(100vh - 120px));
  height: min(760px, calc(100dvh - 120px));
  grid-template-rows: auto minmax(0, 1fr);
  border-radius: var(--radius-lg);
}

.rail-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--line);
  background: var(--oled-950);
}

.rail-tab {
  position: relative;
  min-height: 52px;
  padding: 0 10px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.rail-tab::after {
  content: "";
  position: absolute;
  right: 12px;
  bottom: -1px;
  left: 12px;
  height: 1px;
  background: transparent;
}

.rail-tab:hover {
  color: var(--text-soft);
}

.rail-tab.active {
  color: var(--text);
}

.rail-tab.active::after {
  background: #fff;
}

.rail-tab span {
  margin-left: 4px;
  color: var(--faint);
  font-size: 9px;
}

.rail-panel {
  display: grid;
  overflow: hidden;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: 20px;
}

.panel-head {
  margin-bottom: 16px;
}

.panel-head h2 {
  font-size: 22px;
}

.media-list,
.people-list {
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.media-list {
  display: grid;
  gap: 7px;
  align-content: start;
}

.media-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  min-height: 58px;
  padding: 7px 8px;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
  width: 100%;
  color: inherit;
}

.media-item:disabled {
  cursor: wait;
  opacity: .62;
}

.media-item:hover {
  border-color: var(--line-soft);
  background: var(--fill);
}

.media-item.active {
  border-color: var(--line-strong);
  background: var(--fill-hover);
}

.media-index {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  color: var(--faint);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.media-item.active .media-index {
  border-color: #fff;
  background: #fff;
  color: #000;
}

.media-copy,
.person-copy,
.admin-room-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.media-status {
  min-width: 54px;
  color: var(--faint);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .06em;
  text-align: right;
  text-transform: uppercase;
}

.panel-empty {
  display: flex;
  min-height: 180px;
  padding: 24px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  color: var(--muted);
  text-align: center;
}

.panel-empty span {
  display: grid;
  width: 46px;
  height: 46px;
  margin-bottom: 14px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--faint);
  font-size: 11px;
}

.panel-empty p {
  max-width: 230px;
  margin: 0;
  font-size: 12px;
}

.chat-list {
  min-height: 0;
  padding-right: 4px;
  overflow: auto;
}

.chat-message {
  display: grid;
  gap: 3px;
  margin-bottom: 16px;
}

.chat-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.chat-meta strong {
  overflow: hidden;
  color: var(--text-soft);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-meta time {
  flex: 0 0 auto;
  color: var(--faint);
  font-size: 9px;
}

.chat-message p {
  margin: 0;
  color: #a9a9a9;
  font-size: 12px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.chat-message.self p {
  color: var(--text-soft);
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px;
  gap: 8px;
  margin: 16px -4px -4px;
}

.chat-form textarea {
  max-height: 110px;
}

.people-list {
  display: grid;
  gap: 6px;
  align-content: start;
}

.person-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  min-height: 54px;
  padding: 7px 4px;
  align-items: center;
  gap: 10px;
}

.person-avatar {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--fill);
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 700;
}

.person-copy strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.presence-label {
  color: var(--faint);
  font-size: 9px;
  text-transform: uppercase;
}

.privacy-callout {
  display: flex;
  margin-top: 16px;
  padding: 14px;
  gap: 11px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  background: var(--oled-900);
}

.privacy-callout svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: var(--muted);
}

.privacy-callout p {
  display: grid;
  margin: 0;
  gap: 3px;
}

.privacy-callout strong {
  font-size: 11px;
}

.privacy-callout span {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.admin-view {
  width: min(100%, 1200px);
}

.admin-heading {
  margin-bottom: 36px;
}

.admin-heading h1 {
  font-size: clamp(3rem, 6vw, 6.5rem);
}

.admin-loading {
  display: flex;
  min-height: 220px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
  color: var(--muted);
}

.auth-card {
  width: min(100%, 560px);
  margin: 0 auto;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}

.metric {
  display: grid;
  min-height: 170px;
  padding: 24px;
  align-content: space-between;
}

.metric > span,
.metric small {
  color: var(--muted);
  font-size: 11px;
}

.metric strong {
  margin: 18px 0;
  font-size: clamp(30px, 4vw, 52px);
  letter-spacing: -.055em;
}

.admin-room-card {
  padding: clamp(18px, 3vw, 28px);
}

.admin-room-list {
  display: grid;
  gap: 8px;
}

.admin-room-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(90px, .55fr)) auto;
  min-height: 66px;
  padding: 10px 10px 10px 14px;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  background: var(--oled-900);
}

.admin-room-stat {
  display: grid;
  gap: 2px;
}

.admin-room-stat small {
  color: var(--faint);
  font-size: 9px;
  text-transform: uppercase;
}

.admin-room-stat strong {
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 600;
}

.danger-button {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.danger-button:hover {
  border-color: var(--line-strong);
  background: var(--fill-hover);
  color: #fff;
}

.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 2px solid rgba(255,255,255,.16);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.site-footer {
  display: flex;
  width: min(100%, var(--page-max));
  margin: auto auto 0;
  padding: 24px clamp(18px, 3vw, 48px) max(24px, env(safe-area-inset-bottom));
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-top: 1px solid var(--line-soft);
  color: var(--faint);
  font-size: 10px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  padding: 18px;
  place-items: center;
  background: rgba(0,0,0,.82);
  backdrop-filter: blur(12px);
  animation: fade-in .18s ease both;
}

.modal {
  position: relative;
  width: min(100%, 480px);
  padding: 32px;
  box-shadow: var(--shadow);
  animation: modal-in .24s var(--ease) both;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
}

.modal > p:not(.kicker) {
  margin: 14px 0 28px;
  color: var(--muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.modal-actions {
  justify-content: flex-end;
}

.toast-region {
  position: fixed;
  z-index: 120;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  display: grid;
  width: min(390px, calc(100vw - 32px));
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  padding: 13px 14px;
  align-items: center;
  gap: 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: rgba(12,12,12,.96);
  box-shadow: var(--shadow);
  color: var(--text-soft);
  font-size: 12px;
  pointer-events: auto;
  animation: toast-in .24s var(--ease) both;
}

.toast::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #aaa;
}

.toast[data-kind="success"]::before {
  background: #fff;
  box-shadow: 0 0 10px rgba(255,255,255,.35);
}

.toast.leaving {
  animation: toast-out .18s ease both;
}

.sr-only {
  position: absolute !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  border: 0 !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
}

.noscript {
  position: fixed;
  inset: 20px;
  z-index: 200;
  display: grid;
  margin: 0;
  place-items: center;
  background: #000;
  color: #fff;
  text-align: center;
}

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

@keyframes pulse {
  50% { opacity: .35; transform: scale(.82); }
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(8px); }
}

@keyframes fade-in {
  from { opacity: 0; }
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(12px) scale(.985); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateX(8px); }
}

@media (max-width: 1060px) {
  .home-view {
    grid-template-columns: 1fr;
  }

  .hero {
    padding-bottom: 0;
  }

  .create-card {
    width: min(100%, 680px);
  }

  .room-grid {
    grid-template-columns: minmax(0, 1fr) 330px;
  }

  .admin-room-row {
    grid-template-columns: minmax(0, 1.5fr) repeat(2, minmax(80px, .5fr)) auto;
  }

  .admin-room-stat.created {
    display: none;
  }
}

@media (max-width: 840px) {
  :root {
    --header-h: 68px;
  }

  .site-header {
    position: sticky;
    top: 0;
    background: rgba(0,0,0,.88);
    backdrop-filter: blur(16px);
  }

  .view {
    padding-top: 28px;
  }

  .brand-copy small,
  .connection-pill {
    display: none;
  }

  .hero {
    padding-top: 22px;
  }

  .principles {
    grid-template-columns: 1fr;
  }

  .principles article {
    min-height: 0;
    padding: 24px 0;
  }

  .principles article + article {
    padding-left: 0;
    border-top: 1px solid var(--line-soft);
    border-left: 0;
  }

  .principle-index {
    margin-bottom: 14px;
  }

  .room-heading {
    align-items: flex-start;
  }

  .viewer-count {
    display: none;
  }

  .room-grid {
    grid-template-columns: 1fr;
  }

  .room-rail {
    position: static;
    height: min(620px, 72vh);
    height: min(620px, 72dvh);
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .metric {
    min-height: 126px;
  }

  .admin-room-row {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .admin-room-stat.storage,
  .admin-room-stat.created {
    display: none;
  }
}

@media (max-width: 600px) {
  .site-header {
    padding-right: 14px;
    padding-left: 14px;
  }

  .view {
    padding-right: 12px;
    padding-left: 12px;
  }

  .home-view {
    gap: 28px;
  }

  .hero h1 {
    font-size: clamp(3rem, 15vw, 5rem);
  }

  .hero-copy {
    margin-top: 20px;
  }

  .create-card,
  .gate-card,
  .state-card,
  .auth-card {
    padding: 22px;
    border-radius: var(--radius-lg);
  }

  .room-view {
    padding-top: 18px;
  }

  .room-heading {
    display: grid;
    gap: 14px;
  }

  .room-actions {
    width: 100%;
  }

  .room-actions .button {
    flex: 1;
  }

  .room-heading h1 {
    font-size: 28px;
  }

  .player-shell {
    width: calc(100% + 24px);
    margin-left: -12px;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .player-topbar {
    padding: 12px;
  }

  .sync-badge,
  .seek-extra {
    display: none;
  }

  .player-controls {
    padding: 26px 10px 9px;
  }

  .player-button {
    width: 42px;
    height: 42px;
  }

  .control-group {
    gap: 2px;
  }

  .time-readout {
    gap: 3px;
  }

  .volume-control {
    width: 44px;
  }

  .volume-control input {
    display: none;
  }

  .upload-card {
    padding: 16px;
  }

  .storage-note,
  .compact-button {
    display: none;
  }

  .dropzone {
    min-height: 124px;
    justify-content: center;
    text-align: center;
  }

  .drop-copy {
    flex: 0 1 auto;
  }

  .drop-icon {
    display: none;
  }

  .room-rail {
    height: 66vh;
    height: 66dvh;
    border-radius: var(--radius-lg);
  }

  .rail-panel {
    padding: 16px;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .modal {
    padding: 26px 20px 20px;
  }

  .modal-actions,
  .state-actions {
    display: grid;
    width: 100%;
    grid-template-columns: 1fr;
  }

  .modal-actions .button,
  .state-actions .button {
    width: 100%;
  }

  .admin-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-room-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .admin-room-stat.viewers,
  .admin-room-stat.storage,
  .admin-room-stat.created {
    display: none;
  }
}

@media (max-width: 390px) {
  .brand-copy {
    display: none;
  }

  .header-actions {
    margin-left: auto;
  }

  .room-actions {
    gap: 7px;
  }

  .time-readout span:nth-child(2),
  #durationLabel {
    display: none;
  }

  .control-row {
    gap: 0;
  }
}

@media (max-width: 900px) and (orientation: landscape) and (max-height: 560px) {
  .site-header,
  .room-heading,
  .upload-card,
  .site-footer {
    display: none;
  }

  .room-view {
    width: 100%;
    max-width: none;
    padding: 0;
  }

  .room-grid {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 34vw);
    gap: 0;
  }

  .player-shell {
    height: 100vh;
    height: 100dvh;
    aspect-ratio: auto;
    border: 0;
    border-radius: 0;
  }

  .room-rail {
    height: 100vh;
    height: 100dvh;
    border-top: 0;
    border-right: 0;
    border-bottom: 0;
    border-radius: 0;
  }
}

@media (hover: none) {
  .player-shell.controls-hidden .player-controls,
  .player-shell.controls-hidden .player-topbar {
    opacity: 1;
    pointer-events: auto;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
