/* WhaleMaps /app — phone layer. Loaded by public/app.html; html.wm-m is set by app-mobile.js on
   (max-width:768px), (pointer:coarse) and (max-height:500px). Inline styles in app.html need !important. */

#main { height: 100vh; height: 100dvh; }
.upgrade-prompt { max-height: 88vh; max-height: 88dvh !important; }
#ai-chat-panel { height: 100dvh !important; }

html.wm-m, html.wm-m body { height: 100%; overscroll-behavior: none; -webkit-text-size-adjust: 100%; }
html.wm-m #main { position: relative; }

/* the old phone controls row duplicated the Min/Max/Lo/Hi controls — the settings sheet holds the real ones */
html.wm-m #mobile-heatmap-controls { display: none !important; }
html.wm-m #header, html.wm-m #info-bar { display: none !important; }

/* ---------- compact top bar: token · exchange · share · settings ---------- */
#m-bar, #m-sheet { display: none; }
html.wm-m #m-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 6px max(8px, env(safe-area-inset-right)) 6px max(8px, env(safe-area-inset-left));
  background: #111; border-bottom: 1px solid #222; flex-shrink: 0;
}
html.wm-m #m-bar .m-spacer { flex: 1; }
html.wm-m #m-bar #token-dropdown { flex-shrink: 0; }
html.wm-m #m-bar #token-btn {
  min-height: 40px; min-width: 76px !important; padding: 6px 12px !important;
  font-size: 15px !important; border-radius: 8px !important;
}
html.wm-m #m-bar #token-menu { min-width: 220px !important; max-height: 60vh !important; max-height: 60dvh !important; }
html.wm-m #m-bar #token-list { max-height: calc(60vh - 56px) !important; max-height: calc(60dvh - 56px) !important; }
html.wm-m #m-bar #token-list > div { padding: 12px 14px !important; font-size: 15px !important; }
html.wm-m #m-bar #token-search { font-size: 16px !important; padding: 10px 12px !important; }
html.wm-m #m-bar #exchange-select {
  min-height: 40px; min-width: 0; max-width: 46vw; flex: 0 1 auto;
  font-size: 16px !important; padding: 6px 8px !important; border-radius: 8px !important;
  text-overflow: ellipsis;
}
/* exchange: the native select is replaced by a token-style menu on phones (iOS picker is a white sheet) */
#exch-dropdown { display: none; }
html.wm-m #m-bar #exchange-select { display: none !important; }
html.wm-m #m-bar #exch-dropdown { display: block; position: relative; flex: 0 1 auto; min-width: 0; }
#exch-btn {
  min-height: 40px; max-width: 46vw; padding: 6px 12px; border-radius: 8px;
  background: #1a1a1a; color: #4fc3f7; border: 1px solid #333;
  font-family: inherit; font-size: 15px; font-weight: bold; text-align: left; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#exch-btn[aria-expanded="true"] { border-color: #4fc3f7; }
#exch-menu {
  display: none; position: absolute; top: 100%; left: 0; margin-top: 2px; z-index: 1000;
  min-width: 220px; max-height: 60vh; max-height: 60dvh; overflow-y: auto; overscroll-behavior: contain;
  background: #1a1a1a; border: 1px solid #444; border-radius: 4px; box-shadow: 0 4px 12px rgba(0,0,0,.5);
}
#exch-menu.open { display: block; }
#exch-menu .exch-group {
  padding: 10px 14px 4px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #6b7a8c;
  border-top: 1px solid #2a2a2a;
}
#exch-menu .exch-group:first-child { border-top: 0; }
#exch-menu .exch-item { padding: 12px 14px; font-size: 15px; font-weight: bold; color: #999; cursor: pointer; }
#exch-menu .exch-item.active { color: #4fc3f7; background: #252525; }
#exch-menu .exch-item.disabled { color: #555; cursor: default; }
html.wm-m #m-bar #screenshot-btn {
  min-width: 42px; min-height: 40px; margin: 0 !important; padding: 6px 10px !important;
  font-size: 17px !important; border-radius: 8px !important;
}
html.wm-m #m-bar #screenshot-btn .toggle-label { display: none !important; }
#m-settings-btn {
  min-height: 40px; padding: 6px 10px; border-radius: 8px; border: 1px solid #333;
  background: #1a1a1a; color: #ccc; font: inherit; font-size: 14px; font-weight: 700;
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; white-space: nowrap;
}
#m-settings-btn .m-caret { font-size: 11px; color: #777; transition: transform .15s; }
#m-settings-btn[aria-expanded="true"] { border-color: #4fc3f7; color: #4fc3f7; }
#m-settings-btn[aria-expanded="true"] .m-caret { transform: rotate(180deg); }

