/* =============================================
   Πασιέντζα / Αράχνη — game styles
   Extends /style.css tokens (--bg, --glass, --border, --text, --dim, --acc …)
   The table is a green felt panel; cards are drawn in CSS, sized from
   --cw / --ch which the script sets from the board width.
   ============================================= */

:root {
  --felt-1: #11553f;
  --felt-2: #0b3a2c;
  --felt-edge: rgba(0, 0, 0, .35);
  --card-face: #fdfcf7;
  --card-edge: #d6d3c4;
  --card-red: #c8102e;
  --card-black: #1b1d29;
  --back-1: #6d28d9;
  --back-2: #7c3aed;
  --hint: #fbbf24;
}

/* ── Header ── */
.sol-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(6, 6, 26, 0.9);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.sol-title {
  font-family: 'Syne', sans-serif;
  font-size: clamp(0.9rem, 3.6vw, 1.6rem);
  font-weight: 800;
  letter-spacing: .04em;
  text-align: center;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: linear-gradient(135deg, #ffffff 0%, #c084fc 50%, #4cc9f0 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.sol-header .lang-select-game {
  background: var(--glass);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 6px 8px;
  font: 600 .8rem 'DM Sans', sans-serif;
  cursor: pointer;
}
.sol-header .lang-select-game option { background: #0d0d2b; color: var(--text); }

/* ── Layout ── */
.sol-main {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: 10px 10px 8px;
}
body[data-variant="spider"] .sol-main { max-width: 1060px; }

/* ── Toolbar ── */
.sol-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin-bottom: 8px;
}
.sol-modes {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 100px;
}
.sol-modes button {
  border: 0;
  background: transparent;
  color: var(--dim);
  font: 600 .8rem 'DM Sans', sans-serif;
  padding: 6px 12px;
  border-radius: 100px;
  cursor: pointer;
  transition: background var(--t), color var(--t);
  white-space: nowrap;
}
.sol-modes button.active { background: rgba(124, 58, 237, .35); color: #fff; }
.sol-modes button:focus-visible,
.sol-actions button:focus-visible { outline: 2px solid var(--acc2); outline-offset: 2px; }

.sol-stats {
  font-size: .85rem;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.sol-stats strong { color: var(--text); font-weight: 700; }

.sol-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.sol-actions button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--glass);
  color: var(--text);
  font: 600 .82rem 'DM Sans', sans-serif;
  padding: 7px 12px;
  border-radius: 100px;
  cursor: pointer;
  transition: background var(--t), border-color var(--t);
}
.sol-actions button:hover { background: var(--glass-h); border-color: var(--border2); }
.sol-actions button[hidden] { display: none; }
.sol-actions .btn-auto { border-color: rgba(251, 191, 36, .6); color: #fde68a; }

/* ── Table ── */
.sol-board {
  --cw: 80px;
  --ch: 112px;
  position: relative;
  width: 100%;
  min-height: 320px;
  border-radius: 14px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, .07), transparent 60%),
    linear-gradient(160deg, var(--felt-1), var(--felt-2));
  box-shadow: inset 0 0 0 1px var(--felt-edge), inset 0 0 60px rgba(0, 0, 0, .35);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.slot,
.card {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--cw);
  height: var(--ch);
  border-radius: calc(var(--cw) * .09);
}

.slot {
  border: 1.5px dashed rgba(255, 255, 255, .22);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, .28);
  font: 700 calc(var(--cw) * .34) 'DM Sans', sans-serif;
}
.slot-stock { cursor: pointer; }
.slot-stock.recycle::before { content: '↻'; font-size: calc(var(--cw) * .5); color: rgba(255, 255, 255, .55); }
.slot-stock.empty:not(.recycle) { border-style: solid; border-color: rgba(255, 255, 255, .12); }
body[data-variant="spider"] .slot-f { border-color: rgba(255, 255, 255, .1); }
.deals-badge {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 600;
  min-width: 26px;
  height: 20px;
  padding: 0 6px;
  border-radius: 100px;
  background: var(--acc);
  color: #fff;
  font: 700 12px/20px 'DM Sans', sans-serif;
  text-align: center;
  pointer-events: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .4);
}
.deals-badge[hidden] { display: none; }
.slot.hint { border-color: var(--hint); box-shadow: 0 0 0 2px var(--hint), 0 0 18px rgba(251, 191, 36, .55); }

