/* ==========================================================================
   达芬奇密码
   --------------------------------------------------------------------------
   依赖全局变量与共享组件（.mode-tabs / .btn / .panel / .room-* / .pc-field 等），
   只补充本游戏自己的部分。前缀 dvc-
   ========================================================================== */

.dvc-app {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

/* 模式页签（公共组件，仅在本游戏内铺满）——与内容列同宽 */
.dvc-app .mode-tabs {
  width: min(100vw, 1200px);
  max-width: 100%;
}
.dvc-app .mode-tab { padding: 12px 18px; }
.dvc-app .mode-tab b { font-size: 15px; }

.dvc {
  display: flex;
  flex-direction: column;
  gap: 12px;
  /* 尽量铺满：宽屏 1200px，窄屏跟随视口；max-width 防止 100vw 含滚动条时溢出 */
  width: min(100vw, 1200px);
  max-width: 100%;
}

.dvc-slot:empty { display: none; }

/* ------------------------------ 座位配色 -------------------------------- */

.dvc-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--text-mute);
}
.dvc-dot.is-s0, .dvc-chip.is-s0 .dvc-dot { background: #8b5cf6; }
.dvc-dot.is-s1, .dvc-chip.is-s1 .dvc-dot { background: #22d3ee; }
.dvc-dot.is-s2, .dvc-chip.is-s2 .dvc-dot { background: #fb7185; }
.dvc-dot.is-s3, .dvc-chip.is-s3 .dvc-dot { background: #34d399; }

/* ------------------------------ 状态栏 ---------------------------------- */

.dvc-status {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
  background: var(--surface);
}

.dvc-status-line { font-size: 13px; color: var(--text-dim); letter-spacing: .02em; }

.dvc-players { display: flex; flex-wrap: wrap; gap: 8px; }

.dvc-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  font-size: 12.5px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.035);
  transition: border-color .2s, background .2s;
}
.dvc-chip b { font-weight: 600; color: var(--text); }
.dvc-chip em {
  font-style: normal;
  font-weight: 700;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.dvc-chip.is-turn {
  border-color: rgba(139, 92, 246, 0.55);
  background: rgba(139, 92, 246, 0.14);
}
.dvc-chip.is-out { opacity: .55; }
.dvc-chip.is-out b { text-decoration: line-through; }
.dvc-chip.is-win {
  border-color: rgba(52, 211, 153, 0.55);
  background: rgba(52, 211, 153, 0.12);
}
.dvc-chip-tag {
  padding: 1px 7px;
  font-size: 11px;
  border-radius: 999px;
  color: #fda4af;
  border: 1px solid rgba(251, 113, 133, 0.4);
  background: rgba(251, 113, 133, 0.12);
}

/* ------------------------------ 结果横幅 -------------------------------- */

.dvc-banner {
  padding: 14px 16px;
  text-align: center;
  border-radius: var(--radius);
  border: 1px solid rgba(139, 92, 246, 0.4);
  background: linear-gradient(120deg, rgba(139, 92, 246, 0.18), rgba(34, 211, 238, 0.1));
  animation: dvc-banner-in .28s cubic-bezier(.2, .8, .3, 1);
}
.dvc-banner[hidden] { display: none; }
.dvc-banner-title { font-size: 17px; font-weight: 700; }
.dvc-banner-detail { margin-top: 5px; font-size: 12.5px; line-height: 1.6; color: var(--text-dim); }
.dvc-banner-detail:empty { display: none; }
.dvc-banner-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
}
.dvc-banner-actions:empty { display: none; margin-top: 0; }

@keyframes dvc-banner-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

.dvc-score-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 10px;
  margin: 6px 0 2px;
}
.dvc-score-row {
  padding: 3px 10px;
  font-size: 12px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.04);
}
.dvc-score-row b { margin-right: 5px; color: var(--text); font-weight: 600; }
.dvc-score-row.is-win {
  color: #6ee7b7;
  border-color: rgba(52, 211, 153, 0.5);
  background: rgba(52, 211, 153, 0.12);
}

/* ------------------------------- 牌墙 ----------------------------------- */

