/* Lock'em Down / CrissCross — Framework7 + Apple HIG shell (Phase 1)
   Coexists with style.css. Adapted from Pac-Man f7-app.css patterns
   (safe-area, --hig-min-touch, orientation) without Pac-Man colors.
*/
:root {
  --hig-min-touch: 44px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --f7-theme-color: #007AFF;
  --f7-page-bg-color: #4a4a4a;
}

html, body {
  /* Full layout viewport — do not shrink to --ccx-vvh. Safari paints the
     leftover keyboard strip with the root canvas color; keep it the board
     chrome so a white void cannot appear under the overlay keyboard. */
  height: 100%;
  height: 100dvh;
  max-height: none;
  overflow: hidden;
  overscroll-behavior: none;
  background: #4a4a4a;
  background-color: #4a4a4a;
}
#ccxViewport {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  width: 100%;
  height: calc(var(--ccx-vvh, 100dvh) - var(--ccx-tabbar-h, calc(56px + var(--safe-bottom))));
  max-height: calc(var(--ccx-vvh, 100dvh) - var(--ccx-tabbar-h, calc(56px + var(--safe-bottom))));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #4a4a4a;
  z-index: 1;
}
#app {
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  position: relative;
  overflow: hidden;
  overscroll-behavior: none;
  background: #4a4a4a;
}
#app .view,
#app .page {
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: #4a4a4a !important;
  background-color: #4a4a4a !important;
}
#app .page-content {
  background: #4a4a4a !important;
  background-color: #4a4a4a !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

.page-content,
#gameShell {
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
  box-sizing: border-box;
}

.navbar {
  padding-top: var(--safe-top);
}

.toolbar-bottom,
#botToolbar.toolbar-bottom {
  /* Do NOT pad with safe-area inside a fixed 52px height — that crushes labels. */
  padding-bottom: 0;
}

/* HIG minimum touch targets */
.chat-action-btn,
.chat-send-btn,
#dlgOK,
#optionsOK,
a.tile,
#botToolbar .toolbar-inner img,
#playReplay {
  min-height: var(--hig-min-touch);
  min-width: var(--hig-min-touch);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

a.tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

/* Neutralize Framework7 button interference on custom chrome */
#chatPanel button,
#dlgOK,
#optionsOK {
  appearance: none;
  -webkit-appearance: none;
  height: auto !important;
  line-height: 1.2 !important;
  box-sizing: border-box;
  touch-action: manipulation;
}

/* Side panel (Phase 1: plain overlay; Phase 2/3 may become F7 panel) */
#myPanel.ccx-side-panel {
  position: fixed;
  z-index: 12000;
  top: 0;
  left: 0;
  width: min(320px, 88vw);
  height: 100%;
  overflow: auto;
  background: #f7f7f7;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.25);
}

/* F7 popups: keep readable over board */
#popupDialog.popup,
#optionsDialog.popup {
  max-width: min(320px, 92vw);
  border-radius: 12px;
}

#popupDialog #dlgOK,
#optionsDialog #optionsOK {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--hig-min-touch);
}

/* Portrait: board stage fills above a bottom-docked tab bar (cells stay square / pan) */
@media (orientation: portrait) {
  .page > .tabs {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 0 !important;
    min-height: 0 !important;
    height: auto !important;
  }

  #tab-board.tab.tab-active,
  #tab-board.page-content.tab-active {
    display: flex !important;
    flex: 1 1 0 !important;
    flex-direction: column !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
  }

  #tab-board .board-stage,
  .board-stage {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    height: auto !important;
    padding-bottom: 0 !important;
  }

  .toolbar.tabbar.toolbar-bottom,
  #botToolbar.toolbar-bottom {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    top: var(--ccx-tabbar-top, calc(var(--ccx-vvh, 100dvh) - 56px - var(--safe-bottom))) !important;
    bottom: auto !important;
    margin: 0 !important;
    flex: none !important;
    height: calc(56px + var(--safe-bottom)) !important;
    min-height: calc(56px + var(--safe-bottom)) !important;
    max-height: calc(56px + var(--safe-bottom)) !important;
    padding-bottom: 0 !important;
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    transform: none !important;
    z-index: 2147483646 !important;
  }

  #puzzle {
    max-width: 100%;
    overflow-x: auto !important;
    overflow-y: auto !important;
    touch-action: pan-x pan-y !important;
  }

  #tab-board #puzzle,
  .board-stage #puzzle,
  #puzzle {
    overflow-x: auto !important;
    overflow-y: auto !important;
    touch-action: pan-x pan-y !important;
  }

  #chatPanel.chat-panel {
    /* existing chat.js positioning retained; ensure overlay-friendly stacking */
    z-index: 15000;
  }
}

/* Landscape: compact navbar, board priority horizontally, chat overlay-friendly */
@media (orientation: landscape) {
  #topToolbar.navbar {
    min-height: 36px;
  }

  #topToolbar .navbar-inner {
    min-height: 36px;
  }

  #puzzle {
    max-height: calc(var(--ccx-vvh, 100svh) - 96px - var(--safe-top) - var(--safe-bottom));
  }
  body.ccx-phone-shell #puzzle,
  body.ccx-fit-board #puzzle {
    max-height: none !important;
  }

  /* Old .clues { max-height: 30% } clips the arrow + crossword icons in short viewports */
  #clueHouse {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  #botToolbar.toolbar-bottom {
    min-height: calc(56px + var(--safe-bottom));
  }

  #chatPanel.chat-panel {
    z-index: 15000;
  }
}

/* ===== Tab shell + centered board ===== */
.page.no-navbar,
.page {
  display: flex !important;
  flex-direction: column;
  position: relative;
  /* Tab bar is outside #app; no bottom padding needed inside the page */
  padding-bottom: 0;
}

.toolbar.tabbar.toolbar-bottom,
#botToolbar.toolbar-bottom {
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  bottom: auto !important;
  top: var(--ccx-tabbar-top, calc(var(--ccx-vvh, 100dvh) - 56px - var(--safe-bottom))) !important;
  margin: 0 !important;
  flex: none !important;
  width: 100% !important;
  z-index: 2147483646 !important;
  padding: 0 !important;
  padding-bottom: 0 !important;
  height: calc(56px + var(--safe-bottom)) !important;
  min-height: calc(56px + var(--safe-bottom)) !important;
  max-height: calc(56px + var(--safe-bottom)) !important;
  background-color: #ffffff !important;
  border-top: 3px solid #007aff !important;
  transform: none !important;
  -webkit-transform: none !important;
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  box-shadow: none;
  box-sizing: border-box !important;
}
#botToolbar .toolbar-inner,
.toolbar.tabbar .toolbar-inner {
  position: absolute !important;
  left: 0 !important;
  right: 0 !important;
  top: 0 !important;
  bottom: var(--safe-bottom) !important;
  /* Stop above the home indicator. A fixed 56px overflowed the 3px border
     and let #ccxViewport scroll when #keys took focus. */
  height: auto !important;
  width: 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-around !important;
  overflow: visible !important;
  padding: 0 4px !important;
  box-sizing: border-box !important;
}
.toolbar.tabbar .tab-link {
  min-height: 44px !important;
  height: 100% !important; /* fill the 53px inner box; a fixed 56px overflowed the bordered bar */
  font-size: 13px !important;
  font-weight: 700 !important;
  line-height: 1.15 !important;
  padding-top: 4px !important;
  padding-bottom: 4px !important;
  color: #007aff !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 1 1 0 !important;
}
.toolbar.tabbar .tab-link .tabbar-label {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  font-size: 13px !important;
  line-height: 1.2 !important;
  color: inherit !important;
}
.toolbar.tabbar .tab-link-active {
  color: var(--f7-theme-color) !important;
}
.toolbar.tabbar .tab-link[href="#tab-chat"].ccx-chat-unread,
.toolbar.tabbar .tab-link[href="#tab-chat"].ccx-chat-unread.tab-link-active,
.toolbar.tabbar .tab-link[href="#tab-chat"].ccx-chat-tab-flash {
  color: #34c759 !important;
}
.toolbar.tabbar .tab-link[href="#tab-chat"].ccx-chat-unread .tabbar-label,
.toolbar.tabbar .tab-link[href="#tab-chat"].ccx-chat-tab-flash .tabbar-label {
  color: inherit !important;
}
@keyframes ccx-msg-blink {
  0%, 100% { box-shadow: none; filter: none; }
  50% { box-shadow: 0 0 0 3px #34c759; filter: brightness(1.35); }
}
#chatPanel .chat-message.ccx-msg-blink {
  animation: ccx-msg-blink 0.22s ease-in-out 3;
}

/* Single player: Chat is 2-player only — omit the tab entirely */
body.ccx-solo .toolbar.tabbar .tab-link[href="#tab-chat"] {
  display: none !important;
}
body.ccx-solo #tab-chat {
  display: none !important;
  pointer-events: none;
  visibility: hidden;
}

/* 2-player: Scores / Hints waits until a grid space is clicked */
body.ccx-scores-locked .toolbar.tabbar .tab-link[href="#tab-scores"] {
  display: none !important;
}
/* 2-player opponent: Options stays over the board, without host controls */
body.ccx-no-options #ccxHamNewGame,
body.ccx-no-options #ccxHamPuzzleSets {
  display: none !important;
}

/* 2-player: crossword icon on hints toolbar waits until both players are Ready */
body.ccx-pre-ready #clueHouse #panelPicLink {
  display: none !important;
}

/* 2-player: Chat overlay stays until both Ready — Chat tab appears after kickoff */
body.ccx-chat-kickoff .toolbar.tabbar .tab-link[href="#tab-chat"] {
  display: none !important;
}
body.ccx-chat-kickoff #chatCloseBtn {
  display: none !important;
}
body.ccx-chat-kickoff .toolbar.tabbar .tab-link:not([href="#tab-chat"]) {
  pointer-events: none;
  opacity: 0.45;
}
body.ccx-solution-lock-options .toolbar.tabbar .tab-link[href="#tab-options"],
body.ccx-chat-kickoff.ccx-is-host.ccx-solution-lock-options .toolbar.tabbar .tab-link[href="#tab-options"] {
  pointer-events: none;
  opacity: 0.45;
}
body.ccx-paused .toolbar.tabbar .tab-link:not([href="#tab-chat"]) {
  pointer-events: none;
  opacity: 0.45;
}
body.ccx-paused #tab-board,
body.ccx-paused #tab-scores,
body.ccx-paused #tab-options,
body.ccx-paused #tab-pause {
  pointer-events: none !important;
}
body.ccx-paused #chatCloseBtn {
  visibility: hidden;
  pointer-events: none;
}

#chatPanel .ccx-pause-dur-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 10px 8px;
  background: #d8d8d8;
  flex-shrink: 0;
}
#chatPanel .ccx-pause-dur-bar[hidden] {
  display: none !important;
}
#chatPanel .ccx-pause-dur-ask {
  font-size: 13px;
  font-weight: 700;
  color: #222;
  margin-right: 4px;
}
#chatPanel .ccx-pause-dur-btn {
  min-height: 36px;
  min-width: 56px;
  padding: 6px 10px;
  border: 0;
  border-radius: 10px;
  background: #7FD4E8;
  color: #123;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
#chatPanel .ccx-pause-dur-btn:hover,
#chatPanel .ccx-pause-dur-btn.ccx-hover {
  background: #5ec4dc;
}
#chatPanel .pause-btn.ccx-restore-btn,
body.ccx-on-chat #chatPanel .pause-btn.ccx-restore-btn,
#chatPanel.ccx-chat-in-tab .pause-btn.ccx-restore-btn {
  background: #34C759 !important;
  color: #fff !important;
}

#tab-board.tab,
#tab-scores.tab,
#tab-pause.tab,
#tab-options.tab {
  display: none;
  box-sizing: border-box;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
  padding-bottom: 8px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  height: 100%;
}
#tab-board.tab.tab-active,
#tab-scores.tab.tab-active,
#tab-pause.tab.tab-active,
#tab-options.tab.tab-active {
  display: block;
}

.board-stage {
  min-height: calc(100% - 8px);
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  box-sizing: border-box;
  padding: 8px 0 16px;
  background: #4a4a4a;
}

#tab-board #puzzle,
.board-stage #puzzle {
  margin-left: auto !important;
  margin-right: auto !important;
  max-width: 100%;
  display: block;
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: none;
}

#tab-board #grid,
.board-stage #grid {
  margin-left: auto !important;
  margin-right: auto !important;
}

/* Scores tab: former side-panel content, not a drawer */
#myPanel.ccx-side-panel,
#tab-scores #myPanel {
  position: static !important;
  display: block !important;
  width: 100% !important;
  max-width: 560px;
  height: auto !important;
  margin: 0 auto;
  box-shadow: none !important;
  background: transparent;
  padding: 12px 8px calc(12px + var(--safe-bottom));
  overflow: visible;
}
#tab-scores .gaugeHouseContainer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}
#tab-scores .gaugeHouse {
  float: none !important;
}

.scores-heading,
.pause-heading,
.options-heading {
  font-size: 18px;
  font-weight: 600;
  margin: 8px 0 12px;
  text-align: center;
}

.pause-panel, .options-inline {
  max-width: 420px;
  margin: 0 auto;
  padding: 12px;
  text-align: center;
}
.pause-panel .button,
.options-inline .button {
  min-height: var(--hig-min-touch);
  margin: 8px 0;
  width: min(280px, 100%);
}

@media only screen and (orientation: landscape) and (max-height: 500px) {
  .toolbar.tabbar .tab-link { font-size: 10px; }
  .board-stage { padding-top: 0; padding-bottom: 0; justify-content: flex-start; }
}
/* Scores / Hints tab — dark strip like Heroku side content */
#tab-scores {
  background: #4a4a4a !important;
  color: #fff;
}
#tab-scores .scores-heading {
  display: none; /* Heroku doesn't show this title over gauges */
}
#tab-scores #myPanel.ccx-side-panel,
#tab-scores #myPanel {
  background: #4a4a4a !important;
  color: #fff;
  max-width: 320px;
  margin: 0 auto;
  padding-top: 16px;
}
#tab-scores .gaugeHouseContainer {
  background: transparent;
  justify-content: center;
}
#tab-scores #hamburger img {
  background: #fff;
  border-radius: 4px;
  padding: 6px;
}
#tab-scores #clueHousePanel,
#tab-scores .cluesPanel {
  color: #111;
  background: #fff;
  border-radius: 6px;
  padding: 8px;
}

/* Keep login popup from stretching tall like F7 sheet */
#myPopupDialog.ccx-login-wrap {
  display: block !important;
}
.ccx-join-row {
  display: flex !important;
  flex-direction: row !important;
  justify-content: center !important;
  align-items: stretch !important;
  gap: 10px !important;
  margin: 8px 0 4px !important;
  flex-wrap: nowrap !important;
}
.ccx-join-row a.ccx-join-btn {
  margin: 0 !important;
  flex: 1 1 0 !important;
  min-width: 0 !important;
}

