/* Local spacing review. Load after compact.css; keep artwork, palette and controls. */

/* Main screens: remove stacked section margins, keeping navigation/safe-area padding. */
.ivory-v2 .topbar { margin-bottom: 16px; }
.ivory-v2 #homeView .home-intro h1 { margin-bottom: 6px; }
.ivory-v2 #homeView .home-intro p { margin-bottom: 12px; }
.ivory-v2 #homeView .hero { margin-bottom: 12px; }
.ivory-v2 #homeView .quick-categories { margin-bottom: 10px; }
.ivory-v2 #homeView .home-links { margin-bottom: 14px; }
.ivory-v2 #homeView .section-head { margin: 18px 0 10px; }
.ivory-v2 #homeView .popular-heading { margin-top: 0; }
.ivory-v2 #homeView .popular-card > span { padding: 12px; gap: 4px; }
.ivory-v2 #homeView .active-wrap { margin-top: 14px; }
.ivory-v2 #homeView .catalog-content > .section-head { margin-top: 0; }
.ivory-v2 #homeView .catalog .card-wrap > .card {
  min-height: 118px;
  padding: 12px 60px 12px 12px;
}
.ivory-v2 #roomsView .page-v2-head { padding-block: 4px 10px; }
/* The artwork includes the game title: keep the whole banner, including on hover. */
.ivory-v2 #homeView .catalog .card-wrap .card-cover {
  height: auto;
  aspect-ratio: 3 / 2;
  background-size: contain;
  background-repeat: no-repeat;
}
.ivory-v2 #roomsView .page-room-tabs { margin: 4px 0 12px; }
.ivory-v2 #roomsView .premium-room { gap: 12px; }
.ivory-v2 #profileView .page-v2-head { margin: 6px 0 12px; }
.ivory-v2 #profileView .profile-compact .compact-identity { margin-bottom: 12px; }
.ivory-v2 #profileView .profile-compact .compact-stats,
.ivory-v2 #profileView .profile-compact .profile-records,
.ivory-v2 #profileView .profile-compact .profile-recent { margin-bottom: 12px; }

/* Sheets: compact text rhythm; preserve the existing bottom safe-area reserve. */
.ivory-v2 #gameSheet .sheet-body { padding-top: 16px; }
.ivory-v2 #gameSheet #sheetText { margin-block: 8px 12px; }
.ivory-v2 #gameSheet .chips { margin-block: 10px; }
.ivory-v2 #gameSheet .rules-block { margin-block: 14px; padding-top: 4px; }
.ivory-v2 #gameSheet .rules-block h3 { margin: 12px 0 6px; }
.ivory-v2 #gameSheet .rules-block ol,
.ivory-v2 #gameSheet .rules-block p { margin-block: 6px 10px; }
.ivory-v2 #gameSheet[data-creating=true] #sheetTitle { margin-bottom: 12px; }
.ivory-v2 #gameSheet .room-create .form-intro { margin-bottom: 12px; }
.ivory-v2 #gameSheet .room-create fieldset,
.ivory-v2 #gameSheet .room-create .seat-field { margin-block: 14px; }

/* Inline games: reduce surrounding chrome, never the playing field or hit areas. */
.ivory-v2 #gameView .game-head { padding-block: 10px; margin-bottom: 12px; }
.ivory-v2 #gameBody:is([data-game="battleship"], [data-game="solo2048"]) > .game-panel {
  padding: 14px;
}
.ivory-v2 #gameBody[data-game="solo2048"] .stat { padding-block: 8px; }
.ivory-v2 #gameBody[data-game="solo2048"] .stat b { margin-top: 2px; }
.ivory-v2 #gameBody[data-game="solo2048"] .game-hint { margin-block: 0 12px; }
.ivory-v2 #gameBody[data-game="solo2048"] .game-actions { margin-top: 10px; gap: 8px; }
.ivory-v2 #gameBody[data-game="battleship"] .battle-status { padding: 10px 12px; }
.ivory-v2 #gameBody[data-game="battleship"] .fleet-console-head { margin-bottom: 8px; }
.ivory-v2 #gameBody[data-game="battleship"] .ship-console-selected { margin-block: 8px; }
.ivory-v2 #gameBody[data-game="battleship"] .fleet-summaries { margin-block: 8px; }

