/* NVIDIAddict — Solitaire (Klondike). Every rule is scoped under .ag-solitaire; classes are prefixed sl-. */
.ag-solitaire {
  --sl-felt-a: #D3E5C7; --sl-felt-b: #BCD4AC; --sl-edge: rgba(30, 60, 25, .18);
  --sl-slot: rgba(25, 60, 20, .26); --sl-slot-ink: rgba(25, 60, 20, .32); --sl-badge: rgba(16, 32, 14, .78); --sl-badge-ink: #EAF3E2;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ag-solitaire {
    --sl-felt-a: #15301D; --sl-felt-b: #0C1A11; --sl-edge: rgba(143, 209, 26, .12);
    --sl-slot: rgba(175, 225, 160, .2); --sl-slot-ink: rgba(175, 225, 160, .3); --sl-badge: rgba(5, 10, 6, .82); --sl-badge-ink: #DDEBD3;
  }
}
:root[data-theme="dark"] .ag-solitaire {
  --sl-felt-a: #15301D; --sl-felt-b: #0C1A11; --sl-edge: rgba(143, 209, 26, .12);
  --sl-slot: rgba(175, 225, 160, .2); --sl-slot-ink: rgba(175, 225, 160, .3); --sl-badge: rgba(5, 10, 6, .82); --sl-badge-ink: #DDEBD3;
}

/* ---- stage: table + controls, sized in JS to the space between the game bar and the bottom rail ---- */
.ag-solitaire .sl-stage { position: relative; display: grid; grid-template-rows: auto auto; align-content: start; gap: 8px; }
.ag-solitaire .sl[data-act="right"] .sl-stage { grid-template-columns: auto 72px; grid-template-rows: none; justify-content: center; align-items: start; }
.ag-solitaire .sl-table { position: relative; justify-self: center; max-width: 100%; border-radius: 14px; border: 1px solid var(--sl-edge);
  background: radial-gradient(130% 85% at 50% 0%, var(--sl-felt-a), var(--sl-felt-b));
  user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; }
.ag-solitaire .sl-table.sl-party { overflow: hidden; }

/* ---- cards (the shared deck from cards.js, sized by --slcw) ---- */
.ag-solitaire .pcard { --cw: var(--slcw, 64px); }
.ag-solitaire .sl-c { position: absolute; left: 0; top: 0; width: var(--slcw); height: var(--slch); transition: transform .22s cubic-bezier(.2, .8, .3, 1); will-change: transform; touch-action: none; cursor: pointer; }
.ag-solitaire .sl-c.sl-dn { cursor: default; }
.ag-solitaire .sl-c > .pcard { width: var(--slcw); height: var(--slch); }
.ag-solitaire .sl-table.sl-instant .sl-c { transition: none !important; }
.ag-solitaire .sl-c.sl-drag { transition: none; cursor: grabbing; }
.ag-solitaire .sl-c.sl-drag > .pcard { box-shadow: 0 16px 28px -10px rgba(0, 0, 0, .6), 0 0 0 1px rgba(0, 0, 0, .22); }
/* small cards: rank top-left, suit top-right, so a card buried in a column still reads */
@container (max-width: 58px) {
  .ag-solitaire .pcard .pc-idx { left: 6%; right: 5%; top: 2.5%; justify-content: space-between; align-items: flex-start; gap: 0; }
  .ag-solitaire .pcard .pc-idx b { font-size: calc(var(--cw) * .34) !important; line-height: .95; letter-spacing: -.06em; }
  .ag-solitaire .pcard .pc-idx i { display: block; font-size: calc(var(--cw) * .27); line-height: 1; margin-top: calc(var(--cw) * .02); }
  .ag-solitaire .pcard .pc-big { top: 63%; font-size: calc(var(--cw) * .56); }
  /* a card half hidden in the Draw 3 fan shows its suit under the rank, on the visible side */
  .ag-solitaire .sl-fan .pcard .pc-idx { flex-direction: column !important; right: auto; align-items: center; }
}
.ag-solitaire .sl-c.sl-under > .pcard { box-shadow: none; }
/* full-size faces: keep the pips clear of the corner index */
.ag-solitaire .pcard .pc-pips { inset: 22% 33% 22% 33%; }
.ag-solitaire .pcard .pc-pips i { font-size: calc(var(--cw) * .165); }
@keyframes sl-flipin { from { transform: scaleX(.04); } to { transform: scaleX(1); } }
.ag-solitaire .pcard.sl-flipin { animation: sl-flipin .2s cubic-bezier(.3, .7, .4, 1); }
@keyframes sl-shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-4px); } 45% { transform: translateX(4px); } 70% { transform: translateX(-2px); } 85% { transform: translateX(1px); } }
.ag-solitaire .sl-shake { animation: sl-shake .3s ease; }

