:root {
  color-scheme: dark;
  --bg: #101211;
  --panel: #191c1a;
  --panel-soft: #20251f;
  --line: #30362f;
  --text: #f4f3ec;
  --muted: #aab0a2;
  --green: #28b46b;
  --gold: #e2b84c;
  --red: #da5b4f;
  --blue: #56a6d8;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    linear-gradient(135deg, rgba(40, 180, 107, 0.16), transparent 34%),
    radial-gradient(circle at 100% 0%, rgba(226, 184, 76, 0.16), transparent 28%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body.auth-pending,
body.auth-locked {
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  place-items: center;
  padding: 22px;
  background:
    linear-gradient(135deg, rgba(40, 180, 107, 0.18), transparent 36%),
    radial-gradient(circle at 100% 0%, rgba(226, 184, 76, 0.18), transparent 28%),
    rgba(16, 18, 17, 0.96);
}

body.auth-pending .auth-gate,
body.auth-locked .auth-gate {
  display: grid;
}

body.auth-pending .app-shell,
body.auth-locked .app-shell {
  visibility: hidden;
  pointer-events: none;
}

.auth-card {
  display: grid;
  gap: 16px;
  width: min(100%, 360px);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(25, 28, 26, 0.94);
  box-shadow: var(--shadow);
}

.auth-mark {
  width: 52px;
  height: 52px;
}

.auth-copy h2 {
  margin: 4px 0 0;
  font-size: 22px;
}

.auth-field input {
  height: 46px;
}

.auth-submit {
  width: 100%;
}

.auth-message {
  min-height: 18px;
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: rgba(16, 18, 17, 0.82);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
}

.brand-text {
  min-width: 0;
  flex: 1;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  border: 2px solid var(--green);
  border-bottom-color: var(--gold);
  border-radius: 50%;
  color: var(--gold);
  font-weight: 800;
}

.brand h1,
.room-header h2,
.section-heading h2 {
  margin: 0;
}

.brand h1 {
  font-size: 19px;
  line-height: 1.2;
}

.brand p,
.eyebrow,
.field span,
.typing-line {
  color: var(--muted);
  font-size: 12px;
}

.brand p {
  margin: 4px 0 0;
}

.brand .sidebar-close {
  display: none;
}

.field {
  display: grid;
  gap: 8px;
}

.field input,
.composer textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #111411;
  color: var(--text);
  outline: none;
}

.field input {
  height: 42px;
  padding: 0 12px;
  border-radius: 8px;
}

.field input:focus,
.composer textarea:focus {
  border-color: rgba(40, 180, 107, 0.9);
  box-shadow: 0 0 0 3px rgba(40, 180, 107, 0.16);
}

.field-row,
.invite-row,
.header-actions,
.call-controls {
  display: flex;
  gap: 8px;
}

.icon-btn,
.command-btn,
.send-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.icon-btn:hover,
.command-btn:hover,
.send-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(244, 243, 236, 0.28);
}

.icon-btn svg,
.command-btn svg,
.send-btn svg,
.ticker-toggle svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.command-btn {
  flex: 1;
  padding: 0 14px;
  white-space: nowrap;
}

.command-btn.accent,
.send-btn {
  border-color: rgba(40, 180, 107, 0.7);
  background: var(--green);
  color: #08130d;
  font-weight: 700;
}

.danger {
  border-color: rgba(218, 91, 79, 0.7);
  color: #ffd2ce;
}

.is-active {
  border-color: rgba(226, 184, 76, 0.85);
  background: rgba(226, 184, 76, 0.16);
  color: var(--gold);
}

.invite-btn,
.install-btn {
  width: 100%;
  flex: 0 0 auto;
}

.install-btn {
  border-color: rgba(226, 184, 76, 0.38);
}

.presence {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* 「你」这一行：身份 + 改昵称合并成一处，不再和在线列表重复显示自己 */
.me-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 8px;
  border: 1px solid rgba(40, 180, 107, 0.4);
  border-radius: 10px;
  background: rgba(40, 180, 107, 0.08);
}

.me-tag {
  flex: 0 0 auto;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--green);
  color: #08130d;
  font-size: 12px;
  font-weight: 700;
}

.me-name {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-weight: 600;
  outline: none;
}

.client-info-slot {
  flex: 0 0 auto;
  display: inline-flex;
}

.member-empty {
  justify-content: center;
  border-style: dashed;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
}