.ivory-v2 #gameBody[data-game="sherlock"] > .game-panel { padding: 12px; }
.ivory-v2 #gameBody[data-game="sherlock"] > .game-panel > p { margin-block: 8px; }
.ivory-v2 #gameBody[data-game="sherlock"] .sher-team h3 { margin-bottom: 8px; }
.ivory-v2 #gameBody[data-game="sherlock"] .game-actions { margin-top: 10px; gap: 8px; }
.ivory-v2 #gameBody[data-game="sherlock"] .solve-field { gap: 6px; }

.ivory-v2 #gameBody .poker-waiting { padding: 16px; }
.ivory-v2 #gameBody .poker-lobby-table { margin-block: 12px; padding-block: 18px; }
.ivory-v2 #gameBody .poker-status { padding: 12px; gap: 10px; }
.ivory-v2 #gameBody .poker-status strong { margin: 2px 0 6px; }
.ivory-v2 #gameBody .poker-status > .poker-status-actions { padding-top: 8px; }
.ivory-v2 #gameBody .poker-action-wrap { padding: 12px; margin-top: 10px; }
.ivory-v2 #gameBody .poker-action-title { margin-bottom: 10px; }
.ivory-v2 #gameBody .poker-footnote { margin-top: 10px; }

@media (min-width: 760px) {
  .ivory-v2 #gameBody .poker-status > .poker-status-actions { padding-top: 0; }
}

/* Shared command rhythm. Deliberately excludes boards, tile controls and avatars. */
.ivory-v2 #gameSheet .sheet-actions > button,
.ivory-v2 #gameSheet .room-create button,
.ivory-v2 #gameBody .game-btn {
  box-sizing: border-box;
  min-width: 0;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  white-space: normal;
}
.ivory-v2 #gameSheet .sheet-actions > .primary,
.ivory-v2 #gameSheet .room-create button.primary,
.ivory-v2 #gameBody #solveCase,
.ivory-v2 #gameBody #readyFleet,
.ivory-v2 #gameBody #startHand {
  min-height: 48px;
}
.ivory-v2 #gameSheet .room-create fieldset > legend {
  margin-bottom: 8px;
}
.ivory-v2 #gameBody .game-actions {
  gap: 8px;
  align-items: stretch;
}
.ivory-v2 #gameBody .game-actions > .game-btn {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Investigation: equal clue commands and readable form rows. */
.ivory-v2 #gameBody[data-game="sherlock"] .suspects {
  min-width: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.ivory-v2 #gameBody[data-game="sherlock"] .suspect {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}
.ivory-v2 #gameBody[data-game="sherlock"] .game-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.ivory-v2 #gameBody[data-game="sherlock"] .game-panel > h3 {
  margin-block: 0 10px;
  font-size: 18px;
  line-height: 1.3;
}
.ivory-v2 #gameBody[data-game="sherlock"] .game-panel > p {
  line-height: 1.5;
}
.ivory-v2 #gameBody[data-game="sherlock"] .solve-grid {
  gap: 10px;
  margin-bottom: 12px;
}
.ivory-v2 #gameBody[data-game="sherlock"] .solve-field,
.ivory-v2 #gameBody[data-game="sherlock"] .solve-field select {
  min-width: 0;
}
.ivory-v2 #gameBody[data-game="sherlock"] .solve-field select {
  min-height: 44px;
  width: 100%;
}

/* Fleet console keeps its horizontal inset and all board geometry intact. */
.ivory-v2 #gameBody[data-game="battleship"] .fleet-console {
  padding-block: 14px;
}
.ivory-v2 #gameBody[data-game="battleship"] .fleet-simple-tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-block: 12px 8px;
}
.ivory-v2 #gameBody[data-game="battleship"] #readyFleet {
  margin-top: 0;
}

