/* ==========================================================================
   BACKSTAGE TP MULTI-GAME SHOWCASE STYLES (v9)
   Editorial 3-Game Switcher · Starlight Chimes (Midnight Brass) · Whisker Cafe
   Strict CSP Compliant · Standard sRGB/hex colors · WCAG AA/AAA Contrast · 100dvh Safe
   ========================================================================== */

:root {
  --tr-spring: var(--spring-ease, cubic-bezier(0.22, 1.35, 0.36, 1));
}

/* Embedded 3-Game Selector Strip (backstage-tp.html) */
.bs-study-hub {
  display: grid;
  gap: 1.15rem;
}

.bs-game-switcher {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.bs-game-tab {
  --bs-tab-accent: var(--accent-red, #e04f33);
  position: relative;
  display: grid;
  gap: 0.36rem;
  align-content: start;
  text-align: left;
  min-block-size: 5.5rem;
  padding: 0.9rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--line-strong, rgba(255, 255, 255, 0.2));
  border-top: 3px solid transparent;
  background: var(--bg-stage, rgba(255, 255, 255, 0.04));
  color: var(--ink-soft, #d7d2c8);
  font: inherit;
  cursor: pointer;
  scroll-snap-align: start;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.bs-game-tab[data-bs-tab="tile-river"] {
  --bs-tab-accent: #1e7a86;
}

.bs-game-tab[data-bs-tab="starlight-chimes"] {
  --bs-tab-accent: #d4a64a;
}

.bs-game-tab[data-bs-tab="whisker-cafe"] {
  --bs-tab-accent: #c85a40;
}

.bs-game-tab:hover {
  border-color: var(--bs-tab-accent);
  background: var(--bg-elev, rgba(255, 255, 255, 0.08));
  color: var(--ink, #f4f1ea);
}

.bs-game-tab:focus-visible {
  outline: 2px solid var(--bs-tab-accent);
  outline-offset: 2px;
}

.bs-game-tab[aria-selected="true"] {
  border-color: var(--bs-tab-accent);
  border-width: 2px;
  border-top-width: 3px;
  background: var(--bg-elev, rgba(255, 255, 255, 0.1));
  color: var(--ink, #f4f1ea);
  box-shadow: none;
}

html[data-theme="light"] .bs-game-tab {
  border: 2px solid #c9beab;
  background: #efeae0;
  color: #3f3c37;
}

html[data-theme="light"] .bs-game-tab:hover,
html[data-theme="light"] .bs-game-tab[aria-selected="true"] {
  background: #fcfaf4;
  color: #141517;
  box-shadow: none;
}

.bs-tab-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.bs-tab-idx {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted, #9b958b);
}

html[data-theme="light"] .bs-tab-idx {
  color: #5b564f;
}

.bs-tab-dot {
  inline-size: 0.5rem;
  block-size: 0.5rem;
  border-radius: 50%;
  background: var(--bs-tab-accent);
}

.bs-tab-genre {
  padding: 0.16rem 0.52rem;
  border-radius: 999px;
  border: 1px solid var(--line, rgba(255, 255, 255, 0.14));
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

html[data-theme="light"] .bs-tab-genre {
  border-color: rgba(20, 21, 23, 0.14);
  background: #efe9dc;
  color: #3d3934;
}

.bs-tab-title {
  font-size: 1.04rem;
  font-weight: 760;
  letter-spacing: -0.015em;
  line-height: 1.25;
}

.bs-tab-sub {
  font-size: 0.78rem;
  line-height: 1.4;
  opacity: 0.88;
}

@media (max-width: 56rem) {
  .bs-game-switcher {
    gap: 0.5rem;
  }
  .bs-game-tab {
    padding: 0.72rem 0.78rem;
    min-block-size: auto;
  }
}

@media (max-width: 42rem) {
  .bs-game-switcher {
    gap: 0.38rem;
  }
  .bs-game-tab {
    padding: 0.56rem 0.6rem;
    gap: 0.22rem;
    border-radius: 10px;
  }
  .bs-tab-title {
    font-size: 0.84rem;
    line-height: 1.18;
  }
  .bs-tab-sub {
    display: none;
  }
}

@media (max-width: 28rem) {
  .bs-tab-genre {
    display: none;
  }
}

.bs-game-panel[hidden] {
  display: none;
}

/* Shared Canvas Utility for New Playable Stages */
.bs-canvas {
  display: block;
  inline-size: 100%;
  block-size: 100%;
  position: absolute;
  inset: 0;
  touch-action: none;
  border-radius: 6px;
}

.bs-canvas:focus-visible {
  outline: 3px solid var(--ac-cyan, #284674);
  outline-offset: -4px;
}

/* ==========================================================================
   GAME 02: STARLIGHT CHIMES (Midnight Indigo Velvet & Brushed Brass Planetarium)
   ========================================================================== */
.bs-game-shell.is-starlight .tr-stage-pane,
.bs-game-shell.is-starlight .tr-full-stage-col {
  background: #0d1426;
  color: #f4ecda;
}

.bs-game-shell.is-starlight .tr-stage-bar {
  background: #131d37;
  border-bottom: 1px solid rgb(228 186 103 / 0.24);
  color: #f4ecda;
}

.bs-game-shell.is-starlight .tr-bar-title-row strong {
  color: #fff6e0;
}

.bs-game-shell.is-starlight .tr-hud-level {
  background: #1c2848;
  border-color: rgb(228 186 103 / 0.34);
  color: #f6dc9b;
}

.bs-game-shell.is-starlight .tr-hud-hint {
  color: #d7cfbe;
}

.bs-game-shell.is-starlight .tr-turn-badge[data-turn-state="client"] {
  background: #193b47;
  border-color: rgb(116 226 208 / 0.42);
  color: #aef4e6;
}

.bs-game-shell.is-starlight .tr-turn-badge[data-turn-state="director"] {
  background: #3e2d14;
  border-color: rgb(242 192 94 / 0.48);
  color: #ffe097;
}

.bs-game-shell.is-starlight .tr-turn-badge[data-turn-state="hold"] {
  background: #3a1f24;
  border-color: rgb(240 132 118 / 0.45);
  color: #ffc8bf;
}

.bs-game-shell.is-starlight .tr-star-counter {
  background: #1b2747;
  border-color: rgb(228 186 103 / 0.42);
  color: #ffe299;
}

.bs-game-shell.is-starlight .tr-stage-btn {
  background: #1a2544;
  border-color: rgb(228 186 103 / 0.28);
  color: #f4ecda;
}

@media (hover: hover) {
  .bs-game-shell.is-starlight .tr-stage-btn:hover:not(:disabled):not(.is-primary):not([aria-pressed="true"]) {
    background: #24335b;
    border-color: #e4ba67;
    color: #ffffff;
  }
}

.bs-game-shell.is-starlight .tr-stage-btn.is-primary {
  background: #e4ba67;
  border-color: #f6d58e;
  color: #121728;
  font-weight: 760;
}

@media (hover: hover) {
  .bs-game-shell.is-starlight .tr-stage-btn.is-primary:hover:not(:disabled) {
    background: #f0ca7b;
    border-color: #ffe3a3;
    color: #121728;
  }
}

.bs-game-shell.is-starlight .tr-stage-btn[aria-pressed="true"]:not(.is-primary) {
  background: #2d426c;
  border-color: #f0ca7b;
  color: #ffe7a8;
}

.bs-game-shell.is-starlight .tr-stage-wrap {
  background: #0c1324;
}

.bs-game-shell.is-starlight .bs-canvas:focus-visible {
  outline: 3px solid #f0ca7b;
  outline-offset: -4px;
}

.bs-game-shell.is-starlight .tr-stage-foot {
  background: #111a31;
  border-top: 1px solid rgb(228 186 103 / 0.22);
  color: #d7cfbe;
}

.bs-game-shell.is-starlight .tr-stage-foot a {
  color: #f5d388;
}

/* ==========================================================================
   GAME 03: WHISKER CAFE (Terracotta Awning & Sunlit Sage Paper-Craft Counter)
   ========================================================================== */
.bs-game-shell.is-cafe .tr-stage-pane,
.bs-game-shell.is-cafe .tr-full-stage-col {
  background: #eef3eb;
  color: #2d1f18;
}

.bs-game-shell.is-cafe .tr-stage-bar {
  background: #fcf6ea;
  border-bottom: 1px solid rgb(181 69 43 / 0.22);
  color: #2d1f18;
}

.bs-game-shell.is-cafe .tr-hud-level {
  background: #f5e6d8;
  border-color: rgb(181 69 43 / 0.30);
  color: #8f321c;
}

.bs-game-shell.is-cafe .tr-hud-hint {
  color: #5b473c;
}

.bs-game-shell.is-cafe .tr-turn-badge[data-turn-state="client"] {
  background: #dcf7ea;
  border-color: rgb(23 106 69 / 0.36);
  color: #155c3c;
  font-weight: 760;
}

.bs-game-shell.is-cafe .tr-turn-badge[data-turn-state="director"] {
  background: #e5e8ff;
  border-color: rgb(56 58 163 / 0.38);
  color: #2d319c;
  font-weight: 760;
}

/* Obvious Full-Fledged 2P Co-Play Turn Spotlight Bar */
.wc-turn-spotlight {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem 0.75rem;
  padding: 0.46rem 0.9rem;
  border-bottom: 2px solid rgb(23 106 69 / 0.28);
  background: linear-gradient(90deg, #dcf7ea 0%, #effcf5 100%);
  color: #155c3c;
  font-family: var(--tr-game-font, "Fredoka Variable", ui-rounded, system-ui, sans-serif);
  flex: 0 0 auto;
  z-index: 5;
}

.wc-turn-spotlight[data-active-turn="clinician"] {
  border-bottom-color: rgb(56 58 163 / 0.32);
  background: linear-gradient(90deg, #e5e8ff 0%, #f2f4ff 100%);
  color: #2d319c;
}

.wc-turn-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.48rem;
  min-inline-size: 0;
}

.wc-turn-dot {
  inline-size: 0.72rem;
  block-size: 0.72rem;
  border-radius: 50%;
  background: #178251;
  border: 2px solid #0e4a2f;
  box-shadow: none;
  flex: none;
  animation: wc-dot-pulse 1.5s ease-in-out infinite;
}

.wc-turn-spotlight[data-active-turn="clinician"] .wc-turn-dot {
  background: #3b3fc4;
  border-color: #202372;
  box-shadow: none;
}

.wc-turn-headline {
  font-size: 0.94rem;
  font-weight: 760;
  letter-spacing: 0.01em;
}

.wc-turn-scorestrip {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  flex: none;
}

.wc-player-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.22rem 0.62rem;
  border-radius: 999px;
  border: 2px solid #4c392b;
  background: #fffcf5;
  color: #463a31;
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: none;
  transition: transform 200ms var(--tr-spring, ease), background-color 180ms ease, border-color 180ms ease;
}

.wc-player-chip.is-client.is-active {
  border-color: #0e4f31;
  background: #1a8756;
  color: #ffffff;
  transform: translateY(-1px) scale(1.03);
  box-shadow: none;
}

.wc-player-chip.is-clinician.is-active {
  border-color: #232678;
  background: #4246c2;
  color: #ffffff;
  transform: translateY(-1px) scale(1.03);
  box-shadow: none;
}

.wc-turn-vs {
  font-size: 0.68rem;
  font-weight: 720;
  text-transform: uppercase;
  opacity: 0.65;
}

/* Compact Console HUD Toolbar & Carved Brand Logos */
.wc-brand-logo {
  display: block;
  inline-size: auto;
  block-size: clamp(2rem, 4vw, 2.5rem);
  max-inline-size: 9.25rem;
  object-fit: contain;
  flex: none;
}

.tr-brand-logo,
.sc-brand-logo {
  block-size: clamp(1.9rem, 3.8vw, 2.4rem);
  max-inline-size: 9.8rem;
}

.bs-game-shell.is-cafe .tr-hud-tools,
.bs-game-shell.is-cafe .tr-toolbar-group {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.34rem;
  min-inline-size: 0;
}

.bs-game-shell.is-cafe .tr-hud-tools {
  max-inline-size: 100%;
  overflow: visible;
  padding-block: 0.1rem;
  -webkit-mask-image: none;
  mask-image: none;
}

@media (max-width: 34rem) {
  .bs-game-shell.is-cafe .tr-hud-tools {
    flex-wrap: wrap;
    justify-content: flex-start;
    overflow-x: visible;
  }
}

@media (max-width: 40rem) {
  .bs-game-shell.is-cafe .tr-hud-tools,
  .bs-game-shell.is-cafe .tr-toolbar-group {
    gap: 0.28rem;
  }

  .bs-game-shell.is-cafe .tr-stage-btn,
  .bs-game-shell.is-cafe .tr-star-counter {
    min-block-size: 2rem;
    padding-inline: 0.52rem;
    font-size: 0.74rem;
  }
}

.bs-game-shell.is-cafe .tr-hud-tools::-webkit-scrollbar {
  display: none;
}

.bs-game-shell.is-cafe .tr-toolbar-group:has([data-wc-next]:not([hidden])) [data-wc-serve],
.bs-game-shell.is-cafe .tr-hud-tools:has([data-wc-next]:not([hidden])) [data-wc-serve] {
  display: none;
}

.bs-game-shell.is-cafe .tr-stage-wrap {
  position: relative;
}

.bs-game-shell.is-cafe .tr-stage-wrap[data-coplay-mode="2p"]::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  border: 4px solid #178251;
  box-shadow: none;
}

.bs-game-shell.is-cafe .tr-stage-wrap[data-coplay-mode="2p"][data-active-turn="clinician"]::after {
  border-color: #3b3fc4;
  box-shadow: none;
}

.bs-game-shell.is-cafe .tr-stage-btn {
  position: relative;
  flex: 0 0 auto;
  white-space: nowrap;
  min-inline-size: 2.15rem;
  min-block-size: 2.15rem;
  padding: 0.24rem 0.62rem;
  border-radius: 11px;
  border: 2px solid #4a3122;
  background: #fff9ee;
  color: #2b1a10;
  font-size: 0.76rem;
  font-weight: 760;
  box-shadow: none;
  transition: transform 120ms ease, background-color 140ms ease, border-color 140ms ease;
}

@media (hover: hover) {
  .bs-game-shell.is-cafe .tr-stage-btn:hover:not(:disabled):not(.is-primary):not(.is-shop):not([aria-pressed="true"]) {
    background: #fff0d8;
    border-color: #2c1c12;
  }
}

.bs-game-shell.is-cafe .tr-stage-btn:active:not(:disabled) {
  transform: scale(0.97);
  box-shadow: none;
}

.bs-game-shell.is-cafe .tr-stage-btn.is-primary {
  background: #cf4f2e;
  border: 2px solid #6b1d0a;
  color: #ffffff;
  font-weight: 780;
  box-shadow: none;
}

@media (hover: hover) {
  .bs-game-shell.is-cafe .tr-stage-btn.is-primary:hover:not(:disabled) {
    background: #dc5b39;
  }
}

.bs-game-shell.is-cafe .tr-stage-btn.is-primary:active:not(:disabled) {
  transform: scale(0.97);
  box-shadow: none;
}

.bs-game-shell.is-cafe .tr-stage-btn.is-primary.is-ready-pulse {
  animation: wc-bell-pulse 1.35s ease-in-out infinite;
}

.bs-game-shell.is-cafe .tr-stage-btn.is-shop {
  background: #ffdf73;
  border: 2px solid #704305;
  color: #3f2200;
  font-weight: 800;
}

@media (hover: hover) {
  .bs-game-shell.is-cafe .tr-stage-btn.is-shop:hover:not(:disabled) {
    background: #ffe894;
  }
}

.wc-shop-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  inline-size: 0.62rem;
  block-size: 0.62rem;
  border-radius: 50%;
  background: #e04224;
  border: 2px solid #fffaf0;
}

.bs-game-shell.is-cafe [data-wc-next].tr-stage-btn.is-primary {
  background: #1f8a58;
  border: 2px solid #0b462a;
  box-shadow: none;
  animation: wc-next-bounce 1.2s ease-in-out infinite;
}

@media (hover: hover) {
  .bs-game-shell.is-cafe [data-wc-next].tr-stage-btn.is-primary:hover:not(:disabled) {
    background: #259c65;
  }
}

.bs-game-shell.is-cafe [data-wc-sound][aria-pressed="true"] {
  border: 2px solid #134d56;
  background: #d8f1f5;
  color: #0e3d44;
  box-shadow: none;
}

@media (pointer: coarse) {
  .bs-game-shell.is-cafe .tr-stage-btn {
    min-inline-size: 2.65rem;
    min-block-size: 2.65rem;
  }
}

/* Lock Embedded Game Window Aspect Ratio / Height ONLY When Two-Column Container Fits & Height Allows */
@media (min-height: 540px) {
  @container trstudio (inline-size >= 52rem) {
    .bs-game-shell.tr-studio-frame .tr-studio-grid {
      block-size: clamp(32rem, 84dvh, 47rem);
      max-block-size: 47rem;
      overflow: hidden;
    }
    .bs-game-shell.tr-studio-frame .tr-console {
      block-size: 100%;
      max-block-size: 100%;
      overflow-y: auto;
      min-block-size: 0;
    }
    .bs-game-shell.tr-studio-frame .tr-stage-pane {
      display: flex;
      flex-direction: column;
      block-size: 100%;
      min-block-size: 0;
      min-inline-size: 0;
      overflow: hidden;
    }
    .bs-game-shell.tr-studio-frame .tr-stage-wrap {
      flex: 1 1 0;
      min-block-size: 18rem;
    }
  }
}

@container trstudio (inline-size < 52rem) {
  .bs-game-shell.tr-studio-frame .tr-stage-wrap {
    min-block-size: clamp(21rem, 56dvh, 33rem);
  }
}

@keyframes wc-dot-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.22); opacity: 0.78; }
}

@keyframes wc-bell-pulse {
  0%, 100% { border-color: #6b1d0a; }
  50% { border-color: #e49f16; }
}

@keyframes wc-next-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

.bs-game-shell.is-cafe .tr-stage-wrap {
  background: #e9efe4;
}

.bs-game-shell.is-cafe .bs-canvas:focus-visible {
  outline: 3px solid #9e3921;
  outline-offset: -4px;
}

.bs-game-shell.is-cafe .tr-stage-foot {
  background: #faf2e3;
  border-top: 1px solid rgb(181 69 43 / 0.18);
  color: #5b473c;
}

.bs-game-shell.is-cafe .tr-stage-foot a {
  color: #9e3921;
}

/* ==========================================================================
   FULLSCREEN MULTI-GAME HUB BAR (backstage-study.html)
   ========================================================================== */
.bs-full-hub {
  position: fixed;
  inset: 0;
  inline-size: 100%;
  max-inline-size: 100%;
  block-size: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
  background: #efe7d7;
}

.bs-full-hub > .bs-slp-drawer {
  margin: 0.35rem 0.75rem 0;
  max-block-size: 38dvh;
  overflow-y: auto;
}

.bs-full-hub,
.bs-full-hub *,
.bs-full-hub *::before,
.bs-full-hub *::after {
  box-sizing: border-box;
}

html[data-theme="dark"] .bs-full-hub {
  background: #111316;
}

.bs-fullscreen-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem 0.9rem;
  min-inline-size: 0;
  inline-size: 100%;
  max-inline-size: 100%;
  box-sizing: border-box;
  padding: 0.48rem 0.95rem;
  background: #efe6d4;
  border-bottom: 1px solid rgb(42 32 20 / 0.16);
  color: #231d17;
  z-index: 30;
}

.bs-fullscreen-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex: none;
  font-size: 0.78rem;
  font-weight: 760;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #4f4439;
}

.bs-fullscreen-brand .bd-brand-emblem {
  inline-size: 1.55rem;
  block-size: 1.55rem;
  object-fit: contain;
  flex: none;
}

html[data-theme="light"] .is-logo-dark {
  display: none !important;
}

html:not([data-theme="light"]) .is-logo-light {
  display: none !important;
}

.bs-fullscreen-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.36rem;
  min-inline-size: 0;
  max-inline-size: 100%;
  overflow: visible;
}

.bs-fullscreen-tab {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 0.4rem;
  min-block-size: 2.2rem;
  padding: 0.34rem 0.78rem;
  border-radius: 999px;
  border: 1px solid rgb(42 32 20 / 0.22);
  background: #faf6ec;
  color: #362e25;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.bs-fullscreen-tab:hover {
  border-color: #231d17;
  color: #14110e;
}

.bs-fullscreen-tab:focus-visible {
  outline: 2px solid #284674;
  outline-offset: 2px;
}

.bs-fullscreen-tab[aria-selected="true"] {
  background: #231d17;
  border-color: #231d17;
  color: #fdfbf6;
}

@media (max-width: 40rem) {
  .bs-fullscreen-bar {
    padding: 0.38rem 0.6rem;
    gap: 0.35rem;
  }
  .bs-fullscreen-tab {
    min-block-size: 1.95rem;
    padding: 0.24rem 0.56rem;
    font-size: 0.7rem;
    gap: 0.28rem;
  }
}

.bs-full-hub .bs-game-panel {
  min-inline-size: 0;
  max-inline-size: 100%;
  min-block-size: 0;
  block-size: 100%;
  overflow: hidden;
}

.bs-full-hub .tr-full-shell {
  position: relative;
  inset: auto;
  min-inline-size: 0;
  inline-size: 100%;
  max-inline-size: 100%;
  block-size: 100%;
}

.bs-full-hub .tr-full-stage-col {
  min-inline-size: 0;
  max-inline-size: 100%;
}

.bs-full-hub .tr-full-drawer {
  block-size: 100%;
}

@media (max-width: 56rem) {
  .bs-full-hub {
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .bs-full-hub .tr-full-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .bs-fullscreen-bar {
    padding: max(0.32rem, env(safe-area-inset-top, 0px)) 0.6rem 0.32rem;
  }

  .bs-fullscreen-tab {
    min-block-size: 1.95rem;
    padding: 0.26rem 0.6rem;
    font-size: 0.71rem;
  }

  .bs-full-hub .tr-stage-bar {
    padding: 0.34rem 0.58rem 0.3rem;
    gap: 0.26rem;
  }

  .bs-full-hub .tr-stage-bar-top {
    flex-direction: column;
    align-items: stretch;
    gap: 0.26rem;
  }

  .bs-full-hub .tr-bar-title-row {
    flex-wrap: nowrap;
    min-inline-size: 0;
    gap: 0.3rem;
  }

  .bs-full-hub .tr-bar-title-row strong {
    font-size: 0.86rem;
    white-space: nowrap;
    flex: none;
  }

  .bs-full-hub .tr-hud-level {
    font-size: 0.58rem;
    padding: 0.12rem 0.44rem;
    min-inline-size: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .bs-full-hub .tr-turn-badge {
    margin-inline-start: auto;
    flex: none;
    font-size: 0.56rem;
    padding: 0.12rem 0.42rem;
  }

  .bs-full-hub .tr-hud-tools {
    flex-wrap: wrap;
    overflow-x: visible;
    gap: 0.28rem;
    padding-block: 0.04rem;
  }

  .bs-full-hub .tr-hud-tools::-webkit-scrollbar {
    display: none;
  }

  .bs-full-hub .tr-moves-badge,
  .bs-full-hub .tr-mastery-stars {
    display: none;
  }

  .bs-full-hub .tr-star-counter {
    order: 1;
    min-block-size: 1.9rem;
    padding: 0.14rem 0.52rem;
    font-size: 0.72rem;
  }

  .bs-full-hub [data-wc-drawer-toggle],
  .bs-full-hub [data-tr-drawer-toggle],
  .bs-full-hub [data-sc-drawer-toggle] {
    order: 2;
  }

  .bs-full-hub [data-wc-next],
  .bs-full-hub [data-tr-next-btn],
  .bs-full-hub [data-sc-next] {
    order: 3;
  }

  .bs-full-hub [data-wc-serve],
  .bs-full-hub [data-sc-launch],
  .bs-full-hub [data-tr-flip-btn] {
    order: 4;
  }

  .bs-full-hub .tr-stage-btn {
    order: 5;
    min-block-size: 1.9rem;
    padding: 0.16rem 0.54rem;
    font-size: 0.69rem;
  }

  .bs-full-hub .tr-hud-hint {
    font-size: 0.7rem;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .bs-full-hub .tr-full-shell:has(.tr-full-drawer:not([hidden])) .tr-full-stage-col {
    block-size: 52dvh;
  }

  .bs-full-hub .tr-full-drawer {
    position: fixed;
    inset: auto 0 0 0;
    block-size: 44dvh;
    max-block-size: 44dvh;
  }

  .bs-fullscreen-brand {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bs-game-tab,
  .bs-fullscreen-tab {
    transition: none;
  }
}

/* AAA Physics Easing for Multi-Game Tabs */
.bs-game-tab,
.bs-fullscreen-tab {
  transition-property: background-color, border-color, color, transform, scale;
  transition-duration: 240ms;
  transition-timing-function: linear(0, 0.38 14%, 0.94 34%, 1.12 50%, 1.02 68%, 0.99 84%, 1);
}

@supports not (animation-timing-function: linear(0, 1)) {
  .bs-game-tab,
  .bs-fullscreen-tab {
    transition-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1);
  }
}

.bs-game-tab:active,
.bs-fullscreen-tab:active {
  scale: 0.985;
}

@media (prefers-reduced-motion: reduce) {
  .bs-game-tab,
  .bs-fullscreen-tab {
    transition: none;
  }
}

/* ==========================================================================
   PHONE-GAME HUD POLISH & MIDNIGHT PLANETARIUM PROMPT CARD THEME
   ========================================================================== */
.bs-game-shell .tr-bar-title-row strong,
.bs-game-shell .tr-star-counter,
.bs-game-shell .tr-stage-btn {
  font-family: var(--tr-game-font, "Fredoka Variable", ui-rounded, system-ui, sans-serif);
}

.bs-game-shell .tr-bar-title-row strong {
  font-size: 1.08rem;
  font-weight: 760;
}

.bs-game-shell .tr-stage-btn {
  border: 2px solid #4a3122;
  box-shadow: none;
}

.bs-game-shell .tr-stage-btn.is-primary {
  box-shadow: none;
}

.bs-game-shell .tr-stage-btn:active:not(:disabled) {
  transform: scale(0.97);
  box-shadow: none;
}

.bs-game-shell .tr-star-counter {
  border: 2px solid #8a5607;
  background: #ffe99c;
  color: #4f2c00;
  font-size: 0.88rem;
  font-weight: 780;
  box-shadow: none;
}

.bs-game-shell .tr-star-counter.is-pop {
  animation: bs-star-pop 280ms var(--tr-spring, ease);
}

@keyframes bs-star-pop {
  0% { transform: scale(1); }
  45% { transform: scale(1.18) rotate(-3deg); }
  100% { transform: scale(1); }
}

@media (max-width: 56rem) {
  .wc-turn-spotlight {
    padding: 0.32rem 0.6rem;
    gap: 0.3rem 0.5rem;
  }
  .wc-turn-headline {
    font-size: 0.82rem;
  }
  .wc-player-chip {
    padding: 0.14rem 0.48rem;
    font-size: 0.68rem;
  }
}

.bs-game-shell.is-cafe .tr-overlay-card {
  border: 2.5px solid #3c2618;
  background: #fffaf0;
  color: #2b1a10;
  box-shadow: none;
}

.bs-game-shell.is-cafe .tr-prompt-say-box {
  border: 2px solid #8f2d16;
  background: #fff1dc;
  box-shadow: none;
}

.bs-game-shell.is-cafe .tr-rep-btn {
  border: 2px solid #4a3122;
  background: #ffffff;
  color: #2b1a10;
  box-shadow: none;
}

.bs-game-shell.is-cafe .tr-rep-btn[aria-pressed="true"] {
  border-color: #0b462a;
  background: #1f8a58;
  color: #ffffff;
  box-shadow: none;
}

.bs-game-shell.is-cafe .tr-reward-toast,
.bs-game-shell.is-cafe .tr-kintsugi-banner,
.bs-game-shell.is-cafe .tr-scoring-box,
.bs-game-shell.is-cafe .tr-master-btn,
.bs-game-shell.is-cafe .tr-cue-row {
  box-shadow: none;
  border: 2px solid #4a3122;
}

.bs-game-shell.is-cafe .tr-tab[aria-selected="true"],
.bs-game-shell.is-cafe .tr-console,
.bs-game-shell.is-cafe .tr-stage-pane,
.bs-game-shell.is-cafe.tr-studio-frame {
  box-shadow: none;
}

.bs-game-shell.is-cafe .tr-bar-title-row {
  flex: 1 1 auto;
  min-inline-size: 0;
}

.bs-game-shell.is-cafe .tr-hud-tools {
  flex: 0 1 auto;
}

.bs-game-shell.is-starlight .tr-stage-btn {
  border: 2px solid #d7ad5c;
  box-shadow: none;
}

.bs-game-shell.is-starlight .tr-stage-btn.is-primary {
  border-color: #8a5c14;
  box-shadow: none;
}

.bs-game-shell.is-starlight .tr-star-counter {
  border: 2px solid #d7ad5c;
  box-shadow: none;
}

.bs-game-shell.is-starlight .tr-overlay-card {
  border: 2.5px solid #d9ac54;
  background: #141f3d;
  color: #f6efe0;
  box-shadow: none;
}

.bs-game-shell.is-starlight .tr-overlay-tag {
  background: #283a69;
  border: 2px solid #e4ba67;
  color: #ffe39a;
}

.bs-game-shell.is-starlight .tr-overlay-card h3,
.bs-game-shell.is-starlight .tr-prompt-lead {
  color: #f4ecda;
}

.bs-game-shell.is-starlight .tr-overlay-card p {
  color: #cfd8ea;
}

.bs-game-shell.is-starlight .tr-prompt-say-box {
  border: 2px solid #f0bc5e;
  background: #1d2b52;
  box-shadow: none;
}

.bs-game-shell.is-starlight .tr-prompt-say-box::after {
  border-color: transparent #f0bc5e #f0bc5e transparent;
  background: #1d2b52;
}

.bs-game-shell.is-starlight .tr-prompt-say-kicker {
  color: #ffd578;
}

.bs-game-shell.is-starlight .tr-prompt-say-text {
  color: #ffe588;
  text-shadow: none;
}

.bs-game-shell.is-starlight .tr-rep-btn {
  border: 2px solid #8c6a2a;
  background: #1c2848;
  color: #d6e1f8;
  box-shadow: none;
}

.bs-game-shell.is-starlight .tr-rep-btn[aria-pressed="true"] {
  border-color: #915a06;
  background: #f5be3e;
  box-shadow: none;
  color: #4a2700;
}

.bs-game-shell.is-starlight .tr-rep-progress {
  background: #223056;
  border-color: rgb(228 186 103 / 0.35);
  color: #ffe39a;
}

@media (prefers-reduced-motion: reduce) {
  .bs-game-shell .tr-stage-btn:active:not(:disabled) {
    transform: none;
  }
}

/* ==========================================================================
   WHISKER CAFE CHEF & CAFE STUDIO MODAL (<dialog> + 2-Col Showcase + Painted Cards)
   ========================================================================== */
dialog.wc-shop-dialog {
  box-sizing: border-box;
  inline-size: min(54rem, calc(100dvw - 1.5rem));
  max-inline-size: min(54rem, calc(100dvw - 1.5rem));
  block-size: min(88dvh, 42rem);
  max-block-size: min(88dvh, 42rem);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 2.5px solid #3c2618;
  border-radius: 20px;
  background: #fffaf0;
  color: #2b1a10;
  box-shadow: none;
  font-family: var(--tr-game-font, "Fredoka Variable", ui-rounded, system-ui, sans-serif);
}

dialog.wc-shop-dialog[open] {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
}

dialog.wc-shop-dialog:modal {
  overscroll-behavior: contain;
}

dialog.wc-shop-dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
  background: rgb(28 18 11 / 0.56);
}

.wc-shop-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  block-size: 100%;
  min-block-size: 0;
  overflow: hidden;
}

.wc-shop-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem 0.85rem;
  padding: 0.8rem 1.05rem;
  background: #f5e6cb;
  border-bottom: 2px solid #3c2618;
}

.wc-shop-title-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.75rem;
}

