/* ---------------------------------------------------------------
   Solitaire - 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 table, the cards and the tokens they need live here.
---------------------------------------------------------------- */

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

/* The cards stay white in the dark theme too - they are objects on the
   table - only a touch dimmer, on a deeper felt. */
:root {
  --felt-1: #1d8f6c;
  --felt-2: #0e5f4b;
  --felt-edge: #0b4d3d;
  --slot: rgba(255, 255, 255, .16);
  --slot-fill: rgba(255, 255, 255, .06);
  --card-face: #ffffff;
  --card-face-2: #f5f7fc;
  --card-line: rgba(20, 28, 48, .14);
  --card-red: #e1374b;
  --card-black: #1f2537;
  --card-tint-red: #ffe6ea;
  --card-tint-black: #e4e9f7;
  --back-1: #5b7bff;
  --back-2: #8b5cf6;
  --hint: #ffd23f;
  --card-shadow: 0 1px 1.5px rgba(0, 0, 0, .22), 0 2px 6px rgba(0, 0, 0, .12);
  --lift-shadow: 0 14px 30px rgba(0, 0, 0, .32), 0 3px 8px rgba(0, 0, 0, .2);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --felt-1: #134d3d;
    --felt-2: #0a2c24;
    --felt-edge: #0a241e;
    --slot: rgba(255, 255, 255, .13);
    --slot-fill: rgba(255, 255, 255, .04);
    --card-face: #eef0f6;
    --card-face-2: #e2e6ef;
    --card-red: #d8334a;
    --card-tint-red: #f6d9de;
    --card-tint-black: #d6dcee;
    --back-1: #4a63d8;
    --back-2: #7646d6;
  }
}

:root[data-theme="dark"] {
  --felt-1: #134d3d;
  --felt-2: #0a2c24;
  --felt-edge: #0a241e;
  --slot: rgba(255, 255, 255, .13);
  --slot-fill: rgba(255, 255, 255, .04);
  --card-face: #eef0f6;
  --card-face-2: #e2e6ef;
  --card-red: #d8334a;
  --card-tint-red: #f6d9de;
  --card-tint-black: #d6dcee;
  --back-1: #4a63d8;
  --back-2: #7646d6;
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

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

.topbar__inner { max-width: 640px; }

.brand__mark svg { width: 20px; height: 20px; display: block; }

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

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

.topbar__hint {
  max-width: 640px;
  margin: 6px auto 0;
  padding: 0 16px;
  font-size: 12px;
  color: var(--text-dim);
}

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

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

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

.levels {
  flex: 1;
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 3px;
  gap: 3px;
}

.level {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 7px 4px;
  border-radius: 9px;
  cursor: pointer;
  display: grid;
  gap: 1px;
  line-height: 1.15;
}

.level small { font-size: 10px; font-weight: 600; opacity: .75; }

.level.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.meta {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 13px;
  color: var(--text-dim);
  flex-wrap: wrap;
}

.meta__item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.meta__item strong { color: var(--text); font-weight: 700; }

.meta__item--deal {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.meta__item--deal strong { color: var(--accent); }
.meta__item--time { margin-left: auto; }

/* -------------------------------- felt --------------------------------- */

.felt {
  position: relative;
  border-radius: var(--radius-lg);
  padding: 10px 8px 12px;
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(255, 255, 255, .14), transparent 60%),
    radial-gradient(90% 60% at 50% 110%, rgba(0, 0, 0, .22), transparent 70%),
    linear-gradient(170deg, var(--felt-1), var(--felt-2));
  box-shadow: inset 0 0 0 1px var(--felt-edge), inset 0 2px 20px rgba(0, 0, 0, .18), var(--shadow);
  overflow: hidden;
}

/* The cards are placed by app.js in pixels; --cw and --ch are the card
   size it measured for this screen. */
.table {
  --cw: 48px;
  --ch: 67px;
  position: relative;
  margin: 0 auto;
  min-height: 320px;
  touch-action: manipulation;
  isolation: isolate;
  user-select: none;
  -webkit-user-select: none;
}

/* ------------------------------- slots --------------------------------- */

.slot {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--cw);
  height: var(--ch);
  border-radius: calc(var(--cw) * .12);
  border: 1.5px solid var(--slot);
  background: var(--slot-fill);
  display: grid;
  place-items: center;
  color: var(--slot);
  z-index: 0;
  transition: box-shadow .2s ease, background .2s ease;
}

