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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
button {
  font-family: inherit;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Smooth cross-document page transitions in supporting browsers (Chrome/Safari/Edge) */
@view-transition {
  navigation: auto;
}

::view-transition-old(root) {
  animation: 150ms cubic-bezier(0.4, 0, 1, 1) both fwg-vt-out;
}
::view-transition-new(root) {
  animation: 210ms cubic-bezier(0, 0, 0.2, 1) both fwg-vt-in;
}

@keyframes fwg-vt-out {
  from { opacity: 1; }
  to { opacity: 0; }
}
@keyframes fwg-vt-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Shared micro-interaction animations */
@keyframes fwg-pop {
  0% { transform: scale(0.84); }
  60% { transform: scale(1.07); }
  100% { transform: scale(1); }
}

@keyframes fwg-shake {
  0%, 100% { transform: translateX(0); }
  18% { transform: translateX(-7px); }
  36% { transform: translateX(7px); }
  54% { transform: translateX(-5px); }
  72% { transform: translateX(5px); }
  88% { transform: translateX(-2px); }
}

@keyframes fwg-pulse {
  0% { transform: scale(1); }
  45% { transform: scale(1.022); }
  100% { transform: scale(1); }
}

@keyframes fwg-card-enter {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fwg-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes fwg-backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fwg-modal-in {
  from { opacity: 0; transform: scale(0.94) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes fwg-sheet-in {
  from { opacity: 0; transform: translateY(32px); }
  to { opacity: 1; transform: translateY(0); }
}

.fx-pop { animation: fwg-pop 190ms cubic-bezier(0.22, 1, 0.36, 1) both; }
.fx-shake { animation: fwg-shake 340ms cubic-bezier(0.36, 0.07, 0.19, 0.97) both; }
.fx-pulse { animation: fwg-pulse 300ms cubic-bezier(0.22, 1, 0.36, 1) both; }
.fx-card-in { animation: fwg-card-enter 280ms cubic-bezier(0.22, 1, 0.36, 1) both; animation-delay: calc(var(--i, 0) * 35ms); }

.fx-confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

/* Shimmer skeletons (zero layout shift while fetching) */
.skel {
  background: linear-gradient(90deg, var(--surface-2) 25%, #F8F9FD 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: fwg-shimmer 1.3s ease-in-out infinite;
  border-radius: var(--radius-md);
}
.skel-hero { height: 268px; border-radius: var(--radius-xl); margin-bottom: 28px; }
.skel-card { height: 226px; border-radius: var(--radius-lg); }
.skel-rail { height: 310px; border-radius: var(--radius-lg); }
.skel-board { height: 310px; border-radius: 16px; }

.icon-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  border-bottom: 3px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.08s ease, background 0.12s ease;
}
.icon-circle:hover { background: var(--surface-2); color: var(--ink); }
.icon-circle:active { transform: translateY(1px); }
.icon-circle.muted { opacity: 0.55; }

/* ── Brand & Header ── */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
}

.site-header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-tiles {
  display: inline-flex;
  gap: 4px;
}

.brand-tile {
  width: 24px;
  height: 26px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: 700 0.82rem var(--font-display);
  color: #fff;
}

.brand-tile.t1 { background: var(--g-ladder); border-bottom: 3px solid var(--g-ladder-deep); }
.brand-tile.t2 { background: var(--g-anagram); border-bottom: 3px solid var(--g-anagram-deep); }
.brand-tile.t3 { background: var(--g-pairs); border-bottom: 3px solid var(--g-pairs-deep); color: var(--ink); }

.brand-name {
  font: 700 1.15rem var(--font-display);
  letter-spacing: -0.01em;
  color: var(--ink);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-nav a {
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-2);
  transition: background 0.14s ease, color 0.14s ease;
}

.header-nav a:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.header-nav a[aria-current="page"] {
  background: var(--g-ladder-soft);
  color: var(--primary);
}

.streak-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--g-pairs-soft);
  color: var(--ink);
  padding: 5px 12px 5px 6px;
  border-radius: var(--radius-pill);
  font: 700 0.85rem var(--font-body);
  white-space: nowrap;
}

.streak-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--g-pairs);
  border-bottom: 2px solid var(--g-pairs-deep);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
}