.wc-shop-header h2 {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 800;
  color: #2b1a10;
}

.wc-shop-balance {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  border: 2px solid #8a5607;
  background: #ffe99c;
  color: #4f2c00;
  font-size: 0.8rem;
  font-weight: 800;
}

.wc-shop-close {
  min-inline-size: 4.4rem;
  min-block-size: 2.2rem;
  padding: 0.25rem 0.9rem;
  border-radius: 11px;
  border: 2px solid #3c2618;
  background: #ffffff;
  color: #2b1a10;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 780;
  cursor: pointer;
}

.wc-shop-close:hover {
  background: #fff0d6;
}

.wc-shop-close:active {
  transform: scale(0.97);
}

.wc-shop-main {
  display: grid;
  grid-template-columns: 17.5rem minmax(0, 1fr);
  block-size: 100%;
  min-block-size: 0;
  overflow: hidden;
}

.wc-shop-stage {
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 0.72rem;
  min-block-size: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.95rem;
  background: linear-gradient(180deg, #fff5e3 0%, #f6e4c5 100%);
  border-right: 2px solid #3c2618;
  text-align: center;
}

.wc-shop-stage-canvas-wrap {
  position: relative;
  inline-size: 100%;
  border-radius: 14px;
  border: 2px solid #3c2618;
  background: #2f2017;
  overflow: hidden;
  line-height: 0;
}

.wc-shop-preview-canvas {
  display: block;
  inline-size: 100%;
  block-size: auto;
  aspect-ratio: 280 / 220;
}

.wc-shop-stage-meta {
  display: grid;
  gap: 0.4rem;
  min-inline-size: 0;
  inline-size: 100%;
}

.wc-shop-stage-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

.wc-shop-rank-pill {
  display: inline-flex;
  align-items: center;
  flex: none;
  white-space: nowrap;
  padding: 0.14rem 0.6rem;
  border-radius: 999px;
  border: 2px solid #0e5a38;
  background: #dff6ea;
  color: #0b4027;
  font-size: 0.72rem;
  font-weight: 800;
}

.wc-shop-avatar-name {
  font-size: 0.92rem;
  font-weight: 800;
  color: #2b1a10;
}

.wc-shop-stage-sub {
  margin: 0;
  font-size: 0.74rem;
  font-weight: 700;
  color: #5b4333;
}

progress.wc-shop-prog {
  inline-size: 100%;
  block-size: 0.62rem;
  border: 2px solid #3c2618;
  border-radius: 999px;
  background: #efe0c7;
  overflow: hidden;
  appearance: none;
}

progress.wc-shop-prog::-webkit-progress-bar {
  background: #efe0c7;
}

progress.wc-shop-prog::-webkit-progress-value {
  background: linear-gradient(90deg, #1b8a58 0%, #3fb579 100%);
  border-radius: 999px;
}

progress.wc-shop-prog::-moz-progress-bar {
  background: #1b8a58;
  border-radius: 999px;
}

.wc-shop-right {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  block-size: 100%;
  min-block-size: 0;
  overflow: hidden;
}

.wc-shop-tabs {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: nowrap;
  gap: 0.25rem;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0 1.05rem;
  background: #fbf0dc;
  border-bottom: 2px solid #3c2618;
}

.wc-shop-tab {
  position: relative;
  flex: none;
  min-block-size: 2.55rem;
  padding: 0.48rem 0.95rem;
  border: 0;
  background: transparent;
  color: #5b4333;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 760;
  cursor: pointer;
}

.wc-shop-tab[aria-selected="true"] {
  color: #9e3218;
}

.wc-shop-tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  border-block-end: 4px solid #b5452b;
}

.wc-shop-body {
  min-block-size: 0;
  block-size: 100%;
  overflow-y: auto;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
  background: #fffaf0;
}

.wc-shop-panel[hidden]:not([hidden="until-found"]) {
  display: none;
}

.wc-shop-panel-inner {
  display: grid;
  gap: 1.05rem;
  padding: 1rem 1.05rem 1.15rem;
}

.wc-shop-section {
  display: grid;
  gap: 0.55rem;
}

.wc-shop-sec-title {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6b4e3c;
}

.wc-shop-avatar-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

@media (max-width: 44rem) {
  .wc-shop-main {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }
  .wc-shop-stage {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    justify-items: start;
    text-align: left;
    gap: 0.75rem;
    padding: 0.65rem 0.9rem;
    border-right: 0;
    border-bottom: 2px solid #3c2618;
  }
  .wc-shop-stage-canvas-wrap {
    inline-size: 136px;
  }
  .wc-shop-stage-top {
    align-items: flex-start;
  }
}

@media (max-width: 32rem) {
  .wc-shop-header {
    flex-wrap: wrap;
    gap: 0.45rem;
    padding: 0.55rem 0.78rem;
  }
  .wc-shop-header h2 {
    font-size: 0.92rem;
    white-space: nowrap;
  }
  .wc-shop-balance {
    padding: 0.14rem 0.48rem;
    font-size: 0.72rem;
    white-space: nowrap;
  }
  .wc-shop-close {
    min-inline-size: 3.4rem;
    min-block-size: 1.95rem;
    padding: 0.2rem 0.65rem;
    font-size: 0.76rem;
    flex: none;
  }
  .wc-shop-avatar-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-height: 540px) and (min-width: 34rem) {
  .wc-shop-main {
    grid-template-columns: clamp(11rem, 32vw, 14rem) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
  }
  .wc-shop-stage {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    text-align: center;
    gap: 0.42rem;
    padding: 0.55rem 0.7rem;
    border-right: 2px solid #3c2618;
    border-bottom: 0;
  }
  .wc-shop-stage-canvas-wrap {
    inline-size: min(100%, 148px);
  }
  .wc-shop-stage-top {
    align-items: center;
  }
  .wc-shop-panel-inner {
    padding: 0.65rem 0.8rem 0.8rem;
    gap: 0.7rem;
  }
}

.wc-shop-item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr));
  gap: 0.55rem;
}

