/* ui-fixes.css — shared lobby + play page layout fixes. Loaded LAST on every lobby and play page.
   1. Room chooser: plain table rows (bottom border only, see-through), from the top of the dark area; Real Stakes same colour as the others.
   2. Settings (practice + multiplayer, lobby + game, PC + mobile): bigger options, content starts at the top of the well.
   3. Lobby players list: rows start at the top edge of the panel; shorter rows.
   4. PC game screen: player score panels bigger, stretched evenly across the top of the game panel.
   5. Game players list: device / account / DND / rating icons use the same sizes and spots as the lobby list. */

/* ---------- 1. Room chooser ---------- */
html[data-theme][data-theme][data-theme][data-theme] body #room-stack#room-stack #room-rows {
  margin: 0 5.6% !important;
  padding: 0 !important;
  gap: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-start !important;
  align-items: stretch !important;
}
html[data-theme][data-theme][data-theme][data-theme] body #room-stack#room-stack .pick-row {
  min-height: 40px !important;
  margin: 0 !important;
  padding: 0 16px !important;
  border: 0 !important;
  border-bottom: 1px solid rgba(214, 255, 140, .45) !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  transform: none !important;
  color: #f4fff6 !important;
  font-size: 14px !important;
}
html[data-theme][data-theme][data-theme][data-theme] body #room-stack#room-stack .pick-row:is(:hover, :focus-visible) {
  border-color: rgba(214, 255, 140, .45) !important;
  background: rgba(255, 229, 106, .14) !important;
  color: #ffe56a !important;
}
html[data-theme][data-theme][data-theme][data-theme] body #room-stack#room-stack .pick-row.rm-guest,
html[data-theme][data-theme][data-theme][data-theme] body #room-stack#room-stack .pick-row.rm-guest :is(.nm, .cnt, .ico) { color: #f4fff6 !important; }
html[data-theme][data-theme][data-theme][data-theme] body #room-stack#room-stack .pick-row.rm-guest:is(:hover, :focus-visible),
html[data-theme][data-theme][data-theme][data-theme] body #room-stack#room-stack .pick-row:is(:hover, :focus-visible) .cnt { color: #ffe56a !important; }

/* ---------- 2. Settings ---------- */
html[data-theme][data-theme][data-theme][data-theme] body :is(#set-back#set-back#set-back, #game-set-back#game-set-back#game-set-back) .set-panel {
  justify-content: flex-start !important;
}
html[data-theme][data-theme][data-theme][data-theme] body :is(#set-back#set-back#set-back, #game-set-back#game-set-back#game-set-back) .set-body {
  justify-content: flex-start !important;
  align-content: flex-start !important;
  margin-top: 0 !important;
  padding-top: 16px !important;
  padding-bottom: 10px !important;
}
html[data-theme][data-theme][data-theme][data-theme] body :is(#set-back#set-back#set-back, #game-set-back#game-set-back#game-set-back) .set-body > :first-child,
html[data-theme][data-theme][data-theme][data-theme] body :is(#set-back#set-back#set-back, #game-set-back#game-set-back#game-set-back) .set-body > .set-sec.eco-head:first-of-type { margin-top: 0 !important; }
html[data-theme][data-theme][data-theme][data-theme] body :is(#set-back#set-back#set-back, #game-set-back#game-set-back#game-set-back) .set-sec {
  margin: 8px 0 4px !important;
  font-size: 13px !important;
}
html[data-theme][data-theme][data-theme][data-theme] body :is(#set-back#set-back#set-back, #game-set-back#game-set-back#game-set-back) .set-opt {
  font-size: 15px !important;
  line-height: 1.25 !important;
  padding: 3px 2px !important;
  gap: 10px !important;
}
html[data-theme][data-theme][data-theme][data-theme] body :is(#set-back#set-back#set-back, #game-set-back#game-set-back#game-set-back) .set-opt .mark {
  width: 17px !important; height: 17px !important; flex: 0 0 17px !important;
}
html[data-theme][data-theme][data-theme][data-theme] body :is(#set-back#set-back#set-back, #game-set-back#game-set-back#game-set-back) .set-opt input:checked + .mark::after {
  left: 5px !important; top: 1.5px !important; width: 4px !important; height: 9px !important;
}

/* ---------- 3. Lobby players list ---------- */
html[data-theme][data-theme] body.game-page #players-pane#players-pane #user-log { padding-top: 0 !important; margin-top: 0 !important; }
html[data-theme][data-theme] body.game-page:not(.mobile) #players-pane#players-pane .user-row {
  min-height: 38px !important; padding-top: 4px !important; padding-bottom: 4px !important; align-items: center !important;
}
html[data-theme][data-theme] body.mobile.game-page #players-pane#players-pane .user-row {
  min-height: 30px !important; padding-top: 3px !important; padding-bottom: 3px !important; align-items: center !important;
}

