/* Share rail (docs/ai/game.md "Share rail"): Facebook, Reddit, Threads and X at the inline-start edge
   Only a top-level window shows it (html.share-top comes from a <head> script, so frames never flash it)
   Wide windows with a free side margin get the vertical rail, every other window a handle that opens the same links
   Nothing here moves the page: the rail and the handle are fixed, no padding or gutter is added for them.
   The handle is a clear tab, 40 to 44 px wide and 56 px tall with a 20 px icon (owner 2026-10-25: bigger on phones) */
.share-rail{display:none;--share-bw:3px;--share-icon:20px;--share-r:24px}
html.share-top .share-rail{display:block;position:fixed;z-index:28;inset-inline-start:env(safe-area-inset-left,0px);top:calc(50% - 28px);width:44px;height:56px}
/* Content pages scroll, so the handle sits at mid height and the card column passes under it (the header stays
   above it at every scroll). The column is min(1000px, 100% - 64px) wide and centred, and 100% of a fixed box is
   the window without its scrollbar: the tab is the gutter minus 2 px, at least 40 px and 44 px where the gutter
   holds it (from a 1092 px wide page). Phones (12 px gutter) and the 32 px gutter get 40 px over the card edge */
html.share-top .share-rail--content{width:clamp(40px,(100% - 1000px) / 2 - 2px,44px)}
/* The game's edges are busy: the handle sits under the header and the start screen is the only place it shows */
html.share-top .share-rail--game{top:var(--share-top,86px)}
html.share-top #app:not([data-screen=start])~.share-rail,
html.share-top.share-room .share-rail,
html.share-top.share-scrolled .share-rail--game,
html.share-top body:has(dialog[open]) .share-rail{display:none}
.share-handle{display:grid;place-items:center;width:100%;height:56px;padding:0;background:#fff;color:var(--ink);border:var(--share-bw) solid var(--ink);border-inline-start:0;border-radius:0;border-start-end-radius:var(--share-r);border-end-end-radius:var(--share-r);box-shadow:0 3px #1b2a6b33,0 6px 16px #1b2a6b44}
.share-handle[aria-expanded=true]{background:#ddd9ff}
.share-links{display:none;flex-direction:column;gap:8px;position:absolute;inset-inline-start:calc(100% + 8px);top:50%;translate:0 -50%;margin:0;padding:8px;list-style:none;background:#f4f0ff;border:3px solid var(--ink);border-radius:30px;box-shadow:0 5px #1b2a6b44}
.share-rail--game .share-links{top:0;translate:none}
.share-rail[data-open] .share-links{display:flex}
.share-link{display:grid;place-items:center;width:44px;height:44px;border:3px solid var(--ink);border-radius:50%;background:#fff;color:var(--ink);box-shadow:0 3px #1b2a6b33;text-decoration:none}
.share-link svg{display:block;width:22px;height:22px}
.share-handle svg{display:block;width:var(--share-icon);height:var(--share-icon);margin-inline-end:var(--share-nudge,2px)}
/* Network colour only on hover and focus */
.share-link:hover,.share-link:focus-visible{background:var(--share-brand);color:#fff}
.share-link[data-network=facebook]{--share-brand:#1877f2}
.share-link[data-network=reddit]{--share-brand:#ff4500}
.share-link[data-network=threads],.share-link[data-network=x]{--share-brand:#000}
@media(prefers-reduced-motion:no-preference){
  .share-link,.share-handle{transition:background-color .15s,color .15s}
  .share-rail[data-open] .share-links{animation:share-open .14s ease-out}
}
@keyframes share-open{from{opacity:0;scale:.94}}
/* Defaults for the game handle until web/js/share.js measures the header */
@media(max-width:1023px){html.share-top .share-rail--game{top:var(--share-top,calc(max(17px,env(safe-area-inset-top)) + 54px))}}
@media(max-width:1023px) and (orientation:landscape) and (max-height:650px){html.share-top .share-rail--game{top:var(--share-top,66px)}}
@media(max-width:600px) and (orientation:portrait){html.share-top .share-rail--game{top:var(--share-top,calc(max(6px,env(safe-area-inset-top)) + 54px))}}
/* Content pages: the 1000 px column leaves a free margin for the full rail from 1180 px */
@media(min-width:1180px) and (min-height:420px){
  html.share-top .share-rail--content{inset-inline-start:calc(16px + env(safe-area-inset-left,0px));top:50%;translate:0 -50%;width:auto;height:auto}
  .share-rail--content .share-handle{display:none}
  .share-rail--content .share-links{display:flex;position:static;translate:none;padding:0;gap:10px;background:none;border:0;box-shadow:none;animation:none}
}
/* Game start screen: the planet leaves a free margin once the window is wide for its height */
@media(min-width:1200px) and (min-aspect-ratio:3/2) and (min-height:420px){
  html.share-top .share-rail--game{inset-inline-start:calc(16px + env(safe-area-inset-left,0px));top:50%;translate:0 -50%;width:auto;height:auto}
  .share-rail--game .share-handle{display:none}
  .share-rail--game .share-links{display:flex;position:static;translate:none;padding:0;gap:10px;background:none;border:0;box-shadow:none;animation:none}
}
@media print{.share-rail{display:none!important}}