.wc-shop-card {
  display: grid;
  gap: 0.35rem;
  align-content: space-between;
  padding: 0.62rem 0.72rem;
  border-radius: 14px;
  border: 2px solid #4a3122;
  background: #ffffff;
  color: #2b1a10;
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: transform 110ms ease, background-color 130ms ease, border-color 130ms ease;
}

@media (hover: hover) {
  .wc-shop-card:hover:not(:disabled):not(.is-equipped) {
    background: #fff5e4;
    border-color: #2b1a10;
  }
}

.wc-shop-card:active:not(:disabled) {
  transform: scale(0.98);
}

.wc-shop-card[aria-pressed="true"],
.wc-shop-card.is-equipped {
  border-color: #0e5a38;
  background: #e1f6eb;
  color: #0b4027;
}

.wc-shop-card.is-locked:not(:disabled) {
  background: #fff4dd;
  border-color: #7c4d08;
}

.wc-shop-card:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.wc-shop-card-top {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}

.wc-shop-card-titlewrap {
  display: flex;
  align-items: center;
  gap: 0.48rem;
  min-inline-size: 0;
}

.wc-shop-card-thumb {
  flex: none;
  inline-size: 46px;
  block-size: 46px;
  padding: 3px;
  border-radius: 10px;
  border: 2px solid #3c2618;
  background: #f8ecd6;
  object-fit: contain;
  object-position: center;
}

