:root {
  color-scheme: dark;
  --bg: #0b0d0e;
  --panel: rgba(18, 22, 25, 0.88);
  --panel-soft: rgba(35, 41, 47, 0.72);
  --text: #ece8de;
  --text-soft: #c9d0cf;
  --text-dim: #8e9897;
  --line: rgba(236, 232, 222, 0.12);
  --primary: #c7ff45;
  --shadow: 0 24px 72px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Geist", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(132, 199, 255, 0.12), transparent 28%),
    radial-gradient(circle at 20% 20%, rgba(199, 255, 69, 0.08), transparent 22%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 20%),
    var(--bg);
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 120px 120px;
  mask-image: radial-gradient(circle at center, black, transparent 85%);
}

.shell {
  width: min(1340px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 12px 0 64px;
}

.room-page {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  padding-left: 0;
  padding-right: 0;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 8px 0 16px;
  background: linear-gradient(180deg, rgba(11, 13, 14, 0.96), rgba(11, 13, 14, 0.76));
  backdrop-filter: blur(18px);
}

.room-page .app-header {
  padding: 8px 16px 16px;
}

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

.header-search {
  flex: 1;
  display: flex;
  justify-content: center;
}

.search-input {
  width: min(560px, 100%);
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  padding: 12px 18px;
}

.icon-button {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  display: grid;
  place-items: center;
  padding: 0;
}

.view-mode.active {
  border-color: rgba(255, 255, 255, 0.36);
  background: rgba(255, 255, 255, 0.1);
}

.profile-pill {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #d89e62;
  color: #111;
  font-weight: 700;
}

.profile-pill.large {
  width: 44px;
  height: 44px;
}

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

.brand-header .brand-copy strong {
  font-size: 18px;
  letter-spacing: 0.02em;
}

.brand-mark {
  width: 16px;
  height: 16px;
  border: 1px solid var(--primary);
  transform: rotate(45deg);
  box-shadow: 0 0 24px rgba(199, 255, 69, 0.25);
}

.brand-copy small,
.eyebrow {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
  color: var(--text-dim);
}

.brand-copy strong {
  display: block;
  font-weight: 600;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.button,
button,
input,
textarea,
select {
  font: inherit;
}

.button,
button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  padding: 12px 16px;
  border-radius: 999px;
  cursor: pointer;
}

.button.primary,
button.primary {
  background: var(--primary);
  border-color: transparent;
  color: #0b0d0e;
  font-weight: 600;
}

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

.login {
  min-height: calc(100vh - 48px);
  display: grid;
  place-items: center;
}

.login-card {
  width: min(720px, 100%);
  padding: 48px;
}

.login-card h1,
.hero-title,
.room-title {
  font-family: "Instrument Serif", serif;
  font-weight: 400;
}

.login-card h1 {
  font-size: clamp(54px, 8vw, 88px);
  line-height: 0.94;
  margin: 12px 0 18px;
}

.lede {
  max-width: 34ch;
  color: var(--text-soft);
  line-height: 1.6;
}

.login-note {
  max-width: 42ch;
  margin: 0 0 28px;
}

.view-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 28px;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.85fr);
  gap: 24px;
}

.section {
  padding: 26px 28px 30px;
}

.doors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 22px;
}

.door {
  position: relative;
  min-height: 280px;
  border-radius: 24px;
  border: 1px solid var(--line);
  padding: 18px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 35%),
    var(--panel-soft);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.door::before {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 50%;
  width: 1px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, transparent, var(--accent), transparent);
  box-shadow: 0 0 18px var(--accent);
}

.door-frame {
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  pointer-events: none;
}

.badge {
  width: fit-content;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.04);
}

.door h3 {
  font-family: "Instrument Serif", serif;
  font-weight: 400;
  font-size: 32px;
  line-height: 0.95;
  margin: 0 0 12px;
  max-width: 8ch;
}

.door p,
.muted {
  color: var(--text-soft);
  line-height: 1.55;
}

.door-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-dim);
  font-size: 13px;
}

.card-grid {
  display: grid;
  gap: 16px;
}

.stack {
  display: grid;
  gap: 16px;
}

.field,
textarea,
select {
  width: 100%;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  padding: 14px 16px;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

.label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-dim);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.room-shell {
  position: relative;
  min-height: 760px;
  overflow: hidden;
}

.room-backdrop {
  position: absolute;
  inset: 0;
  background-position: center;
  background-size: cover;
}

