/* ============================================
   Lex.Games v3 — Sleek & Whimsical
   ============================================ */

:root {
  --ink:           #241a4e;
  --ink-soft:      #5b5680;
  --purple-deep:   #2d1066;
  --purple-mid:    #5121ad;
  --purple-bright: #7c3aed;
  --purple-tint:   #ede9fe;
  --bg:            #eeeefb;   /* matches the game pages' body color */
  --card:          #ffffff;
  --line:          #e2ddf3;
  --pink:          #ec4899;
  --green:         #0e9f6e;
  --gold:          #b45309;
  --gold-bg:       #fef3c7;
  --radius:        14px;
  --radius-sm:     9px;
  --shadow-sm:     0 1px 3px rgba(45, 16, 102, 0.10);
  --shadow-md:     0 4px 14px rgba(45, 16, 102, 0.12);
  --shadow-lg:     0 10px 28px rgba(45, 16, 102, 0.18);
  --font:          'Avenir Next', Avenir, -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, sans-serif;
  --ease:          0.18s cubic-bezier(.34,1.4,.64,1);

  /* one accent per game — whimsy via color, not emoji */
  --c-connections: #f59e0b;
  --c-lexicogs:    #0ea5e9;
  --c-byavowel:    #ec4899;
  --c-mini:        #8b5cf6;
  --c-cryptograms: #14b8a6;
  --c-squaredance: #ef4444;
  --c-six:         #22c55e;
  --c-rung:        #d97706;
  --c-crossword:   #6366f1;
  --c-mindcontrol: #a855f7;
  --c-leaderboard: #64748b;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: var(--font);
  color: var(--ink);
  margin: 0;
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--purple-bright); }
a:hover { color: var(--purple-deep); }

:focus-visible {
  outline: 3px solid var(--pink);
  outline-offset: 2px;
  border-radius: 3px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* Defensive: hide v1 chrome if any page emits it */
#narrowstrip, #header { display: none !important; }

/* ---------- Skip link ---------- */
.v3-skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 300;
  background: var(--purple-deep);
  color: #fff;
  padding: 10px 18px;
  border-radius: 0 0 var(--radius-sm) 0;
  text-decoration: none;
  font-weight: 600;
}
.v3-skip:focus { left: 0; color: #fff; }

/* ---------- Top bar ---------- */
.v3-nav {
  background: linear-gradient(120deg, var(--purple-deep), var(--purple-mid));
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.v3-nav-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  min-height: 52px;
  gap: 20px;
}

.v3-wordmark,
.v3-wordmark:link,
.v3-wordmark:visited {
  color: #fff;
  text-decoration: none;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
}
.v3-wordmark .dot {
  color: #f0abfc;
  display: inline-block;
  margin: 0 1px;
  transition: transform var(--ease);
}
.v3-wordmark:hover { color: #fff; }
.v3-wordmark:hover .dot { transform: translateY(-3px) rotate(20deg); color: var(--pink); }

.v3-wordmark small {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  opacity: 0.75;
}

.v3-nav-links {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 14px;
}

.v3-nav-links a,
.v3-nav-links a:link,
.v3-nav-links a:visited {
  color: rgba(255,255,255,0.92);
  text-decoration: none;
  font-weight: 500;
}
.v3-nav-links a:hover { color: #fff; text-decoration: underline; text-underline-offset: 3px; }

.v3-nav-user {
  background: rgba(255,255,255,0.14);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 13px;
}

.v3-upgrade,
.v3-nav-links a.v3-upgrade {
  background: #fff;
  color: var(--purple-mid);
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 999px;
  transition: transform var(--ease), box-shadow var(--ease);
}
.v3-nav-links a.v3-upgrade:hover {
  color: var(--purple-deep);
  text-decoration: none;
  transform: scale(1.05);
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);
}

/* ---------- Games bar (wraps — never scrolls) ---------- */
.v3-gamebar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.v3-gamebar-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 5px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1px 0;
}

.v3-pill,
.v3-pill:link,
.v3-pill:visited {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--ease), transform var(--ease);
}

.v3-pill .gdot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gcolor, var(--purple-bright));
  flex-shrink: 0;
  transition: transform var(--ease);
}

.v3-pill:hover {
  background: var(--purple-tint);
  color: var(--purple-deep);
  transform: translateY(-1px);
}
.v3-pill:hover .gdot { transform: scale(1.5); }