.wc-shop-card.is-equipped .wc-shop-card-thumb {
  border-color: #0e5a38;
  background: #ffffff;
}

.wc-shop-icon-badge {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: 30px;
  block-size: 30px;
  border-radius: 9px;
  border: 2px solid #3c2618;
  background: #fff4df;
  color: #5b3216;
}

.wc-shop-icon-badge svg {
  inline-size: 18px;
  block-size: 18px;
  display: block;
}

.wc-shop-card.is-equipped .wc-shop-icon-badge {
  border-color: #0e5a38;
  background: #ffffff;
  color: #0e5a38;
}

.wc-shop-card-name {
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.18;
}

.wc-shop-card-cost {
  flex: none;
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.44rem;
  border-radius: 999px;
  border: 1.5px solid #3c2618;
  background: #ffe99c;
  color: #4f2c00;
  font-size: 0.7rem;
  font-weight: 800;
  white-space: nowrap;
}

.wc-shop-card.is-equipped .wc-shop-card-cost {
  border-color: #0e5a38;
  background: #1a8756;
  color: #ffffff;
}

.wc-shop-card-desc {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.3;
  color: #5b4333;
}

.wc-shop-footer {
  padding: 0.65rem 1.05rem;
  background: #f5e6cb;
  border-top: 2px solid #3c2618;
}

