:root {
  color-scheme: dark;
  --bg: #06070a;
  --panel: rgba(15, 18, 28, 0.96);
  --panel-soft: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.1);
  --text: #eef3ff;
  --muted: rgba(238, 243, 255, 0.72);
  --accent: #52c2ff;
  --accent-strong: #2f92ff;
  --danger: #ff6b6b;
  --shadow: 0 24px 48px rgba(0, 0, 0, 0.36);
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top, rgba(45, 125, 255, 0.28), transparent 42%),
    linear-gradient(180deg, #090b12 0%, #05060a 100%);
  color: var(--text);
}

body {
  overflow: hidden;
}

body.modal-open {
  overflow: hidden;
}

button,
input {
  font: inherit;
}

.hidden {
  display: none !important;
}

.app-shell {
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 16px 16px 12px;
}

.topbar-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
}

.topbar-link {
  border: 0;
  background: transparent;
  color: rgba(238, 243, 255, 0.72);
  cursor: pointer;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: rgba(82, 194, 255, 0.92);
}

.topbar h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
}

.meta-line {
  margin: 8px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  color: var(--muted);
  font-size: 13px;
}

.status-chip {
  flex-shrink: 0;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  font-size: 13px;
}

.content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.player-section {
  flex-shrink: 0;
  padding: 0 16px;
}

.player-shell {
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.6);
  box-shadow: var(--shadow);
}

.chat-divider {
  flex-shrink: 0;
  height: 18px;
  margin: 0 16px;
  border-radius: 0;
  background:
    linear-gradient(180deg, rgba(72, 77, 89, 0.94), rgba(33, 36, 43, 1));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 -1px 0 rgba(0, 0, 0, 0.5);
}

.video-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}

.live-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #000;
}

.watermark-layer,
.chat-overlay,
.viewer-gate,
.error-panel {
  position: absolute;
  inset: 0;
}

.watermark-layer {
  pointer-events: none;
  overflow: hidden;
}

.watermark-item {
  position: absolute;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.38);
  font-size: 12px;
  line-height: 1.45;
  backdrop-filter: blur(2px);
  transform: translate(16px, 16px);
}

.watermark-line {
  display: block;
}

.chat-overlay {
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: flex-end;
  padding: 16px;
}

.overlay-message {
  max-width: 78%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(6, 8, 15, 0.56);
  backdrop-filter: blur(10px);
}

.overlay-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.overlay-body {
  min-width: 0;
}

.overlay-author {
  display: block;
  font-size: 12px;
  color: #87d1ff;
}

.overlay-text {
  display: block;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.92);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.viewer-gate,
.error-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  text-align: center;
  background: rgba(4, 6, 10, 0.72);
  backdrop-filter: blur(8px);
}

.gate-card,
.error-panel p {
  max-width: 340px;
}

.gate-card h2,
.auth-card h3,
.chat-header h2 {
  margin: 0 0 8px;
}

.gate-card p,
.auth-card p,
.chat-header p,
.user-profile p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.gate-actions,
.auth-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 14px;
}

.chat-section {
  flex: 1;
  min-height: 0;
  margin: 0 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #ffffff 0%, #f5f6fb 100%);
  overflow: hidden;
}

.chat-header {
  display: flex;
  justify-content: center;
  gap: 12px;
  align-items: center;
  padding: 18px 16px 12px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid rgba(27, 38, 61, 0.06);
  text-align: center;
  position: relative;
}

.login-status {
  flex-shrink: 0;
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(78, 120, 216, 0.09);
  color: rgba(54, 91, 175, 0.82);
  font-size: 12px;
}

.auth-card,
.user-profile {
  margin: 12px 16px 10px;
  padding: 15px 16px;
  border: 1px solid rgba(36, 51, 89, 0.07);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 8px 18px rgba(28, 42, 72, 0.06);
}

.course-verify-form {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.course-verify-form input {
  width: 100%;
  border: 1px solid rgba(52, 76, 132, 0.08);
  border-radius: 16px;
  padding: 12px 14px;
  font: inherit;
  color: #25314f;
  background: #f4f7fd;
  outline: none;
}

.course-verify-form input:focus {
  border-color: rgba(95, 143, 242, 0.32);
  box-shadow: 0 0 0 3px rgba(95, 143, 242, 0.14);
}

.course-verify-message {
  min-height: 18px;
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.5;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
}

.chat-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 16px 18px;
  background:
    linear-gradient(180deg, rgba(238, 242, 255, 0.9) 0, rgba(247, 248, 251, 0.98) 60px),
    #f5f6fb;
  scroll-behavior: smooth;
}

.chat-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 0 10px;
}

.chat-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 5px 12px rgba(34, 51, 91, 0.12);
}

.chat-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.chat-item-header {
  display: flex;
  justify-content: flex-start;
  gap: 8px;
  align-items: center;
  margin-bottom: 4px;
  color: rgba(89, 116, 179, 0.85);
  font-size: 12px;
}

.chat-item-name {
  color: #5f8ff2;
  font-size: 15px;
  font-weight: 600;
}

.chat-item-content {
  margin: 0;
  display: inline-block;
  max-width: min(100%, 92%);
  padding: 10px 14px;
  border-radius: 6px 16px 16px 16px;
  background: #ffffff;
  color: #25314f;
  word-break: break-word;
  line-height: 1.6;
  box-shadow: 0 6px 16px rgba(33, 48, 84, 0.08);
}