/* Scores tab: left dark strip + board peek like Heroku panel */
#tab-scores.tab {
  display: none;
  background: #ececec !important;
  padding: 0 !important;
}
#tab-scores.tab.tab-active {
  display: block !important;
}
#tab-scores .scores-stage {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  min-height: calc(100dvh - 50px - env(safe-area-inset-bottom));
}
#tab-scores #myPanel {
  width: min(280px, 42vw);
  max-width: 320px;
  background: #4a4a4a !important;
  color: #fff;
  padding: 12px 10px 20px;
  box-sizing: border-box;
  overflow-y: auto;
}
#tab-scores .scores-board-peek {
  flex: 1;
  background: #f2f2f2;
  position: relative;
}
#tab-scores #myPanel #hamburger {
  margin: 12px auto;
  display: block;
  width: 44px;
  height: 44px;
  background: #fff;
  border-radius: 4px;
  text-align: center;
  line-height: 44px;
}
#tab-scores #myPanel #hamburger img {
  vertical-align: middle;
  background: transparent;
  padding: 0;
}
/* Hide login while on Scores so gauges are visible like Heroku */
body.ccx-on-scores #myPopupDialog, body.ccx-on-scores #popupDialog, body.ccx-on-options #myPopupDialog, body.ccx-on-options #popupDialog:not(.ccx-qa-dialog) {
  display: none !important;
  visibility: hidden !important;
}
/* Options tab — compact draggable dialog over the still-visible board */
#tab-options.tab.tab-active {
  display: flex !important;
  justify-content: center;
  align-items: flex-start;
  padding: 20px 8px 24px;
  background: #ececec !important;
  overflow: hidden;
}
body.ccx-on-options .page > .tabs {
  overflow: visible !important;
}
body.ccx-on-options #tab-board.tab,
body.ccx-on-options #tab-board.tab.tab-active {
  display: flex !important;
  visibility: visible !important;
}
body.ccx-on-options #tab-options.tab.tab-active {
  position: absolute !important;
  left: 0 !important;
  right: 0 !important;
  top: 0 !important;
  bottom: 0 !important;
  z-index: 12000;
  display: block !important;
  justify-content: unset;
  align-items: unset;
  padding: 0 !important;
  background: transparent !important;
  overflow: visible !important;
  pointer-events: none;
}
body.ccx-on-options #ccxOptionsDialog,
body.ccx-on-options .ccx-options-dialog {
  position: absolute !important;
  margin: 0 !important;
  transform: none !important;
  pointer-events: auto;
}
#ccxOptionsDialog,
.ccx-options-dialog {
  width: 200px;
  max-width: calc(100vw - 24px);
  margin: 8px auto 0;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  overflow: hidden;
  position: relative;
  z-index: 20;
}
.ccx-options-dialog-header {
  position: relative;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #4f90c8 0%, #2f6aa3 100%);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: move;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.ccx-options-close-btn {
  display: none !important;
}
.ccx-options-close-btn:hover,
.ccx-options-close-btn.ccx-hover {
  background: rgba(0, 0, 0, 0.38);
}
.ccx-options-close-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.55);
}
.ccx-options-cancel-btn {
  display: block;
  box-sizing: border-box;
  width: 65%;
  margin: 9px auto 2px;
  min-height: 30px;
  padding: 6px 9px;
  border: 0;
  border-radius: 8px;
  background: #e8e8ed;
  color: #222;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.ccx-options-cancel-btn:hover,
.ccx-options-cancel-btn.ccx-hover {
  background: #d8d8de;
}
.ccx-options-cancel-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(47, 106, 163, 0.45);
}
.ccx-share-btn {
  display: block;
  box-sizing: border-box;
  width: 100%;
  margin: 8px 0 0;
  min-height: 44px;
  padding: 8px 10px 7px;
  border: 0;
  border-radius: 8px;
  background: #c0c0c0;
  color: #000;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.15;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.ccx-share-label,
.ccx-share-hint {
  display: block;
}
.ccx-share-hint {
  margin-top: 3px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.25;
  color: #333;
}
.ccx-share-btn:hover,
.ccx-share-btn.ccx-hover {
  background: #a8a8a8;
  color: #000;
}
.ccx-share-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(47, 106, 163, 0.45);
}
.ccx-options-dialog-body {
  padding: 10px 14px 14px;
  text-align: left;
}
.ccx-opt-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  font-size: 14px;
  font-weight: 600;
  color: #222;
  cursor: pointer;
  margin: 0;
}
.ccx-opt-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.ccx-opt-hint {
  font-size: 11px;
  font-weight: 500;
  line-height: 1.25;
  color: #555;
}
.ccx-opt-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  min-width: 20px;
  margin: 0;
  accent-color: #2f6aa3;
  cursor: pointer;
}
button.ccx-opt-action {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  font-weight: 600;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}
button.ccx-opt-action:hover,
button.ccx-opt-action.ccx-hover {
  color: #1a5a93;
}
button.ccx-opt-action:disabled {
  opacity: 0.4;
  cursor: default;
  color: #222;
}
.ccx-opt-sep {
  border: 0;
  border-top: 1px solid #c8c8c8;
  margin: 8px 0 12px;
}
#tab-options #hamburger,
.ccx-options-hamburger {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  position: relative;
  margin: 8px auto 0;
  text-align: center;
}
#tab-options #btnbar,
#tab-options .ccx-opt-btnbar {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 3px;
  width: 100%;
  margin: 6px 0 0;
  padding: 4px 6px 6px;
  background: transparent !important;
  box-sizing: border-box;
  border-radius: 0;
}
#tab-options #btnbar.ccx-open {
  display: flex !important;
}
#ccxOptionsDialog.ccx-ham-menu-open .ccx-options-dialog-body .ccx-opt-row {
  display: none;
}
@keyframes ccx-ham-roll {
  from { opacity: 0; transform: translateY(-10px) scaleY(0.6); }
  to   { opacity: 1; transform: translateY(0) scaleY(1); }
}
#tab-options .ccx-ham-link {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 75%;
  min-height: 33px;
  padding: 6px 9px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  border-radius: 6px;
  background: linear-gradient(180deg, #6eb0dc 0%, #3d7ab8 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.28);
  -webkit-tap-highlight-color: transparent;
  transform-origin: top center;
}
#tab-options #btnbar.ccx-open .ccx-ham-link {
  animation: ccx-ham-roll 0.38s ease-out both;
}
#tab-options #btnbar.ccx-open .ccx-ham-link:nth-child(1) { animation-delay: 0s; }
#tab-options #btnbar.ccx-open .ccx-ham-link:nth-child(2) { animation-delay: 0.16s; }
#tab-options #btnbar.ccx-open .ccx-ham-link:nth-child(3) { animation-delay: 0.32s; }
#tab-options .ccx-ham-link:hover,
#tab-options .ccx-ham-link:focus-visible,
#tab-options .ccx-ham-link.ccx-hover {
  background: #2e8b57;
  color: #fff;
}
#tab-options .ccx-ham-link:active {
  background: #247048;
}
#tab-options .ccx-ham-icon {
  width: 40px;
  height: 40px;
  min-width: 44px;
  min-height: 44px;
  cursor: pointer;
}
#tab-scores #hamburger {
  display: none !important;
}
/* ===== Compact login popup over blinking grid (HIG) ===== */
body.ccx-login-open #keys,
body.ccx-login-open #myFormContainer {
  pointer-events: none !important;
}
body.ccx-login-open #popupDialog,
body.ccx-login-open #popupDialog * {
  pointer-events: auto !important;
}

/* F7 tablet/sheet stretch — force a real card popup.
   Login left/top are set by ccxPlaceLoginOnGrid (center of puzzle, above tab bar). */
#popupDialog.ccx-login-dialog.popup,
#popupDialog.ccx-login-dialog.modal-in,
#popupDialog.ccx-login-dialog {
  position: fixed !important;
  /* left/top/transform set by ccxPlaceLoginOnGrid — do not 50%-translate here */
  right: auto !important;
  bottom: auto !important;
  width: min(300px, calc(100vw - 24px)) !important;
  max-width: 300px !important;
  min-width: 0 !important;
  height: auto !important;
  max-height: min(70vh, calc(var(--ccx-vvh, 100svh) - var(--ccx-tabbar-h, 50px) - 24px)) !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 14px !important;
  overflow: auto !important;
  background: #fff !important;
  box-shadow: 0 12px 40px rgba(0,0,0,0.35) !important;
  z-index: 12000 !important;
}
#popupDialog.ccx-login-dialog.ccx-card-prep,
#ccxWordSetDialog.ccx-card-prep {
  opacity: 0 !important;
  animation: none !important;
  transition: none !important;
}
#popupDialog.ccx-login-dialog.ccx-card-in,
body.ccx-themes-open #ccxWordSetDialog.ccx-card-in {
  animation: none !important;
  opacity: 1 !important;
  transition: opacity 0.42s ease !important;
}
@keyframes ccx-board-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
#puzzle.ccx-board-reveal #grid {
  animation: ccx-board-in 0.5s ease;
}
#grid {
  transition: filter 0.45s ease;
}
body.ccx-login-open #grid,
body.ccx-themes-open #grid {
  filter: saturate(0.72) brightness(0.9);
}
body.ccx-choice-open #popupDialog.ccx-name-dialog,
body.ccx-choice-open #popupDialog.ccx-choice-dialog {
  z-index: 40000 !important;
  pointer-events: auto !important;
}
#popupDialog.ccx-choice-dialog.popup,
#popupDialog.ccx-choice-dialog.modal-in,
#popupDialog.ccx-choice-dialog {
  position: fixed !important;
  right: auto !important;
  bottom: auto !important;
  /* left/top come from ccxPlaceChoiceDialog. A percent translate
     shifts a leftover pixel left off the screen. */
  transform: none !important;
  width: min(300px, 88vw) !important;
  max-width: 300px !important;
  min-width: 260px !important;
  height: auto !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 14px !important;
  overflow: hidden !important;
  background: #fff !important;
  box-shadow: 0 12px 40px rgba(0,0,0,0.35) !important;
  z-index: 26000 !important;
}
#popupDialog.ccx-choice-dialog #dlgTitle {
  cursor: grab;
  touch-action: none;
}
#popupDialog.ccx-choice-dialog.ccx-pointer-dragging #dlgTitle {
  cursor: grabbing;
}
#popupDialog.ccx-login-dialog .block-title,
#popupDialog.ccx-login-dialog #dlgTitle,
#popupDialog.ccx-choice-dialog .block-title,
#popupDialog.ccx-choice-dialog #dlgTitle {
  display: block !important;
  background: linear-gradient(180deg, #2a5fa8 0%, #1e4f8c 100%) !important;
  color: #fff !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  line-height: 1.3 !important;
  padding: 12px 14px !important;
  margin: 0 !important;
  text-align: center !important;
  border-radius: 0 !important;
}
#popupDialog.ccx-login-dialog .block,
#popupDialog.ccx-login-dialog #dlgContent,
#popupDialog.ccx-choice-dialog .block,
#popupDialog.ccx-choice-dialog #dlgContent {
  padding: 14px 16px 8px !important;
  margin: 0 !important;
  background: #fff !important;
  text-align: center !important;
}
#popupDialog.ccx-login-dialog #dlgOK {
  display: none !important; /* welcome uses Join / Play Alone */
}
#popupDialog.ccx-login-dialog .block:has(#dlgOK) {
  display: none !important;
}
.ccx-welcome-form {
  margin: 8px auto 4px !important;
  width: 100% !important;
  max-width: 220px !important;
}
#user.ccx-name-input,
#dlgContent #user {
  display: block !important;
  width: 100% !important;
  max-width: 220px !important;
  margin: 6px auto 0 !important;
  box-sizing: border-box !important;
  height: 44px !important;
  min-height: 44px !important;
  padding: 10px 12px !important;
  font-size: 17px !important;
  line-height: 1.2 !important;
  color: #111 !important;
  background: #fff !important;
  border: 1.5px solid #8eb6d8 !important;
  border-radius: 10px !important;
  box-shadow: inset 0 1px 3px rgba(30,79,140,0.18) !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  caret-color: #007AFF !important;
  cursor: text !important;
}
#user.ccx-name-input:focus,
#dlgContent #user:focus {
  outline: none !important;
  border-color: #1e4f8c !important;
  box-shadow: 0 0 0 3px rgba(30,79,140,0.22) !important;
}
#user.ccx-name-input::placeholder,
#dlgContent #user::placeholder {
  font-style: italic !important;
  font-weight: 400 !important;
  color: #8aa4bc !important;
  opacity: 1;
}
#user.ccx-name-input::-webkit-input-placeholder,
#dlgContent #user::-webkit-input-placeholder {
  font-style: italic !important;
  font-weight: 400 !important;
  color: #8aa4bc !important;
}
.ccx-join-row {
  display: flex !important;
  flex-direction: row !important;
  justify-content: center !important;
  align-items: stretch !important;
  gap: 10px !important;
  margin: 12px 0 6px !important;
  flex-wrap: nowrap !important;
}
a.ccx-join-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 1 1 0 !important;
  min-width: 0 !important;
  min-height: var(--hig-min-touch) !important;
  height: auto !important;
  padding: 8px 12px !important;
  margin: 0 !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  line-height: 1.2 !important;
  text-align: center !important;
  color: #fff !important;
  background: #1e4f8c !important;
  border-radius: 11px !important;
  text-decoration: none !important;
  border: none !important;
  box-sizing: border-box !important;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15) !important;
  white-space: normal !important;
  cursor: pointer !important;
  transition: background-color 0.2s ease !important;
}
@media (hover: hover) and (pointer: fine) {
  a.ccx-join-btn:hover {
    background: #2f74d0 !important;
    box-shadow: 0 4px 12px rgba(30, 79, 140, 0.38) !important;
    filter: brightness(1.06);
  }
}
a.ccx-join-btn.ccx-mode-press {
  background: #2a6fbf !important;
  filter: none !important;
  transform: none !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15) !important;
}
a.ccx-join-btn:focus-visible {
  outline: 3px solid rgba(0, 122, 255, 0.45);
  outline-offset: 2px;
}
a.ccx-join-btn.ccx-blinking {
  background: #2a6fbf !important;
}
.ccx-qa-hint {
  margin-top: 8px !important;
  font-size: 12px !important;
  color: #555 !important;
  text-align: center !important;
}
#popupDialog.ccx-qa-dialog.popup,
#popupDialog.ccx-qa-dialog.modal-in,
#popupDialog.ccx-qa-dialog,
#popupDialog.ccx-login-dialog.ccx-qa-dialog {
  position: fixed !important;
  left: 50% !important;
  top: 50% !important;
  right: auto !important;
  bottom: auto !important;
  transform: translate(-50%, -50%) !important;
  width: min(340px, 92vw) !important;
  max-width: 340px !important;
  max-height: 82vh !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 14px !important;
  background: #fff !important;
  box-shadow: 0 12px 40px rgba(0,0,0,0.35) !important;
  z-index: 13000 !important;
}
#popupDialog.ccx-qa-dialog #dlgTitle {
  display: block !important;
  background: linear-gradient(180deg, #2a5fa8 0%, #1e4f8c 100%) !important;
  color: #fff !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  padding: 12px 14px !important;
  margin: 0 !important;
  text-align: center !important;
}
#popupDialog.ccx-qa-dialog #dlgContent,
#popupDialog.ccx-login-dialog.ccx-qa-dialog #dlgContent {
  padding: 8px 14px 12px !important;
  max-height: none !important;
  text-align: left !important;
}
.ccx-qa-tabs {
  display: flex;
  width: 100%;
  margin: 0 0 10px;
  border: 1px solid #c8c8c8;
  border-radius: 8px;
  overflow: hidden;
  background: #ececec;
}
.ccx-qa-tab {
  flex: 1 1 50%;
  min-height: 44px;
  margin: 0;
  padding: 8px 6px;
  border: 0;
  background: transparent;
  color: #333;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.ccx-qa-tab.ccx-qa-tab-on {
  background: #1e4f8c;
  color: #fff;
}
.ccx-qa-panel {
  text-align: left;
}
.ccx-qa-h {
  margin: 10px 0 6px;
  font-size: 16px;
  font-weight: 700;
  color: #68a3ce;
  text-align: left;
}
.ccx-qa-list {
  margin: 0 0 8px;
  padding-left: 1.25em;
  text-align: left;
  list-style: disc;
}
.ccx-qa-list li {
  margin: 0 0 8px;
  padding: 0;
  text-align: left;
  font-size: 15px;
  font-weight: 300;
  color: #111;
  line-height: 1.35;
}
.ccx-qa-note {
  margin: 0 0 6px;
  padding: 0;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: #111;
}
img.ccx-qa-pic {
  height: 27px;
  width: auto;
  vertical-align: middle;
  margin: 0 3px;
  border-radius: 4px;
}
.ccx-qa-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 12px 0 4px;
}
a.ccx-join-btn:active { filter: brightness(0.95); }
#popupDialog.ccx-login-dialog #games {
  font-size: 13px !important;
  margin: 4px 0 !important;
}
#popupDialog.ccx-login-dialog a[href*="Q"],
#popupDialog.ccx-login-dialog #QandA,
#popupDialog.ccx-login-dialog .ccx-qa-hint {
  font-size: 12px !important;
}

