/* ==========================================================================
   黑白棋（Reversi / Othello）
   ========================================================================== */

/* 统一宽度：模式标签与下方内容列（状态栏 / 棋盘 / 控制区 / 规则）等宽 */
.rvs-app {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 20px;
  width: min(94vw, 620px);
  margin: 0 auto;
}

.rvs {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
}

.rvs-slot:empty { display: none; }

/* ------------------------------ 模式切换 -------------------------------- */

.rvs-tabs {
  display: flex;
  gap: 8px;
  padding: 6px;
  width: 100%;
  border-radius: 16px;
  border: 1px solid var(--border-soft);
  background: var(--surface);
}

.rvs-tab {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 11px 15px;
  font-family: inherit;
  text-align: left;
  color: var(--text-dim);
  border: none;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  transition: color .2s, background .2s, box-shadow .2s;
}
.rvs-tab b { font-size: 14px; color: inherit; }
.rvs-tab small { font-size: 11.5px; color: var(--text-mute); }
.rvs-tab:hover { color: var(--text); background: var(--surface-2); }
.rvs-tab.is-active {
  color: #0a0e1a;
  background: linear-gradient(120deg, #a78bfa, #22d3ee);
  box-shadow: 0 14px 30px -18px rgba(139, 92, 246, 0.95);
}
.rvs-tab.is-active small { color: rgba(10, 14, 26, 0.7); }

.rvs-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

/* ------------------------------ 状态栏 ---------------------------------- */

.rvs-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
  background: var(--surface);
}

.rvs-turn { display: inline-flex; align-items: center; gap: 10px; font-size: 14.5px; font-weight: 600; }

.rvs-turn-stone {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.14);
  transition: background .25s, box-shadow .25s;
}
.rvs-turn-stone.is-black {
  background: radial-gradient(circle at 32% 28%, #6b7280, #111827 62%, #000);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.16);
}
.rvs-turn-stone.is-white {
  background: radial-gradient(circle at 32% 28%, #ffffff, #e6e9f2 58%, #b8bfd0);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
}
.rvs-turn-stone.is-finished { background: rgba(255, 255, 255, 0.08); box-shadow: none; }

.rvs-score { display: inline-flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }

.rvs-score-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-dim);
  transition: color .25s, border-color .25s, background .25s;
}
.rvs-score-item.is-ahead {
  color: var(--text);
  border-color: rgba(139, 92, 246, 0.5);
  background: rgba(139, 92, 246, 0.16);
}
.rvs-score-sep { color: var(--text-mute); font-weight: 700; }

.rvs-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.16);
}
.rvs-dot.is-black { background: radial-gradient(circle at 32% 28%, #7b8494, #141b2b 60%, #04070f); }
.rvs-dot.is-white { background: radial-gradient(circle at 32% 28%, #fff, #e9ecf5 58%, #b6bdcf); }
.rvs-dot.is-empty { background: transparent; border: 1px dashed rgba(255, 255, 255, 0.32); }

/* ------------------------------ 结果横幅 -------------------------------- */

.rvs-banner {
  padding: 16px 18px;
  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: rvs-banner-in .28s cubic-bezier(.2, .8, .3, 1);
}
.rvs-banner[hidden] { display: none; }
.rvs-banner.is-black { border-color: rgba(148, 163, 184, 0.45); }
.rvs-banner.is-white { border-color: rgba(226, 232, 240, 0.4); }
.rvs-banner.is-draw { border-color: rgba(251, 191, 36, 0.4); }

@keyframes rvs-banner-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

.rvs-banner-title { font-size: 18px; font-weight: 700; }
.rvs-banner-detail { margin-top: 6px; font-size: 13px; color: var(--text-dim); }
.rvs-banner-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 14px; }
.rvs-banner-actions:empty { display: none; }

/* ------------------------------- 棋盘 ----------------------------------- */

.rvs-board-wrap { display: grid; place-items: center; }

.rvs-board {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid rgba(0, 0, 0, 0.35);
  background:
    radial-gradient(120% 120% at 18% 0%, rgba(255, 255, 255, 0.16), transparent 55%),
    linear-gradient(155deg, #1f6b4a, #14533a 58%, #0e3f2c);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 26px 54px -26px rgba(0, 0, 0, 0.92);
}

.rvs-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: 100%;
  height: 100%;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.28);
}

.rvs-cell {
  position: relative;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(0, 0, 0, 0.34);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.045), rgba(0, 0, 0, 0.06));
  cursor: default;
  -webkit-tap-highlight-color: transparent;
  transition: background .2s;
}
.rvs-cell:disabled { cursor: default; }
.rvs-cell.can-play { cursor: pointer; }
.rvs-cell.can-play:hover { background: rgba(255, 255, 255, 0.14); }