.mobile-nav-strip {
  display: none;
}

/* ── Pressable Bright Arcade Buttons ── */
.btn-chunky {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 14px;
  border: none;
  font: 700 0.95rem var(--font-body);
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.12s ease;
  user-select: none;
}

.btn-chunky:active { transform: translateY(2px); }

.btn-chunky.primary {
  background: var(--primary);
  color: var(--on-primary);
  border-bottom: 4px solid var(--primary-deep);
}

.btn-chunky.white {
  background: #fff;
  color: var(--primary);
  border-bottom: 4px solid #D3DCFA;
}

.btn-chunky.secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1.5px solid var(--line-strong);
  border-bottom: 3.5px solid var(--line-strong);
  padding: 9px 15px;
  font-size: 0.88rem;
}

.btn-chunky:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* ── Homepage Layout ── */
.home-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px 24px 64px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 316px;
  gap: 24px;
  align-items: start;
}

.home-main { min-width: 0; }

.home-rail {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Featured Hero */
.hero-card {
  background: linear-gradient(135deg, #2F5BFF 0%, #244CE6 100%);
  border-bottom: 5px solid var(--primary-deep);
  border-radius: var(--radius-xl);
  padding: 28px 30px;
  color: #fff;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(220px, 0.85fr);
  gap: 24px;
  align-items: center;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.16);
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.hero-card h1 {
  font: 700 clamp(2rem, 3.2vw, 2.7rem) var(--font-display);
  line-height: 1.08;
  margin: 0 0 10px;
}

.hero-desc {
  margin: 0 0 14px;
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.96rem;
  max-width: 40ch;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.82rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.82);
  margin-bottom: 20px;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.hero-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  transition: background 0.12s ease;
}
.hero-link:hover { background: rgba(255, 255, 255, 0.24); }

.hero-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}

.hero-preview-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hero-preview-label {
  width: 34px;
  text-align: right;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.72);
}

.hp-tile {
  width: 38px;
  height: 40px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: 700 1.05rem var(--font-display);
  background: #fff;
  color: var(--ink);
  border-bottom: 3px solid #D3DCFA;
}

.hp-tile.amber {
  background: var(--g-pairs);
  color: var(--ink);
  border-bottom-color: var(--g-pairs-deep);
}

.hp-tile.ghost {
  background: rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.8);
  border: 1.5px dashed rgba(255, 255, 255, 0.45);
}

.hp-tile.goal {
  background: #fff;
  border: 2px solid var(--g-pairs);
  border-bottom: 3px solid var(--g-pairs-deep);
}

/* Catalog Section */
.catalog-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 0 0 16px;
}

.catalog-head h2 {
  font: 700 1.35rem var(--font-display);
  margin: 0;
}

.catalog-head span {
  font-size: 0.86rem;
  color: var(--ink-3);
  font-weight: 500;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.cartridge-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-card);
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}

.cartridge-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(20, 27, 52, 0.09);
  border-color: var(--line-strong);
}

.cartridge-banner {
  height: 108px;
  padding: 12px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 4px solid rgba(0, 0, 0, 0.14);
}

.cartridge-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.cartridge-badge {
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 0.68rem;
  font-weight: 700;
  background: var(--g-ladder-soft);
  color: var(--primary);
  white-space: nowrap;
  flex-shrink: 0;
}

.cartridge-badge.new {
  background: var(--g-pairs-soft);
  color: var(--g-pairs-deep);
}

.cartridge-badge.solved {
  background: var(--success-soft);
  color: var(--success-deep);
}

.cartridge-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.cartridge-body h3 {
  font: 700 1.08rem var(--font-display);
  margin: 0;
  min-width: 0;
}

.cartridge-body p {
  margin: 0 0 14px;
  color: var(--ink-2);
  font-size: 0.84rem;
  line-height: 1.45;
  flex: 1;
}

.cartridge-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cartridge-time {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-3);
}

.cartridge-cta {
  padding: 7px 14px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 700;
}

/* Right Rail: Today's Progress + Ad */
.rail-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
}

.progress-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}

.progress-head h2 {
  font: 700 1.05rem var(--font-display);
  margin: 0;
}

.progress-count {
  font-size: 0.84rem;
  color: var(--ink-2);
}

