/* Geometry for the optional cabinet. Materials live in adventure.css.
   All moves are real DOM moves in adventure-layout.js, not CSS order changes. */
html body[data-theme="adventure"][data-theme] #gameApp.app-container {
  max-width: 1240px;
  padding: 12px 24px 32px;
  gap: 10px;
}
html body[data-theme="adventure"][data-theme] #gameApp .masthead { gap: 12px; }
html body[data-theme="adventure"][data-theme] #gameApp .game-help-nav { gap: 8px; }
html body[data-theme="adventure"][data-theme] #gameApp .theme-selector { gap: 6px; }
html body[data-theme="adventure"][data-theme] #gameApp .theme-label { font-size: .8rem; margin-right: 0; text-shadow: none; }
html body[data-theme="adventure"][data-theme] #gameApp .theme-selector button[data-theme-choice] { font-size: .86rem; }
html body[data-theme="adventure"][data-theme] #gameApp .brand {
  padding: 4px 22px 6px;
  flex-shrink: 0;
}
html body[data-theme="adventure"][data-theme] #gameApp .brand h1 { font-size: 1.85rem; }
html body[data-theme="adventure"][data-theme] #gameApp .brand-kicker,
html body[data-theme="adventure"][data-theme] #gameApp .brand-subtitle { font-size: .6rem; }
html body[data-theme="adventure"][data-theme] #gameApp .header {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(180px, 1fr);
  align-items: center;
  padding: 4px 8px;
  border-width: 2px;
  gap: 12px;
  min-width: 0;
}
html body[data-theme="adventure"][data-theme] #gameApp .wallet {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 12px;
}
html body[data-theme="adventure"][data-theme] #gameApp .wallet .balance-pill {
  grid-column: auto;
  justify-content: center;
  min-height: 44px;
  padding: 2px 8px;
  gap: 4px 6px;
  min-width: 0;
}
html body[data-theme="adventure"][data-theme] #gameApp :is(#balance, #brickBalance) {
  max-width: 100%;
  overflow-wrap: anywhere;
  white-space: normal;
}
html body[data-theme="adventure"][data-theme] #gameApp .wallet :is(.icon-coin, .icon-brick) {
  position: static;
  transform: none;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
}
html body[data-theme="adventure"][data-theme] #gameApp .level-pill { padding: 3px 8px; min-height: 44px; height: auto; }
html body[data-theme="adventure"][data-theme] #gameApp .level-details { font-size: .72rem; }
html body[data-theme="adventure"][data-theme] #gameApp .level-details strong { font-size: .95rem; }
html body[data-theme="adventure"][data-theme] #gameApp .main-content {
  display: grid;
  grid-template-columns: 112px minmax(536px, 596px) minmax(312px, 340px);
  grid-template-rows: max-content 1fr auto;
  gap: 22px 20px;
  align-items: start;
  justify-content: center;
}
html body[data-theme="adventure"][data-theme] #gameApp .adventure-rewards {
  --reward-button-height: 120px;
  grid-column: 1;
  grid-row: 1 / 3;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  padding-top: 6px;
}
html body[data-theme="adventure"][data-theme] #gameApp .adventure-rewards[hidden] { display: none; }
html body[data-theme="adventure"][data-theme] #gameApp .adventure-rewards .bonus-group {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  gap: 14px;
}
/* The reward column/grid cell owns width, never the ready/countdown label. */
html body[data-theme="adventure"][data-theme] #gameApp .adventure-rewards .bonus-wrapper {
  width: 100%;
  max-width: 100%;
}
html body[data-theme="adventure"][data-theme] #gameApp .adventure-rewards .daily-systems-launchers {
  grid-column: auto;
  width: 100%;
  overflow: visible;
  min-width: 0;
}
html body[data-theme="adventure"][data-theme] #gameApp .adventure-rewards #dailyMissionsOpen { box-sizing: border-box; min-width: 0; }
html body[data-theme="adventure"][data-theme] #gameApp .adventure-rewards :is(.btn-get-coins, .btn-bonus, #mapButton, #dailyMissionsOpen) {
  display: flex;
  flex-direction: column;
  width: 100%;
  justify-content: center;
  align-items: center;
  gap: 2px;
  padding: 5px 4px 7px;
   min-height: var(--reward-button-height);
   height: var(--reward-button-height);
  white-space: normal;
  overflow-wrap: anywhere;
  font-size: .88rem;
  grid-column: auto;
}
html body[data-theme="adventure"][data-theme] #gameApp .adventure-rewards :is(.get-coins-art, .icon-chest, .map-button-art, .dc-launcher-icon) {
  width: 76px;
  height: 76px;
  flex: none;
}
html body[data-theme="adventure"][data-theme] #gameApp .adventure-rewards .bonus-countdown {
  margin-top: 5px;
  font-size: .72rem;
  line-height: 1.25;
  padding: 4px 6px;
  width: 100%;
  overflow-wrap: anywhere;
}
/* The calendar shares the rectangular launchers' footprint; the round Brick
   Wheel keeps its deliberately wheel-shaped control. */