/* Keep board/grid visible behind popup; never cover the tab bar */
.popup-backdrop {
  background: rgba(0,0,0,0.25) !important;
}
body.ccx-login-open .popup-backdrop {
  z-index: 11000 !important;
  /* Stop above the tab bar so tabs stay visible + tappable */
  bottom: var(--ccx-tabbar-h, 50px) !important;
  height: auto !important;
}
body.ccx-login-open .toolbar.tabbar,
body.ccx-login-open #botToolbar.toolbar-bottom,
body.ccx-themes-open .toolbar.tabbar,
body.ccx-themes-open #botToolbar.toolbar-bottom {
  z-index: 30000 !important;
  pointer-events: auto !important;
  visibility: visible !important;
  opacity: 1 !important;
}
/* Dimmer must not cover the fixed tab bar */
/* Dimmer must not cover the fixed tab bar — see main rule near wordset dialog */

#popupDialog.ccx-login-dialog > .block:last-child { display:none !important; padding:0 !important; margin:0 !important; height:0 !important; overflow:hidden !important; }

body.ccx-choice-open #keys,
body.ccx-choice-open #myFormContainer,
body.ccx-choice-open #grid,
body.ccx-choice-open .toolbar.tabbar {
  pointer-events: none !important;
}
body.ccx-choice-open #popupDialog,
body.ccx-choice-open #popupDialog * {
  pointer-events: auto !important;
}
body.ccx-choice-open .popup-backdrop {
  z-index: 25000 !important;
  pointer-events: auto !important;
}
.ccx-choice-copy {
  margin: 4px 0 10px !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  color: #1e4f8c !important;
  line-height: 1.35 !important;
}
#popupDialog.ccx-name-dialog .ccx-name-picks {
  flex-direction: column !important;
  align-items: stretch !important;
}
#popupDialog.ccx-name-dialog a.ccx-name-own {
  color: #1e4f8c !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  text-decoration: underline !important;
}
#popupDialog.ccx-choice-dialog:not(.ccx-thanks-dialog) #dlgOK,
#popupDialog.ccx-choice-dialog:not(.ccx-thanks-dialog) .block:has(#dlgOK) {
  display: none !important;
}
#popupDialog.ccx-choice-dialog.ccx-thanks-dialog .block:has(#dlgOK) {
  display: block !important;
  padding: 0 16px 16px !important;
  height: auto !important;
  overflow: visible !important;
}
#popupDialog.ccx-choice-dialog.ccx-thanks-dialog #dlgOK {
  display: inline-flex !important;
  width: 90% !important;
  min-height: var(--hig-min-touch) !important;
  margin: 0 auto 4px !important;
}

/* Play again — card over the revealed board, dragged by the title */
#popupDialog.ccx-playagain-dialog.popup,
#popupDialog.ccx-playagain-dialog.modal-in,
#popupDialog.ccx-playagain-dialog {
  position: fixed !important;
  right: auto !important;
  bottom: auto !important;
  width: min(300px, 88vw) !important;
  max-width: 300px !important;
  min-width: 260px !important;
  height: auto !important;
  max-height: none !important;
  padding: 0 !important;
  border-radius: 14px !important;
  overflow: hidden !important;
  background: #fff !important;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35) !important;
  z-index: 26000 !important;
  animation: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}
#popupDialog.ccx-playagain-dialog.ccx-playagain-ready,
#popupDialog.ccx-playagain-dialog.ccx-playagain-ready.popup,
#popupDialog.ccx-playagain-dialog.ccx-playagain-ready.modal-in {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}
#popupDialog.ccx-playagain-dialog #dlgTitle {
  display: block !important;
  height: 36px !important;
  min-height: 36px !important;
  background: #4a4a4a !important;
  color: transparent !important;
  font-size: 0 !important;
  line-height: 36px !important;
  padding: 0 !important;
  margin: 0 !important;
  text-align: center !important;
  cursor: move;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
#popupDialog.ccx-playagain-dialog #dlgContent {
  padding: 16px 16px 18px !important;
  margin: 0 !important;
  background: #fff !important;
  text-align: center !important;
}
#popupDialog.ccx-playagain-dialog .block:has(#dlgOK),
#popupDialog.ccx-playagain-dialog #dlgOK {
  display: none !important;
}
.ccx-playagain-copy {
  margin: 0 0 12px !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  color: #1e4f8c !important;
  line-height: 1.35 !important;
}
.ccx-playagain-ask {
  margin: 0 0 14px !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  color: #222 !important;
  line-height: 1.35 !important;
}
.ccx-playagain-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ccx-playagain-go,
.ccx-playagain-stop {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: var(--hig-min-touch);
  padding: 10px 14px;
  border-radius: 11px;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.ccx-playagain-go {
  background: #1e4f8c;
  color: #fff;
}
.ccx-playagain-stop {
  background: #e8e8ed;
  color: #222;
}
@media (hover: hover) and (pointer: fine) {
  .ccx-playagain-go:hover { background: #2f74d0; color: #fff; }
  .ccx-playagain-stop:hover { background: #d8d8de; color: #222; }
}
.ccx-playagain-go:focus-visible,
.ccx-playagain-stop:focus-visible {
  outline: 3px solid rgba(0, 122, 255, 0.45);
  outline-offset: 2px;
}

/* Winner — same card chrome as Play Again / Options; height ends ~20px under Cancel */
#popupDialog.ccx-winner-dialog.popup,
#popupDialog.ccx-winner-dialog.modal-in,
#popupDialog.ccx-winner-dialog {
  position: fixed !important;
  right: auto !important;
  bottom: auto !important;
  width: min(300px, 88vw) !important;
  max-width: 300px !important;
  min-width: 260px !important;
  height: auto !important;
  max-height: none !important;
  padding: 0 !important;
  border-radius: 14px !important;
  overflow: hidden !important;
  background: #fff !important;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35) !important;
  z-index: 26000 !important;
  animation: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}
#popupDialog.ccx-winner-dialog.ccx-winner-ready,
#popupDialog.ccx-winner-dialog.ccx-winner-ready.popup,
#popupDialog.ccx-winner-dialog.ccx-winner-ready.modal-in {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}
#popupDialog.ccx-winner-dialog #dlgTitle {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 51px !important;
  min-height: 51px !important;
  background: linear-gradient(180deg, #4f90c8 0%, #2f6aa3 100%) !important;
  color: #fff !important;
  font-size: 18px !important;
  font-weight: 700 !important;
  letter-spacing: 0.02em !important;
  line-height: 1.2 !important;
  padding: 0 12px !important;
  margin: 0 !important;
  text-align: center !important;
  cursor: move;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
#popupDialog.ccx-winner-dialog #dlgContent {
  padding: 16px 16px 20px !important;
  margin: 0 !important;
  background: #fff !important;
  text-align: center !important;
}
#popupDialog.ccx-winner-dialog .block:has(#dlgOK),
#popupDialog.ccx-winner-dialog #dlgOK {
  display: none !important;
}
.ccx-winner-name {
  margin: 0 0 8px !important;
  font-size: 24px !important;
  font-weight: 700 !important;
  color: #30d158 !important;
  line-height: 1.25 !important;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.ccx-winner-copy {
  margin: 0 0 14px !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  color: #1e4f8c !important;
  line-height: 1.35 !important;
}
.ccx-winner-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.ccx-winner-go,
.ccx-winner-stop {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 75%;
  max-width: 75%;
  min-height: var(--hig-min-touch);
  padding: 10px 14px;
  border-radius: 11px;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.ccx-winner-go {
  background: #1e4f8c;
  color: #fff;
}
.ccx-winner-stop {
  background: #e8e8ed;
  color: #222;
}
@media (hover: hover) and (pointer: fine) {
  .ccx-winner-go:hover { background: #2f74d0; color: #fff; }
  .ccx-winner-stop:hover { background: #d8d8de; color: #222; }
}
.ccx-winner-go:focus-visible,
.ccx-winner-stop:focus-visible {
  outline: 3px solid rgba(0, 122, 255, 0.45);
  outline-offset: 2px;
}

#grid.grid40 > div.grid40,
#tab-board #grid.grid40 > div.grid40 {
  position: relative !important;
}

/* Force-hide login after Play Alone / Join */
#popupDialog:not(.modal-in) {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}
#popupDialog.ccx-login-dialog:not(.modal-in) {
  display: none !important;
}

/* Cell-click clue tooltip (Heroku style) */
#clueHouse {
  position: absolute !important;
  z-index: 9000 !important;
  display: none;
  height: auto !important;
  max-height: none !important;
  min-width: 140px !important;
  width: max-content;
  max-width: min(280px, 80vw);
  overflow: visible !important;
  padding: 10px 12px 12px !important;
  background: #fff !important;
  border: 1px solid #c8c8c8 !important;
  border-top: 2px solid #4a4a4a !important;
  border-radius: 10px !important;
  box-shadow: 0 6px 18px rgba(0,0,0,0.22) !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  color: #555 !important;
  text-align: center !important;
  line-height: 1.25 !important;
  pointer-events: auto !important;
  cursor: move !important;
  cursor: grab !important;
  -webkit-user-select: none !important;
  user-select: none !important;
  -webkit-touch-callout: none;
  touch-action: none !important;
}

/* Shown when the browser or socket drops, including while Chat is hidden. */
#ccxNetBanner {
  position: fixed;
  left: 12px;
  right: 12px;
  top: calc(12px + env(safe-area-inset-top, 0px));
  z-index: 16000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: #3a1d1d;
  color: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  font: 600 15px/1.35 system-ui, sans-serif;
  text-align: left;
}
#ccxNetBanner[hidden] {
  display: none !important;
}
#ccxNetBanner .ccx-net-banner-ok {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 6px 12px;
  border: 0;
  border-radius: 8px;
  background: #fff;
  color: #3a1d1d;
  font-weight: 700;
}
/* Notify prompts: the message uses the black card. The white OK stays
   inside that card (Framework7 sets button { width: 100% }, which otherwise
   runs past the card and the puzzle). Half the card, and never wider than
   the puzzle. */
#ccxNetBanner.ccx-notify-banner {
  flex-direction: column;
  align-items: center;
  box-sizing: border-box;
  overflow: hidden;
}
#ccxNetBanner.ccx-notify-banner .ccx-net-banner-text {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
#ccxNetBanner.ccx-notify-banner .ccx-net-banner-ok {
  appearance: none;
  -webkit-appearance: none;
  width: min(50%, var(--ccx-notify-btn, 100%));
  max-width: 100%;
  min-width: 0;
  flex: 0 0 auto;
  align-self: center;
  box-sizing: border-box;
  text-align: center;
}
#clueHouse.ccx-dragging,
#clueHouse.ui-draggable-dragging {
  cursor: grabbing !important;
}
#clueHouse .clueDivClass {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 10px !important;
  margin-top: 8px !important;
  flex-shrink: 0;
  min-width: max-content;
}
#clueHouse .clueDivClass img {
  width: 44px !important;
  height: 44px !important;
  min-width: 44px;
  min-height: 44px;
  border-radius: 6px !important;
  cursor: pointer;
  background: #f2f2f2;
  flex: 0 0 44px;
}

#popupDialog.modal-in.ccx-login-dialog,
#popupDialog.modal-in {
  display: block !important;
  visibility: visible !important;
  pointer-events: auto !important;
}
/* ===== Scores / Hints HIG panel ===== */
#tab-scores.tab.tab-active {
  display: block !important;
  background: #4a4a4a !important;
  color: #fff;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 !important;
  padding-bottom: calc(12px + var(--safe-bottom, 0px)) !important;
}
body.ccx-on-scores.ccx-tablet-shell #tab-scores .scores-stage,
body.ccx-ipad.ccx-on-scores #tab-scores .scores-stage {
  min-height: 0 !important;
}
body.ccx-on-scores.ccx-anagram-off #tab-scores.tab.tab-active {
  overflow-y: hidden !important;
}
#tab-scores .scores-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: calc(100dvh - 50px - env(safe-area-inset-bottom, 0px));
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 16px 16px 24px;
  box-sizing: border-box;
}
#tab-scores .scores-heading,
#tab-scores .scores-board-peek {
  display: none !important;
}
#tab-scores #myPanel,
#tab-scores #myPanel.ccx-side-panel {
  position: static !important;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  width: 100% !important;
  max-width: 360px;
  margin: 0 auto;
  padding: 8px 0 20px !important;
  background: transparent !important;
  box-shadow: none !important;
  height: auto !important;
  overflow: visible !important;
}

/* Gauge — centered, solo-friendly */
#tab-scores .gaugeHouseContainer {
  display: flex !important;
  justify-content: center;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 260px;
  margin: 4px auto 16px;
  max-height: none !important;
}
#tab-scores .gaugeHouse {
  float: none !important;
  display: flex !important;
  justify-content: center;
  max-width: 140px !important;
  max-height: none !important;
}
#tab-scores #gaugeDivR:empty,
#tab-scores #gauge2_div:empty {
  display: none;
}
#tab-scores .gauges,
#tab-scores #gauge1_div,
#tab-scores #gauge2_div,
#tab-scores #gauge1_div canvas,
#tab-scores #gauge2_div canvas,
canvas.ccx-gauge {
  margin: 0 auto;
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

/* Clue card */
#tab-scores #panelClueHouse,
#tab-scores .ccx-panel-clue-block {
  width: 100%;
  max-width: 320px;
  margin: 0 auto 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
#tab-scores #clueHousePanel,
#tab-scores .cluesPanel {
  display: block;
  width: 100%;
  box-sizing: border-box;
  height: auto !important;
  max-height: none !important;
  min-height: 44px;
  overflow: visible !important;
  padding: 14px 16px 22px !important;
  margin: 0 !important;
  background: #fff !important;
  color: #555 !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  line-height: 1.45 !important;
  text-align: center !important;
  border: 3px solid #cfcfcf !important;
  border-radius: 10px !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Direction + board icons — HIG 44px */
#tab-scores #directionPicPanel,
#tab-scores .ccx-dir-row {
  display: flex !important;
  flex-direction: row !important;
  justify-content: center;
  align-items: center;
  gap: 14px;
  width: 100%;
  margin: 4px 0 8px;
}
#tab-scores #directionPicPanel img {
  width: 48px !important;
  height: 48px !important;
  min-width: 44px;
  min-height: 44px;
  border-radius: 8px !important;
  object-fit: contain;
  background: #2f2f2f;
  box-shadow: 0 1px 3px rgba(0,0,0,0.35);
  cursor: default;
  -webkit-tap-highlight-color: transparent;
}
#tab-scores #directionPicPanel img#noPanelBoard,
#tab-scores #directionPicPanel img#panelPicLink {
  background: #fff;
  cursor: pointer;
}

