/* EwrekaGames — Pyramid solitaire (assets/js/solo/pyramid.js). Shell styles: assets/css/solo.css.
 * The table has a fixed pixel size set once from the viewport by pyramid.js (--cw / --ch = card size);
 * everything inside is absolutely positioned, so nothing that happens during play can move or resize it. */
:root {
  --py-felt: #e9f1ea; --py-felt-2: #d6e5d8; --py-felt-line: rgba(30, 38, 54, .10);
  --py-sel: #ff6b4a; --py-hint: #f5b524;
}
:root[data-theme="dark"] {
  --py-felt: #1d2a24; --py-felt-2: #16211c; --py-felt-line: rgba(255, 255, 255, .07);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --py-felt: #1d2a24; --py-felt-2: #16211c; --py-felt-line: rgba(255, 255, 255, .07);
  }
}

/* the status line above the board never wraps to a second line (it would push the table down) */
body.solo-page #status { width: 100%; contain: inline-size;  height: 22px; min-height: 22px; overflow: hidden; white-space: nowrap; display: block; text-overflow: ellipsis; max-width: 100%; line-height: 22px; }
body.solo-page .solo-board { gap: 0; }
@media (max-width: 640px) { body.solo-page .solo-stage { padding-left: 6px; padding-right: 6px; } }

.py-wrap {
  position: relative; margin: 0 auto; flex: none; overflow: hidden;
  border-radius: 18px; background: radial-gradient(120% 90% at 50% 0%, var(--py-felt) 0%, var(--py-felt-2) 100%);
  box-shadow: inset 0 0 0 1px var(--py-felt-line), 0 3px 0 var(--line-2);
  touch-action: manipulation; -webkit-tap-highlight-color: transparent; contain: layout paint;
  font-variant-numeric: tabular-nums;
}
.py-wrap:focus-visible { outline: 3px solid color-mix(in srgb, var(--blue) 55%, transparent); outline-offset: 2px; }
.py-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.py-table { position: absolute; inset: 0; }

/* score / pass / streak */
.py-info { position: absolute; left: var(--pad); right: var(--pad); top: var(--pad); height: var(--ib); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; z-index: 960; pointer-events: none; }
.py-stat { min-width: 0; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 0 8px; border-radius: 11px; background: color-mix(in srgb, var(--surface) 80%, transparent); box-shadow: inset 0 0 0 1px var(--py-felt-line); overflow: hidden; white-space: nowrap; }
.py-stat small { font-size: 11px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.py-stat b { font-size: 16px; font-weight: 800; color: var(--ink); flex: none; }
.py-score b { color: var(--brand); }

/* cards (the art inside is the shared deck: assets/css/cards.css; .cd-sm on .py-wrap = compact art) */
.py-card { position: absolute; left: 0; top: 0; perspective: 600px; cursor: default; border-radius: calc(var(--cw) * .09); outline: none; will-change: transform; }
.py-in { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .16s ease; border-radius: inherit; }
.py-card.down .py-in { transform: rotateY(180deg); }
.py-face, .py-back { position: absolute; inset: 0; border-radius: inherit; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; }
.py-face { background: var(--cd-face); box-shadow: inset 0 0 0 1px var(--cd-edge), 0 1px 2px rgba(20, 24, 36, .28); }
.py-face > .cd, .py-back > .cd { position: absolute; inset: 0; }
.py-back { transform: rotateY(180deg); box-shadow: 0 1px 2px rgba(20, 24, 36, .3); }

.py-card.free { cursor: pointer; }
.py-card.cov .py-face { filter: brightness(.95); }
@media (hover: hover) { .py-card.free:hover .py-in { transform: translateY(calc(var(--ch) * -.03)); } }
.py-card.sel .py-in { transform: translateY(calc(var(--ch) * -.06)); }
.py-card.sel .py-face { box-shadow: inset 0 0 0 2px var(--py-sel), 0 0 0 3px color-mix(in srgb, var(--py-sel) 45%, transparent), 0 6px 12px rgba(20, 24, 36, .25); }
.py-card.hint .py-face { animation: py-hint 1.1s ease-in-out 3; }
.py-card:focus-visible .py-face { box-shadow: inset 0 0 0 2px var(--blue), 0 0 0 3px color-mix(in srgb, var(--blue) 45%, transparent); }
@keyframes py-hint {
  0%, 100% { box-shadow: inset 0 0 0 1px var(--cd-edge), 0 1px 2px rgba(20, 24, 36, .28); }
  50% { box-shadow: inset 0 0 0 2px var(--py-hint), 0 0 0 4px color-mix(in srgb, var(--py-hint) 55%, transparent), 0 0 14px var(--py-hint); }
}
/* a little more room to hit a card than its drawing (the gaps between cards) */
.py-card.free::after { content: ""; position: absolute; inset: -2px; }

/* stock button (sits on the stock pile), waste spot */
.py-spot, .py-stockbtn { position: absolute; left: 0; top: 0; border-radius: calc(var(--cw) * .12); }
.py-wastespot { box-shadow: inset 0 0 0 2px var(--py-felt-line); z-index: 1; }
.py-stockbtn { z-index: 150; cursor: default; display: grid; place-items: center; outline: none; }
.py-stockbtn.can { cursor: pointer; }
.py-stockbtn .py-empty { display: none; width: 100%; height: 100%; border-radius: inherit; box-shadow: inset 0 0 0 2px var(--py-felt-line); place-items: center; color: color-mix(in srgb, var(--ink) 45%, transparent); }
.py-stockbtn.empty .py-empty { display: grid; }
.py-stockbtn.empty.can .py-empty { color: var(--blue); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--blue) 55%, transparent); background: color-mix(in srgb, var(--blue) 8%, transparent); }
.py-eico { width: 46%; height: 46%; }
.py-cnt { position: absolute; right: -4px; bottom: -4px; min-width: 22px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--surface); color: var(--ink); font-size: 12px; font-weight: 800; display: grid; place-items: center; box-shadow: 0 1px 0 var(--line-2), inset 0 0 0 1px var(--line); }
.py-cnt:empty { display: none; }
.py-stockbtn:focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 55%, transparent); }
.py-stockbtn.hint { animation: py-hint-ring 1.1s ease-in-out 3; }
@keyframes py-hint-ring { 0%, 100% { box-shadow: none; } 50% { box-shadow: 0 0 0 4px var(--py-hint), 0 0 16px var(--py-hint); } }