/* Poker actions remain equally sized; their existing colours retain meaning. */
.ivory-v2 #gameBody .poker-controls {
  gap: 8px;
  align-items: stretch;
}
.ivory-v2 #gameBody .poker-controls > .game-btn {
  min-height: 48px;
  padding: 10px 8px;
}
.ivory-v2 #gameBody .quick-bets {
  gap: 8px;
}
.ivory-v2 #gameBody .quick-bet {
  min-height: 44px;
  border-radius: 12px;
}
/* Native disclosure keeps keyboard behaviour; one drawn arrow reflects open state. */
.ivory-v2 #gameBody .sea-history-details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  list-style: none;
  text-align: left;
}
.ivory-v2 #gameBody .sea-history-details > summary::marker {
  content: '';
}
.ivory-v2 #gameBody .sea-history-details > summary::-webkit-details-marker {
  display: none;
}
.ivory-v2 #gameBody .sea-history-details > summary::after {
  content: '';
  flex: 0 0 7px;
  width: 7px;
  height: 7px;
  margin-right: 3px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
}
.ivory-v2 #gameBody .sea-history-details[open] > summary::after {
  transform: rotate(225deg);
}
@media (max-width: 480px) {
  .ivory-v2 #gameBody .poker-table {
    padding: 12px;
    gap: 12px;
  }
  .ivory-v2 #gameBody .poker-table .poker-seat small {
    margin-left: 0;
    margin-top: 6px;
  }
  .ivory-v2 #gameBody .poker-table .poker-seat .seat-badges {
    margin-left: 0;
  }
  .ivory-v2 #gameBody .poker-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ivory-v2 #gameBody[data-game="sherlock"] .solve-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 350px) {
  .ivory-v2 #gameBody[data-game="sherlock"] .suspects {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 360px) {
  .ivory-v2 #gameBody[data-game="battleship"] .fleet-simple-tools {
    grid-template-columns: minmax(0, 1fr);
  }
  .ivory-v2 #gameBody[data-game="battleship"] .fleet-simple-tools > .game-btn {
    overflow-wrap: normal;
    word-break: normal;
  }
}

/* Owner review: one quiet command system across the main application. */
.ivory-v2 {
  --command-primary: #3e3329;
  --command-paper: #fffdf9;
  --command-secondary: #f0e8dc;
  --command-ink: #514234;
  --command-selected: #e5d7c3;
  --command-selected-line: #b59a75;
  --command-focus: #92734e;
}
.ivory-v2 :is(.primary,.secondary,.sheet-action,.tiny-btn,.room-secondary),
.ivory-v2 #gameBody .game-btn,
.ivory-v2 #gameBody .quick-bet {
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--command-secondary);
  color: var(--command-ink);
  box-shadow: none;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  text-shadow: none;
}
.ivory-v2 :is(.primary,.sheet-action.main),
.ivory-v2 #gameBody .game-btn.primaryish {
  min-height: 48px;
  background: var(--command-primary);
  border-color: var(--command-primary);
  color: var(--command-paper);
  box-shadow: none;
}
/* Legacy theme marks primary surfaces important; override only those properties. */
.ivory-v2 #homeView .primary,
.ivory-v2 .sheet :is(.primary,.sheet-action.main),
.ivory-v2 #codeSheet #submitCode,
.ivory-v2 #gameBody .poker-controls .game-btn.primaryish,
.ivory-v2 #gameBody[data-game="sherlock"] #solveCase {
  background: var(--command-primary) !important;
  border-color: var(--command-primary) !important;
  color: var(--command-paper) !important;
  box-shadow: none !important;
  text-shadow: none;
}
.ivory-v2 #homeView .primary:hover,
.ivory-v2 .sheet :is(.primary,.sheet-action.main):hover,
.ivory-v2 #codeSheet #submitCode:hover,
.ivory-v2 #gameBody .poker-controls .game-btn.primaryish:hover,
.ivory-v2 #gameBody[data-game="sherlock"] #solveCase:hover {
  background: var(--command-primary) !important;
  box-shadow: none !important;
}
.ivory-v2 #gameBody .game-btn.danger,
.ivory-v2 .room-secondary.dangerish {
  background: #f2e6df;
  color: #874c3e;
}
.ivory-v2 :is(.primary,.secondary,.sheet-action,.tiny-btn,.room-secondary):hover,
.ivory-v2 #gameBody .game-btn:hover {
  box-shadow: none;
  filter: brightness(.97);
}
.ivory-v2 :is(button,a,input,textarea,select):focus-visible {
  outline: 2px solid var(--command-focus);
  outline-offset: 3px;
}
.ivory-v2 :is(.primary,.secondary,.sheet-action,.tiny-btn,.room-secondary):active,
.ivory-v2 #gameBody .game-btn:active {
  box-shadow: none;
}
.ivory-v2 button:disabled {
  opacity: .45;
}
.ivory-v2 #gameBody .poker-controls > .game-btn {
  min-height: 48px;
  padding-inline: 8px;
}
.ivory-v2 #gameSheet .seat-stepper > button,
.ivory-v2 #gamesSheet .room-tab,
.ivory-v2 .page-room-tabs button,
.ivory-v2 .battle-tabs .battle-tab {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--command-secondary);
  box-shadow: none;
  color: var(--command-ink);
}
.ivory-v2 #gamesSheet .room-tab.active,
.ivory-v2 .page-room-tabs button.active,
.ivory-v2 .battle-tabs .battle-tab.active {
  background: var(--command-selected);
  border-color: var(--command-selected-line);
  color: #392f26;
  box-shadow: none;
}