/* Anagram tray */
#tab-scores #kidsCellHouse2,
#tab-scores .ccx-anagram-tray {
  display: flex !important;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
  width: auto;
  max-width: 100%;
  min-height: 56px;
  margin: 16px auto 8px !important;
  padding: 10px 12px !important;
  box-sizing: border-box;
  background: #4a4a4a !important;
  border: 4px solid #d8d8d8 !important;
  border-radius: 10px !important;
  cursor: pointer;
}
#tab-scores #kidsCellHouse2 > div,
#tab-scores .ccx-anagram-tray > div {
  float: none !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 44px !important;
  height: 44px !important;
  min-width: 44px;
  min-height: 44px;
  margin: 0 !important;
  font-size: 22px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  color: #1a1a1a !important;
  background: #e8d7a8 !important;
  border: 1px solid #c4a86a !important;
  border-radius: 4px !important;
  box-shadow: 1px 2px 0 #b89a5c;
}

/* Hide invisible start button from layout */
#tab-scores #playReplay {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

@media (orientation: landscape) and (max-height: 500px) {
  #tab-scores .scores-stage { padding-top: 8px; }
  #tab-scores .gaugeHouseContainer { margin-bottom: 8px; }
  #tab-scores #kidsCellHouse2 { margin-top: 8px !important; }
}

/* ===== Scores gauge + anagram tray fix ===== */
/* Gauge: true center; hide empty second gauge */
#tab-scores .gaugeHouseContainer {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  width: 100% !important;
  max-width: 100% !important;
  margin-left: auto !important;
  margin-right: auto !important;
  float: none !important;
  text-align: center !important;
}
#tab-scores #gaugeDivL,
#tab-scores #gaugeDivR,
#tab-scores .gaugeHouse {
  float: none !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  margin: 0 auto !important;
  width: auto !important;
  max-width: none !important;
}
#tab-scores #gaugeDivR:has(#gauge2_div:empty),
#tab-scores #gaugeDivR:not(:has(svg)):not(:has(canvas)):not(:has(table)) {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
}
/* Fallback when :has unsupported — hide gauge2 if no child content */
#tab-scores #gauge2_div:empty {
  display: none !important;
}
#tab-scores #gaugeDivR {
  /* solo play: JS often leaves empty right gauge taking float space */
}
#tab-scores.solo-gauge #gaugeDivR {
  display: none !important;
}
#tab-scores #gauge1_div,
#tab-scores #gauge1_div > * {
  margin-left: auto !important;
  margin-right: auto !important;
}
#tab-scores #gauge1_div table,
#tab-scores #gauge1_div svg,
#tab-scores #gauge1_div canvas {
  display: block !important;
  margin: 0 auto !important;
}

/* Anagram tray: width hugs letters with even padding */
#tab-scores #kidsCellHouse2,
#tab-scores .ccx-anagram-tray {
  display: inline-flex !important;
  flex-wrap: nowrap !important;
  justify-content: center !important;
  align-items: center !important;
  width: max-content !important;
  max-width: calc(100% - 24px) !important;
  min-width: 0 !important;
  height: auto !important;
  margin: 16px auto 8px !important;
  padding: 10px 14px !important;
  gap: 8px !important;
  box-sizing: border-box !important;
  border: 4px solid #d8d8d8 !important;
  border-radius: 10px !important;
  background: #4a4a4a !important;
}
#tab-scores #kidsCellHouse2 > div,
#tab-scores .ccx-anagram-tray > div {
  flex: 0 0 44px !important;
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  min-height: 44px !important;
  margin: 0 !important;
  float: none !important;
}

/* ===== Dir toggle clickable ===== */
#tab-scores #directionPicPanel,
#tab-scores .ccx-dir-row {
  pointer-events: auto !important;
  position: relative;
  z-index: 5;
}
#tab-scores #directionPicPanel img,
#ccxDirToggle,
#directionPicPanel img.ccx-dir-btn {
  -webkit-user-select: none;
  user-select: none;
}
#tab-scores #noPanelBoard,
#tab-scores #directionPicPanel img#noPanelBoard {
  pointer-events: auto !important;
  cursor: pointer !important;
}
#tab-scores.solo-gauge #gaugeDivR {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
}
#tab-scores .gaugeHouseContainer {
  justify-content: center !important;
  width: 100% !important;
}
#tab-scores #gaugeDivL,
#tab-scores #gaugeDivR {
  margin: 0 !important;
  float: none !important;
}
#tab-scores #kidsCellHouse2 {
  width: max-content !important;
  max-width: calc(100% - 24px) !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding: 10px 14px !important;
  display: inline-flex !important;
  box-sizing: border-box !important;
}

/* ===== Anagram tray snug HIG (reference) ===== */
#tab-scores #kidsCellHouse2,
#tab-scores .ccx-anagram-tray {
  display: block !important;
  width: var(--ccx-anagram-tray-width, max-content) !important;
  max-width: calc(100% - 16px) !important;
  height: auto !important;
  min-height: 0 !important;
  margin: 16px auto 8px !important;
  padding: 3px !important;
  box-sizing: border-box !important;
  background: #4a4a4a !important;
  border: 4px solid #c8c8c8 !important;
  border-radius: 10px !important;
  box-shadow: inset 0 0 0 1px #fff !important; /* inner white stroke */
  cursor: pointer;
  overflow: hidden !important;
  position: relative;
  white-space: nowrap !important;
}
#tab-scores #kidsCellHouse2 > div,
#tab-scores .ccx-anagram-tray > div {
  float: left !important;
  display: block !important;
  flex: none !important;
  width: var(--ccx-anagram-tile, 44px) !important;
  height: var(--ccx-anagram-tile, 44px) !important;
  min-width: var(--ccx-anagram-tile, 44px) !important;
  min-height: var(--ccx-anagram-tile, 44px) !important;
  max-width: var(--ccx-anagram-tile, 44px) !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 2px !important;
  font-size: 22px !important;
  font-weight: 700 !important;
  line-height: var(--ccx-anagram-tile, 44px) !important;
  text-align: center !important;
  color: #1a1a1a !important;
  background: #e8d7a8 !important;
  border: 1px solid #c4a86a !important;
  border-right-width: 0 !important; /* flush seam */
  box-shadow: none !important;
}
#tab-scores #kidsCellHouse2 > div.ccx-anag-correct,
#tab-scores .ccx-anagram-tray > div.ccx-anag-correct,
body.ccx-on-scores #tab-scores #kidsCellHouse2 > div.ccx-anag-correct {
  color: #77e056 !important;
}
#tab-scores #kidsCellHouse2 > div:last-child,
#tab-scores .ccx-anagram-tray > div:last-child {
  border-right-width: 1px !important;
}

/* Direction arrow on Scores is display-only (Across/Down indicator) */
#tab-scores #ccxDirDisplay,
#tab-scores #ccxDirToggle,
#tab-scores #directionPicPanel img.ccx-dir-btn,
#tab-scores #directionPicPanel img.ccx-dir-display,
#tab-scores #directionPicPanel img:not(#noPanelBoard):not(#panelPicLink) {
  pointer-events: none !important;
  cursor: default !important;
  opacity: 1;
}
#tab-scores #noPanelBoard {
  pointer-events: auto !important;
  cursor: pointer !important;
}

/* ===== Clue tooltip clamp enclosure ===== */
#puzzle {
  position: relative;
}
#clueHouse {
  max-width: min(280px, calc(100% - 8px)) !important;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  box-sizing: border-box !important;
}

/* ===== Puzzle scrollbars + touch ===== */
#puzzle,
#tab-board #puzzle,
.board-stage #puzzle {
  overflow-x: auto !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  /* Show classic scrollbars when content overflows (laptop / large grid) */
  scrollbar-width: thin;
  scrollbar-color: #888 #ddd;
}
#puzzle::-webkit-scrollbar,
#tab-board #puzzle::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
#puzzle::-webkit-scrollbar-thumb,
#tab-board #puzzle::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 6px;
}
#puzzle::-webkit-scrollbar-track,
#tab-board #puzzle::-webkit-scrollbar-track {
  background: #ddd;
}
#grid,
#grid > div,
#kidsCellHouse2 > div,
#tab-scores #kidsCellHouse2 > div,
#kidsCellHouse2.ccx-anagram-tray,
#tab-scores #kidsCellHouse2.ccx-anagram-tray > div {
  touch-action: none !important;
}
#clueHouse {
  /* sit nearer the cell; clamp still applies */
  margin: 0 !important;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  max-width: min(280px, calc(100% - 8px)) !important;
  box-sizing: border-box !important;
}
@media (max-width: 430px) {
  #clueHouse {
    max-width: min(240px, calc(100vw - 16px)) !important;
  }
  #puzzle #clueHouse {
    max-width: min(240px, calc(100% - 8px)) !important;
  }
}

/* ===== Hit-test + DnD + scrollbars ===== */
/* Keep #puzzle as scrollport; center via board-stage, not flex on #puzzle */
#tab-board #puzzle,
.board-stage #puzzle {
  display: block !important;
  overflow-x: scroll !important;
  overflow-y: scroll !important;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: #666 #e0e0e0;
  max-width: 100%;
  touch-action: none;
}
#tab-board #puzzle::-webkit-scrollbar,
.board-stage #puzzle::-webkit-scrollbar {
  width: 12px;
  height: 12px;
  display: block;
}
#tab-board #puzzle::-webkit-scrollbar-thumb,
.board-stage #puzzle::-webkit-scrollbar-thumb {
  background: #666;
  border-radius: 6px;
  border: 2px solid #e0e0e0;
}
#tab-board #puzzle::-webkit-scrollbar-track,
.board-stage #puzzle::-webkit-scrollbar-track {
  background: #e0e0e0;
}
#tab-board #grid,
.board-stage #grid {
  display: block !important;
  touch-action: none;
}
#tab-board #grid > div,
.board-stage #grid > div {
  touch-action: none;
}

/* Anagram drag tiles — DevTools / touch */
#kidsCellHouse2,
#tab-scores #kidsCellHouse2 {
  touch-action: none !important;
}
#kidsCellHouse2 > div,
#tab-scores #kidsCellHouse2 > div {
  touch-action: none !important;
  cursor: grab !important;
  -webkit-user-select: none !important;
  user-select: none !important;
}
#kidsCellHouse2 > div.ui-sortable-helper,
#tab-scores #kidsCellHouse2 > div.ui-sortable-helper {
  cursor: grabbing !important;
  z-index: 40000 !important;
  position: absolute !important;
  float: none !important;
  display: block !important;
  width: var(--ccx-anagram-tile, 44px) !important;
  height: var(--ccx-anagram-tile, 44px) !important;
  background: #e8d7a8 !important;
  border: 1px solid #c4a86a !important;
  font-weight: 700 !important;
  font-size: 20px !important;
  line-height: var(--ccx-anagram-tile, 44px) !important;
  text-align: center !important;
  color: #1a1a1a !important;
  box-shadow: 0 6px 14px rgba(0,0,0,0.35) !important;
  pointer-events: none !important;
}
#kidsCellHouse2 .ccx-anag-placeholder,
#tab-scores #kidsCellHouse2 .ccx-anag-placeholder {
  visibility: visible !important;
  background: rgba(255,255,255,0.18) !important;
  border: 1px dashed #c4a86a !important;
  float: left !important;
  display: block !important;
  flex: none !important;
  width: var(--ccx-anagram-tile, 44px) !important;
  height: var(--ccx-anagram-tile, 44px) !important;
  min-width: var(--ccx-anagram-tile, 44px) !important;
  max-width: var(--ccx-anagram-tile, 44px) !important;
  box-sizing: border-box !important;
}
#clueHouse.ui-draggable {
  touch-action: none;
  cursor: grab !important;
}
#clueHouse.ccx-dragging,
#clueHouse.ui-draggable-dragging {
  position: fixed !important;
  margin: 0 !important;
  right: auto !important;
  bottom: auto !important;
  transform: none !important;
  cursor: grabbing !important;
}

/* ===== Fixed crossword grid geometry ===== */
#grid.grid40,
#tab-board #grid.grid40,
.board-stage #grid.grid40 {
  /* 15 cols × 40px border-box cells — hug the tiles (no right/bottom strip) */
  width: 600px !important;
  height: 600px !important;
  max-width: none !important;
  min-width: 600px !important;
  display: block !important;
  overflow: hidden !important;
  float: none !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding: 0 !important;
  box-sizing: content-box !important;
  border: 1px solid #000 !important;
  background-color: #4a4a4a !important;
}
#grid.grid40 > div,
#tab-board #grid.grid40 > div,
.board-stage #grid.grid40 > div {
  float: left !important;
  box-sizing: border-box !important;
  width: 40px !important;
  height: 40px !important;
  background-color: #fff;
}
#grid > div.blackout,
#tab-board #grid > div.blackout,
.board-stage #grid > div.blackout {
  background-color: #36C3E0;
}
#grid > div.hilite,
#tab-board #grid > div.hilite,
.board-stage #grid > div.hilite {
  background-color: yellow;
}
/* Smaller boards if class changes */
#grid.grid35 { width: 525px !important; height: 525px !important; border: 1px solid #000 !important; box-sizing: content-box !important; }
#grid.grid30 { width: 450px !important; height: 450px !important; border: 1px solid #000 !important; box-sizing: content-box !important; }

#grid .numSpot, #grid .numSpot1, #grid .numSpot2, #grid span {
  pointer-events: none !important;
}
/* ===== Chat tab (in-panel, not floating overlay) ===== */
#tab-chat.page-content {
  display: none;
  padding: 12px;
  overflow: auto;
  background: #f2f2f7;
  box-sizing: border-box;
}
#tab-chat.tab-active {
  display: block !important;
}
.ccx-chat-stage {
  max-width: 360px;
  margin: 0 auto;
  min-height: calc(100% - 8px);
  display: flex;
  flex-direction: column;
}
#chatPanel.chat-panel.ccx-chat-in-tab {
  position: relative !important;
  left: auto !important;
  right: auto !important;
  top: auto !important;
  bottom: auto !important;
  width: 100% !important;
  max-width: 360px;
  height: min(560px, calc(var(--ccx-vvh, 100svh) - 120px - env(safe-area-inset-bottom, 0px))) !important;
  min-height: 420px;
  margin: 0 auto;
  display: flex !important;
  flex-direction: column;
  z-index: 1 !important;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  border: 2px solid #D4C5B9;
  border-radius: 12px;
  background: silver;
}
#chatPanel.ccx-chat-in-tab .chat-header,
body.ccx-on-chat #chatPanel .chat-header {
  cursor: default;
  flex-shrink: 0;
  background: #8a8279 !important;
  overflow: hidden;
  position: relative;
}
#chatPanel.ccx-chat-in-tab .chat-header-gradient,
#chatPanel .chat-header-gradient,
body.ccx-on-chat #chatPanel .chat-header-gradient {
  background: #8a8279 !important;
}
#chatPanel.ccx-chat-in-tab .chat-title,
body.ccx-on-chat #chatPanel .chat-title {
  color: #fff !important;
  padding: 0 48px;
  box-sizing: border-box;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#chatPanel .chat-close-btn,
body.ccx-on-chat #chatPanel .chat-close-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 22px;
  background: rgba(0, 0, 0, 0.22);
  color: #fff;
  font-size: 26px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