/* hint: the card to move glows gold, where it goes glows green */
.ag-solitaire .sl-c.sl-hint > .pcard { box-shadow: 0 0 0 3px var(--gold), 0 0 18px 3px color-mix(in srgb, var(--gold) 55%, transparent); }
.ag-solitaire .sl-c.sl-hint-to > .pcard, .ag-solitaire .sl-slot.sl-hint-to { box-shadow: 0 0 0 3px var(--accent), 0 0 16px 3px color-mix(in srgb, var(--accent) 50%, transparent); }
@keyframes sl-pulse { 50% { filter: brightness(1.12); } }
.ag-solitaire .sl-hint > .pcard, .ag-solitaire .sl-hint-to > .pcard { animation: sl-pulse 1.1s ease-in-out infinite; }
/* drag: legal drops are outlined, the one under the card is lit */
.ag-solitaire .sl-c.sl-can > .pcard, .ag-solitaire .sl-slot.sl-can { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 50%, transparent); }
.ag-solitaire .sl-c.sl-over > .pcard, .ag-solitaire .sl-slot.sl-over { box-shadow: 0 0 0 3px var(--accent), 0 0 14px 2px color-mix(in srgb, var(--accent) 45%, transparent); }

/* ---- empty piles ---- */
.ag-solitaire .sl-slot { position: absolute; left: 0; top: 0; width: var(--slcw); height: var(--slch); border-radius: calc(var(--slcw) * .085); border: 1.5px solid var(--sl-slot);
  display: flex; align-items: center; justify-content: center; touch-action: none; background: color-mix(in srgb, var(--sl-slot) 25%, transparent); }
