/* ===== Pulse Grid — game-specific styles =====
   Generic glass chrome comes from shared/css/glass.css (fixed theme, no
   light/dark mode). This file re-tints that chrome to neon magenta/cyan and
   lays out the highway screen plus the four tap pads underneath it. */

:root {
  --accent-1: #ff4fb8;
  --accent-2: #42e8ff;
  --on-accent: #08030f;
  --bg-glow-a: rgba(255, 79, 184, .30);
  --bg-glow-b: rgba(66, 232, 255, .22);
  --gold: #ffd166;
}

/* base.css has no generic [hidden] rule; several overlays below set a
   display value, so they need this to stay genuinely hidden. */
[hidden] { display: none !important; }

.c-app { --fpad: clamp(10px, 3vw, 28px); }
.c-table {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 18px;
}

/* The shared back chip is a light pill; this page is a dark arcade cabinet. */
.gc-back {
  border-color: rgba(255, 255, 255, .18);
  background: rgba(10, 5, 26, .62);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #e8ecff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .45);
  opacity: .85;
}
.gc-back:hover { color: #fff; opacity: 1; }

/* ---------- Stage: screen + pads ---------- */
.pg-stage {
  /* 42:62 highway plus the pad row, sized so a 900px desktop and a 640px
     phone both fit without the page itself scrolling. */
  width: min(94vw, 430px, calc((100dvh - 286px) / 1.48));
  margin: 0 auto;
}

.pg-screen {
  position: relative;
  width: 100%;
  aspect-ratio: 42 / 62;
  border-radius: 16px;
  overflow: hidden;
  background: #05030e;
  border: 1px solid var(--glass-line);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .12);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
#board {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* ---------- Track picker ---------- */
.pg-cover {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-content: center;
  gap: 10px;
  padding: 16px 18px;
  text-align: center;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(255, 79, 184, .20), transparent 60%),
    linear-gradient(180deg, rgba(7, 3, 20, .62), rgba(5, 2, 14, .94));
  animation: pgFade .25s ease;
}
@keyframes pgFade { from { opacity: 0; } }

.pg-cover__kicker {
  margin: 0;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .55);
}
.pg-cover__title {
  margin: 0;
  font-size: clamp(26px, 8vw, 38px);
  line-height: 1.05;
  letter-spacing: -.02em;
  background: linear-gradient(92deg, #ff4fb8, #ffd166 52%, #42e8ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 18px rgba(255, 79, 184, .35));
}
.pg-cover__sub {
  margin: 0 auto;
  max-width: 30ch;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--c-muted);
}
.pg-cover__sub b { color: #fff; }

.pg-diffs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 2px;
}
.pg-diff {
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px 7px;
  border-radius: 10px;
  border: 1px solid var(--glass-line);
  background: rgba(255, 255, 255, .05);
  color: var(--c-text);
  font: inherit;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .06s ease;
}
.pg-diff b { font-size: 12.5px; font-weight: 700; letter-spacing: .01em; }
.pg-diff span { font-size: 9.5px; color: var(--c-muted); font-variant-numeric: tabular-nums; }
.pg-diff:hover { background: rgba(255, 255, 255, .1); }
.pg-diff.is-on {
  border-color: rgba(66, 232, 255, .55);
  background: linear-gradient(180deg, rgba(255, 79, 184, .22), rgba(66, 232, 255, .14));
  box-shadow: 0 0 18px rgba(66, 232, 255, .18), inset 0 1px 0 rgba(255, 255, 255, .2);
}
.pg-diff.is-on span { color: rgba(255, 255, 255, .82); }
.pg-diff:focus-visible { outline: none; box-shadow: var(--ring); }

.pg-play { width: 100%; padding: 10px 16px; font-size: 14px; }
.pg-cover__best {
  margin: 0;
  font-size: 11px;
  color: rgba(255, 255, 255, .5);
  font-variant-numeric: tabular-nums;
}
.pg-cover__best b { color: var(--gold); }