/* 更换房间：默认折叠的设置项，一般只复制链接就够了 */
.room-settings {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.room-settings summary {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  list-style: none;
  color: var(--muted);
  font-size: 13px;
}

.room-settings summary::-webkit-details-marker {
  display: none;
}

.room-settings summary svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.room-settings summary .chevron {
  margin-left: auto;
  transition: transform 0.18s ease;
}

.room-settings[open] summary .chevron {
  transform: rotate(180deg);
}

.room-settings-body {
  display: grid;
  gap: 10px;
  padding-top: 10px;
}

.room-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.room-settings-body input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: #111411;
  color: var(--text);
  border-radius: 8px;
  outline: none;
}

.room-settings-body input:focus {
  border-color: rgba(40, 180, 107, 0.9);
  box-shadow: 0 0 0 3px rgba(40, 180, 107, 0.16);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-heading h2 {
  font-size: 14px;
}

.section-heading span {
  color: var(--gold);
  font-size: 13px;
}

.member-list {
  flex: 1;
  list-style: none;
  display: grid;
  grid-auto-rows: max-content;
  gap: 8px;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: auto;
}

.member-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(32, 37, 31, 0.72);
}

.member-identity {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.member-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-info {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  cursor: help;
}

.client-info:hover,
.client-info:focus-visible {
  border-color: rgba(40, 180, 107, 0.5);
  background: rgba(40, 180, 107, 0.1);
  color: #b9ecd0;
  outline: none;
}

.client-info svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.call-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(40, 180, 107, 0.12);
}

.chat-panel {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto auto;
  min-width: 0;
  height: 100vh;
  height: 100dvh;
}

.room-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(25, 28, 26, 0.9);
}

.room-title-block {
  flex: 1;
  min-width: 0;
}

.room-header h2 {
  margin-top: 2px;
  font-size: 20px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.menu-btn {
  display: none;
}

/* ---------------------------------------------------------------- 比分条 */

.match-ticker {
  display: flex;
  align-items: stretch;
  min-width: 0;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: rgba(14, 17, 15, 0.92);
}

.match-ticker.is-empty {
  display: none;
}

.ticker-track {
  display: flex;
  flex: 1;
  gap: 8px;
  min-width: 0;
  align-items: stretch;
  padding: 8px 10px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.ticker-track::-webkit-scrollbar {
  display: none;
}

.ticker-tag {
  align-self: center;
  flex: 0 0 auto;
  padding: 3px 7px;
  border: 1px solid rgba(226, 184, 76, 0.4);
  border-radius: 999px;
  color: var(--gold);
  font-size: 10.5px;
}

.match-card {
  display: grid;
  gap: 3px;
  flex: 0 0 auto;
  min-width: 104px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
  color: var(--text);
  text-align: left;
}

.match-card:hover {
  border-color: rgba(244, 243, 236, 0.3);
}

.match-card.live {
  border-color: rgba(40, 180, 107, 0.6);
  background: rgba(31, 52, 39, 0.6);
}

.mc-status {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 10.5px;
  white-space: nowrap;
}

.match-card.live .mc-status {
  color: var(--green);
  font-weight: 700;
}

.live-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 1.6s ease infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.mc-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  line-height: 1.25;
  white-space: nowrap;
}

.mc-code {
  font-weight: 700;
  letter-spacing: 0.02em;
}

.mc-name {
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
}

.mc-score {
  margin-left: auto;
  padding-left: 10px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.match-card.live .mc-score {
  color: var(--gold);
}

.ticker-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 0 0 auto;
  min-width: 30px;
  padding: 0 6px;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--muted);
}

.ticker-toggle:hover {
  color: var(--text);
}

.ticker-toggle svg {
  width: 15px;
  height: 15px;
  transition: transform 0.18s ease;
}

.ticker-toggle .tt-label {
  display: none;
  font-size: 12px;
}

.match-ticker.collapsed .ticker-track {
  display: none;
}

.match-ticker.collapsed .ticker-toggle {
  flex: 1;
  justify-content: space-between;
  padding: 7px 12px;
  border-left: 0;
}

.match-ticker.collapsed .ticker-toggle .tt-label {
  display: inline;
}

.match-ticker.collapsed .ticker-toggle svg {
  transform: rotate(180deg);
}