.slot svg { width: 44%; height: 44%; fill: currentColor; }
.slot__label { font-weight: 800; font-size: calc(var(--cw) * .36); line-height: 1; }

.slot--stock { cursor: pointer; }
.slot--stock svg { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; width: 48%; height: 48%; }
.slot--stock.is-empty-for-good svg { opacity: .35; }

.slot.is-target { background: rgba(255, 255, 255, .16); box-shadow: 0 0 0 2px rgba(255, 255, 255, .6); }
.slot.is-hint { box-shadow: 0 0 0 3px var(--hint), 0 0 18px var(--hint); animation: hint 1s ease-in-out infinite; }

/* -------------------------------- cards -------------------------------- */

.card {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--cw);
  height: var(--ch);
  perspective: 700px;
  transition: transform .3s cubic-bezier(.2, .8, .3, 1) var(--delay, 0ms);
  will-change: transform;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

/* A card the player can pick up takes the touch itself: dragging it never
   scrolls the page. The felt around the cards still scrolls. */
.card.is-live { touch-action: none; }

.card__inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform .34s cubic-bezier(.3, .7, .3, 1) var(--delay, 0ms);
}

.card.is-down .card__inner { transform: rotateY(180deg); }

.card__front,
.card__back {
  position: absolute;
  inset: 0;
  border-radius: calc(var(--cw) * .12);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

.card__front {
  background: linear-gradient(160deg, var(--card-face) 55%, var(--card-face-2));
  box-shadow: inset 0 0 0 1px var(--card-line), var(--card-shadow);
  color: var(--card-black);
}

.card.is-red .card__front { color: var(--card-red); }

.card__back {
  transform: rotateY(180deg);
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, .22) 0 18%, transparent 19%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .08) 0 3px, transparent 3px 7px),
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, .08) 0 3px, transparent 3px 7px),
    linear-gradient(150deg, var(--back-1), var(--back-2));
  box-shadow: inset 0 0 0 calc(var(--cw) * .05) rgba(255, 255, 255, .92), inset 0 0 0 calc(var(--cw) * .07) rgba(255, 255, 255, .25), var(--card-shadow);
}

.card__back::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url("/assets/lynx.svg") center / 46% no-repeat;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .25));
}

/* The corner index: rank and suit, sized to stay readable on the narrow
   strip a card shows under the next one in its column. */
