/*
Theme Name: Solitaired
Theme URI: https://solitaired.ca
Author: Solitaired.ca
Description: A full-featured online Solitaire game theme for WordPress
Version: 1.0
License: GNU General Public License v2 or later
Text Domain: solitaired
*/

/* ── Variables ──────────────────────────────────────────────────────────── */
:root {
  --green-dark:    #1a6b2e;
  --green-mid:     #217a35;
  --green-felt:    #2d8a47;
  --green-light:   #3aaa5a;
  --green-hover:   #4dc76e;
  --nav-bg:        #14521f;
  --nav-hover:     #1d7030;
  --card-bg:       #ffffff;
  --card-red:      #c0392b;
  --card-black:    #1a1a2e;
  --card-back:     #2563eb;
  --card-back2:    #1d4ed8;
  --card-border:   rgba(0,0,0,.18);
  --card-shadow:   0 2px 8px rgba(0,0,0,.35);
  --card-radius:   8px;
  --btn-bg:        #1b5e20;
  --btn-hover:     #256427;
  --btn-border:    #0d3b13;
  --gold:          #f5c518;
  --white:         #ffffff;
  --text-light:    rgba(255,255,255,.85);
  --font-main:     'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --transition:    .18s ease;
}

/* ── Reset / Base ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font-main);
  background: var(--green-dark);
  color: var(--white);
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }

/* ── Site Header / Nav ──────────────────────────────────────────────────── */
.site-header {
  background: var(--nav-bg);
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 0;
  height: 52px;
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.site-logo {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -.5px;
  color: var(--white);
  margin-right: 24px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.site-logo-icon { font-size: 1.4rem; }

.site-nav {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
}
.site-nav::-webkit-scrollbar { display: none; }

.site-nav a {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: .88rem;
  font-weight: 600;
  color: var(--text-light);
  white-space: nowrap;
  transition: background var(--transition), color var(--transition);
}
.site-nav a:hover,
.site-nav a.active {
  background: var(--nav-hover);
  color: var(--white);
}

/* ── Game Wrapper ───────────────────────────────────────────────────────── */
.sg-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 10px 40px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Toolbar ────────────────────────────────────────────────────────────── */
.sg-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.sg-draw-tabs {
  display: flex;
  background: rgba(0,0,0,.2);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.12);
}
.sg-draw-tabs button {
  padding: 6px 16px;
  font-size: .82rem;
  font-weight: 700;
  background: transparent;
  color: var(--text-light);
  border: none;
  transition: background var(--transition), color var(--transition);
}
.sg-draw-tabs button.active,
.sg-draw-tabs button:hover {
  background: var(--green-mid);
  color: var(--white);
}

.sg-toolbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sg-info-bar {
  display: flex;
  gap: 14px;
  font-size: .8rem;
  color: var(--text-light);
  align-items: center;
}
.sg-info-item { display: flex; align-items: center; gap: 4px; }
.sg-info-label { opacity: .7; }
.sg-info-val { font-weight: 700; color: var(--white); }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.sg-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--white);
  font-size: .82rem;
  font-weight: 700;
  transition: background var(--transition), transform var(--transition);
  white-space: nowrap;
  position: relative;
}
.sg-btn:hover { background: var(--btn-hover); }
.sg-btn:active { transform: scale(.97); }
.sg-btn-icon { font-size: 1rem; }

/* New game dropdown */
.sg-new-wrap { position: relative; }
.sg-new-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: #1b5e20;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 10px;
  min-width: 180px;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
  overflow: hidden;
  z-index: 500;
  display: none;
}
.sg-new-menu.sg-menu-open { display: block; }
.sg-new-menu button {
  display: block;
  width: 100%;
  padding: 10px 16px;
  text-align: left;
  background: none;
  border: none;
  color: var(--white);
  font-size: .85rem;
  font-weight: 600;
  transition: background var(--transition);
}
.sg-new-menu button:hover { background: rgba(255,255,255,.1); }
.sg-new-menu hr { border-color: rgba(255,255,255,.1); margin: 4px 0; }

/* ── Game Board ─────────────────────────────────────────────────────────── */
.sg-board {
  background: radial-gradient(ellipse at 60% 40%, var(--green-light) 0%, var(--green-felt) 40%, var(--green-mid) 100%);
  border-radius: 16px;
  padding: 16px 12px 20px;
  box-shadow: inset 0 2px 12px rgba(0,0,0,.25), 0 4px 20px rgba(0,0,0,.35);
  position: relative;
  overflow: hidden;
}

/* subtle felt texture */
.sg-board::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4'%3E%3Ccircle cx='1' cy='1' r='.5' fill='rgba(0,0,0,.05)'/%3E%3C/svg%3E");
  pointer-events: none;
  border-radius: 16px;
}

/* Top area: stock + waste + spacer + foundations */
.sg-top-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}