/* Two equal entry actions; neither competes with the main play button. */
.ivory-v2 #homeView .home-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-items: stretch;
}
.ivory-v2 #homeView .home-links > button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 10px;
  margin: 0;
  white-space: normal;
  overflow-wrap: normal;
  font-size: 13px;
  background: var(--command-secondary);
  border: 1px solid transparent;
  border-radius: 12px;
  box-shadow: none;
  color: var(--command-ink);
}

/* Short code entry: one focus outline, one primary action, a quiet cancellation. */
.ivory-v2 #codeSheet .sheet-body { padding: 12px 20px 8px; }
.ivory-v2 #codeSheet h2 { margin: 0 0 6px; font-size: 23px; }
.ivory-v2 #codeSheet p { margin: 0 0 16px; font-size: 13px; }
.ivory-v2 #codeSheet .code-input {
  min-height: 52px;
  padding: 12px;
  margin-bottom: 10px;
  border: 1px solid #d5c8b7;
  border-radius: 12px;
  background: var(--command-paper);
  box-shadow: none;
  font-weight: 600;
  letter-spacing: .12em;
  color: #392f26;
}
.ivory-v2 #codeSheet .code-input:focus {
  border-color: var(--command-focus);
  outline: 2px solid var(--command-focus);
  outline-offset: 0;
  box-shadow: none;
}
.ivory-v2 #codeSheet #submitCode { margin-top: 0; }
.ivory-v2 #codeSheet #cancelCode {
  min-height: 44px;
  margin-top: 6px;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: #796f64;
}

/* Navigation uses the existing four branded icons and a clear current-page surface. */
.ivory-v2 .topbar .brand-art {
  position: relative;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  overflow: visible;
  border: 0;
  border-radius: 12px;
  background: transparent;
  box-shadow: none;
}
.ivory-v2 .topbar .brand-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.ivory-v2 .topbar #profileBtn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: auto;
  min-width: 44px;
  height: auto;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--command-secondary);
  color: var(--command-ink);
  box-shadow: none;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}
.ivory-v2 .topbar #profileBtn:hover,
.ivory-v2 .topbar #profileBtn:active {
  background: var(--command-secondary);
  border-color: transparent;
  box-shadow: none;
}
.ivory-v2 #bottomNav {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 6px 8px calc(6px + var(--safe-bottom));
  background: #fbf8f3;
  border-top: 1px solid #e7ded2;
  box-shadow: none;
}
.ivory-v2 #bottomNav .bottom-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  min-height: 56px;
  padding: 6px 2px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #796f64;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  box-shadow: none;
}
.ivory-v2 #bottomNav .bottom-nav-btn.active {
  background: #ebe0d0;
  color: #3e3329;
}
.ivory-v2 #bottomNav .nav-mark {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
}
.ivory-v2 #bottomNav .nav-mark svg {
  width: 24px;
  height: 24px;
  margin: 0;
  filter: none;
}

