/* ============================================================
   gbreeze.cn 站点样式
   深色玻璃拟态 + 移动端优先。纯 CSS 变量，无框架。
   ============================================================ */

:root {
  --bg: #0b1020;
  --bg-soft: #121a33;
  --panel: rgba(22, 30, 54, 0.72);
  --panel-solid: #161e36;
  --border: rgba(120, 150, 220, 0.18);
  --border-strong: rgba(120, 150, 220, 0.34);
  --text: #e8eefc;
  --text-dim: #9aa8c7;
  --text-mute: #6b7897;
  --accent: #5b8cff;
  --accent-2: #3ddc97;
  --warn: #ffc857;
  --danger: #ff6b8b;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --font: system-ui, -apple-system, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --mono: ui-monospace, 'Cascadia Code', Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(1100px 600px at 12% -8%, rgba(91, 140, 255, 0.18), transparent 62%),
    radial-gradient(900px 520px at 92% 4%, rgba(61, 220, 151, 0.12), transparent 58%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

h1,
h2,
h3 {
  margin: 0 0 0.4em;
  line-height: 1.25;
  font-weight: 650;
}
h1 {
  font-size: 1.6rem;
}
h2 {
  font-size: 1.25rem;
}
h3 {
  font-size: 0.95rem;
  color: var(--text-dim);
  text-transform: none;
  letter-spacing: 0.02em;
}

p {
  margin: 0 0 0.7em;
}

.muted {
  color: var(--text-dim);
}
.hint {
  color: var(--text-mute);
  font-size: 0.85rem;
}
.grow {
  flex: 1;
}
.inline {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ------------------------------- 按钮 ------------------------------- */

.btn {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform 0.08s ease, background 0.16s ease, border-color 0.16s ease;
  white-space: nowrap;
}
.btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.09);
  border-color: var(--accent);
}
.btn:active:not(:disabled) {
  transform: translateY(1px);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn-primary {
  background: linear-gradient(180deg, #6b97ff, #4b7bf0);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(75, 123, 240, 0.34);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #7ba3ff, #5785f5);
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-dim);
}
.btn-ghost:hover:not(:disabled) {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}
.btn-mini {
  padding: 5px 11px;
  font-size: 0.82rem;
}
.btn-lg {
  padding: 13px 30px;
  font-size: 1rem;
}

/* ------------------------------ 输入框 ------------------------------ */

input,
select,
textarea {
  font: inherit;
  color: var(--text);
  background: rgba(8, 13, 28, 0.7);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  outline: none;
  transition: border-color 0.16s ease;
  min-width: 0;
}
input:focus,
select:focus {
  border-color: var(--accent);
}
input::placeholder {
  color: var(--text-mute);
}
.nick-input {
  width: 170px;
}
.code-input {
  width: 110px;
  text-transform: uppercase;
  font-family: var(--mono);
  letter-spacing: 0.14em;
  text-align: center;
}

/* ------------------------------ 顶栏 ------------------------------ */

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(11, 16, 32, 0.72);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 40;
}
.brand {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  letter-spacing: -0.01em;
}
.brand span {
  color: var(--accent);
}
.brand:hover {
  text-decoration: none;
}
.crumb {
  color: var(--text-dim);
  font-size: 0.9rem;
  padding-left: 12px;
  border-left: 1px solid var(--border);
}
.conn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-mute);
}
.conn-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-mute);
  display: inline-block;
}
.conn-dot.on {
  background: var(--accent-2);
  box-shadow: 0 0 8px var(--accent-2);
}

/* ------------------------------ 面板 ------------------------------ */

.panel,
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

/* ============================== 首页 ============================== */

.hero {
  max-width: 1080px;
  margin: 0 auto;
  padding: 54px 20px 26px;
  text-align: center;
}
.hero h1 {
  font-size: clamp(1.9rem, 5.4vw, 3rem);
  letter-spacing: -0.02em;
  margin-bottom: 12px;
  background: linear-gradient(180deg, #ffffff, #a9bcf0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero .lead {
  color: var(--text-dim);
  max-width: 620px;
  margin: 0 auto 22px;
  font-size: 1.02rem;
}
.hero-badges {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.badge {
  font-size: 0.78rem;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
  background: rgba(255, 255, 255, 0.03);
}

.section {
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px 20px 40px;
}
.section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
}
.section-head h2 {
  margin: 0;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 16px;
}
.game-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: transform 0.14s ease, border-color 0.16s ease, box-shadow 0.16s ease;
  color: inherit;
}
.game-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 14px 34px rgba(75, 123, 240, 0.24);
  text-decoration: none;
}
.game-card .gc-icon {
  font-size: 1.9rem;
  line-height: 1;
}
.game-card .gc-name {
  font-weight: 650;
  font-size: 1.06rem;
}
.game-card .gc-desc {
  color: var(--text-dim);
  font-size: 0.88rem;
  flex: 1;
}
.game-card .gc-foot {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: var(--text-mute);
}
.pill {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 0.74rem;
}
.pill.online-count {
  color: var(--accent-2);
  border-color: rgba(61, 220, 151, 0.4);
}