.wc-shop-status {
  margin: 0;
  min-block-size: 1.35em;
  font-size: 0.78rem;
  font-weight: 700;
  color: #3c2618;
}

.bs-fullscreen-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  flex: none;
}

html[data-theme="dark"] .bs-fullscreen-bar {
  background: #14171c;
  border-bottom-color: rgb(244 241 234 / 0.14);
  color: #f4f1ea;
}

html[data-theme="dark"] .bs-fullscreen-brand {
  color: #d7d2c8;
}

html[data-theme="dark"] .bs-fullscreen-tab {
  border-color: rgb(244 241 234 / 0.22);
  background: #1e232b;
  color: #e6e0d4;
}

html[data-theme="dark"] .bs-fullscreen-tab:hover {
  border-color: #f4f1ea;
  color: #ffffff;
}

html[data-theme="dark"] .bs-fullscreen-tab:focus-visible {
  outline-color: #7fb4ff;
}

html[data-theme="dark"] .bs-fullscreen-tab[aria-selected="true"] {
  background: #f4f1ea;
  border-color: #f4f1ea;
  color: #111316;
}

/* ==========================================================================
   GAME 02: STARLIGHT CHIMES - LIGHT THEME (Sunlit Maritime Observatory)
   ========================================================================== */
html[data-theme="light"] .bs-game-shell.is-starlight .tr-stage-pane,
html[data-theme="light"] .bs-game-shell.is-starlight .tr-full-stage-col {
  background: #edf2f8;
  color: #13213a;
}

