/* Shared palette for the site, waiting room and match controls. */
html[data-theme] {
  --club-paper: #f3f0e6;
  --club-surface: #fffdf5;
  --club-raised: #eae6d8;
  --club-line: #d8d3c2;
  --club-ink: #212e25;
  --club-muted: #586557;
  --club-green: #2b624a;
  --club-selection: #e0eadc;
  --club-button: #285b43;
  --club-button-hover: #1d4834;
  --club-logo-gold: #ffd83d;
}

html[data-theme=dark] {
  --club-paper: #171f1a;
  --club-surface: #212c24;
  --club-raised: #29382d;
  --club-line: #455448;
  --club-ink: #f3f1e5;
  --club-muted: #b6c4b4;
  --club-green: #b3d5b9;
  --club-selection: #304c3a;
  --club-button: #35664b;
  --club-button-hover: #2b553d;
}

html[data-theme] body:has(#app.cinema-shell) {
  --bg: var(--club-paper);
  --bg-2: var(--club-raised);
  --surface: var(--club-surface);
  --surface-2: var(--club-raised);
  --surface-3: var(--club-selection);
  --text: var(--club-ink);
  --text-2: var(--club-muted);
  --text-3: var(--club-muted);
  --brand: var(--club-green);
  --brand-2: var(--club-green);
  --brand-soft: var(--club-selection);
  --border: var(--club-line);
  --border-strong: var(--club-line);
  --sel-bg: var(--club-button);
  --sel-text: #fff;
  --sel-border: var(--club-button);
  background: var(--club-paper);
}

html[data-theme] #app.cinema-shell[data-page] :is(.bga-header, .site-bottom-nav) {
  background: var(--club-surface);
  border-color: var(--club-line);
}
html[data-theme] #app.cinema-shell[data-page] .bga-header .bga-logo-text {
  color: var(--club-ink);
  font-weight: 700;
}
html[data-theme] #app.cinema-shell[data-page] :is(.home-header-nav, .site-bottom-nav) a[aria-current=page] {
  color: var(--club-green);
  background: var(--club-selection);
}
/* The v559 banner room-code control, placed in the shared header. */
html[data-theme] #app.cinema-shell .bga-header .cinema-header-tools .cinema-header-join-form {
  display: inline-flex;
  align-items: stretch;
  flex: 0 1 auto;
  min-width: 0;
  height: 40px;
  box-sizing: content-box;
  border: 1px solid var(--club-line);
  border-radius: 999px;
  background: var(--club-surface);
}
html[data-theme] #app.cinema-shell .bga-header .cinema-header-tools .cinema-header-join-form input[type=text] {
  box-sizing: border-box;
  width: 74px;
  min-width: 0;
  height: auto;
  min-height: 0;
  padding: 0 10px;
  border: 0;
  border-radius: 999px 0 0 999px;
  background: transparent;
  color: var(--club-ink);
  font-size: 14px;
}
html[data-theme] #app.cinema-shell .bga-header .cinema-header-tools .cinema-header-join-form .cinema-header-join {
  height: auto;
  min-height: 0;
  padding: 0 10px;
  border: 1px solid var(--club-line);
  border-radius: 999px;
  background: var(--club-selection);
  color: var(--club-green);
  font-size: 14px;
  box-shadow: none;
}
html[data-theme] #app.cinema-shell .bga-header .cinema-header-tools .cinema-header-join-form .cinema-header-join:hover {
  background: var(--club-raised);
}
html[data-theme] #app.cinema-shell .bga-header .cinema-header-tools .cinema-header-join-form:focus-within {
  outline: 2px solid var(--club-green);
  outline-offset: 2px;
}

html[data-theme] #app.cinema-shell[data-page] .bga-header .bga-trademark {
  box-sizing: border-box;
  padding: 3px;
  border-radius: 9px;
  background: var(--club-logo-gold);
  filter: none;
}

