/* SmurfVillage visual fixes, 2026-11-24.
   Loaded last on pages that carry the tinyblue network bar.
   Each block is one fix; remove a block (or this file and its <link>) to undo it.
   Backup of the original pages: /home/papasmurf/k3s/backups/smurfvillage.cloud-20261124/ */

/* Fix 1: Profile Cloud board tabs pushed the page sideways on phones. */
@media (max-width:640px){
  html body .panel-head{flex-wrap:wrap}
  html body .panel-head > div:first-child{flex:1 1 100%;min-width:0}
  html body .panel-actions{width:100%;min-width:0}
  html body .scope-control{max-width:100%;min-width:0;overflow-x:auto;grid-template-columns:repeat(4,minmax(0,auto))}
}

/* Fix 2: give the page room for the floating tinyblue network bar (~70px tall).
   The last content scrolls clear of it, and this site's own floating buttons
   (settings gear, Pokedex Coach) sit above it instead of underneath. */
html{scroll-padding-bottom:110px}
html body{padding-bottom:calc(110px + env(safe-area-inset-bottom,0px)) !important}
html body .sv-settings-btn{bottom:calc(92px + env(safe-area-inset-bottom,0px)) !important}
html body .sv-settings-panel{bottom:calc(152px + env(safe-area-inset-bottom,0px)) !important}
html body #rc-orb{bottom:calc(92px + env(safe-area-inset-bottom,0px)) !important}
@media (min-width:761px){
  html body .rc-panel{bottom:calc(156px + env(safe-area-inset-bottom,0px)) !important}
}

/* Fix 3: on tablet-landscape and small-laptop widths the five-link nav pill
   ran over "Sign in", and "Start playing" wrapped onto two lines.
   Tighten the pill between 901px and 1320px and keep header labels on one line. */
html body .nav-cta,
html body .nav-action-link{white-space:nowrap !important}
/* Side columns never shrink below their content, so the centred pill can't slide over Sign in at any desktop width. */
@media (min-width:901px){
  html body .nav-inner{grid-template-columns:minmax(max-content,1fr) auto minmax(max-content,1fr) !important}
}
@media (min-width:901px) and (max-width:1320px){
  html body .nav-inner{width:calc(100% - 40px) !important;column-gap:14px !important}
  html body .nav-links{gap:2px !important}
  html body .nav-links a:not(.nav-cta){min-width:0 !important;padding:0 13px !important;gap:7px !important;font-size:15px !important}
  html body .nav-links svg{width:17px !important;height:17px !important}
  html body .nav-mob{gap:10px !important}
  html body .nav-cta{padding:0 16px !important}
}
@media (min-width:901px) and (max-width:1100px){
  html body .nav-links{grid-auto-columns:auto !important}
  html body .nav-links svg{display:none !important}
  html body .nav-links a:not(.nav-cta){padding:0 10px !important;font-size:14px !important}
  html body .nav-mob{gap:8px !important}
}

/* Fix 4: the phone menu had no visible close button (the drawer header with the X was hidden).
   Bring back just the X, top right inside the dropdown; the duplicate logo stays hidden. */
html:not(#sv-fix) body .drawer .drawer-head{display:flex !important;position:static !important;min-height:0 !important;max-width:none !important;justify-content:flex-end !important;padding:2px 2px 4px !important;margin:0 !important;border:0 !important;background:none !important;-webkit-backdrop-filter:none !important;backdrop-filter:none !important}
html body .drawer .drawer-head .brand{display:none !important}
html body .drawer .drawer-head .drawer-close{display:inline-grid !important;place-items:center !important;width:40px !important;height:40px !important}
/* Same menu: on About, Gamepad and Legal the "Sign in" row got two icons and its label
   was squeezed into a sliver. Drop the extra generated icon on rows that bring their own. */
html body .drawer-links a:has(.drawer-cell-icon)::before{display:none !important;content:none !important}

/* Fix 5: Home hero on phones. The console picture, the "Featured" pill and the
   "Arcade ready" card sat side by side in a row too narrow for them and overlapped.
   Stack them: picture, then the pill, then the card, each full width. */
@media (max-width:760px){
  html body .hero-art{display:flex !important;flex-direction:column !important;align-items:stretch !important;min-height:0 !important;gap:14px !important}
  html body .hero-art .hero-cart.is-scene{width:100% !important;max-width:560px !important;margin:0 auto !important;transform:none !important}
  html body .hero-art .hero-badge{position:static !important;transform:none !important;align-self:center !important;max-width:100% !important;white-space:normal !important;text-align:center !important}
  html body .hero-art .hero-panel{width:100% !important;max-width:none !important}
}

/* Fix 7: Home "Spotlight" rail. The white cart name sat right on top of the cover's own
   printed title (SNAKE, BREAKOUT) and was hard to read. Give the caption a solid dark
   band so the name always reads cleanly. */
html body .feat-cart .feat-cart-meta{background:linear-gradient(180deg,rgba(8,10,16,.55),rgba(8,10,16,.9)) !important;-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);padding:10px 14px 12px !important}

