:root {
  --ink: #17202a;
  --muted: #667085;
  --line: #d9e1e8;
  --panel: #ffffff;
  --surface: #f5f7f9;
  --brand: #0b6b68;
  --brand-dark: #084d4a;
  --accent: #b45309;
  --danger: #b42318;
  --shadow: 0 18px 40px rgba(16, 24, 40, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--surface);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

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

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 32px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--brand), #1677a8);
}

.nav-link {
  color: var(--muted);
  font-size: 14px;
}

.home-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 42px 24px;
}

.home-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 24px;
  margin-bottom: 24px;
}

.home-head h1,
.watch-title h1 {
  margin: 0;
  font-size: 30px;
  letter-spacing: 0;
}

.home-head p,
.watch-title p {
  margin: 8px 0 0;
  color: var(--muted);
}

.room-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.room-card {
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.06);
}

.room-cover {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  background: #dfe7ef center / cover no-repeat;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  width: max-content;
  padding: 5px 10px;
  color: #fff;
  background: rgba(23, 32, 42, 0.78);
  border-radius: 999px;
  font-size: 12px;
}

.room-cover .status-pill {
  position: absolute;
  top: 12px;
  left: 12px;
}

.status-pill.is-live {
  background: var(--danger);
}

.room-card-body {
  display: grid;
  gap: 8px;
  padding: 16px;
}

.room-card-body span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.watch-shell {
  max-width: 1360px;
  margin: 0 auto;
  padding: 24px;
}

.watch-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.watch-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 18px;
}

.player-panel,
.side-panel,
.admin-panel,
.login-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.06);
}

.player-wrap {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #101828;
  border-radius: 8px 8px 0 0;
}

#play {
  width: 100%;
  height: 100%;
}

.cover-layer {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: #101828 url("../img/default-cover.png") center / cover no-repeat;
}

.cover-layer::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(10, 18, 30, 0.28);
}

.password-gate {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(16, 24, 40, 0.72);
}

.password-box {
  width: min(360px, 100%);
  padding: 24px;
  color: #fff;
  background: rgba(16, 24, 40, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
}

.password-box h2 {
  margin: 0 0 12px;
  font-size: 20px;
}

.password-box input {
  width: 100%;
  height: 42px;
  margin: 8px 0;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 6px;
}

.player-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
}

.notice {
  color: var(--muted);
  font-size: 14px;
}

.side-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 640px;
}

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

.tabs button {
  min-height: 48px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-right: 1px solid var(--line);
  cursor: pointer;
}

.tabs button:last-child {
  border-right: 0;
}

.tabs button.is-active {
  color: var(--brand-dark);
  font-weight: 700;
  box-shadow: inset 0 -2px var(--brand);
}

.panel-body {
  min-height: 0;
  padding: 16px;
}

.comment-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 480px;
  overflow: auto;
}

.comment-item {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid #edf2f7;
  border-radius: 8px;
}

.comment-item strong {
  color: var(--brand-dark);
  font-size: 13px;
}

.comment-item span {
  line-height: 1.55;
}

.comment-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 76px;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
}

.comment-form input,
.form-grid input,
.form-grid textarea,
.form-grid select,
.obs-box input {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.comment-hint {
  grid-column: 1 / -1;
  min-height: 18px;
  color: var(--danger);
  font-size: 12px;
}

.primary-btn,
.ghost-btn,
.danger-btn {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
}

.primary-btn {
  color: #fff;
  background: var(--brand);
}

.primary-btn:hover {
  background: var(--brand-dark);
}

.ghost-btn {
  color: var(--brand-dark);
  background: #fff;
  border-color: var(--line);
}

.danger-btn {
  color: #fff;
  background: var(--danger);
}

.info-block {
  display: grid;
  gap: 10px;
  line-height: 1.7;
}

.info-block h3 {
  margin: 0;
  font-size: 18px;
}

.info-block p {
  margin: 0;
  color: var(--muted);
}

.admin-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: calc(100vh - 64px);
}

.admin-sidebar {
  padding: 18px;
  background: #fff;
  border-right: 1px solid var(--line);
}

.admin-sidebar-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

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

.admin-room {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 12px;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.admin-room.is-active {
  border-color: var(--brand);
  box-shadow: inset 3px 0 var(--brand);
}

.admin-room span {
  color: var(--muted);
  font-size: 12px;
}

.admin-main {
  padding: 24px;
}

.admin-panel {
  padding: 22px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.form-grid textarea {
  min-height: 94px;
  resize: vertical;
}

.check-row {
  display: flex !important;
  align-items: center;
  gap: 8px;
}

.check-row input {
  width: 16px;
  min-height: 16px;
}

.obs-box {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  padding: 14px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.obs-box label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 18px;
}

.admin-hint {
  color: var(--brand-dark);
}

.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.login-panel {
  display: grid;
  gap: 12px;
  width: min(380px, 100%);
  padding: 24px;
}

.login-panel h1 {
  margin: 0 0 8px;
  font-size: 24px;
}

.empty-state,
.fatal {
  padding: 28px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

@media (max-width: 960px) {
  .topbar {
    padding: 0 18px;
  }

  .home-head,
  .watch-title,
  .watch-layout,
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .watch-title {
    align-items: start;
  }

  .side-panel {
    min-height: 520px;
  }

  .comment-list {
    height: 320px;
  }

  .admin-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

@media (max-width: 560px) {
  .watch-shell,
  .home-shell,
  .admin-main {
    padding: 16px;
  }

  .home-head h1,
  .watch-title h1 {
    font-size: 24px;
  }

  .comment-form {
    grid-template-columns: 1fr;
  }
}