/* ------------------------------------------------------------ 比赛详情 */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(5, 7, 6, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.scrim.show {
  opacity: 1;
  pointer-events: auto;
}

.match-sheet,
.install-sheet {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  max-height: 80vh;
  max-height: 80dvh;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 18px 18px 0 0;
  background: var(--panel);
  box-shadow: var(--shadow);
  transform: translateY(105%);
  visibility: hidden;
  transition: transform 0.24s ease, visibility 0.24s;
}

.match-sheet.open,
.install-sheet.open {
  transform: translateY(0);
  visibility: visible;
}

.sheet-grip {
  width: 42px;
  height: 4px;
  margin: 10px auto 0;
  border-radius: 999px;
  background: var(--line);
}

.sheet-close {
  position: absolute;
  top: 10px;
  right: 10px;
  min-width: 34px;
  width: 34px;
  height: 34px;
}

.sheet-body {
  display: grid;
  gap: 16px;
  min-height: 0;
  padding: 8px 18px calc(18px + env(safe-area-inset-bottom));
  overflow-y: auto;
}

.install-body {
  display: grid;
  gap: 14px;
  padding: 16px 18px calc(20px + env(safe-area-inset-bottom));
}

.install-body h2 {
  margin: 0;
  padding-right: 42px;
  font-size: 18px;
}

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

.install-steps li {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(16, 18, 17, 0.6);
}

.install-steps span {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(40, 180, 107, 0.16);
  color: #b9ecd0;
  font-weight: 800;
}

.install-steps p {
  margin: 0;
  min-width: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.sheet-stage {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.sheet-stage .live-tag {
  margin-left: 6px;
  color: var(--green);
  font-weight: 700;
}

.sheet-score {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
}

.sheet-team {
  display: grid;
  gap: 4px;
  justify-items: center;
  min-width: 0;
  text-align: center;
}

.sheet-team .flag {
  font-size: 30px;
  line-height: 1;
}

.sheet-team .team-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
}

.sheet-score-num {
  font-size: 32px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sheet-section {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(16, 18, 17, 0.6);
}

.sheet-section h3 {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.sheet-section h3 .tag {
  padding: 2px 7px;
  border: 1px solid rgba(226, 184, 76, 0.4);
  border-radius: 999px;
  color: var(--gold);
  font-size: 10px;
  font-weight: 400;
}

.stat-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
}

.stat-row .sv {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat-row .sv.home {
  text-align: left;
}

.stat-row .sv.away {
  text-align: right;
}

.stat-row .sl {
  color: var(--muted);
  font-size: 12px;
}

.possession-bar {
  display: flex;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(86, 166, 216, 0.5);
}

.possession-bar .home-share {
  background: var(--green);
}

.odds-row {
  display: grid;
  grid-template-columns: 56px 1fr;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.odds-row .ol {
  color: var(--muted);
  font-size: 12px;
}

.odds-values {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.odds-chip {
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.odds-chip b {
  color: var(--gold);
  font-weight: 700;
}

.odds-empty,
.tl-empty {
  color: var(--muted);
  font-size: 13px;
}

.odds-note {
  color: var(--muted);
  font-size: 11px;
}

.timeline {
  display: grid;
  gap: 8px;
}

.tl-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
  line-height: 1.4;
}

.tl-min {
  flex: 0 0 40px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.tl-icon {
  flex: 0 0 auto;
}

.tl-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.tl-text .tl-team {
  font-weight: 700;
  margin-right: 4px;
}

.tl-text .tl-detail {
  color: var(--muted);
}

/* -------------------------------------------------------------- 通话区 */

.call-stage {
  display: grid;
  gap: 12px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(18, 22, 18, 0.92);
}

.call-stage.is-hidden {
  display: none;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  max-height: 38vh;
  overflow: auto;
}

.video-tile {
  position: relative;
  overflow: hidden;
  min-height: 132px;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b0d0b;
}

.video-tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.video-tile .video-label {
  position: absolute;
  left: 8px;
  bottom: 8px;
  max-width: calc(100% - 16px);
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.56);
  color: var(--text);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.call-controls {
  justify-content: center;
}

/* -------------------------------------------------------------- 消息区 */

.message-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  padding: 20px 22px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.message {
  width: min(680px, 92%);
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(32, 37, 31, 0.78);
  box-shadow: var(--shadow);
}

.message.own {
  align-self: flex-end;
  border-color: rgba(40, 180, 107, 0.34);
  background: rgba(31, 62, 44, 0.82);
}

.notice {
  align-self: center;
  width: auto;
  max-width: 94%;
  padding: 6px 10px;
  border-color: transparent;
  background: rgba(226, 184, 76, 0.12);
  color: var(--gold);
  box-shadow: none;
  font-size: 13px;
}

.notice.match-alert {
  border: 1px solid rgba(40, 180, 107, 0.4);
  background: rgba(40, 180, 107, 0.12);
  color: #b9ecd0;
  font-weight: 600;
}

.message-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

.message-sender {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-weight: 700;
}

.message-delete {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.message-delete:hover {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  color: #ffb3a8;
}

.message-delete svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.message-text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.55;
}

.sticker-message {
  display: inline-grid;
  justify-items: center;
  gap: 6px;
  min-width: 96px;
  padding: 8px 10px 10px;
  border-radius: 8px;
  background: rgba(8, 11, 9, 0.28);
}

.sticker-face {
  font-size: 30px;
  font-weight: 800;
  line-height: 1.1;
}

.sticker-label {
  color: var(--muted);
  font-size: 12px;
}

.media-preview {
  display: block;
  max-width: 100%;
  max-height: 360px;
  border-radius: 8px;
  background: #0b0d0b;
}

.file-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--blue);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.typing-line {
  min-height: 20px;
  padding: 0 22px;
}

.composer {
  display: grid;
  grid-template-columns: auto auto auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding: 14px 22px 18px;
  border-top: 1px solid var(--line);
  background: rgba(25, 28, 26, 0.94);
}

.sticker-panel {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 8px;
  max-height: 186px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(13, 16, 14, 0.98);
  box-shadow: var(--shadow);
}

.sticker-panel.is-hidden {
  display: none;
}

.sticker-option {
  display: grid;
  justify-items: center;
  gap: 5px;
  min-width: 0;
  min-height: 66px;
  padding: 8px 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  cursor: pointer;
}

.sticker-option:hover {
  border-color: rgba(40, 180, 107, 0.42);
  background: rgba(40, 180, 107, 0.1);
}

.sticker-option span {
  max-width: 100%;
  overflow: hidden;
  font-size: 20px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sticker-option small {
  color: var(--muted);
  font-size: 11px;
}

.composer textarea {
  min-height: 42px;
  max-height: 132px;
  resize: none;
  padding: 10px 12px;
  border-radius: 8px;
  line-height: 1.35;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom));
  z-index: 60;
  transform: translateX(-50%) translateY(18px);
  max-width: min(460px, calc(100vw - 32px));
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(16, 18, 17, 0.96);
  color: var(--text);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* -------------------------------------------------------------- 桌面端 */

@media (min-width: 861px) {
  .match-sheet,
  .install-sheet {
    inset: 50% auto auto 50%;
    width: min(560px, 92vw);
    max-height: min(640px, 86vh);
    border-bottom: 1px solid var(--line);
    border-radius: 14px;
    transform: translate(-50%, -50%) translateY(14px);
    opacity: 0;
  }

  .match-sheet.open,
  .install-sheet.open {
    transform: translate(-50%, -50%);
    opacity: 1;
  }

  .install-sheet {
    width: min(420px, 92vw);
  }

  .install-body {
    padding: 22px;
  }

  .sheet-grip {
    display: none;
  }

  .sheet-body {
    padding: 18px 22px 22px;
  }
}

/* -------------------------------------------------------------- 移动端 */

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    width: min(86vw, 320px);
    height: 100vh;
    height: 100dvh;
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: var(--shadow);
  }

  body.drawer-open .sidebar {
    transform: translateX(0);
  }

  .brand .sidebar-close {
    display: inline-flex;
    min-width: 36px;
    width: 36px;
    height: 36px;
  }

  .menu-btn {
    display: inline-flex;
    flex: 0 0 auto;
  }

  .room-header {
    gap: 10px;
    padding: 10px 12px;
  }

  .room-header h2 {
    font-size: 16px;
  }

  .eyebrow {
    font-size: 10px;
  }

  .header-actions .command-btn {
    flex: 0 0 auto;
    min-width: 42px;
    padding: 0;
  }

  .header-actions .command-btn span {
    display: none;
  }

  .match-card {
    min-width: 96px;
    padding: 5px 9px;
  }

  .mc-row {
    font-size: 12px;
  }

  .call-stage {
    padding: 10px 12px;
  }

  .video-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    max-height: 32vh;
  }

  .message-list {
    gap: 10px;
    padding: 12px;
  }

  .message {
    width: min(680px, 96%);
    padding: 10px 12px;
    font-size: 14px;
    box-shadow: none;
  }

  .typing-line {
    padding: 0 12px;
  }

  .composer {
    gap: 8px;
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
  }

  .sticker-panel {
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    max-height: 170px;
    padding: 8px;
  }

  .composer .icon-btn,
  .composer .send-btn {
    min-width: 40px;
    height: 40px;
  }

  .composer textarea {
    min-height: 40px;
  }
}