/* ---------- 4. PC game screen: score panels ---------- */
html:not(.practice) body.gameplay-page:not(.mobile) #game-wrap #score-overlay {
  left: 12px !important; right: 12px !important; transform: none !important;
  width: auto !important; max-width: none !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 8px 24px !important;
}
html:not(.practice) body.gameplay-page:not(.mobile) #game-wrap #score-overlay .scorecard {
  min-width: 0 !important; width: auto !important; padding: 8px 18px 9px !important; border-radius: 10px !important;
}
html:not(.practice) body.gameplay-page:not(.mobile) #game-wrap #score-overlay .scorecard .name { font-size: 17px !important; }
html:not(.practice) body.gameplay-page:not(.mobile) #game-wrap #score-overlay .scorecard .sub { font-size: 12px !important; min-height: 14px !important; }
html:not(.practice) body.gameplay-page:not(.mobile) #game-wrap #score-overlay .scorecard :is(.pts, .sc-time) { font-size: 20px !important; }
html:not(.practice) body.gameplay-page:not(.mobile) #game-wrap #score-overlay #on-ball { font-size: 15px !important; padding: 4px 12px !important; gap: 8px !important; }
html:not(.practice) body.gameplay-page:not(.mobile) #game-wrap #score-overlay #on-dot { width: 18px !important; height: 18px !important; }
html:not(.practice) body.gameplay-page:not(.mobile) #game-wrap #score-overlay #potted-row { padding: 4px 10px !important; gap: 4px !important; }

