/* ==========================================================================
   跳棋
   ========================================================================== */

.tq-app {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

/* 统一宽度：与上方 .mode-tabs（min(94vw, 620px)）等宽 */
.tq {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: min(94vw, 620px);
}

.tq-slot,
.tq-status,
.tq-banner,
.tq-notice,
.tq-controls { width: 100%; }

.tq-slot:empty { display: none; }

/* 六方配色（与 rules.js 的 COLORS 一一对应） */
.tq-piece.is-red, .tq-hull.is-red, .tq-score-chip.is-red .dot { --tq: #f9738c; --tq-deep: #be123c; }
.tq-piece.is-blue, .tq-hull.is-blue, .tq-score-chip.is-blue .dot { --tq: #5aa9ff; --tq-deep: #1d4ed8; }
.tq-piece.is-amber, .tq-hull.is-amber, .tq-score-chip.is-amber .dot { --tq: #f5b942; --tq-deep: #b45309; }
.tq-piece.is-green, .tq-hull.is-green, .tq-score-chip.is-green .dot { --tq: #4ade80; --tq-deep: #15803d; }
.tq-piece.is-violet, .tq-hull.is-violet, .tq-score-chip.is-violet .dot { --tq: #c084fc; --tq-deep: #7e22ce; }
.tq-piece.is-orange, .tq-hull.is-orange, .tq-score-chip.is-orange .dot { --tq: #fb923c; --tq-deep: #c2410c; }

/* 人数选择沿用平台公共控件（.pc-field / .pc-btn，见 main.css），这里只补布局 */
.tq-slot > .pc-field { width: 100%; justify-content: center; }

/* ------------------------------ 状态栏 ---------------------------------- */

.tq-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
  background: var(--surface);
}

.tq-turn {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--text-dim);
}

.tq-turn-dot {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  transition: background .25s, box-shadow .25s;
}
.tq-turn-dot.is-red { background: #f9738c; box-shadow: 0 0 0 3px rgba(249, 115, 140, 0.22); }
.tq-turn-dot.is-blue { background: #5aa9ff; box-shadow: 0 0 0 3px rgba(90, 169, 255, 0.22); }
.tq-turn-dot.is-amber { background: #f5b942; box-shadow: 0 0 0 3px rgba(245, 185, 66, 0.22); }
.tq-turn-dot.is-green { background: #4ade80; box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.22); }
.tq-turn-dot.is-violet { background: #c084fc; box-shadow: 0 0 0 3px rgba(192, 132, 252, 0.22); }
.tq-turn-dot.is-orange { background: #fb923c; box-shadow: 0 0 0 3px rgba(251, 146, 60, 0.22); }

.tq-score { display: flex; flex-wrap: wrap; gap: 8px; }

.tq-score-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  font-size: 12px;
  border-radius: 999px;
  color: var(--text-mute);
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.03);
  transition: color .2s, border-color .2s, background .2s;
}
.tq-score-chip .dot { width: 9px; height: 9px; border-radius: 50%; background: rgba(255, 255, 255, 0.16); }
.tq-score-chip b { font-size: 12px; font-variant-numeric: tabular-nums; }
.tq-score-chip.is-active {
  color: var(--text);
  border-color: rgba(139, 92, 246, 0.5);
  background: rgba(139, 92, 246, 0.14);
}

/* ------------------------------ 结果横幅 -------------------------------- */

.tq-banner {
  padding: 16px 20px;
  text-align: center;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  animation: tq-pop .34s cubic-bezier(.2, .8, .3, 1);
}
.tq-banner[hidden] { display: none; }

.tq-banner-title { font-size: 19px; font-weight: 700; color: #c4b5fd; }
.tq-banner-detail { margin-top: 6px; font-size: 12.5px; color: var(--text-dim); }
.tq-banner-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; margin-top: 13px; }
.tq-banner-actions:empty { display: none; }

@keyframes tq-pop {
  from { opacity: 0; transform: translateY(-8px) scale(.985); }
  to { opacity: 1; transform: none; }
}

/* ------------------------------- 提示 ----------------------------------- */

.tq-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);
}
.tq-notice[hidden] { display: none; }
.tq-notice.is-error {
  color: #fda4af;
  border-color: rgba(251, 113, 133, 0.4);
  background: rgba(251, 113, 133, 0.12);
}

/* ------------------------------- 棋盘 ----------------------------------- */

.tq-board-wrap { display: grid; place-items: center; width: 100%; }

.tq-board {
  position: relative;
  width: min(94vw, 620px);
  border-radius: 20px;
  border: 1px solid rgba(120, 108, 168, 0.32);
  background:
    radial-gradient(120% 120% at 18% 0%, rgba(255, 255, 255, 0.07), transparent 55%),
    radial-gradient(100% 100% at 50% 50%, #1a1f36 0%, #12162a 62%, #0c0f1e 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 26px 54px -26px rgba(0, 0, 0, 0.95);
  overflow: hidden;
}

/* 棋盘底衬：六个营区 */
.tq-hulls { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

.tq-hull {
  fill: rgba(255, 255, 255, 0.035);
  stroke: rgba(255, 255, 255, 0.10);
  stroke-width: 0.12;
  stroke-linejoin: round;
  transition: fill .3s, stroke .3s, stroke-opacity .3s;
}
.tq-hull.is-idle { fill: rgba(255, 255, 255, 0.03); }
.tq-hull.is-red { fill: rgba(249, 115, 140, 0.16); stroke: rgba(249, 115, 140, 0.55); }
.tq-hull.is-blue { fill: rgba(90, 169, 255, 0.16); stroke: rgba(90, 169, 255, 0.55); }
.tq-hull.is-amber { fill: rgba(245, 185, 66, 0.16); stroke: rgba(245, 185, 66, 0.55); }
.tq-hull.is-green { fill: rgba(74, 222, 128, 0.16); stroke: rgba(74, 222, 128, 0.55); }
.tq-hull.is-violet { fill: rgba(192, 132, 252, 0.16); stroke: rgba(192, 132, 252, 0.55); }
.tq-hull.is-orange { fill: rgba(251, 146, 60, 0.16); stroke: rgba(251, 146, 60, 0.55); }

.tq-hull.is-mine { stroke-width: 0.2; }
.tq-hull.is-aim {
  fill-opacity: 0.5;
  stroke-dasharray: 0.42 0.34;
  animation: tq-aim 2.4s linear infinite;
}

@keyframes tq-aim {
  to { stroke-dashoffset: -1.52; }
}

/* 121 个棋位 */
.tq-cells, .tq-marks, .tq-pieces { position: absolute; inset: 0; pointer-events: none; }

.tq-cell {
  position: absolute;
  width: 2.4%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.10);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  transition: background .25s, box-shadow .25s;
}
.tq-cell.is-camp { background: rgba(255, 255, 255, 0.16); }
.tq-cell.is-movable { background: rgba(196, 181, 253, 0.55); }
.tq-cell.is-selected {
  background: #ddd6fe;
  box-shadow: 0 0 0 3px rgba(196, 181, 253, 0.35);
}
.tq-cell.is-last {
  background: #fbbf24;
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.3);
}

/* 落点提示 */
.tq-mark {
  position: absolute;
  width: 6.4%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  cursor: pointer;
  pointer-events: auto;
  z-index: 4;
  border: 2px solid rgba(255, 255, 255, 0.85);
  background: radial-gradient(circle at 34% 30%, rgba(134, 239, 172, 0.95), rgba(22, 163, 74, 0.85) 74%);
  box-shadow: 0 0 14px -2px rgba(34, 197, 94, 0.85);
  animation: tq-mark-pulse 1.1s ease-in-out infinite;
}
.tq-mark.is-jump {
  background: radial-gradient(circle at 34% 30%, rgba(253, 224, 71, 0.95), rgba(217, 119, 6, 0.88) 74%);
  box-shadow: 0 0 14px -2px rgba(251, 191, 36, 0.9);
}
.tq-mark:hover { transform: translate(-50%, -50%) scale(1.16); }

@keyframes tq-mark-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.55); }
  50% { box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.06); }
}

/* 棋子 */
.tq-piece {
  position: absolute;
  width: 5.8%;
  aspect-ratio: 1 / 1;
  padding: 0;
  border: 0;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  cursor: default;
  pointer-events: auto;
  z-index: 3;
  background: radial-gradient(circle at 32% 28%, #ffffff, var(--tq) 46%, var(--tq-deep) 100%);
  box-shadow:
    0 2px 5px rgba(0, 0, 0, 0.45),
    inset 0 0 0 1.5px rgba(255, 255, 255, 0.75);
  transition:
    left .3s cubic-bezier(.3, .9, .3, 1),
    top .3s cubic-bezier(.3, .9, .3, 1),
    transform .18s,
    box-shadow .2s;
}
.tq-piece[hidden] { display: none; }

.tq-piece.is-movable {
  cursor: pointer;
  z-index: 6;
  animation: tq-piece-pulse 1.05s ease-in-out infinite;
}
.tq-piece.is-movable:hover { transform: translate(-50%, -50%) scale(1.18); }

@keyframes tq-piece-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.9), 0 2px 5px rgba(0, 0, 0, 0.45); }
  50% { box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.13), 0 2px 5px rgba(0, 0, 0, 0.45); }
}