.sg-stock, .sg-waste { grid-column: span 1; }
.sg-foundation-area {
  grid-column: 4 / 8;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

/* Tableau */
.sg-tableau {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  align-items: start;
}

.sg-col {
  display: flex;
  flex-direction: column;
  position: relative;
  min-height: 120px;
}

.sg-tab-card-wrap {
  margin-top: -72px;
  position: relative;
}
.sg-tab-card-wrap:first-child { margin-top: 0; }

/* ── Cards ──────────────────────────────────────────────────────────────── */
.sg-card {
  width: 100%;
  aspect-ratio: 5/7;
  border-radius: var(--card-radius);
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 4px 5px;
  cursor: pointer;
  user-select: none;
  position: relative;
  transition: transform .12s ease, box-shadow .12s ease;
  background: var(--card-bg);
  font-size: clamp(10px, 1.8vw, 15px);
}

.sg-card:hover:not(.sg-card-empty):not(.sg-card-back) {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0,0,0,.45);
}

.sg-card-red { color: var(--card-red); }
.sg-card-black { color: var(--card-black); }

.sg-card-rank-top {
  align-self: flex-start;
  font-weight: 800;
  font-size: 1em;
  line-height: 1;
}
.sg-card-suit {
  font-size: 1.6em;
  line-height: 1;
}
.sg-card-rank-bot {
  align-self: flex-end;
  font-weight: 800;
  font-size: 1em;
  line-height: 1;
  transform: rotate(180deg);
}

/* Card back */
.sg-card-back {
  background: linear-gradient(135deg, var(--card-back) 0%, var(--card-back2) 100%);
  cursor: default;
  overflow: hidden;
}
.sg-card-back::before {
  content: '';
  position: absolute;
  inset: 5px;
  border: 2px solid rgba(255,255,255,.2);
  border-radius: 4px;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 4px,
    rgba(255,255,255,.06) 4px,
    rgba(255,255,255,.06) 8px
  );
}

/* Empty slot */
.sg-card-empty {
  background: rgba(0,0,0,.12);
  border: 2px dashed rgba(255,255,255,.2);
  box-shadow: none;
  cursor: default;
  font-size: 1.6em;
  color: rgba(255,255,255,.3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0;
  padding: 0;
}
.sg-card-empty:hover { transform: none; }

/* Stock empty (replay icon) */
.sg-stock-empty {
  font-size: 2em;
  cursor: pointer;
  color: rgba(255,255,255,.4);
  transition: color var(--transition);
}
.sg-stock-empty:hover { color: rgba(255,255,255,.8); }

/* Waste fan wrapper */
.sg-waste-wrap { position: relative; width: 100%; height: 100%; }
.sg-waste-fan { position: absolute; top: 0; width: 100%; }

/* Drag states */
.sg-dragging { opacity: .55; transform: scale(.97); }
.sg-drag-over > .sg-card,
.sg-drag-over.sg-card { outline: 2px solid var(--gold); outline-offset: 1px; }

/* Hint highlight */
.sg-hint-from { outline: 3px solid #FFD700 !important; outline-offset: 2px; animation: sg-pulse 0.5s ease infinite alternate; }
.sg-hint-to   { outline: 3px solid #4fc3f7 !important; outline-offset: 2px; }

@keyframes sg-pulse { from { opacity: 1; } to { opacity: .6; } }

/* ── Modals ─────────────────────────────────────────────────────────────── */
.sg-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  backdrop-filter: blur(3px);
}
.sg-modal.sg-modal-open { display: flex; }

.sg-modal-box {
  background: #1b5e20;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 16px;
  padding: 28px 32px;
  min-width: 300px;
  max-width: 95vw;
  box-shadow: 0 16px 48px rgba(0,0,0,.6);
  position: relative;
  animation: sg-modal-in .2s ease;
}

@keyframes sg-modal-in {
  from { opacity: 0; transform: translateY(-20px) scale(.95); }
  to   { opacity: 1; transform: none; }
}

.sg-modal-title {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sg-modal-close {
  position: absolute;
  top: 14px; right: 16px;
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}
.sg-modal-close:hover { color: var(--white); }

/* Stats grid */
.sg-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 24px;
  margin-bottom: 20px;
}
.sg-stat-item { text-align: center; }
.sg-stat-val {
  font-size: 2rem;
  font-weight: 900;
  color: var(--gold);
  line-height: 1;
}
.sg-stat-label {
  font-size: .75rem;
  color: var(--text-light);
  margin-top: 2px;
}

/* Settings rows */
.sg-setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,.08);
  font-size: .9rem;
}
.sg-setting-row:last-of-type { border-bottom: none; }

/* Toggle switch */
.sg-toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.sg-toggle input { opacity: 0; width: 0; height: 0; }
.sg-toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,.2);
  border-radius: 24px;
  cursor: pointer;
  transition: background .2s;
}
.sg-toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 3px;
  background: white;
  border-radius: 50%;
  transition: transform .2s;
}
.sg-toggle input:checked + .sg-toggle-slider { background: var(--green-hover); }
.sg-toggle input:checked + .sg-toggle-slider::before { transform: translateX(20px); }

/* ── Win Overlay ────────────────────────────────────────────────────────── */
#sg-win-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.72);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  backdrop-filter: blur(4px);
}
#sg-win-overlay.sg-overlay-visible { display: flex; }

