/* R0iceparty shared game feel (2026-10-24): play-first layout, score pops,
   hurt flash, end-of-round card. Paired with /r0iceparty/play/juice.js. */

/* Play first: the game sits right under the nav, the intro moves below it. */
main.shell { display: flex; flex-direction: column; }
main.shell > .section:has(.game-shell) { order: -1; padding: 22px 0 18px; }
main.shell > .game-hero { padding: 28px 0 40px; }
main.shell > .game-hero .hero-copy h1 { font-size: clamp(30px, 4vw, 42px); }

.jz-bar { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; }
.jz-bar h2 { margin: 0; font-size: clamp(22px, 3vw, 30px); line-height: 1.1; }
.jz-bar .jz-keys { display: flex; gap: 6px; flex-wrap: wrap; }
.jz-bar .jz-keys span { font-size: 12px; padding: 4px 9px; border-radius: 999px; background: var(--pill, rgba(255,255,255,.06)); border: 1px solid var(--border, rgba(255,255,255,.08)); color: var(--muted, #abb8c8); }
.jz-bar .jz-sound { margin-left: auto; font: inherit; font-size: 13px; color: var(--text, #eef5ff); background: transparent; border: 1px solid var(--border, rgba(255,255,255,.12)); border-radius: 999px; padding: 6px 12px; cursor: pointer; min-height: 34px; }
.jz-bar .jz-sound[aria-pressed="false"] { color: var(--muted, #abb8c8); }
.jz-bar .jz-sound:focus-visible { outline: 3px solid #f2b544; outline-offset: 2px; }

/* Effects layer over the canvas */
.jz-fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.jz-pop { position: absolute; z-index: 3; pointer-events: none; font-weight: 800; font-size: 26px; color: #ffe08a; text-shadow: 0 2px 0 rgba(0,0,0,.55), 0 0 14px rgba(255,190,80,.55); transform: translate(-50%, -50%); animation: jz-rise 760ms cubic-bezier(.2,.9,.3,1) forwards; white-space: nowrap; }
.jz-pop.big { font-size: 36px; color: #fff3c4; }
.jz-pop.mile { font-size: 30px; color: #8ff7c8; text-shadow: 0 2px 0 rgba(0,0,0,.55), 0 0 16px rgba(80,255,180,.5); }
.jz-pop small { font-size: .6em; margin-left: 4px; color: #ff9f7a; }
@keyframes jz-rise {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(.6); }
  18% { opacity: 1; transform: translate(-50%, -60%) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -190%) scale(1); }
}
.jz-hurt { position: absolute; inset: 0; z-index: 2; pointer-events: none; box-shadow: inset 0 0 90px 20px rgba(255, 40, 60, .75); animation: jz-flash 420ms ease-out forwards; }
@keyframes jz-flash { from { opacity: 1; } to { opacity: 0; } }

.hud-item.jz-up strong { animation: jz-bump 260ms ease-out; color: #ffe08a; }
.hud-item.jz-down strong { animation: jz-bump 300ms ease-out; color: #ff6b7d; }
@keyframes jz-bump { 0% { transform: scale(1); } 35% { transform: scale(1.28); } 100% { transform: scale(1); } }
.hud-item strong { display: inline-block; transition: color 400ms ease; }

/* End-of-round card additions */
.jz-end { margin: 4px 0 14px; display: grid; gap: 8px; }
.jz-end .jz-best { font-size: 30px; font-weight: 800; background: linear-gradient(90deg, #f2b544, #ff8a3d); -webkit-background-clip: text; background-clip: text; color: transparent; animation: jz-bump 520ms ease-out; }
.jz-end .jz-line { margin: 0; color: var(--text, #eef5ff); font-size: 15px; }
.jz-end .jz-line b { color: #ffe08a; }
.jz-end .jz-meter { height: 8px; border-radius: 999px; background: rgba(255,255,255,.1); overflow: hidden; }
.jz-end .jz-meter i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #f2b544, #ff8a3d); transition: width 700ms cubic-bezier(.2,.9,.3,1); }
.jz-end .jz-hint { margin: 0; font-size: 12px; color: var(--muted, #abb8c8); }
.jz-end .jz-hint kbd { font: inherit; padding: 1px 6px; border-radius: 6px; border: 1px solid rgba(255,255,255,.2); }

@media (prefers-reduced-motion: reduce) {
  .jz-pop { animation-duration: 1ms; animation-delay: 0s; opacity: 0; }
  .hud-item.jz-up strong, .hud-item.jz-down strong, .jz-end .jz-best { animation: none; }
  .jz-hurt { animation-duration: 600ms; box-shadow: inset 0 0 40px 6px rgba(255, 40, 60, .5); }
}

/* The end card holds the result, the goal and Play next: give it room. */
.game-overlay .overlay-card:has(.jz-end) { width: min(620px, 94%); max-width: none; max-height: 94%; overflow-y: auto; overscroll-behavior: contain; }
.game-overlay .overlay-card:has(.jz-end) .rp-next-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 560px) { .game-overlay .overlay-card:has(.jz-end) .rp-next-row { grid-template-columns: 1fr; } }
/* Challenge links (?beat=N) */
.jz-chal { display: grid; gap: 2px; margin: 0 0 12px; padding: 10px 14px; border-radius: 14px; border: 1px solid rgba(242,181,68,.45); background: linear-gradient(135deg, rgba(242,181,68,.16), rgba(255,138,61,.1)); text-align: center; }
.jz-chal small { font-size: 12px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted, #abb8c8); }
.jz-chal b { font-size: 24px; background: linear-gradient(90deg, #f2b544, #ff8a3d); -webkit-background-clip: text; background-clip: text; color: transparent; }
.jz-end .jz-vs b { color: #45e6a8; }
.jz-end .jz-share { justify-self: center; min-height: 44px; padding: 0 20px; border-radius: 14px; border: 1px solid rgba(242,181,68,.55); background: rgba(242,181,68,.12); color: #ffe08a; font: inherit; font-weight: 700; cursor: pointer; }
.jz-end .jz-share:hover, .jz-end .jz-share:focus-visible { background: rgba(242,181,68,.24); outline: none; }
.jz-end .jz-link { width: 100%; padding: 8px 10px; border-radius: 10px; border: 1px solid rgba(255,255,255,.2); background: rgba(0,0,0,.3); color: inherit; font: 13px ui-monospace, monospace; }
/* The site theme picker stays a small pill on game pages so it never covers the HUD (phones already do this). */
#r0ice-global-theme-switcher { top: auto !important; bottom: 14px; }
#r0ice-global-theme-switcher:not(.is-open) { width: auto !important; padding: 0 !important; border-radius: 999px !important; opacity: .6; }
#r0ice-global-theme-switcher:not(.is-open):hover { opacity: 1; }
#r0ice-global-theme-switcher:not(.is-open) > :not(.r0ice-theme-toggle) { display: none !important; }
#r0ice-global-theme-switcher .r0ice-theme-toggle { display: block !important; justify-self: end; min-width: 44px; height: 36px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; color: inherit; font: inherit; cursor: pointer; }
#r0ice-global-theme-switcher.is-open .r0ice-theme-toggle { height: 28px; padding: 0 4px; }
.jz-chal .jz-same { display: block; margin-top: 2px; font-size: .78rem; opacity: .8; letter-spacing: 0; text-transform: none; }

/* ===== Play mode (2026-10-25): the game owns the screen, like Poki / CrazyGames.
   Slim top bar (back, name, sound), compact score chips, a 16:9 field sized to the
   viewport, touch pad in its own band under the field, intro below the fold. */
body:has(.game-shell) { background: #07080d; background-image: radial-gradient(1100px 520px at 50% -10%, rgba(120, 90, 255, .16), transparent 70%), radial-gradient(800px 400px at 100% 100%, rgba(255, 138, 61, .08), transparent 70%); background-attachment: fixed; --rp-chrome: 150px; }
body:has(.game-shell) > .bg-nebula, body:has(.game-shell) > .bg-hero-anim, body:has(.game-shell) > .bg-grad, body:has(.game-shell) > .bg-grid, body:has(.game-shell) > .vignette { display: none; }
body:has(.game-shell) > header.nav { display: none; }
body:has(.game-shell) main.shell { width: min(1400px, 100% - 24px); }
main.shell > .section:has(.game-shell) { padding: 8px 0 18px; }
.game-shell { gap: 8px !important; }

.jz-bar { flex-wrap: nowrap; min-height: 48px; gap: 10px; }
.jz-bar h2 { font-size: clamp(18px, 2.4vw, 24px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.jz-bar .jz-back { flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 44px; height: 40px; padding: 0 12px; border-radius: 12px; border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.04); color: #eef5ff; text-decoration: none; font-weight: 700; font-size: 14px; }
.jz-bar .jz-back:hover, .jz-bar .jz-back:focus-visible { border-color: #f2b544; outline: none; }
.jz-bar .jz-back .jz-arrow { font-size: 18px; line-height: 1; }
.jz-bar .jz-keys { flex-wrap: nowrap; overflow: hidden; min-width: 0; }
.jz-bar .jz-sound { flex: none; }

/* Score chips: one tight row instead of big boxes */
.game-shell .game-hud { display: flex !important; flex-wrap: wrap; justify-content: center; gap: 6px !important; }
.game-shell .hud-item { flex: 0 1 auto; gap: 8px; padding: 5px 12px !important; min-height: 32px; border-radius: 999px !important; background: rgba(255,255,255,.05) !important; font-size: 12px !important; text-transform: uppercase; letter-spacing: .06em; color: #9eabc6; }
.game-shell .hud-item strong { font-size: 16px !important; color: #f1f4fb; letter-spacing: 0; font-variant-numeric: tabular-nums; }

/* The field: 16:9, as big as the viewport allows */
.game-shell .canvas-wrap { width: min(100%, calc((100dvh - var(--rp-chrome)) * 16 / 9)); margin: 0 auto; border-radius: 16px; border-color: rgba(255,255,255,.1); box-shadow: 0 30px 80px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.04); background: #05060a; }
.game-shell .canvas-wrap > canvas#gameCanvas { width: 100% !important; height: auto !important; aspect-ratio: 16 / 9; }
.game-shell .game-foot { text-align: center; color: #9eabc6; }
.game-overlay .overlay-card { backdrop-filter: blur(8px); }
.game-overlay .overlay-card .btn.solid { min-height: 50px; padding: 0 28px; font-size: 17px; border-radius: 14px; background: linear-gradient(90deg, #f2b544, #ff8a3d); color: #1a1100; border: 0; box-shadow: 0 10px 30px rgba(255, 138, 61, .35); }

/* Intro and details live under the game, as a calm "about" panel */
main.shell > .game-hero { padding: 26px 0 34px; border-top: 1px solid rgba(255,255,255,.07); }
main.shell > .game-hero .eyebrow { display: none; }

/* Touch: the pad gets its own band under the field, never over it */
@media (hover: none), (pointer: coarse) {
  body:has(.game-shell) { --rp-chrome: 120px; }
  body:has(.touch-controls) { --rp-chrome: 300px; }
  .game-shell .canvas-wrap { overflow: visible; background: transparent; border: 0; box-shadow: none; }
  .game-shell .canvas-wrap > canvas#gameCanvas { border-radius: 14px; border: 1px solid rgba(255,255,255,.1); background: #05060a; }
  .game-shell .canvas-wrap > .game-overlay, .game-shell .canvas-wrap > .jz-fx { border-radius: 14px; }
  .game-shell .touch-controls { position: static !important; display: flex !important; justify-content: space-between; align-items: center; padding: 14px 6px 4px !important; pointer-events: none; }
  .game-shell .touch-dpad { display: grid !important; grid-template-columns: repeat(3, 58px) !important; grid-template-rows: repeat(3, 50px) !important; gap: 4px !important; }
  .game-shell .touch-dpad [data-touch="up"] { grid-area: 1 / 2; }
  .game-shell .touch-dpad [data-touch="left"] { grid-area: 2 / 1; }
  .game-shell .touch-dpad [data-touch="right"] { grid-area: 2 / 3; }
  .game-shell .touch-dpad [data-touch="down"] { grid-area: 3 / 2; }
  .game-shell .touch-btn { width: 58px !important; height: 50px !important; font-size: 0 !important; border-radius: 14px !important; background: rgba(255,255,255,.07) !important; border: 1px solid rgba(255,255,255,.14) !important; touch-action: none; -webkit-user-select: none; user-select: none; position: relative; pointer-events: auto; }
  .game-shell .touch-btn::after { content: ""; width: 0; height: 0; border-left: 9px solid transparent; border-right: 9px solid transparent; border-bottom: 12px solid #eef5ff; }
  .game-shell .touch-btn[data-touch="down"]::after { transform: rotate(180deg); }
  .game-shell .touch-btn[data-touch="left"]::after { transform: rotate(-90deg); }
  .game-shell .touch-btn[data-touch="right"]::after { transform: rotate(90deg); }
  .game-shell .touch-btn:active { background: rgba(242,181,68,.3) !important; }
  /* Action buttons keep their words, big and round */
  .game-shell .touch-btn:not([data-touch="up"]):not([data-touch="down"]):not([data-touch="left"]):not([data-touch="right"]) { font-size: 15px !important; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: #1a1100; background: linear-gradient(135deg, #f2b544, #ff8a3d) !important; border: 0 !important; box-shadow: 0 8px 22px rgba(255,138,61,.35); }
  .game-shell .touch-btn:not([data-touch="up"]):not([data-touch="down"]):not([data-touch="left"]):not([data-touch="right"])::after { display: none; }
  .game-shell .touch-btn.boost, .game-shell .touch-btn.action { width: 96px !important; height: 96px !important; border-radius: 50% !important; }
  .game-shell .touch-row { display: flex; gap: 8px; pointer-events: auto; }
  .game-shell .touch-row .touch-btn { width: 72px !important; height: 72px !important; border-radius: 50% !important; background: rgba(255,255,255,.08) !important; color: #eef5ff; border: 1px solid rgba(255,255,255,.16) !important; box-shadow: none; }
  .jz-bar .jz-keys { display: none; }
  .jz-bar .jz-back span { display: none; }
  .game-shell .game-foot { display: none; }
  .game-shell .hud-item { padding: 4px 10px !important; font-size: 11px !important; }
  .game-shell .hud-item strong { font-size: 15px !important; }
}
/* Phone on its side: pad goes back over the field edges, chrome shrinks */
@media ((hover: none), (pointer: coarse)) and (orientation: landscape) and (max-height: 520px) {
  body:has(.game-shell), body:has(.touch-controls) { --rp-chrome: 96px; }
  .game-shell .canvas-wrap { position: relative; }
  .game-shell .touch-controls { position: absolute !important; inset: auto 0 0 0; padding: 8px !important; opacity: .85; }
  .game-shell .canvas-wrap:has(.game-overlay.is-visible) .touch-controls { display: none !important; }
}
/* Touch: Ready / results become a full-screen sheet over the field, so the card never fights the pad. */
@media (hover: none), (pointer: coarse) {
  .game-shell .canvas-wrap > .game-overlay { position: fixed; inset: 0; z-index: 60; border-radius: 0; padding: 16px; background: rgba(5, 6, 10, .62); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
  .game-shell .canvas-wrap > .game-overlay .overlay-card { width: min(440px, 100%); max-width: none; max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; padding: 26px 20px; border-radius: 22px; background: rgba(14, 17, 27, .96); border: 1px solid rgba(255,255,255,.1); }
  .game-shell .canvas-wrap > .game-overlay .overlay-card h2 { font-size: 30px; margin: 0 0 8px; }
  .game-shell .canvas-wrap > .game-overlay .overlay-card .btn.solid { width: 100%; min-height: 56px; font-size: 18px; }
  main.shell > .section:has(.game-shell) { padding-bottom: 28px; }
}
/* Depth: a soft vignette over every field, under the effects and cards */
.game-shell .canvas-wrap::after { content: ""; position: absolute; left: 0; top: 0; width: 100%; aspect-ratio: 16 / 9; pointer-events: none; z-index: 1; border-radius: 14px; box-shadow: inset 0 0 110px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .06); }
.game-shell .canvas-wrap > .game-overlay { z-index: 5; }
main.shell > .game-hero { background: none; box-shadow: none; }
main.shell > .game-hero::before, main.shell > .game-hero::after { display: none; }
@media (hover: none), (pointer: coarse) {
  .game-shell .touch-row .touch-btn { color: #eef5ff !important; background: rgba(255,255,255,.08) !important; border: 1px solid rgba(255,255,255,.18) !important; box-shadow: none !important; }
  .game-shell .canvas-wrap > .game-overlay { z-index: 60; }
}