.site-foot {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 20px 46px;
  color: var(--text-mute);
  font-size: 0.84rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: space-between;
}

/* ============================ 游戏页外壳 ============================ */

.game-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.game-body {
  flex: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 20px 44px;
}

.setup-panel,
.wait-panel {
  max-width: 560px;
  margin: 0 auto;
  padding: 26px;
}
.setup-head {
  text-align: center;
  margin-bottom: 18px;
}
.setup-head p {
  margin: 0;
}

.mode-tabs {
  display: flex;
  gap: 8px;
  padding: 5px;
  background: rgba(8, 13, 28, 0.6);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 20px;
}
.mode-tab {
  flex: 1;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  padding: 9px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}
.mode-tab.active {
  background: rgba(91, 140, 255, 0.2);
  color: var(--text);
  font-weight: 600;
}

.opt-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 16px 0 20px;
}
.opt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.opt-label {
  color: var(--text-dim);
  font-size: 0.9rem;
  flex-shrink: 0;
}
.opt-row select,
.opt-row input[type='number'] {
  min-width: 140px;
}
.opt-toggle input {
  width: 42px;
  height: 24px;
  accent-color: var(--accent);
}

/* 多行文本项（例如抽奖的奖项列表）：标签在上、输入框占满整行 */
.opt-row.opt-col {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.opt-row textarea {
  width: 100%;
  min-height: 84px;
  resize: vertical;
  line-height: 1.5;
  font-family: var(--mono);
  font-size: 0.86rem;
}
.setup-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
}
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-mute);
  font-size: 0.82rem;
  margin: 20px 0;
}
.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.room-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 14px 0 8px;
  color: var(--text-dim);
  font-size: 0.88rem;
}
.room-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 230px;
  overflow-y: auto;
}
.room-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(8, 13, 28, 0.45);
}
.room-item-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.room-code {
  font-family: var(--mono);
  letter-spacing: 0.12em;
  color: var(--accent);
}

/* ---------------------------- 等待室 ---------------------------- */

.wait-head {
  text-align: center;
}
.room-code-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px;
  margin: 16px 0;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: rgba(8, 13, 28, 0.4);
}
.big-code {
  font-family: var(--mono);
  font-size: 1.7rem;
  letter-spacing: 0.2em;
  color: var(--accent);
}
.wait-players {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0;
}
.wait-player {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(8, 13, 28, 0.45);
}
.seat-badge {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(91, 140, 255, 0.22);
  color: var(--accent);
  font-size: 0.76rem;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.wait-player .pname {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tag {
  font-size: 0.74rem;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-mute);
  white-space: nowrap;
}
.tag.ok {
  color: var(--accent-2);
  border-color: rgba(61, 220, 151, 0.42);
}
.tag.warn {
  color: var(--warn);
  border-color: rgba(255, 200, 87, 0.42);
}
.tag.bot {
  color: var(--accent);
  border-color: rgba(91, 140, 255, 0.42);
}
.wait-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 8px;
}
.wait-chat {
  margin-top: 20px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

/* ---------------------------- 对局布局 ---------------------------- */

.play-grid {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 18px;
  align-items: start;
}
.play-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.side-block {
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.side-block h3 {
  margin: 0 0 10px;
}
.player-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.player-card {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(8, 13, 28, 0.45);
  transition: border-color 0.16s ease, background 0.16s ease;
}
.player-card.active {
  border-color: var(--accent);
  background: rgba(91, 140, 255, 0.14);
}
.player-card.me .pname {
  font-weight: 650;
}
.player-card .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.player-card .pname {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9rem;
}
.player-card .pextra {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-family: var(--mono);
  white-space: nowrap;
}
.player-card.offline {
  opacity: 0.5;
}

.chat-block {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.chat-log {
  flex: 1;
  min-height: 120px;
  max-height: 230px;
  overflow-y: auto;
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}
.chat-line {
  color: var(--text-dim);
  word-break: break-word;
}
.chat-line b {
  color: var(--text);
  font-weight: 600;
}
.chat-line.mine b {
  color: var(--accent);
}
.chat-line.system {
  color: var(--text-mute);
  font-style: italic;
  font-size: 0.8rem;
}
.chat-input-row {
  display: flex;
  gap: 8px;
}
.chat-input-row input {
  flex: 1;
}

.play-board {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.hud-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 46px;
}
.hud {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
}
.hud-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.turn-text {
  font-size: 0.92rem;
  color: var(--text-dim);
}
.turn-text.mine {
  color: var(--accent-2);
  font-weight: 650;
}
.turn-text.mine::before {
  content: '▶ ';
}
.room-tag {
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--text-mute);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px;
}
.countdown {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--text-dim);
  min-width: 34px;
  text-align: right;
}
.countdown.urgent {
  color: var(--danger);
  font-weight: 700;
}

.stage {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  overflow: auto;
}
.controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  min-height: 0;
}
.controls:empty {
  display: none;
}
.stage-note {
  color: var(--text-dim);
  font-size: 0.9rem;
  text-align: center;
}