.v3-pill[aria-current="page"],
.v3-pill[aria-current="page"]:link,
.v3-pill[aria-current="page"]:visited {
  background: var(--purple-deep);
  color: #fff;
}

.v3-pill .pro {
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  background: var(--gold-bg);
  color: var(--gold);
  padding: 1px 5px;
  border-radius: 999px;
}

/* Small screens: pills stay visible and simply wrap tighter */
@media (max-width: 719px) {
  .v3-gamebar-inner { padding: 4px 4px; gap: 0; }
  .v3-pill { font-size: 12px; padding: 3px 7px; gap: 4px; line-height: 1.35; }
  .v3-pill .gdot { width: 6px; height: 6px; }
  .v3-pill .pro { font-size: 8px; padding: 1px 4px; }
}

/* ---------- Contextual sub-bar ---------- */
.v3-subbar {
  background: transparent;
}
.v3-subbar-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 8px 20px 0;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 22px;
  font-size: 13px;
}
.v3-subbar a,
.v3-subbar a:link,
.v3-subbar a:visited {
  color: var(--ink-soft);
  font-weight: 600;
  text-decoration: none;
  letter-spacing: 0.02em;
  border-bottom: 2px solid transparent;
  padding-bottom: 1px;
}
.v3-subbar a:hover {
  color: var(--purple-deep);
  border-bottom-color: var(--pink);
}

/* ---------- Main / content ---------- */
main { display: block; }

/* ---------- Hero (homepage) ---------- */
.v3-hero {
  text-align: center;
  padding: 34px 20px 6px;
  max-width: 720px;
  margin: 0 auto;
}

.v3-hero h1 {
  font-size: 30px;
  font-weight: 800;
  color: var(--purple-deep);
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

.v3-hero .v3-date {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--pink);
  margin-bottom: 10px;
}

.v3-hero p {
  font-size: 16px;
  color: var(--ink-soft);
  margin: 6px 0 0;
  line-height: 1.5;
}
.v3-hero p a { color: var(--purple-bright); font-weight: 600; text-decoration: none; }
.v3-hero p a:hover { text-decoration: underline; }

/* ---------- Game cards ---------- */
.v3-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: 22px;
  max-width: 1160px;
  margin: 0 auto;
  padding: 26px 20px 10px;
}

.v3-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  border-top: 4px solid var(--gcolor, var(--purple-bright));
  transition: transform var(--ease), box-shadow var(--ease);
}

.v3-card:hover {
  transform: translateY(-4px) rotate(-0.4deg);
  box-shadow: var(--shadow-lg);
}

/* Previews sit inset on a matte tinted with the game's color — raw
   screenshots vary in composition, and the frame keeps them looking finished */