/* 合法落点提示 */
.rvs-cell.can-play::after {
  content: "";
  position: absolute;
  width: 24%;
  height: 24%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.34);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.28);
  pointer-events: none;
}
.rvs-cell.can-play:hover::after { width: 30%; height: 30%; }

.rvs-disc {
  width: 88%;
  height: 88%;
  border-radius: 50%;
  transform: scale(0);
  transition: transform .18s cubic-bezier(.2, .9, .3, 1.4), background .2s, box-shadow .2s;
}

.rvs-cell.is-black .rvs-disc,
.rvs-cell.is-white .rvs-disc { transform: scale(1); }

.rvs-cell.is-black .rvs-disc {
  background: radial-gradient(circle at 32% 28%, #7b8494, #141b2b 58%, #04070f);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.5);
}
.rvs-cell.is-white .rvs-disc {
  background: radial-gradient(circle at 32% 28%, #ffffff, #e9ecf5 55%, #b6bdcf);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.36);
}

/* 刚落下的子：轻微放大以突出 */
.rvs-cell.is-last .rvs-disc { animation: rvs-drop .3s cubic-bezier(.2, .9, .3, 1.5); }
@keyframes rvs-drop {
  from { transform: scale(0.4); }
  to { transform: scale(1); }
}

/* 本回合被翻转的子：翻面动画 */
.rvs-cell.is-flipped .rvs-disc { animation: rvs-flip .34s ease-out; }
@keyframes rvs-flip {
  from { transform: rotateY(0deg) scale(1); }
  50% { transform: rotateY(90deg) scale(0.92); }
  to { transform: rotateY(0deg) scale(1); }
}

/* ------------------------------- 控制区 --------------------------------- */

.rvs-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}
.rvs-controls:empty { display: none; }

/* ------------------------------ 房间模式 -------------------------------- */

/* 左：创建房间；右：加入房间。两列等宽，同行内等高 */
.rvs-lobby {
  display: grid;
  gap: 18px;
  width: 100%;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
}

/* 大厅顶部提示应横跨整行 */
.rvs-lobby > .rvs-notice { grid-column: 1 / -1; }

.rvs-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));
}
.rvs-card h3 { margin: 0 0 6px; font-size: 16px; }
.rvs-card p.hint { margin: 0 0 16px; font-size: 12.5px; line-height: 1.6; color: var(--text-mute); }

.rvs-field { display: block; margin-bottom: 14px; }
.rvs-field > span { display: block; margin-bottom: 7px; font-size: 12.5px; color: var(--text-dim); }

.rvs-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;
}
.rvs-input:focus { border-color: rgba(139, 92, 246, 0.7); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18); }
.rvs-input::placeholder { color: var(--text-mute); }

.rvs-input.is-room {
  letter-spacing: 0.22em;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
}

.rvs-lobby-actions { display: flex; gap: 10px; margin-top: auto; }
.rvs-lobby-actions .btn { flex: 1 1 auto; }

.rvs-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  padding: 14px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
  background: var(--surface);
}

.rvs-room-code { display: flex; align-items: center; gap: 10px; }
.rvs-room-code small { font-size: 12px; color: var(--text-mute); }
.rvs-room-code b { font-size: 22px; letter-spacing: 0.16em; }

.rvs-seats { display: flex; flex-wrap: wrap; gap: 10px; }

.rvs-seat {
  display: flex;
  align-items: center;
  gap: 8px;
  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);
}
.rvs-seat.is-me { color: var(--text); border-color: rgba(139, 92, 246, 0.45); background: rgba(139, 92, 246, 0.14); }
.rvs-seat.is-offline { opacity: 0.55; }
.rvs-seat.is-empty { opacity: 0.6; }

.rvs-seat-info { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.rvs-seat-info b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rvs-seat-info small { font-size: 11.5px; color: var(--text-mute); }

.rvs-copy { padding: 6px 12px; font-size: 12px; border-radius: 999px; }

.rvs-wait { font-size: 12.5px; color: var(--text-dim); }

.rvs-notice {
  padding: 11px 14px;
  font-size: 13px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(251, 191, 36, 0.32);
  background: rgba(251, 191, 36, 0.1);
  color: #fcd88a;
}
.rvs-notice[hidden] { display: none; }
.rvs-notice.is-error { border-color: rgba(251, 113, 133, 0.4); background: rgba(251, 113, 133, 0.12); color: #fda4af; }

@media (max-width: 640px) {
  .rvs-board { padding: 8px; }
  .rvs-status { flex-direction: column; align-items: flex-start; gap: 10px; }
  /* 窄屏仍保持左创建 / 右加入，收窄间距与内边距以容纳两列 */
  .rvs-lobby { gap: 12px; }
  .rvs-card { padding: 15px; }
}