#chatPanel .chat-close-btn:hover,
#chatPanel .chat-close-btn.ccx-hover,
body.ccx-on-chat #chatPanel .chat-close-btn:hover {
  background: rgba(0, 0, 0, 0.38);
}
#chatPanel .chat-close-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.45);
}
#chatPanel.ccx-chat-in-tab .chat-action-buttons {
  display: flex;
  gap: 6px;
  padding: 14px 10px 8px;
  flex-shrink: 0;
  background: silver;
}
#chatPanel.ccx-chat-in-tab .chat-action-btn {
  flex: 1;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  font-size: 12px;
  padding: 10px 4px;
  min-height: 40px;
  cursor: pointer;
}
#chatPanel.ccx-chat-in-tab .ready-btn {
  background: #34C759;
  color: #fff;
}
#chatPanel.ccx-chat-in-tab .pause-btn {
  background: #7FD4E8;
  color: #123;
}
#chatPanel.ccx-chat-in-tab .pause-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(0.2);
}
#chatPanel.ccx-chat-in-tab .quit-btn {
  background: #F5A8C0;
  color: #321;
}
#chatPanel.ccx-chat-in-tab .ready-btn:disabled,
#chatPanel.ccx-chat-in-tab .ready-btn.ccx-quit-used,
#chatPanel.ccx-chat-in-tab .quit-btn:disabled,
#chatPanel.ccx-chat-in-tab .quit-btn.ccx-quit-used {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(0.2);
  pointer-events: none !important;
}
#chatPanel.ccx-chat-in-tab .chat-messages {
  flex: 1;
  min-height: 0;
  background: silver;
}

/* iMessage-style 2-player chat bubbles */
#chatPanel .chat-message.regular,
body.ccx-on-chat #chatPanel .chat-message.regular {
  box-sizing: border-box;
  max-width: 75%;
  padding: 7px 14px;
  border: none !important;
  background-image: none !important;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 17px;
  font-weight: 400;
  letter-spacing: -0.41px;
  line-height: 1.29;
  -webkit-font-smoothing: antialiased;
}
#chatPanel .chat-message.regular.own,
body.ccx-on-chat #chatPanel .chat-message.regular.own {
  align-self: flex-end;
  margin-left: auto;
  background-color: #007AFF !important;
  color: #FFFFFF !important;
  border-radius: 18px 18px 4px 18px;
}
#chatPanel .chat-message.regular.other,
body.ccx-on-chat #chatPanel .chat-message.regular.other {
  align-self: flex-start;
  background-color: #E9E9EB !important;
  color: #000000 !important;
  border-radius: 18px 18px 18px 4px;
}
#chatPanel .chat-message.regular .chat-message-text,
body.ccx-on-chat #chatPanel .chat-message.regular .chat-message-text {
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  line-height: inherit;
  color: inherit !important;
}
#chatPanel .chat-message.system,
body.ccx-on-chat #chatPanel .chat-message.system {
  text-align: left !important;
  align-self: stretch !important;
  max-width: 100% !important;
  width: 100% !important;
  justify-content: flex-start;
}
#chatPanel.ccx-chat-in-tab .chat-input-area,
body.ccx-on-chat #chatPanel .chat-input-area {
  display: flex;
  gap: 8px;
  padding: 10px;
  background: #8a8279 !important;
  border-radius: 0 0 14px 14px;
  flex-shrink: 0;
}
#chatPanel.ccx-chat-in-tab .chat-input,
body.ccx-on-chat #chatPanel .chat-input {
  flex: 1;
  border: 1px solid #cfcfcf;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 14px;
  min-height: 36px;
  background: #fff !important;
  color: #222;
}
#chatPanel.ccx-chat-in-tab .chat-input::placeholder,
body.ccx-on-chat #chatPanel .chat-input::placeholder {
  color: #888;
}
#chatPanel.ccx-chat-in-tab .chat-send-btn {
  background: #5B9BD5;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-weight: 600;
  min-height: 36px;
  cursor: pointer;
}
body.ccx-on-chat #clueHouse {
  display: none !important;
}
/* ===== Puzzle scrollport fix (visible h-scrollbar) ===== */
/*
  Why the bar was "missing":
  1) #puzzle was sizing to the grid (width ~ content). If the window
     is still >= the grid, scrollWidth == clientWidth — overflow:auto correctly
     draws NO bar.
  2) When the viewport IS narrower, Chromium often uses overlay scrollbars
     that stay hidden until you scroll; classic bars need an explicit width
     constraint on the scrollport (width:100%; min-width:0) plus non-overlay
     scrollbar styling.
  3) height:auto made #puzzle grow with the 600px grid, so there was no pan-Y
     on phones ≥390. Cap #puzzle to the visible tab instead. SE/mini (≤375)
     uses body.ccx-fit-board and must NOT gain a 600px pan scroller.
*/
.page > .tabs {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 0;
  height: auto;
  min-height: 0;
  overflow: hidden;
  position: relative;
}
#tab-board.page-content,
#tab-board.tab,
#tab-board {
  min-width: 0;
  min-height: 0;
  overflow: hidden; /* pan happens on #puzzle, not the page */
  flex-direction: column;
  padding-top: 0 !important; /* hidden F7 navbar must not leave a gray band */
  padding-bottom: 0;
  background: #4a4a4a !important;
}
#tab-board.tab.tab-active {
  display: flex !important;
  flex: 1 1 0 !important;
  flex-direction: column;
  min-height: 0 !important;
  height: auto !important;
  background: #4a4a4a !important;
}
.board-stage {
  align-items: stretch; /* was center — let #puzzle take full stage width */
  justify-content: flex-start; /* grid under welcome, not vertically centered */
  min-width: 0;
  min-height: 0;
  width: 100%;
  flex: 1 1 0;
  overflow: hidden;
  background: #4a4a4a;
  padding-top: 0;
  padding-bottom: 0;
}
@media (orientation: portrait) {
  .page > .tabs {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 0 !important;
    min-height: 0 !important;
    height: auto !important;
  }
  #tab-board.page-content,
  #tab-board.tab,
  #tab-board.tab.tab-active,
  #tab-board {
    display: flex !important;
    flex: 1 1 0 !important;
    flex-direction: column !important;
    min-height: 0 !important;
    height: auto !important;
  }
  /* Inactive tabs must stay hidden even with the flex rules above */
  #tab-board.tab:not(.tab-active),
  #tab-scores.tab:not(.tab-active),
  #tab-chat.tab:not(.tab-active),
  #tab-options.tab:not(.tab-active),
  #tab-pause.tab:not(.tab-active) {
    display: none !important;
  }
  .board-stage {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    height: auto !important;
  }
  .toolbar.tabbar.toolbar-bottom,
  #botToolbar.toolbar-bottom {
    margin: 0 !important;
    flex: none !important;
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    top: var(--ccx-tabbar-top, calc(var(--ccx-vvh, 100dvh) - 56px - var(--safe-bottom))) !important;
    bottom: auto !important;
    height: calc(56px + var(--safe-bottom)) !important;
    min-height: calc(56px + var(--safe-bottom)) !important;
    max-height: calc(56px + var(--safe-bottom)) !important;
    padding-bottom: 0 !important;
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 2147483646 !important;
  }
}
#tab-board #puzzle,
.board-stage #puzzle,
#puzzle {
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important; /* critical inside flex: allow shrink below grid */
  /* Never use height:100% here — flex parents with height:auto resolve 100% to 0
     (blank board after login / landscape→portrait in Chrome DevTools). */
  min-height: 160px;
  height: min(560px, calc(var(--ccx-vvh, 100svh) - var(--ccx-tabbar-h, 50px) - 24px)) !important;
  max-height: min(560px, calc(var(--ccx-vvh, 100dvh) - var(--ccx-tabbar-h, 50px) - 24px)) !important;
  max-height: min(560px, calc(var(--ccx-vvh, 100svh) - var(--ccx-tabbar-h, 50px) - 24px)) !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  display: block !important;
  overflow-x: scroll !important;
  overflow-y: scroll !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-x pan-y;
  scrollbar-gutter: stable;
  scrollbar-width: auto;
  scrollbar-color: #555 #4a4a4a;
  background: #4a4a4a;
}
/* Laptop / desktop: 560px window around the 600px grid so both scrollbars
   sit on the board, not at the far edge of a full-width scrollport. */
body:not(.ccx-fit-board) #tab-board #puzzle,
body:not(.ccx-fit-board) .board-stage #puzzle,
body:not(.ccx-fit-board) #puzzle {
  width: 560px !important;
  max-width: min(560px, 100%) !important;
  height: 560px !important;
  max-height: 560px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  overflow-x: scroll !important;
  overflow-y: scroll !important;
}
/* Header strip: 40px min, 80px max (two 20px lines), plus the iOS
   status-bar inset so TestFlight / time / battery do not sit on
   "Name -- Puzzle Set Installed". */
.ccx-board-welcome,
.ccx-board-welcome[hidden] {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 100%;
  min-height: calc(40px + env(safe-area-inset-top, 0px));
  max-height: calc(80px + env(safe-area-inset-top, 0px));
  margin: 0 0 2px;
  padding: env(safe-area-inset-top, 0px) 10px 0;
  overflow: hidden;
  white-space: normal;
  text-overflow: clip;
  text-align: center;
  font-family: -apple-system, Helvetica, Arial, sans-serif;
  font-size: 13px;
  font-weight: 700;
  line-height: 20px;
  color: silver;
  background: transparent;
}
/* Phones and iPads: the scrollport fills the stage from the header down to
   the bottom-docked tab bar; the grid (cells ≥ 40px) overflows it and pans. */
body.ccx-fit-board #tab-board #puzzle,
body.ccx-fit-board .board-stage #puzzle,
body.ccx-fit-board #puzzle {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  max-height: none !important;
  height: auto !important;
  overflow-x: scroll !important;
  overflow-y: scroll !important;
}
body.ccx-fit-board .board-stage,
body.ccx-fit-board #tab-board .board-stage {
  display: flex !important;
  flex-direction: column !important;
  padding-bottom: 0 !important;
}
body.ccx-keyboard-open .board-stage,
body.ccx-keyboard-open #tab-board .board-stage {
  padding: 0 !important;
  justify-content: flex-start !important;
}
body.ccx-keyboard-open.ccx-fit-board #tab-board #puzzle,
body.ccx-keyboard-open.ccx-fit-board .board-stage #puzzle,
body.ccx-keyboard-open.ccx-fit-board #puzzle {
  flex: 1 1 auto !important;
  margin-bottom: 0 !important;
}
#grid,
#tab-board #grid,
.board-stage #grid,
#grid > div {
  touch-action: none;
}
#clueHouse {
  touch-action: none !important;
}
body.ccx-clue-dragging #puzzle,
body.ccx-clue-dragging #grid,
body.ccx-clue-dragging .board-stage {
  touch-action: none !important;
}
#tab-board #puzzle::-webkit-scrollbar,
.board-stage #puzzle::-webkit-scrollbar,
#puzzle::-webkit-scrollbar {
  width: 14px !important;
  height: 14px !important;
  display: block !important;
  background: #4a4a4a;
}
#tab-board #puzzle::-webkit-scrollbar-thumb,
.board-stage #puzzle::-webkit-scrollbar-thumb,
#puzzle::-webkit-scrollbar-thumb {
  background: #888 !important;
  border-radius: 7px;
  border: 2px solid #4a4a4a;
  min-width: 40px;
  min-height: 40px;
}
#tab-board #puzzle::-webkit-scrollbar-track,
.board-stage #puzzle::-webkit-scrollbar-track,
#puzzle::-webkit-scrollbar-track {
  background: #4a4a4a !important;
}
#tab-board #puzzle::-webkit-scrollbar-corner,
.board-stage #puzzle::-webkit-scrollbar-corner,
#puzzle::-webkit-scrollbar-corner {
  background: #4a4a4a;
}
/* Grid stays fixed size so it can overflow the 100%-wide scrollport */
#grid.grid40,
#tab-board #grid.grid40,
.board-stage #grid.grid40 {
  width: 600px !important;
  height: 600px !important;
  max-width: none !important;
  min-width: 600px !important;
  flex-shrink: 0;
  box-sizing: content-box !important;
  border: 1px solid #000 !important;
  padding: 0 !important;
}
body.ccx-fit-board #grid.grid40,
body.ccx-fit-board #tab-board #grid.grid40,
body.ccx-fit-board .board-stage #grid.grid40 {
  width: var(--ccx-grid-px) !important;
  height: var(--ccx-grid-px) !important;
  min-width: var(--ccx-grid-px) !important;
}
body.ccx-fit-board #grid.grid40 > div,
body.ccx-fit-board #tab-board #grid.grid40 > div,
body.ccx-fit-board .board-stage #grid.grid40 > div {
  width: var(--ccx-cell-px) !important;
  height: var(--ccx-cell-px) !important;
  font-size: var(--ccx-cell-font, 16px) !important;
  line-height: var(--ccx-cell-px) !important;
  overflow: hidden !important;
}
/* Cell numbers are absolutely positioned spans with inline 11px font. */
body.ccx-fit-board #grid.grid40 > div > span[style*="position:absolute"] {
  font-size: var(--ccx-num-font, 11px) !important;
  line-height: 1 !important;
}

/* ccx-user-caret: ensure visible blinking caret in First Name on desktop */
#user.ccx-name-input,
#dlgContent #user {
  caret-color: #1e4f8c !important;
  cursor: text !important;
  -webkit-user-select: text !important;
  user-select: text !important;
}
body.ccx-login-open #keys,
body.ccx-login-open #myFormContainer {
  pointer-events: none !important;
  opacity: 0 !important;
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
}

/* ccx-keys-overlay: never steal board clicks */
#myFormContainer.keysInputForm,
#myFormContainer {
  pointer-events: none !important;
  z-index: 1 !important;
}
#keys,
input#keys {
  pointer-events: none !important;
}
/* When focused for letter entry, allow the tiny keys input only */
body.ccx-entering-letter #keys,
body.ccx-entering-letter input#keys {
  pointer-events: auto !important;
}


#ccxWordSetDialog,
.ccx-wordset-dialog {
  display: none;
}