/* ---------- 5. Game players list matches the lobby list ---------- */
/* PC: same row height as the lobby list. */
html[data-theme][data-theme] body.gameplay-page:not(.mobile) #side-players#side-players .plist-row {
  min-height: 38px !important; padding-top: 4px !important; padding-bottom: 4px !important; align-items: center !important;
}
/* Mobile (Players overlay): the lobby's phone sizes and badge spots. */
html #mchat#mchat#mchat .plist .plist-row {
  display: grid !important;
  grid-template-columns: 44px 36px minmax(0, 1fr) max-content !important;
  align-items: center !important;
  min-height: 30px !important;
  padding: 3px 52px 3px 0 !important;
  gap: 0 !important;
  overflow: visible !important;
}
html #mchat#mchat#mchat .plist .plist-row .client-cell { display: block !important; grid-column: 1 !important; overflow: visible !important; }
html #mchat#mchat#mchat .plist .plist-row .client {
  position: relative !important; display: block !important;
  width: 23px !important; height: 23px !important;
  margin: 0 0 0 12px !important;
}
html #mchat#mchat#mchat .plist .plist-row .client img.face {
  width: 23px !important; height: 23px !important; min-width: 0 !important; max-width: none !important; display: block !important;
}
html #mchat#mchat#mchat .plist .plist-row .client :is(img.rk, .rk) {
  position: absolute !important; top: 0 !important; left: 0 !important; margin: 0 !important;
  width: 15px !important; height: 15px !important; min-width: 0 !important; min-height: 0 !important;
  max-width: 15px !important; max-height: 15px !important; background-size: 15px 15px !important;
  transform: translate(-6px, -5px) !important; z-index: 3 !important;
}
html #mchat#mchat#mchat .plist .plist-row .client .dnd-mark {
  position: absolute !important; left: 15px !important; top: 50% !important;
  width: 16px !important; height: 16px !important; max-width: none !important; max-height: none !important;
  transform: translateY(-50%) !important; z-index: 4 !important;
}
html #mchat#mchat#mchat .plist .plist-row .client img.corner-badge {
  position: absolute !important; top: 100% !important; width: 13px !important; height: 13px !important;
  max-width: 13px !important; max-height: 13px !important; z-index: 4 !important; transform: translate(-50%, -60%) !important;
}
html #mchat#mchat#mchat .plist .plist-row .client img.corner-badge.is-mute { left: 100% !important; }
html #mchat#mchat#mchat .plist .plist-row .client img.corner-badge.is-demerit { left: 0 !important; }
html #mchat#mchat#mchat .plist .plist-row .ball { grid-column: 2 !important; display: flex !important; align-items: center !important; padding-left: 6px !important; }
html #mchat#mchat#mchat .plist .plist-row :is(img.rb, .rb) {
  width: 20px !important; height: 20px !important; min-width: 0 !important; min-height: 0 !important;
  max-width: 20px !important; max-height: 20px !important; flex: 0 0 20px !important;
  background-size: 20px 20px !important; margin: 0 !important; object-fit: contain !important;
}
html #mchat#mchat#mchat .plist .plist-row .nm { grid-column: 3 !important; font-size: 15px !important; padding-left: 6px !important; }
html #mchat#mchat#mchat .plist .plist-row .rt { grid-column: 4 !important; }
html #mchat#mchat#mchat .plist #roster-scroll { padding-top: 0 !important; margin-top: 0 !important; }

/* ---------- 6. Shared chat palette (desktop and phone, all three games) ---------- */
:root {
  --chat-system-ink: #9ce8a2;
  --chat-admin-ink: #ff9999;
  --chat-moderator-ink: #ffbc80;
  --chat-player-ink: #ffffff;
  --chat-member-ink: #99eef5;
  --chat-whisper-ink: #9fd3ff;
  --chat-self-name-ink: #ffec99;
}
/* Repeated IDs intentionally outrank the existing late mobile skin rules.
   Restrict overrides to chat and roster names; badges and ratings keep their colors. */