.room-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(4, 7, 9, 0.12), rgba(4, 7, 9, 0.38) 56%, rgba(4, 7, 9, 0.76)),
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.1), transparent 22%);
}

.player-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  grid-template-areas:
    "stage chat"
    "details chat";
  gap: 24px;
  align-items: start;
}

.room-stage {
  position: relative;
  z-index: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 12px;
}

.room-shell {
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 0;
}

.room-stage-panel {
  grid-area: stage;
}

.player-controls-bottom {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
}

.player-controls-bottom {
  align-self: stretch;
}

.player-chiprow {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 999px;
  background: rgba(8, 10, 12, 0.34);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
  margin-left: auto;
}

.room-title {
  font-size: clamp(48px, 6vw, 82px);
  line-height: 0.92;
  margin: 12px 0;
  max-width: 9ch;
}

.below-title {
  font-size: clamp(28px, 3vw, 40px);
  margin: 0 0 8px;
  max-width: none;
}

.room-statusline {
  max-width: 42ch;
  margin: 0;
  color: rgba(236, 232, 222, 0.86);
  line-height: 1.6;
}

.room-scene-copy {
  max-width: 44ch;
  margin: 12px 0 0;
  color: rgba(236, 232, 222, 0.64);
  line-height: 1.55;
}

.chip-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.chip {
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(8, 10, 12, 0.34);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
}

.panel-strip {
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(8, 10, 12, 0.36);
  backdrop-filter: blur(10px);
  padding: 16px 18px;
}

.dock-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 12px;
}

.dock-form {
  display: grid;
  gap: 12px;
}

.dock-form textarea {
  min-height: 88px;
  background: rgba(255, 255, 255, 0.04);
}

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

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 12px;
}

.room-below {
  grid-area: details;
  display: grid;
  gap: 16px;
  min-width: 0;
}

.room-below-main {
  display: grid;
  gap: 14px;
  padding: 0 18px 24px;
}

.creator-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.creator-block {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.creator-copy {
  display: grid;
  gap: 2px;
}

.creator-copy span {
  color: var(--text-dim);
  font-size: 13px;
}

.room-actions {
  gap: 8px;
}

.room-description {
  color: var(--text-soft);
  line-height: 1.55;
  max-width: 70ch;
}

.room-description p {
  margin: 0 0 8px;
}

.evolve-drawer {
  max-width: 860px;
}

.room-chatrail {
  grid-area: chat;
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: calc(100vh - 84px);
  padding: 16px;
  overflow: hidden;
}

.chatrail-theater {
  width: 100%;
}

.chat-right .room-chatrail {
  position: fixed;
  top: 72px;
  right: 0;
  width: 360px;
  height: calc(100vh - 88px);
  z-index: 30;
}

.chat-right {
  column-gap: 0;
  row-gap: 24px;
  grid-template-columns: minmax(0, calc(100vw - 360px)) 360px;
}

.chat-right .room-stage-panel,
.chat-right .room-below {
  width: min(100%, calc(100vw - 360px));
}

.chat-below {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "stage"
    "chat"
    "details";
}

.chat-below .room-chatrail {
  width: calc(100% - 20px);
  min-height: 450px;
  max-height: 450px;
  position: static;
  height: 450px;
  margin: 0 10px;
}

.chat-head-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-toggle {
  display: flex;
  gap: 6px;
}

.chat-toggle-button {
  width: 32px;
  height: 32px;
  font-size: 14px;
}

.room-page.room-shell-theater .player-layout {
  grid-template-columns: 1fr;
  grid-template-areas:
    "stage"
    "chat"
    "details";
}

.room-page.room-shell-theater .room-shell {
  border-radius: 0;
  border-left: 0;
  border-right: 0;
}

.room-page.room-shell-theater .room-below-main {
  padding: 0 16px;
}

.room-page.room-shell-theater .room-chatrail {
  position: static;
  min-height: 450px;
  max-height: 450px;
  height: 450px;
}

.player-layout:fullscreen {
  background: #000;
  padding: 12px;
  grid-template-columns: minmax(0, 1fr) 360px;
  height: 100vh;
}

.player-layout.chat-below:fullscreen,
.room-page.room-shell-theater .player-layout:fullscreen {
  grid-template-columns: 1fr;
  grid-template-rows: minmax(0, auto) 450px auto;
}

.player-layout:fullscreen .room-shell {
  aspect-ratio: auto;
  height: calc(100vh - 24px);
}

.player-layout.chat-below:fullscreen .room-shell,
.room-page.room-shell-theater .player-layout:fullscreen .room-shell {
  height: auto;
  max-height: 68vh;
}

.player-layout:fullscreen .room-chatrail {
  min-height: 0;
}

.chat-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-head strong {
  display: block;
  font-size: 15px;
  font-weight: 600;
}

.chat-presence {
  color: var(--text-dim);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.chat-pinned {
  position: absolute;
  top: 58px;
  left: 16px;
  right: 16px;
  z-index: 3;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 18px;
  gap: 10px;
  align-items: center;
  padding: 8px 10px 8px 8px;
  min-height: 52px;
  max-height: 52px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  color: #111;
  overflow: hidden;
}

.chat-pinned-avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #f6cd3d;
  font-size: 10px;
  font-weight: 700;
}

.chat-pinned-copy {
  display: grid;
  gap: 0;
  min-width: 0;
}

.chat-pinned-copy strong,
.chat-pinned-copy span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-pinned-copy span {
  font-size: 12px;
}

.chat-more {
  border: 0;
  background: transparent;
  color: #111;
  padding: 0;
}

.messages {
  display: grid;
  gap: 6px;
  padding: 72px 0 12px;
  overflow: auto;
  align-content: start;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
}

.jump-latest {
  position: absolute;
  right: 18px;
  bottom: 66px;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  padding: 0;
  z-index: 4;
  background: rgba(22, 26, 29, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.32);
}

.jump-latest[hidden] {
  display: none;
}

.message-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 1px 0;
}