html body[data-theme="adventure"][data-theme] #gameApp .adventure-rewards #dailyCalendarOpen {
  box-sizing: border-box;
  width: 100%;
  height: var(--reward-button-height);
  min-height: var(--reward-button-height);
}
html body[data-theme="adventure"][data-theme] #gameApp .adventure-rewards .btn-bonus-mini .fr-launch-meter {
  position: absolute;
  inset-inline: 12px;
  bottom: 5px;
  margin-top: 0;
}
html body[data-theme="adventure"][data-theme] #gameApp #mapButton .map-button-copy {
  align-items: center;
  gap: 3px;
}
html body[data-theme="adventure"][data-theme] #gameApp #mapButton .map-button-copy small { white-space: normal; }
html body[data-theme="adventure"][data-theme] #gameApp #mapButton .map-button-copy strong { white-space: normal; overflow-wrap: anywhere; max-width: 100%; }
/* Two IDs intentionally outrank resource-controls.css's compact map icon.
   The wide illustration is letterboxed inside its square SVG. Reclaim only
   that empty vertical space, leaving the existing plaque and copy unchanged. */
html body[data-theme="adventure"][data-theme] #gameApp #mapButton .map-button-art {
  width: 68px;
  height: 68px;
  margin-block: -4px;
}
html body[data-theme="adventure"][data-theme] #gameApp #mapButton .map-progress-ring {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 26px;
  height: 26px;
}
html body[data-theme="adventure"][data-theme] #gameApp #mapButton .map-button-arrow { display: none; }
/* One normal-flow composition: the plaque hangs below Pip's face, across his
   folded paws. Its live text can grow downward without covering any controls. */
