:root {
  color-scheme: light;
  --ink: #2b2240;
  --ink-soft: #635772;
  --paper: rgba(255, 255, 255, 0.68);
  --paper-strong: rgba(255, 255, 255, 0.84);
  --stroke: rgba(255, 255, 255, 0.7);
  --stroke-tint: rgba(134, 100, 210, 0.2);
  --pink: #ff7ac8;
  --violet: #8b6cff;
  --aqua: #22d3ee;
  --mint: #6ee7b7;
  --peach: #ffb48f;
  --warning: #9a5b00;
  --danger: #b42345;
  --shadow: 0 24px 70px rgba(98, 64, 155, 0.22);
  --soft-shadow: 0 14px 36px rgba(98, 64, 155, 0.16);
  --card-radius: 8px;
  --control-radius: 16px;
  --max-width: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
  background:
    linear-gradient(120deg, rgba(255, 154, 200, 0.36), rgba(113, 223, 255, 0.36) 36%, rgba(182, 151, 255, 0.34) 68%, rgba(255, 223, 159, 0.42)),
    conic-gradient(from 210deg at 50% 42%, #fff1fb, #c7f7ff, #e4d2ff, #fff2ba, #ffd7ec, #fff1fb);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.4), transparent 42%, rgba(255, 255, 255, 0.28)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.12) 0 1px, transparent 1px 78px);
  opacity: 0.9;
}

body::after {
  content: "";
  position: fixed;
  inset: -12%;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(100deg, transparent 0 18%, rgba(255, 122, 200, 0.18) 28%, transparent 42% 100%),
    linear-gradient(28deg, transparent 0 34%, rgba(34, 211, 238, 0.2) 50%, transparent 66% 100%),
    linear-gradient(152deg, transparent 0 48%, rgba(139, 108, 255, 0.18) 60%, transparent 78% 100%);
  filter: blur(24px);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.app-shell {
  width: min(var(--max-width), calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 36px;
}

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, var(--pink), var(--violet) 52%, var(--aqua));
  box-shadow: var(--soft-shadow);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-pill {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  border: 1px solid var(--stroke);
  border-radius: 999px;
  padding: 7px 12px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(18px);
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(98, 64, 155, 0.12);
}

.status-online {
  color: #155e54;
  background: rgba(209, 250, 229, 0.72);
}

.status-offline {
  color: #8f1d3a;
  background: rgba(255, 228, 238, 0.76);
}

.home-view {
  min-height: calc(100vh - 120px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px;
  gap: 56px;
  align-items: center;
}

.hero-copy {
  max-width: 620px;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 10px;
  color: #7f4db5;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.hero-copy h1 {
  margin: 0;
  font-size: 82px;
  line-height: 0.98;
  letter-spacing: 0;
}

.hero-subtitle {
  max-width: 520px;
  margin: 24px 0 0;
  color: var(--ink-soft);
  font-size: 22px;
  line-height: 1.7;
}

.glass-panel {
  border: 1px solid var(--stroke);
  border-radius: var(--card-radius);
  background: var(--paper);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.entry-panel {
  padding: 28px;
}

.panel-heading h2,
.room-toolbar h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.25;
}

.compact-heading h2 {
  font-size: 20px;
}

.entry-form,
.video-form {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

.field-label {
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 700;
}

.text-input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--stroke-tint);
  border-radius: var(--control-radius);
  outline: none;
  padding: 0 15px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.74);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.text-input::placeholder {
  color: rgba(99, 87, 114, 0.58);
}

.text-input:focus {
  border-color: rgba(139, 108, 255, 0.58);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 0 4px rgba(139, 108, 255, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.84);
}

.entry-actions,
.video-input-row,
.sync-strip,
.room-toolbar-actions,
.chat-form {
  display: flex;
  gap: 12px;
  align-items: center;
}

.entry-actions {
  margin-top: 12px;
}

.button {
  min-height: 46px;
  border: 0;
  border-radius: 999px;
  padding: 0 18px;
  color: var(--ink);
  font-weight: 800;
  transition: transform 140ms ease, box-shadow 140ms ease, filter 140ms ease;
  white-space: nowrap;
}

.button:hover {
  transform: translateY(-1px);
  filter: saturate(1.08);
}

.button:active {
  transform: translateY(0);
}

.button-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--pink), var(--violet) 54%, var(--aqua));
  box-shadow: 0 14px 26px rgba(139, 108, 255, 0.28);
}

.button-secondary {
  border: 1px solid rgba(139, 108, 255, 0.22);
  color: #4c3275;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(211, 248, 255, 0.74));
  box-shadow: 0 10px 22px rgba(98, 64, 155, 0.12);
}