/* Select Puzzle / Host word-set dialog */
body.ccx-themes-open::before {
  content: '';
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  bottom: var(--ccx-tabbar-h, 50px);
  background: rgba(0, 0, 0, 0.42);
  z-index: 12900;
  pointer-events: auto;
}
body.ccx-themes-open #ccxWordSetDialog,
body.ccx-themes-open .ccx-wordset-dialog {
  display: flex !important;
  flex-direction: column;
  position: fixed !important;
  /* left/top set by ccxPlaceWordSetOnGrid — fallback near grid center */
  z-index: 13000 !important;
  width: min(240px, calc(100vw - 32px)) !important;
  height: auto !important;
  max-height: min(70vh, calc(var(--ccx-vvh, 100svh) - 24px)) !important;
  margin: 0 !important;
  padding: 0 0 6px !important;
  overflow: auto;
  background: #4a4a4a !important;
  border-radius: 14px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.45);
  transform: none;
}
#popupDialog.ccx-card-leave,
#ccxWordSetDialog.ccx-card-leave {
  animation: none !important;
  opacity: 0 !important;
  transition: opacity 0.4s ease !important;
  pointer-events: none !important;
}
body.ccx-themes-open .ccx-wordset-header {
  display: block;
  padding: 14px 16px 12px;
  text-align: center;
  font-family: -apple-system, Helvetica, Arial, sans-serif;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  color: silver;
  background: #4a4a4a;
}
body.ccx-themes-open .mPuzzles {
  display: block !important;
  position: relative !important;
  left: auto !important;
  top: auto !important;
  transform: none !important;
  z-index: auto !important;
  width: auto !important;
  height: auto !important;
  max-height: 70vh;
  overflow: auto;
  margin: 0 !important;
  padding: 8px !important;
  list-style: none !important;
  background: transparent !important;
  border-radius: 0;
  box-shadow: none;
}
body.ccx-themes-open .mPuzzles li {
  list-style: none !important;
  margin: 4px 0 !important;
  padding: 0 !important;
  display: flex;
  justify-content: center;
}
body.ccx-themes-open .mPuzzles li a {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: relative !important;
  width: 80% !important;
  box-sizing: border-box;
  min-height: 44px !important;
  padding: 8px 28px !important;
  margin: 0 !important;
  font-family: -apple-system, Helvetica, Arial, sans-serif !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  color: #fff !important;
  text-shadow: none !important;
  text-decoration: none !important;
  border: 0 !important;
  border-radius: 10px !important;
  background: linear-gradient(180deg, #6eb0dc 0%, #3d7ab8 100%) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.28);
  transition: background 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}
body.ccx-themes-open .mPuzzles li a:not(.ccx-wordset-selected)::before,
body.ccx-themes-open .mPuzzles li a::after {
  content: none !important;
  display: none !important;
}
body.ccx-themes-open .mPuzzles li a.ccx-wordset-selected::before {
  content: '✓' !important;
  display: flex !important;
  position: absolute !important;
  left: 10px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  font-size: 16px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  color: #fff !important;
  text-shadow: 0 1px 0 rgba(0,0,0,0.25);
  pointer-events: none;
}
body.ccx-themes-open .mPuzzles li.ccx-wordset-cancel {
  margin-top: 12px !important;
  padding-top: 0 !important;
  display: flex !important;
  justify-content: center;
}
body.ccx-themes-open.ccx-wordset-required .mPuzzles li.ccx-wordset-cancel {
  display: none !important;
}
body.ccx-themes-open .mPuzzles li.ccx-wordset-cancel a {
  width: 50% !important;
  max-width: 50% !important;
  flex: 0 0 50%;
  box-sizing: border-box;
  color: #222 !important;
  background: linear-gradient(180deg, #f7e27a 0%, #e0c43a 100%) !important;
}
@media (hover: hover) and (pointer: fine) {
  body.ccx-themes-open .mPuzzles li a:hover,
  body.ccx-themes-open .mPuzzles li a.ccx-hover {
    background: linear-gradient(180deg, #7ee08a 0%, #34c759 100%) !important;
    color: #fff !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.35), 0 0 0 2px rgba(52,199,89,0.45);
  }
  body.ccx-themes-open .mPuzzles li.ccx-wordset-cancel a:hover,
  body.ccx-themes-open .mPuzzles li.ccx-wordset-cancel a.ccx-hover {
    background: linear-gradient(180deg, #b6f0b3 0%, #34c759 100%) !important;
    color: #0b3d14 !important;
  }
}
body.ccx-themes-open .mPuzzles li a:focus-visible {
  outline: none;
  background: linear-gradient(180deg, #7ee08a 0%, #34c759 100%) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.35), 0 0 0 3px rgba(52,199,89,0.55);
}
body.ccx-themes-open .mPuzzles li a.ccx-theme-blinking {
  pointer-events: none;
  transition: none !important;
}
body.ccx-themes-open .mPuzzles li a.ccx-theme-blink-on {
  background: linear-gradient(180deg, #5ee06a 0%, #248a32 100%) !important;
  color: #fff !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.35), 0 0 0 2px rgba(52,199,89,0.45);
}

/* Scores / Hints floats over the still-visible game board */
body.ccx-on-scores .page > .tabs {
  overflow: visible !important;
}
body.ccx-on-scores #tab-board.tab,
body.ccx-on-scores #tab-board.tab.tab-active,
body.ccx-on-scores #tab-board.page-content {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: none;
}
body.ccx-on-scores #clueHouse {
  display: none !important;
}
body.ccx-on-scores #tab-scores,
body.ccx-on-scores #tab-scores.tab,
body.ccx-on-scores #tab-scores.tab.tab-active {
  position: absolute !important;
  left: 0 !important;
  right: 0 !important;
  top: 0 !important;
  bottom: 0 !important;
  z-index: 12000 !important;
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow-x: hidden !important;
  overflow-y: hidden !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: rgba(0, 0, 0, 0.42) !important;
  padding: max(12px, env(safe-area-inset-top, 0px)) 8px 16px !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  width: auto !important;
  box-sizing: border-box;
  pointer-events: auto;
}
body.ccx-on-scores .toolbar.tabbar,
body.ccx-on-scores #botToolbar.toolbar-bottom {
  z-index: 13000 !important;
}
body.ccx-on-scores #tab-scores .scores-stage {
  position: absolute;
  background: #4a4a4a !important;
  border-radius: 14px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.45);
  /* Compact HIG popover (~iOS alert 270pt), leaving grid cells visible on both sides */
  width: min(252px, calc(100vw - 64px));
  max-width: 252px;
  flex: 0 0 auto !important;
  min-height: 0 !important;
  height: auto !important;
  max-height: calc(var(--ccx-vvh, 100svh) - var(--ccx-tabbar-h, 50px) - 24px) !important;
  margin: 0 auto;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: auto;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  padding: 10px 8px 12px !important;
  pointer-events: auto;
  touch-action: manipulation;
  cursor: default;
  scrollbar-width: auto;
  scrollbar-color: #e8e8ed #2c2c2e;
}
body.ccx-on-scores #tab-scores .scores-stage.ccx-pointer-dragging {
  cursor: grabbing;
  overflow: hidden !important;
}
body.ccx-on-scores #tab-scores .ccx-scores-grip {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  flex: none;
  box-sizing: border-box;
  width: auto !important;
  max-width: none !important;
  height: 44px;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  touch-action: none;
  background: #a8a9ad;
  border-radius: 14px 14px 0 0;
  z-index: 1;
}
body.ccx-on-scores #tab-scores .ccx-scores-grip::before {
  content: '';
  width: 72px;
  height: 7px;
  border-radius: 4px;
  background: #f4f4f6;
}
body.ccx-on-scores #tab-scores .scores-stage.ccx-pointer-dragging .ccx-scores-grip {
  cursor: grabbing;
}
body.ccx-on-scores #tab-scores .ccx-anagram-tray,
body.ccx-on-scores #tab-scores .ccx-anagram-hscroll {
  touch-action: pan-x;
  cursor: auto;
}
body.ccx-on-scores #tab-scores .scores-stage::-webkit-scrollbar {
  width: 14px;
  height: 14px;
}
body.ccx-on-scores #tab-scores .scores-stage::-webkit-scrollbar-track {
  background: #2c2c2e;
  border-radius: 8px;
}
body.ccx-on-scores #tab-scores .scores-stage::-webkit-scrollbar-thumb {
  background: #e8e8ed;
  border-radius: 8px;
  border: 2px solid #2c2c2e;
  min-height: 36px;
}
body.ccx-on-scores #tab-scores .scores-stage::-webkit-scrollbar-thumb:active {
  background: #f2f2f7;
}
body.ccx-on-scores #tab-scores .scores-stage::-webkit-scrollbar-corner {
  background: #2c2c2e;
}
body.ccx-on-scores #tab-scores #myPanel,
body.ccx-on-scores #tab-scores #myPanel.ccx-side-panel {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  text-align: center !important;
  width: 100% !important;
  max-width: 100% !important;
  padding: 0 !important;
  flex: 0 0 auto !important;
  min-height: 0 !important;
  height: auto !important;
  pointer-events: none;
}
body.ccx-on-scores #tab-scores .ccx-anagram-rack,
body.ccx-on-scores #tab-scores .ccx-anagram-well,
body.ccx-on-scores #tab-scores .ccx-anagram-hscroll,
body.ccx-on-scores #tab-scores #kidsCellHouse2,
body.ccx-on-scores #tab-scores #kidsCellHouse2 > div,
body.ccx-on-scores #tab-scores #panelClueHouse,
body.ccx-on-scores #tab-scores #clueHousePanel,
body.ccx-on-scores #tab-scores #noPanelBoard {
  pointer-events: auto !important;
}
body.ccx-on-scores #tab-scores .gaugeHouseContainer {
  display: flex !important;
  max-width: 100% !important;
  width: 100% !important;
  gap: 8px !important;
  padding: 2px 0 4px !important;
  box-sizing: border-box !important;
  align-items: center !important;
  justify-content: center !important;
  flex-wrap: nowrap !important;
  margin-top: 21px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  position: relative;
  z-index: 4;
  pointer-events: none;
  cursor: default;
  touch-action: auto;
}
body.ccx-on-scores #tab-scores #gauge1_div,
body.ccx-on-scores #tab-scores #gauge2_div,
body.ccx-on-scores #tab-scores #gauge1_div > *,
body.ccx-on-scores #tab-scores #gauge2_div > *,
body.ccx-on-scores #tab-scores #gauge1_div table,
body.ccx-on-scores #tab-scores #gauge2_div table,
body.ccx-on-scores #tab-scores #gauge1_div svg,
body.ccx-on-scores #tab-scores #gauge2_div svg,
body.ccx-on-scores #tab-scores #gauge1_div canvas,
body.ccx-on-scores #tab-scores #gauge2_div canvas {
  width: var(--ccx-gauge-px, 108px) !important;
  height: var(--ccx-gauge-px, 108px) !important;
  min-width: 0 !important;
  min-height: 0 !important;
  pointer-events: none;
  touch-action: pan-y;
}
body.ccx-on-scores #tab-scores #gaugeDivL,
body.ccx-on-scores #tab-scores #gaugeDivR {
  float: none !important;
  margin: 0 !important;
  flex: 0 0 var(--ccx-gauge-px, 108px);
  width: var(--ccx-gauge-px, 108px) !important;
  justify-content: center !important;
}
body.ccx-on-scores #tab-scores:not(.solo-gauge) #gaugeDivR,
body.ccx-on-scores #tab-scores:not(.solo-gauge) #gauge2_div {
  display: flex !important;
  width: var(--ccx-gauge-px, 108px) !important;
  height: var(--ccx-gauge-px, 108px) !important;
  overflow: visible !important;
  margin: 0 !important;
}
body.ccx-on-scores #tab-scores .ccx-panel-clue-block,
body.ccx-on-scores #tab-scores .ccx-anagram-rack {
  cursor: default;
}
body.ccx-on-scores #tab-scores .ccx-anagram-spacer {
  height: 8px;
  margin: 0;
}
body.ccx-on-scores #tab-scores #panelClueHouse,
body.ccx-on-scores #tab-scores .ccx-panel-clue-block {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  visibility: visible !important;
  opacity: 1 !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: -6px auto 18px !important;
}
body.ccx-on-scores #tab-scores #clueHousePanel,
body.ccx-on-scores #tab-scores .cluesPanel {
  display: block !important;
  visibility: visible !important;
  height: auto !important;
  max-height: none !important;
  min-height: 44px;
  overflow: visible !important;
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: 100% !important;
  padding: 10px 10px 12px !important;
  font-size: 15px !important;
  line-height: 1.35 !important;
  word-wrap: break-word;
  overflow-wrap: break-word;
  text-align: center !important;
  margin-left: auto !important;
  margin-right: auto !important;
}
body.ccx-on-scores #tab-scores #directionPicPanel img {
  width: 44px !important;
  height: 44px !important;
}
body.ccx-on-scores #tab-scores #kidsCellHouse2,
body.ccx-on-scores #tab-scores .ccx-anagram-tray {
  display: block !important;
  width: var(--ccx-anagram-tray-width, max-content) !important;
  max-width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  padding: 3px !important;
  margin: 8px auto 4px !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
  position: relative !important;
  white-space: nowrap !important;
  flex: 0 0 auto !important;
  touch-action: pan-x pan-y !important;
}
body.ccx-on-scores #tab-scores #kidsCellHouse2 > div,
body.ccx-on-scores #tab-scores .ccx-anagram-tray > div {
  float: left !important;
  display: block !important;
  flex: none !important;
  width: var(--ccx-anagram-tile, 44px) !important;
  height: var(--ccx-anagram-tile, 44px) !important;
  min-width: var(--ccx-anagram-tile, 44px) !important;
  max-width: var(--ccx-anagram-tile, 44px) !important;
  font-size: 20px !important;
  line-height: var(--ccx-anagram-tile, 44px) !important;
  text-align: center !important;
  box-sizing: border-box !important;
}

body.ccx-on-scores #tab-scores #directionPicPanel,
body.ccx-on-scores #tab-scores .ccx-dir-row {
  display: flex !important;
  visibility: visible !important;
  justify-content: center !important;
  align-items: center !important;
  width: 100% !important;
  margin-left: auto !important;
  margin-right: auto !important;
}
body.ccx-on-scores #tab-scores .ccx-anagram-rack {
  align-self: center !important;
  margin-left: auto !important;
  margin-right: auto !important;
}
#tab-scores .ccx-anagram-spacer {
  height: 8px;
  margin: 0;
}

/* Chat floats over the still-visible game board (2P) */
body.ccx-on-chat .page > .tabs {
  overflow: visible !important;
}
body.ccx-on-chat #tab-board.tab,
body.ccx-on-chat #tab-board.tab.tab-active,
body.ccx-on-chat #tab-board.page-content {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: none;
}
body.ccx-on-chat #clueHouse {
  display: none !important;
}
body.ccx-on-chat #tab-chat,
body.ccx-on-chat #tab-chat.tab,
body.ccx-on-chat #tab-chat.tab-active,
body.ccx-on-chat #tab-chat.page-content {
  position: absolute !important;
  left: 0 !important;
  right: 0 !important;
  top: 0 !important;
  bottom: 0 !important;
  z-index: 12000 !important;
  display: block !important;
  visibility: visible !important;
  overflow: hidden !important;
  background: rgba(0, 0, 0, 0.42) !important;
  padding: max(12px, env(safe-area-inset-top, 0px)) 8px 12px !important;
  height: auto !important;
  min-height: 0 !important;
  width: auto !important;
  box-sizing: border-box;
  pointer-events: auto;
  opacity: 1;
}
body.ccx-on-chat.ccx-chat-enter #tab-chat,
body.ccx-on-chat.ccx-chat-enter #tab-chat.tab,
body.ccx-on-chat.ccx-chat-enter #tab-chat.tab-active {
  animation: ccx-chat-dim-in 0.34s ease-out both;
}
body.ccx-on-chat.ccx-chat-enter #chatPanel,
body.ccx-on-chat.ccx-chat-enter #chatPanel.chat-panel,
body.ccx-on-chat.ccx-chat-enter #chatPanel.ccx-chat-in-tab {
  animation: ccx-chat-panel-in 0.42s cubic-bezier(0.32, 0.72, 0, 1) both;
}
@keyframes ccx-chat-dim-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes ccx-chat-panel-in {
  from {
    opacity: 0;
    transform: translate3d(0, 28px, 0) scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  body.ccx-on-chat.ccx-chat-enter #tab-chat,
  body.ccx-on-chat.ccx-chat-enter #chatPanel {
    animation: none !important;
  }
}
body.ccx-on-chat #tab-chat .ccx-chat-stage {
  background: transparent !important;
  min-height: 0 !important;
  max-width: 300px;
  width: min(300px, calc(100vw - 40px));
  margin: 0 auto;
  pointer-events: auto;
  display: flex !important;
  flex-direction: column;
}
body.ccx-on-chat #chatPanel,
body.ccx-on-chat #chatPanel.chat-panel,
body.ccx-on-chat #chatPanel.ccx-chat-in-tab,
body.ccx-on-chat #chatPanel.chat-panel.ccx-chat-in-tab {
  position: relative !important;
  left: auto !important;
  right: auto !important;
  top: auto !important;
  bottom: auto !important;
  width: 100% !important;
  max-width: none !important;
  min-height: 0 !important;
  height: auto !important;
  max-height: 100% !important;
  margin: 0 auto !important;
  display: flex !important;
  flex-direction: column !important;
  z-index: 1 !important;
  border-radius: 14px !important;
  border: 1px solid rgba(0,0,0,0.12);
  box-shadow: 0 10px 32px rgba(0,0,0,0.45);
  overflow: hidden;
  background: silver !important;
}
body.ccx-on-chat #chatPanel .chat-header {
  min-height: 44px;
  flex-shrink: 0;
}
body.ccx-on-chat #chatPanel .chat-action-buttons {
  gap: 8px;
  padding: 14px 10px 8px;
  flex-shrink: 0;
}
body.ccx-on-chat #chatPanel .chat-action-btn {
  min-height: 44px;
  font-size: 13px;
  border-radius: 10px;
}
body.ccx-on-chat #chatPanel .chat-messages {
  flex: 1 1 auto;
  min-height: 72px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