/* ── Cards ── */
.card {
  background: var(--card-face);
  border: 1px solid var(--card-edge);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .35);
  transition: transform .18s ease;
  touch-action: none;
  cursor: grab;
  will-change: auto;
}
.no-anim .card,
.no-anim .slot { transition: none !important; }
.card.dragging {
  transition: none;
  cursor: grabbing;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .45);
  will-change: transform;
}
.card.red { color: var(--card-red); }
.card.black { color: var(--card-black); }

.card .ci {
  position: absolute;
  left: calc(var(--cw) * .07);
  top: calc(var(--cw) * .035);
  display: flex;
  align-items: baseline;
  gap: calc(var(--cw) * .02);
  line-height: 1;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: calc(var(--cw) * .27);
  letter-spacing: -.03em;
}
.card .ci b { font-weight: 700; }
.card .ci i { font-style: normal; font-size: .92em; }
.card .cc {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(var(--ch) * .1);
  text-align: center;
  line-height: 1;
  font-size: calc(var(--cw) * .54);
}
.card .cc.face {
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 700;
  font-size: calc(var(--cw) * .44);
  left: 18%;
  right: 18%;
  bottom: calc(var(--ch) * .12);
  padding: calc(var(--cw) * .06) 0;
  border: 1px solid currentColor;
  border-radius: calc(var(--cw) * .06);
  opacity: .9;
}

.card.down {
  cursor: default;
  border: 2px solid #f5f3ff;
  background:
    repeating-linear-gradient(45deg, var(--back-1) 0 5px, var(--back-2) 5px 10px);
}
.card.down::after {
  content: '';
  position: absolute;
  inset: calc(var(--cw) * .06);
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: calc(var(--cw) * .05);
}
.card.down > span { display: none; }

.card.hint { box-shadow: 0 0 0 2px var(--hint), 0 0 16px rgba(251, 191, 36, .75); }
.card.nope { animation: sol-nope .28s ease; }
@keyframes sol-nope {
  0%, 100% { translate: 0 0; }
  25% { translate: -5px 0; }
  75% { translate: 5px 0; }
}

/* Very small cards (Spider on phones): smaller corner, no centre pip clutter */
@media (max-width: 520px) {
  body[data-variant="spider"] .card .ci { font-size: calc(var(--cw) * .34); left: calc(var(--cw) * .05); letter-spacing: -.06em; }
  body[data-variant="spider"] .card .ci i { display: none; }
  body[data-variant="spider"] .card .cc { font-size: calc(var(--cw) * .62); bottom: calc(var(--ch) * .08); }
  body[data-variant="spider"] .card .cc.face { left: 10%; right: 10%; font-size: calc(var(--cw) * .44); }
}

.sol-record {
  min-height: 1.2em;
  margin: 8px 4px 0;
  font-size: .8rem;
  color: var(--muted);
  text-align: center;
}

/* ── Toast ── */
.sol-toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 20px);
  max-width: min(92vw, 460px);
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(13, 13, 43, .96);
  border: 1px solid var(--border2);
  color: var(--text);
  font-size: .88rem;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 1500;
}
.sol-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ── Win overlay ── */
.sol-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(3, 3, 15, .72);
  backdrop-filter: blur(6px);
}
.sol-overlay[hidden] { display: none; }
.sol-result {
  width: min(420px, 100%);
  padding: 26px 22px 22px;
  border-radius: 20px;
  text-align: center;
  background: linear-gradient(160deg, #15123a, #0b0b24);
  border: 1px solid var(--border2);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
}
.sol-result-emoji { font-size: 3rem; line-height: 1; margin-bottom: 8px; }
.sol-result h2 {
  font-family: 'Syne', sans-serif;
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--text);
}
.sol-result p { color: var(--dim); font-size: .92rem; margin-bottom: 6px; }
.sol-result .btn-primary { margin-top: 12px; }

.sol-confetti { position: fixed; inset: 0; pointer-events: none; z-index: 1300; overflow: hidden; }
.sol-confetti i {
  position: absolute;
  top: -12px;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  opacity: .9;
  animation-name: sol-fall;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}
@keyframes sol-fall {
  to { transform: translateY(110vh) rotate(540deg); }
}

@media (max-width: 600px) {
  .sol-header { padding: 8px 10px; }
  .sol-header .back-label { display: none; }
  .sol-modes button { padding: 6px 9px; }
  .sol-toolbar { gap: 6px 8px; }
  .sol-main { padding: 8px 6px 6px; }
  .sol-actions button { padding: 7px 10px; font-size: .8rem; }
  .sol-actions .lbl-optional { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .card { transition: none; }
}
