/* action.css — shared chrome for the full-screen canvas ARCADE games
   (Rocko's Watch /rockos-watch/, Rocko on a Roll /rocko-on-a-roll/).

   Same page model as the other kids' games: <body class="act rk-land">, a lobby
   section (#view-levels → hero + level cards, like /dash/) and a play section
   (#view-game) — so nav.js tucks the menu behind ☰ Menu and locks the page while
   playing, footer.js / version-check.js add the footer + 🏠 All games pill.
   The play section holds a fixed full-screen canvas stage (#stage) with the
   game's own HUD on top. Load order: styles.css → action.css → landing.css. */

body.act { --c-arcade: #FF3D57; }
body.act [hidden] { display: none !important; }   /* the game toggles HUD / buttons / dialogs with the hidden attr */
body.act main { max-width: 1000px; margin: 0 auto; padding: 0 20px 64px; }

/* ============ lobby ============ */
.act-hero {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 30px; flex-wrap: wrap;
  margin: 26px 0 26px; padding: 34px 36px; border-radius: 26px;
  background: radial-gradient(120% 150% at 100% 0%,
    color-mix(in srgb, var(--c-arcade) 18%, var(--surface)) 0%, var(--surface) 60%);
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.act-hero-art { flex: 0 0 auto; width: 128px; height: 128px; object-fit: contain; }
.act-hero-copy { flex: 1 1 300px; min-width: 0; }
.act-eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  color: #fff; background: var(--c-arcade); padding: 4px 11px; border-radius: 999px; margin: 0 0 12px;
}
.act-hero h1 { font-size: clamp(1.9rem, 4.8vw, 3rem); margin: 0 0 .26em; }
.act-hero .lede { font-size: 1.06rem; font-weight: 700; margin: 0; max-width: 54ch; }

.act-h { font-size: 1.35rem; color: #fff; margin: 30px 0 12px; }
.act-h:first-of-type { margin-top: 0; }

.level-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }
button.level-card { font: inherit; cursor: pointer; padding: 0; }
.level-card {
  display: flex; flex-direction: column; text-align: left; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); color: inherit;
  transition: transform .12s ease, box-shadow .12s ease;
}
.level-card:hover, .level-card:focus-visible { transform: translateY(-3px); box-shadow: var(--shadow-lift); outline: none; }
.level-card.on { box-shadow: 0 0 0 4px #FFC93C, var(--shadow-lift); }
.level-thumb {
  position: relative; display: grid; place-items: center; height: 118px;
  background: var(--thumb, var(--surface-2)); font-size: 2.6rem; letter-spacing: .08em;
}
.level-meta { padding: 12px 16px 16px; display: flex; flex-direction: column; gap: 2px; }
.level-name { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; color: var(--ink); }
.level-tag { color: var(--ink-soft); font-size: .88rem; font-weight: 700; }
.lvbest { font-size: .8rem; font-weight: 800; color: var(--brand-ink); min-height: 1.2em; }
.level-go {
  position: absolute; right: 10px; bottom: 10px; font-family: var(--font-display); font-weight: 700;
  font-size: .85rem; letter-spacing: 0; background: #FFC93C; color: #241454;
  padding: 5px 12px; border-radius: 999px; box-shadow: 0 3px 0 #C98A12;
}

.act-actions { display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: center; margin: 22px 0 6px; }
.act-actions .btn.play { margin: 0 16px; }

/* how-to-play sticker grid (the game's funny callouts, as white cards) */
.callouts { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.callout {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 15px;
  background: var(--surface); color: var(--ink); border-radius: 16px;
  border: 2px solid var(--c, var(--line)); box-shadow: var(--shadow);
}
.callouts .callout:nth-child(odd)  { transform: rotate(-.8deg); }
.callouts .callout:nth-child(even) { transform: rotate(.8deg); }
.callout .ci {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 12px; font-size: 1.3rem;
  display: grid; place-items: center; background: color-mix(in srgb, var(--c, #FFC93C) 22%, #fff);
}
.callout h4 { margin: 0 0 2px; font-family: var(--font-display); font-size: 1rem; color: var(--ink); }
.callout p { margin: 0; font-size: .9rem; font-weight: 600; line-height: 1.4; color: var(--ink-soft); }
.callout b { color: var(--ink); }
.act-fine { margin-top: 24px; }

@media (max-width: 560px) {
  .act-hero { padding: 24px 22px; gap: 16px; }
  .act-hero-art { width: 96px; height: 96px; }
}

/* ============ play: full-screen canvas stage ============ */
/* sits under the ☰ Menu (85) + dropped-down nav (80); the pages' own dialogs sit on top */
#stage {
  position: fixed; inset: 0; z-index: 40; overflow: hidden; background: #0b1220; color: #fff;
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; touch-action: none;
}
#stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
/* the 🏠 All games pill would sit on the game's own bottom-left gauge — ☰ Menu covers it while playing */
body.act.rk-playing .rk-allgames { display: none; }

/* HUD: panels sit below the ☰ Menu / sound row so nothing overlaps */
#stage .hud {
  position: absolute; inset: 0; pointer-events: none; z-index: 5;
  padding: 70px clamp(10px, 2.2vw, 20px) clamp(10px, 2.2vw, 20px);
  display: flex; flex-direction: column; justify-content: space-between;
  font-family: var(--font-display);
}
#stage .hud-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
#stage .hud-bottom { display: flex; align-items: flex-end; }
#stage .gpanel {
  background: rgba(36,20,84,.72); border: 2px solid rgba(255,255,255,.85); border-radius: 16px;
  padding: 8px 14px; box-shadow: 0 0 0 3px rgba(255,201,60,.55), 0 8px 18px rgba(10,4,30,.35);
  backdrop-filter: blur(6px);
}
#stage .lbl { font-size: .7rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #E7DBFF; }
#stage .score { font-size: clamp(22px, 5vw, 34px); font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
#stage .combo { color: #1FD3C3; font-weight: 700; font-size: clamp(14px, 3.2vw, 19px); min-height: 1.2em; }
#stage .wave { color: #FFC93C; font-weight: 700; font-size: clamp(15px, 3.4vw, 20px); text-align: right; }
#stage .dogs { display: flex; gap: 4px; margin-top: 6px; justify-content: flex-end; font-size: clamp(16px, 4vw, 22px); }
#stage .dogs .d { filter: drop-shadow(0 2px 3px rgba(0,0,0,.5)); transition: opacity .2s, transform .2s; }
#stage .dogs .d.gone { opacity: .18; transform: scale(.8); filter: grayscale(1); }

/* the big round thumb button (BARK / ZOOM) */
#stage .thumb-btn {
  position: absolute; right: clamp(14px, 4vw, 28px); bottom: clamp(18px, 5vw, 34px); z-index: 7;
  width: clamp(80px, 20vw, 106px); height: clamp(80px, 20vw, 106px); border-radius: 50%;
  border: 3px solid #fff; color: #241454; font-family: var(--font-display); font-weight: 700;
  font-size: clamp(15px, 4vw, 19px); letter-spacing: .02em; pointer-events: auto; cursor: pointer;
  background: radial-gradient(circle at 38% 32%, #FFE7A0, #FFC93C 70%);
  box-shadow: 0 0 0 4px rgba(36,20,84,.55), 0 10px 24px rgba(0,0,0,.45), inset 0 2px 0 rgba(255,255,255,.6);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  -webkit-tap-highlight-color: transparent; touch-action: none; transition: transform .08s;
}
#stage .thumb-btn:active { transform: scale(.94); }
#stage .thumb-btn.cool { filter: grayscale(.5) brightness(.85); }
#stage .thumb-btn .cd { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(36,20,84,.4); }

/* centre shout ("Wave 3", "BOSS DOWN!") */
#flash { position: absolute; inset: 0; z-index: 6; display: flex; align-items: center; justify-content: center; pointer-events: none; opacity: 0; }
#flash .yell {
  font-family: var(--font-display); font-weight: 700; font-size: clamp(28px, 8vw, 66px);
  text-align: center; color: #fff; white-space: nowrap;
  text-shadow: 0 0 20px rgba(255,201,60,.9), 0 5px 0 #241454;
}
#flash.show { animation: actFlash 1.6s ease; }
@keyframes actFlash { 0% { opacity: 0; transform: scale(.7); } 12% { opacity: 1; transform: scale(1.04); }
  22% { transform: scale(1); } 82% { opacity: 1; } 100% { opacity: 0; } }