/* ---------- Pause veil ---------- */
.pg-pause {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  padding: 20px;
  text-align: center;
  background: rgba(4, 2, 12, .72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.pg-pause__title {
  margin: 0;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: .02em;
  color: #fff;
  text-shadow: 0 0 24px rgba(66, 232, 255, .55);
}
.pg-pause__sub { margin: 0 0 6px; font-size: 12.5px; color: var(--c-muted); }

/* ---------- Pads ---------- */
.pg-pads {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  margin-top: 9px;
}
.pg-pad {
  appearance: none;
  position: relative;
  height: 50px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .14);
  background: linear-gradient(180deg, var(--lane-soft), rgba(255, 255, 255, .02));
  color: var(--lane);
  font: 800 15px/1 ui-monospace, "SFMono-Regular", "Segoe UI", monospace;
  letter-spacing: .06em;
  cursor: pointer;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 6px 16px rgba(0, 0, 0, .3);
  transition: transform .06s ease, background .1s ease, box-shadow .1s ease;
}
.pg-pad::after {              /* the same diamond that sits on the hit line */
  content: "";
  position: absolute;
  left: 50%;
  top: 7px;
  width: 9px;
  height: 9px;
  margin-left: -4.5px;
  border-radius: 2px;
  transform: rotate(45deg);
  background: var(--lane);
  opacity: .55;
  box-shadow: 0 0 10px var(--lane);
}
.pg-pad span { position: relative; top: 5px; }
.pg-pad.is-down {
  transform: translateY(2px) scale(.985);
  background: linear-gradient(180deg, var(--lane-glow), rgba(255, 255, 255, .06));
  box-shadow: inset 0 0 0 1px var(--lane), 0 0 22px var(--lane-glow);
}
.pg-pad:focus-visible { outline: none; box-shadow: var(--ring); }

.pg-pad--0 { --lane: #42e8ff; --lane-soft: rgba(66, 232, 255, .15); --lane-glow: rgba(66, 232, 255, .38); }
.pg-pad--1 { --lane: #ff6bd6; --lane-soft: rgba(255, 107, 214, .15); --lane-glow: rgba(255, 107, 214, .38); }
.pg-pad--2 { --lane: #ffd166; --lane-soft: rgba(255, 209, 102, .15); --lane-glow: rgba(255, 209, 102, .38); }
.pg-pad--3 { --lane: #8bff9e; --lane-soft: rgba(139, 255, 158, .15); --lane-glow: rgba(139, 255, 158, .38); }

/* ---------- Result panel ---------- */
.pg-res-panel { width: min(94vw, 430px); }
.pg-res {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 6px 0 14px;
}
.pg-res__rank {
  flex: 0 0 auto;
  display: grid;
  place-content: center;
  width: 86px;
  height: 86px;
  border-radius: 50%;
  border: 2px solid rgba(255, 209, 102, .65);
  background: radial-gradient(circle at 50% 35%, rgba(255, 209, 102, .22), rgba(255, 79, 184, .10) 60%, transparent);
  color: var(--gold);
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -.03em;
  text-shadow: 0 0 22px rgba(255, 209, 102, .6);
  box-shadow: 0 0 34px rgba(255, 209, 102, .18), inset 0 0 22px rgba(255, 209, 102, .12);
}
.pg-res__rank.is-fail {
  border-color: rgba(255, 107, 107, .6);
  background: radial-gradient(circle at 50% 35%, rgba(255, 88, 88, .22), transparent 68%);
  color: #ff7b7b;
  text-shadow: 0 0 22px rgba(255, 88, 88, .55);
  box-shadow: 0 0 34px rgba(255, 88, 88, .16);
}
.pg-res__main { min-width: 0; }
.pg-res__score {
  margin: 0;
  font-size: 30px;
  font-weight: 800;
  line-height: 1.05;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.pg-res__meta {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--c-muted);
  font-variant-numeric: tabular-nums;
}
.pg-res__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 2px;
}
.pg-res__cell {
  padding: 9px 6px;
  border-radius: 10px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  text-align: center;
}
.pg-res__cell small {
  display: block;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--c-muted);
}
.pg-res__cell b {
  display: block;
  margin-top: 3px;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  color: #fff;
}
.pg-res__cell--p { border-color: rgba(66, 232, 255, .35); }
.pg-res__cell--p b { color: #7ff1ff; }
.pg-res__cell--g { border-color: rgba(139, 255, 158, .3); }
.pg-res__cell--g b { color: #a9ffb6; }
.pg-res__cell--o { border-color: rgba(255, 209, 102, .3); }
.pg-res__cell--o b { color: var(--gold); }
.pg-res__cell--m { border-color: rgba(255, 107, 107, .3); }
.pg-res__cell--m b { color: #ff9b9b; }

/* ---------- Small screens ---------- */
@media (max-width: 620px) {
  /* Shrink the bar to three compact rows and keep the stage clear of the
     fixed Game Center chip in the bottom-left corner. */
  .pg-page .c-bar { padding: 8px 12px; gap: 8px 10px; }
  .pg-page .c-bar__controls { gap: 6px; }
  .pg-page .c-bar__controls .c-btn { padding: 6px 9px; font-size: 12px; }
  .pg-page .c-bar__stats { gap: 13px; font-size: 12.5px; }
  .c-table { padding-bottom: 54px; }
  .pg-stage { width: min(94vw, calc((100dvh - 268px) / 1.48)); }
  .pg-pad { height: 44px; }
  .pg-pad::after { top: 6px; width: 8px; height: 8px; margin-left: -4px; }
  .pg-cover { gap: 8px; padding: 12px 14px; }
  .pg-cover__sub { font-size: 11.5px; }
  .pg-diff { padding: 6px 3px 5px; }
  .pg-diff b { font-size: 11.5px; }
  .pg-diff span { font-size: 9px; }
  .pg-play { padding: 8px 14px; font-size: 13px; }
  .pg-res__rank { width: 70px; height: 70px; font-size: 32px; }
  .pg-res__score { font-size: 25px; }
}

@media (prefers-reduced-motion: reduce) {
  .pg-cover { animation: none; }
  .pg-pad { transition: none; }
}