.club-hero {
  display: grid;
  grid-template-columns: max-content clamp(300px, 33%, 460px);
  align-items: center;
  gap: 12px;
  position: relative;
  isolation: isolate;
  margin-bottom: 14px;
  padding: 16px clamp(20px, 4vw, 64px) 16px clamp(22px, 4vw, 64px);
  border: 1px solid var(--club-line);
  border-radius: 14px;
  background:
    linear-gradient(90deg, #101e17 0%, #101e17ed 22%, #101e1740 70%, #101e1766 100%),
    #101e17 url("../identity/club-hero.5ebc2b2938e2.webp") center right / cover no-repeat;
  color: #fffdf2;
}
.club-hero-label { margin: 0 0 6px; color: #f2d497; font-size: 14px; }
.club-hero h1 {
  margin: 0;
  color: inherit;
  font: 700 clamp(30px, 3.6vw, 54px)/1.2 var(--ui-font, sans-serif);
}
.club-banner-stickers {
  display: none;
  position: absolute;
  left: 10px;
  bottom: 9px;
  flex-direction: column;
  align-items: start;
  gap: 5px;
  pointer-events: none;
}
.club-recommendation .featured-slide.is-current .club-banner-stickers { display: flex; }
.club-banner-sticker {
  padding: 5px 9px;
  border-radius: 5px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
  box-shadow: 0 3px 9px #0003;
  white-space: nowrap;
}
.club-banner-sticker.sticker-red { background: #eb3549; transform: rotate(-9deg); }
.club-banner-sticker.sticker-blue { background: #2162ee; transform: translateX(9px) rotate(6deg); }

.club-catalogue-title {
  margin: 0;
  color: var(--club-ink);
  font-size: clamp(20px, 2.2vw, 28px);
}
.club-catalogue-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.club-catalogue-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
#app.cinema-shell .club-catalogue-rooms {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding-inline: 12px;
  border: 1px solid var(--club-line);
  border-radius: 999px;
  background: var(--club-selection);
  color: var(--club-green);
  text-decoration: none;
  white-space: nowrap;
}
#app.cinema-shell .club-catalogue-rooms:hover {
  background: var(--club-raised);
}
.club-recommendation {
  display: grid;
  grid-template-rows: clamp(118px, 11vw, 168px) auto;
  min-width: 0;
  color: #fffdf2;
}
.club-recommendation[hidden] { display: none; }
#app.cinema-shell .club-recommendation .featured-poster {
  position: relative;
  isolation: isolate;
  overflow: visible;
  background: transparent;
  box-shadow: none;
}
.club-recommendation .featured-slide {
  position: absolute;
  inset: 50% 5% auto auto;
  width: 61%;
  max-height: 83%;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  background: #151d17;
  box-shadow: 0 3px 10px #16261f45;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: none;
  transform: translateY(-50%) rotate(4deg);
  z-index: 5;
}
.club-recommendation .featured-slide[data-depth="1"] { transform: translate(-14%, calc(-50% - 13px)) rotate(-4deg); z-index: 4; }
.club-recommendation .featured-slide[data-depth="2"] { transform: translate(-28%, -50%) rotate(-7deg); z-index: 3; }
.club-recommendation .featured-slide[data-depth="3"] { transform: translate(-42%, calc(-50% + 13px)) rotate(-3deg); z-index: 2; }
.club-recommendation .featured-slide[data-depth="4"] { transform: translate(-56%, -50%) rotate(4deg); z-index: 1; }
.club-recommendation .featured-image { object-fit: cover; }
.club-recommendation-controls { display: flex; justify-content: space-between; align-items: center; gap: 4px; }
#app.cinema-shell .club-recommendation .featured-dot { width: clamp(20px, 2vw, 30px); }
.club-recommendation .featured-dot > span { background: #e6ead4a6; }
.club-recommendation .featured-dot[aria-pressed=true] > span { background: #f2d497; }
#app.cinema-shell .club-recommendation .featured-carousel-controls button {
  width: 36px;
  background: #ffffff1c;
  color: #fffdf2;
}
#app.cinema-shell .club-recommendation button:focus-visible {
  outline: 2px solid #f2d497;
  outline-offset: -2px;
}

html[data-theme] #app.cinema-shell[data-page=lobby] .lobby-quick-row .room-list > .empty {
  grid-column: 1 / -1;
  min-height: 0;
  height: auto;
  padding: 9px 12px;
  border: 0;
  border-inline-start: 2px solid var(--club-line);
  border-radius: 0;
  color: var(--club-muted);
}

