:root {
  --bg: #f5f7fb;
  --panel: rgba(255, 255, 255, 0.92);
  --ink: #0f172a;
  --muted: #667085;
  --line: #e6ebf3;
  --soft: #f1f5fb;
  --primary: #2563eb;
  --primary-dark: #1e40af;
  --success: #0f9f6e;
  --danger: #d92d20;
  --warning: #f59e0b;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
  --shadow-hover: 0 24px 70px rgba(15, 23, 42, 0.14);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}


[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background:
    radial-gradient(circle at 12% 0%, rgba(37, 99, 235, 0.13), transparent 28rem),
    radial-gradient(circle at 86% 10%, rgba(14, 165, 233, 0.13), transparent 28rem),
    linear-gradient(180deg, #f8fbff 0%, var(--bg) 100%);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.shell {
  width: min(1320px, calc(100% - 36px));
  margin: 30px auto 34px;
}

.toolbar-card {
  position: sticky;
  top: 14px;
  z-index: 8;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 132px 132px 132px 132px auto auto;
  gap: 10px;
  align-items: center;
  padding: 16px;
  border: 1px solid rgba(226, 232, 240, 0.92);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 16px 44px rgba(15, 23, 42, 0.09);
  backdrop-filter: blur(18px);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.search-box span {
  color: #64748b;
  font-size: 20px;
  line-height: 1;
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}

select {
  width: 100%;
  min-height: 46px;
  padding: 0 36px 0 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  outline: 0;
  color: #1f2937;
  background: #fff;
}

.primary-btn,
.soft-btn,
.page-btn,
.edit-btn,
.icon-btn {
  border: 0;
  outline: 0;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.primary-btn,
.soft-btn,
.page-btn {
  min-height: 46px;
  padding: 0 20px;
  border-radius: 16px;
  font-weight: 800;
  white-space: nowrap;
}

.primary-btn {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), #0ea5e9);
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.24);
}

.primary-btn:hover,
.soft-btn:hover,
.page-btn:hover,
.edit-btn:hover {
  transform: translateY(-1px);
}

.soft-btn,
.page-btn {
  color: #1e40af;
  border: 1px solid #dbeafe;
  background: #eff6ff;
}

.message {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.6;
}

.message.error {
  color: #b42318;
  border: 1px solid #fecaca;
  background: #fff7f7;
}

.message.success {
  color: #067647;
  border: 1px solid #bbf7d0;
  background: #f0fdf4;
}

.message.compact {
  margin: 0;
}

.loading-card {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--muted);
  background: #fff;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #bfdbfe;
  border-top-color: var(--primary);
  border-radius: 999px;
  animation: spin 0.8s linear infinite;
}

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

.room-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.room-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid rgba(226, 232, 240, 0.92);
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 16px 42px rgba(15, 23, 42, 0.08);
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.room-card:hover {
  transform: translateY(-4px);
  border-color: rgba(37, 99, 235, 0.24);
  box-shadow: var(--shadow-hover);
}

.room-cover {
  position: relative;
  height: 150px;
  overflow: hidden;
  background: #dbeafe;
}

.room-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 24%, rgba(15, 23, 42, 0.38));
}

.room-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.room-badges {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  color: #1f2937;
  font-size: 12px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
}

.badge.live {
  color: #047857;
  background: rgba(209, 250, 229, 0.94);
}

.badge.waiting {
  color: #92400e;
  background: rgba(254, 243, 199, 0.94);
}

.badge.ended {
  color: #475569;
  background: rgba(241, 245, 249, 0.94);
}

.badge.hot {
  color: #be123c;
  background: rgba(255, 228, 230, 0.94);
}

.room-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 18px;
}

.room-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.room-avatar {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border: 3px solid #fff;
  border-radius: 18px;
  object-fit: cover;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
}

.room-title {
  min-width: 0;
}

.room-title h2 {
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-title p {
  margin: 6px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notice {
  display: -webkit-box;
  min-height: 44px;
  margin: 16px 0;
  overflow: hidden;
  color: #475467;
  font-size: 13px;
  line-height: 1.7;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: auto;
}

.meta-item {
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid #edf2f7;
  border-radius: 16px;
  background: #f8fafc;
}

.meta-item.full {
  grid-column: 1 / -1;
}

.meta-item span,
.meta-item strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta-item span {
  color: #94a3b8;
  font-size: 12px;
}

.meta-item strong {
  margin-top: 4px;
  color: #1f2937;
  font-size: 13px;
}

.room-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #eef2f7;
}

.room-footer small {
  min-width: 0;
  overflow: hidden;
  color: #98a2b3;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.edit-btn {
  min-height: 38px;
  padding: 0 15px;
  border-radius: 14px;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  background: #0f172a;
}

.skeleton-card {
  min-height: 420px;
  border-radius: 28px;
  background:
    linear-gradient(90deg, rgba(241, 245, 249, 0.9) 25%, rgba(226, 232, 240, 0.9) 37%, rgba(241, 245, 249, 0.9) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}

@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

.empty-card {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  min-height: 300px;
  padding: 34px;
  border: 1px dashed #cbd5e1;
  border-radius: 28px;
  color: var(--muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.72);
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 18px;
  color: var(--primary);
  font-size: 28px;
  background: #eff6ff;
}

.empty-card h2 {
  margin: 16px 0 8px;
  color: var(--ink);
}

.empty-card p {
  margin: 0;
}

.pager-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 22px auto 0;
  color: #334155;
  font-weight: 800;
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(8px);
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 26px 80px rgba(15, 23, 42, 0.24);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.modal-head h2 {
  margin: 8px 0 8px;
  font-size: 24px;
  line-height: 1.1;
}

.modal-head p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.eyebrow {
  margin: 0;
  color: #2563eb;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.icon-btn {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 14px;
  color: #475569;
  font-size: 28px;
  line-height: 1;
  background: #f1f5f9;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.field span {
  color: #334155;
  font-size: 13px;
  font-weight: 800;
}

.field input {
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  outline: 0;
  background: #fff;
}

.field input:focus,
.search-box:focus-within,
select:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

body.modal-open {
  overflow: hidden;
}

@media (max-width: 1180px) {
  .toolbar-card {
    grid-template-columns: minmax(220px, 1fr) 1fr 1fr 1fr;
  }

  .primary-btn,
  .soft-btn {
    width: 100%;
  }

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

@media (max-width: 820px) {
  .shell {
    width: min(100% - 24px, 760px);
    margin-top: 14px;
  }

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

  .toolbar-card {
    position: static;
    grid-template-columns: 1fr;
    border-radius: 20px;
  }

  .room-cover {
    height: 138px;
  }

  .pager-card {
    flex-wrap: wrap;
  }

  .modal-panel {
    padding: 20px;
    border-radius: 24px;
  }
}

@media (max-width: 460px) {
  .meta-grid {
    grid-template-columns: 1fr;
  }

  .room-footer,
  .modal-actions {
    align-items: stretch;
    flex-direction: column;
  }

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