/* Fix 8: Home game cards in light mode. The "Play" links used pale pastel colours meant
   for the dark theme (light green on white for Game Boy, pale blue for Tetris) and were
   barely visible. Use deeper versions of the same colours when the page is light. */
html[data-theme="light"] body .card.sys-GB  .card-play{color:#23853a !important}
html[data-theme="light"] body .card.sys-GBC .card-play{color:#a35f00 !important}
html[data-theme="light"] body .card.sys-GBA .card-play{color:#7a3fb0 !important}
html[data-theme="light"] body .card.sys-NDS .card-play{color:#c2185b !important}
html[data-theme="light"] body .card.sys-TET .card-play{color:#2c63d1 !important}
@media (prefers-color-scheme: light){
  html:not([data-theme="dark"]) body .card.sys-GB  .card-play{color:#23853a !important}
  html:not([data-theme="dark"]) body .card.sys-GBC .card-play{color:#a35f00 !important}
  html:not([data-theme="dark"]) body .card.sys-GBA .card-play{color:#7a3fb0 !important}
  html:not([data-theme="dark"]) body .card.sys-NDS .card-play{color:#c2185b !important}
  html:not([data-theme="dark"]) body .card.sys-TET .card-play{color:#2c63d1 !important}
}

/* Fix 9: Home "Live leaderboard". (a) The "Contacting SmurfVillage cloud boards..." line
   stayed after the scores loaded. (b) Because that line counted as the first row, the
   medal colours were off by one: rank 1 got a near-white colour and vanished, rank 2 got
   bronze. Hide the loading line once rows exist and colour ranks by their own position. */
html body .al-board .al-empty:has(~ .al-row){display:none !important}
html body .al-board .al-row .al-rank{color:var(--ink-dim) !important}
html body .al-board .al-row:nth-child(1 of .al-row) .al-rank{color:#d39b00 !important}
html body .al-board .al-row:nth-child(2 of .al-row) .al-rank{color:#8a93a6 !important}
html body .al-board .al-row:nth-child(3 of .al-row) .al-rank{color:#c0773e !important}

/* Fix 10: Home section spacing.
   (a) At 721px and up the "at a glance" strip ran edge to edge with no side margin.
   (b) On desktop, "Live session path" and "Player station" were pulled up with negative
       margins and sat on top of the section above them.
   (c) The Arcade Live columns stretched to the tallest one, leaving "Season race" as a
       tall empty card; let each card be its own height. */
@media (min-width:721px){
  html body .stats{max-width:min(1200px, calc(100% - 48px)) !important}
}
@media (min-width:901px){
  html body .session-path{margin-top:0 !important}
  html body .player-dock{margin-top:8px !important}
}
@media (min-width:661px){
  html body .arcade-live-grid{align-items:start !important}
}

/* Fix 11: search boxes.
   (a) Home: the search icon was a tiny glyph floating in the corner of the box.
   (b) The "Ctrl J" keyboard hint showed on phones, where there is no keyboard shortcut.
   (c) Library: the hint sat on its own line under the box, which pushed the Search
       label above the Sort label. Put the hint inside the box on the right instead. */
html body .library-search > span[aria-hidden="true"]:first-child{font-size:20px;line-height:1;display:inline-grid;place-items:center;width:20px}
/* Home's search box was picking up the Library page's stacked label styles (icon on its own
   line, a second border round the input). Keep it one row: icon, input, hint. */
html body:not(.sv-library-page) .library-tools .library-search{display:flex !important;align-items:center !important;gap:10px !important;font-size:15px}
html body:not(.sv-library-page) .library-tools .library-search input{border:0 !important;background:transparent !important;min-height:46px !important;padding:0 !important;box-shadow:none !important;outline:0}
html body:not(.sv-library-page) .library-tools .library-search .sv-palette-kbd{flex:none}
@media (max-width:760px), (hover:none){
  html body .sv-palette-kbd{display:none !important}
}
html body.sv-library-page .library-search{position:relative}
html body.sv-library-page .library-search .sv-palette-kbd{position:absolute;right:14px;bottom:15px;margin:0 !important}
@media (min-width:761px) and (hover:hover){
  html body.sv-library-page .library-search input{padding-right:84px}
}

/* Fix 12: Library game cards.
   (a) The blue "Play" pill had no padding, so "Play" touched (and on some cards ran past)
       its right edge.
   (b) A stretchy row under each title left a big empty gap between the name and the year.
   (c) Covers could sit off-centre in their box.
   (d) On phones the system filter chips showed a desktop scrollbar with arrows. */
html body.sv-library-page #playable .cart{display:flex !important;flex-direction:column !important;gap:0 !important}
html body.sv-library-page #playable .cart strong{min-height:0 !important;margin-top:2px}
html body.sv-library-page #playable .cart small{margin-top:4px}
html body.sv-library-page #playable .cart .play{width:max-content !important;align-items:center !important;margin-top:auto !important;padding:7px 14px 7px 11px !important;min-height:0 !important;border-radius:999px !important;white-space:nowrap}
html body.sv-library-page #playable .cart small + .play{margin-top:auto !important}
html body.sv-library-page #playable .cart small{margin-bottom:12px}
html body.sv-library-page #playable .cart img{object-position:center !important}
html body .library-filters{scrollbar-width:none}
html body .library-filters::-webkit-scrollbar{display:none}

/* Fix 13: Arcade page.
   (a) On phones and tablets the daily-challenge card touched the stat cards below it.
   (b) On desktop the Hall of fame card stretched to match the taller right column and
       ended in a big empty area. */
@media (max-width:1020px){
  html body .hero:has(#daily) + .metrics{margin-top:16px !important}
}
html body .dashboard .stack{align-content:start !important}

/* Fix 14: Pokédex on phones. The four hero stats wrapped 3 + 1, leaving "Carts read"
   alone on its own row. Lay them out as an even 2 x 2 grid. */
@media (max-width:760px){
  html body .dex-agg-stats{display:grid !important;grid-template-columns:repeat(2,minmax(0,1fr)) !important}
  html body .dex-agg-stat{min-width:0}
}

/* Fix 17: Gamepad test page.
   (a) The "< Library | Gamepad test" bar hugged the far left edge on wide screens instead
       of lining up with the content under it (back link now also goes to the Library,
       as its label says, not Home).
   (b) On phones that bar stuck under the header, so two sticky bars ate ~110px. It now
       scrolls away with the page on phones.
   (c) The B and A buttons used the serif display font while the d-pad used sans. */
html body .chrome:has(.chrome-back){padding-left:max(24px, calc((100% - 980px) / 2 + 24px)) !important;padding-right:max(24px, calc((100% - 980px) / 2 + 24px)) !important}
@media (max-width:760px){
  html body .chrome:has(.chrome-back){position:relative !important;top:auto !important}
}
html body .face button{font-family:-apple-system,BlinkMacSystemFont,"SF Pro Text","Helvetica Neue",Arial,sans-serif !important;font-weight:650 !important;font-size:20px !important}

/* Fix 18: Profile page.
   (a) Icons from the shared outline sprite (Player profile, Local, Vault and the account
       rows) rendered as solid black squares and blobs because nothing told them to be
       outlines. Give every sprite icon the outline style the sprite was drawn for.
   (b) The big "Your arcade history." headline was squeezed so tight the letters touched.
   (c) "Scan saves" wrapped onto two lines. */
html body svg:not([fill]):has(> use[href*="glyphs.svg#g-"]){fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
html body h1#profile-title{letter-spacing:-.035em !important}
html body .mini-button{white-space:nowrap}

/* Fix 11 follow-up 2: home search box on phones (arcade-shell.css align-items:end shrank it to the right) */
@media (max-width:760px){
  html body:not(.sv-library-page) .library-tools{align-items:stretch !important}
  html body:not(.sv-library-page) .library-tools .library-search{flex:0 0 auto !important;width:100%;box-sizing:border-box}
}
html body:not(.sv-library-page) .library-tools .library-search input:focus,
html body:not(.sv-library-page) .library-tools .library-search input:focus-visible{outline:0 !important;box-shadow:none !important}
html body:not(.sv-library-page) .library-tools .library-search:focus-within{box-shadow:0 0 0 3px rgba(41,121,255,.28)}

/* Hide server stats in the shared tinyblue bar on this site only (Nick, 2026-11-24): the
   "15/19 · 154 pods · 49 trust" chip and the Pods/Jobs counters in the bar's Infra view. */
/* The bar lives in #tbn-root, attached to <html> outside <body>. */
html #tbn-root #tbn-fleet-chip,
html #tbn-root #tbn-infra-mode .tbn-infra-stat{display:none !important}