.progress-count strong {
  font: 700 1.05rem var(--font-display);
  color: var(--ink);
}

.progress-slots {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

.prog-slot {
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  border: 2px solid transparent;
  transition: transform 0.12s ease;
}

.prog-slot.solved {
  background: var(--success) !important;
  color: #fff;
  border-bottom: 3px solid var(--success-deep);
}

.prog-slot.next {
  border-color: var(--primary);
}

.week-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-2);
  margin-bottom: 10px;
}

.week-streak-text {
  color: var(--g-pairs-deep);
}

.week-dots {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 18px;
}

.week-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--ink-3);
}

.week-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: transparent;
}

.week-circle.done {
  background: var(--g-pairs);
  color: var(--ink);
  border-bottom: 2px solid var(--g-pairs-deep);
}

.week-circle.today {
  background: #fff;
  border: 2px solid var(--g-pairs);
}

.up-next-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--g-ladder-soft);
  border-radius: 14px;
  padding: 10px 12px;
}

.up-next-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.game-badge-sq {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: 700 0.9rem var(--font-display);
  flex-shrink: 0;
  border-bottom: 3px solid rgba(0, 0, 0, 0.18);
}

.up-next-label {
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--primary);
  text-transform: uppercase;
}

.up-next-title {
  font: 700 0.92rem var(--font-display);
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.up-next-go {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
}

/* Reserved Ad Slots (hidden on prod until ads enabled, shown on localhost or ?ads=preview) */
.ad-card {
  display: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow-card);
}

html.ads-preview .ad-card { display: block; }

.ad-caption {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.ad-box {
  background: var(--ad-fill);
  border: 1.5px dashed var(--line-strong);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-3);
  font-size: 0.78rem;
  font-weight: 600;
}

.ad-box.rect { height: 250px; }
.ad-box.banner { height: 50px; }

.ad-slot-sentinel { height: 1px; width: 100%; }

/* ── Mini Thumbnail Graphics ── */
.thumb {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.thumb-row {
  display: flex;
  align-items: center;
  gap: 3px;
}

.t-cell {
  width: 21px;
  height: 21px;
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  font: 700 0.68rem var(--font-display);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.14);
}

.t-cell.dark { background: var(--ink); color: #fff; }
.t-cell.amber { background: var(--g-pairs); color: var(--ink); }
.t-cell.teal { background: #0A8A7E; color: #fff; }
.t-cell.dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #fff;
  box-shadow: none;
}
.t-cell.dot.dark { background: var(--ink); }
.t-plus { color: rgba(20, 27, 52, 0.55); font-weight: 800; font-size: 0.7rem; }

/* ── Unified Game Shell (Desktop + Mobile-First) ── */
.game-shell-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
}

.game-shell-header-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.gs-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.back-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}
.back-pill:hover { background: var(--line); }

.gs-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.gs-title {
  font: 700 1.15rem var(--font-display);
  margin: 0;
  line-height: 1.15;
}

.gs-subtitle {
  font-size: 0.74rem;
  color: var(--ink-3);
  font-weight: 600;
}

.mode-switch {
  display: inline-flex;
  background: var(--surface-2);
  padding: 3px;
  border-radius: var(--radius-pill);
  gap: 2px;
}

.mode-btn {
  border: none;
  background: transparent;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font: 700 0.82rem var(--font-body);
  color: var(--ink-2);
  cursor: pointer;
}

.mode-btn.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(20, 27, 52, 0.1);
}

.gs-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stats-pill {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-2);
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-2);
  white-space: nowrap;
}

.stats-pill strong {
  font: 700 0.9rem var(--font-display);
  color: var(--ink);
  margin-left: 3px;
}

.stats-pill .streak-inline {
  color: var(--g-pairs-deep);
  font-weight: 700;
}

.help-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  border-bottom: 3px solid var(--primary-deep);
  color: #fff;
  font: 700 1rem var(--font-display);
  cursor: pointer;
  flex-shrink: 0;
}
.help-circle:active { transform: translateY(1px); }

.mobile-subbar {
  display: none;
}

.mobile-ad-bar {
  display: none;
  padding: 0 14px;
  margin: 8px auto 0;
  max-width: 420px;
}