.composer {
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  display: flex;
  gap: 10px;
  align-items: center;
  border-top: 1px solid rgba(31, 45, 79, 0.08);
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(14px);
}

.composer-input {
  flex: 1;
  min-width: 0;
  border: 0;
  border-radius: 999px;
  padding: 13px 16px;
  color: #25314f;
  background: #eceff5;
  outline: none;
}

.composer-input:focus {
  box-shadow: 0 0 0 3px rgba(95, 143, 242, 0.16);
}

.primary-button,
.ghost-button {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.primary-button:active,
.ghost-button:active {
  transform: scale(0.98);
}

.primary-button {
  padding: 11px 16px;
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
}

.composer-button {
  flex-shrink: 0;
  min-width: 76px;
  box-shadow: 0 10px 20px rgba(47, 146, 255, 0.22);
}

.ghost-button {
  padding: 10px 16px;
  color: #31456f;
  background: rgba(62, 101, 188, 0.09);
}

.chat-header h2 {
  margin-bottom: 2px;
  color: #2f74e7;
  font-size: 26px;
  letter-spacing: 0.04em;
}

.chat-header p {
  display: none;
}

.focus-warning {
  position: fixed;
  left: 50%;
  top: 22px;
  transform: translateX(-50%);
  z-index: 30;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(255, 76, 76, 0.9);
  color: white;
  font-size: 13px;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.26);
}

.course-entry-button {
  position: fixed;
  right: 16px;
  bottom: calc(88px + env(safe-area-inset-bottom));
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 132px;
  padding: 12px 14px;
  border: 0;
  border-radius: 18px;
  color: #2b1900;
  background: linear-gradient(135deg, #ffe082, #ffb300);
  box-shadow: 0 24px 40px rgba(255, 179, 0, 0.28);
  cursor: pointer;
}

.course-entry-icon {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.42);
  font-size: 20px;
}

.course-entry-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  font-size: 12px;
}

.course-entry-copy strong {
  font-size: 15px;
}

.course-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.course-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 4, 8, 0.72);
  backdrop-filter: blur(8px);
}

.course-card-sheet {
  position: relative;
  width: min(100%, 520px);
  margin: 16px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 28px;
  background:
    radial-gradient(circle at top right, rgba(255, 208, 74, 0.22), transparent 34%),
    linear-gradient(180deg, rgba(18, 14, 8, 0.98), rgba(8, 8, 10, 0.98));
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.42);
}

.course-modal-close {
  position: absolute;
  right: 14px;
  top: 14px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.86);
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.course-card-hero {
  padding-right: 40px;
}

.course-card-tag {
  display: inline-flex;
  margin-bottom: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  color: #402500;
  font-size: 12px;
  font-weight: 700;
  background: linear-gradient(135deg, #ffe082, #ffca28);
}

.course-card-hero h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
}

.course-card-subtitle {
  margin: 10px 0 0;
  color: rgba(255, 244, 220, 0.8);
  line-height: 1.6;
}

.course-card-content {
  margin-top: 18px;
}

.course-card-description {
  margin: 0;
  color: rgba(255, 255, 255, 0.88);
  line-height: 1.8;
}

.course-card-highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.course-highlight-badge {
  display: inline-flex;
  padding: 9px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 214, 102, 0.22);
  color: #ffe7a2;
  font-size: 13px;
  background: rgba(255, 213, 79, 0.08);
}

.course-card-price {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 18px;
  color: #fff0bf;
  background: rgba(255, 204, 64, 0.12);
  line-height: 1.6;
}

.course-card-footer {
  margin-top: 20px;
}

.course-launch-hint {
  margin: 0 0 14px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 13px;
  line-height: 1.6;
}

.mini-program-launch-wrap,
.mini-program-launch-wrap wx-open-launch-weapp {
  display: block;
  width: 100%;
}

.course-launch-button {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 18px;
  color: #1c1300;
  font-size: 16px;
  font-weight: 700;
  background: linear-gradient(135deg, #ffd54f, #ffb300);
  box-shadow: 0 16px 28px rgba(255, 191, 0, 0.28);
  cursor: pointer;
}

@media (min-width: 900px) {
  .app-shell {
    max-width: 980px;
    margin: 0 auto;
  }

  .topbar {
    padding-top: 24px;
  }
}

@media (max-width: 640px) {
  .topbar {
    padding-bottom: 10px;
}

.gate-verify-card {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.gate-verify-card input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  color: #eef3ff;
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

.gate-verify-card input:focus {
  border-color: rgba(91, 192, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(91, 192, 255, 0.14);
}

.chat-divider {
    height: 16px;
    margin: 0 12px;
  }

  .chat-section {
    margin: 0 12px;
  }

  .course-entry-button {
    right: 12px;
    bottom: calc(82px + env(safe-area-inset-bottom));
    min-width: 118px;
    padding: 11px 12px;
  }

  .course-card-sheet {
    margin: 10px;
    padding: 18px;
    border-radius: 24px;
  }

  .course-card-hero h2 {
    font-size: 24px;
  }

  .login-status {
    right: 10px;
    font-size: 11px;
    padding: 7px 8px;
  }
}