html body[data-theme="adventure"][data-theme] #gameApp .adventure-pets-teaser {
  display: grid;
  justify-items: center;
  align-self: center;
  width: 100%;
  min-width: 0;
  pointer-events: none;
}
html body[data-theme="adventure"][data-theme] #gameApp .adventure-companion {
  grid-area: 1 / 1;
  width: 104px;
  height: auto;
  max-width: 100%;
  align-self: start;
  pointer-events: none;
  filter: drop-shadow(0 6px 4px #24685b44);
}
html body[data-theme="adventure"][data-theme] #gameApp .adventure-pets-sign {
  grid-area: 1 / 1;
  align-self: start;
  position: relative;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  margin: 88px 0 5px;
  padding: 7px 7px 9px;
  border: 2px solid #8b501d;
  border-radius: 9px 9px 14px 14px;
  background: linear-gradient(#fff4c4, #ffe2a0 52%, #edbd69);
  box-shadow: inset 0 2px #fffbe7, inset 0 -3px #ce9245, 0 3px 0 #633f25, 0 5px 6px #24685b33;
  color: #503218;
  font-size: .88rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-shadow: 0 1px #fff6d5;
  overflow-wrap: anywhere;
}
html body[data-theme="adventure"][data-theme] #gameApp .adventure-pets-sign::before {
  content: "";
  position: absolute;
  top: -9px;
  left: 16%;
  right: 16%;
  height: 11px;
  border-inline: 3px solid #785031;
  pointer-events: none;
}
html body[data-theme="adventure"][data-theme] #gameApp .adventure-pets-sign svg {
  display: block;
  width: 17px;
  height: 17px;
  margin: 0 auto 3px;
  fill: #8a5226;
}
html body[data-theme="adventure"][data-theme] #gameApp .is-art-missing .adventure-pets-sign { margin-top: 0; }
html body[data-theme="adventure"][data-theme] #gameApp .is-art-missing .adventure-pets-sign::before { display: none; }
html body[data-theme="adventure"][data-theme] #gameApp .play-column {
  grid-column: 2;
  grid-row: 1;
  padding: 10px 10px 10px;
  gap: 8px;
}
html body[data-theme="adventure"][data-theme] #gameApp .board-section {
  padding: 8px;
  margin: 0;
}
html body[data-theme="adventure"][data-theme] #gameApp .number-grid {
  grid-template-columns: repeat(10, minmax(44px, 1fr));
  gap: 4px;
}
html body[data-theme="adventure"][data-theme] #gameApp #numberGrid button.number {
  min-width: 44px;
  min-height: 44px;
  height: max(44px, 2.75rem);
  aspect-ratio: auto;
}
html body[data-theme="adventure"][data-theme] #gameApp .controls-section {
  padding: 6px 10px 12px;
  gap: 5px;
}
/* PLAY's depth is covered by the gap before the secondary row. The controls
   section already supplies bottom clearance for Turbo and its focus ring. */
html body[data-theme="adventure"][data-theme] #gameApp .action-panel { padding-bottom: 0; }
html body[data-theme="adventure"][data-theme] #gameApp .bet-panel { gap: 0 8px; }
/* Selected controls move 2px down; the focus ring extends another 6px.
   Leave 4px clear before feedback, without reserving space when it is empty. */
html body[data-theme="adventure"][data-theme] #gameApp .bet-feedback:not(:empty) { margin-top: 12px; }
html body[data-theme="adventure"][data-theme] #gameApp .bet-options { flex-basis: 300px; }
html body[data-theme="adventure"][data-theme] #gameApp .bet-buttons { gap: 6px; }
html body[data-theme="adventure"][data-theme] #gameApp .btn-bet { padding: 5px 12px; }
html body[data-theme="adventure"][data-theme] #gameApp .custom-bet-option { padding: 2px 5px 2px 10px; }
html body[data-theme="adventure"][data-theme] #gameApp .custom-bet-option input { min-height: 44px; }
html body[data-theme="adventure"][data-theme] #gameApp .bet-status-row { padding: 3px 7px; gap: 4px; }
html body[data-theme="adventure"][data-theme] #gameApp .bet-status-row .status-msg { flex-basis: 0; font-size: .9rem; }
html body[data-theme="adventure"][data-theme] #gameApp .selection-tracker { font-size: .8rem; }
html body[data-theme="adventure"][data-theme] #gameApp .btn-play { min-height: 58px; font-size: 1.8rem; }
html body[data-theme="adventure"][data-theme] #gameApp .side-rail { grid-column: 3; grid-row: 1 / 3; margin-top: 0; }
html body[data-theme="adventure"][data-theme] #gameApp .secondary-column { grid-column: 2; grid-row: 2; }
html body[data-theme="adventure"][data-theme] #gameApp .footer-section { grid-column: 1 / -1; grid-row: 3; }
html body[data-theme="adventure"][data-theme] #gameApp .results-section { padding: 12px; }
html body[data-theme="adventure"][data-theme] #gameApp .results-section .section-title { min-height: 0; }
html body[data-theme="adventure"][data-theme] #gameApp :is(.community-list, .community-feed) { max-height: none; overflow: visible; }