html.ads-preview .mobile-ad-bar.active-mobile { display: block; }

/* 3-Column Desktop Play Layout */
.play-shell-grid {
  max-width: 1320px;
  margin: 0 auto;
  padding: 20px 20px 36px;
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr) 316px;
  gap: 24px;
  align-items: start;
}

.games-rail {
  padding-top: 4px;
}

.rail-heading {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  text-transform: uppercase;
  margin: 0 0 10px 8px;
}

.rail-game-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rail-game-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 13px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink);
  transition: background 0.12s ease;
}

.rail-game-item:hover { background: var(--surface-2); }

.rail-game-item.current {
  background: var(--surface);
  box-shadow: var(--shadow-card);
  font-weight: 700;
}

.rail-game-left {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.rail-game-left .game-badge-sq {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  font-size: 0.78rem;
  border-bottom-width: 2px;
}

.rail-game-status {
  font-size: 0.74rem;
  color: var(--ink-3);
  white-space: nowrap;
}

.rail-game-status.solved {
  color: var(--success);
  font-weight: 700;
}

.rail-game-status.playing {
  color: var(--primary);
  font-weight: 700;
}

/* Center Game Column */
.play-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

.board-card {
  width: 100%;
  max-width: 560px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 20px;
  box-shadow: var(--shadow-card);
  user-select: none;
  -webkit-user-select: none;
}

.shell-message {
  min-height: 24px;
  margin: 12px 0 10px;
  text-align: center;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-2);
}

.shell-message.error { color: var(--error); }
.shell-message.info { color: var(--primary); }
.shell-message.success { color: var(--success); }

.shell-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.hint-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--g-pairs);
  color: var(--ink);
  font: 700 0.72rem var(--font-display);
}

.shell-input-area {
  width: 100%;
  max-width: 560px;
  user-select: none;
  -webkit-user-select: none;
}

/* Shared On-Screen QWERTY Keyboard (exact 10-column proportions across all 3 rows) */
.arcade-kbd {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  user-select: none;
  -webkit-user-select: none;
}

.arcade-kbd-row {
  display: flex;
  justify-content: center;
  gap: 5px;
  width: 100%;
}

.arcade-kbd-row.row-mid {
  padding: 0 5%;
}

.arcade-key {
  flex: 1 1 0;
  min-width: 0;
  padding: 0;
  height: 48px;
  border-radius: 10px;
  border: 1px solid var(--line);
  border-bottom: 3px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font: 700 0.96rem var(--font-display);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.arcade-key:active { transform: translateY(2px); }

.arcade-key.wide {
  flex: 1.5 1 0;
  min-width: 0;
  padding: 0;
  font: 700 0.76rem var(--font-body);
  letter-spacing: 0.01em;
}

.arcade-key.submit {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  border-bottom-color: var(--primary-deep);
}

/* ── Unified Overlays (Solved + How to Play) ── */
.overlay-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 27, 52, 0.48);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 60;
  animation: fwg-backdrop-in 170ms ease-out both;
}

.overlay-backdrop[hidden] { display: none; }

.overlay-sheet {
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-float);
  position: relative;
  z-index: 2;
  animation: fwg-modal-in 220ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.sheet-handle {
  display: none;
  width: 40px;
  height: 4px;
  border-radius: 99px;
  background: var(--line-strong);
  margin: 0 auto 14px;
}

.sheet-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

.solved-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--success);
  border-bottom: 4px solid var(--success-deep);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin: 0 auto 12px;
}

.solved-icon.neutral {
  background: var(--surface-2);
  border-bottom-color: var(--line-strong);
  color: var(--ink);
}

.overlay-title {
  font: 700 1.65rem var(--font-display);
  margin: 0 0 6px;
  text-align: center;
}

.overlay-sub {
  margin: 0 0 18px;
  text-align: center;
  color: var(--ink-2);
  font-size: 0.9rem;
}

.stat-trio {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--bg);
  border-radius: 16px;
  padding: 12px 6px;
  margin-bottom: 16px;
  text-align: center;
}

.stat-trio > div + div {
  border-left: 1px solid var(--line);
}

.stat-trio strong {
  display: block;
  font: 700 1.35rem var(--font-display);
  color: var(--ink);
}