#aiBanner {
  position: absolute; left: 50%; bottom: clamp(16px, 4vh, 40px); transform: translateX(-50%); z-index: 9;
  pointer-events: none; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  background: #241454; color: #fff; border: 2px solid #fff; border-radius: 999px; padding: 9px 17px;
  font-family: var(--font-display); font-weight: 600; font-size: .95rem;
  box-shadow: 0 0 0 3px rgba(255,201,60,.9), 0 8px 24px rgba(0,0,0,.45);
  animation: actAi 1.8s ease-in-out infinite;
}
#aiBanner b { color: #FFC93C; }
@keyframes actAi { 0%,100% { opacity: .85; } 50% { opacity: 1; } }

/* top-right game buttons (Pause / Sound), level with the ☰ Menu button */
#stage .topbar { position: absolute; top: 12px; right: 12px; z-index: 12; display: flex; gap: 8px; }
#stage .tb-btn {
  height: 46px; padding: 0 14px; border-radius: 14px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-display); font-weight: 700; font-size: .95rem; color: #fff;
  background: #241454; border: 2px solid #fff; box-shadow: 0 0 0 3px rgba(255,201,60,.95), 3px 4px 0 rgba(20,10,50,.4);
  transform: rotate(2deg); -webkit-tap-highlight-color: transparent;
}
#stage .tb-btn:active { transform: rotate(2deg) translateY(1px); }

