/* Block Runner top bar + phones held sideways (Marlon 02.12., photos from his phone). Loaded last.
   1. The top bar is docked to the very top: the safe area (status bar / notch) is padded once, by the bar itself (the shell
      added it a second time, so on phones with an inset the bar slid down over the view heads). Own background + line below.
   2. Sideways phones: the five tabs become a slim rail on the left, the bar shrinks to one low row and the head of the open
      view (Runner|Gear, Shop, Ranking|Friends) sits in that same row, so the content gets the whole height.
   --nb-right (js/vollbild.js) = width of wallet pill + cog from the right edge; view heads keep that space free. */
:root { --nb-rail: 0px; }

/* ---- top bar: docked, safe area once ---- */
.shell { padding: 0; }
.nb-bar { background: linear-gradient(180deg, rgba(5,7,10,.94), rgba(10,14,20,.84)); border-bottom: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(0,0,0,.3); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.home { padding-left: calc(14px + env(safe-area-inset-left)); padding-right: calc(14px + env(safe-area-inset-right)); }
/* small phones: the name as a two-line word mark next to the icon, the pill without its unit */
@media (max-width: 519px) {
  .nb-logo .bar-title { position: static; width: auto; height: auto; clip-path: none; overflow: visible; max-width: 7ch; font-size: 12px; line-height: 1.05; white-space: normal; }
  .nb-wal small { display: none; }
}
@media (max-width: 340px) { .nb-logo .bar-title { display: none; } }
/* the balance lives in the wallet view itself: no second number in the bar there */
html[data-tab="wallet"] .nb-wal { visibility: hidden; }

/* ---- upright phones: compact shop head, prices on one line, the end of every view above the tab bar ---- */
.gc-price { white-space: nowrap; max-width: 100%; }
#win-runner .stats { margin-top: 4px; }
.win.nb-pane .win-body::after { content: ""; display: block; flex: none; height: 4px; } /* last line never glued to the tab bar */
@media (max-width: 600px) {
  #win-shop .win-body.gv { gap: 6px; }
  .g-shophead { row-gap: 0; column-gap: 8px; }
  .g-shophead .gs-k { width: 26px; height: 26px; padding: 4px; }
  .g-shophead span:last-child { margin-top: -2px; }
  .g-grid.shop .gc-price { padding: 1px 7px 1px 4px; font-size: 11px; }
}
/* short upright phones (browser bars, status bar): the runner view fits without scrolling */
@media (max-height: 800px) and (orientation: portrait) {
  #win-runner .win-body h3 { margin: 10px 0 6px; }
  #win-runner .critters { gap: 6px; }
  #win-runner .critters button { padding: 4px 4px 6px; }
  #win-runner .critters button img { max-width: 54px; }
  #win-runner .name-field .name-row b { font-size: 18px; }
}

/* ---- phones held sideways ---- */
@media (max-height: 520px) and (orientation: landscape) {
  :root { --nb-rail: calc(74px + env(safe-area-inset-left)); --nb-bar: calc(46px + env(safe-area-inset-top)); --nb-tab: env(safe-area-inset-bottom); }

  /* tab rail on the left: icon + small label, the whole height */
  .tabs { top: 0; bottom: 0; left: 0; right: auto; width: var(--nb-rail); height: auto; transform: none; border-radius: 0; border: 0; border-right: 1px solid var(--line);
    grid-template-columns: minmax(0, 1fr); grid-template-rows: repeat(5, minmax(0, 1fr)); gap: 4px;
    padding: calc(6px + env(safe-area-inset-top)) 6px calc(6px + env(safe-area-inset-bottom)) calc(6px + env(safe-area-inset-left));
    background: linear-gradient(90deg, rgba(5,7,10,.97), rgba(14,19,26,.92)); box-shadow: 10px 0 30px rgba(0,0,0,.3); }
  .tabs button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 44px; border-radius: 14px; }
  .tabs button i[data-ic], .tabs button svg { width: 22px; height: 22px; }
  .tabs button b { font-size: 9px; letter-spacing: .05em; }
  .tabs .tab-dot { position: absolute; order: 0; top: 6px; right: 8px; margin: 0; }

  /* bar: one low row right of the rail */
  .nb-bar { padding: env(safe-area-inset-top) calc(10px + env(safe-area-inset-right)) 0 calc(var(--nb-rail) + 12px); }
  .nb-logo > i[data-ic] { width: 32px; height: 32px; border-radius: 11px; } .nb-logo > i[data-ic] svg { width: 20px; height: 20px; }
  .nb-logo .bar-title { position: static; width: auto; height: auto; clip-path: none; overflow: visible; max-width: none; font-size: 17px; white-space: nowrap; }
  .nb-wal, #cogBtn { min-height: 38px; } #cogBtn { width: 38px; min-width: 38px; padding: 0; }
  .nb-wal small { display: none; }

  /* start screen between bar and bottom, right of the rail */
  .home { padding: 6px calc(14px + env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) calc(var(--nb-rail) + 14px); }

  /* views: from the top edge (head in the bar row) to the bottom, right of the rail */
  .win.nb-pane { top: 0; left: var(--nb-rail); bottom: var(--nb-tab); padding: 0; }
  .win.nb-pane .win-box { width: 100%; border-radius: 0; border-width: 0; }
  .win.nb-pane .win-head { min-height: var(--nb-bar); padding: calc(4px + env(safe-area-inset-top)) calc(var(--nb-right, 200px) + 8px) 4px 12px; background: rgba(5,7,10,.35); }
  .win.nb-pane .win-head i[data-ic] { width: 32px; height: 32px; }
  .win.nb-pane .win-body { padding-left: 14px; padding-right: calc(14px + env(safe-area-inset-right)); }
  html.nb-view .nb-bar { background: none; border-color: transparent; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; pointer-events: none; }
  html.nb-view .nb-bar > * { pointer-events: auto; }
  html.nb-view .nb-logo { visibility: hidden; }
  .nb-seg { padding: 3px; } .nb-seg button { min-height: 36px; }
  .nb-lv, .win-head .spk { min-height: 36px; }
  /* wallet has no head: it starts below the bar, the bar keeps its name there */
  html[data-tab="wallet"] .nb-bar { background: linear-gradient(180deg, rgba(5,7,10,.94), rgba(10,14,20,.84)); border-color: var(--line); pointer-events: auto; }
  html[data-tab="wallet"] .nb-logo { visibility: visible; }
  html[data-tab="wallet"] #win-wallet.nb-pane { top: var(--nb-bar); }
  #win-wallet .win-body { padding: 8px calc(14px + env(safe-area-inset-right)) 8px 14px; }
  /* guide: full screen over everything, so the side insets are its own */
  #win-guide .win-body.gv { padding-left: calc(12px + env(safe-area-inset-left)); padding-right: calc(12px + env(safe-area-inset-right)); }
  #win-guide .win-head { padding-left: calc(12px + env(safe-area-inset-left)); padding-right: calc(10px + env(safe-area-inset-right)); }

  /* Runner: name + stats left, the six critters right (whole figures) */
  #win-runner .win-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.45fr); grid-template-rows: auto auto minmax(0, 1fr); align-content: start; column-gap: 18px; padding-top: 10px; }
  #win-runner .name-field { grid-column: 1; grid-row: 1; margin: 0; }
  #win-runner .name-field > span { display: none; }
  #win-runner .name-row { flex-wrap: wrap; row-gap: 6px; }
  #win-runner .win-body > h3:nth-of-type(1) { display: none; }
  #win-runner .critters { grid-column: 2; grid-row: 1 / span 3; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; align-self: start; }
  #win-runner .critters button { padding: 4px 4px 6px; }
  #win-runner .critters button img { max-width: min(64px, calc((100vh - var(--nb-bar) - var(--nb-tab) - 110px) / 2)); }
  #win-runner .win-body > h3:nth-of-type(2) { grid-column: 1; grid-row: 2; margin: 12px 0 6px; }
  #win-runner .stats { grid-column: 1; grid-row: 3; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; margin: 0; align-content: start; }

  /* Shop: kinds as icons + kind title in one row, the cards below with name and price */
  #win-shop .win-body.gv { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: 8px 12px; padding: 8px calc(12px + env(safe-area-inset-right)) 8px 12px; }
  #shopKinds { grid-column: 1; grid-row: 1; align-self: center; }
  #shopKinds .gf { width: 40px; height: 38px; padding: 0; }
  #win-shop .g-bar { grid-column: 2; grid-row: 1; min-width: 0; }
  #win-shop .g-shophead { grid-template-columns: auto minmax(0, 1fr); column-gap: 8px; row-gap: 0; }
  #win-shop .g-shophead .gs-k { grid-row: span 2; width: 28px; height: 28px; padding: 4px; }
  #win-shop .g-shophead b { font-size: 13px; }
  #win-shop .g-shophead span:last-child { grid-column: 2; font-size: 11.5px; line-height: 1.25; }
  #shop { grid-column: 1 / -1; grid-row: 2; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
  #shop .gc { padding: 6px 4px 6px; } #shop .gc-art { max-width: 52px; }
  .g-foot { display: none; }

  /* race: the «finding runners» bar sits at the bottom, where the controls hint is; hint waits until the race runs */
  .stage:has(.st-wait:not([hidden])) .st-hint { visibility: hidden; }

}
@media (max-height: 520px) and (orientation: landscape) and (max-width: 700px) {
  .nb-logo .bar-title { font-size: 14px; }
  .nb-seg button i[data-ic] { display: none; }
  #win-board .win-head .rk-live { display: none; }
}