/* ---------- settings sheet (drops down over the chart) ---------- */
html.wm-m #m-sheet.open {
  display: block; position: absolute; left: 0; right: 0; z-index: 950;
  max-height: calc(100dvh - var(--m-bar-h, 52px) - 8px); overflow-y: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: #0d0d12; border-bottom: 1px solid #2a2a3e; box-shadow: 0 14px 30px rgba(0,0,0,.6);
  padding: 4px max(12px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}
#m-sheet .m-sec { padding: 10px 0; border-bottom: 1px solid #1a1a24; }
#m-sheet .m-sec:last-child { border-bottom: 0; }
#m-sheet .m-h { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #6b7a8c; margin-bottom: 8px; }

/* timeframe */
#m-sheet #timeframe-control { display: block !important; }
#m-sheet #tf-slider-wrap { display: none !important; }
#m-sheet .btn-group { display: grid !important; grid-template-columns: repeat(6, 1fr); gap: 6px; overflow: visible !important; }
#m-sheet .btn-group button {
  min-height: 40px; padding: 6px 0 !important; font-size: 13px !important; border-radius: 6px !important;
}

/* heatmap filters */
#m-sheet .m-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; align-items: center; }
#m-sheet .slider-group { margin: 0 !important; gap: 8px !important; min-width: 0; }
#m-sheet .slider-group.m-wide { grid-column: 1 / -1; }
#m-sheet .slider-group label { font-size: 12px !important; min-width: 52px !important; color: #8b98a5; }
#m-sheet .slider-group input[type=range] { flex: 1; width: auto !important; min-width: 0; height: 32px; }
#m-sheet .slider-group input[type=number] {
  width: 72px !important; min-height: 36px; font-size: 16px !important; padding: 4px 6px !important;
}
#m-sheet .slider-group #price-lo, #m-sheet .slider-group #price-hi { flex: 1; width: auto !important; min-width: 0; }
#m-sheet #price-reset {
  display: inline-block !important; grid-column: 1 / -1; min-height: 40px;
  font-size: 13px !important; padding: 6px 12px !important; border-radius: 6px !important;
}
#m-sheet .m-hint { grid-column: 1 / -1; font-size: 11.5px; color: #5c7089; line-height: 1.45; }

/* layers */
#m-sheet .m-layers { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
#m-sheet .m-layers button {
  margin: 0 !important; min-height: 44px; padding: 8px 10px !important; font-size: 13px !important;
  text-align: left; border-radius: 8px !important;
}
#m-sheet .m-layers .toggle-label { display: inline !important; }

/* pages */
#m-sheet .m-links { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
#m-sheet .m-links a {
  margin: 0 !important; min-height: 44px; display: flex !important; align-items: center;
  padding: 8px 10px !important; font-size: 13px !important; border-radius: 8px !important;
  border: 1px solid #333 !important; background: #1a1a2e !important;
}

/* account row */
#m-sheet .m-account { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
#m-sheet #user-bar { margin: 0 !important; gap: 10px; font-size: 13px; flex-wrap: wrap; }
#m-sheet #user-bar a { min-height: 40px; display: inline-flex !important; align-items: center; font-size: 14px !important; }
#m-sheet #user-bar a[style*="display:none"], #m-sheet #user-bar a[style*="display: none"] { display: none !important; }
#m-sheet #hdr-account { font-size: 20px !important; padding: 0 6px; }
#m-sheet #hdr-signin { padding: 8px 16px !important; }
#m-sheet #hdr-redeem input { font-size: 16px !important; width: 150px !important; min-height: 40px; }
#m-sheet #hdr-redeem button { min-height: 40px; font-size: 13px !important; }
#m-sheet #m-home { color: #4fc3f7; font-size: 13px; text-decoration: none; min-height: 40px; display: inline-flex; align-items: center; }