.tq-piece.is-selected {
  z-index: 7;
  animation: none;
  box-shadow:
    0 0 0 3px #ddd6fe,
    0 0 16px rgba(196, 181, 253, 0.9),
    0 2px 5px rgba(0, 0, 0, 0.45);
}
.tq-piece.is-last {
  box-shadow:
    0 0 0 2px #fbbf24,
    0 0 12px rgba(251, 191, 36, 0.85),
    0 2px 5px rgba(0, 0, 0, 0.45);
}

/* ------------------------------- 控制区 --------------------------------- */

.tq-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}
.tq-controls:empty { display: none; }

/* ------------------------------ 房间模式 -------------------------------- */

.tq-lobby {
  display: grid;
  gap: 18px;
  width: min(94vw, 620px);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
}
.tq-lobby > .tq-notice { grid-column: 1 / -1; }

.tq-card {
  display: flex;
  flex-direction: column;
  padding: 22px;
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02));
}
.tq-card h3 { margin: 0 0 6px; font-size: 16px; }
.tq-card p.hint { margin: 0 0 16px; font-size: 12.5px; line-height: 1.6; color: var(--text-mute); }

.tq-field { display: block; margin-bottom: 14px; }
.tq-field > span { display: block; margin-bottom: 7px; font-size: 12.5px; color: var(--text-dim); }