/* ---- Ranking on phones (Marlon 03.12., photos: crown over the pot, steps cut, my row over the podium, «Yester…»):
   one grid instead of stacked boxes. Sideways: pot, places 4+ and my row left, the podium right over the whole height.
   Upright: tabs, pot, podium, list, my row. The podium is a size container: avatars and steps grow and shrink with the
   room it gets (cqh), so nothing overlaps and no step is cut, whatever the browser bars and the text size leave. ---- */
@media (max-width: 560px), (max-height: 560px) and (min-width: 600px) {
  #win-board .win-body.rk-body { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(104px, 1.6fr) minmax(0, 1fr) auto;
    grid-template-areas: "tabs" "hero" "pod" "list" "me"; gap: 8px; overflow: hidden; }
  #win-board .rk-main, #win-board .rk-stage { display: contents; }
  #win-board .rk-tabs { grid-area: tabs; }
  #win-board .rk-tabs button { flex: 1 1 auto; padding: 0 6px; }
  #win-board .rk-hero { grid-area: hero; grid-template-columns: minmax(0, 1fr) auto; }
  #win-board .rk-pot { grid-template-columns: minmax(0, 1fr); }
  #win-board .rk-pv .rk-cnt { font: 700 1.2em/1 "Rajdhani", var(--body); letter-spacing: .01em; } /* a lone 0 in the display font looked like a box */
  #win-board .rk-podium { grid-area: pod; container-type: size; width: auto; height: auto; min-height: 0; align-self: stretch; padding: 24px 2px 0; gap: 6px; }
  #win-board .rk-listbox { grid-area: list; min-height: 0; }
  #win-board .rk-listbox:has(.rk-empty) { min-height: 40px; }
  #win-board .rk-empty { min-height: 36px; padding: 6px 10px; font-size: 12px; }
  #win-board .rk-me { grid-area: me; padding-top: 0; border-top: 0; }
  #win-board .rk-load { grid-column: 1 / -1; grid-row: 2 / -1; }
  #win-board .rk-body:has(.rk-empty) { grid-template-rows: auto auto minmax(104px, 1fr) auto auto; }
  /* podium: sizes from its own height */
  #win-board .rk-pod { gap: 0; }
  #win-board .rk-ava { --a: clamp(26px, calc(78cqh - 64px), 74px); width: calc(var(--a) * .8); height: calc(var(--a) * .8); margin-bottom: 3px; }
  #win-board .rk-pod.p1 .rk-ava { width: var(--a); height: var(--a); }
  #win-board .rk-podium:has(.rk-pp) .rk-ava { --a: clamp(26px, calc(78cqh - 80px), 74px); }
  #win-board .rk-ava::before { inset: -8px; }
  #win-board .rk-crown { top: -19px; width: 24px; height: 20px; }
  #win-board .rk-medal { width: 20px; height: 20px; font-size: 11px; right: -5px; bottom: -5px; }
  #win-board .rk-ghost { font-size: 18px; }
  #win-board .rk-pn { font-size: 12px; line-height: 1.25; } #win-board .rk-pt { font-size: 10.5px; line-height: 1.3; } #win-board .rk-ps { font-size: 11.5px; line-height: 1.3; }
  #win-board .rk-pp { font-size: 10.5px; padding: 0 6px; }
  #win-board .rk-step { height: clamp(6px, 9cqh, 34px); margin-top: 3px; } #win-board .rk-pod.p1 .rk-step { height: clamp(12px, 16cqh, 48px); } #win-board .rk-pod.p2 .rk-step { height: clamp(9px, 12cqh, 40px); }
  @container (max-height: 118px) { #win-board .rk-pt { display: none; } }
  /* rows: rank, critter, name, points, prize */
  #win-board .rk-row { grid-template-columns: 22px 30px minmax(0, 1fr) auto auto; gap: 8px; height: 42px; padding: 0 10px 0 4px; }
  #win-board .rk-row img { width: 30px; height: 30px; }
  #win-board .rk-row .rk-lg, #win-board .rk-row .rk-sc small, #win-board .rk-row .rk-pz.none { display: none; }
  #win-board .rk-row.ghost { grid-template-columns: 22px 30px minmax(0, 1fr); }
  #win-board .rk-me p { margin: 3px 2px 0; font-size: 11px; }
}
@media (max-width: 560px) { #win-board .rk-head { display: none; } } /* upright: the Ranks tab says what this is, the list gets the room */
@media (max-height: 560px) and (min-width: 600px) {
  #win-board .rk-body:has(.rk-empty) { grid-template-rows: auto auto minmax(0, 1fr) auto; }
  #win-board .win-body.rk-body { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr) auto;
    grid-template-areas: "tabs tabs" "hero pod" "list pod" "me pod"; column-gap: 14px; row-gap: 7px; padding-top: 6px; padding-bottom: 8px; }
  #win-board .rk-hero { padding: 6px 10px; gap: 8px; }
  #win-board .rk-pot { grid-template-columns: minmax(0, 1fr); align-items: start; }
  #win-board .rk-pv { font-size: 22px; }
  #win-board .rk-clock { padding: 4px 8px; gap: 6px; } #win-board .rk-clock b { font-size: 14px; } #win-board .rk-clock > svg { width: 20px; height: 20px; }
  #win-board .rk-podium { padding-top: 26px; }
  #win-board .rk-row { height: 38px; }
  #win-board .rk-me p { display: none; }
  #win-board .rk-rule { top: 46px; left: 12px; right: auto; width: min(52%, 420px); }
}

/* ---- Shop (Marlon 03.12.: «was sind das für Blitze? man zahlt mit BLOZ»): the head shows the wBLOZ you pay with (no Sparks, they
   belong to burning in Gear), every kind button has its short name under the icon ---- */
html[data-tab="shop"] #pillWal { visibility: hidden; }
.shop-wb { flex: none; margin-left: auto; min-height: 38px; }
#shopKinds .gf small, .g-filter.kinds .gf small { display: block; max-width: 100%; font: 600 9px/1.1 var(--body); letter-spacing: -.01em; text-transform: none; }
.shop-wb i[data-ic] { width: 20px; height: 20px; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; }
.shop-wb small { display: inline; }
#shopKinds .gf { flex-direction: column; gap: 2px; height: 46px; padding: 0 2px; }
#shopKinds .gf svg { width: 18px; height: 18px; }
@media (max-height: 520px) and (orientation: landscape) {
  #shopKinds .gf { width: 50px; height: 42px; padding: 0 1px; }
  .shop-wb { min-height: 36px; }
}