html[data-theme] #app.cinema-shell:is([data-page=lobby],[data-page=games]) .game-library-section {
  padding-top: 14px;
  border-top: 1px solid var(--club-line);
}
html[data-theme] #app.cinema-shell:is([data-page=lobby],[data-page=games]) .game-card {
  border: 1px solid var(--club-line);
  border-radius: 12px;
  background: var(--club-surface);
}
html[data-theme] #app.cinema-shell:is([data-page=lobby],[data-page=games]) .game-card .g-name {
  color: var(--club-ink);
  font-weight: 700;
}
html[data-theme] #app.cinema-shell:is([data-page=lobby],[data-page=games]) .game-card > .quick-create {
  color: var(--club-green);
  background: var(--club-selection);
  border: 0;
  border-radius: 999px;
  padding-inline: clamp(5px, 1vw, 14px);
}
html[data-theme] #app.cinema-shell[data-page] :is(.lobby-library-tools, .room-directory-tools) button[aria-pressed=true] {
  color: var(--club-green);
  background: var(--club-selection);
  border-color: var(--club-line);
}
html[data-theme] #app.cinema-shell[data-page] :is(.lobby-quick-row, .tables-room-list) .room-list-card {
  background: var(--club-surface);
  border-color: var(--club-line);
  box-shadow: none;
}
html[data-theme] #app.cinema-shell[data-page] :is(.lobby-quick-row, .tables-room-list) .room-list-card .r-name {
  color: var(--club-ink);
}
html[data-theme] #app.cinema-shell[data-page] :is(.lobby-quick-row, .tables-room-list) .room-list-card > .lobby-resume-action,
html[data-theme] #app.cinema-shell[data-page=tables] .room-directory-actions > .room-directory-create {
  border-color: var(--club-button);
  background: var(--club-button);
  color: #fff;
}
html[data-theme] #app.cinema-shell[data-page] :is(.lobby-quick-row, .tables-room-list) .room-list-card > .lobby-resume-action:hover,
html[data-theme] #app.cinema-shell[data-page=tables] .room-directory-actions > .room-directory-create:hover {
  background: var(--club-button-hover);
}

/* The directory uses game covers as the main cue for browsing tables. */
html[data-theme] #app.cinema-shell[data-page=tables] .bga-content {
  max-width: 1600px;
  padding-block: clamp(12px, 2.3vw, 32px) 8px;
}
#app.cinema-shell[data-page=tables] .room-directory-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 16px;
  padding: 0 0 12px;
}
#app.cinema-shell[data-page=tables] .room-directory-actions {
  justify-self: end;
  gap: 8px;
  margin: 0;
}
#app.cinema-shell[data-page=tables] .room-directory-actions > button:not(.room-directory-create) {
  min-height: 40px;
  padding-inline: 12px;
  border: 1px solid var(--club-line);
  background: var(--club-surface);
  color: var(--club-ink);
  box-shadow: none;
}
#app.cinema-shell[data-page=tables] .room-directory-tools .table-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  width: min(100%, 460px);
  box-sizing: border-box;
  padding: 4px;
  border-radius: 14px;
  background: var(--club-raised);
}
html[data-theme] #app.cinema-shell[data-page=tables] .room-directory-tools .table-filters button {
  justify-content: center;
  min-width: 0;
  padding-inline: 4px;
  border-color: transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--club-ink);
  white-space: nowrap;
}
html[data-theme] #app.cinema-shell[data-page=tables] .room-directory-tools .table-filters button[aria-pressed=true] {
  background: var(--club-surface);
  color: var(--club-green);
  box-shadow: 0 1px 3px #0002;
}
html[data-theme] #app.cinema-shell[data-page=tables] .tables-room-list .room-list {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr));
  justify-content: stretch;
  align-items: start;
  gap: 14px;
  margin: 12px 0 8px;
}
html[data-theme] #app.cinema-shell[data-page=tables] .tables-room-list .room-list-card {
  grid-column: auto;
}
html[data-theme] #app.cinema-shell:is([data-page=lobby],[data-page=tables]) :is(.lobby-quick-row,.tables-room-list) .room-list-card {
  --room-cover-width: 64px;
  grid-template-columns: var(--room-cover-width) minmax(0, 1fr) auto;
  grid-template-rows: 23px auto;
  height: auto;
  min-height: 0;
  margin: 0;
  box-sizing: border-box;
  border-radius: 12px;
  box-shadow: 0 2px 5px #17251a12;
}
html[data-theme] #app.cinema-shell:is([data-page=lobby],[data-page=tables]) :is(.lobby-quick-row,.tables-room-list) .room-list-card .lobby-room-code {
  width: 100%;
  height: 23px;
  flex-direction: row;
  background: #ffe5a0;
  color: #513a14;
  box-shadow: 2px 3px 5px #62481c66;
  transform: translate(-5px, 8px) rotate(-3deg);
  z-index: 1;
}
html[data-theme] #app.cinema-shell:is([data-page=lobby],[data-page=tables]) :is(.lobby-quick-row,.tables-room-list) .room-list-card .lobby-room-cover {
  position: static;
  inset: auto;
  width: 100%;
  height: auto;
  aspect-ratio: 8 / 5;
  padding: 1px;
  box-sizing: border-box;
  border: 0;
  background: #fff;
  border-radius: 5px;
  box-shadow: 2px 2px 0 #99744d29;
  transform: translateX(5px) rotate(5deg);
}
html[data-theme] #app.cinema-shell:is([data-page=lobby],[data-page=tables]) :is(.lobby-quick-row,.tables-room-list) .room-list-card .lobby-room-cover > :is(img,svg) {
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: contain;
}
#app.cinema-shell[data-page=tables] .room-directory-actions > .room-directory-create {
  min-height: 40px;
  padding-inline: 14px;
  border-radius: 999px;
  white-space: nowrap;
}
.room-create-compact { display: none; }
html[data-theme] #app.cinema-shell[data-page=tables] .tables-room-list .room-list > .empty {
  min-height: 96px;
  padding: 20px;
  border: 1px dashed var(--club-line);
  border-radius: 14px;
  background: var(--club-surface);
  color: var(--club-muted);
}