/* tool buttons on the table */
.py-tool { position: absolute; left: 0; top: 0; z-index: 970; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 0; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); color: var(--ink-2); box-shadow: var(--press, 0 3px 0 var(--line-2)); cursor: pointer; font: inherit; touch-action: manipulation; transition: background .15s, color .15s, opacity .15s; }
.py-tool .ico { width: 20px; height: 20px; }
.py-tool .py-tl { font-size: 10px; font-weight: 700; line-height: 1.1; max-width: 100%; padding: 0 2px; overflow: hidden; text-align: center; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; max-height: 2.2em; }
.py-tool:hover:not(:disabled) { color: var(--ink); }
.py-tool:active:not(:disabled) { transform-origin: center; filter: brightness(.96); }
.py-tool:disabled { opacity: .4; cursor: default; }
.py-tool:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.py-hintb .ico { color: #e19a00; }
@media (max-width: 400px) { .py-tool .py-tl { display: none; } .py-tool .ico { width: 22px; height: 22px; } }

/* floating "+10" and dead-end panel */
.py-fly { position: absolute; inset: 0; pointer-events: none; z-index: 980; }
.py-plus { position: absolute; left: 0; top: 0; font-weight: 800; font-size: 18px; color: var(--brand); text-shadow: 0 1px 0 var(--surface); }
.py-over { position: absolute; inset: 0; z-index: 990; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 10px; box-sizing: border-box; overflow: hidden; background: color-mix(in srgb, var(--surface) 55%, transparent); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.py-over.hidden { display: none; }
.py-over-box { box-sizing: border-box; width: 100%; min-width: 0; max-width: min(340px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-lg, 0 10px 30px rgba(0, 0, 0, .2)); padding: 18px 16px 16px; text-align: center; }
.py-over-box h2 { margin: 0 0 4px; font-size: 22px; font-weight: 800; }
.py-over-box p { margin: 0; color: var(--ink-2); font-size: 14px; }
.py-over-box .py-over-st { margin-top: 2px; color: var(--ink-3); font-size: 13px; }
.py-over-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; margin-top: 14px; }
.py-over-row .btn { min-width: 0; height: auto; min-height: 44px; padding-top: 4px; padding-bottom: 4px; gap: 6px; justify-content: center; white-space: normal; text-align: center; line-height: 1.15; padding-left: 8px; padding-right: 8px; overflow-wrap: break-word; hyphens: auto; }
.py-over-row .btn.primary { grid-column: 1 / -1; }
.land .py-over-box { max-width: min(420px, 100%); }
.py-over-row .btn .ico { flex: none; }
/* a very narrow table (a 320 px phone with the language strip above the game): text-only buttons */
.py-over-box { container-type: inline-size; }
@container (max-width: 250px) {
  .py-over-row .btn .ico { display: none; }
  .py-over-row .btn { padding-left: 4px; padding-right: 4px; }
}
/* narrow tables (320 px phones): a tighter panel */
@media (max-width: 380px) {
  .py-over-box { padding: 14px 10px 12px; border-radius: 16px; }
  .py-over-box h2 { font-size: 19px; }
  .py-over-box p { font-size: 13px; }
  .py-over-row { gap: 6px; margin-top: 10px; }
  .py-over-row .btn { font-size: 13px; padding-left: 6px; padding-right: 6px; }
}
/* status mirror over the info bar (shown only while the status line above the table is out of view) */
.py-toast { position: absolute; left: var(--pad); right: var(--pad); top: var(--pad); height: var(--ib); z-index: 985; box-sizing: border-box; display: flex; align-items: center; justify-content: center; padding: 0 10px; border-radius: 11px; background: var(--ink); color: var(--surface); font-size: 13px; font-weight: 700; line-height: 1.15; text-align: center; overflow: hidden; pointer-events: none; opacity: 0; visibility: hidden; transition: opacity .18s, visibility 0s linear .18s; }
.py-toast.on { opacity: 1; visibility: visible; transition: opacity .18s; }

/* first paint: the loading box takes about the room of the table */
body.solo-page #soloBoard > .loading-box { box-sizing: border-box; width: 100%; padding: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; height: max(300px, min(calc(98vw + 40px), 600px, calc(100svh - 230px))); }

@media (prefers-reduced-motion: reduce) {
  .py-in { transition: none; }
  .py-toast { transition: none; }
  .py-card.hint .py-face, .py-stockbtn.hint { animation: none; box-shadow: inset 0 0 0 3px var(--py-hint); }
}
/* a covered card shows only its corner index (what peeks out between the cards of the row below) */
.py-card.cov .cd-mid { visibility: hidden; }
@media (max-width: 380px) {
  .py-info { gap: 4px; }
  .py-stat { padding: 0 4px; gap: 4px; }
  .py-stat small { font-size: 10px; letter-spacing: 0; }
  .py-stat b { font-size: 15px; }
}