/* ============ dialogs: pause / game over / top dogs (site win-card look) ============ */
.act-dlg {
  position: absolute; inset: 0; z-index: 10; display: flex; overflow-y: auto; padding: 70px 18px 24px;
  background: rgba(24,10,64,.62); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  -webkit-user-select: text; user-select: text; touch-action: auto;
}
.act-dlg.fixed { position: fixed; z-index: 90; }
.act-dlg[hidden] { display: none; }
.act-dlg .win-card {
  margin: auto; width: 100%; max-width: 440px; text-align: center;
  background: var(--surface); color: var(--ink); border-radius: 22px; padding: 26px 24px 24px;
  box-shadow: 0 24px 70px rgba(0,0,0,.4); animation: actPop .3s ease both;
}
.act-dlg.wide .win-card { max-width: 620px; }
@keyframes actPop { 0% { transform: scale(.92); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.act-dlg .win-rocko { width: 104px; height: 104px; object-fit: contain; animation: actWag 1s ease-in-out infinite alternate; }
@keyframes actWag { from { transform: rotate(-5deg); } to { transform: rotate(5deg); } }
.act-dlg h2 { font-size: 1.8rem; margin: 4px 0 8px; }
.act-dlg .kicker { font-family: var(--font-display); font-weight: 600; color: var(--brand-ink); margin: 0 0 4px; }
.act-dlg .lbl, #stage .act-dlg .lbl { font-size: .72rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); }
.act-dlg .final { font-family: var(--font-display); font-weight: 700; font-size: clamp(40px, 11vw, 64px); line-height: 1.05; color: var(--brand-ink); font-variant-numeric: tabular-nums; }
.act-dlg .newhi { color: #1E9E57; font-weight: 800; margin-top: 4px; }
.act-dlg .presume { color: var(--ink-soft); font-weight: 700; margin: 16px 0 0; }
.act-dlg .callouts { text-align: left; margin-top: 10px; }
.act-actions-col { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; align-items: stretch; }
.act-actions-col .btn { justify-content: center; }
.act-actions-col .btn.play { margin: 0 16px; }

/* local top-5 list */
.board { margin: 16px auto 0; max-width: 320px; text-align: left; }
.board h3 { font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); margin: 0 0 8px; text-align: center; }
.board ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.board li { display: flex; justify-content: space-between; font-weight: 700; font-variant-numeric: tabular-nums;
  background: var(--surface-2); border: 1.5px solid var(--line); border-radius: 12px; padding: 7px 12px; }
.board li.you { border-color: #FFC93C; background: #FFF6DA; }
.board li .rk { color: var(--ink-soft); width: 2ch; }
.board li .in { font-family: var(--font-display); letter-spacing: .14em; flex: 1; padding: 0 12px; }
.board li .sc { color: var(--brand-ink); }
.board-note { font-size: .78rem; font-weight: 700; color: var(--ink-soft); margin: 8px 0 0; text-align: center; }

.initials { display: flex; gap: 10px; justify-content: center; margin: 10px 0 0; }
.initials input {
  width: 58px; height: 70px; text-align: center; font-family: var(--font-display); font-size: 38px; font-weight: 700;
  color: var(--ink); background: var(--surface-2); border: 2px solid var(--line); border-radius: 14px;
  text-transform: uppercase; caret-color: var(--brand);
}
.initials input:focus { outline: 3px solid #FFC93C; outline-offset: 1px; background: #fff; }

@media (prefers-reduced-motion: reduce) {
  .act-dlg .win-card, .act-dlg .win-rocko, #aiBanner { animation: none; }
}
