/* ===========================================================
   10K TAVERN — Solitaire (Klondike)
   Builds on /styles.css (felt, brass, bone, the two themes).
   Cards are real-card white with red backs in both themes, so
   they stand out on the felt. Card size comes from --cw / --ch,
   which main.js sets from the table's width.
   =========================================================== */

/* -------------------- picker -------------------- */
.sol-modes{ grid-template-columns: repeat(2, 1fr); max-width: 640px; margin-left:auto; margin-right:auto; }
@media (max-width: 560px){ .sol-modes{ grid-template-columns: minmax(0,1fr); } }
.sol-mode-record{
  font-family: var(--mono);
  font-size: 0.75rem;
  color: rgba(var(--fg-rgb),0.45);
  padding-top: 6px;
}
.sol-resume{ text-align:center; margin-top: 24px; }

/* -------------------- table layout -------------------- */
.sol-felt{
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
}
.sol-stats, .sol-board, .sol-message, .sol-controls{
  width: 100%;
  max-width: 920px;
  margin-left: auto;
  margin-right: auto;
}
.sol-stats{
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 12px;
}
.sol-stats .plaque{ padding: 10px 14px; }
.sol-stats .p-name{ font-size: 0.9rem; }
.sol-stats .p-score{ font-size: 1.35rem; margin-top: 2px; }
.sol-mode{ font-family: var(--display) !important; }
.sol-stats .p-onboard{ white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 640px){
  .sol-felt{ gap: 10px; }
  .sol-stats{ gap: 8px; }
  .sol-stats .plaque{ padding: 8px 10px; }
  .sol-stats .p-name{ font-size: 0.78rem; }
  .sol-stats .p-score{ font-size: 1.05rem; }
  .sol-stats .p-onboard{ font-size: 0.62rem; }
}

.sol-message{
  min-height: 1.3em;
  text-align: center;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--brass-bright);
}
.sol-controls{ justify-content: center; flex-wrap: wrap; }
.sol-controls .btn-secondary, .sol-controls .btn-primary{ padding: 11px 22px; }