/* The same history action now has artwork, a result and its own date line. */
.ivory-v2 .profile-compact .profile-recent > .recent-game-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 12px;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  min-height: 82px;
  border: 0;
  border-bottom: 1px solid #e7ded2;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
}
.ivory-v2 .profile-compact .recent-game-cover {
  display: block;
  width: 64px;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: contain;
  border-radius: 8px;
}
.ivory-v2 .profile-compact .recent-game-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.ivory-v2 .profile-compact .recent-game-copy b {
  font-size: 14px;
  line-height: 1.3;
}
.ivory-v2 .profile-compact .recent-game-result {
  font-size: 13px;
  line-height: 1.4;
  color: #514234;
  overflow-wrap: anywhere;
}
.ivory-v2 .profile-compact .recent-game-date {
  margin: 0;
  font-size: 11px;
  line-height: 1.3;
  color: #82766a;
}

/* Owner's supplied PARTYBOX portrait: circular avatar in the header. */
.ivory-v2 .topbar .brand-mark {
  border-radius: 50%;
  overflow: hidden;
  border: 0;
  box-shadow: none;
  background: transparent;
}
.ivory-v2 .topbar .brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: contain;
}
/* Owner review: shared dismissal, game entry commands and readable quick choices. */
.ivory-v2 :is(.sheet,#chatDrawer) .sheet-close {
  position: relative;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: #fffdf9;
  color: #514234;
  box-shadow: none;
}
.ivory-v2 #gameSheet #closeSheet {
  position: sticky;
  top: 16px;
  background: #fffdf9;
  border: 0;
  box-shadow: none;
}
.ivory-v2 :is(.sheet,#chatDrawer) .sheet-close::before,
.ivory-v2 :is(.sheet,#chatDrawer) .sheet-close::after {
  content: '';
  position: absolute;
  left: 12px;
  top: 21px;
  width: 20px;
  height: 2px;
  border: 0;
  border-radius: 2px;
  background: currentColor;
  transform: rotate(45deg);
}
.ivory-v2 :is(.sheet,#chatDrawer) .sheet-close::after { transform: rotate(-45deg); }
.ivory-v2 :is(.sheet,#chatDrawer) .sheet-close:hover { background: #f0e8dc; box-shadow: none; }
.ivory-v2 #gameSheet #sheetActions { gap: 8px; }
.ivory-v2 #gameSheet #sheetActions .sheet-action {
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid transparent !important;
  border-radius: 12px;
  background: #f0e8dc !important;
  color: #514234 !important;
  box-shadow: none !important;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
}
.ivory-v2 #gameSheet #sheetActions .sheet-action.main {
  background: #3e3329 !important;
  border-color: #3e3329 !important;
  color: #fffdf9 !important;
}
.ivory-v2 #homeView .quick-categories {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.ivory-v2 #homeView .quick-categories > button {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
  min-height: 52px;
  padding: 10px;
  gap: 8px;
  border: 0;
  border-radius: 12px;
  background: #eee5d8;
  box-shadow: none;
}
.ivory-v2 #homeView .quick-categories > button > span {
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  border-radius: 0;
  background: transparent;
}
.ivory-v2 #homeView .quick-categories > button > span svg {
  width: 26px;
  height: 26px;
  margin: 0;
}
.ivory-v2 #homeView .quick-categories > button small {
  display: block;
  min-width: 0;
  min-height: 0;
  max-width: none;
  width: auto;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  color: #514234;
  white-space: normal;
  overflow-wrap: normal;
  text-wrap: pretty;
}

