/* ==========================================================================
   BomBocLat
   A retro arcade, done quietly: an orange CRT glow on the charcoal page, a
   pixel face for the HUD only, and the real sprites from the game.
   ========================================================================== */

.theme-bomb {
  --accent: #ff8a00;
  --accent-2: #ffb35c;
  --bomb-deep: #e25f00;
  --bomb-cream: #fff3d6;
  --bomb-red: #e53935;
  --bomb-shadow: rgba(120, 40, 0, 0.55);
  --pixel: "Silkscreen", var(--font-mono);
}

.theme-bomb ::selection {
  background: rgba(255, 138, 0, 0.45);
}

.px {
  font-family: var(--pixel);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

@keyframes spark {
  50% { transform: scale(0.6) rotate(45deg); opacity: 0.7; }
}

@keyframes blink {
  50% { opacity: 0; }
}

/* ── Hero ────────────────────────────────────────────────────────────────── */

.bb-hero {
  position: relative;
  padding-top: calc(var(--nav-h) + 56px);
  overflow: hidden;
  isolation: isolate;
}

.bb-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(45% 55% at 78% 50%, rgba(255, 138, 0, 0.28), transparent 70%),
    radial-gradient(30% 35% at 10% 90%, rgba(229, 57, 53, 0.1), transparent 70%);
}

.bb-hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
  margin-top: 36px;
}

.bb-kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--accent-2);
}

.bb-kicker i {
  width: 8px;
  height: 8px;
  background: var(--accent);
  animation: blink 1.2s steps(1) infinite;
}

.bb-title {
  margin-top: 22px;
  font-size: clamp(52px, 7.4vw, 108px);
  white-space: nowrap;
  font-weight: 800;
  letter-spacing: -0.055em;
  line-height: 0.9;
  color: var(--bomb-cream);
  text-shadow: 0.05em 0.05em 0 var(--bomb-deep), 0.1em 0.1em 0 rgba(120, 40, 0, 0.5);
}

.bb-promise {
  margin-top: 26px;
  font-size: clamp(26px, 3.2vw, 42px);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.12;
}

.bb-promise .dim {
  color: rgba(255, 255, 255, 0.4);
}

.bb-hero .lead {
  margin-top: 22px;
  max-width: 560px;
}

.bb-hero .btn-row {
  margin-top: 32px;
}

.bb-tf {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-2);
  border: 1px dashed var(--line-3);
}

/* The hero art: a phone mid-game, the bomb floating out of it. */
.bb-art {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 560px;
}

.bb-art__halo {
  position: absolute;
  width: 78%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 138, 0, 0.45), rgba(255, 138, 0, 0.1) 60%, transparent);
  filter: blur(10px);
}

.bb-art .phone {
  --pw: clamp(220px, 22vw, 280px);
  transform: rotate(-6deg);
  transition: transform 1s var(--ease-out);
}

.bb-art:hover .phone {
  transform: rotate(-2deg) translateY(-6px);
}

.bb-art__bomb {
  position: absolute;
  right: 4%;
  top: 6%;
  z-index: 3;
  width: clamp(120px, 13vw, 170px);
  animation: bb-float 3.2s var(--ease-in-out) infinite;
}

.bb-art__bomb img {
  width: 100%;
  image-rendering: pixelated;
  filter: drop-shadow(0 20px 0 rgba(120, 40, 0, 0.35));
}