/* -------------------- board -------------------- */
.sol-board{
  position: relative;
  z-index: 0;   /* keeps every card in its own layer, under pop-up boxes */
  --cw: 100px;
  --ch: 140px;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.sol-slot{
  position: absolute;
  left: 0; top: 0;
  width: var(--cw);
  height: var(--ch);
  border-radius: calc(var(--cw) * 0.08);
  border: 1.5px dashed rgba(var(--fg-rgb),0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(var(--fg-rgb),0.16);
  font-size: calc(var(--cw) * 0.42);
  font-family: var(--display);
}
.sol-slot.stock{ cursor: pointer; border-style: solid; border-color: rgba(var(--brass-rgb),0.35); color: rgba(var(--brass-rgb),0.6); }
.sol-slot.stock.spent{ color: rgba(var(--fg-rgb),0.15); cursor: default; }
.sol-slot.foundation{ border-style: solid; border-color: rgba(var(--brass-rgb),0.3); background: rgba(0,0,0,0.12); }
.sol-slot.drop-ok{ border-color: var(--brass-bright); background: rgba(var(--brass-rgb),0.12); }

/* -------------------- cards -------------------- */
.sol-card{
  position: absolute;
  left: 0; top: 0;
  width: var(--cw);
  height: var(--ch);
  border-radius: calc(var(--cw) * 0.08);
  transition: transform 0.2s ease;
  will-change: transform;
  touch-action: none;   /* a drag moves the card, not the page */
}
.sol-card.face{
  /* Real-card white in both themes — the dark Casino Night "bone" made the
     whole table look gloomy. */
  background: linear-gradient(180deg, #FFFFFF, #F6F4EF);
  border: 1px solid rgba(0,0,0,0.18);
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
  color: #1C1A18;
  cursor: grab;
}
.sol-card.red{ color: #C8262F; }

.sol-corner{
  position: absolute;
  top: calc(var(--cw) * 0.05);
  left: calc(var(--cw) * 0.06);
  display: flex;
  align-items: baseline;
  gap: calc(var(--cw) * 0.015);
  font-family: var(--display);
  font-weight: 700;
  font-size: calc(var(--cw) * 0.24);
  letter-spacing: -0.03em;
  line-height: 1;
}
.sol-corner i{ font-style: normal; font-size: 0.85em; }
/* The same index, turned around in the bottom-right corner */
.sol-corner.bottom{
  top: auto; left: auto;
  bottom: calc(var(--cw) * 0.05);
  right: calc(var(--cw) * 0.06);
  transform: rotate(180deg);
}

/* Number cards: pips in the traditional pattern. The pip area sits
   between the two corner indexes so they never overlap. */
.sol-pips{
  position: absolute;
  left: 30%; right: 30%;
  top: 29%; bottom: 29%;
}
.sol-p{
  position: absolute;
  width: calc(var(--cw) * 0.17);
  height: calc(var(--cw) * 0.17);
  transform: translate(-50%, -50%);
}
.sol-p svg{ display: block; width: 100%; height: 100%; }
.sol-p.flip{ transform: translate(-50%, -50%) rotate(180deg); }
.sol-pips.ace .sol-p{ width: calc(var(--cw) * 0.4); height: calc(var(--cw) * 0.4); }

/* Jacks, Queens and Kings: a framed two-headed portrait */
.sol-courtbox{
  position: absolute;
  left: 17%; right: 17%;
  top: 22%; bottom: 22%;
}
.sol-courtbox svg{ display: block; width: 100%; height: 100%; }

.sol-card.back{
  /* Classic deck back: a red lattice inside a white border. */
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,0.26) 0 1.5px, transparent 1.5px 6px),
    repeating-linear-gradient(-45deg, rgba(255,255,255,0.26) 0 1.5px, transparent 1.5px 6px),
    linear-gradient(160deg, #D23A3F, #A61E28);
  border: 1px solid rgba(0,0,0,0.2);
  box-shadow: inset 0 0 0 calc(var(--cw) * 0.05) #FFFFFF, inset 0 0 0 calc(var(--cw) * 0.06) rgba(166,30,40,0.5), 0 1px 3px rgba(0,0,0,0.4);
}
.sol-card.back > *{ display: none; }   /* face-down: hide rank and suit */
.sol-card.back.on-stock{
  cursor: pointer;
  /* The deck is many cards stacked in one spot; without this their shadows
     add up into a heavy dark ring. */
  box-shadow: inset 0 0 0 calc(var(--cw) * 0.05) #FFFFFF, inset 0 0 0 calc(var(--cw) * 0.06) rgba(166,30,40,0.5);
}

.sol-card.dragging{
  transition: none;
  cursor: grabbing;
  box-shadow: 0 10px 22px rgba(0,0,0,0.45);
}
.sol-card.flip{ animation: sol-flip 0.28s ease-out; }
@keyframes sol-flip{
  0%{ filter: brightness(0.7); clip-path: inset(0 50% 0 50%); }
  100%{ filter: none; clip-path: inset(0 0 0 0); }
}
.sol-card.hint, .sol-slot.hint{
  animation: sol-hint 0.6s ease-in-out 3;
}
@keyframes sol-hint{
  0%, 100%{ box-shadow: 0 0 0 0 rgba(var(--brass-rgb),0); }
  50%{ box-shadow: 0 0 0 4px var(--brass-bright), 0 0 18px 4px rgba(var(--brass-rgb),0.6); }
}
.sol-card.shake{ animation: sol-shake 0.3s ease; }
@keyframes sol-shake{
  0%,100%{ translate: 0 0; } 25%{ translate: -4px 0; } 75%{ translate: 4px 0; }
}
.sol-board.won .sol-card{ cursor: default; }

/* -------------------- modals -------------------- */
.sol-howto{
  font-size: 0.88rem;
  line-height: 1.6;
  color: rgba(var(--ink-rgb),0.8);
  padding-left: 20px;
  margin: 0 0 18px;
}
#won-body{ font-size: 0.95rem; line-height: 1.6; }
#won-body .sol-won-time{
  font-family: var(--mono);
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--pine);
  line-height: 1.2;
}
#won-body .sol-won-best{ font-weight: 700; color: var(--brass); }
/* Three buttons in the end-game box: let them wrap instead of spilling out */
#modal-stuck .modal-actions{ flex-wrap: wrap; }
#modal-stuck .modal-actions #stuck-keep{ margin-right: auto; }
#stuck-body table{ width:100%; border-collapse:collapse; margin:4px 0 4px; font-family: var(--mono); font-size:0.85rem; }
#stuck-body td{ padding:6px 4px; border-bottom:1px solid rgba(var(--ink-rgb),0.1); }
#stuck-body td:last-child{ text-align:right; }
#won-body table{ width:100%; border-collapse:collapse; margin-top:12px; font-family: var(--mono); font-size:0.85rem; }
#won-body td{ padding:6px 4px; border-bottom:1px solid rgba(var(--ink-rgb),0.1); }
#won-body td:last-child{ text-align:right; }
