/* =============================================================
   Playwithspect — /cardportal styles
   Retro-comic brand language, matched to the main "the box" site.
   Palette + fonts mirror src/styles.css and src/config.js THEME.
   ============================================================= */

@font-face {
  /* Display / comic title font (Safe fallback to bold Inter if missing). */
  font-family: "Mabook";
  src: url("../../asset/Mabook.ttf") format("truetype");
  font-display: swap;
}

:root {
  --pws-yellow: #ffcc00;
  --pws-cyan: #00c1ff;
  --pws-pink: #ff5cc8;
  --pws-green: #3dff7a;
  --ink: #1a1a1a;
  --paper: #fff;
  --card-radius: 20px;
  --hard-shadow: 0 6px 0 rgba(0, 0, 0, 0.85);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--pws-yellow);
  font-family: "Inter", "Helvetica Neue", Arial, "PingFang TC", "Microsoft JhengHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  color: var(--ink);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.title-font {
  font-family: "Mabook", "Inter", sans-serif;
  font-weight: 800;
}

/* ---------------- Game stage ---------------- */
.stage {
  position: fixed;
  inset: 0;
  display: block;
}

.game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* ---------------- HUD ---------------- */
.hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: max(14px, env(safe-area-inset-top)) 16px 0;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.hud.is-visible {
  opacity: 1;
}

.hud__pips {
  display: flex;
  gap: 6px;
}

.hud__pip {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 3px solid var(--ink);
  background: rgba(255, 255, 255, 0.55);
  box-shadow: var(--hard-shadow);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s ease;
}

.hud__pip.is-on {
  background: var(--pws-cyan);
  transform: scale(1.15);
}

/* ---------------- Loading screen ---------------- */
.loader {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  /* Brand yellow backdrop. */
  background: var(--pws-yellow);
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loader.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Spinning black hole rendered as a neon sign: the shape itself
   cycles brand colours and glows (CSS mask over an animated gradient),
   mirroring the main landing's neon logo treatment. */
.loader__blackhole {
  width: min(180px, 50vw);
  aspect-ratio: 1 / 1;
  background: conic-gradient(
    from 0deg,
    var(--pws-cyan),
    var(--pws-yellow),
    var(--pws-pink),
    var(--pws-green),
    var(--pws-cyan)
  );
  -webkit-mask: url("../blackhole.svg") center / contain no-repeat;
  mask: url("../blackhole.svg") center / contain no-repeat;
  animation: spin 3s linear infinite reverse, neon-hue 4s linear infinite;
  filter:
    drop-shadow(0 0 4px #fff)
    drop-shadow(0 0 12px var(--pws-cyan))
    drop-shadow(0 0 26px var(--pws-cyan))
    drop-shadow(0 0 48px rgba(0, 193, 255, 0.9));
}

@keyframes neon-hue {
  to {
    filter:
      drop-shadow(0 0 4px #fff)
      drop-shadow(0 0 12px var(--pws-cyan))
      drop-shadow(0 0 26px var(--pws-cyan))
      drop-shadow(0 0 48px rgba(0, 193, 255, 0.9))
      hue-rotate(360deg);
  }
}

/* ---------------- Victory screen ---------------- */
.victory {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(255, 204, 0, 0.96);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

.victory.is-visible {
  opacity: 1;
  visibility: visible;
}

.victory__flash {
  position: fixed;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
}

.victory__flash.is-flashing {
  animation: flash 0.6s ease-out forwards;
}

.victory__card {
  position: relative;
  width: min(420px, 92vw);
  text-align: center;
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: var(--card-radius);
  padding: 28px 24px 24px;
  box-shadow: 0 10px 0 rgba(0, 0, 0, 0.85), 0 20px 40px rgba(0, 0, 0, 0.3);
  transform: translateY(16px) scale(0.96);
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.victory.is-visible .victory__card {
  transform: translateY(0) scale(1);
}

.victory__title {
  font-family: "Mabook", "Inter", sans-serif;
  font-weight: 800;
  font-size: clamp(40px, 14vw, 64px);
  line-height: 0.95;
  letter-spacing: 0.02em;
  color: var(--pws-yellow);
  -webkit-text-stroke: 3px var(--ink);
  text-shadow: 4px 4px 0 var(--ink);
  margin: 4px 0 12px;
}

.victory__lead {
  font-family: "Mabook", "Inter", sans-serif;
  font-weight: 800;
  font-size: clamp(20px, 6vw, 26px);
  line-height: 1.1;
  margin-bottom: 22px;
}

.victory__btn {
  display: inline-block;
  width: 100%;
  padding: 14px 18px;
  font-family: "Mabook", "Inter", sans-serif;
  font-weight: 800;
  font-size: clamp(22px, 7vw, 28px);
  letter-spacing: 0.02em;
  color: var(--ink);
  text-decoration: none;
  background: var(--pws-yellow);
  border: 4px solid var(--ink);
  border-radius: 14px;
  box-shadow: var(--hard-shadow);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.victory__btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.85);
}

/* ---------------- Keyframes ---------------- */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.12);
  }
}

@keyframes flash {
  0% {
    opacity: 0;
  }
  30% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}
