:root {
  --bg: #f3f6f9;
  --surface: #ffffff;
  --line: #d7dde5;
  --text: #17222c;
  --muted: #5d6b78;
  --primary: #2f7df4;
  --primary-strong: #1f62c9;
  --danger: #cf3d4f;
  --ok: #138f5b;
  --shadow: 0 14px 30px rgba(24, 44, 72, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #eff4fb 0%, #f7fafc 100%);
  min-height: 100%;
}

.bg-shape {
  position: fixed;
  border-radius: 999px;
  filter: blur(8px);
  z-index: 0;
  pointer-events: none;
}

.bg-shape-a {
  width: 260px;
  height: 260px;
  background: rgba(47, 125, 244, 0.12);
  top: -80px;
  left: -40px;
}

.bg-shape-b {
  width: 280px;
  height: 280px;
  background: rgba(19, 143, 91, 0.08);
  right: -120px;
  bottom: -80px;
}

.app-shell {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 22px auto;
  padding: 0 14px 30px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.app-header h1 {
  margin: 0;
  font-size: 1.45rem;
}

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

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.view {
  margin-top: 12px;
}

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

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

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.92rem;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 0.94rem;
  background: #fff;
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(47, 125, 244, 0.3);
  outline-offset: 0;
}

textarea {
  width: 100%;
  resize: vertical;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.row.between {
  justify-content: space-between;
}

.block-title {
  margin-top: 18px;
  margin-bottom: 6px;
  font-weight: 600;
}

.ticker-wrap {
  margin: 10px 0 4px;
  border: 1px solid #f6c57f;
  border-radius: 10px;
  background: linear-gradient(90deg, #fff7e6 0%, #fffdf6 100%);
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ticker-label {
  flex: 0 0 auto;
  font-size: 0.82rem;
  color: #9b5600;
  font-weight: 600;
}

.ticker-track {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
}

.ticker-text {
  display: inline-block;
  padding-left: 100%;
  color: #8a2f0a;
  animation: ticker-scroll 14s linear infinite;
}

@keyframes ticker-scroll {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-100%);
  }
}

.btn {
  border: 0;
  border-radius: 9px;
  padding: 9px 14px;
  font-size: 0.93rem;
  cursor: pointer;
  color: #fff;
  background: var(--primary);
  transition: transform 0.12s ease, opacity 0.12s ease, background 0.12s ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  background: var(--primary-strong);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.btn.secondary {
  background: #506577;
}

.btn.secondary:hover:not(:disabled) {
  background: #415767;
}

.btn.ghost {
  background: #e8eef4;
  color: #2d3f4d;
}

.btn.ghost:hover:not(:disabled) {
  background: #d9e4ee;
}

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

.btn.danger:hover:not(:disabled) {
  background: #b73143;
}

.muted {
  margin: 5px 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.muted.tiny {
  font-size: 0.8rem;
}

.error-text {
  color: var(--danger);
  font-size: 0.9rem;
  min-height: 1.2em;
}

.rooms-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.room-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.room-card h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.room-members {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.member-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
  background: #f7fafc;
  cursor: pointer;
  font-size: 0.82rem;
}

.member-chip:hover {
  border-color: var(--primary);
}

.room-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 12px;
  margin-top: 12px;
}

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

.member-item {
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  width: 100%;
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: 10px;
  background: #fbfdff;
  padding: 8px;
}

.member-main-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  cursor: pointer;
}

.kick-btn {
  padding: 5px 9px;
  font-size: 0.8rem;
  white-space: nowrap;
}

.member-item img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid #d8e1ea;
}

.member-item.online {
  border-left-color: var(--ok);
}

.member-item.offline {
  border-left-color: #a6b4c0;
}

.chat-panel {
  display: flex;
  flex-direction: column;
  min-height: 390px;
}

.chat-messages {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f9fcff;
  height: 320px;
  overflow-y: auto;
  padding: 10px;
}

.chat-item {
  margin-bottom: 8px;
  font-size: 0.9rem;
  line-height: 1.4;
}

.chat-item-admin {
  color: #c53333;
  background: #fff2f2;
  border: 1px solid #f3bcbc;
  border-radius: 8px;
  padding: 7px 9px;
}

.remote-audio {
  width: 100%;
  margin-top: 8px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 26, 37, 0.48);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 20;
}

.modal-card {
  width: min(520px, 100%);
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 15px;
}

.notice-modal-card {
  border-color: #f6c57f;
}

.profile-body {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.toast {
  position: fixed;
  right: 14px;
  bottom: 14px;
  background: #223548;
  color: #fff;
  border-radius: 9px;
  padding: 10px 12px;
  box-shadow: var(--shadow);
  z-index: 30;
}

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

.hidden {
  display: none !important;
}

@media (max-width: 900px) {
  .grid-form,
  .grid-form.compact {
    grid-template-columns: 1fr 1fr;
  }

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

@media (max-width: 640px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-actions {
    width: 100%;
  }

  .header-actions .btn {
    flex: 1;
  }

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

  .row {
    flex-wrap: wrap;
  }

  .rooms-list {
    grid-template-columns: 1fr;
  }
}