body.ccx-on-chat #chatPanel .chat-input-area {
  flex-shrink: 0;
  gap: 8px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
}
body.ccx-on-chat #chatPanel .chat-input {
  font-size: 16px !important;
  min-height: 44px;
  border-radius: 10px;
}
body.ccx-on-chat #chatPanel .chat-send-btn {
  min-height: 44px;
  min-width: 64px;
  border-radius: 10px;
  font-size: 16px;
}

/* Hide the in-chat game timer */
#gameTimerContainer,
.game-timer-container,
#chatPanel #gameTimerContainer {
  display: none !important;
}

/* Chat buttons — HIG hover / press / disabled
   Hover is not gated on (hover:hover)/(pointer:fine): hybrid laptops often
   report coarse pointer, so those media queries hide mouseover entirely. */
#chatPanel .chat-action-btn,
#chatPanel .chat-send-btn {
  cursor: pointer;
  transition: background-color 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease, transform 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}
#chatPanel .ready-btn,
body.ccx-on-chat #chatPanel .ready-btn,
#chatPanel.ccx-chat-in-tab .ready-btn {
  background: #34C759 !important;
  border: 0 !important;
  color: #fff !important;
}
#chatPanel .chat-action-btn:disabled,
#chatPanel .chat-action-btn.ccx-quit-used {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(0.2);
  transform: none !important;
  box-shadow: none !important;
  pointer-events: none !important;
}
#chatPanel .chat-action-btn:focus-visible,
#chatPanel .chat-send-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.38);
}
#chatPanel .chat-action-btn:hover:not(:disabled),
#chatPanel .chat-action-btn.ccx-hover:not(:disabled),
#chatPanel .chat-send-btn:hover:not(:disabled),
#chatPanel .chat-send-btn.ccx-hover:not(:disabled),
body.ccx-on-chat #chatPanel .chat-action-btn:hover:not(:disabled),
body.ccx-on-chat #chatPanel .chat-action-btn.ccx-hover:not(:disabled),
body.ccx-on-chat #chatPanel .chat-send-btn:hover:not(:disabled),
body.ccx-on-chat #chatPanel .chat-send-btn.ccx-hover:not(:disabled) {
  filter: none;
  transform: translateY(-1px);
}
#chatPanel .ready-btn:hover:not(:disabled),
#chatPanel .ready-btn.ccx-hover:not(:disabled),
body.ccx-on-chat #chatPanel .ready-btn:hover:not(:disabled),
body.ccx-on-chat #chatPanel .ready-btn.ccx-hover:not(:disabled),
#chatPanel.ccx-chat-in-tab .ready-btn:hover:not(:disabled),
#chatPanel.ccx-chat-in-tab .ready-btn.ccx-hover:not(:disabled) {
  background: #248A3D !important;
  box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.55) !important;
}
#chatPanel .pause-btn:hover:not(:disabled),
#chatPanel .pause-btn.ccx-hover:not(:disabled),
body.ccx-on-chat #chatPanel .pause-btn:hover:not(:disabled),
body.ccx-on-chat #chatPanel .pause-btn.ccx-hover:not(:disabled) {
  background: #4BB8D0 !important;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.35) !important;
}
#chatPanel .quit-btn:hover:not(:disabled),
#chatPanel .quit-btn.ccx-hover:not(:disabled),
body.ccx-on-chat #chatPanel .quit-btn:hover:not(:disabled),
body.ccx-on-chat #chatPanel .quit-btn.ccx-hover:not(:disabled) {
  background: #E85A7A !important;
  box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.32) !important;
}
#chatPanel .chat-send-btn:hover:not(:disabled),
#chatPanel .chat-send-btn.ccx-hover:not(:disabled),
body.ccx-on-chat #chatPanel .chat-send-btn:hover:not(:disabled),
body.ccx-on-chat #chatPanel .chat-send-btn.ccx-hover:not(:disabled) {
  background: #1A6FD4 !important;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.38) !important;
}
#chatPanel .chat-action-btn:active:not(:disabled),
#chatPanel .chat-send-btn:active:not(:disabled) {
  filter: brightness(0.92);
  transform: scale(0.98);
}

/* Immediate Ready tooltip (native title is delayed and often invisible) */
.ccx-hig-tip {
  position: fixed;
  z-index: 200000;
  left: 0;
  top: 0;
  transform: translate(-50%, -100%);
  background: #1c1c1e;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.25;
  padding: 7px 11px;
  border-radius: 8px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  box-shadow: 0 6px 18px rgba(0,0,0,0.32);
}
.ccx-hig-tip.ccx-hig-tip-on {
  opacity: 1;
  visibility: visible;
}
.ccx-hig-tip::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 100%;
  margin-left: -6px;
  border: 6px solid transparent;
  border-top-color: #1c1c1e;
}
.ccx-hig-tip.ccx-hig-tip-below {
  transform: translate(-50%, 0);
}
.ccx-hig-tip.ccx-hig-tip-below::after {
  top: auto;
  bottom: 100%;
  border-top-color: transparent;
  border-bottom-color: #1c1c1e;
}

@media (orientation: portrait) {
  body.ccx-on-chat #tab-chat .ccx-chat-stage {
    width: min(300px, calc(100vw - 40px));
    max-width: 300px;
  }
  body.ccx-on-chat #chatPanel .chat-messages {
    min-height: 88px;
    max-height: 220px;
  }
}
@media (orientation: landscape) {
  body.ccx-on-chat #tab-chat,
  body.ccx-on-chat #tab-chat.tab-active {
    padding-top: 8px !important;
    padding-bottom: 8px !important;
  }
  body.ccx-on-chat #tab-chat .ccx-chat-stage {
    max-height: calc(100dvh - 58px - env(safe-area-inset-bottom, 0px) - 12px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(80,80,80,0.55) rgba(0,0,0,0.08);
  }
  body.ccx-on-chat #chatPanel {
    max-height: 100% !important;
  }
  body.ccx-on-chat #chatPanel .chat-messages {
    min-height: 48px;
  }
}

/* ===== Anagram rack: 44px tiles, horizontal scroll after ~7 letters ===== */
#tab-scores .ccx-anagram-rack,
body.ccx-on-scores #tab-scores .ccx-anagram-rack {
  --ccx-anagram-tile: 44px;
  --ccx-anagram-visible: 7;
  --ccx-anagram-rack-max: calc(var(--ccx-anagram-visible) * 44px + 6px + 8px);
  display: block;
  width: auto;
  max-width: min(var(--ccx-anagram-rack-max), 100%);
  min-width: 0;
  margin: 8px auto 4px !important;
  flex: 0 0 auto;
  box-sizing: border-box;
}
body.ccx-on-scores #tab-scores .ccx-anagram-rack {
  margin-top: -19px !important;
}
#tab-scores .ccx-anagram-rack.ccx-anagram-rack-hidden,
body.ccx-on-scores #tab-scores .ccx-anagram-rack.ccx-anagram-rack-hidden {
  display: none !important;
}
#tab-scores .ccx-anagram-well,
body.ccx-on-scores #tab-scores .ccx-anagram-well {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  box-sizing: border-box;
  padding: 3px;
  background: #4a4a4a;
  border: 4px solid #d8d8d8;
  border-radius: 10px;
  box-shadow: inset 0 0 0 1px #fff;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  /* Native overlay bars clip on iPhone; custom track below is the visible scroller */
  scrollbar-width: none;
  -ms-overflow-style: none;
}
#tab-scores .ccx-anagram-well::-webkit-scrollbar,
body.ccx-on-scores #tab-scores .ccx-anagram-well::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}
#tab-scores .ccx-anagram-well.ccx-anagram-scrolling,
body.ccx-on-scores #tab-scores .ccx-anagram-well.ccx-anagram-scrolling {
  overflow-x: scroll;
}
#tab-scores .ccx-anagram-hscroll,
body.ccx-on-scores #tab-scores .ccx-anagram-hscroll {
  display: block;
  position: relative;
  height: 16px;
  margin: 6px 2px 1px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  overflow: hidden;
  touch-action: none;
  cursor: pointer;
  pointer-events: auto;
}
#tab-scores .ccx-anagram-hscroll[hidden],
body.ccx-on-scores #tab-scores .ccx-anagram-hscroll[hidden] {
  display: none !important;
}
#tab-scores .ccx-anagram-hscroll-thumb,
body.ccx-on-scores #tab-scores .ccx-anagram-hscroll-thumb {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  min-width: 28px;
  background: #e8d7a8;
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
  pointer-events: none;
}
#tab-scores .ccx-anagram-well.ccx-anag-solved,
body.ccx-on-scores #tab-scores .ccx-anagram-well.ccx-anag-solved {
  border-color: #77e056 !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  pointer-events: auto !important;
  touch-action: pan-x !important;
}
#tab-scores .ccx-anagram-well.ccx-anag-solved.ccx-anagram-scrolling,
body.ccx-on-scores #tab-scores .ccx-anagram-well.ccx-anag-solved.ccx-anagram-scrolling {
  overflow-x: scroll !important;
}
#tab-scores .ccx-anagram-well.ccx-anag-solved #kidsCellHouse2,
body.ccx-on-scores #tab-scores .ccx-anagram-well.ccx-anag-solved #kidsCellHouse2 {
  cursor: default !important;
  pointer-events: none !important;
}
#tab-scores .ccx-anagram-well.ccx-anag-solved #kidsCellHouse2 > div,
body.ccx-on-scores #tab-scores .ccx-anagram-well.ccx-anag-solved #kidsCellHouse2 > div {
  color: #77e056 !important;
  cursor: default !important;
  pointer-events: none !important;
  touch-action: pan-x !important;
}
#tab-scores .ccx-anagram-well.ccx-anag-solved #kidsCellHouse2,
#tab-scores #kidsCellHouse2.ccx-anag-locked,
body.ccx-on-scores #tab-scores .ccx-anagram-well.ccx-anag-solved #kidsCellHouse2 {
  cursor: default !important;
}
#tab-scores .ccx-anagram-well.ccx-anag-solved #kidsCellHouse2 > div,
#tab-scores #kidsCellHouse2.ccx-anag-locked > div,
body.ccx-on-scores #tab-scores .ccx-anagram-well.ccx-anag-solved #kidsCellHouse2 > div {
  color: #77e056 !important;
  cursor: default !important;
  pointer-events: none !important;
}
#tab-scores .ccx-anagram-rack #kidsCellHouse2,
#tab-scores .ccx-anagram-rack .ccx-anagram-tray,
body.ccx-on-scores #tab-scores .ccx-anagram-rack #kidsCellHouse2,
body.ccx-on-scores #tab-scores .ccx-anagram-rack .ccx-anagram-tray {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0 !important;
  width: var(--ccx-anagram-tray-width, max-content) !important;
  max-width: none !important;
  height: 44px !important;
  min-height: 44px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  overflow: visible !important;
  white-space: nowrap !important;
  position: relative !important;
  float: none !important;
  touch-action: none !important;
}
#kidsCellHouse2 > div.ccx-anag-dragging,
#tab-scores #kidsCellHouse2 > div.ccx-anag-dragging {
  position: fixed !important;
  z-index: 40000 !important;
  margin: 0 !important;
  right: auto !important;
  bottom: auto !important;
  transform: none !important;
  pointer-events: auto !important;
  touch-action: none !important;
}
body.ccx-anag-drag #tab-scores,
body.ccx-anag-drag .scores-stage {
  overflow: visible !important;
}
#tab-scores .ccx-anagram-rack #kidsCellHouse2 > div,
body.ccx-on-scores #tab-scores .ccx-anagram-rack #kidsCellHouse2 > div {
  flex: 0 0 44px !important;
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  min-height: 44px !important;
  max-width: 44px !important;
  max-height: 44px !important;
  box-sizing: border-box !important;
  float: none !important;
  line-height: 44px !important;
  touch-action: none !important;
}

/* Phone / DevTools portrait: pan the grid both ways; keep the tab bar in view */
@media (orientation: portrait) {
  #tab-board.tab,
  #tab-board.tab.tab-active,
  #tab-board.page-content {
    min-height: 0 !important;
    overflow: hidden !important;
  }
  #tab-board .board-stage,
  .board-stage {
    min-height: 0 !important;
    overflow: hidden !important;
  }
  #tab-board #puzzle,
  .board-stage #puzzle,
  #puzzle {
    overflow-x: scroll !important;
    overflow-y: scroll !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: none !important;
  }
  #tab-board #grid,
  .board-stage #grid,
  #grid,
  #grid > div {
    touch-action: none !important;
  }
}
@media (orientation: landscape) and (pointer: coarse),
       (orientation: landscape) and (max-height: 520px) {
  #tab-board.tab,
  #tab-board.tab.tab-active,
  #tab-board.page-content {
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
    height: 100% !important;
    overflow: hidden !important;
  }
  #tab-board .board-stage,
  .board-stage {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    overflow: hidden !important;
    justify-content: flex-start !important;
    padding-top: 4px !important;
    padding-bottom: 4px !important;
  }
  #tab-board #puzzle,
  .board-stage #puzzle,
  #puzzle {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: calc(100dvh - 50px - env(safe-area-inset-bottom, 0px) - 36px) !important;
    overflow-x: scroll !important;
    overflow-y: scroll !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: none !important;
  }
  #tab-board #grid,
  .board-stage #grid,
  #grid,
  #grid > div {
    touch-action: none !important;
  }
}

/* ===== Dark mode (html.ccx-dark) ===== */
html { color-scheme: light; }
html.ccx-dark { color-scheme: dark; }

html.ccx-dark,
html.ccx-dark body,
html.ccx-dark #ccxViewport,
html.ccx-dark #app,
html.ccx-dark #app .view,
html.ccx-dark #app .page,
html.ccx-dark #app .page-content {
  background: #1c1c1e !important;
  background-color: #1c1c1e !important;
  color: #f2f2f7;
}

html.ccx-dark #botToolbar.toolbar.tabbar.toolbar-bottom,
html.ccx-dark .toolbar.tabbar.toolbar-bottom {
  background: #1c1c1e !important;
  background-color: #1c1c1e !important;
  border-top-color: #0a84ff !important;
}
html.ccx-dark .toolbar.tabbar .tab-link,
html.ccx-dark .toolbar.tabbar .tab-link-active {
  color: #0a84ff !important;
}

