/* ==========================================================================
   国际跳棋 · 样式
   ========================================================================== */

/* 统一布局：模式按钮（共用 .mode-tabs，宽 min(94vw, 620px)）居中，内容列等宽 */
.gtq-app {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.gtq {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(94vw, 620px);
}

.gtq-slot { display: block; }
.gtq-slot:empty { display: none; }

/* ------------------------------ 状态栏 ------------------------------ */

.gtq-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.gtq-turn {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  font-weight: 600;
}

.gtq-turn-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.1);
  background: #e5e7eb;
}
.gtq-turn-dot.is-white { background: #f5f5f4; border-color: rgba(0, 0, 0, 0.3); }
.gtq-turn-dot.is-black { background: #1f2937; border-color: rgba(255, 255, 255, 0.3); }
.gtq-turn-dot.is-idle { background: #e5e7eb; }

.gtq-turn-text.is-finished { color: #16a34a; }

.gtq-meta {
  font-size: 0.875rem;
  color: #6b7280;
  white-space: nowrap;
}

/* ------------------------------ 横幅 ------------------------------ */

.gtq-banner {
  border-radius: 10px;
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(22, 163, 74, 0.12), rgba(59, 130, 246, 0.12));
  border: 1px solid rgba(22, 163, 74, 0.3);
}
.gtq-banner-title { font-size: 1.1rem; font-weight: 700; color: #166534; }
.gtq-banner-detail { font-size: 0.875rem; color: #475569; margin-top: 4px; }
.gtq-banner-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

.gtq-wait { font-size: 0.875rem; color: #64748b; align-self: center; }

/* ------------------------------ 提示 ------------------------------ */

.gtq-notice {
  width: 100%;
  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);
}
.gtq-notice.is-error {
  color: #fda4af;
  border-color: rgba(251, 113, 133, 0.4);
  background: rgba(251, 113, 133, 0.12);
}
.gtq-notice:empty { display: none; }

/* ------------------------------ 棋盘 ------------------------------ */

.gtq-board-wrap {
  display: flex;
  justify-content: center;
  padding: 8px 0;
}

.gtq-board {
  position: relative;
  width: 100%;
  max-width: 560px;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  background: #f5e6c8;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
  user-select: none;
}

.gtq-grid {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  grid-template-rows: repeat(10, 1fr);
}

.gtq-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}
.gtq-cell.is-playable {
  background: #8b5a2b;
  cursor: pointer;
}
.gtq-cell.is-light {
  background: #f5e6c8;
}
.gtq-cell.is-light-bg {
  background: #f5e6c8;
}

.gtq-cell::before {
  content: '';
  position: absolute;
  inset: 0;
}

.gtq-cell.is-selected::before { background: rgba(255, 235, 59, 0.35); }
.gtq-cell.is-target::before { background: rgba(34, 197, 94, 0.35); }
.gtq-cell.is-from::before { background: rgba(96, 165, 250, 0.25); }
.gtq-cell.is-capture::before { background: rgba(244, 67, 54, 0.4); }
.gtq-cell.is-path::before { background: rgba(147, 51, 234, 0.2); }
.gtq-cell.is-path-active::before { background: rgba(147, 51, 234, 0.35); }
.gtq-cell.is-lastmove::before { background: rgba(250, 204, 21, 0.25); }

/* 棋子：用「::after」画圆，王棋叠加王冠符号 */
.gtq-cell::after {
  content: '';
  position: relative;
  width: 78%;
  height: 78%;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  transition: transform 0.1s ease;
}
.gtq-cell.is-white::after {
  background: radial-gradient(circle at 30% 30%, #fff, #e5e5e5 60%, #c7c7c7);
  border: 1.5px solid rgba(0, 0, 0, 0.35);
}
.gtq-cell.is-black::after {
  background: radial-gradient(circle at 30% 30%, #4b5563, #1f2937 60%, #0b0f16);
  border: 1.5px solid rgba(255, 255, 255, 0.25);
}
.gtq-cell.is-king::after {
  background-image:
    linear-gradient(135deg, rgba(255, 215, 0, 0.9), rgba(255, 215, 0, 0.5) 50%, rgba(255, 215, 0, 0.9));
}
.gtq-cell.is-king.is-white::after {
  background-image:
    linear-gradient(135deg, rgba(255, 215, 0, 0.95), rgba(255, 235, 140, 0.6) 50%, rgba(255, 215, 0, 0.95));
}
.gtq-cell.is-king::after {
  /* 王冠装饰：用内嵌文字 */
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9em;
  font-weight: 700;
  color: #b8860b;
}
.gtq-cell.is-king.is-black::after {
  color: #fde047;
}

/* 王冠内容：用 JS 层填入「王」字更稳，这里用 CSS 伪元素兜底 */
.gtq-cell.is-king.is-white::before,
.gtq-cell.is-king.is-black::before {
  content: '♛';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6em;
  z-index: 2;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
.gtq-cell.is-king.is-white::before { color: #a16207; }
.gtq-cell.is-king.is-black::before { color: #fde047; }

.gtq-cell.is-dim::after { opacity: 0.35; }

.gtq-axis {
  position: absolute;
  pointer-events: none;
  font-size: 0.65rem;
  color: rgba(0, 0, 0, 0.35);
}
.gtq-axis-cols {
  bottom: -1.4em;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  text-align: center;
}
.gtq-axis-rows {
  left: -1.8em;
  top: 0;
  bottom: 0;
  display: grid;
  grid-template-rows: repeat(10, 1fr);
  align-items: center;
  justify-items: center;
}

/* ------------------------------ 控制 / 大厅 ------------------------------ */

.gtq-controls { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

.gtq-lobby {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  width: min(94vw, 620px);
  align-items: stretch;
}
.gtq-lobby > .gtq-notice { grid-column: 1 / -1; }

.gtq-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));
}
.gtq-card h3 { margin: 0 0 6px; font-size: 16px; }
.gtq-card .hint { margin: 0 0 16px; font-size: 12.5px; line-height: 1.6; color: var(--text-mute); }
.gtq-field { display: block; margin-bottom: 14px; }
.gtq-field > span { display: block; margin-bottom: 7px; font-size: 12.5px; color: var(--text-dim); }
.gtq-input {
  width: 100%;
  box-sizing: border-box;
  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;
}
.gtq-input:focus { border-color: rgba(139, 92, 246, 0.7); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18); }
.gtq-input::placeholder { color: var(--text-mute); }
.gtq-input.is-room { letter-spacing: 0.22em; text-align: center; font-size: 20px; font-weight: 700; }
.gtq-lobby-actions { display: flex; gap: 10px; margin-top: auto; }
.gtq-lobby-actions .btn { flex: 1 1 auto; }

/* ------------------------------ 房间座位条 ------------------------------ */

.gtq-room-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}
.gtq-room-code { display: flex; align-items: center; gap: 10px; }
.gtq-room-code small { font-size: 12px; color: var(--text-mute); }
.gtq-room-code b { font-size: 22px; letter-spacing: 0.16em; font-variant-numeric: tabular-nums; }
.gtq-copy { padding: 6px 12px; font-size: 12px; border-radius: 999px; }

.gtq-wait { font-size: 12.5px; color: var(--text-mute); }

.gtq-seats { display: flex; flex-wrap: wrap; gap: 10px; }

.gtq-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);
}
.gtq-seat-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.16);
}
.gtq-seat.is-white .gtq-seat-dot { background: #f5f5f4; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.3); }
.gtq-seat.is-black .gtq-seat-dot { background: #1f2937; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4); }
.gtq-seat.is-active { color: var(--text); border-color: rgba(139, 92, 246, 0.5); background: rgba(139, 92, 246, 0.12); }
.gtq-seat.is-me { box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.5); }
.gtq-seat.is-offline { opacity: 0.55; }

.gtq-seat-info { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.gtq-seat-info b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 8em; }
.gtq-seat-info small { font-size: 11.5px; color: var(--text-mute); }

/* ------------------------------ 规则说明 ------------------------------ */

.gtq-rules .panel-body { font-size: 0.9rem; line-height: 1.7; color: #374151; }
.gtq-rules h4 { margin: 12px 0 4px; font-size: 0.95rem; color: #111827; }
.gtq-rules h4:first-child { margin-top: 0; }
.gtq-rules ul { margin: 4px 0 8px 20px; padding: 0; }
.gtq-rules li { margin-bottom: 4px; }

/* ------------------------------ 窄屏适配 ------------------------------ */

@media (max-width: 640px) {
  .gtq-lobby { gap: 12px; }
  .gtq-card { padding: 15px; }
  .gtq-room-bar { flex-direction: column; align-items: flex-start; }
  .gtq-seat-info b { max-width: 6em; }
}

@media (max-width: 480px) {
  .gtq-board { max-width: 100%; }
  .gtq-cell.is-king.is-white::before,
  .gtq-cell.is-king.is-black::before { font-size: 1.2em; }
  .gtq-status { font-size: 0.9rem; }
  .gtq-meta { font-size: 0.8rem; }
}