/* ---------------------------------------------------------------
   Lily Leap - 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 controls live here. The
   field itself is drawn on a canvas by game.js, which reads
   --stage-mode to switch between day and night.
---------------------------------------------------------------- */

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

:root {
  --stage-mode: light;
  --stage-edge: #cfd6ea;
  --frog: #2fbf71;
  --frog-2: #16a3a0;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --stage-mode: dark;
    --stage-edge: #2a3350;
  }
}

:root[data-theme="dark"] {
  --stage-mode: dark;
  --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--frog {
  background: linear-gradient(135deg, var(--frog), var(--frog-2));
}

.brand__mark--frog 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: #7fc45a;
  /* Swipes make the frog hop, 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: 360 / 600;
}

/* --------------------------- 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__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);
}

/* ------------------------------- 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; }

.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; }

/* ------------------------------ menu logo ------------------------------ */

.cover__logo {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  height: 46px;
  margin: 0 auto 8px;
}

.cover__frog,
.cover__baby {
  --c: #3fd46b;
  position: relative;
  display: block;
  width: 38px;
  height: 34px;
  border-radius: 50% 50% 46% 46%;
  background: radial-gradient(circle at 40% 35%, #b8f7c6, var(--c) 60%);
  box-shadow: 0 6px 12px -6px rgba(0, 0, 0, .4);
  animation: hop 1.6s cubic-bezier(.3, .7, .4, 1) infinite;
}

.cover__baby {
  width: 24px;
  height: 21px;
  background: radial-gradient(circle at 40% 35%, #fff, var(--c) 55%);
}

.cover__frog::before,
.cover__frog::after,
.cover__baby::before,
.cover__baby::after {
  content: '';
  position: absolute;
  top: -6px;
  left: 3px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 42%, #10131c 0 26%, #fff 28% 58%, var(--c) 60%);
}

.cover__frog::after,
.cover__baby::after { left: auto; right: 3px; }

.cover__baby::before,
.cover__baby::after { width: 9px; height: 9px; top: -4px; }

.cover__baby:nth-child(2) { animation-delay: .15s; }
.cover__baby:nth-child(3) { animation-delay: .3s; }
.cover__baby:nth-child(4) { animation-delay: .45s; }

@keyframes hop {
  0%, 55%, 100% { transform: translateY(0) scale(1, 1); }
  10% { transform: translateY(0) scale(1.08, .88); }
  28% { transform: translateY(-14px) scale(.94, 1.08); }
  46% { transform: translateY(0) scale(1.06, .92); }
}

/* The tap-and-swipe explainer, shown on touch screens. */
.swipe-help {
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
}

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

.swipe-help__demo {
  position: relative;
  flex: none;
  width: 44px;
  height: 52px;
}

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

.swipe-help__arrow {
  position: absolute;
  left: 16px;
  top: 2px;
  width: 12px;
  height: 12px;
  border-left: 3px solid var(--accent);
  border-top: 3px solid var(--accent);
  transform: rotate(45deg);
  opacity: .6;
}

@keyframes swipe-up {
  0%, 20% { transform: translateY(0); opacity: 1; }
  60% { transform: translateY(-20px); opacity: .2; }
  100% { transform: translateY(0); opacity: 1; }
}

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

/* ----------------------------- level picker ---------------------------- */

.level-list {
  display: grid;
  gap: 8px;
  margin: 8px 0 4px;
  text-align: left;
}

.world {
  --w: #3fd46b;
  border-radius: 14px;
  padding: 7px 8px 8px;
  background: var(--surface-2);
  background: color-mix(in srgb, var(--w) 12%, var(--surface-2));
  border: 1px solid var(--border);
  border-color: color-mix(in srgb, var(--w) 35%, var(--border));
}

.world--city { --w: #6f8bff; }
.world--ruins { --w: #e3b94f; }
.world--frost { --w: #5cc8ff; }
.world--volcano { --w: #ff7a2f; }

.world__name {
  margin: 0 0 5px 2px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.world__levels {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.lvl-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  font: inherit;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  padding: 5px 0 4px;
  display: grid;
  justify-items: center;
  gap: 1px;
}

.lvl-btn__n { font-size: 16px; line-height: 1.1; }
.lvl-btn:active { transform: scale(.95); }
.lvl-btn.is-done { border-color: var(--w); }
.lvl-btn.is-locked { opacity: .4; cursor: default; }

.stars { display: flex; gap: 2px; }

.stars i,
.big-stars i {
  display: block;
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

.stars i {
  width: 9px;
  height: 9px;
  background: var(--border-strong);
}

.stars i.on { background: #ffc928; }

.big-stars {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 6px;
  margin: 0 0 8px;
}

.big-stars i {
  width: 38px;
  height: 38px;
  background: var(--border);
}

.big-stars i:nth-child(2) { width: 46px; height: 46px; margin-bottom: 6px; }

.big-stars i.on {
  background: linear-gradient(180deg, #ffe07a, #ffb400);
  animation: star-in .5s cubic-bezier(.2, 1.6, .4, 1) both;
}

.big-stars i.on:nth-child(2) { animation-delay: .15s; }
.big-stars i.on:nth-child(3) { animation-delay: .3s; }

@keyframes star-in {
  from { opacity: 0; transform: scale(.2) rotate(-40deg); }
}

/* ------------------------------- the pad ------------------------------- */

.tools { flex-direction: column; align-items: stretch; }

.tools__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pad {
  display: grid;
  grid-template-columns: repeat(3, 64px);
  grid-template-rows: repeat(2, 50px);
  gap: 6px;
  justify-content: center;
  margin: 0 auto 4px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.pad[hidden] { display: none; }

.pad__btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 14px;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  padding: 0;
}

.pad__btn:active { transform: scale(.94); background: var(--accent-soft); }

.pad__btn svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pad__btn--up { grid-column: 2; grid-row: 1; }
.pad__btn--left { grid-column: 1; grid-row: 2; }
.pad__btn--down { grid-column: 2; grid-row: 2; }
.pad__btn--right { grid-column: 3; grid-row: 2; }

/* The swipe / buttons switch only matters on a touch screen. */
.tool--pad { display: none; }

@media (pointer: coarse) {
  .tool--pad { display: flex; }
}

@media (max-width: 420px) {
  .tools__row .tool { min-width: 0; flex: 1; padding: 8px 6px; }
}

/* ------------------------ pictures for the site ------------------------ */

.is-shot body > *:not(main) { display: none !important; }
.is-shot .page { padding: 0; max-width: none; }
.is-shot .tools, .is-shot .about, .is-shot .cover { display: none !important; }
.is-shot .stage { position: fixed; inset: 0; width: 100vw !important; height: 100vh !important; border: 0; border-radius: 0; }

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

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