.message-avatar {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 10px;
  font-weight: 700;
}

.message-copy {
  min-width: 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text);
}

.message-inline {
  display: block;
  min-width: 0;
}

.message-inline strong {
  display: inline;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  margin-right: 8px;
}

.message-inline span {
  display: inline;
  overflow-wrap: anywhere;
}

.chat-form {
  display: grid;
  gap: 0;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-inputrow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px 28px;
  gap: 4px;
  align-items: center;
  min-height: 34px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.chat-textinput {
  width: 100%;
  height: 24px;
  border: 0;
  outline: none;
  box-shadow: none;
  border-radius: 0;
  padding: 0 4px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
}

.chat-textinput::placeholder {
  color: var(--text-dim);
}

.chat-iconbutton,
.chat-sendbutton {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-soft);
  font-size: 11px;
}

.chat-sendbutton {
  background: rgba(255, 255, 255, 0.1);
}

.chat-iconbutton:hover,
.chat-sendbutton:hover {
  background: rgba(255, 255, 255, 0.12);
}

.message-audience .message-avatar {
  background: rgba(132, 199, 255, 0.18);
}

.message-system .message-avatar {
  background: rgba(199, 255, 69, 0.18);
}

.status {
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  color: var(--text-dim);
}

.error {
  color: #ff9c88;
}

.error-block {
  color: #ff9c88;
  margin-top: 16px;
}

.notice-banner {
  margin: 0 0 18px;
  padding: 14px 18px;
  border-radius: 18px;
  border: 1px solid rgba(199, 255, 69, 0.25);
  background: rgba(199, 255, 69, 0.08);
  color: var(--text);
}

.form-row,
.room-meta-row,
.suggestions-grid {
  display: grid;
  gap: 12px;
}

.form-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.room-stage-copy {
  display: flex;
  flex-direction: column;
  justify-content: end;
  gap: 12px;
  padding: 24px;
}

.room-description {
  max-width: 72ch;
}

.room-meta-row {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.room-meta-pill {
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(11, 13, 14, 0.38);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-soft);
}

.suggestions-grid {
  margin-top: 16px;
}

.suggestion-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  padding: 16px;
}

.suggestion-card p {
  color: var(--text-soft);
  line-height: 1.5;
}

@media (max-width: 980px) {
  .dashboard-layout,
  .view-grid {
    grid-template-columns: 1fr;
  }

  .player-layout,
  .chat-right,
  .chat-below,
  .room-page.room-shell-theater .player-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "stage"
      "chat"
      "details";
  }

  .room-chatrail,
  .chat-right .room-chatrail {
    min-height: 520px;
    position: static;
    height: auto;
    width: 100%;
  }

  .chat-right .room-stage-panel,
  .chat-right .room-below {
    width: 100%;
  }

  .form-row,
  .room-meta-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100vw - 20px, 1340px);
  }

  .login-card,
  .section,
  .room-overlay {
    padding: 18px;
  }
}
