/* ==========================================================================================
   W75 (0.9.6) - BIG SCREENS: THE PLAY COLUMN.            docs/notes/W75-android.md
   ------------------------------------------------------------------------------------------
   Cape Clash is a portrait phone game. Tablets, unfolded foldables, Chromebooks, desktop
   windows and split-screen can hand it a window that is wide or even landscape (Android 16
   ignores an app's portrait lock on every sw600dp+ screen, and Google Play asked for exactly
   that), so on any window wider than the game the WHOLE game - every screen, the battle, every
   card and overlay - stays one portrait PLAY COLUMN in the middle, and the sides get a comic
   backdrop in the game's own colours: ink, a gold sunburst, halftone dots and two big
   onomatopoeia. Nothing is stretched and nothing is scaled; the column is the same 460 CSS px
   the battle canvas, the HUD and HOME were already capped at.

   HOW, AND WHY THIS WAY. Every screen and overlay is a position:fixed layer with inset:0. The
   layers are narrowed to the column by their own left/right (below) - NOT by making <body> a
   transformed / contained box: that would move the origin of every position:fixed element, and
   the ~20 effects that place themselves from getBoundingClientRect() (coin flights, POW floats,
   the tour ring, tooltips, the hold-to-peek card) would all land beside their targets. Here the
   viewport stays the coordinate space, so every hit box, drag and effect is exactly where it was.
   Phones never see any of it: the whole file sits behind min-width:540px (a phone in portrait is
   at most ~480 CSS px wide), so at 360x640 / 390x844 / 412x915 the game is the same to the pixel.
   The fight itself never reads the window: it runs in its fixed 552-high sim world
   (npm run determinism:sizes covers the wide sizes too).
   ========================================================================================== */