/* Mobile table keeps the cards readable and brings the turn controls closer. */
@media (max-width: 480px) {
  .ivory-v2 #gameBody .poker-status { padding: 12px; gap: 8px; }
  .ivory-v2 #gameBody .poker-status strong { margin-bottom: 4px; }
  .ivory-v2 #gameBody .poker-status-actions { padding-top: 8px; }
  .ivory-v2 #gameBody .poker-table { padding: 10px; gap: 8px; }
  .ivory-v2 #gameBody .poker-table .poker-seat { padding: 8px; }
  .ivory-v2 #gameBody .poker-table .poker-players { padding-bottom: 6px; }
  .ivory-v2 #gameBody .poker-center {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
  }
  .ivory-v2 #gameBody .poker-center .poker-hand-label { margin: 0; text-align: left; }
  .ivory-v2 #gameBody .poker-center .pot-badge { grid-column: 2; grid-row: 1; margin: 0; padding: 5px 8px; }
  .ivory-v2 #gameBody .poker-center .board-cards { grid-column: 1 / -1; grid-row: 2; }
  .ivory-v2 #gameBody .poker-table .my-hand { gap: 4px; }
  .ivory-v2 #gameBody .poker-table .my-combo { margin-top: 0; }
  .ivory-v2 #gameBody .poker-action-wrap { padding: 12px; margin-top: 8px; }
  .ivory-v2 #gameBody .poker-action-title { margin-bottom: 8px; }
}
/* Direction and history commands share the flat system; tile styling is unchanged. */
.ivory-v2 #gameBody[data-game="solo2048"] :is(.control-key, #undo2048) {
  border-radius: 12px;
  background: var(--command-secondary) !important;
  border-color: transparent;
  color: var(--command-ink);
  box-shadow: none !important;
}
.ivory-v2 #gameBody[data-game="solo2048"] #new2048 {
  border-radius: 12px;
  background: #426f68 !important;
  border-color: #426f68 !important;
  box-shadow: none !important;
  text-shadow: none;
}

/* Active-game shortcuts use the same hierarchy as the main entry actions. */
.ivory-v2 #homeView .active-controls .primary-btn {
  min-height: 48px;
  border: 1px solid var(--command-primary) !important;
  border-radius: 12px;
  background: var(--command-primary) !important;
  color: var(--command-paper) !important;
  box-shadow: none !important;
  font-weight: 600;
}
.ivory-v2 #homeView :is(.active-code, .manage-games-btn, .active-all) {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--command-secondary);
  color: var(--command-ink);
  padding: 10px 12px;
  box-shadow: none;
  font-weight: 600;
}
.ivory-v2 #homeView .active-controls .primary-btn:hover { background: var(--command-primary) !important; }
.ivory-v2 #homeView .popular-card .card-cover {
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

/* Entry actions precede the complete rules for every game. */
.ivory-v2 #gameSheet #sheetActions { margin: 12px 0 0; }
.ivory-v2 #gameSheet #sheetActions + .rules-block {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e7ded2;
}

/* Keep investigation and fleet information complete, with less nested chrome. */
@media (max-width: 480px) {
  .ivory-v2 #gameBody[data-game="sherlock"] {
    border-width: 6px;
    padding: 6px;
    border-radius: 20px;
  }
  .ivory-v2 #gameBody[data-game="sherlock"] > .game-panel {
    padding: 10px;
    margin-bottom: 8px;
    box-shadow: none;
  }
  .ivory-v2 #gameBody[data-game="sherlock"] > .game-panel h3 {
    font-size: 18px;
    margin-block: 0 8px;
  }
  .ivory-v2 #gameBody[data-game="sherlock"] .clue { padding: 8px 10px; }
  .ivory-v2 #gameBody[data-game="sherlock"] .solve-field { gap: 4px; }
  .ivory-v2 #gameBody[data-game="sherlock"] .solve-grid { gap: 8px; }
  .ivory-v2 #gameBody[data-game="battleship"]:not([data-battle-phase="PLACEMENT"]) { padding-block: 6px; }
  .ivory-v2 #gameBody[data-game="battleship"]:not([data-battle-phase="PLACEMENT"]) .sea-turns { margin-block: 6px; }
  .ivory-v2 #gameBody[data-game="battleship"] .battle-flags { margin-top: 8px; gap: 6px; }
  .ivory-v2 #gameBody[data-game="battleship"] .battle-flag { padding: 6px 8px; }
  .ivory-v2 #gameBody[data-game="battleship"] .fleet-summary { padding-block: 6px; }
  .ivory-v2 #gameBody[data-game="battleship"] .fleet-summary > b { margin-bottom: 5px; }
  .ivory-v2 #gameBody[data-game="battleship"] .fleet-summary > div { gap: 3px; }
  .ivory-v2 #gameBody[data-game="battleship"] .battle-status-main .poker-status-actions { border: 0; padding: 0; }
}
@media (min-width: 361px) and (max-width: 480px) {
  .ivory-v2 #gameBody[data-game="sherlock"] .solve-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.ivory-v2 #gameBody[data-game="sherlock"] .game-btn:not(.primaryish) {
  background: var(--command-secondary);
  color: var(--command-ink);
  border-color: transparent;
  box-shadow: none;
  border-radius: 12px;
}
.ivory-v2 #gameBody[data-game="battleship"] #battleHelp {
  width: auto;
  min-width: 44px;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 12px;
  border-color: transparent;
  background: var(--command-secondary);
  color: var(--command-ink);
  box-shadow: none;
  font-size: 12px;
  font-weight: 600;
}