html[data-theme] #app[data-page=community] .community-workspace {
  --surface: var(--club-surface);
  --surface-2: var(--club-raised);
  --text: var(--club-ink);
  --text-2: var(--club-muted);
  --border: var(--club-line);
  --brand: var(--club-button);
  --brand-soft: var(--club-selection);
  --bubble: var(--club-raised);
  --bubble-self: var(--club-selection);
  --on-brand: #fff;
}
html[data-theme] #app[data-page=community] .community-channel-list > button[aria-current=page] {
  color: var(--club-green);
  background: var(--club-selection);
  border-color: var(--club-line);
}

.community-page-title,
.community-active-channel h2 {
  margin: 0;
  color: var(--club-ink);
  font-size: 21px;
  line-height: 1.3;
}
.community-active-channel {
  display: flex;
  flex: none;
  align-items: center;
  padding: 12px clamp(16px, 3vw, 38px);
  border-bottom: 1px solid var(--club-line);
}
.community-public-notice {
  flex: none;
  margin: 0;
  padding: 4px 12px;
  color: var(--club-muted);
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
}

@media (min-width: 881px) {
  html[data-theme] #app.cinema-shell[data-page=community] .bga-content.community-workspace {
    grid-template-columns: minmax(172px, 220px) minmax(0, 1fr);
    gap: 14px;
    max-width: 1480px;
    margin-inline: auto;
    padding: clamp(12px, 2vw, 26px);
  }
  #app[data-page=community] .community-channel-bar,
  #app[data-page=community] .community-conversation {
    border: 1px solid var(--club-line);
    border-radius: 14px;
  }
  #app[data-page=community] .community-channel-bar {
    padding: 16px 12px 12px;
    background: var(--club-raised);
  }
  .community-page-title { margin: 2px 8px 18px; }
  #app[data-page=community] .community-channel-list > button {
    border-radius: 8px;
  }
  html[data-theme] #app[data-page=community] .community-channel-list > button[aria-current=page] {
    background: var(--club-surface);
  }
  #app[data-page=community] .community-channel-bar > .community-connection {
    order: 0;
    padding: 10px 8px 0;
    border-top: 1px solid var(--club-line);
  }
  #app[data-page=community] .community-timeline {
    padding: 14px clamp(16px, 3vw, 38px);
  }
  #app[data-page=community] .community-timeline .community-message {
    max-width: 860px;
    margin-inline: auto;
  }
}