.stat-trio span {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--ink-3);
}

.solution-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-bottom: 18px;
}

.sol-pill {
  padding: 5px 11px;
  border-radius: 9px;
  background: var(--g-ladder-soft);
  color: var(--primary);
  font: 700 0.78rem var(--font-body);
  letter-spacing: 0.06em;
}

.sol-pill.goal {
  background: var(--g-pairs);
  color: var(--ink);
}

.countdown-line {
  text-align: center;
  font-size: 0.8rem;
  color: var(--ink-3);
  font-weight: 600;
  margin: 12px 0 16px;
}

.countdown-line strong {
  color: var(--ink);
  font-family: var(--font-display);
}

.play-next-label {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 10px;
}

.play-next-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.pn-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 13px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.pn-banner {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 4px;
}

.pn-banner .thumb { transform: scale(0.62); }

.pn-info {
  padding: 7px 8px;
}

.pn-title {
  font: 700 0.76rem var(--font-display);
  line-height: 1.2;
  margin-bottom: 2px;
}

.pn-meta {
  font-size: 0.66rem;
  color: var(--ink-3);
  font-weight: 600;
}

/* How-to-Play Overlay */
.rules-list {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rules-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.88rem;
  color: var(--ink-2);
}

.rule-num {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: var(--g-ladder-soft);
  color: var(--primary);
  font: 700 0.8rem var(--font-display);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.rules-example {
  background: var(--bg);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 14px;
  text-align: center;
}

.rules-note {
  font-size: 0.8rem;
  color: var(--ink-2);
  margin: 0 0 16px;
}

/* Prose / Archive pages */
.page-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 28px 24px 64px;
}

.prose-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 28px;
  max-width: 740px;
  box-shadow: var(--shadow-card);
}

.prose-card h1 { font: 700 2rem var(--font-display); margin: 0 0 6px; }
.prose-card h2 { font: 700 1.1rem var(--font-display); margin: 22px 0 6px; }
.prose-card p { color: var(--ink-2); font-size: 0.94rem; }

.archived-banner {
  max-width: 1320px;
  margin: 12px auto 0;
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--g-pairs-soft);
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 600;
}

.error-box {
  background: var(--error-soft);
  border: 1px solid #FBC8C8;
  color: var(--error);
  padding: 18px;
  border-radius: 14px;
  font-weight: 600;
}

.site-footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 20px 24px 36px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 0.84rem;
  color: var(--ink-3);
}

.footer-games-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  font-weight: 600;
}

.footer-games-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.footer-games-row a { color: var(--ink-2); }
.footer-games-row a:hover { color: var(--primary); }

.footer-bottom {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-links { display: flex; gap: 18px; font-weight: 600; }
.footer-links a:hover { color: var(--ink); }

/* Below-the-fold SEO About & FAQ section on game pages (never crowds above-the-fold play) */
.seo-about {
  max-width: 1120px;
  margin: 36px auto 28px;
  padding: 0 20px;
}

.seo-about-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 28px;
  box-shadow: var(--shadow-card);
}

.seo-cols {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 28px;
  margin-bottom: 24px;
}

.seo-about-card h2 {
  font: 700 1.35rem var(--font-display);
  margin: 0 0 10px;
}

.seo-about-card h3 {
  font: 700 1.02rem var(--font-display);
  margin: 0 0 10px;
}

.seo-about-card p {
  margin: 0 0 10px;
  color: var(--ink-2);
  font-size: 0.9rem;
  line-height: 1.55;
}

.seo-rules-ol {
  margin: 0;
  padding-left: 20px;
  color: var(--ink-2);
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.seo-faq {
  border-top: 1px solid var(--line);
  padding-top: 20px;
  margin-bottom: 22px;
}

.seo-faq-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 14px;
  margin-bottom: 8px;
  background: var(--bg);
}

.seo-faq-item summary {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--ink);
  cursor: pointer;
}

.seo-faq-item p {
  margin: 8px 0 0;
  font-size: 0.86rem;
}

.seo-more {
  border-top: 1px solid var(--line);
  padding-top: 20px;
}

.seo-more-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

.seo-more-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  font-size: 0.82rem;
  color: var(--ink-2);
  transition: border-color 0.12s ease;
}

