/* EwrekaGames — FreeCell (assets/js/solo/freecell.js). Classes prefixed fc-. The table is sized once by the script
 * (pixel width/height + --cw/--ch card size) and never changes while playing; cards are positioned with transforms. */

.solo-board.fc-host { max-width: none; }
#soloMain[data-game="freecell"] .solo-board { max-width: none; }   /* wave16 fix: from the first paint (no sideways shift when the table mounts) */
/* wave16 fix: desktop with the side rail: the placeholder takes about the table's measured height (window - 204 px, at
   most 847 px), so the content below does not jump when the table is drawn */
@media (min-width: 1024px) and (min-height: 600px) and (max-height: 1100px) {
  body.solo-page #soloBoard > .loading-box { min-height: min(calc(100vh - 204px), 847px); min-height: min(calc(100svh - 204px), 847px); }
}
/* the status line above the table stays one line on this page (a second line would push the table down) */
.solo-stage:has(.fc-host) .status-line { display: block; width: 100%; height: 22px; line-height: 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; contain: inline-size; }

.fc {
  position: relative; margin: 0 auto; flex: none;
  --felt: #2f8a5f; --felt-2: #22714b; --felt-line: rgba(255, 255, 255, .24); --felt-ink: rgba(255, 255, 255, .34);
  --glow: #ffd84a; --ok: rgba(122, 255, 196, .95);
}
:root[data-theme="dark"] .fc {
  --felt: #1f5c41; --felt-2: #163f2e; --felt-line: rgba(255, 255, 255, .16); --felt-ink: rgba(255, 255, 255, .24);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .fc {
    --felt: #1f5c41; --felt-2: #163f2e; --felt-line: rgba(255, 255, 255, .16); --felt-ink: rgba(255, 255, 255, .24);
  }
}

