/* Store and expedition use the existing rendered Warcraft frames. */
#menu-screen .mode-options { grid-template-columns: repeat(4, minmax(0, 1fr)); }
#menu-screen .menu-nav { gap: 6px; }
#menu-screen .menu-nav button { padding-inline: 12px; }
#menu-screen .selected-kart h2 { font-size: clamp(19px, 2.4vw, 30px); overflow-wrap: normal; word-break: normal; text-wrap: balance; }
.dakar-route-preview { margin: 0; color: #c6bea6; font-size: 10px; line-height: 1.5; text-align: center; }
.dakar-route-preview strong { display: block; color: #e4c47e; font: 700 10px/1.5 Georgia, serif; letter-spacing: 1px; }
.dakar-route-preview span { display: block; margin-top: 4px; }
.kart-card.locked .kart-illustration { filter: grayscale(.6) brightness(.6); }
.kart-card-lock { display: block; color: #e9c478; font-size: 9px; line-height: 1.4; text-align: center; margin: -4px 0 7px; }
.kart-card.locked { border-color: #575447; }
.kart-card.locked:hover { border-color: #c7a661; }
.store-modal { width: min(900px, calc(100vw - 40px)); padding: 32px 28px 20px; }
.store-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 12px 0 20px; padding-bottom: 16px; border-bottom: 1px solid #8c774154; }
.store-heading h2 { font: 700 31px/1.2 Georgia, serif; color: #e9d4a1; margin: 0; }
.store-heading h2 em { color: #f6dc91; font-style: normal; }
.store-heading p { margin: 7px 0 0; color: #c2b7a0; font-size: 12px; }
.store-wallet { display: flex; flex: none; align-items: center; gap: 9px; padding: 8px 12px; border: 2px ridge #786d4d; background: #151611; }
.store-wallet img { object-fit: contain; }
.store-wallet span { display: block; font-size: 10px; color: #bdb08d; }
.store-wallet strong { font: 700 24px/1.25 Georgia, serif; color: #f7d367; }
.store-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.store-card { display: grid; grid-template-rows: auto 170px 1fr 48px auto; gap: 12px; padding: 17px; border: 3px ridge #79705b; background: radial-gradient(ellipse at 50% 23%, #35441b90, #151912 60%); box-shadow: inset 0 0 0 1px #090b08, 0 4px 14px #0007; min-width: 0; }
.store-card.lichking { background: radial-gradient(ellipse at 50% 23%, #25445b99, #12161b 60%); }
.store-card-heading { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.store-card h3 { color: #f0dba8; margin: 0; font: 700 23px/1.2 Georgia, serif; text-align: center; }
.store-ownership { color: #a8b193; font-size: 9px; font-weight: 700; letter-spacing: 1.2px; }
.store-empty { grid-column: 1 / -1; text-align: center; color: #dcc599; }
.store-art { position: relative; min-width: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.store-kart-art { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 12px 9px #0008); }
.store-hero-head { position: absolute; width: 68px; height: 68px; right: 2px; top: 4px; object-fit: cover; border-radius: 50%; border: 3px ridge #a4956b; background: #111714; box-shadow: 0 3px 10px #000a; }
.store-spell { display: flex; align-items: flex-start; gap: 12px; min-width: 0; padding-top: 13px; border-top: 1px solid #c3ac7040; }
.store-spell .spell-icon { flex: 0 0 46px; width: 46px; height: 46px; object-fit: cover; border: 2px ridge #8f804f; }
.store-spell strong { color: #d9daa9; font: 700 16px/1.25 Georgia, serif; }
.lichking .store-spell strong { color: #b9d8e5; }
.store-spell p { color: #b8b8a6; font-size: 11px; line-height: 1.55; margin: 5px 0 0; }
.store-buy { min-height: 48px; width: 100%; font-size: 17px; gap: 8px; }
.store-buy img { width: 25px; height: 25px; object-fit: contain; }
.store-buy:disabled { opacity: .55; cursor: default; }
.store-card-note { font-size: 10px; color: #a89b7d; margin: -5px 0 0; text-align: center; min-height: 14px; }
.store-message { margin: 0 0 14px; padding: 10px 12px; background: #20291a; color: #e2d49d; border: 1px solid #8e8553; font-size: 12px; }
.store-footer { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-top: 16px; padding-top: 13px; border-top: 1px solid #8c774154; }
.store-free-hero { display: flex; align-items: center; flex: 1; gap: 8px; font-size: 11px; color: #ccbc98; }
.store-free-hero img { border-radius: 50%; border: 2px ridge #8b7b55; }
.store-footer p { flex: 1; margin: 0; color: #a89c82; font-size: 10px; line-height: 1.5; }
/* Darkness is rendered in the scene pass so the HUD remains legible. */
.darkness-veil { position: fixed; inset: 0; z-index: 2; pointer-events: none; background: none; }
.hud { z-index: 3; }
#hud[data-dakar="true"] .hud-lap { min-width: 96px; }
#hud[data-dakar="true"] .hud-lap strong { display: flex; align-items: baseline; gap: 2px; white-space: nowrap; font-variant-numeric: tabular-nums; }
#hud[data-dakar="true"] .hud-lap strong > small { font-size: .5em; }

@media (pointer: coarse) and (max-width: 760px) and (orientation: portrait) {
  /* A third row of simultaneous effects leaves room for the route warning. */
  #hud:has(.active-effects .active-effect:nth-child(9)) .race-center { top: calc(302px + var(--safe-top)); }
}

@media (max-width: 760px) and (orientation: portrait) {
  #menu-screen .menu-nav { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
  #menu-screen .menu-nav button { padding: 5px 2px; font-size: 11px; }
  #menu-screen .mode-option { height: 60px; }
  #menu-screen .mode-option span { font-size: 10px; }
  #menu-screen .selected-kart h2 { font-size: 22px; }
  .store-modal { width: calc(100vw - 20px); padding: 58px 12px 13px; max-height: calc(100dvh - 24px); }
  .store-modal .dialog-close { position: absolute; top: 10px; right: 10px; margin: 0; }
  .store-heading { gap: 8px; margin: 10px 0 13px; padding-bottom: 12px; }
  .store-heading h2 { font-size: 22px; }
  .store-heading p { font-size: 10px; max-width: 180px; }
  .store-wallet { gap: 5px; padding: 6px; }
  .store-wallet img { width: 25px; height: 25px; }
  .store-wallet span { font-size: 8px; max-width: 68px; overflow-wrap: anywhere; }
  .store-wallet strong { font-size: 20px; }
  .store-cards { grid-template-columns: 1fr; gap: 12px; }
  .store-card { grid-template-columns: 100px minmax(0, 1fr); grid-template-rows: auto 1fr 44px auto; gap: 8px 10px; padding: 11px; }
  .store-card-heading { grid-column: 2; grid-row: 1; align-items: flex-start; gap: 4px; }
  .store-card h3 { text-align: left; font-size: 19px; }
  .store-ownership { font-size: 8px; }
  .store-art { grid-column: 1; grid-row: 1 / 3; min-height: 116px; overflow: visible; }
  .store-kart-art { height: 110px; }
  .store-hero-head { width: 44px; height: 44px; right: 0; top: -2px; }
  .store-spell { grid-column: 2; grid-row: 2; padding-top: 6px; gap: 7px; }
  .store-spell .spell-icon { flex-basis: 28px; width: 28px; height: 28px; }
  .store-spell strong { font-size: 13px; }
  .store-spell p { font-size: 10px; line-height: 1.4; margin-top: 4px; }
  .store-buy { grid-column: 1 / -1; grid-row: 3; min-height: 44px; font-size: 16px; }
  .store-card-note { grid-column: 1 / -1; grid-row: 4; font-size: 9px; margin: 0; }
  .store-footer { margin-top: 12px; padding-top: 10px; gap: 8px; flex-direction: column; align-items: flex-start; }
  .store-footer p { font-size: 9px; }
  .store-free-hero { font-size: 10px; }
  #hud[data-dakar="true"] .hud-top { grid-template-columns: minmax(0, 1fr) 82px auto; }
  #hud[data-dakar="true"] .hud-lap { min-width: 0; padding-inline: 6px; }
  #hud[data-dakar="true"] .hud-lap strong { font-size: 21px; }
}
@media (orientation: landscape) and (max-height: 560px) {
  #hud[data-dakar="true"] .hud-top { grid-template-columns: auto 82px minmax(0, 1fr) auto; }
  #hud[data-dakar="true"] .hud-lap { min-width: 0; padding-inline: 6px; }
  #hud[data-dakar="true"] .hud-lap strong { font-size: 21px; }
  #menu-screen .menu-nav button { padding-inline: 6px; font-size: 11px; }
  #menu-screen .menu-header { gap: 8px; }
  #menu-screen .mode-option { height: 44px; }
  #menu-screen .mode-option span { font-size: 11px; }
  #menu-screen .dakar-route-preview { display: none; }
  #menu-screen .selected-kart h2 { font-size: 21px; }
  .store-modal { width: min(850px, calc(100vw - 28px)); padding: 21px 17px 12px; }
  .store-heading { margin: 4px 0 12px; padding-bottom: 8px; }
  .store-heading h2 { font-size: 23px; }
  .store-heading p { font-size: 10px; }
  .store-card { grid-template-columns: 110px minmax(0, 1fr); grid-template-rows: auto 1fr 44px auto; gap: 8px; padding: 10px; }
  .store-card-heading { grid-column: 1 / -1; }
  .store-card h3 { font-size: 18px; }
  .store-art { grid-column: 1; grid-row: 2; height: 115px; }
  .store-hero-head { width: 42px; height: 42px; }
  .store-spell { grid-column: 2; grid-row: 2; flex-direction: column; padding: 0; border: 0; gap: 5px; }
  .store-spell .spell-icon { width: 28px; height: 28px; flex-basis: 28px; }
  .store-spell strong { font-size: 12px; }
  .store-spell p { font-size: 9px; line-height: 1.4; margin-top: 4px; }
  .store-buy, .store-card-note { grid-column: 1 / -1; }
  .store-buy { min-height: 44px; font-size: 15px; }
  .store-footer { margin-top: 9px; padding-top: 8px; }
}
@media (pointer: coarse) and (orientation: landscape) {
  #hud[data-dakar="true"] .hud-lap { min-width: 78px; }
}

/* Dakar chooses its route and one-way format automatically. */
#menu-screen[data-mode="dakar"] .race-options { grid-column: 1 / -1; grid-template-columns: minmax(0, 1fr); }
.party-options.is-dakar { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* One account balance and ownership across every race mode. */
#store-dialog .store-heading { flex-wrap: wrap; }
#store-dialog .store-wallet { max-width: 100%; min-width: 0; flex-wrap: wrap; gap: 10px; }
.store-wallet-balance { display: flex; align-items: center; gap: 8px; min-width: 0; }
#store-dialog #store-wallet-label { max-width: 160px; overflow-wrap: anywhere; }
#store-account-action { min-height: 36px; padding: 6px 12px; font-size: 12px; }
@media (max-width: 760px) and (orientation: portrait) {
  #store-dialog .store-heading { align-items: flex-start; }
  #store-dialog .store-wallet { justify-content: space-between; }
  #store-account-action { min-height: 44px; }
}