html.ccx-dark #puzzle,
html.ccx-dark #tab-board #puzzle,
html.ccx-dark .board-stage #puzzle,
html.ccx-dark .board-stage,
html.ccx-dark #tab-board .board-stage {
  background: #1c1c1e !important;
  background-color: #1c1c1e !important;
}
html.ccx-dark #grid,
html.ccx-dark #grid.grid40,
html.ccx-dark #grid.grid35,
html.ccx-dark #grid.grid30 {
  border-color: #000 !important;
  background-color: #1c1c1e !important;
}
html.ccx-dark #tab-board #grid.grid40 > div,
html.ccx-dark #tab-board #grid > div,
html.ccx-dark .board-stage #grid.grid40 > div,
html.ccx-dark #grid > div {
  background-color: #2c2c2e;
  color: #f2f2f7;
  border-color: #48484a;
}
html.ccx-dark #tab-board #grid > div.hilite,
html.ccx-dark .board-stage #grid > div.hilite,
html.ccx-dark #grid > div.hilite {
  background-color: #f5d90a;
  color: #1c1c1e;
}
html.ccx-dark #tab-board #grid > div.blackout,
html.ccx-dark .board-stage #grid > div.blackout,
html.ccx-dark #grid > div.blackout {
  background-color: #36c3e0;
  color: #102026;
}
html.ccx-dark #tab-board #grid > div.blackout2,
html.ccx-dark #grid > div.blackout2 {
  background-color: #e23b3b;
  color: #fff;
}
#tab-board #grid.grid40 > div.ccx-correct,
#tab-board #grid > div.ccx-correct,
.board-stage #grid > div.ccx-correct,
#grid > div.ccx-correct {
  color: #34C759;
}
html.ccx-dark #tab-board #grid.grid40 > div.ccx-correct,
html.ccx-dark #tab-board #grid > div.ccx-correct,
html.ccx-dark .board-stage #grid > div.ccx-correct,
html.ccx-dark #grid > div.ccx-correct {
  color: #30D158;
}
#tab-board #grid.grid40 > div.ccx-opp-correct,
#tab-board #grid > div.ccx-opp-correct,
.board-stage #grid.grid40 > div.ccx-opp-correct,
#grid > div.ccx-opp-correct {
  background-color: #D5DCE6;
}
html.ccx-dark #tab-board #grid.grid40 > div.ccx-opp-correct,
html.ccx-dark #tab-board #grid > div.ccx-opp-correct,
html.ccx-dark .board-stage #grid.grid40 > div.ccx-opp-correct,
html.ccx-dark #grid > div.ccx-opp-correct {
  background-color: #3D4A5C;
  color: #30D158;
}
#tab-board #grid.grid40 > div.hilite,
#tab-board #grid > div.hilite,
.board-stage #grid.grid40 > div.hilite {
  background-color: yellow;
  color: #1a1a1a;
}
/* A blocked square is not a letter. Hilite must not turn it yellow. */
#tab-board #grid.grid40 > div.blackout.hilite,
#tab-board #grid > div.blackout.hilite,
.board-stage #grid.grid40 > div.blackout.hilite,
#grid > div.blackout.hilite {
  background-color: #36C3E0;
  color: #102026;
}
#tab-board #grid > div.blackout2.hilite,
#grid > div.blackout2.hilite {
  background-color: red;
  color: #fff;
}
html.ccx-dark #tab-board #grid.grid40 > div.hilite,
html.ccx-dark #tab-board #grid > div.hilite,
html.ccx-dark .board-stage #grid.grid40 > div.hilite {
  background-color: #f5d90a;
  color: #1c1c1e;
}
html.ccx-dark #tab-board #grid.grid40 > div.blackout.hilite,
html.ccx-dark #tab-board #grid > div.blackout.hilite,
html.ccx-dark .board-stage #grid.grid40 > div.blackout.hilite,
html.ccx-dark #grid > div.blackout.hilite {
  background-color: #36c3e0;
  color: #102026;
}
html.ccx-dark #tab-board #grid > div.blackout2.hilite,
html.ccx-dark #grid > div.blackout2.hilite {
  background-color: #e23b3b;
  color: #fff;
}
html.ccx-dark #grid .numSpot,
html.ccx-dark #grid .numSpot1,
html.ccx-dark #grid .numSpot2,
html.ccx-dark #grid > div > span {
  color: #c7c7cc !important;
}
html.ccx-dark #grid > div.hilite > span,
html.ccx-dark #grid > div.blackout > span,
html.ccx-dark #grid > div.hilite .numSpot,
html.ccx-dark #grid > div.blackout .numSpot,
html.ccx-dark #grid > div.hilite .numSpot1,
html.ccx-dark #grid > div.blackout .numSpot1,
html.ccx-dark #grid > div.hilite .numSpot2,
html.ccx-dark #grid > div.blackout .numSpot2 {
  color: #1c1c1e !important;
}

html.ccx-dark #puzzle::-webkit-scrollbar-thumb,
html.ccx-dark #tab-board #puzzle::-webkit-scrollbar-thumb {
  background: #636366;
}
html.ccx-dark #puzzle::-webkit-scrollbar-track,
html.ccx-dark #tab-board #puzzle::-webkit-scrollbar-track {
  background: #1c1c1e;
}

html.ccx-dark #clueHouse {
  background: #2c2c2e !important;
  color: #f2f2f7 !important;
  border-color: #48484a !important;
  border-top-color: #8e8e93 !important;
}
html.ccx-dark #tab-scores,
html.ccx-dark #tab-scores.tab,
html.ccx-dark #tab-scores .scores-board-peek {
  background: #1c1c1e !important;
  color: #f2f2f7;
}
/* Floating sheets stay see-through so the board remains visible. */
html.ccx-dark body.ccx-on-options #tab-options.tab.tab-active {
  background: transparent !important;
}
html.ccx-dark body.ccx-on-scores #tab-scores,
html.ccx-dark body.ccx-on-scores #tab-scores.tab,
html.ccx-dark body.ccx-on-scores #tab-scores.tab.tab-active {
  background: rgba(0, 0, 0, 0.42) !important;
}
html.ccx-dark body.ccx-on-scores #tab-scores .scores-stage {
  background: #2c2c2e !important;
  scrollbar-color: #f2f2f7 #1c1c1e;
}
html.ccx-dark body.ccx-on-scores #tab-scores .scores-stage::-webkit-scrollbar-track {
  background: #1c1c1e;
}
html.ccx-dark body.ccx-on-scores #tab-scores .scores-stage::-webkit-scrollbar-thumb {
  background: #f2f2f7;
  border-color: #1c1c1e;
}
html.ccx-dark body.ccx-on-scores #tab-scores .scores-stage::-webkit-scrollbar-thumb:active {
  background: #ffffff;
}
html.ccx-dark body.ccx-on-scores #tab-scores .scores-stage::-webkit-scrollbar-corner {
  background: #1c1c1e;
}
html.ccx-dark #tab-scores #myPanel,
html.ccx-dark #tab-scores #myPanel.ccx-side-panel {
  background: #2c2c2e !important;
  color: #f2f2f7;
}
html.ccx-dark #tab-scores #clueHousePanel,
html.ccx-dark #tab-scores .cluesPanel {
  background: #3a3a3c !important;
  color: #f2f2f7 !important;
  border-color: #48484a !important;
}

html.ccx-dark #ccxOptionsDialog,
html.ccx-dark .ccx-options-dialog {
  background: #2c2c2e;
  color: #f2f2f7;
}
html.ccx-dark .ccx-opt-row,
html.ccx-dark button.ccx-opt-action {
  color: #f2f2f7;
}
html.ccx-dark .ccx-opt-hint {
  color: #d1d1d6;
}
html.ccx-dark button.ccx-opt-action:disabled {
  color: #f2f2f7;
}
html.ccx-dark .ccx-opt-sep {
  border-top-color: #48484a;
}
html.ccx-dark .ccx-options-cancel-btn,
html.ccx-dark .ccx-playagain-stop {
  background: #3a3a3c;
  color: #f2f2f7;
}
html.ccx-dark .ccx-options-cancel-btn:hover,
html.ccx-dark .ccx-options-cancel-btn.ccx-hover,
html.ccx-dark .ccx-playagain-stop:hover {
  background: #48484a;
  color: #f2f2f7;
}
html.ccx-dark .ccx-share-btn {
  background: #c0c0c0;
  color: #000;
}
html.ccx-dark .ccx-share-btn:hover,
html.ccx-dark .ccx-share-btn.ccx-hover {
  background: #a8a8a8;
  color: #000;
}
html.ccx-dark .ccx-share-hint {
  color: #333;
}

html.ccx-dark #tab-chat.page-content {
  background: #000 !important;
}
html.ccx-dark body.ccx-on-chat #tab-chat,
html.ccx-dark body.ccx-on-chat #tab-chat.tab,
html.ccx-dark body.ccx-on-chat #tab-chat.tab-active,
html.ccx-dark body.ccx-on-chat #tab-chat.page-content {
  background: rgba(0, 0, 0, 0.42) !important;
}
html.ccx-dark #chatPanel.chat-panel.ccx-chat-in-tab,
html.ccx-dark #chatPanel.ccx-chat-in-tab .chat-action-buttons,
html.ccx-dark #chatPanel.ccx-chat-in-tab .chat-messages {
  background: #1c1c1e !important;
  border-color: #3a3a3c;
}
html.ccx-dark #chatPanel.ccx-chat-in-tab .chat-header,
html.ccx-dark body.ccx-on-chat #chatPanel .chat-header,
html.ccx-dark #chatPanel .chat-header-gradient,
html.ccx-dark #chatPanel.ccx-chat-in-tab .chat-input-area,
html.ccx-dark body.ccx-on-chat #chatPanel .chat-input-area {
  background: #2c2c2e !important;
}
html.ccx-dark #chatPanel .chat-message.regular.other,
html.ccx-dark body.ccx-on-chat #chatPanel .chat-message.regular.other {
  background-color: #3a3a3c !important;
  color: #f2f2f7 !important;
}
html.ccx-dark #chatPanel .chat-message.regular.other .chat-message-text,
html.ccx-dark body.ccx-on-chat #chatPanel .chat-message.regular.other .chat-message-text {
  color: #f2f2f7 !important;
}
html.ccx-dark #chatPanel .chat-message.system,
html.ccx-dark body.ccx-on-chat #chatPanel .chat-message.system,
html.ccx-dark #chatPanel .chat-message.system .chat-message-text,
html.ccx-dark body.ccx-on-chat #chatPanel .chat-message.system .chat-message-text,
html.ccx-dark #chatPanel .chat-message.system .chat-message-text::before,
html.ccx-dark body.ccx-on-chat #chatPanel .chat-message.system .chat-message-text::before {
  color: #f2f2f7 !important;
}

/* End-game / new-game card sits above chat so READY, PAUSE, QUIT, and Send cannot be clicked.
   The shield lives in #app because the popup is moved there; a body shield would cover it. */
body.ccx-endgame-modal #app::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 20000;
  background: transparent;
}
body.ccx-endgame-modal #tab-chat,
body.ccx-endgame-modal #chatPanel,
body.ccx-endgame-modal #chatPanel * {
  pointer-events: none !important;
}
body.ccx-endgame-modal #clueHouse,
body.ccx-endgame-modal #clueHouse1,
body.ccx-endgame-modal #clueHousePanel {
  display: none !important;
}
body.ccx-endgame-modal #tab-scores {
  visibility: hidden !important;
  pointer-events: none !important;
}
body.ccx-endgame-modal #popupDialog {
  z-index: 40000 !important;
  pointer-events: auto !important;
}
html.ccx-dark #chatPanel.ccx-chat-in-tab .chat-input,
html.ccx-dark body.ccx-on-chat #chatPanel .chat-input {
  background: #1c1c1e !important;
  color: #f2f2f7 !important;
  border-color: #48484a !important;
}
html.ccx-dark #chatPanel .chat-input::placeholder,
html.ccx-dark body.ccx-on-chat #chatPanel .chat-input::placeholder {
  color: #8e8e93;
}
html.ccx-dark #chatPanel .ccx-pause-dur-bar {
  background: #2c2c2e;
}
html.ccx-dark #chatPanel .ccx-pause-dur-ask {
  color: #f2f2f7;
}

html.ccx-dark #popupDialog.ccx-login-dialog,
html.ccx-dark #popupDialog.ccx-login-dialog .block,
html.ccx-dark #popupDialog.ccx-login-dialog #dlgContent,
html.ccx-dark #popupDialog.ccx-choice-dialog,
html.ccx-dark #popupDialog.ccx-choice-dialog .block,
html.ccx-dark #popupDialog.ccx-choice-dialog #dlgContent,
html.ccx-dark #popupDialog.ccx-qa-dialog,
html.ccx-dark #popupDialog.ccx-qa-dialog #dlgContent,
html.ccx-dark #popupDialog.ccx-playagain-dialog,
html.ccx-dark #popupDialog.ccx-playagain-dialog #dlgContent,
html.ccx-dark #popupDialog.ccx-winner-dialog,
html.ccx-dark #popupDialog.ccx-winner-dialog #dlgContent {
  background: #2c2c2e !important;
  color: #f2f2f7 !important;
}
html.ccx-dark #popupDialog.ccx-name-dialog a.ccx-name-own {
  color: #8ec5ff !important;
}
html.ccx-dark #popupDialog.ccx-playagain-dialog #dlgTitle {
  background: #1c1c1e !important;
}
html.ccx-dark #popupDialog.ccx-winner-dialog #dlgTitle {
  background: linear-gradient(180deg, #3a6a96 0%, #244f78 100%) !important;
  color: #f2f2f7 !important;
}
html.ccx-dark .ccx-winner-name {
  color: #30d158 !important;
}
html.ccx-dark .ccx-winner-copy {
  color: #8eb6e8 !important;
}
html.ccx-dark .ccx-winner-stop {
  background: #3a3a3c !important;
  color: #f2f2f7 !important;
}
html.ccx-dark .ccx-winner-stop:hover {
  background: #48484a !important;
  color: #f2f2f7 !important;
}
html.ccx-dark #user.ccx-name-input,
html.ccx-dark #dlgContent #user {
  color: #f2f2f7 !important;
  background: #1c1c1e !important;
  border-color: #5a7a98 !important;
}
html.ccx-dark #user.ccx-name-input::placeholder,
html.ccx-dark #dlgContent #user::placeholder,
html.ccx-dark #user.ccx-name-input::-webkit-input-placeholder,
html.ccx-dark #dlgContent #user::-webkit-input-placeholder {
  color: #8e8e93 !important;
}
html.ccx-dark .ccx-qa-tabs {
  background: #1c1c1e;
  border-color: #48484a;
}
html.ccx-dark .ccx-qa-tab {
  color: #f2f2f7;
}
html.ccx-dark .ccx-qa-list li,
html.ccx-dark .ccx-qa-note,
html.ccx-dark .ccx-qa-hint,
html.ccx-dark .ccx-playagain-ask {
  color: #f2f2f7 !important;
}
html.ccx-dark .ccx-playagain-copy {
  color: #8eb6e8 !important;
}
html.ccx-dark .ccx-qa-h {
  color: #8eb6e8;
}

/* SE landscape: ask for portrait. The web page cannot lock rotation. */
#ccxSePortrait {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(12, 18, 28, 0.72);
  box-sizing: border-box;
}
#ccxSePortrait[hidden] {
  display: none !important;
}
.ccx-se-portrait-card {
  width: min(300px, 100%);
  margin: 0;
  padding: 22px 20px 18px;
  border-radius: 14px;
  background: #fff;
  color: #1c1c1e;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  font: 16px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.ccx-se-portrait-card p {
  margin: 0;
}
.ccx-se-portrait-title {
  margin-bottom: 8px !important;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.02em;
}
html.ccx-dark #ccxSePortrait {
  background: rgba(0, 0, 0, 0.62);
}
html.ccx-dark .ccx-se-portrait-card {
  background: #1c1c1e;
  color: #f2f2f7;
}
.ccx-safety-row {
  display: flex;
  gap: 8px;
  padding: 0 10px 8px;
  background-color: silver;
}
.ccx-safety-row[hidden] {
  display: none !important;
}
.ccx-safety-btn {
  flex: 1;
  min-height: 36px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  font-family: 'Segoe UI', Arial, sans-serif;
  cursor: pointer;
}
#ccxReportBtn {
  background: #fff;
  color: #111;
  border: 1px solid #666;
}
#ccxBlockBtn {
  background: #2c2c2e;
  color: #fff;
  border: none;
}
