/* =========================================================================
   GAME SETTINGS (180° Back-Wall Porcelain Gallery) & MODE MENUS
   ========================================================================= */
.game-menu .dex-detail-bar h1 {
  margin: 0;
  color: var(--collection-ink);
  font-size: calc(22px * var(--spire-ui-text, 1));
  letter-spacing: -0.02em;
}

.game-menu[data-game-menu="settings"].is-from-waterfall .game-settings-stage {
  opacity: 0;
  pointer-events: none;
}

.game-settings-stage {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  width: 100%;
  height: 100%;
  transform-origin: 50% 50%;
  will-change: transform, opacity;
}

.game-settings-shell {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: clamp(14px, 2.4vh, 24px) clamp(18px, 3vw, 40px) clamp(20px, 3.6vh, 36px);
  overflow: hidden;
}

.game-settings-layout {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  gap: clamp(14px, 2vw, 24px);
  width: 100%;
  max-width: 920px;
  min-height: 0;
  margin-inline: auto;
}

.game-settings-layout[data-show-preview="1"] {
  grid-template-columns: 224px minmax(0, 1.35fr) minmax(240px, 300px);
  max-width: 1120px;
}

/* Left Floating Category Rail */
.game-settings-sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  min-height: 0;
  padding: 16px 14px;
  border: 1px solid var(--collection-line);
  border-radius: 24px;
  background: var(--collection-panel);
  overflow-y: auto;
  scrollbar-width: thin;
}

.game-settings-tabs {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#app .game-menu .game-settings-nav-btn {
  width: 100%;
  justify-content: flex-start;
  padding: 11px 15px;
  border-radius: 13px !important;
  font-size: calc(14px * var(--spire-ui-text, 1));
  font-weight: 800;
  text-align: left;
  background: rgba(248, 250, 252, 0.72) !important;
  border: 1px solid transparent !important;
  box-shadow: none !important;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

#app .game-menu .game-settings-nav-btn:hover:not([aria-pressed="true"]) {
  transform: translateX(3px);
  background: #f0f9ff !important;
  border-color: rgba(56, 189, 248, 0.45) !important;
  color: #0369a1 !important;
}

#app .game-menu .game-settings-nav-btn[aria-pressed="true"] {
  transform: none;
}

.game-settings-sidebar-divider {
  height: 1px;
  margin: 2px 4px;
  background: rgba(148, 163, 184, 0.24);
}

/* Dedicated Waterfall Tuning Button (turns 180° back to face the waterfall) */
.game-settings-waterfall-btn {
  appearance: none;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 13px;
  border-radius: 15px;
  border: 1px solid rgba(14, 165, 233, 0.28);
  background: linear-gradient(135deg, rgba(240, 249, 255, 0.96) 0%, rgba(224, 242, 254, 0.88) 100%);
  color: #0f172a;
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 8px 18px -12px rgba(14, 165, 233, 0.36);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.game-settings-waterfall-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(14, 165, 233, 0.62);
  background: linear-gradient(135deg, #e0f2fe 0%, #dbeafe 100%);
  box-shadow: 0 12px 24px -12px rgba(14, 165, 233, 0.48);
}

.game-settings-waterfall-btn .gsw-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.game-settings-waterfall-btn strong {
  font-size: 13.5px;
  font-weight: 900;
  color: #0369a1;
  line-height: 1.25;
}

.game-settings-waterfall-btn small {
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  line-height: 1.25;
}

.game-settings-waterfall-btn .gsw-arrow {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: #ffffff;
  border: 1px solid rgba(14, 165, 233, 0.28);
  color: #0284c7;
  font-size: 14px;
  font-weight: 900;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.game-settings-waterfall-btn:hover .gsw-arrow {
  transform: rotate(180deg);
}

.game-settings-sidebar-foot {
  margin-top: auto;
  padding-top: 6px;
}

#app .game-menu .game-settings-reset-btn {
  width: 100%;
  justify-content: center;
  padding: 9px 12px;
  border-radius: 12px !important;
  font-size: 13px;
  color: #64748b !important;
  background: rgba(248, 250, 252, 0.85) !important;
  border: 1px solid rgba(148, 163, 184, 0.28) !important;
  box-shadow: none !important;
}

#app .game-menu .game-settings-reset-btn:hover {
  background: #fef2f2 !important;
  border-color: rgba(239, 68, 68, 0.42) !important;
  color: #dc2626 !important;
}

