/* SizeGuard in the browser (app.sizeguard.com). Loaded after styles.css, only in the web build.
   Phones and narrow windows look exactly like the phone app. Wider windows (Mac and Windows laptops
   and desktops) get a side menu and a two-column calculator. */
@media (hover: hover) and (pointer: fine) {
  button, select, summary, label[for] { cursor: pointer; }
  /* A tab under the mouse shows the chosen tab's tile faintly (as a finger's press does), its name in the text colour. */
  .bottom-nav button:not([aria-pressed="true"]):hover { color: var(--text); }
  .bottom-nav button:not([aria-pressed="true"]):hover::after { opacity: 0.4; }
  .primary-btn:hover { filter: brightness(1.06); }
  .add-pill:hover::after { opacity: 0.5; } /* + Add trade: the press tile, faintly (a filter would spoil its glass) */
  /* A computer's window counts its scroll bar in 100vw (Windows): there the pill is centred on the page as the bar is
     (a computer never spreads fixed things over a page wider than the window, the reason for 50vw on a phone). */
  .add-pill { left: 0; right: 0; margin: 0 auto; translate: none; max-width: calc(100% - 32px); }
}
:focus-visible { outline: 3px solid var(--accent-line, #e9b949); outline-offset: 2px; }

.install-btn { min-height: 44px; }

@media (min-width: 960px) {
  html { scroll-padding-bottom: 16px; }
  main { max-width: 1180px; padding: 20px 32px 40px 272px; }
  /* The menu down the side does not float: it is the window's own edge. It keeps the floating bar's feel: the chosen
     item's tile, its icon in the market's colour, the press (see "Bottom navigation" in styles.css). */
  .bottom-nav { top: 0; bottom: 0; left: 0; right: auto; width: 232px; max-width: none; margin: 0; display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: 6px;
    padding: 84px 16px 24px; border: 0; border-right: 1px solid var(--line); border-radius: 0; box-shadow: none; }
  .bottom-nav::before { content: "SizeGuard"; position: absolute; top: 22px; left: 24px; padding-left: 40px; line-height: 32px; background: url(icons/icon.svg) no-repeat left center / 32px 32px; font-weight: 800; font-size: 1.35rem; letter-spacing: -0.04em; color: var(--text); }
  .bottom-nav button { flex: 0 0 auto; flex-direction: row; align-items: center; justify-content: flex-start; gap: 14px; padding: 0 16px; min-height: 50px; border-radius: 14px; font-size: 1rem; }
  /* Each name on one line here ("Trade Journal"; on a phone it stands on two rows), and the order from the top:
     Calculator, Trade Journal, Daily Journal, Prop Firms, Markets. (The menu runs bottom to top, column-reverse, so
     the bar's own order would put Daily Journal above Trade Journal: the two journal items swap places here.) */
  .bottom-nav .nm > span { display: inline; }
  #navJournal { order: 1; } #navCalc { order: 2; }
  body.welcoming .bottom-nav { display: none; }
  main::after { display: none; } /* the fade under the floating bar: there is no bar along the bottom here */
  body.welcoming main { padding-left: 32px; max-width: 720px; }
  /* The side menu already shows the shield and the word SizeGuard: the top row keeps only the screen's name here, at
     the left of the page, as its title. (The welcome screen has no side menu: shield and word, as on a phone.) The top
     row's shield is only a copy (<use>): the shapes and the gold it copies are in .svg-defs, which is never hidden. */
  .top .brand-mark, .top #brandWord { display: none; }
  body.welcoming .top .brand-mark, body.welcoming .top #brandWord:not([hidden]) { display: block; }
  .toast { left: 272px; bottom: 24px; }

  /* Calculator: settings and trade on the left, the answer on the right, always in view. */
  #calcView:not([hidden]) { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 24px; row-gap: 0; align-items: start; }
  #calcView > * { margin-bottom: var(--gap); }
  #calcView > .trial-banner { grid-column: 1 / -1; grid-row: 1; }
  #calcView > .lock-card { grid-column: 1 / -1; grid-row: 2; }
  #calcView > .risk { grid-column: 1; grid-row: 3; }
  #calcView > .trade { grid-column: 1; grid-row: 4; }
  #calcView > .day-limit { grid-column: 1; grid-row: 5; }
  #calcView > .results { grid-column: 2; grid-row: 3 / span 3; position: sticky; top: 16px; }
  #calcView > footer { grid-column: 1 / -1; grid-row: 6; }
  #calcView .summary:has(#direction[hidden]) { display: block; }
  /* The stop box: the outline is now drawn by the label around the box (1.5px above and below), so 57px inside it
     makes the same 60px box as before. */
  #calcView .big-input input { min-height: 57px; font-size: 2.2rem; }
  /* The size is not repeated in the stop box here: there is no on-screen keypad on a computer, and the answer card
     is always in view beside the boxes. */
  .live { display: none !important; }

  /* Journal, Prop Firms, Markets: one comfortable reading column. */
  #journalView, #propView, #marketsView, #unlockView { width: 100%; max-width: 860px; margin-inline: auto; }
  /* The Insights window reads in the same column, 860px at most (the phone's sheet is 560px). */
  .insights-page .tf { max-width: 860px; }
  /* The window is centred over the page, beside the side menu (the margin keeps the menu's width free on its left),
     while the sheet and its dimming cover the whole window, the menu too, as for the Trading Book and Add trade: the
     menu is dimmed and a click on it closes Insights (the fourth hunt: it stayed bright but did nothing). */
  .insights-page .tf { margin-left: 232px; }
  /* + Add trade: on a phone it floats above the bar of tabs (styles.css, "+ Add trade floats"). Here there is no bar
     along the bottom to float above, and a pill alone in the middle of a wide window, far from everything, would be
     lost: it stands on the title line instead, at the left of Light / Dark, in the same glass look, a little smaller
     (as tall as Light / Dark: a mouse needs no thumb-size target), and stays put while the page scrolls (the ids here
     outweigh the phone's classes). It is placed from the right edge of the page (main is its frame; 20px and 32px are
     main's own padding above), so both widths are fixed, in rem so they grow with the text: Light / Dark is 5.5rem
     whichever word it shows, the pill 7.75rem. No room is kept for it under the page, and the Undo message stays at
     the bottom. A "not saved" note in the top row moves to the pill's left. */
  .theme-toggle { width: 5.5rem; padding: 0; justify-content: center; }
  #journalView > #addTrade { position: absolute; top: 20px; right: calc(32px + 5.5rem + 12px); bottom: auto; left: auto; width: 7.75rem; min-height: 44px; margin: 0; padding: 0; gap: 6px; font-size: 0.94rem; max-width: none; opacity: 1; transform: none; translate: none; pointer-events: auto; transition: none; }
  #journalView > #addTrade .plus { font-size: 20px; }
  body:has(#journalView:not([hidden]):not(.locked) > .add-pill:not([hidden])) .top .saved { margin-right: calc(7.75rem + 14px); }
  #journalView:not(.locked):has(> .add-pill:not([hidden])) { padding-bottom: 0; }
  html:has(> body > main > #journalView:not([hidden]):not(.locked) > .add-pill:not([hidden])) { scroll-padding-bottom: 16px; }
  #journalView:not([hidden]):not(.locked):has(> .add-pill:not([hidden])) ~ .toast { bottom: 24px; }
}
/* In light mode the app icon's own dark square sat round the shield like a small dark tile: there the menu shows the
   shield alone (icons/mark.svg: the same shapes and gold as the phone's top row, .svg-defs #sgMark), on the menu's
   own background. Dark mode keeps the icon, whose square melts into the black. (The small look list before launch.) */
@media (min-width: 960px) and (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .bottom-nav::before { background-image: url(icons/mark.svg); } }
@media (min-width: 960px) { :root[data-theme="light"] .bottom-nav::before { background-image: url(icons/mark.svg); } }
@media (min-width: 1280px) { main { padding-left: 296px; } .bottom-nav { width: 256px; } .toast { left: 296px; } .insights-page .tf { margin-left: 256px; } }

/* "SizeGuard is open in another tab" (web/one-tab.js): the cover over a tab that has paused because the app was
   opened in another tab. It fills the whole window with the app's own background, so nothing old shows through,
   and holds one card in the middle, drawn like the welcome card: the SizeGuard mark, a title, a few plain words and
   one button. "Use it here" is the cover's main button, so it is the one thing filled with the market's colour
   (the colour rule: a screen's main button and the calculator's answer). It is the only thing to do on the cover,
   and filled it reads at once as the way back. The card scrolls with very large text instead of being cut off:
   it sits in the middle while there is room (margin: auto) and starts at the top when there is not. */
.tab-cover[open] { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; overflow: auto; overscroll-behavior: contain;
  box-sizing: border-box; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; border: 0;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: var(--bg); color: var(--text); }
.tab-cover::backdrop { background: transparent; }
.tab-cover-card { margin: auto; width: 100%; max-width: 440px; box-sizing: border-box; align-items: center; text-align: center; gap: 14px; padding: 28px 22px 22px; }
.tab-cover-card:focus { outline: none; }
.tab-cover-card h1 { line-height: 1.2; text-wrap: balance; }
.tab-cover-card p { margin: 0; text-wrap: pretty; } /* no word left alone on the last line */
#tabCoverText, .tab-cover-form, #tabCoverNext { line-height: 1.5; }
.tab-cover-form { font-weight: 650; } /* "The form you had open here was not saved.": said once, plainly */
/* A change not saved (could not be, the storage full, or may not have been) is told as every error in the app is:
   in the error colour, at the weight of the other error lines (as "! Not saved" in the working tab). */
#tabCoverLost, #tabCoverAlso { color: var(--error); } /* (two lines when two things were not saved: review 86p) */
.tab-cover-card .primary-btn { width: 100%; margin-top: 4px; padding-block: 0.45em; } /* grows with very large text */
.tab-cover-card .primary-btn[aria-disabled="true"] { cursor: progress; } /* "Switching…": pressed, working */
html.tab-paused { overflow: hidden; } /* the page behind the cover does not scroll */
@media (prefers-reduced-motion: no-preference) { .tab-cover[open] { animation: tab-cover-in 0.22s ease-out; } }
@keyframes tab-cover-in { from { opacity: 0; } }