@media (max-width: 880px) {
  .community-page-title,
  .community-active-channel { display: none; }
  #app[data-page=community] .community-channel-bar {
    gap: 8px;
    padding: 6px 8px;
    background: var(--club-surface);
  }
  #app[data-page=community] .community-channel-list {
    padding: 3px;
    border-radius: 10px;
    background: var(--club-raised);
  }
  #app[data-page=community] .community-channel-list > button {
    border-radius: 7px;
  }
  html[data-theme] #app[data-page=community] .community-channel-list > button[aria-current=page] {
    background: var(--club-surface);
    box-shadow: 0 1px 3px #0002;
  }
}

@media (max-width: 560px) {
  #app.cinema-shell[data-page=tables] .room-directory-tools {
    gap: 5px;
  }
  #app.cinema-shell[data-page=tables] .room-directory-tools .table-filters {
    grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 1.25fr);
    gap: 1px;
    padding: 2px;
  }
  html[data-theme] #app.cinema-shell[data-page=tables] .room-directory-tools .table-filters button {
    flex-direction: column;
    gap: 0;
    padding: 2px 0;
    font-size: 11px;
    line-height: 1.2;
  }
  #app.cinema-shell[data-page=tables] .room-directory-actions { gap: 4px; }
  #app.cinema-shell[data-page=tables] .room-directory-actions > button {
    min-width: 36px;
    padding-inline: 5px;
  }
  #app.cinema-shell[data-page=tables] .room-directory-actions > button span,
  .room-create-wide { display: none; }
  .room-create-compact { display: inline; }
  #app.cinema-shell[data-page=tables] .room-directory-actions > .room-directory-create { padding-inline: 9px; }
}

html[data-theme] #app.cinema-shell[data-page] :is(.profile-header-card, .profile-function-grid > a, .replay-item, .replay-viewer, .lab-entry) {
  color: var(--club-ink);
  background: var(--club-surface);
  border-color: var(--club-line);
  box-shadow: none;
}
html[data-theme] #app.cinema-shell[data-page] :is(.profile-edit, .replay-play, .replay-item > button) {
  color: #fff;
  background: var(--club-button);
  border-color: var(--club-button);
}

html[data-theme] #app.cinema-shell[data-page=replays] .bga-content {
  max-width: 1040px;
  padding-inline: clamp(12px, 3vw, 32px);
}

#app.cinema-shell[data-page=replays] .page-header { margin-bottom: 16px; }

#app .replay-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

#app .replay-list > .empty { grid-column: 1 / -1; }

#app .replay-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px;
}

#app .replay-cover {
  display: block;
  width: clamp(52px, 8vw, 96px);
  height: auto;
  aspect-ratio: 8 / 5;
  border-radius: 7px;
  object-fit: contain;
  background: var(--club-raised);
}

.replay-item-copy h3 { font-size: 15px; }
.replay-item-copy p { line-height: 1.45; }
.replay-item-players { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#app .replay-item > button { margin: 0; min-height: 40px; padding-inline: 12px; }

#app .replay-viewer {
  padding: clamp(10px, 2vw, 18px);
  border-radius: 16px;
  overflow-wrap: anywhere;
}

