/* ---------------------------------------------------------------
   Nova Bricks - game-specific styles.

   Loaded after /assets/base.css, which supplies the design tokens,
   the top bar, the buttons, the footer, the modals, the cookie
   banner and the legal-page layout shared by every Lynxy game.
   Only the field, its screens and the tokens they need live here.
---------------------------------------------------------------- */

/* ------------------------------- tokens -------------------------------- */

/* The field is drawn on a canvas; game.js reads these tokens and
   redraws whenever the theme changes. */
:root {
  --stage-mode: light;
  --stage-text: #1b2033;
  --stage-dim: rgba(27, 32, 51, .55);
  --stage-wall: #4f6cf7;
  --stage-wall-2: #8b5cf6;
  --stage-edge: #cfd6ea;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --stage-mode: dark;
    --stage-text: #eef2ff;
    --stage-dim: rgba(238, 242, 255, .55);
    --stage-wall: #6f8bff;
    --stage-wall-2: #c084fc;
    --stage-edge: #2a3350;
  }
}

:root[data-theme="dark"] {
  --stage-mode: dark;
  --stage-text: #eef2ff;
  --stage-dim: rgba(238, 242, 255, .55);
  --stage-wall: #6f8bff;
  --stage-wall-2: #c084fc;
  --stage-edge: #2a3350;
}

/* --------------------------- header extras ----------------------------- */