.tq-input {
  width: 100%;
  padding: 11px 14px;
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(6, 9, 18, 0.55);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.tq-input:focus { border-color: rgba(139, 92, 246, 0.7); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18); }
.tq-input::placeholder { color: var(--text-mute); }
.tq-input.is-room { letter-spacing: 0.22em; text-align: center; font-size: 20px; font-weight: 700; }

.tq-lobby-actions { display: flex; gap: 10px; margin-top: auto; }
.tq-lobby-actions .btn { flex: 1 1 auto; }

.tq-room-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

.tq-room-code { display: flex; align-items: center; gap: 10px; }
.tq-room-code small { font-size: 12px; color: var(--text-mute); }
.tq-room-code b { font-size: 22px; letter-spacing: 0.16em; font-variant-numeric: tabular-nums; }
.tq-copy { padding: 6px 12px; font-size: 12px; border-radius: 999px; }
.tq-wait { font-size: 12.5px; color: var(--text-mute); }

.tq-seats { display: flex; flex-wrap: wrap; gap: 10px; }

.tq-seat {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 14px;
  font-size: 13px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-dim);
}
.tq-seat .dot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; --tq: rgba(255, 255, 255, 0.16); background: var(--tq); }
.tq-seat.is-red { --tq: #f9738c; }
.tq-seat.is-blue { --tq: #5aa9ff; }
.tq-seat.is-amber { --tq: #f5b942; }
.tq-seat.is-green { --tq: #4ade80; }
.tq-seat.is-violet { --tq: #c084fc; }
.tq-seat.is-orange { --tq: #fb923c; }
.tq-seat.is-active { color: var(--text); border-color: rgba(139, 92, 246, 0.5); background: rgba(139, 92, 246, 0.12); }
.tq-seat.is-me { box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.5); }
.tq-seat.is-offline { opacity: 0.55; }

.tq-seat-info { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.tq-seat-info b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 8em; }
.tq-seat-info small { font-size: 11.5px; color: var(--text-mute); }

/* ------------------------------ 响应式 ---------------------------------- */

@media (max-width: 640px) {
  .tq-status { padding: 10px 13px; }
  .tq-lobby { gap: 12px; }
  .tq-card { padding: 15px; }
  .tq-room-bar { flex-direction: column; align-items: flex-start; }
  .tq-seat-info b { max-width: 6em; }
}