/* Center Floating Settings Card */
.game-settings-main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  align-self: stretch;
  min-width: 0;
  min-height: 0;
  padding: 20px 24px 16px;
  gap: 12px;
  border: 1px solid var(--collection-line);
  border-radius: 24px;
  background: var(--collection-panel);
}

.game-settings-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}

.game-settings-panel-head h2 {
  margin: 0;
  font-size: calc(18px * var(--spire-ui-text, 1));
  font-weight: 900;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.game-settings-panel-head p {
  margin: 0;
  font-size: 12.5px;
  font-weight: 600;
  color: #64748b;
}

.game-settings-panels {
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.game-setting-row {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  min-height: 56px;
  padding: 10px 4px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.game-setting-row:last-child {
  border-bottom: 0;
}

.game-setting-row > label,
.game-setting-row > dt {
  font-weight: 800;
  color: #0f172a;
  line-height: 1.35;
}

.game-setting-row select {
  width: 100%;
  min-height: 38px;
  padding: 6px 11px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
  color: #0f172a;
  color-scheme: light;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.game-setting-row select:focus-visible { outline: 2px solid #0ea5e9; outline-offset: 2px; }
.game-setting-row input[type="range"] { width: 100%; min-width: 0; margin: 0; accent-color: #0284c7; cursor: pointer; }
.game-setting-hint { display: block; margin-top: 3px; font-size: 11.5px; color: #64748b; font-weight: 500; line-height: 1.4; }

/* Modern Pill Toggle Switch */
.game-setting-check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  justify-self: end;
  cursor: pointer;
  color: #334155;
  font-size: 13px;
  font-weight: 800;
  user-select: none;
}

.game-setting-check input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #e2e8f0;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.game-setting-check input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.22);
  transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}

.game-setting-check input[type="checkbox"]:checked {
  background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
  border-color: transparent;
  box-shadow: 0 4px 12px -4px rgba(37, 99, 235, 0.55);
}

.game-setting-check input[type="checkbox"]:checked::after {
  transform: translateX(20px);
}

.game-setting-check input[type="checkbox"]:focus-visible {
  outline: 2px solid #0ea5e9;
  outline-offset: 2px;
}

.game-setting-range { display: grid; grid-template-columns: minmax(0, 1fr) 4.6ch; align-items: center; gap: 10px; }
.game-setting-range output { color: #0369a1; font-variant-numeric: tabular-nums; font-weight: 800; text-align: right; }
.game-setting-controls { margin: 0; }
.game-setting-controls dd { margin: 0; color: #475569; font-weight: 600; justify-self: end; text-align: right; }
.game-setting-controls kbd { color: #0369a1; }

/* Right Floating Live Card Preview (Shown ONLY on Video & Text tabs) */
.game-settings-reference {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  justify-items: center;
  min-height: 0;
  margin: 0;
  padding: 18px 16px;
  gap: 10px;
  border: 1px solid var(--collection-line);
  border-radius: 24px;
  background: radial-gradient(ellipse at 50% 45%, #ffffff 0%, #ebf4ff 100%);
}

.game-settings-reference[hidden] {
  display: none !important;
}

.game-settings-reference figcaption { align-self: start; display: grid; gap: 2px; text-align: center; }
.game-settings-reference figcaption strong { font-size: 14px; font-weight: 900; color: #0f172a; }
.game-settings-reference figcaption span { font-size: 12px; font-weight: 700; color: #64748b; }
.game-settings-card { display: grid; place-items: center; width: 100%; min-height: 0; container-type: size; }

#app .game-settings-card .poke-card.ptcg-v2 {
  width: min(100cqw, 72cqh, 280px) !important;
  height: auto !important;
  aspect-ratio: 0.718;
  margin: 0 !important;
  transform: none !important;
  pointer-events: none;
  --card-opacity: .64;
  --pointer-x: 35%;
  --pointer-y: 45%;
  --background-x: 35%;
  --background-y: 45%;
}

#app .game-settings-card .poke-card.ptcg-v2 .j-shine,
#app .game-settings-card .poke-card.ptcg-v2 .j-subject-foil { display: block !important; }

.game-mode-screen { position: relative; flex: 1; z-index: auto; }
.game-mode-content, .game-release-notes { padding-block: clamp(14px, 5vh, 48px); }
.game-release-notes time { color: var(--collection-muted); }
.game-mode-status { margin: 0 0 14px; color: var(--collection-highlight); text-align: center; }
.game-mode-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; max-width: 720px; margin-inline: auto; }
.game-mode-options--three { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 1088px; }

.game-mode-options section {
  position: relative;
  display: grid;
  justify-items: center;
  grid-template-rows: auto auto 1fr auto;
  gap: 10px;
  padding: clamp(14px, 4vw, 38px);
  border: 1px solid var(--collection-line);
  border-radius: 8px;
  background: var(--collection-panel);
  text-align: center;
}

.game-mode-options h2, .game-mode-options p { margin: 0; }
.game-mode-options p { color: var(--collection-muted); }
.game-mode-options small { display: block; margin-top: 4px; color: var(--collection-highlight); }
.game-mode-options .collection-control { text-align: center; }
.game-mode-options .collection-control:not(:disabled)::after {
  content: "";
  position: absolute;
  inset: 0;
}
.game-mode-options section:has(.collection-control:not(:disabled):is(:hover, :focus-visible)) {
  border-color: #527684;
}
.game-mode-options img { width: clamp(32px, 5vw, 60px); image-rendering: pixelated; }
.game-menu .collection-control:disabled,
.game-menu .collection-control:disabled:hover { cursor: default; opacity: .62; background: var(--collection-control); }

@media (max-width: 900px) {
  .game-settings-layout,
  .game-settings-layout[data-show-preview="1"] {
    grid-template-columns: 188px minmax(0, 1fr);
  }
  .game-settings-layout[data-show-preview="1"] .game-settings-reference {
    grid-column: 1 / -1;
    grid-template-rows: auto minmax(180px, 240px);
  }
}

@media (max-height: 460px) {
  .game-menu .dex-detail-bar > div { min-height: 44px; }
  .game-menu .collection-control { min-height: 34px; }
  .game-settings-shell { padding: 8px 14px 12px; }
  .game-settings-sidebar { padding: 10px; gap: 6px; }
  #app .game-menu .game-settings-nav-btn { padding: 7px 10px; font-size: 12.5px; }
  .game-settings-waterfall-btn { padding: 8px 10px; }
  .game-settings-main { padding: 12px 14px 10px; gap: 6px; }
  .game-settings-panel-head { padding-bottom: 6px; }
  .game-setting-row { min-height: 42px; padding-block: 5px; }
  .game-mode-options section { padding: 12px; gap: 6px; }
  .game-settings-reference { padding: 10px; gap: 4px; }
}

@media (max-width: 520px) {
  .game-mode-options--three { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 680px) {
  .game-menu .dex-detail-width { width: calc(100% - 20px); }
  .game-settings-shell { padding: 10px 12px 14px; }
  .game-settings-layout,
  .game-settings-layout[data-show-preview="1"] {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    gap: 10px;
  }
  .game-settings-sidebar {
    padding: 10px;
    gap: 8px;
    overflow: visible;
  }
  .game-settings-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .game-settings-sidebar-divider { display: none; }
  .game-settings-sidebar-foot { margin-top: 0; padding-top: 0; }
  .game-settings-panel-head { flex-direction: column; gap: 2px; }
  .game-setting-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .game-setting-check, .game-setting-controls dd { justify-self: start; text-align: left; }
}

/* Defaults preserve the existing game typography and card composition. */
:root {
  --font-ptcg-zh: var(--spire-font, "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif);
  --font-ptcg-num: var(--spire-font, "Barlow Condensed", "DIN Condensed", "Helvetica Neue", sans-serif);
  --uni-font-display: var(--spire-font, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system, sans-serif);
}

body { font-family: var(--spire-font, -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif); }
.expedition-home, .expedition-route { font-family: var(--spire-font, "PingFang SC", "Hiragino Sans GB", system-ui, sans-serif); }

.collection-ui, .dex-detail { font-size: calc(14px * var(--spire-ui-text, 1)); }
.game-menu .dex-detail-back { font-size: calc(13px * var(--spire-ui-text, 1)); }
[data-spire-ui-scale] :is(.collection-home, .sts-dex-overlay) .sts-dex-sec-head { font-size: calc(12px * var(--spire-ui-text)); }
[data-spire-ui-scale] .sts-dex-overlay :is(.sts-dex-check-row, .sts-dex-seg-btn, #dex-search),
[data-spire-ui-scale] .dex-detail :is(.dex-wiki-section p, .dex-wiki-section dt, .dex-wiki-section dd) {
  font-size: calc(13px * var(--spire-ui-text));
}

:root[data-spire-card-color="single"] .ptcg-v2[data-secondary-type] .j-art-bg {
  background: radial-gradient(circle at 50% 52%, #ffffffc7 0%, var(--type-bg-a, #f3ede0) 55%, var(--type-bg-b, #e2dfd6) 100%);
}
:root[data-spire-card-color="single"] .ptcg-v2 .j-dual-emblem.is-dual .e1 { mask-image: none; -webkit-mask-image: none; }
:root[data-spire-card-color="single"] .ptcg-v2 .j-dual-emblem .e2 { display: none; }

:root[data-spire-frame="full"] .ptcg-v2:not(.is-curse-card) .j-art-frame {
  inset: 0;
  height: 100%;
  border: 0;
  box-shadow: none;
}
:root[data-spire-frame="full"] .ptcg-v2:not(.is-curse-card) .j-effects-zone {
  background: linear-gradient(180deg, #f8fafc91, #f8fafce8);
  border-radius: 4px;
  padding-inline: 2cqw;
}
/* Cosmetic footnotes can be hidden while type icons, effects and costs remain visible. */
:root[data-spire-card-detail="compact"] .ptcg-v2 :is(.j-spec-bar, .j-footer, .j-copyright) { visibility: hidden; }

/* Screen shake intensity (STS2-style Gameplay setting) */
:root[data-spire-shake="off"] .screen-shake,
:root[data-spire-shake="off"] .screen-shake-heavy {
  animation: none !important;
}
:root[data-spire-shake="light"] .screen-shake-heavy {
  animation-name: screenShake !important;
  animation-duration: .2s !important;
}

/* Optional Smooth Quality Mode (default 'high' leaves full foil 100% untouched) */
:root[data-spire-quality="smooth"] #app[data-screen="battle"] .hand-row .poke-card.ptcg-v2 .j-rotator {
  box-shadow: 0 8px 14px -6px rgba(0, 0, 0, 0.55) !important;
}
:root[data-spire-quality="smooth"] #app[data-screen="battle"] .hand-row .poke-card.ptcg-v2 .j-subject img.card-sprite {
  filter: none !important;
}

/* Floating Live FPS & Run Timer HUD Badges */
.spire-fps-badge,
.spire-run-timer {
  position: fixed;
  z-index: 9800;
  pointer-events: none;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(10, 18, 28, 0.82);
  border: 1px solid rgba(148, 194, 212, 0.32);
  font-family: "Barlow Condensed", "DIN Condensed", monospace;
  font-size: 14px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
  color: #e2e8f0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}
.spire-fps-badge {
  top: 8px;
  right: 10px;
}
.spire-fps-badge[data-tier="high"] { color: #38bdf8; border-color: rgba(56, 189, 248, 0.55); }
.spire-fps-badge[data-tier="good"] { color: #4ade80; }
.spire-fps-badge[data-tier="low"]  { color: #f87171; }
.spire-run-timer {
  top: 8px;
  right: 92px;
  color: #fde047;
}

/* =========================================================================
   Global Fullscreen Floating Button (Title Screen Top-Right) & Mobile Guide
   ========================================================================= */
.spire-fs-fab {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top, 0px));
  right: calc(16px + env(safe-area-inset-right, 0px));
  z-index: 45;
  appearance: none;
  display: none;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.92);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(14px) saturate(1.25);
  -webkit-backdrop-filter: blur(14px) saturate(1.25);
  color: #0f172a;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  box-shadow:
    0 10px 24px -8px rgba(15, 23, 42, 0.22),
    0 2px 6px rgba(15, 23, 42, 0.08);
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
  user-select: none;
  -webkit-user-select: none;
}

body:not(.is-twf-tuning):not(.twf-mode-back):not(.twf-yaw-turning):has(#app[data-screen="title"] .title-float-home:not([inert])) .spire-fs-fab:not([hidden]) {
  display: inline-flex;
}

.spire-fs-fab svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 2.3;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  flex: none;
}

.spire-fs-fab:hover {
  transform: translateY(-1px);
  background: #ffffff;
  border-color: rgba(14, 165, 233, 0.55);
  color: #0369a1;
  box-shadow: 0 12px 28px -8px rgba(14, 165, 233, 0.32);
}

.spire-fs-fab:active {
  transform: scale(0.96);
}

.spire-fs-fab.is-active {
  background: rgba(15, 23, 42, 0.78);
  border-color: rgba(148, 163, 184, 0.4);
  color: #f8fafc;
}

@media (max-height: 460px) {
  .spire-fs-fab {
    top: calc(8px + env(safe-area-inset-top, 0px));
    right: calc(10px + env(safe-area-inset-right, 0px));
    padding: 6px 11px;
    font-size: 11.5px;
    gap: 5px;
  }
  .spire-fs-fab svg {
    width: 13px;
    height: 13px;
  }
}

.spire-fs-guide:not([open]) {
  display: none;
}

.spire-fs-guide {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: grid;
  place-items: center;
  width: 100%;
  height: var(--spire-viewport);
  max-width: none;
  max-height: none;
  margin: 0;
  border: 0;
  padding: max(14px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(14px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  background: transparent;
}

.spire-fs-guide::backdrop {
  background: rgba(15, 23, 42, 0.62);
}

.spire-fs-guide-card {
  width: min(460px, 92vw);
  max-height: calc(var(--spire-content-height) - 28px);
  overflow-y: auto;
  padding: 18px 20px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.35);
  color: #0f172a;
}

.spire-fs-guide-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.spire-fs-guide-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 900;
  color: #0f172a;
}

.spire-fs-guide-close {
  appearance: none;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: #f8fafc;
  color: #475569;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.spire-fs-guide-desc {
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.55;
  color: #334155;
}

.spire-fs-guide-actions {
  display: flex;
  justify-content: flex-end;
}

.spire-fs-guide-ok {
  appearance: none;
  padding: 8px 20px;
  border-radius: 10px;
  border: 0;
  background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
  color: #ffffff;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

/* 4-channel audio mixer row (slider + output + preview button) */
.game-setting-audio-ctrl {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.game-setting-preview-btn {
  padding: 5px 12px;
  font-size: 12.5px;
  min-width: 56px;
}

/* =========================================================================
   Title Screen Floating Music Switcher Pill (next to Fullscreen FAB)
   ========================================================================= */
.spire-bgm-widget {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top, 0px));
  right: calc(114px + env(safe-area-inset-right, 0px));
  z-index: 46;
  display: none;
  flex-direction: column;
  align-items: flex-end;
}

body:not(.is-twf-tuning):not(.twf-mode-back):not(.twf-yaw-turning):has(#app[data-screen="title"] .title-float-home:not([inert])) .spire-bgm-widget {
  display: flex;
}

body:has(#spire-fs-fab[hidden]) .spire-bgm-widget {
  right: calc(16px + env(safe-area-inset-right, 0px));
}

.spire-bgm-fab {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  max-width: 196px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.92);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(14px) saturate(1.25);
  -webkit-backdrop-filter: blur(14px) saturate(1.25);
  color: #0f172a;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  box-shadow:
    0 10px 24px -8px rgba(15, 23, 42, 0.22),
    0 2px 6px rgba(15, 23, 42, 0.08);
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
  user-select: none;
  -webkit-user-select: none;
}

.spire-bgm-fab svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  flex: none;
}

.spire-bgm-fab-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spire-bgm-fab:hover {
  transform: translateY(-1px);
  background: #ffffff;
  border-color: rgba(14, 165, 233, 0.55);
  color: #0369a1;
  box-shadow: 0 12px 28px -8px rgba(14, 165, 233, 0.32);
}

.spire-bgm-fab:active {
  transform: scale(0.96);
}

.spire-bgm-fab.is-muted {
  color: #64748b;
  background: rgba(248, 250, 252, 0.78);
}

.spire-bgm-popover {
  margin-top: 8px;
  width: min(292px, calc(100vw - 28px));
  padding: 10px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.92);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  box-shadow:
    0 22px 48px -12px rgba(15, 23, 42, 0.28),
    0 4px 12px rgba(15, 23, 42, 0.08);
  color: #0f172a;
}

.spire-bgm-popover[hidden] {
  display: none;
}

.spire-bgm-pop-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 6px 8px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
  margin-bottom: 6px;
}

.spire-bgm-pop-head strong {
  font-size: 13.5px;
  font-weight: 900;
  color: #0f172a;
}

.spire-bgm-pop-head small {
  font-size: 11px;
  font-weight: 700;
  color: #0284c7;
}

.spire-bgm-pop-list {
  display: grid;
  gap: 4px;
  max-height: min(360px, 60vh);
  overflow-y: auto;
}

.spire-bgm-track-item {
  appearance: none;
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: #0f172a;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease;
}

.spire-bgm-track-item:hover {
  background: rgba(14, 165, 233, 0.08);
}

.spire-bgm-track-item.is-active {
  background: rgba(14, 165, 233, 0.14);
  border-color: rgba(14, 165, 233, 0.42);
}

.spire-bgm-track-dot {
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.5);
  flex: none;
  transition: background 0.14s ease, box-shadow 0.14s ease;
}

.spire-bgm-track-item.is-active .spire-bgm-track-dot {
  background: #0284c7;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.22);
}

.spire-bgm-track-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.spire-bgm-track-copy strong {
  font-size: 13px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.25;
}

.spire-bgm-track-copy small {
  font-size: 11px;
  font-weight: 500;
  color: #475569;
  line-height: 1.35;
}

@media (max-height: 460px) {
  .spire-bgm-widget {
    top: calc(8px + env(safe-area-inset-top, 0px));
    right: calc(96px + env(safe-area-inset-right, 0px));
  }
  .spire-bgm-fab {
    min-height: 36px;
    padding: 6px 11px;
    font-size: 11.5px;
    gap: 5px;
  }
  .spire-bgm-fab svg {
    width: 13px;
    height: 13px;
  }
}
