/* ── FULL-VIEWPORT APP SHELL ─────────────────────────────────── */
html, body { height: 100%; }
body { overflow: hidden; display: flex; flex-direction: column; }

/* Manual price-reload button spin (the ↻ next to the price on Stable/Risky cards). */
@keyframes rp-spin { to { transform: rotate(360deg); } }
.rp-spin svg { animation: rp-spin 0.7s linear infinite; }

/* Nothing in the body is selectable as text (stops accidental selection on tap).
   Only form fields stay editable — everything else, including logs/ledgers, is not
   selectable (use the COPY / SAVE buttons instead). */
body {
  -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}
input, textarea, select {
  -webkit-user-select: text; -moz-user-select: text; -ms-user-select: text; user-select: text;
}

.header-inner {
  max-width: 400px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ── WALLET BAR (fixed top strip) ────────────────────────────── */
#wallet-bar {
  position: fixed;   /* never scrolls */
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 28px);
  max-width: 400px;
  z-index: 1000;     /* always on top — above the side drawers (200/300) and dropdown (500) */
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 20px;
  /* The third drawer handle — tinted and lifted off the page like the two side handles
     (operator 2026-08-13), so all three read as the same kind of thing. */
  background: #262040;
  border-bottom: 1px solid #ffffff2a;
  cursor: pointer;
  user-select: none;
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #b9b9d6;
  transition: color .15s, background .15s;
}
#wallet-bar:hover { color: #f0f0f8; background: #322a52; }

/* ── WALLET DROPDOWN (slides down from below the bar) ────────── */
#wallet-dropdown {
  position: fixed;
  left: 50%;
  top: 36px;
  width: calc(100% - 28px);
  max-width: 400px;
  max-height: calc(100vh - 36px);
  z-index: 500;
  background: #1a1730;                  /* tinted like the drawers it belongs with */
  border: 1px solid #ffffff2a;          /* match drawer panels */
  border-top: none;                     /* joins the wallet bar above it */
  border-radius: 0;                     /* square corners, like the drawer panels */
  box-shadow: 0 8px 16px #00000044;     /* match the drawer panels' shadow */
  transform: translateX(-50%) translateY(-120%);
  transition: transform .35s ease;
  display: flex;
  flex-direction: column;
}
#wallet-dropdown.open { transform: translateX(-50%) translateY(0); }

#wallet-dropdown-inner {
  padding: 20px 16px 20px;
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: #a78bfa33 transparent;
}
#wallet-dropdown-inner::-webkit-scrollbar       { width: 4px; }
#wallet-dropdown-inner::-webkit-scrollbar-track { background: transparent; }
#wallet-dropdown-inner::-webkit-scrollbar-thumb { background: #a78bfa33; border-radius: 4px; }
#wallet-dropdown-inner::-webkit-scrollbar-thumb:hover { background: #a78bfa; }

/* ── HEADER OFFSET (room for fixed wallet bar) ───────────────── */
.header { padding-top: 36px; }

/* ── APP LAYOUT ──────────────────────────────────────────────── */
#app-layout {
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow: hidden;
}

#center-col {
  max-width: 400px;
  margin: 0 auto;
  padding: 16px 14px;
  /* Modest bottom clearance so the last element isn't flush against the mobile chrome. */
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
  height: 100%;
  overflow-y: auto;
  scrollbar-width: none;             /* clean look — still scrolls by touch/wheel, no visible bar */
  -ms-overflow-style: none;
}
#center-col::-webkit-scrollbar { width: 0; height: 0; display: none; }

/* Removed the full-width "START ALL SNIPERS" bar — redundant now (Risky is armed by
   default and each panel has its own START/STOP), and it crowded the bottom handle. */
#arm-all-btn { display: none; }

/* Mode switch (PAPER | LIVE) is now an in-flow element at the bottom of the center
   column — styled inline in _modeSwitchHtml; no fixed bar. */
/* On narrow screens the center column goes full-width and its edges slip UNDER the
   36px side-panel handles. Inset it past the handles so the main view fits between
   them (38px = 36px handle + 2px gap). */
@media (max-width: 480px) {
  #center-col   { margin-left: 38px; margin-right: 38px; }
  /* Header row (date + SOL price) also slips under the side handles — inset it too. */
  .header-inner { padding-left: 38px; padding-right: 38px; }
  /* Give the SOL-price pill's rounded edge a little extra room off the handle. */
  .sol-price    { margin-right: 6px; }
}
/* Header middle column (Online / awake / FEATURES) on a folded cover screen: the token block and the
   clock take their width first, so below ~340px there isn't room for a spelled-out FEATURES label.
   Drop it to the ❓ glyph rather than let #brand-row's overflow:hidden clip it mid-word. The title
   attribute still carries the meaning. */
@media (max-width: 340px) {
  #brand-mid #main-conn a          { font-size: 0; padding: 4px 7px; }
  #brand-mid #main-conn a::before  { content: "\2753"; font-size: 12px; }
}