.stats {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.stat {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px 10px;
  text-align: center;
  min-width: 58px;
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.stat__value {
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat__label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-dim);
}

.brand__mark--ark {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.brand__mark--ark svg { width: 20px; height: 20px; fill: #fff; }

@media (max-width: 520px) {
  .stats { gap: 6px; }
  .stat { min-width: 48px; padding: 4px 6px; }
  .stat__value { font-size: 15px; }
  .stat__label { font-size: 9px; letter-spacing: .04em; }
  .brand__name { display: none; }
}

/* -------------------------------- page --------------------------------- */

.page {
  flex: 1;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 10px 12px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stage-wrap {
  display: flex;
  justify-content: center;
}

.stage {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--stage-edge);
  box-shadow: var(--shadow);
  background: #0e1117;
  /* Swipes steer the paddle, so the field must never scroll the page. */
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  /* Replaced by game.js with the size that fits the screen. */
  width: min(100%, 360px);
}

#game {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  cursor: none;
}

/* --------------------------- screens on the field ---------------------- */

.cover {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 14px;
  overflow-y: auto;
  background: rgba(8, 11, 20, .5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fade .2s ease;
  z-index: 3;
}

.cover[hidden] { display: none; }

.cover__card {
  width: 100%;
  max-width: 320px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 20px 18px 16px;
  text-align: center;
  animation: rise .25s cubic-bezier(.2, .8, .3, 1);
}

.cover__card[hidden] { display: none; }
.cover__card--wide { max-width: 360px; padding: 16px 14px 14px; }

.cover__logo {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  width: 132px;
  margin: 0 auto 10px;
}

.cover__logo span {
  height: 12px;
  border-radius: 3px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .5), transparent 55%), var(--c, #ff4d5e);
  box-shadow: 0 0 10px var(--c, #ff4d5e);
  animation: glow 2.4s ease-in-out infinite;
}

.cover__logo span:nth-child(1) { --c: #ff4d5e; }
.cover__logo span:nth-child(2) { --c: #ff8a3d; animation-delay: .15s; }
.cover__logo span:nth-child(3) { --c: #ffd23f; animation-delay: .3s; }
.cover__logo span:nth-child(4) { --c: #3ddc84; animation-delay: .45s; }
.cover__logo span:nth-child(5) { --c: #4f7dff; animation-delay: .6s; }

@keyframes glow {
  50% { transform: translateY(-3px); filter: brightness(1.25); }
}

.cover__icon { font-size: 36px; line-height: 1; margin-bottom: 4px; }

.cover__title {
  margin: 0 0 6px;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -.03em;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.cover__title--sm {
  font-size: 20px;
  background: none;
  color: var(--text);
}

.cover__text {
  margin: 0 0 12px;
  font-size: 13.5px;
  color: var(--text-dim);
}

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

.cover__actions + .cover__actions { margin-top: 8px; }

.cover__actions--row { flex-direction: row; }
.cover__actions--row .btn--primary { flex: 1; }

.cover__home { flex: none; width: 48px; padding: 0; }
.cover__home img { width: 26px; height: 26px; display: block; }

.cover__note {
  margin: 10px 0 0;
  font-size: 12.5px;
  color: var(--text-dim);
}

/* The swipe explainer, shown on touch screens before the first ball:
   a finger sliding along a track, the paddle sliding with it. */
.swipe-help {
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px;
  margin: 0 0 12px;
}

.swipe-help[hidden] { display: none; }

.swipe-help__demo {
  position: relative;
  height: 42px;
  margin: 0 auto 6px;
  width: 170px;
}

.swipe-help__track {
  position: absolute;
  left: 0;
  right: 0;
  top: 11px;
  height: 2px;
  border-radius: 2px;
  background: repeating-linear-gradient(90deg, var(--accent) 0 6px, transparent 6px 11px);
  opacity: .5;
}

.swipe-help__finger {
  position: absolute;
  top: 1px;
  left: 50%;
  width: 22px;
  height: 22px;
  margin-left: -11px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 25%, transparent);
  animation: swipe 2.2s ease-in-out infinite;
}

.swipe-help__paddle {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 54px;
  height: 9px;
  margin-left: -27px;
  border-radius: 5px;
  background: linear-gradient(90deg, var(--accent-2) 0 10px, var(--text-dim) 10px calc(100% - 10px), var(--accent-2) calc(100% - 10px));
  animation: swipe 2.2s ease-in-out infinite;
}

@keyframes swipe {
  0%, 100% { transform: translateX(-58px); }
  50% { transform: translateX(58px); }
}

.swipe-help__text {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text);
}

/* ----------------------------- stage picker ---------------------------- */

.stage-list {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  margin: 8px 0 4px;
}

.stage-btn {
  aspect-ratio: 1;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 9px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  padding: 0;
  display: grid;
  place-items: center;
  position: relative;
}

.stage-btn:active { transform: scale(.95); }

.stage-btn.is-done {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.stage-btn.is-done::after {
  content: '';
  position: absolute;
  top: 3px;
  right: 3px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ok);
}

.stage-btn.is-locked {
  opacity: .4;
  cursor: default;
}

/* ------------------------------- dialogs ------------------------------- */

.score-row {
  display: flex;
  gap: 8px;
  margin: 4px 0 14px;
}

.score-row__item {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 4px;
  display: grid;
  gap: 2px;
}

.score-row__value {
  font-size: 19px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.score-row__item:first-child .score-row__value { color: var(--ok); }

.score-row__label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-dim);
}

/* ------------------------------- tool row ------------------------------ */

.tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
}

.tool {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-dim);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  min-width: 104px;
  white-space: nowrap;
}

.tool:active { transform: scale(.97); }
.tool[disabled] { opacity: .45; cursor: default; }
.tool .icon { width: 18px; height: 18px; }

.icon--play { display: none; }
.is-paused .icon--pause { display: none; }
.is-paused .icon--play { display: block; }

.icon__mute { display: none; }
.is-off .icon__waves { display: none; }
.is-off .icon__mute { display: block; }

.keys-hint {
  display: none;
  margin: 0;
  gap: 4px 12px;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 12px;
  color: var(--text-dim);
}

kbd {
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  min-width: 22px;
  padding: 1px 5px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  background: var(--surface);
  color: var(--text);
  display: inline-block;
  text-align: center;
}

@media (hover: hover) and (pointer: fine) {
  .keys-hint { display: flex; }
}

/* ------------------------ about / SEO copy ----------------------------- */

.about {
  border-top: 1px solid var(--border);
  padding-top: 18px;
  margin-top: 10px;
  color: var(--text-dim);
  font-size: 14px;
}

.about h1 {
  font-size: 18px;
  letter-spacing: -.02em;
  color: var(--text);
  margin: 0 0 6px;
}

.about h2 {
  font-size: 15px;
  color: var(--text);
  margin: 18px 0 4px;
}

.about p { margin: 0 0 8px; }
.about__small { font-size: 12px; opacity: .8; }

.powers {
  list-style: none;
  margin: 10px 0 12px;
  padding: 0;
  display: grid;
  gap: 6px;
}

.powers li {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cap {
  flex: none;
  width: 34px;
  height: 18px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(180deg, rgba(255, 255, 255, .45), transparent 50%, rgba(0, 0, 0, .2)), var(--c);
  box-shadow: 0 0 8px var(--c);
}

.noscript {
  text-align: center;
  padding: 12px 16px;
  margin: 0;
  color: var(--error);
}

/* --------------------------- tables in prose --------------------------- */

.doc table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  font-size: 14px;
}

.doc th, .doc td {
  border: 1px solid var(--border);
  padding: 7px 9px;
  text-align: left;
}

.doc th { background: var(--surface-2); color: var(--text); font-weight: 600; }
.doc ol { padding-left: 20px; }
.doc .powers li { font-size: 15px; }

.stage-names {
  columns: 2;
  column-gap: 24px;
}

.stage-names li { break-inside: avoid; margin: 2px 0; }
