/* Mobile application shell. Existing desktop chart workspace is retained. */
:root { --app-surface: #10182e; --app-bg: #090d21; --app-ink: #eff4ff;
  --app-muted: #acbdd6; --app-accent: #7be4e7; --app-nav-height: 64px;
  --z-app-nav: 30; --z-app-header: 31; }
.app-primary { display: flex; align-items: center; justify-content: center; gap: 12px;
  min-height: 48px; padding: 12px 16px; border-radius: 12px; background: #7be4e7;
  color: #062632; font-weight: 700; font-size: 14px; text-align: center; }
.app-primary:hover { background: #a0eff0; }
.app-primary:active { transform: scale(.985); }
#app-nav { display: none; }
.discovery-choice { cursor: pointer; min-width: 0; }
button, a, input, select, summary { touch-action: manipulation; }
.discovery-choice:active { filter: brightness(1.2); }
.discovery-saved-links { display: grid; grid-template-columns:1fr 1fr; gap:8px; }
.discovery-saved-links a { min-width:0; min-height:48px; padding:8px; font-size:13px; text-align:center; }
.discovery-play-next { margin-top: 12px; }
.discovery-choice .discovery-sparkline { display: block; }
#profile-page { width: min(100%, 560px); margin: 20px auto 48px; }
.app-page-heading h1 { font: 700 32px/1.15 Rajdhani, sans-serif; margin: 0 0 8px; }
.app-page-heading p { color: var(--app-muted); font-size: 13px; margin: 0 0 24px; }
.app-wallet { padding: 24px; border-radius: 16px; background: #142e3c; }
.app-wallet > span { color: #bcdae4; font-size: 13px; }
.app-wallet strong { display: block; font: 700 42px/1.3 Rajdhani, sans-serif; margin: 8px 0; }
.app-wallet strong small { font: 500 14px Inter, sans-serif; color: #bcdae4; }
.app-wallet p { font-size: 12px; color: #bcdae4; margin: 0 0 18px; }
#profile-name { margin: 26px 0 16px; }
#profile-name label { font-weight: 600; }
#profile-name p { color: var(--app-muted); font-size: 12px; margin: 6px 0 12px; }
#profile-name > div { display: flex; gap: 8px; }
#profile-name input { font-size: 16px; background: var(--app-surface); }
#profile-name small { display: block; color: var(--app-muted); margin-top: 8px; }
[data-profile-status]:empty { display: none; }
.app-settings { border-block: 1px solid #293a54; }
.app-settings > :is(a,button) { display: flex; align-items: center; justify-content: space-between; gap: 20px;
  width: 100%; padding: 18px 4px; min-height: 56px; border: 0; border-radius: 0;
  border-bottom: 1px solid #202f49; font: 500 14px Inter, sans-serif; color: #e0eafb; background: transparent; text-align: left; }
.app-settings > :last-child { border-bottom: 0; }
.app-settings > :is(a,button) > span:last-child { color: var(--app-accent); }
.app-install-help { padding: 14px; border-radius: 12px; color: #cbe8f1; background: #142637; font-size: 13px; }
.app-reset { padding: 18px 0; }
.app-reset h2 { font-size: 20px; margin: 8px 0; }
.app-reset p, .app-fineprint { color: var(--app-muted); font-size: 12px; }
.app-reset button { width: 100%; min-height: 48px; color: #e0cfff; border-color: #796a9f; }
[data-swipe-ready] { display: block; width: 100%; min-height: 44px; color: #a7f4f1; border-color: #408f9b; }

@media (max-width: 767px) {
  html { background: var(--app-bg); scroll-padding-top: 70px; scroll-padding-bottom: 90px; }
  body { background: var(--app-bg); padding: 0 12px calc(var(--app-nav-height) + env(safe-area-inset-bottom) + 18px);
    overscroll-behavior-y: none; -webkit-tap-highlight-color: transparent; }
  body::before, body::after { display: none; }
  .topbar, body[data-route="/swipe"] .topbar { height: 58px; min-height: 58px; padding: 6px 0;
    position: sticky; top: 0; z-index: var(--z-app-header); background: var(--app-bg); }
  .brand img { width: 104px; height: 36px; object-fit: contain; }
  .topbar > nav, .account-menu { display: none !important; }
  .topbar { width: 100%; margin: 0; }
  #account { margin-left: auto; }
  .balance-chip { display: flex; align-items: center; gap: 4px; min-height: 40px; padding: 8px 11px;
    font-size: 13px; background: #141d37; border: 1px solid #354369; color: #edefff; }
  .balance-chip > span { color: #aebbd8; font-size: 10px; }
  body > .notice, body[data-route="/swipe"] > .notice { font: 10px/1.4 Inter, sans-serif;
    color: #b0bfd6; padding: 3px 0 8px; margin: 0; }
  main { width: 100%; }
  main > details.notice { margin-top: 20px; }
  #app-nav { display: grid; margin: 0; gap: 4px; grid-template-columns: repeat(4, 1fr); position: fixed; z-index: var(--z-app-nav);
    bottom: 0; inset-inline: 0; height: calc(var(--app-nav-height) + env(safe-area-inset-bottom));
    padding: 4px 8px calc(4px + env(safe-area-inset-bottom)); border-top: 1px solid #2b3653; background: #0e142a; }
  #app-nav a { display: flex; align-items: center; justify-content: center; flex-direction: column;
    position: relative; gap: 4px; padding: 6px 4px; border: 0; min-height: 52px; border-radius: 10px; color: #a9b9d2; font: 500 11px/1 Inter, sans-serif; }
  #app-nav a[aria-current=page] { color: #98f0ed; background: #17313e; }
  #app-nav svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; }
  #app-position-count { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 17px; height: 17px;
    padding: 3px; border-radius: 10px; background: #c4a7ff; color: #23183b; font: 700 10px/1 Inter; }
  #toast, body[data-route="/swipe"] #toast { top: 64px; bottom: auto; width: calc(100% - 24px); max-width: 500px;
    padding: 12px 16px; font-size: 12px; border-radius: 12px; box-shadow: none; }
  #page { padding: 16px 12px; border: 0; background: transparent; box-shadow: none; }
  #page > h1 { font-size: 28px; margin: 8px 0 20px; }
  #profile-page { margin-top: 10px; }
  .app-page-heading p { margin-bottom: 16px; }
  .app-wallet { padding: 20px; }
  .discovery-preview { margin: 4px auto 0; }
  .discovery-heading { margin-bottom: 10px; min-height: 42px; gap: 8px; }
  .discovery-heading p { display: none; }
  .discovery-heading h1 { font-size: 26px; line-height: 1.1; text-wrap: balance; }
  .discovery-ticket { padding: 8px; font-size: 11px; }
  .discovery-filters button { min-height: 44px; }
  .discovery-progress { margin: 8px 2px; min-height: 14px; }
  .discovery-card { padding: 14px; border-radius: 16px; }
  .discovery-event { font-size: 10px; }
  .discovery-teams { margin: 12px 0 10px; gap: 10px; min-height: 50px; }
  .discovery-teams > div { flex-direction: row; gap: 6px; }
  .discovery-teams > div:last-child { flex-direction: row-reverse; }
  .discovery-teams b { font-size: 19px; overflow-wrap: anywhere; }
  .discovery-teams img, .discovery-teams > div > span { width: 28px; height: 28px; font-size: 23px; flex-shrink: 0; }
  .discovery-question { margin-bottom: 10px; }
  .discovery-question h2 { font-size: 24px; margin: 4px 0; }
  .discovery-question small { font-size: 9px; }
  .discovery-choices { gap: 10px; }
  .discovery-choice { min-height: 144px; padding: 10px 6px 4px; border-radius: 12px; }
  .discovery-choice b { margin: 7px 0 3px; font-size: 21px; }
  .discovery-choice strong { font-size: 34px; }
  .discovery-sparkline, .discovery-choice svg { height: 30px; }
  .discovery-choice small { font-size: 10px; margin: 3px 0; color: #b6c7de; }
  .discovery-source { margin: 8px 0 0; font-size: 10px; color: #bac9df; }
  .discovery-actions { margin-top: 16px; }
  .discovery-actions button { min-height: 44px; font-size: 12px; }
  .discovery-draw { margin: 6px auto; min-height: 44px; padding: 6px 14px; }
  .discovery-note { font-size: 10px; margin: 8px 0; }
  .discovery-play-next { margin-top: 8px; min-height: 46px; font-size: 13px; }
  .discovery-feedback:empty { display: none; }
  .discovery-feedback { font-size: 11px; }
  .discovery-saved h2 { font-size: 24px; }
  .discovery-saved-links .app-primary { font-size: 13px; }
  #swipe-page { margin: 4px auto 0; }
  .swipe-heading h1 { font-size: 27px; }
  .swipe-heading { margin-bottom: 8px; }
  .swipe-links a:first-child { display: none; }
  .swipe-card, .swipe-stack::before, .swipe-stack::after { box-shadow: none; }
  .swipe-teams > div { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 5px; }
  .swipe-teams small { display: none; }
  .swipe-teams b { font-size: 17px; }
  .swipe-teams { min-height: 40px; margin: 6px 0; }
  .swipe-teams img, .swipe-club { width: 24px; height: 24px; }
  .swipe-chart { height: 82px; }
  .swipe-selection h2 { font-size: 20px; }
  /* Keep the quote and source above the controls; bottom-sticky controls covered
     the payout on short screens. The bottom application navigation remains fixed. */
  .swipe-controls { position:static; }
  .swipe-stakes { gap: 8px; }
  .swipe-stakes button { flex: 1; max-width: 72px; }
  .swipe-source { color: #b3c3dc; }
  .swipe-info { padding-top: 8px; }
  .swipe-info-block { padding: 14px 0; }
  .swipe-info .swipe-rule { padding: 0; border: 0; }
}
@media (max-width: 767px) and (max-height: 720px) {
  .swipe-heading { display:none; }
  .discovery-card { padding: 10px 12px; }
  .discovery-teams { min-height: 38px; margin: 6px 0; }
  .discovery-question h2 { font-size: 22px; }
  .discovery-choice { min-height: 128px; padding-top: 6px; }
  .discovery-choice b { margin-top: 4px; }
  .discovery-choice strong { font-size: 30px; }
  .discovery-actions { position: sticky; bottom: calc(var(--app-nav-height) + env(safe-area-inset-bottom) + 4px); z-index: 5;
    padding: 5px 0; background: var(--app-bg); }
  .swipe-chart { height: 64px; }
  .swipe-card { padding: 8px 10px; }
  .swipe-times { font-size: 10px; margin-bottom:4px; }
  .swipe-payouts strong { font-size: 23px; }
  .swipe-payouts > button { display:grid; grid-template-columns:auto auto; align-items:center; padding:4px; font-size:10px; }
  .swipe-payouts strong { font-size:21px; margin:0; }
  .swipe-payouts small { grid-column:1/-1; }
  .swipe-stack { margin-bottom:6px; }
  .swipe-controls { padding:4px; }
  .swipe-source { margin-top:5px; }
  .swipe-meta { margin-bottom:5px; }
  .swipe-teams { min-height:32px; }
  .swipe-selection { padding-top:6px; }
}
.swipe-meta { gap:8px; }
.swipe-meta label { position:relative; display:block; min-width:0; width:100px;
  height:44px; padding:4px 8px 0; font-size:10px; border:1px solid var(--border); border-radius:8px; }
.swipe-meta select { position:absolute; inset:0; font:inherit; font-size:16px; min-width:0; width:100%; height:44px; min-height:44px;
  margin:0; padding:12px 20px 0 8px; border:0; background:transparent; cursor:pointer; appearance:none; -webkit-appearance:none; }
.swipe-meta label::after { content:'⌄'; position:absolute; right:8px; bottom:4px; font-size:16px; pointer-events:none; }
.swipe-meta label:has(select:focus-visible) { outline:2px solid var(--lilac); outline-offset:2px; }
.swipe-meta select:focus-visible { outline:none; }
.swipe-meta button { min-height:44px; font-size:12px; padding:8px; }
.swipe-meta .swipe-market { display:none; }
.swipe-stakes { margin:6px 0 10px; }
@media (max-width:767px) {
  .swipe-filters { display:none; }
  .swipe-meta { display:grid; grid-template-columns:minmax(0,1fr) 70px 80px 60px; gap:6px; margin-bottom:8px; }
  .swipe-meta label { width:100%; }
  .swipe-meta .swipe-market { display:block; }
  .swipe-meta #swipe-count { display:none; }
  .swipe-stakes { margin:0 0 8px; }
  .swipe-stakes > span:first-child { max-width:none; }
}
@media (max-width:767px) and (max-height:620px) {
  /* Native stake selector keeps every preset available on short phones. */
  .swipe-stakes { display:none; }
}
