/* ===== Unified modern theme ===== */

/* --- Header / module bar --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  padding-top: 12px;
}

.module-bar {
  margin-bottom: 14px;
  border: 1px solid rgba(75, 141, 185, 0.13);
  border-radius: var(--radius-lg);
  background: rgba(251, 253, 255, 0.92);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(14px);
}

.module-brand {
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #f0a83b, #d97706);
  color: #241303;
}

.module-current {
  border-color: var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--brand-dark);
}

.module-nav a,
.module-nav span {
  border-color: var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
}

.module-nav .active {
  border-color: rgba(75, 141, 185, 0.35);
  background: #e7f3fb;
  color: var(--brand-dark);
}

.stealth-nav button,
.mode-chip {
  border-color: var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--muted);
}

.mode-chip {
  border-color: rgba(75, 141, 185, 0.22);
  background: #e7f3fb;
  color: var(--brand-dark);
}

/* --- Section heads (hero, toolbox-head, community-head) --- */
.section-head,
.toolbox-head,
.community-head {
  position: relative;
  overflow: hidden;
  grid-template-columns: minmax(0, 1fr) minmax(390px, 440px);
  gap: 20px;
  padding: 24px;
  border: 1px solid rgba(75, 141, 185, 0.13);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, #ffffff 0%, #eef6fb 60%, #f7fbfd 100%);
  box-shadow: var(--shadow);
}

.section-head::after,
.toolbox-head::after,
.community-head::after {
  content: "";
  position: absolute;
  inset: auto -60px -60px auto;
  width: 280px;
  height: 140px;
  border: 1px solid rgba(75, 141, 185, 0.08);
  transform: rotate(-8deg);
  background: repeating-linear-gradient(
    90deg,
    rgba(75, 141, 185, 0.04) 0 1px,
    transparent 1px 14px
  );
  pointer-events: none;
}

.section-head > *,
.toolbox-head > *,
.community-head > * {
  position: relative;
  z-index: 1;
}

.section-kicker {
  margin-bottom: 10px;
  color: var(--brand);
  letter-spacing: 0.12em;
}

.fish-console h1 {
  max-width: 760px;
  color: var(--ink);
}

.section-copy {
  max-width: 760px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 15px;
}

.fish-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 14px;
}

.fish-actions button {
  min-width: 0;
  min-height: 88px;
  padding: 14px;
  border: 1px solid rgba(75, 141, 185, 0.16);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.84);
  color: var(--ink);
  text-align: left;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.fish-actions button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.fish-actions strong {
  display: block;
  margin-bottom: 8px;
  font-size: 17px;
  color: var(--brand-dark);
}

.fish-actions span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.fish-actions button:nth-child(2) {
  border-color: rgba(240, 168, 59, 0.3);
  background: #fff8ee;
}

.fish-actions button:nth-child(3) {
  border-color: rgba(75, 141, 185, 0.22);
  background: #eef8ff;
}

.fish-actions button:nth-child(4) {
  border-color: rgba(75, 141, 185, 0.2);
  background: #f4fbff;
}

.feature-strip span,
.next-tags span {
  min-height: 30px;
  border-color: rgba(75, 141, 185, 0.16);
  border-radius: 999px;
  background: #f1f8ff;
  color: #23618d;
  font-size: 12px;
  font-weight: 900;
}