.sg-win-box {
  background: linear-gradient(135deg, #1b5e20 0%, #2e7d32 100%);
  border: 2px solid var(--gold);
  border-radius: 20px;
  padding: 40px 48px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.7);
  animation: sg-modal-in .3s ease;
}
.sg-win-trophy { font-size: 4rem; margin-bottom: 8px; }
.sg-win-title {
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--gold);
  margin-bottom: 16px;
}
.sg-win-stats {
  display: flex;
  gap: 32px;
  justify-content: center;
  margin-bottom: 28px;
}
.sg-win-stat-val { font-size: 2rem; font-weight: 900; color: var(--white); }
.sg-win-stat-label { font-size: .75rem; color: var(--text-light); }
.sg-win-btns { display: flex; gap: 12px; justify-content: center; }
.sg-win-btn {
  padding: 12px 28px;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 800;
  border: none;
  cursor: pointer;
  transition: transform .15s, opacity .15s;
}
.sg-win-btn:hover { opacity: .9; transform: scale(1.03); }
.sg-win-btn-primary { background: var(--gold); color: #1a1a2e; }
.sg-win-btn-secondary { background: rgba(255,255,255,.15); color: var(--white); border: 1px solid rgba(255,255,255,.2); }

/* ── Confetti canvas ───────────────────────────────────────────────────── */
#sg-confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2999;
}

/* ── Toast ──────────────────────────────────────────────────────────────── */
#sg-toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(60px);
  background: rgba(0,0,0,.85);
  color: white;
  padding: 10px 22px;
  border-radius: 24px;
  font-size: .9rem;
  font-weight: 600;
  z-index: 9999;
  transition: transform .3s ease, opacity .3s ease;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}
#sg-toast.sg-toast-show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ── Footer ─────────────────────────────────────────────────────────────── */
.site-footer {
  background: var(--nav-bg);
  color: var(--text-light);
  text-align: center;
  padding: 18px 16px;
  font-size: .8rem;
  margin-top: auto;
}
.site-footer a { color: var(--text-light); }
.site-footer a:hover { color: var(--white); }

/* ── How to play section ─────────────────────────────────────────────────── */
.sg-info-section {
  max-width: 860px;
  margin: 24px auto 0;
  padding: 0 12px;
  color: var(--text-light);
  font-size: .92rem;
  line-height: 1.7;
}
.sg-info-section h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--white);
  margin: 24px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.sg-info-section h3 { font-size: 1.05rem; color: var(--white); margin: 16px 0 6px; }
.sg-info-section p { margin-bottom: 10px; }
.sg-info-section ul { padding-left: 20px; margin-bottom: 10px; }
.sg-info-section li { margin-bottom: 6px; }
.sg-info-section strong { color: var(--white); }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .site-header { height: 48px; padding: 0 10px; }
  .site-logo { font-size: 1.1rem; margin-right: 12px; }
  .site-nav a { padding: 5px 10px; font-size: .8rem; }

  .sg-wrap { padding: 8px 6px 30px; gap: 8px; }

  .sg-toolbar { gap: 5px; }
  .sg-btn { padding: 6px 10px; font-size: .78rem; }
  .sg-info-bar { gap: 8px; font-size: .74rem; }

  .sg-tab-card-wrap { margin-top: -62px; }

  .sg-board { padding: 10px 6px 14px; border-radius: 10px; }
  .sg-top-row, .sg-tableau { gap: 4px; }

  .sg-card { border-radius: 5px; font-size: clamp(8px, 2.5vw, 12px); }
  .sg-card-suit { font-size: 1.4em; }

  .sg-modal-box { padding: 20px 18px; }
  .sg-win-box { padding: 28px 24px; }
  .sg-win-title { font-size: 1.6rem; }
  .sg-win-stat-val { font-size: 1.5rem; }
  .sg-win-stats { gap: 20px; }
  .sg-stats-grid { grid-template-columns: 1fr 1fr; gap: 10px 16px; }
  .sg-stat-val { font-size: 1.6rem; }
}

@media (max-width: 420px) {
  .sg-tab-card-wrap { margin-top: -55px; }
  .sg-info-bar .sg-info-item:last-child { display: none; }
}

/* ── WordPress body class overrides ────────────────────────────────────── */
body.home, body.page { background: var(--green-dark); }

/* ── Spider Solitaire coming soon ───────────────────────────────────────── */
.sg-coming-soon {
  text-align: center;
  padding: 80px 20px;
}
.sg-coming-soon h1 { font-size: 2.5rem; font-weight: 900; margin-bottom: 12px; }
.sg-coming-soon p { font-size: 1.1rem; color: var(--text-light); max-width: 500px; margin: 0 auto 28px; }
.sg-coming-soon .sg-cs-icon { font-size: 5rem; margin-bottom: 16px; }
.sg-notify-btn {
  display: inline-block;
  padding: 14px 36px;
  background: var(--gold);
  color: #1a1a2e;
  border-radius: 10px;
  font-weight: 800;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  transition: opacity .2s;
}
.sg-notify-btn:hover { opacity: .9; }