.fc-table {
  position: absolute; left: 0; top: 0; width: 100%;
  border-radius: 16px;
  background: radial-gradient(120% 90% at 50% 18%, var(--felt) 0%, var(--felt-2) 100%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .14), inset 0 3px 14px rgba(0, 0, 0, .22);
  touch-action: pan-y;   /* the page can still scroll from the felt; cards themselves take the touch (touch-action: none) */
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

/* empty piles */
.fc-ph {
  position: absolute; left: 0; top: 0; width: var(--cw); height: var(--ch);
  border-radius: max(5px, calc(var(--cw) * .1));
  border: 2px solid var(--felt-line); background: rgba(0, 0, 0, .09);
  display: grid; place-items: center; color: var(--felt-ink);
  transition: box-shadow .15s, background .15s;
}
.fc-ph svg { width: 46%; height: 46%; }
.fc-ph-cell { border-style: solid; }
.fc-ph-cell svg { width: 40%; height: 40%; }
.fc-ph-col { border-style: dashed; }
.fc-ph.fc-ok { box-shadow: 0 0 0 3px var(--ok); background: rgba(122, 255, 196, .12); }
.fc-ph.fc-sel { box-shadow: 0 0 0 3px var(--glow); }

/* cards (the art inside is the shared deck: assets/css/cards.css; .cd-sm on .fc = compact art) */
.fc-card {
  position: absolute; left: 0; top: 0; width: var(--cw); height: var(--ch);
  border-radius: max(4px, calc(var(--cw) * .09));
  background: var(--cd-face);
  border: 1px solid var(--cd-edge);
  box-shadow: 0 1px 0 rgba(0, 0, 0, .18), 0 2px 4px -1px rgba(0, 0, 0, .22);
  touch-action: none; cursor: pointer; will-change: transform;
  contain: layout paint;
}
.fc-card > .cd { position: absolute; inset: 0; pointer-events: none; }

.fc-card.sel { box-shadow: 0 0 0 3px var(--glow), 0 3px 8px rgba(0, 0, 0, .3); }
.fc-card.lift { box-shadow: 0 12px 24px rgba(0, 0, 0, .38), 0 0 0 2px var(--glow); cursor: grabbing; }
.fc-card.fc-ok { box-shadow: 0 0 0 3px var(--ok); }
.fc-card.fc-hintsrc { animation: fc-pulse 1s ease-in-out 3; box-shadow: 0 0 0 3px var(--brand); }
.fc-card.fc-hintdst, .fc-ph.fc-hintdst { animation: fc-pulse2 1s ease-in-out 3; box-shadow: 0 0 0 3px var(--blue); }
@keyframes fc-pulse { 50% { box-shadow: 0 0 0 6px var(--brand); } }
@keyframes fc-pulse2 { 50% { box-shadow: 0 0 0 6px var(--blue); } }
@media (prefers-reduced-motion: reduce) {
  .fc-card.fc-hintsrc, .fc-card.fc-hintdst, .fc-ph.fc-hintdst { animation: none; }
}

/* keyboard / screen-reader targets over each pile (pointer input is handled on the table) */
.fc-slot {
  position: absolute; left: 0; top: 0; padding: 0; margin: 0; border: 0; background: transparent;
  border-radius: max(5px, calc(var(--cw) * .1)); pointer-events: none; z-index: 300;
}
.fc-slot:focus { outline: none; }
.fc-slot:focus-visible { outline: 3px solid var(--glow); outline-offset: 2px; }

/* toolbar (under the table; on short landscape screens under the free cells and the foundations) */
.fc-tb { position: absolute; left: 0; top: 0; height: 44px; display: flex; gap: 6px; z-index: 5; }
.fc-btn {
  flex: 1 1 0; min-width: 0; height: 44px; padding: 0 8px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
  box-shadow: var(--press); touch-action: manipulation;
  transition: transform .08s, box-shadow .08s, opacity .15s;
}
.fc-btn:active:not(:disabled) { transform: translateY(3px); box-shadow: none; }
.fc-btn:disabled { cursor: default; color: var(--ink-3); box-shadow: none; transform: translateY(3px); }
.fc-btn:disabled .ico { opacity: .45; }
.fc-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.fc-btn .ico { width: 18px; height: 18px; flex: none; display: inline-grid; }
.fc-btn .ico svg { width: 18px; height: 18px; }
.fc-btn-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc-hint .ico { color: var(--brand); }
.fc-deal { flex: 1.5 1 0; flex-direction: column; gap: 1px; line-height: 1.1; }
.fc-deal-n { font-size: 13px; font-weight: 800; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.fc-deal-m { font-size: 11px; font-weight: 600; color: var(--ink-3); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
/* narrow tables: icon above a small label */
.fc.narrow .fc-btn:not(.fc-deal), .fc.wide .fc-btn:not(.fc-deal) { flex-direction: column; gap: 1px; padding: 0 3px; font-size: 11px; line-height: 1.1; }
.fc.narrow .fc-btn .ico, .fc.narrow .fc-btn .ico svg, .fc.wide .fc-btn .ico, .fc.wide .fc-btn .ico svg { width: 17px; height: 17px; }
.fc-btn-t { max-width: 100%; }
.fc.wide .fc-tb { gap: 4px; }
.fc.wide .fc-btn { padding: 0 4px; }

/* deal menu */
.fc-menu {
  position: absolute; inset: 0; z-index: 700; display: grid; place-items: center; padding: 10px;
  background: var(--overlay, rgba(23, 32, 51, .55)); border-radius: 16px;
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.fc-menu-box {
  width: min(360px, 100%); max-height: 100%; overflow: auto;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow-lg); padding: 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px;
}
.fc-menu-box > * { min-width: 0; }
.fc-menu h3 { margin: 0; font-size: 18px; font-weight: 800; }
.fc-lv { margin: -6px 0 0; color: var(--ink-3); font-size: 13px; font-weight: 600; }
.fc-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.fc-stats div { background: var(--surface-2); border-radius: 10px; padding: 6px 8px; min-width: 0; }
.fc-stats small { display: block; font-size: 11px; color: var(--ink-3); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fc-stats b { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
.fc-form { display: grid; gap: 6px; }
.fc-form label { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.fc-row { display: flex; gap: 8px; }
.fc-in {
  flex: 1; min-width: 0; height: 44px; padding: 0 12px; border-radius: 12px;
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink);
  font: inherit; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.fc-in:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.fc-row .btn { height: 44px; flex: none; }
.fc-help { margin: 0; font-size: 12px; color: var(--ink-3); }
.fc-help.bad { color: var(--bad); font-weight: 700; }
.fc-menu .btn.ghost { justify-self: stretch; }

.fc-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

/* short labels on the deal button where space is tight (landscape side blocks) */
.fc-deal-s, .fc-deal-c { display: none; font-variant-numeric: tabular-nums; }
.fc.wide .fc-btn-t { display: none; }
.fc.wide .fc-deal-n, .fc.wide .fc-deal-m { display: none; }
.fc.wide .fc-deal-s { display: block; font-size: 11px; font-weight: 800; max-width: 100%; overflow: hidden; text-overflow: clip; letter-spacing: -.02em; }
.fc.wide .fc-deal { flex: 2 1 0; padding: 0 2px; }
/* short landscape screens: the deal menu is a dialog over the whole viewport, not squeezed into the low table */
.fc.wide .fc-menu { position: fixed; inset: 0; border-radius: 0; z-index: 1000; }
.fc.wide .fc-menu-box { width: min(560px, 100%); grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 14px; padding: 12px 14px; }
.fc.wide .fc-menu-box > .fc-mh, .fc.wide .fc-menu-box > .fc-lv { grid-column: 1 / -1; }
.fc.wide .fc-menu-box > .fc-form { align-self: start; }
/* the table has its own Hint button; the shell's second one in the side card is hidden on this page (still clicked by it) */
body:has(.fc-host) #btnHint { display: none; }
.fc.wide .fc-deal-c { display: block; font-size: 11px; font-weight: 600; color: var(--ink-3); }
.fc-form { grid-template-columns: minmax(0, 1fr); }
.fc-row > .fc-in { width: 100%; }
.fc.narrow .fc-menu-box { padding: 12px; gap: 8px; }
.fc.narrow .fc-menu h3 { font-size: 16px; }
.fc.narrow .fc-stats div { padding: 4px 6px; }
.fc.narrow .fc-stats b { font-size: 15px; }
.fc-mh { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.fc-x { width: 44px; height: 44px; margin: -10px -10px -10px 0; flex: none; display: grid; place-items: center; border: 0; border-radius: 12px; background: transparent; color: var(--ink-2); cursor: pointer; }
.fc-x:hover { background: var(--surface-2); color: var(--ink); }
.fc-x .ico, .fc-x svg { width: 20px; height: 20px; }
.fc-x:focus-visible { outline: 2px solid var(--brand); }

/* wave18: labels that do not fit are not ellipsized: icons only (the name is in aria-label/title), short deal number */
.fc.fc-ico .fc-btn:not(.fc-deal) .fc-btn-t { display: none; }
.fc.fc-ico .fc-btn:not(.fc-deal) .ico, .fc.fc-ico .fc-btn:not(.fc-deal) .ico svg { width: 20px; height: 20px; }
.fc.fc-dsh .fc-deal-n { display: none; }
.fc.fc-dsh .fc-deal-s { display: block; font-size: 13px; font-weight: 800; max-width: 100%; overflow: hidden; text-overflow: clip; }
.fc.fc-dsh .fc-deal-s::before { content: '#'; }
/* wave18: FreeCell has neither the mistakes switch nor the side-card Hint (its hint is in the table toolbar), so the
   options row is not drawn at all (from first paint: the page marker is server-rendered, nothing shifts later) */
#soloMain[data-game="freecell"] .solo-opts { display: none; }