/* ---------- chart + strips ---------- */
html.wm-m #heatmap-container { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; cursor: default; }
html.wm-m #context-strip { touch-action: none; height: 72px !important; }
html.wm-m #context-labels { width: 74px !important; padding: 2px 4px !important; }
html.wm-m #context-labels span { font-size: 10px !important; line-height: 1.1; white-space: nowrap; }
html.wm-m #alert-banner { font-size: 12px !important; padding: 6px 12px !important; }
html.wm-m #alert-banner > span { display: inline-block; padding: 2px 0; }
html.wm-m #tooltip { white-space: normal; max-width: min(320px, calc(100vw - 24px)); font-size: 12px; line-height: 1.45; }
html.wm-m button, html.wm-m a, html.wm-m select, html.wm-m input, html.wm-m label { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

/* iOS zooms the page when an input under 16px is focused */
html.wm-m input:not([type=range]):not([type=checkbox]):not([type=color]), html.wm-m select, html.wm-m textarea { font-size: 16px !important; }

/* banners / modals */
html.wm-m #trial-expired-banner { margin: 6px 8px; padding: 10px 34px 10px 12px; }
html.wm-m #trial-expired-banner .close-banner { padding: 10px 12px; top: 0; right: 0; font-size: 20px; }
html.wm-m #redeem-bar { padding: 8px 10px; }
html.wm-m #redeem-bar input { width: 140px !important; min-height: 36px; }
html.wm-m .upgrade-prompt { padding: 20px 16px !important; width: 94% !important; }
html.wm-m .upgrade-prompt h3 { font-size: 17px !important; }

/* short landscape phones: every pixel of height goes to the chart */
@media (pointer: coarse) and (max-height: 500px) {
  html.wm-m #m-bar { padding-top: 4px; padding-bottom: 4px; }
  html.wm-m #context-strip { height: 48px !important; }
  html.wm-m #context-labels span:nth-child(n+4) { display: none; }
  html.wm-m #options-flow-strip, html.wm-m #alert-banner { display: none !important; }
  html.wm-m #m-sheet .btn-group { grid-template-columns: repeat(11, 1fr); }
  html.wm-m #m-sheet .m-layers, html.wm-m #m-sheet .m-links { grid-template-columns: repeat(4, 1fr); }
}

/* upgrade window on phones: price, then the pay buttons, then the feature list (buttons were below the fold) */
html.wm-m #plan-pro-card { display: flex; flex-direction: column; }
html.wm-m #plan-pro-card > ul { order: 3; margin: 14px 0 0 !important; }
html.wm-m #plan-pro-card > #btn-pro-card,
html.wm-m #plan-pro-card > #btn-pro-crypto { order: 2; min-height: 46px; font-size: 14px !important; }

/* account chip at the right of the phone bar; exchange name gives up width first */
#m-acct { display: none; }
html.wm-m #m-acct {
  display: inline-flex; align-items: center; min-height: 40px; padding: 6px 10px; border-radius: 8px; flex-shrink: 0;
  font: inherit; font-size: 13px; font-weight: 800; white-space: nowrap; cursor: pointer; border: 1px solid #333; background: #1a1a1a; color: #ccc;
}
html.wm-m #m-acct.signin { background: #00e676; color: #04121f; border-color: #00e676; }
html.wm-m #m-acct.paid { color: #ffd740; border-color: #5a4a10; background: #1a1606; }
html.wm-m #m-acct.trial { color: #4fc3f7; border-color: #1b3a52; background: #0d1a24; }
html.wm-m #m-acct.expired { color: #ff8a65; border-color: #5a2a1a; background: #1f100a; }
html.wm-m #m-bar .m-spacer { flex: 0 0 0; }
html.wm-m #m-bar #exch-dropdown { flex: 1 1 auto; min-width: 0; }
html.wm-m #m-bar #exch-btn { width: 100%; max-width: 100%; }
html.wm-m #m-bar #token-btn { min-width: 0 !important; }
@media (max-width: 380px) {
  html.wm-m #m-bar { gap: 4px; padding-left: 6px; padding-right: 6px; }
  html.wm-m #m-tf { display: none; }
  html.wm-m #m-acct { padding: 6px 8px; font-size: 12px; }
  html.wm-m #m-bar #screenshot-btn { min-width: 38px; padding: 6px 8px !important; }
}
html.wm-m #wm-free-strip { font-size: 12px; padding: 6px 10px; }