html[data-theme="light"] .bs-game-shell.is-starlight .tr-stage-bar {
  background: #f7f9fc;
  border-bottom: 1px solid rgb(24 44 82 / 0.18);
  color: #13213a;
}

html[data-theme="light"] .bs-game-shell.is-starlight .tr-bar-title-row strong {
  color: #13213a;
}

html[data-theme="light"] .bs-game-shell.is-starlight .tr-hud-level {
  background: #e3ebf6;
  border-color: rgb(140 94 14 / 0.34);
  color: #6b4606;
}

html[data-theme="light"] .bs-game-shell.is-starlight .tr-hud-hint {
  color: #3f4f6b;
}

html[data-theme="light"] .bs-game-shell.is-starlight .tr-turn-badge[data-turn-state="client"] {
  background: #def3ec;
  border-color: rgb(21 107 79 / 0.38);
  color: #0e523c;
}

html[data-theme="light"] .bs-game-shell.is-starlight .tr-turn-badge[data-turn-state="director"] {
  background: #faedd2;
  border-color: rgb(145 93 10 / 0.42);
  color: #6c4303;
}

html[data-theme="light"] .bs-game-shell.is-starlight .tr-turn-badge[data-turn-state="hold"] {
  background: #fbe3df;
  border-color: rgb(166 56 40 / 0.42);
  color: #8b281a;
}

html[data-theme="light"] .bs-game-shell.is-starlight .tr-star-counter {
  background: #faeed2;
  border-color: #a97822;
  color: #6e4504;
  box-shadow: none;
}

html[data-theme="light"] .bs-game-shell.is-starlight .tr-stage-btn {
  background: #ffffff;
  border-color: #9e7328;
  color: #162540;
  box-shadow: none;
}

@media (hover: hover) {
  html[data-theme="light"] .bs-game-shell.is-starlight .tr-stage-btn:hover:not(:disabled):not(.is-primary):not([aria-pressed="true"]) {
    background: #eef4fc;
    border-color: #6f4c10;
    color: #0f1b30;
  }
}

html[data-theme="light"] .bs-game-shell.is-starlight .tr-stage-btn.is-primary {
  background: #1b3666;
  border-color: #102446;
  color: #ffffff;
}