.ivory-v2 #gameBody[data-game="battleship"] #battleHelp {
  white-space: nowrap;
  flex-shrink: 0;
  min-width: max-content;
}
.ivory-v2 #gameBody[data-game="battleship"] .battle-status-main > .poker-status-actions { flex-shrink: 0; }
.ivory-v2 #gameBody[data-game="sherlock"] .sher-room-details {
  margin: 12px 0 0;
  border: 1px solid var(--line, #ddccb4);
  border-radius: 14px;
  background: var(--paper, #fffaf2);
  overflow: hidden;
}
.ivory-v2 #gameBody[data-game="sherlock"] .sher-room-details > summary {
  padding: 14px 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}
.ivory-v2 #gameBody[data-game="sherlock"] .sher-room-details .sher-team {
  margin: 0;
  border: 0;
  box-shadow: none;
}
.ivory-v2 #gameBody[data-game="sherlock"] .sher-room-code { padding: 12px 16px; }

/* Secondary information remains available without pushing the next move away. */
.ivory-v2 #gameBody .game-secondary-details {
  margin: 12px 0;
  border: 1px solid var(--line, #ddccb4);
  border-radius: 14px;
  background: var(--paper, #fffaf2);
  overflow: hidden;
}
.ivory-v2 #gameBody .game-secondary-details > summary {
  min-height: 44px;
  padding: 13px 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}
.ivory-v2 #gameBody .game-secondary-details > summary:focus-visible {
  outline: 2px solid var(--gold, #a87940);
  outline-offset: -4px;
}
.ivory-v2 #gameBody .game-secondary-details > :not(summary) { margin: 0 16px 16px; }
.ivory-v2 #gameBody .game-secondary-details .fleet-summaries { border: 0; padding: 0; }
.ivory-v2 #gameBody .poker-wait-note { margin: 0; color: var(--muted, #776654); }

.ivory-v2 #gameSheet details.rules-block > summary {
  cursor: pointer;
  min-height: 44px;
  padding: 12px 0;
  font-size: 14px;
  font-weight: 600;
}
.ivory-v2 #gameSheet details.rules-block > summary:focus-visible {
  outline: 2px solid var(--gold, #a87940);
  outline-offset: 2px;
  border-radius: 6px;
}
.ivory-v2 #gameSheet details.rules-block .rules-content { padding-bottom: 4px; }

/* Keep investigation context readable without making names look clickable. */
.ivory-v2 #gameBody[data-game="sherlock"] .suspects {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--soft);
}
.ivory-v2 #gameBody[data-game="sherlock"] .suspect {
  display: inline;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font: inherit;
  color: inherit;
}
.ivory-v2 #gameBody[data-game="sherlock"] .suspect:not(:last-child)::after { content: " · "; }
.ivory-v2 #gameBody[data-game="sherlock"] .suspects-label { font-weight: 600; }
.ivory-v2 #gameBody[data-game="sherlock"] .game-hint {
  max-width: none;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  text-align: left;
  font-size: 12px;
}
.ivory-v2 #gameBody .bet-sheet > label {
  display: block;
  margin-bottom: 7px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

/* Completed poker table: reuse the felt, cards and player profiles. */
.ivory-v2 #gameBody .poker-final .poker-table {
  display: block;
  min-height: 0;
  padding: 18px 12px;
}
.ivory-v2 #gameBody .poker-final .poker-center {
  position: static;
  transform: none;
  width: 100%;
  display: grid;
  justify-items: center;
  gap: 12px;
}
.ivory-v2 #gameBody .poker-final-player {
  display: grid;
  width: 100%;
  grid-template-columns: auto minmax(0, 1fr) auto;
}
.ivory-v2 #gameBody .poker-final-player b {
  min-width: 0;
  overflow-wrap: anywhere;
}
.ivory-v2 #gameBody .poker-final-player small {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