/* --- Connection box --- */
.connection-box {
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(75, 141, 185, 0.16);
  border-radius: var(--radius-md);
  background: rgba(251, 253, 255, 0.88);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.connection-box label {
  color: var(--muted);
}

.connection-box input {
  min-height: 42px;
  border-color: var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
}

.connection-row {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
}

.room-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.room-actions button,
.bot-toggle {
  justify-content: center;
  min-height: 38px;
  border-color: rgba(75, 141, 185, 0.16);
  border-radius: var(--radius-sm);
  background: #f8fbff;
  color: #174867;
}

.bot-toggle {
  grid-column: span 1;
}

.connection-status {
  min-height: 34px;
  padding: 8px 10px;
  border: 1px solid rgba(75, 141, 185, 0.22);
  border-radius: var(--radius-sm);
  background: #eaf6ff;
  color: var(--brand-dark);
}

.room-help {
  border-top-color: rgba(75, 141, 185, 0.12);
  color: var(--muted);
}

.room-help strong {
  color: var(--brand-dark);
}

.stealth-panel {
  border-color: rgba(75, 141, 185, 0.2);
  border-radius: var(--radius-sm);
  background: #eef8ff;
}

.panel-label {
  display: block;
  margin-bottom: 4px;
  color: var(--brand);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.stealth-panel strong {
  color: var(--brand-dark);
}

.stealth-hint {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.stealth-actions,
.room-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

/* --- Buttons --- */
.primary,
.chat-input-row button {
  background: var(--brand-gradient);
  color: #fff;
  border: 1px solid rgba(37, 91, 124, 0.4);
  box-shadow: 0 1px 2px rgba(37, 91, 124, 0.18), 0 8px 18px rgba(75, 141, 185, 0.22);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.primary:hover,
.chat-input-row button:hover {
  background: var(--brand-gradient-hover);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(37, 91, 124, 0.2), 0 12px 24px rgba(75, 141, 185, 0.3);
}

button:active {
  transform: translateY(1px);
  box-shadow: 0 1px 2px rgba(37, 91, 124, 0.18);
}

/* focus-visible 统一由 base.css 处理，此处不再重复定义 */

/* --- Game overview --- */
.game-overview {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(75, 141, 185, 0.12);
  border-radius: var(--radius-md);
  background: rgba(251, 253, 255, 0.66);
  box-shadow: var(--shadow-sm);
}

.game-overview div {
  min-height: 72px;
  border-color: rgba(75, 141, 185, 0.12);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #fffdf7, #f3efe5);
  box-shadow: none;
}

.game-overview strong {
  color: var(--brand-dark);
}

/* --- Game shell --- */
.game-shell {
  grid-template-columns: 244px minmax(0, 1fr);
  min-height: min(790px, calc(100svh - 134px));
  border: 1px solid rgba(75, 141, 185, 0.16);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.game-menu {
  gap: 10px;
  padding: 14px;
  border-right-color: rgba(75, 141, 185, 0.13);
  background:
    linear-gradient(90deg, rgba(75, 141, 185, 0.03) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(180deg, #f7fbfd, #edf6fb);
}

.game-tab {
  min-height: 64px;
  border: 1px solid rgba(75, 141, 185, 0.13);
  border-radius: var(--radius-sm);
  background: rgba(251, 253, 255, 0.78);
  color: var(--brand-dark);
}

.game-tab small {
  color: var(--muted);
}

.game-tab:not(.active):hover {
  background: #eef8ff;
}

.game-tab.active {
  border-color: rgba(75, 141, 185, 0.28);
  background: linear-gradient(135deg, #d9edf8, #c6e2f2);
  color: #1f4d69;
  box-shadow: 0 12px 24px rgba(36, 79, 113, 0.12);
}

.game-tab.active .game-icon {
  background: #ffffff;
  color: #1f6b9f;
}

.game-icon {
  border-color: rgba(75, 141, 185, 0.14);
  background: #f4faff;
  color: var(--brand);
}

.game-stage {
  padding: 18px;
  background:
    linear-gradient(90deg, rgba(75, 141, 185, 0.02) 1px, transparent 1px) 0 0 / 30px 30px,
    linear-gradient(180deg, #fbfdff 0%, #f2f7fb 100%);
}

/* --- Panel head & status --- */
.panel-head {
  align-items: center;
  min-height: 66px;
  padding: 12px 14px;
  border: 1px solid rgba(75, 141, 185, 0.14);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72), 0 10px 24px rgba(18, 27, 24, 0.06);
}

.panel-head h2 {
  color: var(--brand-dark);
  font-size: clamp(22px, 3vw, 32px);
}

.panel-head p {
  color: var(--muted);
}

.status-pill {
  border-color: rgba(75, 141, 185, 0.2);
  background: #e7f3fb;
  color: var(--brand-dark);
}

/* --- Board frames & common surfaces --- */
.board-frame,
.inline-tools,
.score-strip,
.guess-box,
.hand,
.chat-log,
.info-panel,
.tool-card,
.community-card {
  border-color: rgba(75, 141, 185, 0.13);
  border-radius: var(--radius-md);
  background: rgba(251, 253, 255, 0.88);
  box-shadow: var(--shadow-sm);
}

.chat-panel {
  margin-top: 16px;
  border-top-color: rgba(75, 141, 185, 0.12);
}

.chat-input-row input {
  min-height: 42px;
}

.info-grid {
  grid-template-columns: 1fr 1fr 1.15fr;
  gap: 10px;
}

.info-panel h2,
.tool-card h2,
.community-card h2 {
  color: var(--brand-dark);
}

/* --- Toolbox & community notes --- */
.toolbox-note,
.community-note {
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 14px;
  border: 1px solid rgba(75, 141, 185, 0.16);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.toolbox-note strong,
.community-note strong {
  color: var(--brand-dark);
}

.toolbox-note span,
.community-note span {
  color: var(--muted);
}

/* --- Stealth mode --- */
body.stealth-mode {
  background: #f4f8fb !important;
}

body.stealth-mode .module-bar,
body.stealth-mode .section-head,
body.stealth-mode .toolbox-head,
body.stealth-mode .community-head {
  border-color: var(--line);
  background: #ffffff;
  color: #23394d;
}

body.stealth-mode .section-copy,
body.stealth-mode .fish-actions span,
body.stealth-mode .connection-box label,
body.stealth-mode .room-help {
  color: var(--muted);
}

body.stealth-mode .section-kicker,
body.stealth-mode .panel-label,
body.stealth-mode .connection-status {
  color: var(--brand);
}

body.stealth-mode .feature-strip,
body.stealth-mode .game-overview {
  display: none;
}

body.stealth-mode .fish-actions button,
body.stealth-mode .connection-box,
body.stealth-mode .stealth-panel {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--ink);
  box-shadow: none;
}

body.stealth-mode .stealth-panel strong {
  color: var(--ink);
}

body.stealth-mode .module-bar {
  background: #fff;
}

body.stealth-mode .mode-chip {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--brand-dark);
}

/* --- Popout --- */
body.popout-page {
  background: linear-gradient(135deg, #eef6fb, #f2f7fb);
}

body.popout-page .section-head,
body.popout-page .game-shell {
  border-radius: var(--radius-md);
}

body.popout-page .fish-actions,
body.popout-page .stealth-panel {
  display: none;
}

body.popout-page .game-section {
  width: min(100vw - 10px, 760px);
}

/* --- Compact mode --- */
.game-section.compact-mode .section-head {
  background: linear-gradient(135deg, #eef6fb, #d9edf8);
}

.game-section.compact-mode .connection-box {
  background: var(--surface-soft);
}

.game-section.compact-mode .connection-row {
  grid-template-columns: 1fr;
}

.game-section.compact-mode .room-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* --- Timer display --- */
.timer-display {
  display: grid;
  place-items: center;
  min-height: 108px;
  margin-bottom: 12px;
  border-radius: var(--radius-md);
  background: linear-gradient(145deg, var(--brand-dark), var(--brand));
  color: #fff;
  font-size: 42px;
  font-weight: 900;
  letter-spacing: 0;
}

/* --- Novel reader shelf card --- */
.novel-book-card {
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.novel-book-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

/* --- Uno card pulse --- */
.uno-hand .uno-card[data-playable] {
  animation: uno-pulse 2s ease-in-out infinite;
}

.uno-hand .uno-card[data-playable]:hover {
  transform: translateY(-16px) rotate(0deg);
  filter: saturate(1.25) brightness(1.05);
}

/* --- Mahjong tile hover --- */
.mj-hand .mj-tile:hover {
  transform: translateY(-10px);
  box-shadow: inset 0 -4px 0 rgba(80, 64, 31, 0.12), 0 14px 18px rgba(0, 0, 0, 0.28);
}

.info-grid {
  grid-template-columns: 1fr 1fr 1.15fr;
  gap: 10px;
}

.info-panel h2,
.tool-card h2,
.community-card h2 {
  color: #102724;
}

.tool-card,
.community-card {
  background: rgba(255, 253, 247, 0.9);
}

body.popout-page {
  background: linear-gradient(135deg, #102724, #e9e2d1);
}

body.popout-page .game-section {
  width: min(100vw - 10px, 760px);
}

body.popout-page .section-head,
body.popout-page .game-shell {
  border-radius: 14px;
}

.game-section.compact-mode .section-head {
  background: linear-gradient(135deg, #102724, #1a513f);
}

.game-section.compact-mode .connection-box {
  background: rgba(4, 18, 17, 0.36);
}

@media (max-width: 900px) {
  .site-header,
  .game-section,
  .toolbox-section,
  .community-section {
    width: min(100vw - 18px, 760px);
  }

  .section-head,
  .toolbox-head,
  .community-head {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .connection-row {
    grid-template-columns: 1fr 1fr;
  }

  .connection-row .primary {
    grid-column: 1 / -1;
  }

  .game-shell {
    grid-template-columns: 1fr;
  }

  .game-menu {
    display: flex;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .game-tab {
    flex: 0 0 124px;
  }
}

@media (max-width: 760px), (max-height: 680px) {
  .site-header {
    padding-top: 6px;
  }

  .module-bar {
    border-radius: 10px;
  }

  .section-head,
  .toolbox-head,
  .community-head {
    padding: 12px;
  }

  .connection-box,
  .game-stage {
    padding: 10px;
  }

  .room-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .game-menu {
    padding: 8px;
  }

  .game-tab {
    flex-basis: 96px;
    min-height: 72px;
  }

  .panel-head {
    min-height: 0;
    padding: 10px;
  }

  .primary,
  .chat-input-row button {
    box-shadow: 0 5px 0 rgba(3, 53, 45, 0.85), 0 10px 18px rgba(3, 53, 45, 0.16);
  }
}

@media (max-width: 560px) {
  .site-header,
  .game-section,
  .toolbox-section,
  .community-section {
    width: min(100vw - 10px, 760px);
  }

  .module-brand,
  .module-current,
  .module-nav a,
  .module-nav span {
    border-radius: 8px;
  }

  .connection-row {
    grid-template-columns: 1fr;
  }

  .room-actions {
    grid-template-columns: 1fr 1fr;
  }

  .room-actions button,
  .bot-toggle {
    min-width: 0;
    padding-inline: 8px;
  }

  .game-overview {
    grid-template-columns: 1fr 1fr;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }

  .info-panel {
    padding: 14px;
  }
}