.card__idx {
  position: absolute;
  top: calc(var(--cw) * .045);
  left: calc(var(--cw) * .07);
  right: calc(var(--cw) * .06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 800;
  font-size: calc(var(--cw) * .33);
  line-height: 1;
  letter-spacing: -.04em;
  font-variant-numeric: tabular-nums;
}

.card__idx svg {
  width: calc(var(--cw) * .27);
  height: calc(var(--cw) * .27);
  fill: currentColor;
  flex: none;
}

.card__idx--end {
  top: auto;
  bottom: calc(var(--cw) * .045);
  transform: rotate(180deg);
  font-size: calc(var(--cw) * .2);
  opacity: .55;
}

.card__idx--end svg { width: calc(var(--cw) * .17); height: calc(var(--cw) * .17); }

.card__art {
  position: absolute;
  left: 12%;
  right: 12%;
  top: 34%;
  bottom: 13%;
  display: grid;
  place-items: center;
}

.card__pip { width: 78%; height: 78%; fill: currentColor; }

/* Jack, Queen and King: an emblem on a tinted plate. */
.card__plate {
  width: 100%;
  height: 100%;
  border-radius: calc(var(--cw) * .1);
  background: linear-gradient(160deg, var(--card-tint-black), transparent 140%);
  display: grid;
  place-items: center;
}

.card.is-red .card__plate { background: linear-gradient(160deg, var(--card-tint-red), transparent 140%); }

.card__plate svg { width: 76%; height: 76%; }

.card:focus-visible .card__front { box-shadow: inset 0 0 0 1px var(--card-line), 0 0 0 3px var(--accent), var(--card-shadow); }

/* Moving: the card rides above everything until it lands. */
.card.is-flying { z-index: 900 !important; }

.card.is-dragging {
  transition: none;
  z-index: 1000 !important;
}

.card.is-dragging .card__front { box-shadow: inset 0 0 0 1px var(--card-line), var(--lift-shadow); }

.card.is-hint .card__front,
.card.is-hint .card__back {
  box-shadow: inset 0 0 0 1px var(--card-line), 0 0 0 3px var(--hint), 0 0 16px var(--hint);
  animation: hint 1s ease-in-out infinite;
}

.card.is-nope .card__inner { animation: nope .32s ease; }

/* The drop target lights up under a dragged card. */
.card.is-target .card__front { box-shadow: inset 0 0 0 1px var(--card-line), 0 0 0 3px rgba(255, 255, 255, .85), var(--card-shadow); }

/* Cards going home at the end glow for a moment. */
.card.is-home .card__front { animation: home .5s ease; }

.table.no-anim .card,
.table.no-anim .card__inner { transition: none !important; }

@keyframes hint {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.12); }
}

@keyframes nope {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

@keyframes home {
  0% { box-shadow: inset 0 0 0 1px var(--card-line), 0 0 0 0 rgba(255, 210, 63, .9); }
  100% { box-shadow: inset 0 0 0 1px var(--card-line), 0 0 0 10px rgba(255, 210, 63, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .card, .card__inner { transition: none; }
  .card.is-nope .card__inner, .card.is-hint .card__front, .card.is-hint .card__back, .slot.is-hint { animation: none; }
}

/* ------------------------------ pause cover ---------------------------- */

.board-cover {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  z-index: 2000;
}

.board-cover[hidden] { display: none; }

.board-cover__card {
  text-align: center;
  display: grid;
  gap: 12px;
  font-weight: 600;
}

.board-cover__card p { margin: 0; }

/* -------------------------------- tools -------------------------------- */

.tools {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.tool {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-dim);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 8px 2px 6px;
  display: grid;
  justify-items: center;
  gap: 3px;
  cursor: pointer;
}

.tool:active { transform: scale(.97); }
.tool[disabled] { opacity: .45; cursor: default; }

/* ------------------------------- confetti ------------------------------ */

.confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 50;
}

/* ------------------------------ win dialog ----------------------------- */

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

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

.score-row__value {
  font-size: 20px;
  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);
}

.modal__actions .modal__home {
  flex: none;
  width: 46px;
  padding: 0;
}

.modal__home img { width: 26px; height: 26px; display: block; }
.modal__home:active { transform: scale(.96); }

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

.about {
  border-top: 1px solid var(--border);
  padding-top: 18px;
  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; }

kbd {
  font: inherit;
  font-size: .85em;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 0 5px;
}

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

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

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

.about th, .doc th { background: var(--surface-2); color: var(--text); font-weight: 600; }

.doc table { margin: 14px 0; font-size: 14px; }
.doc th, .doc td { padding: 7px 9px; }

.doc ol { padding-left: 20px; }

/* -------------------------- staged screenshots ------------------------- */

.is-shot body > *:not(main) { display: none !important; }
.is-shot .panel, .is-shot .about { display: none !important; }
