/*
 * Hub-only appearance layer: shared account chrome + the hub dark mapping.
 * The hub loads this trimmed file instead of the full rg-theme.css (which
 * keeps the per-game dark palettes for the game pages).
 * Loaded after hub.css so the mappings below can adapt existing variables
 * without coupling theme behavior to page logic.
 *
 * 令牌层已收敛到 shared/css/rg-tokens.css(先于本文件加载):统一 --rg-* 令牌
 * 与共享账号 chrome 的 --rg-night-* 暗色板都在那里定义,本文件只引用。
 */

.theme-btn,
.rg-theme {
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid rgba(80, 70, 160, .10);
  background: rgba(255, 255, 255, .82);
  color: #3a3760;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(90, 70, 180, .12);
  -webkit-tap-highlight-color: transparent;
  transition: transform .14s ease, background-color .2s ease, border-color .2s ease,
    color .2s ease, box-shadow .2s ease;
}
.top__actions {
  display: flex;
  align-items: center;
  gap: 9px;
}
.theme-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.2rem;
}
.rg-theme {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font: 700 1.05rem/1 ui-rounded, "Segoe UI", system-ui, sans-serif;
}
.theme-btn:hover,
.rg-theme:hover { background: #f3f2ff; }
.theme-btn:active,
.rg-theme:active { transform: scale(.92); }
.theme-btn:focus-visible,
.rg-theme:focus-visible {
  outline: 3px solid rgba(108, 99, 255, .34);
  outline-offset: 2px;
}
.gatehead,
.rg-gatehead { position: relative; }
.gate-theme,
.rg-gate-theme {
  position: absolute;
  top: -7px;
  right: -5px;
  z-index: 2;
}
.gate-logo,
.rg-gate-logo { pointer-events: none; }

html[data-color-mode="dark"] {
  color-scheme: dark;
}
html[data-color-mode="dark"] body,
html[data-color-mode="dark"] .rg-bar,
html[data-color-mode="dark"] .rg-sheet,
html[data-color-mode="dark"] .card,
html[data-color-mode="dark"] button,
html[data-color-mode="dark"] input {
  transition-property: background-color, border-color, color, box-shadow;
  transition-duration: 180ms;
  transition-timing-function: ease;
}

/* Shared account chrome --------------------------------------------------- */
html[data-color-mode="dark"] .rg-bar {
  background: rgba(31, 33, 38, .96);
  box-shadow: inset 0 -1px 0 var(--rg-night-line);
  color: var(--rg-night-text);
}
html[data-color-mode="dark"] .rg-back,
html[data-color-mode="dark"] .rg-title { color: var(--rg-night-text); }
html[data-color-mode="dark"] .rg-back:hover { background: rgba(155, 140, 255, .12); }
html[data-color-mode="dark"] .rg-back:active { background: rgba(155, 140, 255, .20); }
html[data-color-mode="dark"] .rg-acct,
html[data-color-mode="dark"] .rg-theme {
  background: var(--rg-night-surface-2);
  color: var(--rg-night-text);
  border-color: var(--rg-night-line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
}
html[data-color-mode="dark"] .rg-acct.on {
  background: var(--rg-night-accent);
  color: #fff;
}
html[data-color-mode="dark"] .rg-overlay {
  background: rgba(8, 10, 14, .72);
}
html[data-color-mode="dark"] .rg-sheet {
  background: var(--rg-night-surface);
  color: var(--rg-night-text);
  border: 1px solid var(--rg-night-line);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .48);
}
html[data-color-mode="dark"] .rg-x,
html[data-color-mode="dark"] .rg-lead,
html[data-color-mode="dark"] .rg-note,
html[data-color-mode="dark"] .rg-hublink,
html[data-color-mode="dark"] .rg-gate-sub { color: var(--rg-night-muted); }
html[data-color-mode="dark"] .rg-x:hover { background: var(--rg-night-surface-2); }
html[data-color-mode="dark"] .rg-in {
  background: var(--rg-night-surface-2);
  color: var(--rg-night-text);
  border-color: var(--rg-night-line);
}
html[data-color-mode="dark"] .rg-in::placeholder { color: #858c99; }
html[data-color-mode="dark"] .rg-in:focus {
  background: var(--rg-night-surface-3);
  border-color: var(--rg-night-accent);
}
html[data-color-mode="dark"] .rg-toggle { color: var(--rg-night-accent-2); }
html[data-color-mode="dark"] .rg-overlay.is-gate {
  background:
    linear-gradient(180deg, rgba(145, 135, 223, .06), transparent 42%),
    #17191d;
}

/* Hub --------------------------------------------------------------------- */
/*
 * 深色大厅 = 电玩厅风:与浅色同一套结构令牌(圆角沿用 hub.css 的 --r-lg),
 * 只换配色 —— 深底 #12141c、面板 #1a1d29、边框 #2a2e3d、霓虹青 accent,
 * 战绩/数字用等宽字体。明暗不再各说各话。
 */
html[data-game="hub"][data-color-mode="dark"] {
  --panel: var(--rg-surface);
  --panel-2: var(--rg-surface-2);
  --text: var(--rg-text);
  --muted: var(--rg-text-dim);
  --line: var(--rg-border);
  --accent: var(--rg-accent);
  --accent-2: #a5f5e3;
  --shadow: rgba(0, 0, 0, .42);
}
html[data-game="hub"][data-color-mode="dark"] body {
  background:
    radial-gradient(1100px 480px at 85% -10%, rgba(126, 240, 212, .07), transparent 60%),
    linear-gradient(180deg, #171a26 0%, #12141c 42%, #0e1017 100%);
}
html[data-game="hub"][data-color-mode="dark"] body::before {
  width: 100%;
  height: 42vh;
  inset: 0 0 auto;
  border-radius: 0;
  filter: none;
  opacity: 1;
  background: linear-gradient(180deg, rgba(126, 240, 212, .045), transparent);
  animation: none;
}
html[data-game="hub"][data-color-mode="dark"] body::after { display: none; }
html[data-game="hub"][data-color-mode="dark"] .brand__name {
  background: none;
  color: var(--text);
}
html[data-game="hub"][data-color-mode="dark"] .theme-btn,
html[data-game="hub"][data-color-mode="dark"] .acct-btn {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
}
html[data-game="hub"][data-color-mode="dark"] .acct-btn.on {
  background: var(--accent);
  color: var(--rg-on-accent);
  border-color: transparent;
}
html[data-game="hub"][data-color-mode="dark"] .offline-badge {
  background: rgba(230, 162, 60, .14);
  color: #e8b36a;
}
html[data-game="hub"][data-color-mode="dark"] .quick__btn {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
}
html[data-game="hub"][data-color-mode="dark"] .quick__offline.is-ready {
  background: rgba(126, 240, 212, .12);
  color: var(--accent);
}
html[data-game="hub"][data-color-mode="dark"] .quick__admin {
  background: #2b3350;
  color: #c3ccff;
  border-color: #3a4468;
  box-shadow: none;
}
html[data-game="hub"][data-color-mode="dark"] .announce {
  background: var(--panel);
  border-color: rgba(230, 178, 96, .24);
  box-shadow: 0 10px 24px rgba(0, 0, 0, .32);
}
html[data-game="hub"][data-color-mode="dark"] .announce__item {
  border-top-color: rgba(230, 178, 96, .16);
}
html[data-game="hub"][data-color-mode="dark"] .announce__body { color: var(--text); }
html[data-game="hub"][data-color-mode="dark"] .announce__toggle {
  color: var(--accent);
  background: rgba(230, 178, 96, .08);
  border-color: rgba(230, 178, 96, .20);
}
html[data-game="hub"][data-color-mode="dark"] .announce__toggle:hover {
  background: rgba(230, 178, 96, .14);
}
html[data-game="hub"][data-color-mode="dark"] .cat__count {
  color: var(--accent);
  background: rgba(126, 240, 212, .12);
}
html[data-game="hub"][data-color-mode="dark"] .card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: 0 12px 26px rgba(0, 0, 0, .30);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
html[data-game="hub"][data-color-mode="dark"] .card__glow {
  opacity: .08;
  filter: saturate(.7);
}
html[data-game="hub"][data-color-mode="dark"] .card__emoji {
  background: color-mix(in srgb, #262b3b 84%, var(--c1) 16%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
}
html[data-game="hub"][data-color-mode="dark"] .card__stats {
  color: var(--accent);
  font-family: var(--rg-font-num);
}
html[data-game="hub"][data-color-mode="dark"] .card__go { color: var(--accent); }
html[data-game="hub"][data-color-mode="dark"] .card:hover {
  background: #1e2231;
  border-color: rgba(126, 240, 212, .40);
  box-shadow: 0 16px 32px rgba(0, 0, 0, .40), 0 0 22px rgba(126, 240, 212, .08);
}
html[data-game="hub"][data-color-mode="dark"] .overlay {
  background: rgba(6, 8, 14, .62);
}
html[data-game="hub"][data-color-mode="dark"] .sheet {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .55);
}
html[data-game="hub"][data-color-mode="dark"] .x:hover,
html[data-game="hub"][data-color-mode="dark"] .in { background: var(--panel-2); }
html[data-game="hub"][data-color-mode="dark"] .in {
  color: var(--text);
  border-color: var(--line);
}
html[data-game="hub"][data-color-mode="dark"] .in:focus {
  background: #262b3b;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(126, 240, 212, .12);
}
html[data-game="hub"][data-color-mode="dark"] .btn.guest {
  background: linear-gradient(160deg, #3fae8d, #2b7f68);
}
html[data-game="hub"][data-color-mode="dark"] .gate-title {
  background: linear-gradient(100deg, #fff, var(--accent));
  -webkit-background-clip: text; background-clip: text;
}
html[data-game="hub"][data-color-mode="dark"] .gate-sub { color: var(--muted); }
html[data-game="hub"][data-color-mode="dark"] .toast {
  background: #2a3040;
  color: var(--text);
}
html[data-game="hub"][data-color-mode="dark"] .foot { border-top-color: var(--line); }
html[data-game="hub"][data-color-mode="dark"] .foot__link { color: var(--accent); }
html[data-game="hub"][data-color-mode="dark"] .overlay.is-gate {
  background:
    radial-gradient(900px 480px at 22% -6%, rgba(126, 240, 212, .16), transparent 60%),
    radial-gradient(800px 520px at 90% 12%, rgba(108, 99, 255, .18), transparent 60%),
    linear-gradient(165deg, #191d2b, #0e1017);
}

@media (prefers-reduced-motion: reduce) {
  html[data-color-mode="dark"] body,
  html[data-color-mode="dark"] .rg-bar,
  html[data-color-mode="dark"] .rg-sheet,
  html[data-color-mode="dark"] .card,
  html[data-color-mode="dark"] button,
  html[data-color-mode="dark"] input {
    transition-duration: .01ms !important;
  }
}