.dvc-table {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dvc-table[hidden] { display: none; }

.dvc-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.012));
  transition: border-color .2s, background .2s;
}
.dvc-row.is-turn {
  border-color: rgba(139, 92, 246, 0.5);
  background: linear-gradient(165deg, rgba(139, 92, 246, 0.14), rgba(139, 92, 246, 0.03));
}
.dvc-row.is-me { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06); }
.dvc-row.is-out { opacity: .55; }

.dvc-row-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.dvc-row-name { font-size: 13.5px; font-weight: 600; color: var(--text); }
.dvc-row-note { font-size: 12px; color: var(--text-mute); }

.dvc-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.dvc-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 80px;
  padding: 0;
  font-family: inherit;
  font-size: 25px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 9px;
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.1), rgba(0, 0, 0, 0.25));
  cursor: default;
  -webkit-tap-highlight-color: transparent;
  transition: transform .16s, box-shadow .16s, border-color .16s;
}
.dvc-card-idx {
  position: absolute;
  left: 5px;
  top: 4px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-mute);
}

/* 暗牌（别人的）：只给牌背 */
.dvc-card.is-dark {
  color: transparent;
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.24);
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.07) 0 6px, rgba(0, 0, 0, 0.2) 6px 12px);
}
.dvc-card.is-dark .dvc-card-face { opacity: 0; }