@media (min-width: 540px) {
  :root {
    --cc-col-w: 460px;                                     /* = #cv / #hud / HOME's max-width */
    --cc-col-x: calc((100vw - var(--cc-col-w)) / 2);       /* the width of each side band */
    /* THE BATTLE on a very tall window (a big monitor on its side, a 1768x2208 foldable in a
       desktop browser): the board world tops out at 360x760, so past ~2.65 column-widths of
       height the canvas would only grow empty bands above and below the board, with the HUD
       and the cards drifting away from it. The battle column is centred at that height instead. */
    --cc-battle-h: calc(var(--cc-col-w) * 2.65);
    --cc-battle-y: max(0px, calc((100vh - var(--cc-battle-h)) / 2));
  }

  /* ---- the backdrop: the whole window behind the column ------------------------------- */
  html {
    background:
      radial-gradient(ellipse 70% 60% at 50% 46%, rgba(255, 210, 63, .10), transparent 70%),
      radial-gradient(ellipse at 50% 50%, transparent 38%, rgba(6, 3, 16, .72) 100%),
      radial-gradient(circle, rgba(196, 186, 240, .13) 1.7px, transparent 2.2px) 0 0 / 18px 18px,
      repeating-conic-gradient(from -4deg at 50% 46%, rgba(255, 210, 63, .075) 0deg 5deg, transparent 5deg 15deg),
      linear-gradient(180deg, #2c2058 0%, #1b1430 52%, #0c0720 100%);
    background-color: #1b1430;
  }
  body { background: transparent; }

  /* the column itself: the game's own ground (ink + the fine dot grid body always had),
     framed like a comic panel - an ink rule, a gold rule and a hard drop shadow */
  body::before {
    content: ''; position: fixed; top: 0; bottom: 0;
    left: var(--cc-col-x); right: var(--cc-col-x); z-index: -1; pointer-events: none;
    background-color: #1b1430;
    background-image: radial-gradient(circle, rgba(255, 255, 255, .07) 1.4px, transparent 1.6px);
    background-size: 14px 14px;
    box-shadow: 0 0 0 3px #0a0618, 0 0 0 6px rgba(255, 210, 63, .78), 14px 0 0 6px rgba(0, 0, 0, .38),
      0 0 60px 10px rgba(0, 0, 0, .55);
  }

  /* ---- every full-window layer becomes a full-COLUMN layer ---------------------------------
     !important because several are written by JS at run time (chestshow .ccs, bosscutin .cci,
     emotes #cemGal, moneyui .muVid) and would otherwise come later in the cascade. Only left and
     right move. THREE layers are deliberately NOT on this list, because code places a child of
     theirs in window coordinates and a moved origin would put it beside its target:
       #gameWrap  - the COACH tab is absolute inside it, placed from its anchor's rect (every
                    battle child is capped at 460 and centred, so the battle IS the column - the one
                    full-width child, the TEAM-UP splash, is narrowed on its own below);
       #capeTour  - the spotlight ring is absolute inside it, placed from the target's rect (its
                    plate and dots row are narrowed to the column below instead);
       #cineWipe  - the comic-panel wipe lays out five panels in vw, so it sweeps the whole window. */
  .screen, #onb, #storyEnd, .alView, #comicView, #swapOv, #netOv, #rewroteOv, #firstPickOv,
  #storyLockOv, #betaWelOv, #betaNotice, #vmOv, #vm2Lead, #finBack, #finTbc, #privOv, #checkinOv,
  #detailOv, #pauseOv, #storyComic, #chestRcpt, #unveil, #adGateOv, #recapOv, #lfOv, #lpOv, #tut,
  #passBanner, .ccScrim, #cineFx, #cineRes, .ccs, .cci, #cemGal, .muVid, #shopScr .backBtn::before {
    left: var(--cc-col-x) !important;
    right: var(--cc-col-x) !important;
  }
  /* the BACK pill hugs the column's corner, not the window's */
  .topBack { left: calc(8px + var(--cc-col-x)); }
  /* the tour: the dim + ring stay window-wide (see above), its plate and dots row sit in the column */
  #tourBox { left: calc(12px + var(--cc-col-x)); right: calc(12px + var(--cc-col-x)); }
  #tourBar { left: var(--cc-col-x); right: var(--cc-col-x); }
  /* a centred story tip is never wider than the column */
  #storyTip { width: min(330px, calc(var(--cc-col-w) - 24px)); }

  /* the battle, centred on a very tall window (see --cc-battle-h): PADDING, not top/bottom, so the
     box keeps its window origin (the coach tab above) while its flex column - HUD, board, cards -
     is squeezed to the battle height. While a battle is up the panel frame follows it, so the fight
     reads as one comic panel on the page (a browser without :has() keeps the full-height column). */
  #gameWrap {
    padding-top: calc(var(--sa-top, env(safe-area-inset-top, 0px)) + var(--cc-battle-y));
    padding-bottom: calc(var(--sa-bottom, env(safe-area-inset-bottom, 0px)) + var(--cc-battle-y));
  }
  body:has(> #gameWrap:not(.hidden))::before { top: var(--cc-battle-y); bottom: var(--cc-battle-y); }

  /* THE TEAM-UP SPLASH (W81, docs/notes/W81-teamup-column.md). The NEW TEAM-UP! band is absolute inside
     #gameWrap with left:0 / right:0, so on a wide window it ran the whole width of the window - one hero's
     half over each side of the backdrop - and, on a very tall one, stayed at the window's top while the
     battle was centred lower down. Here it is the column's width and sits under the HUD + mode strip of the
     centred battle, exactly where it sits on a phone. It WIPES in from the column's left edge instead of
     sliding in from off-screen (a slide would sweep it across the backdrop); the clip reaches 6px below the
     band so its ink drop shadow still shows. Reduced motion keeps its plain fade. pointer-events stay none. */
  #tuSplash {
    left: var(--cc-col-x); right: var(--cc-col-x);
    top: calc(var(--sa-top, 0px) + var(--cc-battle-y) + var(--cc-hud-h, 44px) + var(--cc-strip-h, 44px) + 6px);
    transform: none; clip-path: inset(0 100% -6px 0);
    transition: clip-path .18s ease-out, opacity .16s linear;
  }
  #tuSplash.tuShow { transform: none; clip-path: inset(0 0 -6px 0); }
  #tuSplash.tuReduced { clip-path: none; }
}

/* ---- two big comic words in the bands, once they are wide enough to carry them ---------- */
@media (min-width: 900px) {
  html::before, html::after {
    position: fixed; z-index: -2; pointer-events: none; line-height: .9; white-space: nowrap;
    font-family: 'Bangers', Impact, sans-serif; letter-spacing: 4px;
    font-size: clamp(64px, calc(var(--cc-col-x) * .42), 190px);
    color: rgba(255, 210, 63, .07);
    -webkit-text-stroke: 3px rgba(255, 210, 63, .20);
    text-shadow: 6px 6px 0 rgba(0, 0, 0, .35);
  }
  html::before {
    content: 'POW!'; content: 'POW!' / '';
    left: calc(var(--cc-col-x) / 2); top: 24%;
    transform: translate(-50%, -50%) rotate(-12deg);
  }
  html::after {
    content: 'BAM!'; content: 'BAM!' / '';
    left: calc(100vw - var(--cc-col-x) / 2); top: 72%;
    transform: translate(-50%, -50%) rotate(9deg);
  }
}