@media (hover: hover) {
  html[data-theme="light"] .bs-game-shell.is-starlight .tr-stage-btn.is-primary:hover:not(:disabled) {
    background: #254682;
    border-color: #162e57;
    color: #ffffff;
  }
}

html[data-theme="light"] .bs-game-shell.is-starlight .tr-stage-btn[aria-pressed="true"]:not(.is-primary) {
  background: #e1ecf9;
  border-color: #214075;
  color: #11223f;
}

html[data-theme="light"] .bs-game-shell.is-starlight .tr-stage-wrap {
  background: #dfe7f2;
}

html[data-theme="light"] .bs-game-shell.is-starlight .tr-stage-foot {
  background: #f3f6fb;
  border-top: 1px solid rgb(24 44 82 / 0.16);
  color: #3f4f6b;
}

html[data-theme="light"] .bs-game-shell.is-starlight .tr-stage-foot a {
  color: #1b4b7a;
}

html[data-theme="light"] .bs-game-shell.is-starlight .tr-overlay-card {
  border-color: #b5842e;
  background: #fdfcf8;
  color: #13213a;
  box-shadow: none;
}

html[data-theme="light"] .bs-game-shell.is-starlight .tr-overlay-tag {
  background: #e4ecf8;
  border-color: #7d5816;
  color: #182b4c;
}

html[data-theme="light"] .bs-game-shell.is-starlight .tr-overlay-card h3,
html[data-theme="light"] .bs-game-shell.is-starlight .tr-prompt-lead {
  color: #13213a;
}

html[data-theme="light"] .bs-game-shell.is-starlight .tr-overlay-card p {
  color: #3f4f6b;
}

html[data-theme="light"] .bs-game-shell.is-starlight .tr-prompt-say-box {
  border-color: #c28524;
  background: #fff9eb;
  box-shadow: none;
}

html[data-theme="light"] .bs-game-shell.is-starlight .tr-prompt-say-box::after {
  border-color: transparent #c28524 #c28524 transparent;
  background: #fff9eb;
}

html[data-theme="light"] .bs-game-shell.is-starlight .tr-prompt-say-kicker {
  color: #845308;
}

html[data-theme="light"] .bs-game-shell.is-starlight .tr-prompt-say-text {
  color: #13213a;
  text-shadow: none;
}

html[data-theme="light"] .bs-game-shell.is-starlight .tr-rep-btn {
  border-color: #b59254;
  background: #ffffff;
  color: #20314f;
  box-shadow: none;
}

html[data-theme="light"] .bs-game-shell.is-starlight .tr-rep-btn[aria-pressed="true"] {
  border-color: #8a5607;
  background: #f5be3e;
  color: #3d2000;
}

html[data-theme="light"] .bs-game-shell.is-starlight .tr-rep-progress {
  background: #f9eed4;
  border-color: rgb(140 94 14 / 0.35);
  color: #6b4606;
}

/* ==========================================================================
   GAME 03: WHISKER CAFE - DARK THEME (Twilight Espresso & Walnut Patisserie)
   ========================================================================== */
html[data-theme="dark"] .bs-game-shell.is-cafe .tr-stage-pane,
html[data-theme="dark"] .bs-game-shell.is-cafe .tr-full-stage-col {
  background: #171412;
  color: #f4ece0;
}

html[data-theme="dark"] .bs-game-shell.is-cafe .tr-stage-bar {
  background: #211b17;
  border-bottom-color: rgb(224 142 98 / 0.22);
  color: #f4ece0;
}

html[data-theme="dark"] .bs-game-shell.is-cafe .tr-hud-level {
  background: #33241d;
  border-color: rgb(232 135 96 / 0.36);
  color: #ffc5ae;
}

html[data-theme="dark"] .bs-game-shell.is-cafe .tr-hud-hint {
  color: #cabdb0;
}

html[data-theme="dark"] .bs-game-shell.is-cafe .tr-turn-badge[data-turn-state="client"] {
  background: #153124;
  border-color: rgb(94 218 160 / 0.4);
  color: #9bf2c6;
}

html[data-theme="dark"] .bs-game-shell.is-cafe .tr-turn-badge[data-turn-state="director"] {
  background: #23254f;
  border-color: rgb(146 152 246 / 0.42);
  color: #ccd0ff;
}