/* 已亮开的牌 */
.dvc-card.is-black {
  color: #f8fafc;
  border-color: rgba(15, 23, 42, 0.9);
  background: linear-gradient(165deg, #334155, #0f172a);
}
.dvc-card.is-white {
  color: #0f172a;
  border-color: rgba(226, 232, 240, 0.85);
  background: linear-gradient(165deg, #ffffff, #dbe2ea);
}
.dvc-card.is-joker { letter-spacing: .04em; }

/* 自己手里还没亮开的牌：只有自己看得见 */
.dvc-card.is-open:not(.is-revealed) {
  border-style: dashed;
  border-color: rgba(139, 92, 246, 0.6);
}

button.dvc-card { cursor: pointer; }
button.dvc-card:hover {
  transform: translateY(-3px);
  border-color: rgba(139, 92, 246, 0.75);
  box-shadow: 0 10px 20px -12px rgba(0, 0, 0, 0.9);
}
.dvc-card.is-picked {
  transform: translateY(-3px);
  border-style: solid;
  border-color: rgba(251, 191, 36, 0.9);
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.7), 0 12px 22px -14px rgba(0, 0, 0, 0.95);
}

/* ------------------------------ 摸牌 / 操作 ------------------------------ */

.dvc-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
  background: var(--surface);
}
.dvc-action[hidden] { display: none; }
.dvc-action-tip { margin: 0; font-size: 12.5px; color: var(--text-dim); text-align: center; }
.dvc-action-tip.is-hot { color: #fcd34d; font-weight: 600; }
.dvc-action-btns { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

.dvc-drawn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.dvc-drawn-label { font-size: 11.5px; color: var(--text-mute); }

.dvc-place {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

/* 插入位按钮：文字用主题前景色，保证深浅两种主题下都看得清 */
.dvc-slot-pick {
  min-width: 58px;
  padding: 8px 15px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
  border: 1px solid rgba(139, 92, 246, 0.7);
  border-radius: 10px;
  background: rgba(139, 92, 246, 0.18);
  cursor: pointer;
  transition: transform .14s, background .14s, border-color .14s;
}
.dvc-slot-pick:hover {
  transform: translateY(-2px);
  border-color: rgba(139, 92, 246, 0.95);
  background: rgba(139, 92, 246, 0.3);
}

/* ------------------------------ 猜测面板 -------------------------------- */

.dvc-guess {
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid rgba(139, 92, 246, 0.4);
  background: rgba(139, 92, 246, 0.08);
  animation: dvc-banner-in .18s ease-out;
}
.dvc-guess[hidden] { display: none; }
.dvc-guess-head {
  margin-bottom: 9px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  color: var(--text);
}
.dvc-guess-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 10px;
}

.dvc-guess-btn {
  padding: 11px 0;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  border: 1px solid var(--border-soft);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: transform .14s, background .14s, border-color .14s;
}
.dvc-guess-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(139, 92, 246, 0.85);
  background: rgba(139, 92, 246, 0.2);
}
.dvc-guess-btn.is-joker { grid-column: span 2; color: #fcd34d; }

/* ------------------------------ 提示与按钮 ------------------------------ */

.dvc-notice {
  padding: 10px 16px;
  font-size: 12.5px;
  text-align: center;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  border: 1px solid var(--border-soft);
  background: var(--surface);
}
.dvc-notice[hidden] { display: none; }
.dvc-notice.is-error {
  color: #fda4af;
  border-color: rgba(251, 113, 133, 0.4);
  background: rgba(251, 113, 133, 0.12);
}

.dvc-controls { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.dvc-controls:empty { display: none; }

/* ------------------------------ 单机交接 -------------------------------- */

.dvc-handoff {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 18px 16px;
  text-align: center;
  border-radius: var(--radius);
  border: 1px dashed rgba(139, 92, 246, 0.45);
  background: rgba(139, 92, 246, 0.08);
}
.dvc-handoff-tip { margin: 0; font-size: 15px; font-weight: 600; color: var(--text); }
.dvc-handoff-sub { margin: 0; font-size: 12px; color: var(--text-mute); }

.dvc-local-top { display: flex; flex-direction: column; gap: 8px; }

/* 人数按钮与「重新开始」同一行，按钮靠右（仅作容器，不加底色） */
.dvc-local-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.dvc-local-bar .pc-field { margin-bottom: 0; }
.dvc-local-bar .btn { margin-left: auto; padding: 9px 18px; }

/* 顶部说明：底色与「游戏规则」面板（details.panel）一致 */
.dvc-local-hint {
  margin: 0;
  padding: 12px 16px;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text-dim);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--surface);
}

.dvc-rules { width: 100%; }

/* ------------------------------- 战报 ----------------------------------- */

.dvc-log {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
  background: var(--surface);
}
.dvc-log-title {
  font-size: 12px;
  color: var(--text-mute);
  letter-spacing: .06em;
  margin-bottom: 2px;
}
.dvc-log-row { font-size: 12.5px; line-height: 1.6; color: var(--text-dim); }
.dvc-log-row b { color: var(--text); font-weight: 600; }
.dvc-log-row.is-empty { color: var(--text-mute); }

/* ------------------------------ 房间座位 -------------------------------- */

.dvc-lobby { width: min(94vw, 620px); }

.room-seat.is-s0 .room-seat-mark { color: #8b5cf6; background: rgba(139, 92, 246, 0.16); }
.room-seat.is-s1 .room-seat-mark { color: #22d3ee; background: rgba(34, 211, 238, 0.16); }
.room-seat.is-s2 .room-seat-mark { color: #fb7185; background: rgba(251, 113, 133, 0.16); }
.room-seat.is-s3 .room-seat-mark { color: #34d399; background: rgba(52, 211, 153, 0.16); }
.room-seat.is-offline { opacity: .55; }

/* ------------------------------ 亮色主题 -------------------------------- */

/* 固定在卡片上的浅色文字，在亮色背景下换成同色系的深色，保证可读 */
body.theme-light .dvc-slot-pick {
  color: #5b21b6;
  border-color: rgba(109, 40, 217, 0.55);
  background: rgba(139, 92, 246, 0.14);
}
body.theme-light .dvc-action-tip.is-hot { color: #b45309; }
body.theme-light .dvc-guess-btn.is-joker { color: #b45309; }
body.theme-light .dvc-score-row.is-win {
  color: #047857;
  border-color: rgba(4, 120, 87, 0.45);
  background: rgba(16, 185, 129, 0.12);
}
body.theme-light .dvc-chip-tag {
  color: #b91c1c;
  border-color: rgba(185, 28, 28, 0.35);
  background: rgba(239, 68, 68, 0.1);
}

/* ------------------------------ 响应式 ---------------------------------- */

@media (max-width: 640px) {
  .dvc { gap: 10px; }
  .dvc-status { padding: 10px 12px; }
  .dvc-row { padding: 9px 12px; }
  .dvc-card { width: 46px; height: 64px; font-size: 20px; }
  .dvc-cards { gap: 7px; }
  .dvc-guess-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .dvc-guess-btn.is-joker { grid-column: span 2; }
  .dvc-place { gap: 8px; }
}