/* 通用棋盘元素（各游戏复用） */
.board-canvas {
  display: block;
  max-width: 100%;
  height: auto;
  touch-action: manipulation;
  border-radius: 8px;
}
.board-svg {
  display: block;
  max-width: 100%;
  height: auto;
  touch-action: manipulation;
}
.seat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-dim);
}
.seat-chip i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

/* ---------------------------- 结算浮层 ---------------------------- */

.overlay-host {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
}
.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(6, 10, 22, 0.68);
  backdrop-filter: blur(6px);
  pointer-events: auto;
  animation: fade-in 0.22s ease;
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.overlay-card {
  width: min(92vw, 360px);
  padding: 30px 26px;
  text-align: center;
  background: var(--panel-solid);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  animation: pop-in 0.26s cubic-bezier(0.2, 1.3, 0.4, 1);
}
@keyframes pop-in {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}
.overlay-emoji {
  font-size: 2.6rem;
  line-height: 1;
  margin-bottom: 8px;
}
.overlay-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 18px;
  flex-wrap: wrap;
}

/* ------------------------------ Toast ------------------------------ */

.toast-host {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  padding: 9px 18px;
  border-radius: 999px;
  background: rgba(22, 30, 54, 0.96);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  font-size: 0.88rem;
  animation: toast-in 0.2s ease;
  max-width: 88vw;
}
@keyframes toast-in {
  from {
    transform: translateY(-10px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
.toast-out {
  opacity: 0;
  transition: opacity 0.24s ease;
}
.toast-ok {
  border-color: rgba(61, 220, 151, 0.5);
  color: #b6f5d8;
}
.toast-error {
  border-color: rgba(255, 107, 139, 0.5);
  color: #ffc3ce;
}
.toast-warn {
  border-color: rgba(255, 200, 87, 0.5);
  color: #ffe6b0;
}

/* ---------------------------- 观战席 ---------------------------- */

.player-list.spectator-list {
  gap: 6px;
}

.player-card {
  flex-wrap: wrap;
}

.player-card.spectator {
  opacity: 0.85;
  border-style: dashed;
}

.player-card.spectator .dot {
  background: #4a5570 !important;
}

.player-card .btn-mini {
  margin-left: auto;
  flex-shrink: 0;
}

/* 等待室里的观战席 */
.wait-spectators {
  margin: 14px 0 4px;
  padding: 12px 14px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: rgba(8, 13, 28, 0.35);
}

.wait-spectators p {
  margin: 0 0 8px;
  font-size: 0.85rem;
}

.spec-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.spec-chip {
  font-size: 0.8rem;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.03);
}

.spec-chip.me {
  color: var(--accent);
  border-color: rgba(91, 140, 255, 0.45);
}

/* 等待室里的房间设置（房主可改） */
.wait-settings {
  margin: 14px 0 4px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(8, 13, 28, 0.35);
}

.wait-settings > button {
  display: block;
  width: 100%;
  text-align: left;
}

.wait-settings-body {
  margin-top: 10px;
}

.wait-settings-body .opt-form {
  margin: 8px 0 12px;
}

.wait-settings textarea,
.wait-settings input[type='text'] {
  width: 100%;
  min-width: 180px;
}

/* ---------------------------- 响应式 ---------------------------- */

@media (max-width: 880px) {
  .play-grid {
    grid-template-columns: 1fr;
  }
  .play-side {
    order: 2;
  }
  .side-block.chat-block .chat-log {
    max-height: 130px;
  }
  .topbar {
    padding: 10px 14px;
  }
  .crumb {
    font-size: 0.84rem;
  }
  .game-body {
    padding: 16px 12px 36px;
  }
  .stage {
    padding: 10px;
    min-height: 260px;
  }
  .hero {
    padding: 34px 16px 18px;
  }
  .section {
    padding: 10px 16px 30px;
  }
}

@media (max-width: 560px) {
  .setup-panel,
  .wait-panel {
    padding: 18px;
  }
  .opt-row {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
  .opt-row select,
  .opt-row input[type='number'] {
    width: 100%;
  }
  .game-grid {
    grid-template-columns: 1fr;
  }
  .room-code-box {
    flex-wrap: wrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