.seo-more-pill:hover { border-color: var(--primary); color: var(--ink); }
.seo-more-pill strong { color: var(--ink); }
.seo-more-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

@media (max-width: 720px) {
  .seo-about { margin-top: 22px; padding: 0 12px; }
  .seo-about-card { padding: 18px; }
  .seo-cols { grid-template-columns: 1fr; gap: 18px; }
}

/* ── Tablet & Mobile Responsive Optimization (390×844 target) ── */
@media (max-width: 1040px) {
  .home-container {
    grid-template-columns: 1fr;
  }
  .play-shell-grid {
    grid-template-columns: 1fr;
    padding: 10px 12px 20px;
    gap: 12px;
  }
  .games-rail,
  .play-right-rail {
    display: none;
  }
}

@media (max-width: 720px) {
  .site-header { position: static; }
  .site-header-inner { padding: 10px 14px; }
  .header-nav { display: none; }
  .streak-text-full { display: none; }
  .home-rail .ad-card { display: none !important; }

  .mobile-nav-strip {
    display: flex;
    gap: 8px;
    padding: 10px 14px 4px;
    max-width: var(--max-width);
    margin: 0 auto;
  }
  .mobile-nav-strip a {
    padding: 7px 14px;
    border-radius: var(--radius-pill);
    background: var(--surface);
    border: 1px solid var(--line);
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--ink-2);
  }
  .mobile-nav-strip a[aria-current="page"] {
    background: var(--ink);
    border-color: var(--ink);
    color: #fff;
  }

  .home-container {
    padding: 12px 14px 44px;
    gap: 14px;
  }

  .hero-card {
    grid-template-columns: 1fr;
    padding: 18px;
    gap: 14px;
    margin-bottom: 16px;
  }
  .hero-preview { display: none; }
  .hero-card h1 { font-size: 1.9rem; }
  .hero-actions .btn-chunky { width: 100%; }

  .game-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .cartridge-banner { height: 84px; padding: 8px; }
  .cartridge-body { padding: 11px 12px 12px; }
  .cartridge-body p { display: none; }
  .cartridge-body h3 { font-size: 0.95rem; }
  .cartridge-title-row { flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
  .mobile-ad-bar { padding: 0 12px; margin: 4px auto 0; }
  .ad-box.banner { height: 42px; font-size: 0.72rem; }
  .arcade-kbd-row { gap: 4px; }
  .arcade-key { height: 46px; font-size: 0.9rem; border-radius: 9px; }
  .arcade-key.wide { font-size: 0.72rem; }
  .seo-about { margin-top: 22px; padding: 0 12px; }

  /* Mobile Game Shell: 100% playable above the fold at 390×844 */
  .game-shell-header-inner {
    padding: 8px 12px;
  }
  .back-pill .back-label,
  .gs-left .mode-switch,
  .gs-right .stats-pill,
  .gs-title-group .game-badge-sq {
    display: none;
  }
  .gs-left { flex: 1; justify-content: space-between; gap: 8px; }
  .gs-title-group { flex: 1; justify-content: center; text-align: center; }
  .gs-title { font-size: 1.05rem; }

  .mobile-subbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px 4px;
    max-width: 560px;
    margin: 0 auto;
  }
  .mobile-subbar .mode-btn { padding: 5px 11px; font-size: 0.78rem; }
  .mobile-subbar .stats-pill { padding: 5px 11px; font-size: 0.76rem; gap: 9px; }

  .board-card {
    padding: 12px;
    border-radius: 18px;
  }
  .shell-message {
    margin: 8px 0 6px;
    font-size: 0.8rem;
  }
  .shell-actions {
    gap: 7px;
    margin-bottom: 10px;
  }
  .shell-actions .btn-chunky.secondary {
    padding: 7px 12px;
    font-size: 0.8rem;
  }
  .arcade-key { height: 42px; font-size: 0.88rem; }

  .overlay-backdrop {
    align-items: flex-end;
    padding: 0;
  }
  .overlay-sheet {
    max-width: 100%;
    border-radius: 24px 24px 0 0;
    padding: 14px 18px 24px;
    animation: fwg-sheet-in 240ms cubic-bezier(0.22, 1, 0.36, 1) both;
  }
  .sheet-handle { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