html[data-theme="dark"] .bs-game-shell.is-cafe .wc-turn-spotlight {
  border-bottom-color: rgb(94 218 160 / 0.3);
  background: linear-gradient(90deg, #163326 0%, #182921 100%);
  color: #9ff5c9;
}

html[data-theme="dark"] .bs-game-shell.is-cafe .wc-turn-spotlight[data-active-turn="clinician"] {
  border-bottom-color: rgb(146 152 246 / 0.35);
  background: linear-gradient(90deg, #21244f 0%, #1c1e3b 100%);
  color: #ccd0ff;
}

html[data-theme="dark"] .bs-game-shell.is-cafe .wc-player-chip {
  border-color: #7d624d;
  background: #2b221c;
  color: #efe5d8;
}

html[data-theme="dark"] .bs-game-shell.is-cafe .wc-player-chip.is-client.is-active {
  border-color: #2ecc87;
  background: #17784d;
  color: #ffffff;
}

html[data-theme="dark"] .bs-game-shell.is-cafe .wc-player-chip.is-clinician.is-active {
  border-color: #8288ff;
  background: #3d42b8;
  color: #ffffff;
}

html[data-theme="dark"] .bs-game-shell.is-cafe .tr-stage-btn {
  border-color: #785d49;
  background: #2b221d;
  color: #f4ece0;
  box-shadow: none;
}

@media (hover: hover) {
  html[data-theme="dark"] .bs-game-shell.is-cafe .tr-stage-btn:hover:not(:disabled):not(.is-primary):not(.is-shop):not([aria-pressed="true"]) {
    background: #382c25;
    border-color: #ad8567;
  }
}

html[data-theme="dark"] .bs-game-shell.is-cafe .tr-stage-btn.is-primary {
  background: #cf4f2e;
  border-color: #f0896d;
  color: #ffffff;
}

html[data-theme="dark"] .bs-game-shell.is-cafe .tr-stage-btn.is-shop {
  background: #ffcf4d;
  border-color: #8f5c0c;
  color: #2c1600;
}

html[data-theme="dark"] .bs-game-shell.is-cafe [data-wc-next].tr-stage-btn.is-primary {
  background: #1d8a57;
  border-color: #66e0a5;
  color: #ffffff;
}

html[data-theme="dark"] .bs-game-shell.is-cafe [data-wc-sound][aria-pressed="true"] {
  border-color: #4dc2d4;
  background: #17383e;
  color: #9df0fc;
}

html[data-theme="dark"] dialog.wc-shop-dialog {
  border-color: #7a5c46;
  background: #1d1815;
  color: #f4ece0;
  box-shadow: none;
}

html[data-theme="dark"] .wc-shop-header,
html[data-theme="dark"] .wc-shop-footer {
  background: #28201b;
  border-color: #5b4333;
}

html[data-theme="dark"] .wc-shop-header h2,
html[data-theme="dark"] .wc-shop-avatar-name,
html[data-theme="dark"] .wc-shop-status {
  color: #f4ece0;
}

html[data-theme="dark"] .wc-shop-close {
  border-color: #785d49;
  background: #302620;
  color: #f4ece0;
}

html[data-theme="dark"] .wc-shop-stage {
  background: linear-gradient(180deg, #251e19 0%, #1d1714 100%);
  border-color: #5b4333;
}

html[data-theme="dark"] .wc-shop-stage-sub,
html[data-theme="dark"] .wc-shop-sec-title,
html[data-theme="dark"] .wc-shop-card-desc,
html[data-theme="dark"] .wc-shop-tab {
  color: #cbbdb0;
}

html[data-theme="dark"] .wc-shop-tabs {
  background: #231c17;
  border-bottom-color: #5b4333;
}

html[data-theme="dark"] .wc-shop-tab[aria-selected="true"] {
  color: #ffb099;
}

html[data-theme="dark"] .wc-shop-tab[aria-selected="true"]::after {
  border-block-end-color: #f07b63;
}

html[data-theme="dark"] .wc-shop-body {
  background: #1a1512;
}

html[data-theme="dark"] .wc-shop-card {
  border-color: #664f3e;
  background: #27201b;
  color: #f4ece0;
}

@media (hover: hover) {
  html[data-theme="dark"] .wc-shop-card:hover:not(:disabled):not(.is-equipped) {
    background: #332922;
    border-color: #a68268;
  }
}

html[data-theme="dark"] .wc-shop-card[aria-pressed="true"],
html[data-theme="dark"] .wc-shop-card.is-equipped {
  border-color: #55d497;
  background: #163325;
  color: #b4f7d6;
}

html[data-theme="dark"] .wc-shop-card.is-locked:not(:disabled) {
  background: #2e2314;
  border-color: #b88228;
}

html[data-theme="dark"] .wc-shop-card-thumb {
  border-color: #6b5240;
  background: #332922;
}

html[data-theme="dark"] .wc-shop-icon-badge {
  border-color: #6b5240;
  background: #302620;
  color: #f4d6be;
}

/* Fix specificity override so Whisker Cafe & Starlight overlay cards stay dark in Dark Mode */
html[data-theme="dark"] .bs-game-shell.is-cafe .tr-overlay-card {
  border-color: #8f6b4e;
  background: linear-gradient(180deg, #241c17 0%, #191310 100%);
  color: #f6efe3;
}

html[data-theme="dark"] .bs-game-shell.is-cafe .tr-prompt-say-box {
  border-color: #e0765e;
  background: linear-gradient(135deg, #2d1e19 0%, #241713 100%);
}

html[data-theme="dark"] .bs-game-shell.is-cafe .tr-rep-btn {
  border-color: #7c634f;
  background: #2b221c;
  color: #f4ece0;
}

html[data-theme="dark"] .bs-game-shell.is-cafe .tr-rep-btn[aria-pressed="true"] {
  border-color: #f2be52;
  background: #9f6007;
  color: #fff9ec;
}

html[data-theme="dark"] .bs-game-shell .tr-star-counter {
  border-color: #b4842c;
  background: #2c2211;
  color: #fbd887;
}

html[data-theme="dark"] .bs-game-shell.is-cafe .tr-reward-toast,
html[data-theme="dark"] .bs-game-shell.is-cafe .tr-kintsugi-banner,
html[data-theme="dark"] .bs-game-shell.is-cafe .tr-scoring-box,
html[data-theme="dark"] .bs-game-shell.is-cafe .tr-master-btn,
html[data-theme="dark"] .bs-game-shell.is-cafe .tr-cue-row {
  border-color: #6b5342;
}

html[data-theme="dark"] .bs-game-shell.is-cafe .tr-stage-btn {
  border-color: #6b5342;
}

dialog.wc-shop-dialog:modal {
  overscroll-behavior: contain;
}

dialog.wc-shop-dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
}

/* Touch-friendly Starlight Chimes floating deflector rotation controls */
.sc-rotate-pill {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0.75rem;
  z-index: 18;
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  max-width: calc(100% - 1.5rem);
  align-items: center;
  gap: 0.35rem;
  padding: 0.32rem 0.5rem;
  border-radius: 999px;
  background: rgba(15, 24, 44, 0.9);
  border: 1.5px solid rgba(228, 186, 103, 0.55);
  color: #fff5dd;
  font-size: 0.78rem;
  font-weight: 700;
}

.sc-rotate-pill[hidden] {
  display: none;
}

.sc-rotate-btn {
  border: 1px solid rgba(228, 186, 103, 0.45);
  background: #22325a;
  color: #fff5dd;
  border-radius: 999px;
  padding: 0.25rem 0.58rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  min-block-size: 30px;
}

html[data-theme="light"] .bs-game-shell.is-starlight .sc-rotate-pill {
  background: rgba(255, 252, 244, 0.95);
  border-color: #9e7328;
  color: #162540;
}

html[data-theme="light"] .bs-game-shell.is-starlight .sc-rotate-btn {
  background: #ffffff;
  border-color: #9e7328;
  color: #162540;
}

/* Active SLP Target Word Chip Overlay inside Game Stage */
.bs-slp-stage-chip {
  position: absolute;
  top: 0.65rem;
  left: 0.75rem;
  z-index: 16;
  display: inline-flex;
  align-items: center;
  gap: 0.48rem;
  max-width: calc(100% - 1.5rem);
  padding: 0.34rem 0.75rem;
  border-radius: 999px;
  background: rgba(18, 29, 44, 0.88);
  border: 1.5px solid rgba(241, 189, 86, 0.62);
  color: #fbf7ee;
  font-size: 0.8rem;
  font-weight: 700;
  pointer-events: auto;
}

.bs-slp-stage-chip[hidden] {
  display: none;
}

html[data-theme="light"] .bs-slp-stage-chip {
  background: rgba(255, 251, 240, 0.95);
  color: #17273b;
  border-color: #b57b14;
}

.bs-slp-stage-chip-tag {
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.68rem;
  background: rgba(241, 189, 86, 0.24);
  color: inherit;
}

/* Unified Check Model Cue panel inside Shared Portal Overlay */
.tr-prompt-model-box {
  margin-top: 0.45rem;
  padding: 0.48rem 0.68rem;
  border-radius: 10px;
  border: 1px dashed rgba(30, 110, 122, 0.45);
  background: rgba(30, 110, 122, 0.08);
  font-size: 0.84rem;
  text-align: left;
}

html[data-theme="dark"] .tr-prompt-model-box {
  border-color: rgba(114, 210, 224, 0.45);
  background: rgba(34, 82, 92, 0.25);
  color: #dff7fa;
}

.tr-prompt-model-btn {
  margin-top: 0.38rem;
  border-radius: 999px;
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  padding: 0.24rem 0.68rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

@media (pointer: coarse) {
  .sc-rotate-btn,
  .tr-prompt-model-btn {
    min-block-size: 44px;
  }
}

.visually-hidden {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}


/* ==========================================================================
   V10: STANDALONE PANEL STUDIO SLOT, FLEX TAB REORDER/HIDE & DARK PARITY
   ========================================================================== */
.bps-deck-slot {
  border-bottom: 1px solid var(--bps-line, var(--alpha-line-dk, rgb(28 36 48 / 0.12)));
  background: var(--bps-panel, var(--dk-1, #faf6ee));
  color: var(--bps-ink, var(--dk-ink, #1c2430));
}

.bs-game-shell .tr-tabs {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  overflow-x: auto;
  scrollbar-width: none;
}

.bs-game-shell .tr-tabs::-webkit-scrollbar {
  display: none;
}

.bs-game-shell .tr-tab {
  flex: 1 1 0;
  white-space: nowrap;
}

.bs-game-shell .tr-tab[hidden] {
  display: none;
}

html[data-theme="dark"] .bps-deck-slot,
html[data-theme="dark"] .bps-standalone-slot {
  border-bottom-color: rgb(232 238 245 / 0.12);
  background: #142230;
  color: #f3f7fa;
}
