/* Daily challenges, stats panel, card themes and Spider Solitaire layout.
   Loaded only on Solitaire, Spider Solitaire, Sudoku, Minesweeper and Word Search pages. */

/* Stats and options panels */
.ogq-modal {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center;
  background: rgba(8,10,14,.78); padding: 1rem;
}
.ogq-box {
  background: #161b22; color: #e8ebf0; border: 1px solid var(--line, rgba(255,255,255,.08));
  border-radius: 16px; padding: 1rem 1.1rem 1.1rem; width: min(26rem, 100%);
  max-height: calc(100vh - 2rem); overflow: auto; box-shadow: 0 18px 50px rgba(0,0,0,.4);
}
.ogq-head { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; margin-bottom: 0.7rem; }
.ogq-head h2 { font-size: 1.2rem; margin: 0; line-height: 1.25; }
.ogq-x {
  appearance: none; border: 0; background: #2a3340; color: #fff; width: 2.1rem; height: 2.1rem;
  border-radius: 999px; font-size: 1.3rem; line-height: 1; cursor: pointer; flex: none;
}
.ogq-x:hover { background: #354252; }
.ogq-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.45rem; }
.ogq-cell { background: #12161d; border: 1px solid var(--line, rgba(255,255,255,.08)); border-radius: 12px; padding: 0.5rem 0.6rem; }
.ogq-cell strong { display: block; font-size: 1.25rem; line-height: 1.2; }
.ogq-cell span { display: block; font-size: 0.78rem; color: #aab1bd; }
.ogq-sub { margin: 0.85rem 0 0.4rem; font-size: 0.82rem; font-weight: 700; color: #c5cbd4; }
.ogq-days { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 3px; }
.ogq-day {
  display: grid; place-items: center; aspect-ratio: 1; border-radius: 6px; font-size: 0.62rem;
  background: #232a35; color: #8a93a1;
}
.ogq-day.on { background: #2f9e5b; color: #fff; font-weight: 800; }
.ogq-day.today { outline: 2px solid #f5c242; outline-offset: -2px; }
.ogq-note { margin: 0.8rem 0 0.5rem; font-size: 0.78rem; color: #8a93a1; }
.ogq-reset { background: #3a2a2a; }
.ogq-seg { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.ogq-seg .btn-tiny { min-height: 2.2rem; }
.ogq-seg .btn-tiny.on { background: #2c6e49; outline: 2px solid #34d399; outline-offset: 1px; }
.ogq-swatch { position: relative; padding-left: 1.9rem !important; }
.ogq-swatch::before {
  content: ""; position: absolute; left: 0.5rem; top: 50%; width: 1rem; height: 1rem; margin-top: -0.5rem;
  border-radius: 4px; border: 1px solid rgba(255,255,255,.35);
}
.sw-classic::before { background: linear-gradient(135deg, #1b6b46 50%, #1d4e89 50%); }
.sw-midnight::before { background: linear-gradient(135deg, #14233f 50%, #6b2d5c 50%); }
.sw-ruby::before { background: linear-gradient(135deg, #6b1d2a 50%, #c9a227 50%); }
.sw-contrast::before { background: linear-gradient(135deg, #000 50%, #ffd400 50%); }
.ogq-end { margin: 0.45rem 0 0; color: #f5c242; font-weight: 700; font-size: 0.92rem; }
.hud-bar .stat.ogq-chip { background: #3b2f0c; border-color: #8a6d1a; color: #f5c242; }

/* Smoother card feel */
.cards-board .pcard { transition: box-shadow 0.15s ease, outline-color 0.15s ease; }
.cards-board .pcard.sel { box-shadow: 0 0 0 2px rgba(0,0,0,.35), 0 10px 18px rgba(0,0,0,.4); }
@media (hover: hover) {
  .cards-board .pcard:not(.back):hover { box-shadow: 0 8px 16px rgba(0,0,0,.32); }
}
.pcard-fly { will-change: transform; }
.stock-pile.hint { outline: 2px solid #34d399; }
.pcard .pc-mid { align-self: end; }

/* Card themes. Classic keeps the original look. */
html[data-card-theme="midnight"] .cards-board.solitaire {
  background: radial-gradient(ellipse at 50% 0%, rgba(255,255,255,.07), transparent 46%), linear-gradient(180deg, #1a2c4f 0%, #0a1426 100%);
}
html[data-card-theme="midnight"] .pcard { background: #eef1f6; color: #121826; }
html[data-card-theme="midnight"] .pcard.red { color: #c2185b; }
html[data-card-theme="midnight"] .pcard.back { background: repeating-linear-gradient(45deg, #6b2d5c 0 7px, #4a1f40 7px 14px); color: transparent; }

html[data-card-theme="ruby"] .cards-board.solitaire {
  background: radial-gradient(ellipse at 50% 0%, rgba(255,255,255,.07), transparent 46%), linear-gradient(180deg, #7a2232 0%, #3d0f18 100%);
}
html[data-card-theme="ruby"] .pcard { background: #fbf6ea; color: #1c1410; }
html[data-card-theme="ruby"] .pcard.red { color: #b3121f; }
html[data-card-theme="ruby"] .pcard.back { background: repeating-linear-gradient(135deg, #c9a227 0 6px, #2b1a08 6px 12px); color: transparent; }

html[data-card-theme="contrast"] .cards-board.solitaire { background: #050505; }
html[data-card-theme="contrast"] .pcard { background: #fff; color: #000; font-weight: 900; border: 1px solid #000; font-size: clamp(0.78rem, 1.8vw, 1.08rem); }
html[data-card-theme="contrast"] .pcard.red { color: #d00000; }
html[data-card-theme="contrast"] .pcard.back { background: repeating-linear-gradient(45deg, #111 0 4px, #2b2b2b 4px 8px); border: 2px solid #ffd400; color: transparent; }
html[data-card-theme="contrast"] .pile { outline-color: rgba(255,255,255,.4); }

/* Spider Solitaire */
.spider-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 8fr); gap: 0.5rem; align-items: start; }
.spider-done { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 0.35rem; }
.spider-done .pile, .spider .stock-pile { min-height: 0; aspect-ratio: 3 / 4.2; max-height: 108px; }
.spider-done .pile-ghost { font-size: 1rem; }
.spider .stock-pile .stock-back { position: absolute; top: 0; width: calc(100% - 16px); }
.spider-tab { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 0.4rem; min-height: 300px; }
.spider-tab .pile { min-height: 80px; }
.spider .pcard { padding: 0.15rem 0.22rem; }
@media (max-width: 700px) {
  .spider-tab { gap: 3px; min-height: 0; }
  .spider-top { gap: 0.3rem; }
  .spider-done { gap: 3px; }
  .spider .pcard { font-size: 0.6rem; padding: 0.06rem 0.08rem; border-radius: 4px; letter-spacing: -0.02em; }
  .spider .stock-count { font-size: 0.72rem; }
  .play-page:has([data-game="spider-solitaire"]) .stage { min-height: 0; }
  .game-root[data-game="spider-solitaire"] { min-height: 0; }
  .ogq-box { padding: 0.85rem 0.85rem 0.95rem; }
}
@media (max-width: 420px) {
  .spider .pcard { font-size: 0.54rem; }
  .spider .pcard .pc-mid { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .cards-board .pcard { transition: none; }
}