html body:is(.game-page, .gameplay-page) #chat-log#chat-log#chat-log#chat-log#chat-log#chat-log#chat-log#chat-log :is(.tx.sub, .tx.sub *, .tx.vip, .tx.vip *) {
  color: var(--chat-member-ink) !important;
}
html body:is(.game-page, .gameplay-page) #chat-log#chat-log#chat-log#chat-log#chat-log#chat-log#chat-log#chat-log :is(.tx.mod, .tx.mod *) {
  color: var(--chat-moderator-ink) !important;
  font-weight: 700 !important;
}
html body:is(.game-page, .gameplay-page) #chat-log#chat-log#chat-log#chat-log#chat-log#chat-log#chat-log#chat-log :is(.pm-tag, .pm-tag *, .pm-tx, .pm-tx *) {
  color: var(--chat-whisper-ink) !important;
  font-weight: 400 !important;
}
html body:is(.game-page, .gameplay-page) #chat-log#chat-log#chat-log#chat-log#chat-log#chat-log#chat-log#chat-log :is(.nm, .nm *) {
  color: var(--chat-player-ink) !important;
  font-weight: 700 !important;
}
html body:is(.game-page, .gameplay-page) #chat-log#chat-log#chat-log#chat-log#chat-log#chat-log#chat-log#chat-log :is(.nm.me, .nm.me *) {
  color: var(--chat-self-name-ink) !important;
}
html body:is(.game-page, .gameplay-page) :is(#players-pane#players-pane#players-pane#players-pane#players-pane#players-pane#players-pane#players-pane, #side-players#side-players#side-players#side-players#side-players#side-players#side-players#side-players, #mchat#mchat#mchat#mchat#mchat#mchat#mchat#mchat) :is(.user-row .who, .user-row .who *, .plist-row .nm, .plist-row .nm *) {
  color: var(--chat-player-ink) !important;
  font-weight: 700 !important;
}
html body:is(.game-page, .gameplay-page) :is(#players-pane#players-pane#players-pane#players-pane#players-pane#players-pane#players-pane#players-pane, #side-players#side-players#side-players#side-players#side-players#side-players#side-players#side-players, #mchat#mchat#mchat#mchat#mchat#mchat#mchat#mchat) :is(.user-row .who.me, .user-row .who.me *, .plist-row .nm.me, .plist-row .nm.me *, .plist-row .nm-txt.me) {
  color: var(--chat-self-name-ink) !important;
}
/* PC play screen: scroll arrows sit centred in the header strip (up) and the bottom strip (down),
   with the track running between them inside the panel frame. Desktop only (phone layout untouched). */
@media (min-width: 761px) {
  html[data-theme] body:not(.mobile) aside#side-chat,
  html[data-theme] body:not(.mobile) aside#side-players { position: relative; }
  html[data-theme] body:not(.mobile) aside#side-chat { --hdr: 38px; --ftr: 59px; }
  html[data-theme] body:not(.mobile) aside#side-players { --hdr: 35px; --ftr: 50px; }

  /* keep chat text, Send button and dock buttons clear of the scroll column */
  html[data-theme] body:not(.mobile) aside#side-chat > .pane-main,
  html[data-theme] body:not(.mobile) aside#side-players > .pane-main { padding-right: 34px !important; box-sizing: border-box; }

  /* column hugs the inside of the frame, header to bottom strip */
  html[data-theme] body:not(.mobile) aside#side-chat > .sb-col,
  html[data-theme] body:not(.mobile) aside#side-players > .sb-col {
    position: absolute !important; top: 4px !important; bottom: 4px !important; right: 4px !important;
    left: auto !important; width: 30px !important; height: auto !important; min-height: 0 !important;
    flex: none !important; display: block !important; padding: 0 !important; margin: 0 !important; gap: 0 !important;
    background: none !important; border: 0 !important; box-shadow: none !important; z-index: 3 !important;
  }

  /* up arrow: centred vertically in the header strip */
  html[data-theme] body:not(.mobile) aside > .sb-col > .sb-up {
    position: absolute !important; left: 4px !important; right: auto !important; top: calc((var(--hdr) - 22px) / 2) !important;
    bottom: auto !important; width: 22px !important; height: 22px !important; margin: 0 !important; transform: none !important;
  }

  /* down arrow: centred vertically in the bottom strip */
  html[data-theme] body:not(.mobile) aside > .sb-col > .sb-down {
    position: absolute !important; left: 4px !important; right: auto !important; top: auto !important;
    bottom: calc((var(--ftr) - 22px) / 2) !important; width: 22px !important; height: 22px !important;
    margin: 0 !important; transform: none !important;
  }

  /* track: starts just under the up arrow and stops just above the down arrow */
  html[data-theme] body:not(.mobile) aside > .sb-col > .sb-track {
    position: absolute !important; left: 15px !important; right: auto !important; width: 13px !important;
    top: calc(var(--hdr) - 5px) !important;
    bottom: calc((var(--ftr) - 22px) / 2 + 24px) !important;
    height: auto !important; min-height: 0 !important; margin: 0 !important; transform: none !important;
  }
}