#center-tabs {
  padding: 8px 20px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

/* ── PANEL BACKDROP ──────────────────────────────────────────────
   An open edge-drawer (up to 386px) overlaps the centered 400px column on any window narrower
   than ~1172px (split-screen / half-width) — which used to render as a "ghost panel" floating
   over the Risky side. This dim layer sits BELOW the drawers (200/300) and ABOVE the center
   column, so an open drawer always reads as an intentional overlay. Tap it to close. Only shown
   in the overlap zone (JS gates by width); wide desktops where nothing overlaps are untouched. */
#panel-backdrop {
  position: fixed;
  top: 36px; left: 0;
  width: 100%; height: calc(100vh - 36px);
  background: rgba(8, 8, 16, 0.55);
  z-index: 150;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
#panel-backdrop.show { opacity: 1; pointer-events: auto; }

/* ── SIDE PANELS ─────────────────────────────────────────────── */
/* Each drawer is TINTED WITH ITS OWN ACCENT (operator 2026-08-13). They used to be #13131f on a
   #0d0d1a page — a 6-point difference that read as one flat surface, so the drawers "blend into the
   main background". Now Risky is a deep purple and Stable a deep blue, matching the colors those
   panels already use for their labels and handles: the drawer is visible AND you can tell which one
   is open from the color alone. Cards inside stay var(--bg2), which now reads as inset on the tint. */
#risky-panel, #stable-panel {
  position: fixed;
  top: 36px;
  height: calc(100vh - 36px);
  overflow: hidden;
  transition: width .3s ease;
  display: flex;
  box-shadow: 2px 0 16px #00000044;
}
#risky-panel   { left: 0;  flex-direction: row;         width: 36px; background: #1b1730; border-right: 1px solid #a78bfa55; z-index: 200; }
#stable-panel { right: 0; flex-direction: row-reverse; width: 36px; background: #132639; border-left:  1px solid #38bdf855; z-index: 300; }
#risky-panel.open   { width: 336px; }
#stable-panel.open { width: 336px; }
@media (min-width: 480px) {
  #risky-panel.open, #stable-panel.open { width: 386px; }
  .panel-content-area { width: 350px; min-width: 350px; }
}

/* ── PANEL HANDLE ────────────────────────────────────────────── */
.panel-handle-col {
  width: 36px;
  min-width: 36px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}
/* The handle sits a step BRIGHTER than its own drawer, so the closed 36px strip reads as a grab bar
   rather than as the edge of the page. */
#risky-panel  .panel-handle-col { background: #2a2450; }
#stable-panel .panel-handle-col { background: #1b3a55; }
#risky-panel  .panel-handle-col:hover { background: #362e63; }
#stable-panel .panel-handle-col:hover { background: #24506f; }

.ph-tap {
  width: 100%;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #444466;
  transition: color .15s;
}
.ph-tap:hover { color: #8888aa; }

.ph-label {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.ph-open, .ph-close {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}
.ph-open span, .ph-close span {
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
}
.ph-open span  { color: #c8ccf0; }   /* brightened from #444466 — was near-invisible on dark/low-brightness screens */
/* Word break in the vertical label: a hairline, not a blank gap, so "OPEN / RISKY" reads as two
   words instead of one nine-letter column. The second word carries the drawer's accent color. */
.ph-gap { width: 12px; height: 1px; margin: 3px 0; background: #ffffff3a; flex-shrink: 0; }
#risky-panel  .ph-open .ph-word { color: #c4b5fd; }
#stable-panel .ph-open .ph-word { color: #7dd3fc; }
.ph-close      { display: none; }
.ph-close span { color: #c4b5fd; }   /* brightened from #a78bfa */
#stable-panel .ph-close span { color: #7dd3fc; }   /* brightened from #38bdf8 */

#risky-panel.open   .ph-open,
#stable-panel.open .ph-open  { display: none; }
#risky-panel.open   .ph-close,
#stable-panel.open .ph-close { display: flex; }

/* ── PANEL CONTENT ───────────────────────────────────────────── */
.panel-content-area {
  width: 300px;
  min-width: 300px;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.panel-label {
  flex-shrink: 0;
  padding: 20px 16px 14px;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 2px;
  border-bottom: 1px solid #ffffff12;
}
.risky-label   { color: #a78bfa; }
.stable-label { color: #38bdf8; }

.panel-scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  padding-bottom: calc(40px + env(safe-area-inset-bottom));
  scrollbar-width: thin;
  scrollbar-color: #a78bfa33 transparent;
}
.panel-scroll-area::-webkit-scrollbar       { width: 4px; }
.panel-scroll-area::-webkit-scrollbar-track { background: transparent; }
.panel-scroll-area::-webkit-scrollbar-thumb { background: #a78bfa33; border-radius: 4px; }
.panel-scroll-area::-webkit-scrollbar-thumb:hover { background: #a78bfa; }