.v3-card-shot {
  display: block;
  height: 168px;
  overflow: hidden;
  padding: 9px;
  background: var(--purple-faint, #f5f3ff);
  background: color-mix(in srgb, var(--gcolor, var(--purple-bright)) 9%, #fff);
}

.v3-card-shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
  margin: 0;
  border: none;
  border-radius: 7px;
  box-shadow: 0 0 0 1px rgba(36, 26, 78, 0.10), 0 1px 4px rgba(36, 26, 78, 0.08);
  transition: transform 0.35s ease;
}
.v3-card:hover .v3-card-shot img { transform: scale(1.03); }

.v3-card-body {
  padding: 15px 17px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.v3-card h2 {
  font-size: 19px;
  font-weight: 800;
  margin: 0 0 5px;
  letter-spacing: -0.01em;
}
.v3-card h2 a,
.v3-card h2 a:link,
.v3-card h2 a:visited {
  color: var(--purple-deep);
  text-decoration: none;
}
.v3-card h2 a:hover { color: var(--gcolor, var(--purple-bright)); }

.v3-card .desc {
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.5;
  margin: 0 0 10px;
  flex: 1;
}

.v3-card .today {
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-bottom: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.v3-card .today strong {
  color: var(--ink);
  font-weight: 600;
}

.v3-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.v3-play,
.v3-play:link,
.v3-play:visited {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--purple-bright);
  color: #fff;
  padding: 8px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: background var(--ease), transform var(--ease);
}
.v3-play::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 7px solid currentColor;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  transition: transform var(--ease);
}
.v3-play:hover {
  background: var(--gcolor, var(--purple-deep));
  color: #fff;
  transform: scale(1.04);
}
.v3-play:hover::after { transform: translateX(3px); }

.v3-card .arch,
.v3-card .arch:link,
.v3-card .arch:visited {
  font-size: 13px;
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 500;
}
.v3-card .arch:hover { color: var(--gcolor, var(--purple-bright)); }

/* Premium tag */
.v3-pro-badge {
  position: absolute;
  top: 14px;
  right: 12px;
  z-index: 2;
  background: var(--gold-bg);
  color: var(--gold);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  padding: 3px 9px;
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
}

/* Played state */
.v3-card.played .v3-card-shot img { filter: grayscale(0.5) opacity(0.55); }
.v3-card.played::after {
  content: "Played ✓";
  position: absolute;
  top: 66px;
  left: 50%;
  transform: translateX(-50%) rotate(-6deg);
  background: var(--green);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 6px 20px;
  border-radius: 999px;
  box-shadow: var(--shadow-md);
  pointer-events: none;
}

/* ---------- Footer ---------- */
.v3-footer {
  margin-top: 40px;
  background: var(--card);
  border-top: 1px solid var(--line);
  text-align: center;
  padding: 30px 20px 56px;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 2.1;
}

.v3-footer a,
.v3-footer a:link,
.v3-footer a:visited {
  color: var(--ink-soft);
  text-decoration: none;
}
.v3-footer a:hover { color: var(--purple-bright); text-decoration: underline; }

.v3-footer-cta {
  margin-bottom: 10px;
}
.v3-footer-cta a,
.v3-footer-cta a:link,
.v3-footer-cta a:visited {
  display: inline-block;
  margin: 0 6px 6px;
  padding: 6px 16px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  font-weight: 600;
  color: var(--purple-mid);
  transition: border-color var(--ease), transform var(--ease);
}
.v3-footer-cta a:hover {
  border-color: var(--purple-bright);
  text-decoration: none;
  transform: translateY(-1px);
}

.v3-footer-links a { margin: 0 9px; }

.v3-footer-copy {
  margin-top: 8px;
  font-size: 12px;
  opacity: 0.75;
}

/* ---------- Small screens ---------- */
@media (max-width: 640px) {
  .v3-nav-inner { min-height: 48px; gap: 12px; padding: 0 14px; }
  .v3-wordmark { font-size: 18px; }
  .v3-wordmark small { display: none; }
  .v3-nav-links { gap: 12px; font-size: 13px; }
  .v3-hero { padding-top: 14px; }
  .v3-hero h1 { font-size: 22px; margin-bottom: 2px; }
  .v3-hero .v3-date { font-size: 11px; margin-bottom: 6px; }
  .v3-hero p { font-size: 14px; margin-top: 2px; }
  .v3-grid { gap: 16px; padding: 14px 14px 6px; }
}

/* Compact horizontal cards: more games per screenful on phones */
@media (max-width: 599px) {
  .v3-grid { grid-template-columns: 1fr; gap: 11px; padding: 12px 12px 4px; }

  .v3-card {
    flex-direction: row;
    border-top: none;
  }
  .v3-card:hover { transform: none; }

  .v3-card-shot {
    width: 112px;
    height: auto;
    flex-shrink: 0;
    padding: 7px;
  }
  .v3-card-shot img {
    width: 100%;
    height: 100%;
    min-height: 110px;
  }

  .v3-card-body { padding: 10px 12px 11px; }
  .v3-card h2 { font-size: 16px; margin-bottom: 2px; }

  .v3-card .desc {
    font-size: 12px;
    line-height: 1.4;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .v3-card .today { font-size: 11.5px; margin-bottom: 8px; }

  .v3-play, .v3-play:link, .v3-play:visited { padding: 5px 15px; font-size: 12.5px; }
  .v3-card .arch { font-size: 12px; }

  .v3-pro-badge { top: 8px; right: 8px; font-size: 9px; padding: 2px 7px; }

  /* Played stamp sits over the thumbnail */
  .v3-card.played::after {
    top: 50%;
    left: 56px;
    transform: translate(-50%, -50%) rotate(-6deg);
    font-size: 11px;
    padding: 4px 10px;
  }
}
