/* Arcade start/pause overlay + versus race bar (ARCADE agent). Builds on mp.css (.np-mp-*) and site tokens. */

/* Board overlay (Start / Paused / race countdown / result), rendered inside #snake-board / #tetris-board */
.np-arc-ov { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; padding: 12px;
  background: rgba(10, 12, 28, .62); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); cursor: pointer; text-align: center; }
.np-arc-ov.is-count { background: rgba(10, 12, 28, .35); cursor: default; }
.np-arc-ov-box { display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: 92%; color: #fff; }
.np-arc-ov-big { font: 800 clamp(34px, 9cqw, 64px)/1 var(--font-display, system-ui); color: var(--volt, #d4ff3a); text-shadow: 0 4px 24px rgba(0,0,0,.45); letter-spacing: -.02em; }
.np-arc-ov-t { font: 750 clamp(18px, 4.2cqw, 26px)/1.1 var(--font-display, system-ui); color: #fff; }
.np-arc-ov-s { font-size: 14px; line-height: 1.35; color: rgba(255,255,255,.82); }
.np-arc-ov-btn { min-width: 130px; margin-top: 4px; }
.np-arc-ov-h { font-size: 12px; color: rgba(255,255,255,.6); }
@media (pointer: coarse) { .np-arc-ov-h { display: none; } }

/* Live race panel */
.np-race-live { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.np-race-side { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; padding: 6px; border-radius: var(--r-sm, 10px); transition: background .2s; }
.np-race-side.is-lead { background: var(--accent-soft, #eaf8c9); }
.np-race-side.is-out { opacity: .55; }
.np-race-side.is-opp { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "chip mini" "score mini"; justify-items: center; align-items: center; column-gap: 10px; }
.np-race-side.is-opp .np-mp-chip { grid-area: chip; }
.np-race-side.is-opp .np-race-score { grid-area: score; }
.np-race-score { display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.np-race-score b { font: 800 22px/1 var(--font-display, system-ui); color: var(--text, #12142a); font-variant-numeric: tabular-nums; }
.np-race-score span { font-size: 12px; color: var(--text-dim, #565a72); }
.np-race-mid { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.np-race-clock { font: 800 26px/1 var(--font-display, system-ui); font-variant-numeric: tabular-nums; padding: 6px 12px; border-radius: 999px;
  background: var(--ink, #0e1020); color: var(--volt, #d4ff3a); }
.np-race-clock.is-low { color: #ff6b6b; }
.np-race-title { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted, #8a8da3); }
.np-race-mini { grid-area: mini; display: block; border-radius: 6px; box-shadow: 0 0 0 2px var(--ink, #0e1020); image-rendering: pixelated; }
.np-race-mini.np-race-tetris { width: 50px; height: 100px; }
.np-race-mini.np-race-snake { width: 80px; height: 80px; }
.np-race-foot { justify-content: space-between !important; }
.np-race-status { font-size: 13px; font-weight: 600; color: var(--text-dim, #565a72); }
.np-race-fs { font: 800 20px/1 var(--font-display, system-ui); font-variant-numeric: tabular-nums; color: var(--text, #12142a); }
.np-race-xp { display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: 999px; background: var(--volt, #d4ff3a); color: var(--volt-ink, #0e1020); font-size: 12px; font-weight: 800; }
.np-race-side .np-mp-name a { color: inherit; text-decoration: none; }

@media (max-width: 560px) {
  .np-race-live { grid-template-columns: 1fr auto 1fr; gap: 6px; }
  .np-race-side.is-opp { grid-template-columns: 1fr; grid-template-areas: "chip" "score" "mini"; row-gap: 4px; }
  .np-race-clock { font-size: 20px; padding: 5px 9px; }
  .np-race-score b { font-size: 18px; }
  .np-race-mini.np-race-tetris { width: 36px; height: 72px; }
  .np-race-mini.np-race-snake { width: 60px; height: 60px; }
  .np-race-bar .np-mp-chip { padding: 3px 7px 3px 3px; font-size: 12px; }
  .np-race-bar .np-mp-av { width: 22px; height: 22px; font-size: 12px; }
}

/* Phones: compact single-line race bar (no one-word-per-line wrapping in narrow containers) */
.np-race-bar .np-race-status, .np-race-score span, .np-race-bar .np-mp-name, .np-race-bar .np-mp-meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.np-race-live, .np-race-side, .np-race-foot { min-width: 0; }
.np-race-status { flex: 1 1 0; }
@media (max-width: 560px), (max-height: 500px) {
  .np-race-title { display: none; }
  .np-race-bar .np-mp-panel { padding: 6px 8px; gap: 6px; }
  .np-race-foot { flex-wrap: nowrap; }
  .np-race-status { font-size: 12px; }
  .np-race-bar .np-mp-meta { display: none; }
}

/* Opponent HUD (np-hud.js): thin strip pinned inside the top of the board during a duel / race.
   .game-area.np-hud-on reserves the room (padding), so the strip never covers tiles or cards. */
.game-area.np-hud-on { padding-top: 46px !important; }
.np-hud { position: absolute; top: 5px; left: 6px; right: 6px; z-index: 18; color: #fff; font-family: var(--font-body, system-ui);
  background: rgba(14, 16, 32, .86); border-radius: 12px; box-shadow: 0 2px 10px rgba(0,0,0,.18); transition: background .2s, box-shadow .2s;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); will-change: transform; }
:root[data-theme="dark"] .np-hud { background: rgba(35, 40, 72, .9); box-shadow: 0 0 0 1px rgba(255,255,255,.08), 0 2px 10px rgba(0,0,0,.3); }
.np-hud.is-float { background: rgba(14, 16, 32, .74); box-shadow: 0 6px 20px rgba(0,0,0,.28); }
.np-hud-row { display: flex; align-items: center; gap: 7px; height: 36px; padding: 0 4px 0 5px; min-width: 0; }
.np-hud-chip { position: relative; flex: none; display: inline-flex; }
.np-hud-av { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--ink-3, #232848); color: #fff; font-size: 13px; font-weight: 800; }
.np-hud .np-mp-bubble { bottom: auto; top: calc(100% + 8px); left: 0; transform: none; z-index: 26; max-width: 240px; white-space: normal; font-size: 12.5px; }
.np-hud .np-mp-bubble::after { top: auto; bottom: 100%; left: 13px; border-top-color: transparent; border-bottom-color: var(--ink, #0e1020); }
.np-hud .np-mp-bubble.is-in { animation-name: np-mp-pop2; }
.np-hud-who { display: flex; flex-direction: column; min-width: 0; flex: 0 1 112px; line-height: 1.15; }
.np-hud-name { display: flex; align-items: center; gap: 5px; min-width: 0; font-size: 12px; }
.np-hud-name b { font-weight: 750; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.np-hud-name a { color: inherit; text-decoration: none; }
.np-hud-live { flex: none; width: 7px; height: 7px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 0 rgba(34,197,94,.6); animation: np-hud-live 1.8s ease-out infinite; }
.np-hud-live.is-off { background: #8a8da3; animation: none; }
@keyframes np-hud-live { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.55); } 70%, 100% { box-shadow: 0 0 0 6px rgba(34,197,94,0); } }
.np-hud-txt { font-size: 12px; font-weight: 800; color: var(--volt, #d4ff3a); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.np-hud-bars { flex: 1 1 60px; min-width: 34px; display: flex; flex-direction: column; gap: 4px; }
.np-hud-bar { position: relative; display: block; height: 6px; border-radius: 999px; background: rgba(255,255,255,.14); overflow: hidden; }
.np-hud-bar i { display: block; height: 100%; width: 0; border-radius: inherit; transition: width .6s cubic-bezier(.2,.8,.2,1); }
.np-hud-bar.is-them i { background: #f97316; }
.np-hud-bar.is-you i { background: var(--volt, #d4ff3a); }
.np-hud-bar.is-ping { animation: np-hud-ping .9s ease-out; }
@keyframes np-hud-ping { 0% { box-shadow: 0 0 0 0 rgba(249,115,22,.9); } 100% { box-shadow: 0 0 0 5px rgba(249,115,22,0); } }
.np-hud-lead { flex: none; font-size: 11.5px; font-weight: 800; padding: 3px 7px; border-radius: 999px; white-space: nowrap; font-variant-numeric: tabular-nums; background: rgba(255,255,255,.12); }
.np-hud-lead em { font-style: normal; font-weight: 700; }
.np-hud-lead.is-up { background: rgba(34,197,94,.22); color: #86efac; }
.np-hud-lead.is-down { background: rgba(249,115,22,.22); color: #fdba74; }
.np-hud-clock { flex: none; font: 800 14px/1 var(--font-display, system-ui); font-variant-numeric: tabular-nums; color: var(--volt, #d4ff3a); min-width: 34px; text-align: right; }
.np-hud-clock.is-low { color: #ff6b6b; }
.np-hud-mini, .np-hud-tog { flex: none; appearance: none; border: 0; padding: 0; margin: 0; cursor: pointer; color: #fff; background: transparent; touch-action: manipulation; }
.np-hud-mini { display: inline-flex; border-radius: 5px; box-shadow: 0 0 0 1px rgba(255,255,255,.22); overflow: hidden; }
.np-hud-mini canvas { display: block; image-rendering: pixelated; }
.np-hud-tog { width: 26px; height: 28px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; background: rgba(255,255,255,.1); }
.np-hud-tog:hover, .np-hud-mini:hover { background-color: rgba(255,255,255,.2); }
.np-hud.is-out .np-hud-txt { color: #fca5a5; }
.np-hud.is-flash { animation: np-hud-flash 1.2s ease-out; }
@keyframes np-hud-flash { 0%, 30% { background: rgba(249,115,22,.95); } 100% { background: rgba(14,16,32,.86); } }
.np-hud-msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; border-radius: inherit; padding: 0 40px;
  font: 800 14px/1.1 var(--font-display, system-ui); text-align: center; background: rgba(14,16,32,.92); color: #fff; pointer-events: none; animation: np-hud-msg 2.8s ease forwards; }
.np-hud-msg.is-fin { background: rgba(249,115,22,.95); }
.np-hud-msg[hidden] { display: none; }
@keyframes np-hud-msg { 0% { opacity: 0; } 8%, 85% { opacity: 1; } 100% { opacity: 0; } }
.np-hud-pop { position: absolute; top: calc(100% + 6px); right: 0; z-index: 27; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px; border-radius: 12px; background: rgba(14,16,32,.95); color: #fff; box-shadow: 0 10px 30px rgba(0,0,0,.35); max-width: calc(100% - 4px); }
.np-hud-pop[hidden] { display: none; }
.np-hud-pop-h { font-size: 12px; font-weight: 800; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.np-hud-pop canvas { display: block; border-radius: 6px; image-rendering: pixelated; max-width: 100%; height: auto; }
.np-hud-pop-cap { font-size: 12px; font-weight: 700; color: rgba(255,255,255,.8); text-align: center; max-width: 190px; line-height: 1.3; }
.np-hud-pop-cap:empty { display: none; }
/* collapsed: a small pill in the top-right corner (a slimmer reserved row, so it never sits on a tile) */
.game-area.np-hud-pill { padding-top: 32px !important; }
.np-hud.is-min { left: auto; right: 6px; top: 4px; border-radius: 999px; background: rgba(14,16,32,.72); cursor: pointer; }
.np-hud.is-min .np-hud-row { height: 24px; gap: 5px; padding: 0 1px 0 2px; }
.np-hud.is-min .np-hud-who, .np-hud.is-min .np-hud-bars, .np-hud.is-min .np-hud-mini { display: none; }
.np-hud.is-min .np-hud-av { width: 20px; height: 20px; font-size: 10px; }
.np-hud.is-min .np-hud-lead { padding: 2px 6px; font-size: 11px; }
.np-hud.is-min .np-hud-lead em { display: none; }
.np-hud.is-min .np-hud-clock { font-size: 12px; min-width: 0; }
.np-hud.is-min .np-hud-tog { width: 20px; height: 20px; border-radius: 50%; }
.np-hud.is-min .np-hud-msg { padding: 0 8px; font-size: 11px; }
/* above the board pieces (mahjong tiles / cards use big z-indexes) while floating or showing the preview;
   the in-board start / result cards still sit above the strip */
.np-hud.is-pop, .np-hud.is-float { z-index: 1000; }
.game-area.np-mm-wait > .np-hud, .game-area.np-res-on > .np-hud { z-index: 18; }
.game-area.np-mm-wait > .np-hud { opacity: .55; }
@container board (max-width: 430px) {
  .np-hud-lead em { display: none; }
  .np-hud-row { gap: 5px; }
  .np-hud-who { flex-basis: 96px; }
}
@container board (max-width: 330px) {
  .np-hud-who { flex-basis: 74px; }
  .np-hud-clock { font-size: 13px; min-width: 30px; }
}
@container board (max-width: 290px) { /* very narrow boards: the lead chip carries the comparison */
  .np-hud-bars { display: none; }
  .np-hud-who { flex: 1 1 auto; }
}
@container board (max-width: 250px) { .np-hud-mini { display: none; } }
@media (max-height: 500px) and (max-width: 1000px) and (orientation: landscape) {
  .game-area.np-hud-on { padding-top: 36px !important; }
  .np-hud { top: 3px; border-radius: 10px; }
  .np-hud-row { height: 30px; }
  .np-hud-av { width: 22px; height: 22px; font-size: 11px; }
  .np-hud-who { line-height: 1.05; }
  .np-hud-tog { height: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .np-hud-live, .np-hud.is-flash, .np-hud-bar.is-ping, .np-hud-msg { animation: none; }
  .np-hud-bar i { transition: none; }
}