#app .replay-heading p { margin-bottom: 0; }
#app .replay-result { gap: 5px; margin: 8px 0; padding: 0; }
#app .replay-result > b { flex-basis: auto; }
#app .replay-game-frame {
  position:relative;
  width:100%;
  margin-inline:auto;
}
#app .replay-game-frame.is-rotated{
  position:fixed;left:50%;top:50%;width:100dvh;height:100dvw;
  transform:translate(-50%,-50%) rotate(90deg);z-index:200;
  display:flex;flex-direction:column;justify-content:center;align-items:center;background:var(--club-paper);
}
#app .replay-game-frame.is-rotated .replay-board{width:min(100%,calc(160dvw))}
#app .replay-game-backdrop{width:100%}
#app .replay-game-frame .room-menu-content{z-index:2}
#app .replay-viewer .replay-game-frame[data-unified-game-controls]:not(.is-rotated)>:is(.room-orientation-dock,.room-game-dock){position:fixed}
#app .replay-game-backdrop > .replay-board {
  box-sizing: border-box;
  width: min(100%,160dvh);
  height: auto !important;
  aspect-ratio: 8 / 5;
  margin-inline: auto;
  padding: 0;
  overflow: visible;
  isolation: isolate;
  container-type: size;
}
#app .replay-fixed-layout > :first-child:not(.duel-player-rail) {
  position: absolute;
  inset: 50% auto auto 50%;
  width: var(--replay-content-width);
  height: var(--replay-content-height);
  max-width: none;
  margin: 0;
  transform: translate(-50%, -50%) scale(var(--game-scale));
}
#app .replay-board > .mj-table {
  --game-avatar-edge:15cqh;
  --game-name-size:calc(15cqh / 8.1);
  position: absolute;
  inset: 50% auto auto 50%;
  width:calc(100% * 1672 / 941 / 1.6);
  transform: translate(-50%, -50%);
  margin: 0;
}
#app .replay-board :is(.mj-head,.mj-hint) { display: none; }
#app .replay-viewer .replay-controls {
  position: absolute;
  inset: auto 0 8px;
  width: min(760px, calc(100% - 16px));
  box-sizing: border-box;
  margin-inline: auto;
  z-index: 60;
  display: grid;
  grid-template-columns: auto auto auto minmax(24px, 1fr) auto auto;
  gap: 4px;
  padding-block: 8px 2px;
}
#app .replay-controls :is(button,select) { min-height: 36px; padding: 4px 7px; font-size: 13px; }
#app .replay-controls button[aria-label] { min-width: 32px; font-size: 19px; }
#app .replay-controls input[type=range] { width: 100%; padding: 0; margin: 0; accent-color: var(--club-green); }
#app .replay-controls .replay-step { margin: 0; font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.replay-round-info { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; margin-top: 6px; }
#app .replay-round-info select { min-height: 36px; padding: 4px 8px; }
#app .replay-description { margin: 0; }
.replay-timeline { max-height: 280px; overflow: auto; }
.replay-timeline h3 { font-size: 13px; margin: 10px 0 4px; }
#app .replay-timeline .replay-step-list { max-height: none; overflow: visible; margin-top: 0; }
#app :is(.replay-board,.room-review-board) :is(.mj-table-chat,.mj-table-tools) { display: none; }
#app .room-review-controls {
  inset:auto 4px 4px;
  width:max-content;
  margin-inline:auto;
  transform:none;
  flex-wrap:wrap;
}
#app .room-review-controls button { flex: none; }
#app :is(.replay-controls,.room-review-controls){
  align-items:center;
  gap:6px;
  padding:6px;
  border:1px solid #708ba66b;
  border-radius:12px;
  background:#162a40;
  color:#f3f7fb;
}
#app .replay-controls{margin-top:6px}
#app .room-review-controls{z-index:24;inset:auto 8px 8px;width:min(420px,calc(100% - 16px));flex-wrap:nowrap;justify-content:stretch;background:#172a38;border-color:#627e86;box-shadow:0 5px 16px #101e3566}
#app :is(.replay-controls,.room-review-controls) :is(button,select){
  min-height:40px;
  padding-inline:8px;
  border:1px solid #637c95;
  border-radius:8px;
  background:#243d57;
  color:#f3f7fb;
  box-shadow:none;
}
#app .replay-controls .btn-primary{background:#dcebdc;border-color:#dcebdc;color:#173b30}
#app :is(.replay-controls,.room-review-controls) input[type=range]{accent-color:#9ce3b4}
#app .room-review-scrubber{flex:1;min-width:0;display:grid;grid-template-columns:1fr auto;align-items:center;gap:1px 8px}
#app .room-review-scrubber span{font-size:12px;white-space:nowrap}
#app .room-review-step{font-variant-numeric:tabular-nums;color:#bfe8da}
#app .room-review-scrubber input{grid-column:1/-1;width:100%;min-width:0;margin:0}
#app .room-review-controls button{min-width:40px;font-size:22px;line-height:1}
#app .room-review-controls button:disabled{opacity:.4}
#app .room-review-controls button:enabled:hover{background:#35546a}
@media(max-width:420px){
  #app .replay-viewer .replay-controls{grid-template-columns:repeat(3,minmax(0,auto)) minmax(0,1fr)}
  #app .replay-controls input[type=range]{grid-row:2;grid-column:1/4}
  #app .replay-controls .replay-step{grid-row:2;grid-column:4;justify-self:end}
}
#app .replay-round-steps { padding-top: 10px; margin-top: 12px; }

@media (max-width: 760px) {
  #app .replay-list { grid-template-columns: minmax(0, 1fr); }
}