@media (min-width: 1101px) and (max-height: 800px) {
  html body[data-theme="adventure"][data-theme] #gameApp.app-container { padding-top: 8px; gap: 6px; }
  /* Reserve room for the normal-flow coin disclosure without shrinking targets. */
  html body[data-theme="adventure"][data-theme] #gameApp .play-column { gap: 2px; }
  html body[data-theme="adventure"][data-theme] #gameApp .number-grid { gap: 2px; }
  html body[data-theme="adventure"][data-theme] #gameApp .controls-section { padding-block: 4px 6px; }
}

@media (max-width: 1100px) {
  html body[data-theme="adventure"][data-theme] #gameApp.app-container { max-width: 760px; padding: 12px 20px 28px; }
  html body[data-theme="adventure"][data-theme] #gameApp .masthead { flex-direction: column; }
  html body[data-theme="adventure"][data-theme] #gameApp .game-help-nav { justify-content: center; }
  html body[data-theme="adventure"][data-theme] #gameApp .main-content { display: flex; flex-direction: column; gap: 20px; }
  html body[data-theme="adventure"][data-theme] #gameApp .main-content > * { width: 100%; }
  html body[data-theme="adventure"][data-theme] #gameApp .adventure-rewards {
    --reward-button-height: 104px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: start;
    gap: 12px;
    padding: 2px 0 4px;
  }
  html body[data-theme="adventure"][data-theme] #gameApp .adventure-rewards .bonus-group { display: contents; }
  html body[data-theme="adventure"][data-theme] #gameApp .adventure-companion { display: none; }
  html body[data-theme="adventure"][data-theme] #gameApp .adventure-pets-teaser { grid-column: 1 / -1; }
  html body[data-theme="adventure"][data-theme] #gameApp .adventure-pets-sign {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: fit-content;
    max-width: 100%;
    margin: 0 0 3px;
    padding: 7px 12px 9px;
  }
  html body[data-theme="adventure"][data-theme] #gameApp .adventure-pets-sign svg { flex: 0 0 17px; margin: 0; }
  html body[data-theme="adventure"][data-theme] #gameApp .adventure-pets-sign::before { display: none; }
  html body[data-theme="adventure"][data-theme] #gameApp .adventure-rewards :is(.get-coins-art, .icon-chest, .map-button-art, .dc-launcher-icon) { width: 60px; height: 60px; }
  html body[data-theme="adventure"][data-theme] #gameApp #mapButton .map-button-art { width: 60px; height: 60px; margin-block: -8px; transform: none; }
  html body[data-theme="adventure"][data-theme] #gameApp .play-column { gap: 12px; }
}
@media (max-width: 620px) {
  html body[data-theme="adventure"][data-theme] #gameApp.app-container { padding: 12px 14px 28px; }
  html body[data-theme="adventure"][data-theme] #gameApp .theme-selector {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    width: auto;
    gap: 6px 10px;
  }
  html body[data-theme="adventure"][data-theme] #gameApp .theme-label { text-align: center; flex-basis: auto; }
  html body[data-theme="adventure"][data-theme] #gameApp .theme-selector button[data-theme-choice] {
    justify-content: center;
    white-space: normal;
    padding: 6px 9px;
    gap: 5px;
    min-height: 46px;
  }
  html body[data-theme="adventure"][data-theme] #gameApp .theme-choice-indicator { width: 18px; height: 18px; }
  html body[data-theme="adventure"][data-theme] #gameApp .theme-selector button[data-theme-choice="adventure"] {
    padding-inline: 15px;
    font-size: .82rem;
  }
  html body[data-theme="adventure"][data-theme] #gameApp .header { grid-template-columns: 1fr; gap: 10px; padding: 10px; }
  html body[data-theme="adventure"][data-theme] #gameApp .wallet { gap: 8px; }
  html body[data-theme="adventure"][data-theme] #gameApp .wallet .balance-pill { padding: 4px; }
  html body[data-theme="adventure"][data-theme] #gameApp .wallet-unit { font-size: .76rem; }
  html body[data-theme="adventure"][data-theme] #gameApp .level-pill { width: 100%; }
  html body[data-theme="adventure"][data-theme] #gameApp .number-grid { grid-template-columns: repeat(5, minmax(44px, 1fr)); gap: 5px; }
  html body[data-theme="adventure"][data-theme] #gameApp #numberGrid button.number { min-height: 48px; height: max(48px, 3rem); }
  html body[data-theme="adventure"][data-theme] #gameApp .play-column { padding: 12px 7px 14px; }
  html body[data-theme="adventure"][data-theme] #gameApp .board-section { padding: 6px; }
  /* The outward 9px keyboard outline needs more than the former 7px inset. */
  html body[data-theme="adventure"][data-theme] #gameApp .controls-section { padding: 8px 12px 14px; }
  html body[data-theme="adventure"][data-theme] #gameApp .action-panel { grid-template-columns: 1fr 1fr; }
  html body[data-theme="adventure"][data-theme] #gameApp .btn-play { grid-column: 1 / -1; min-height: 62px; }
  html body[data-theme="adventure"][data-theme] #gameApp .adventure-rewards { --reward-button-height: 76px; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  html body[data-theme="adventure"][data-theme] #gameApp .adventure-rewards :is(.btn-get-coins, .btn-bonus, #mapButton, #dailyMissionsOpen) { flex-direction: row; gap: 4px; font-size: .9rem; }
  html body[data-theme="adventure"][data-theme] #gameApp .adventure-rewards #mapButton .map-progress-ring { position: static; width: 22px; height: 22px; flex: none; }
  html body[data-theme="adventure"][data-theme] #gameApp .adventure-rewards :is(.get-coins-art, .icon-chest, .map-button-art, .dc-launcher-icon) { width: 46px; height: 46px; }
  html body[data-theme="adventure"][data-theme] #gameApp #mapButton .map-button-art {
    width: 46px;
    height: 46px;
    flex: 0 1 46px;
    min-width: 0;
    margin-block: 0;
  }
  html body[data-theme="adventure"][data-theme] #gameApp #mapButton .map-button-copy { flex: none; }
  html body[data-theme="adventure"][data-theme] #gameApp #mapButton .map-button-copy small { padding-inline: 2px; }
  html body[data-theme="adventure"][data-theme] #gameApp .bonus-countdown { font-size: .74rem; }
}
@media (min-width: 375px) and (max-width: 620px) {
  html body[data-theme="adventure"][data-theme] #gameApp .number-grid { grid-template-columns: repeat(6, minmax(44px, 1fr)); }
}
@media (max-width: 360px) {
  html body[data-theme="adventure"][data-theme] #gameApp.app-container { padding-inline: 12px; }
  html body[data-theme="adventure"][data-theme] #gameApp .play-column { padding-inline: 5px; }
  html body[data-theme="adventure"][data-theme] #gameApp .board-section { padding: 4px; }
  html body[data-theme="adventure"][data-theme] #gameApp .number-grid { gap: 4px; }
  html body[data-theme="adventure"][data-theme] #gameApp .adventure-rewards { gap: 12px; }
}
@media (forced-colors: active) {
  html body[data-theme="adventure"] #gameApp .adventure-companion { display: none; }
  html body[data-theme="adventure"][data-theme] #gameApp .adventure-pets-sign {
    margin-top: 0;
    background: Canvas;
    color: CanvasText;
    border-color: CanvasText;
    box-shadow: none;
    text-shadow: none;
  }
  html body[data-theme="adventure"][data-theme] #gameApp .adventure-pets-sign::before { display: none; }
  html body[data-theme="adventure"][data-theme] #gameApp .adventure-pets-sign svg { fill: currentColor; }
}