.ag-solitaire .sl-slot span { font: 800 calc(var(--slcw) * .42) / 1 var(--display); color: var(--sl-slot-ink); pointer-events: none; }
.ag-solitaire .sl-s-waste { border-color: transparent; background: none; }
.ag-solitaire .sl-s-stock { cursor: pointer; }
.ag-solitaire .sl-recyc { display: block; width: 46%; color: var(--sl-slot-ink); pointer-events: none; }
.ag-solitaire .sl-recyc svg { display: block; width: 100%; height: auto; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.ag-solitaire .sl-s-stock.sl-can-re { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.ag-solitaire .sl-s-stock.sl-can-re .sl-recyc { color: var(--accent); }
.ag-solitaire .sl-s-stock.sl-spent .sl-recyc { opacity: .35; }
.ag-solitaire .sl-count, .ag-solitaire .sl-pass { position: absolute; left: 0; top: 0; z-index: 95; pointer-events: none; white-space: nowrap; font: 700 10.5px / 1 var(--mono); padding: 3px 6px; border-radius: 999px; background: var(--sl-badge); color: var(--sl-badge-ink); }
.ag-solitaire .sl-pass { background: var(--gold); color: #1A1305; }

/* ---- "no useful moves" ---- */
.ag-solitaire .sl-banner { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 4000; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 12px;
  width: max-content; max-width: calc(100% - 16px); padding: 10px 12px 10px 16px; border-radius: 14px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: 0 14px 34px -10px rgba(0, 0, 0, .55); font-weight: 600; font-size: 14.5px; }
.ag-solitaire .sl-bb { display: flex; gap: 8px; }
.ag-solitaire .sl-mini { min-height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--raised); color: var(--ink); font: 600 14px var(--sans); cursor: pointer; }
.ag-solitaire .sl-mini.pri { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.ag-solitaire .sl-mini.x { min-width: 44px; padding: 0; font-size: 20px; color: var(--muted); background: transparent; border-color: transparent; }

/* ---- controls ---- */
.ag-solitaire .sl-acts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.ag-solitaire .sl[data-act="right"] .sl-acts { grid-template-columns: minmax(0, 1fr); grid-auto-rows: 58px; align-content: start; }
.ag-solitaire .sl-act { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 54px; padding: 5px 2px;
  border: 1px solid var(--line); background: var(--raised); color: var(--ink); border-radius: 12px; font: 600 12px / 1.1 var(--sans); cursor: pointer; transition: transform .08s, background .15s; -webkit-tap-highlight-color: transparent; }
.ag-solitaire .sl-act:active:not(:disabled) { transform: scale(.96); }
.ag-solitaire .sl-act svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ag-solitaire .sl-act:disabled { opacity: .38; cursor: default; }
.ag-solitaire .sl-a-new { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.ag-solitaire .sl-a-fin { background: var(--gold); color: #1A1305; border-color: transparent; }
@keyframes sl-glow { 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold) 35%, transparent); } }
.ag-solitaire .sl-a-fin:not([hidden]) { animation: sl-glow 1.4s ease-in-out infinite; }
.ag-solitaire .sl-a-day.on { border-color: var(--gold); color: var(--gold); background: var(--gold-soft); }
.ag-solitaire .sl-dot { position: absolute; top: 7px; right: calc(50% - 19px); width: 8px; height: 8px; border-radius: 50%; background: var(--gold); display: none; }
.ag-solitaire .sl-a-day.todo:not(.on) .sl-dot { display: block; }

/* ---- sheets: new deal, result ---- */
.ag-solitaire .sl-sheet { position: absolute; inset: 0; z-index: 5000; display: flex; align-items: center; justify-content: center; padding: 10px; background: rgba(5, 8, 5, .55); border-radius: 14px; }
.ag-solitaire .sl-card { width: min(100%, 430px); max-height: 100%; overflow: auto; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px 16px; box-shadow: 0 18px 50px rgba(0, 0, 0, .5); display: grid; gap: 10px; overscroll-behavior: contain; }
.ag-solitaire .sl-card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.ag-solitaire .sl-card h4 { font: 800 22px / 1.1 var(--display); margin: 0; }
.ag-solitaire .sl-result h4 { color: var(--good); }
.ag-solitaire .sl-x { border: 0; background: transparent; font-size: 26px; line-height: 1; color: var(--muted); cursor: pointer; width: 44px; height: 44px; border-radius: 10px; margin: -6px -8px -6px 0; }
.ag-solitaire .sl-x:hover { background: var(--raised); }
.ag-solitaire .sl-sub { margin: -6px 0 0; color: var(--muted); font-size: 13px; }
.ag-solitaire .sl-big3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ag-solitaire .sl-big3 > div { display: grid; gap: 2px; padding: 10px 8px; border-radius: 12px; background: var(--raised); text-align: center; }
.ag-solitaire .sl-big3 b { font: 800 24px / 1.05 var(--display); font-variant-numeric: tabular-nums; }
.ag-solitaire .sl-big3 small { font-size: 11.5px; color: var(--muted); line-height: 1.25; }
.ag-solitaire .sl-big3 em { font-style: normal; color: var(--gold); font-weight: 700; }
.ag-solitaire .sl-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(62px, 1fr)); gap: 6px; }
.ag-solitaire .sl-tiles.sl-t5 { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; }
.ag-solitaire .sl-t5 .sl-tile { padding: 7px 2px; }
.ag-solitaire .sl-t5 .sl-tile b { font-size: 15px; }
.ag-solitaire .sl-tile { display: grid; gap: 1px; padding: 7px 6px; border-radius: 10px; border: 1px solid var(--line); text-align: center; min-width: 0; }
.ag-solitaire .sl-tile b { font: 700 16px / 1.15 var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ag-solitaire .sl-tile b i { font-style: normal; color: var(--muted); font-weight: 500; font-size: 13px; }
.ag-solitaire .sl-tile small { font-size: 10.5px; color: var(--muted); line-height: 1.2; }
.ag-solitaire .sl-dline { margin: 0; font-size: 13.5px; color: var(--muted); }
.ag-solitaire .sl-dline b { color: var(--gold); font-family: var(--mono); }
.ag-solitaire .sl-line { margin: 0; padding: 10px 12px; border-radius: 10px; border-left: 3px solid var(--accent); background: var(--accent-soft); font-size: 13.5px; line-height: 1.45; }
.ag-solitaire .sl-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.ag-solitaire .sl-btn { flex: 1 1 140px; min-height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--raised); color: var(--ink); font: 700 15px var(--sans); cursor: pointer; padding: 0 12px; }
.ag-solitaire .sl-btn.pri { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.ag-solitaire .sl-btn.gold { background: var(--gold); color: #1A1305; border-color: transparent; }
.ag-solitaire .sl-pick { display: grid; gap: 2px; text-align: left; width: 100%; min-height: 58px; padding: 9px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--raised); color: var(--ink); font: inherit; cursor: pointer; }
.ag-solitaire .sl-pick b { font-size: 15.5px; }
.ag-solitaire .sl-pick small { font-size: 12.5px; color: var(--muted); }
.ag-solitaire .sl-pick.pri { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.ag-solitaire .sl-pick.pri small { color: inherit; opacity: .78; }
.ag-solitaire .sl-pick.gold { border-color: color-mix(in srgb, var(--gold) 60%, var(--line)); background: var(--gold-soft); }
.ag-solitaire .sl-opts { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 600; font-size: 14px; }
.ag-solitaire .sl-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: var(--raised); }
.ag-solitaire .sl-seg button { border: 0; background: transparent; min-height: 40px; padding: 0 14px; border-radius: 999px; cursor: pointer; font: 600 13.5px var(--sans); color: var(--muted); }
.ag-solitaire .sl-seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.ag-solitaire .sl-note { margin: -4px 0 0; color: var(--muted); }
.ag-solitaire .sl-warn { margin: 0; color: var(--warn); }

/* ---- below the table ---- */
.ag-solitaire .sl-more { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-top: 16px; align-items: start; }
.ag-solitaire .sl-rules p { margin: 0 0 8px; line-height: 1.5; }
.ag-solitaire .sl-rules p:last-child { margin-bottom: 0; }

@media (prefers-reduced-motion: reduce) {
  .ag-solitaire .sl-c { transition: none; }
  .ag-solitaire .sl-hint > .pcard, .ag-solitaire .sl-hint-to > .pcard, .ag-solitaire .sl-a-fin:not([hidden]) { animation: none; }
}