html[data-theme] #app.cinema-shell[data-page=profile] .bga-content {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr);
  grid-template-rows: auto auto auto;
  align-content: start;
  gap: 16px 24px;
  max-width: 1120px;
  padding: clamp(16px, 3vw, 36px);
}

#app.cinema-shell[data-page=profile] .page-header {
  grid-column: 1 / -1;
  margin: 0;
}

#app.cinema-shell[data-page=profile] .page-subtitle:empty { display: none; }

html[data-theme] #app.cinema-shell[data-page=profile] .profile-header-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px clamp(12px, 2vw, 24px);
  padding: clamp(14px, 2vw, 24px);
  margin: 0;
  border-radius: 20px;
  background: var(--club-selection);
}

#app.cinema-shell[data-page=profile] .profile-avatar-large {
  grid-row: span 2;
  align-self: center;
  width: clamp(112px, 16vw, 176px);
  height: auto;
  aspect-ratio: 1;
  border-radius: 12px;
}

#app.cinema-shell[data-page=profile] .profile-user-info { align-self: end; }
#app.cinema-shell[data-page=profile] .profile-username { font-size: clamp(20px, 2.2vw, 30px); }
#app.cinema-shell[data-page=profile] .profile-joined { line-height: 1.5; }

html[data-theme] #app.cinema-shell[data-page=profile] .profile-edit {
  align-self: start;
  justify-self: start;
  width: auto;
  max-width: 100%;
  margin: 0;
  padding-inline: 16px;
}

html[data-theme] #app.cinema-shell[data-page=profile] .stats-card {
  grid-column: 1;
  grid-row: 3;
  padding: 14px 8px;
  margin: 0;
  border-color: var(--club-line);
  border-radius: 14px;
}

#app.cinema-shell[data-page=profile] .stat-value {
  font-size: clamp(17px, 2.4vw, 28px);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

#app.cinema-shell[data-page=profile] .stat-value.win { color: var(--club-green); }
#app.cinema-shell[data-page=profile] .stat-divider { margin-inline: 4px; }

html[data-theme] #app.cinema-shell[data-page=profile] .profile-function-grid {
  grid-column: 2;
  grid-row: 2 / span 2;
  align-self: start;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  margin: 0;
}

html[data-theme] #app.cinema-shell[data-page=profile] .profile-function-grid > a {
  position: relative;
  grid-column: 1 / -1;
  justify-content: center;
  min-height: 60px;
  padding: 10px 38px 10px 16px;
  border-radius: 12px;
  text-decoration: none;
  overflow-wrap: anywhere;
}

#app.cinema-shell[data-page=profile] .profile-function-grid > a:nth-child(-n+4)::after {
  content: "";
  position: absolute;
  inset: 50% 18px auto auto;
  width: 7px;
  height: 7px;
  border: solid var(--club-green);
  border-width: 1.5px 1.5px 0 0;
  transform: translateY(-50%) rotate(45deg);
}

html[data-theme] #app.cinema-shell[data-page=profile] .profile-function-grid > a:nth-last-child(-n+2) {
  grid-column: auto;
  min-height: 44px;
  padding: 8px 12px;
  border-color: transparent;
  background: transparent;
  color: var(--club-muted);
  text-align: center;
}

html[data-theme] #app.cinema-shell[data-page=profile] .profile-function-grid > a:is(:hover, :focus-visible) {
  background: var(--club-selection);
  color: var(--club-ink);
}

@media (max-width: 760px) {
  html[data-theme] #app.cinema-shell[data-page=profile] .bga-content {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    gap: 12px;
  }

  html[data-theme] #app.cinema-shell[data-page=profile] .profile-function-grid {
    grid-area: auto;
  }
}