.bb-art__bomb .bomb__spark {
  width: 22px;
  height: 22px;
  background:
    linear-gradient(#fff6c2, #fff6c2) 8px 0 / 6px 22px no-repeat,
    linear-gradient(#fff6c2, #fff6c2) 0 8px / 22px 6px no-repeat;
}

@keyframes bb-float {
  0%, 100% { transform: translateY(0) rotate(8deg); }
  50% { transform: translateY(-14px) rotate(2deg); }
}

.bb-art__hearts {
  position: absolute;
  left: 2%;
  bottom: 12%;
  z-index: 3;
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  animation: bb-float2 4s var(--ease-in-out) infinite;
}

@keyframes bb-float2 {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(10px); }
}

@media (max-width: 900px) {
  .bb-hero__grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .bb-art {
    min-height: 480px;
  }
}

/* Pixel heart, drawn on an 8×7 grid. */
.heart {
  display: inline-block;
  width: 24px;
  height: 21px;
  background: currentColor;
  color: var(--bomb-red);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 7' shape-rendering='crispEdges'%3E%3Cpath d='M1 0h2v1H1zM5 0h2v1H5zM0 1h8v3H0zM1 4h6v1H1zM2 5h4v1H2zM3 6h2v1H3z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 7' shape-rendering='crispEdges'%3E%3Cpath d='M1 0h2v1H1zM5 0h2v1H5zM0 1h8v3H0zM1 4h6v1H1zM2 5h4v1H2zM3 6h2v1H3z'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: color 0.3s, transform 0.5s var(--ease-spring);
}

.heart.is-lost {
  color: rgba(80, 25, 0, 0.45);
  transform: scale(0.8);
}

/* ── Story ───────────────────────────────────────────────────────────────── */

.bb-duo {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: clamp(48px, 6vw, 80px);
}

.bb-duo .card {
  padding: clamp(24px, 3vw, 36px);
}

.bb-duo__tag {
  font-size: 12px;
  color: var(--fg-3);
}

.bb-duo .card:last-child {
  border-color: rgba(255, 138, 0, 0.3);
  background:
    radial-gradient(80% 100% at 100% 0%, rgba(255, 138, 0, 0.14), transparent 60%),
    var(--surface);
}

.bb-duo .card:last-child .bb-duo__tag {
  color: var(--accent-2);
}

.bb-duo h3 {
  margin-top: 16px;
  font-size: clamp(21px, 2vw, 26px);
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.bb-duo p {
  margin-top: 12px;
  color: var(--fg-2);
  line-height: 1.6;
}

@media (max-width: 860px) {
  .bb-duo {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ── The arcade ──────────────────────────────────────────────────────────── */

.arcade {
  position: relative;
  padding: clamp(10px, 1.6vw, 18px);
  border-radius: 34px;
  background: linear-gradient(180deg, #2a2b31, #17181c);
  border: 1px solid var(--line-2);
  box-shadow:
    0 60px 120px -50px rgba(255, 110, 0, 0.45),
    0 30px 60px -30px rgba(0, 0, 0, 0.8),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.arcade__screen {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border-radius: 24px;
  background: radial-gradient(120% 90% at 50% 40%, #ffab45, #ff8a00 50%, #e86a00);
  color: #fff;
  min-height: 460px;
  display: flex;
  flex-direction: column;
}

/* CRT: faint scanlines and a vignette. */
.arcade__screen::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background: repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.06) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
}

.arcade__screen::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  box-shadow: inset 0 0 120px rgba(120, 30, 0, 0.45);
}

.arcade__screen.is-shaking {
  animation: bb-shake 0.5s steps(2) 1;
}

@keyframes bb-shake {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-8px, 4px); }
  40% { transform: translate(7px, -5px); }
  60% { transform: translate(-5px, -3px); }
  80% { transform: translate(4px, 5px); }
  100% { transform: translate(0, 0); }
}

.arcade__flash {
  position: absolute;
  inset: 0;
  z-index: 6;
  background: #fff8e1;
  opacity: 0;
  pointer-events: none;
}

.arcade__flash.is-on {
  animation: bb-flash 0.5s ease-out 1;
}

@keyframes bb-flash {
  0% { opacity: 0.85; }
  100% { opacity: 0; }
}

.arcade__hud {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 20px 24px 0;
}

.hud {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hud--p2 {
  align-items: flex-end;
}

.hud__name {
  font-size: clamp(15px, 1.6vw, 20px);
  text-shadow: 2px 2px 0 var(--bomb-shadow);
}

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

.hud__center {
  font-size: 13px;
  padding: 7px 12px;
  border-radius: 10px;
  background: rgba(120, 40, 0, 0.28);
  text-shadow: 1px 1px 0 var(--bomb-shadow);
}

.arcade__stage {
  position: relative;
  z-index: 1;
  flex: 1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
  padding: 10px clamp(18px, 3vw, 40px) 0;
  min-height: 250px;
}

.fighter {
  width: clamp(76px, 10vw, 128px);
  image-rendering: pixelated;
  filter: drop-shadow(0 12px 0 rgba(120, 40, 0, 0.3));
  transition: transform 0.5s var(--ease-spring);
}

.fighter--p2 {
  transform: scaleX(-1);
}

.fighter.is-holding {
  animation: bb-nervous 0.3s steps(2) infinite;
}

.fighter--p2.is-holding {
  animation-name: bb-nervous-flip;
}

@keyframes bb-nervous {
  50% { transform: translateX(2px); }
}

@keyframes bb-nervous-flip {
  0%, 100% { transform: scaleX(-1); }
  50% { transform: scaleX(-1) translateX(2px); }
}

.fighter.is-hit {
  animation: bb-hit 0.6s steps(3) 1;
}

@keyframes bb-hit {
  0%, 100% { opacity: 1; }
  33% { opacity: 0.2; }
  66% { opacity: 0.8; }
}

.rail {
  position: relative;
  height: 100%;
  min-height: 200px;
}

.rail::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 14px;
  height: 10px;
  background:
    repeating-linear-gradient(90deg, rgba(120, 40, 0, 0.5) 0 6px, transparent 6px 14px),
    linear-gradient(rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0.25)) 0 0 / 100% 2px no-repeat,
    linear-gradient(rgba(120, 40, 0, 0.45), rgba(120, 40, 0, 0.45)) 0 100% / 100% 2px no-repeat;
}

.bomb {
  position: absolute;
  bottom: 20px;
  left: 0;
  width: clamp(64px, 8vw, 96px);
  transform: translateX(0);
  transition: left 0.5s cubic-bezier(0.45, 0, 0.2, 1);
}

.bomb[data-side="1"] {
  left: calc(100% - clamp(64px, 8vw, 96px));
}

.bomb img {
  width: 100%;
  image-rendering: pixelated;
  filter: drop-shadow(0 10px 0 rgba(120, 40, 0, 0.3));
}

.bomb.is-hopping img {
  animation: bb-hop 0.5s cubic-bezier(0.3, 0, 0.3, 1) 1;
}

@keyframes bb-hop {
  0% { transform: translateY(0) rotate(0); }
  50% { transform: translateY(-70px) rotate(180deg); }
  100% { transform: translateY(0) rotate(360deg); }
}

.bomb.is-idle img {
  animation: bb-wobble 1.1s steps(2) infinite;
}

@keyframes bb-wobble {
  50% { transform: rotate(-4deg) translateY(-2px); }
}

.bomb__spark {
  position: absolute;
  left: 62%;
  top: -2%;
  width: 16px;
  height: 16px;
  background:
    linear-gradient(#fff6c2, #fff6c2) 6px 0 / 4px 16px no-repeat,
    linear-gradient(#fff6c2, #fff6c2) 0 6px / 16px 4px no-repeat;
  filter: drop-shadow(0 0 6px #ffe066);
  animation: spark 0.28s steps(2) infinite;
}

.bomb.is-gone {
  opacity: 0;
}

.boom {
  position: absolute;
  bottom: 0;
  z-index: 4;
  width: clamp(150px, 18vw, 230px);
  aspect-ratio: 1;
  pointer-events: none;
  opacity: 0;
  transform: translateX(-50%) scale(0.3);
}

.boom svg {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.boom.is-on {
  animation: bb-boom 1.1s steps(6) 1 forwards;
}

@keyframes bb-boom {
  0% { opacity: 1; transform: translateX(-50%) scale(0.3); }
  30% { opacity: 1; transform: translateX(-50%) scale(1.1); }
  70% { opacity: 1; transform: translateX(-50%) scale(1.2); }
  100% { opacity: 0; transform: translateX(-50%) scale(1.3); }
}

.arcade__controls {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px 24px 22px;
}

.arcade__status {
  text-align: center;
  font-size: clamp(12px, 1.3vw, 15px);
  line-height: 1.4;
  text-shadow: 2px 2px 0 var(--bomb-shadow);
}

.pass {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 56px;
  padding: 0 18px 0 20px;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffd9a0, #f5a34a);
  color: #5a2300;
  font-size: 16px;
  box-shadow: 0 6px 0 #b34700, 0 10px 20px -6px rgba(90, 30, 0, 0.6), inset 0 2px 0 rgba(255, 255, 255, 0.6);
  transition: transform 0.08s, box-shadow 0.08s, filter 0.2s;
  overflow: hidden;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

/* Driven by the CPU in 1P mode: looks alive, ignores clicks. */
.pass.is-cpu {
  pointer-events: none;
}

.pass kbd {
  height: 22px;
  min-width: 22px;
  background: rgba(90, 30, 0, 0.12);
  border-color: rgba(90, 30, 0, 0.25);
  color: #5a2300;
  font-family: var(--pixel);
}

.pass:active:not([disabled]),
.pass.is-pressed {
  transform: translateY(5px);
  box-shadow: 0 1px 0 #b34700, 0 4px 10px -6px rgba(90, 30, 0, 0.6), inset 0 2px 0 rgba(255, 255, 255, 0.6);
}

.pass[disabled] {
  cursor: default;
  filter: saturate(0.3) brightness(0.9);
}

/* Cooldown: the button refills from the bottom. */
.pass__cool {
  position: absolute;
  inset: 0;
  background: rgba(90, 30, 0, 0.35);
  transform-origin: 50% 100%;
  transform: scaleY(0);
  pointer-events: none;
}

.pass.is-cooling .pass__cool {
  animation: bb-cool var(--cool, 900ms) linear 1 forwards;
}

@keyframes bb-cool {
  from { transform: scaleY(1); }
  to { transform: scaleY(0); }
}

.pass.is-nope {
  animation: swi-no 0.3s steps(2) 1;
}

@keyframes swi-no {
  50% { transform: translateX(-4px); }
}

.arcade__overlay {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 20px;
  padding: 24px;
  text-align: center;
  background: rgba(40, 14, 0, 0.55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  transition: opacity 0.4s var(--ease-out), visibility 0s linear 0s;
}

.arcade__overlay[hidden] {
  display: grid !important;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s var(--ease-out), visibility 0s linear 0.4s;
}

.arcade__big {
  font-size: clamp(30px, 5vw, 56px);
  color: var(--bomb-cream);
  text-shadow: 4px 4px 0 var(--bomb-deep), 8px 8px 0 rgba(90, 30, 0, 0.45);
}

.arcade__modes {
  display: inline-flex;
  gap: 6px;
  padding: 5px;
  border-radius: 14px;
  background: rgba(90, 30, 0, 0.35);
}

.arcade__modes button {
  height: 40px;
  padding: 0 16px;
  border-radius: 10px;
  font-size: 13px;
  color: rgba(255, 243, 214, 0.75);
  transition: background-color 0.3s, color 0.3s;
}

.arcade__modes button[aria-pressed="true"] {
  background: var(--bomb-cream);
  color: #7a2f00;
}

.arcade__start {
  height: 58px;
  padding: 0 30px;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffe7c2, #ffc27a);
  color: #6b2800;
  font-size: 18px;
  box-shadow: 0 7px 0 #b34700, 0 14px 24px -8px rgba(90, 30, 0, 0.7), inset 0 2px 0 rgba(255, 255, 255, 0.7);
  animation: bb-pulse 1.4s var(--ease-in-out) infinite;
}

.arcade__start:active {
  transform: translateY(6px);
  box-shadow: 0 1px 0 #b34700, inset 0 2px 0 rgba(255, 255, 255, 0.7);
}

@keyframes bb-pulse {
  50% { filter: brightness(1.08); transform: scale(1.03); }
}

.arcade__help {
  font-size: 12px;
  color: rgba(255, 243, 214, 0.8);
}

.arcade-note {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 24px;
  margin-top: 22px;
  font-size: 13px;
  color: var(--fg-3);
}

.arcade-note span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

@media (max-width: 640px) {
  .arcade__screen {
    min-height: 420px;
  }

  .arcade__hud {
    padding: 16px 16px 0;
  }

  .arcade__controls {
    grid-template-columns: 1fr 1fr;
    padding: 12px 14px 18px;
  }

  .arcade__status {
    grid-column: span 2;
    order: -1;
  }

  .pass {
    justify-content: center;
  }

  .pass kbd {
    display: none;
  }

  .heart {
    width: 18px;
    height: 16px;
  }
}

/* ── Arcade manual (mechanics) ───────────────────────────────────────────── */

.manual {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.manual__card {
  position: relative;
  padding: 26px 24px 28px;
  border-radius: 18px;
  background: #1c1d22;
  box-shadow:
    0 0 0 2px #2c2d34,
    6px 6px 0 0 rgba(255, 138, 0, 0.18);
  transition: transform 0.5s var(--ease-out), box-shadow 0.5s var(--ease-out);
}

.manual__card:hover {
  transform: translate(-3px, -3px);
  box-shadow:
    0 0 0 2px #3a3b44,
    9px 9px 0 0 rgba(255, 138, 0, 0.35);
}

.manual__n {
  font-size: 12px;
  color: var(--accent-2);
}

.manual__icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-top: 18px;
  border-radius: 12px;
  background: rgba(255, 138, 0, 0.12);
  color: var(--accent-2);
}

.manual__icon .i {
  font-size: 22px;
}

.manual__card h3 {
  margin-top: 18px;
  font-family: var(--pixel);
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.35;
}

.manual__card p {
  margin-top: 10px;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--fg-2);
}

@media (max-width: 960px) {
  .manual {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .manual {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ── State machine diagram ───────────────────────────────────────────────── */

.bb-states {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 28px;
}

.bb-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line-2);
}

.bb-state--hot {
  border-color: rgba(255, 138, 0, 0.45);
  color: var(--accent-2);
  background: rgba(255, 138, 0, 0.08);
}

.bb-arrow {
  color: var(--fg-3);
  font-size: 14px;
}

.bb-code {
  margin: 0;
  padding: 22px 24px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.75;
  color: #d6d3e3;
  background: #1a1a1f;
}

.bb-code .k { color: #ff7ab2; }
.bb-code .t { color: #dabaff; }
.bb-code .f { color: #67b7a4; }
.bb-code .s { color: #ff8170; }
.bb-code .c { color: #7f8c98; font-style: italic; }
.bb-code .p { color: #6bdfff; }
.bb-code .n { color: #d9c97c; }
.bb-code .a { color: #fd8f3f; }

.bb-note {
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--fg-3);
}

/* ── Screens & team ──────────────────────────────────────────────────────── */

.bb-screens {
  display: flex;
  justify-content: center;
  gap: clamp(14px, 2.4vw, 32px);
  flex-wrap: wrap;
}

.bb-screens figure {
  display: grid;
  justify-items: center;
  gap: 14px;
}

.bb-screens .phone {
  --pw: clamp(150px, 19vw, 230px);
  transition: transform 0.8s var(--ease-out);
}

.bb-screens figure:nth-child(odd) .phone {
  transform: translateY(24px);
}

.bb-screens figure:hover .phone {
  transform: translateY(-8px);
}

.bb-screens figcaption {
  font-size: 12px;
  color: var(--fg-3);
}

.bb-team {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: center;
}

.bb-team__photo {
  border-radius: var(--r-l);
  overflow: hidden;
  border: 1px solid var(--line-2);
  box-shadow: 0 40px 80px -40px rgba(0, 0, 0, 0.9);
  transform: rotate(-2deg);
  transition: transform 0.9s var(--ease-out);
}

.bb-team__photo:hover {
  transform: rotate(0deg);
}

.bb-team__photo img {
  width: 100%;
}

@media (max-width: 860px) {
  .bb-team {
    grid-template-columns: minmax(0, 1fr);
  }

  .bb-team__photo {
    max-width: 420px;
  }
}