.button-ghost {
  border: 1px solid rgba(255, 255, 255, 0.56);
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.34);
}

.button:disabled {
  cursor: wait;
  opacity: 0.66;
  transform: none;
}

.soft-hint {
  margin: 18px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.7;
}

.soft-hint.warning {
  color: var(--warning);
}

.soft-hint.error {
  color: var(--danger);
}

.room-view {
  display: grid;
  gap: 18px;
}

.room-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
}

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

.video-panel {
  padding: 16px;
}

.video-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.46);
  border-radius: var(--card-radius);
  background:
    linear-gradient(135deg, rgba(32, 24, 52, 0.96), rgba(52, 35, 86, 0.95)),
    #171124;
}

.video-frame video {
  display: block;
  width: 100%;
  height: 100%;
  background: #151124;
}

.autoplay-prompt {
  position: absolute;
  inset: auto 16px 16px;
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  padding: 0 16px;
  color: #fff;
  background: rgba(43, 34, 64, 0.74);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(16px);
}

.video-input-row {
  margin-top: 2px;
}

.sync-strip {
  justify-content: space-between;
  margin-top: 14px;
}

.sync-strip .soft-hint {
  margin: 0;
  flex: 1;
}

.side-column {
  display: grid;
  gap: 18px;
}

.members-panel,
.chat-panel {
  padding: 18px;
}

.members-list {
  display: grid;
  gap: 10px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.member-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  border: 1px solid rgba(139, 108, 255, 0.16);
  border-radius: 14px;
  padding: 8px 10px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.52);
}

.member-avatar {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--aqua), var(--violet));
}

.member-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.chat-panel {
  min-height: 520px;
  display: grid;
  grid-template-rows: auto minmax(260px, 1fr) auto;
}

.chat-messages {
  min-height: 260px;
  max-height: 440px;
  overflow-y: auto;
  padding: 10px 2px 14px 0;
  scrollbar-color: rgba(139, 108, 255, 0.42) transparent;
}

.chat-message {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid rgba(139, 108, 255, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.56);
  box-shadow: 0 10px 20px rgba(98, 64, 155, 0.08);
}

.chat-message.system {
  color: var(--ink-soft);
  background: rgba(211, 248, 255, 0.38);
}

.message-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
  color: #7f4db5;
  font-size: 12px;
  font-weight: 800;
}

.message-time {
  color: rgba(99, 87, 114, 0.76);
  font-weight: 700;
}

.message-text {
  overflow-wrap: anywhere;
  color: var(--ink);
  line-height: 1.55;
}

.chat-message.system .message-text {
  color: var(--ink-soft);
}

.chat-form {
  align-items: stretch;
}

.chat-form .text-input {
  min-width: 0;
}

.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 36px));
}

.toast {
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--card-radius);
  padding: 12px 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(18px);
  line-height: 1.5;
}

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

.toast.warning {
  color: var(--warning);
}

@media (max-width: 980px) {
  .home-view {
    grid-template-columns: 1fr;
    gap: 28px;
    align-items: start;
    padding-top: 24px;
  }

  .hero-copy h1 {
    font-size: 58px;
  }

  .hero-subtitle {
    font-size: 19px;
  }

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

  .side-column {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 22px, var(--max-width));
    padding-top: max(14px, env(safe-area-inset-top));
    padding-bottom: max(22px, env(safe-area-inset-bottom));
  }

  .topbar {
    align-items: flex-start;
    margin-bottom: 18px;
  }

  .brand {
    align-items: flex-start;
  }

  .brand span:last-child {
    max-width: 170px;
    line-height: 1.25;
  }

  .home-view {
    min-height: auto;
  }

  .hero-copy h1 {
    font-size: 44px;
    line-height: 1.04;
  }

  .hero-subtitle {
    margin-top: 16px;
    font-size: 17px;
  }

  .entry-panel,
  .video-panel,
  .members-panel,
  .chat-panel,
  .room-toolbar {
    padding: 14px;
  }

  .entry-actions,
  .video-input-row,
  .sync-strip,
  .room-toolbar,
  .room-toolbar-actions,
  .chat-form {
    align-items: stretch;
    flex-direction: column;
  }

  .button,
  .text-input {
    width: 100%;
  }

  .room-toolbar {
    gap: 14px;
  }

  .side-column {
    grid-template-columns: 1fr;
  }

  .chat-panel {
    min-height: 460px;
  }

  .chat-messages {
    max-height: 360px;
  }

  .autoplay-prompt {
    right: 10px;
    bottom: 10px;
    left: 10px;
    min-height: 42px;
    white-space: normal;
  }
}