html[data-theme] .lobby-create-dialog {
  color: var(--club-ink);
  background: var(--club-surface);
  border-color: var(--club-line);
}
html[data-theme] #app:is([data-page=room],[data-page=local]) .room-immersive.waiting-room {
  --wait-bg: var(--club-paper);
  --wait-surface: var(--club-surface);
  --wait-ink: var(--club-ink);
  --wait-muted: var(--club-muted);
  --wait-line: var(--club-line);
  --wait-soft: var(--club-raised);
  --wait-blue: var(--club-green);
  --wait-green: var(--club-green);
}
@media (max-width: 880px) {
  .club-hero { display: none; }
  html[data-theme] #app.cinema-shell:is([data-page=lobby],[data-page=tables]) :is(.lobby-quick-row,.tables-room-list) .room-list-card {
    --room-cover-width: 58px;
    column-gap: 8px;
  }
  html[data-theme] #app.cinema-shell:is([data-page=lobby],[data-page=games]) .lobby-library-tools .lobby-categories {
    grid-template-columns: minmax(56px, 1.5fr) repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 380px) {
  #app.cinema-shell .lobby-categories button .lobby-filter-dot { display: none; }
}
#app .local-play.waiting-room .local-room-title{display:block}
html[data-theme] #app:is([data-page=room],[data-page=local]) .waiting-room .waiting-start:not(:disabled){
  background:var(--club-green);border-color:var(--club-green);color:var(--club-paper);
}
#app .local-play.waiting-room .room-ready-controls{justify-content:flex-end}
#app .local-play .room-waiting-game{display:none}
#app .has-duel-rail .pw-quilt-heading>.duel-native-identity{display:none}

html[data-theme] #app.cinema-shell[data-page=profile] .profile-function-grid > a:first-child { grid-column: 1 / -1; min-height: 60px; padding: 10px 38px 10px 16px; border-color: var(--border); background: var(--surface); color: var(--text); text-align: left; }
#app.cinema-shell[data-page=profile] .profile-settings { grid-column: 1 / -1; }

html[data-theme] #app.cinema-shell[data-page=profile] .bga-content { grid-template-columns: repeat(2, minmax(0, 1fr)); }
html[data-theme] #app.cinema-shell[data-page=profile] :is(.profile-header-card, .profile-results-card) { min-height: 224px; }
html[data-theme] #app.cinema-shell[data-page=profile] .profile-results-card { grid-column: 2; grid-row: 2; display: flex; flex-direction: column; justify-content: center; gap: 24px; padding: clamp(14px, 2vw, 24px); border-radius: 20px; }
.profile-results-stats { display: flex; align-items: center; width: 100%; }
.profile-replays-link { display: flex; align-items: center; justify-content: center; align-self: center; width: min(100%, 280px); min-height: 52px; padding: 12px 24px; border-radius: 999px; background: var(--club-green); color: var(--club-surface); font-size: 16px; font-weight: 600; text-decoration: none; }
.profile-replays-link:hover, .profile-replays-link:focus-visible { opacity: .88; }
html[data-theme] #app.cinema-shell[data-page=profile] .profile-function-grid { grid-column: 1 / -1; grid-row: auto; }
@media (max-width: 760px) {
  html[data-theme] #app.cinema-shell[data-page=profile] .bga-content { grid-template-columns: minmax(0, 1fr); }
  html[data-theme] #app.cinema-shell[data-page=profile] .profile-results-card { grid-column: 1; grid-row: auto; }
}

html[data-theme] #app.cinema-shell[data-page=profile] .profile-settings .btn-danger { color: #fff; background: #9a2b48; border-color: #9a2b48; }
html[data-theme] #app.cinema-shell[data-page=profile] .profile-settings .btn-danger:hover { color: #fff; background: #80253e; border-color: #80253e; }

html[data-theme] #app.cinema-shell[data-page=profile] .profile-header-card { grid-column: 1; grid-row: 1; }
html[data-theme] #app.cinema-shell[data-page=profile] .profile-results-card { grid-row: 1; }
@media (hover: hover) {
  #app.cinema-shell[data-page=profile] .profile-avatar-large { transition: transform .16s ease; transform-origin: center; }
  #app.cinema-shell[data-page=profile] .profile-avatar-large:hover { position: relative; z-index: 1; transform: scale(1.2); }
}
@media (max-width: 760px) {
  html[data-theme] #app.cinema-shell[data-page=profile] :is(.profile-header-card, .profile-results-card) { min-height: 0; }
  html[data-theme] #app.cinema-shell[data-page=profile] .profile-results-card { grid-row: auto; gap: 16px; }
}

#app.cinema-shell[data-page=profile] .profile-settings .setting-row:has(.seg) { flex-direction: column; align-items: stretch; }
#app.cinema-shell[data-page=profile] .profile-settings .setting-row > .seg { display: flex; width: 100%; max-width: none; align-self: stretch; }
#app.cinema-shell[data-page=profile] .profile-settings .setting-row > .seg > .seg-btn { flex: 1 1 0; min-width: 0; }
