/* ====================================
   Home Page — landing CTA grid + (shared) game styles
   The game styles below are also pulled in by /games.
   ==================================== */

.home-cta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.home-cta { display: flex; flex-direction: column; gap: 10px; padding: 20px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: rgba(255,255,255,.04); color: var(--fg); text-decoration: none; transition: all var(--ease); box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,.04); }
.home-cta:hover { background: rgba(255,255,255,.07); border-color: rgba(56,189,248,.4); transform: translateY(-2px); }
.home-cta h3 { margin: 0; font-size: 17px; font-weight: 700; }
.home-cta p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.home-cta-icon { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: var(--radius-md); background: rgba(255,255,255,.06); }
.home-cta-icon.brand { color: var(--brand); background: var(--brand-dim); }
.home-cta-icon.ok { color: var(--ok); background: var(--ok-dim); }
.home-cta-arrow { margin-top: auto; font-size: 13px; font-weight: 600; color: var(--brand); letter-spacing: .02em; }

:root { --viewport-h: clamp(580px, 75vh, 800px); --stage-size: min(520px, 88vw); }

.game-card { background: rgba(255,255,255,.04); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px; box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,.04); }
.tabs {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px;
}
/* On narrow phones we run out of room for 8 wrapping pills — switch to a
   horizontally-scrollable strip with momentum scrolling. */
@media (max-width: 600px) {
  .tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    margin-left: -4px;
    margin-right: -4px;
    padding-left: 4px;
    padding-right: 4px;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: 0 0 auto; }
}
.tab { appearance: none; border: 1px solid var(--border-light); color: var(--fg); background: rgba(255,255,255,.05); border-radius: var(--radius-pill); padding: 7px 14px; font-size: 13px; font-weight: 600; letter-spacing: .03em; cursor: pointer; transition: all var(--ease); }
.tab:hover { background: rgba(255,255,255,.08); }
.tab.active { border-color: rgba(56,189,248,.6); box-shadow: 0 0 0 2px rgba(56,189,248,.2) inset; color: var(--brand); }
.sectionsWrap { position: relative; height: var(--viewport-h); width: 100%; }
.section { position: absolute; inset: 0; overflow: auto; padding: 0 4px 10px; visibility: hidden; pointer-events: none; }
.section.active { visibility: visible; pointer-events: auto; }
.stage { position: relative; width: 100%; aspect-ratio: 1/1; max-width: var(--stage-size); margin: 0 auto; }
.stageBox { position: absolute; inset: 0; border-radius: var(--radius-xl); background: linear-gradient(180deg,rgba(255,255,255,.04),rgba(255,255,255,.02)); border: 1px solid var(--border); box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,.04); overflow: hidden; }
.overlay { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.cta { pointer-events: auto; border: 1px solid var(--border-light); background: rgba(255,255,255,.07); color: var(--fg); padding: 10px 18px; border-radius: var(--radius-pill); font-weight: 700; letter-spacing: .04em; min-width: 140px; cursor: pointer; transition: all var(--ease); }
.cta:hover { background: rgba(255,255,255,.12); }
canvas.game { position: absolute; inset: 0; width: 100%; height: 100%; }
.tttStage { position: absolute; inset: 12px; display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.cell { display: grid; place-items: center; aspect-ratio: 1/1; border: 1px solid var(--border-light); border-radius: var(--radius-lg); background: rgba(255,255,255,.04); font-size: clamp(28px,10vw,56px); font-weight: 800; user-select: none; cursor: pointer; transition: background var(--ease); }
.cell:hover { background: rgba(255,255,255,.07); }
.infoRow { display: flex; gap: 10px; align-items: center; justify-content: center; margin: 10px 0 4px; }
.game-badge { padding: 5px 10px; border-radius: var(--radius-pill); border: 1px solid var(--border-light); background: rgba(255,255,255,.05); font-size: 12px; }
.game-btn { border: 1px solid var(--border-light); background: rgba(255,255,255,.05); color: var(--fg); padding: 7px 12px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 600; cursor: pointer; transition: all var(--ease); }
.game-btn:hover { background: rgba(255,255,255,.09); }
.sudokuStage { position: absolute; inset: 10px; display: grid; grid-template-columns: repeat(9,1fr); gap: 2px; }
.sq { aspect-ratio: 1/1; display: grid; place-items: center; font-size: clamp(12px,2.6vw,20px); background: rgba(255,255,255,.04); border-radius: var(--radius-sm); user-select: none; cursor: pointer; transition: background var(--ease); }
.sq:hover { background: rgba(255,255,255,.07); }
.sq.given { background: rgba(255,255,255,.10); font-weight: 800; }
.sq.sel { outline: 2px solid var(--brand); }
.sq.err { background: var(--err-dim); }
.numpad { display: grid; grid-template-columns: repeat(9,1fr); gap: 6px; width: min(var(--stage-size),96%); margin: 10px auto 0; }
.key { padding: 10px 0; border-radius: var(--radius-md); text-align: center; border: 1px solid var(--border-light); background: rgba(255,255,255,.05); user-select: none; cursor: pointer; transition: all var(--ease); }
.key:hover { background: rgba(255,255,255,.09); }
.sudBtns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }

/* ====================================
   Memory match
   ==================================== */
.memStage { position: absolute; inset: 10px; display: grid; grid-template-columns: repeat(4,1fr); grid-template-rows: repeat(4,1fr); gap: 8px; }
.memCard { perspective: 600px; cursor: pointer; }
.memCard .face { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .35s ease; border-radius: var(--radius-md); }
.memCard.flipped .face, .memCard.matched .face { transform: rotateY(180deg); }
.memCard .front, .memCard .back { position: absolute; inset: 0; display: grid; place-items: center; backface-visibility: hidden; border-radius: var(--radius-md); font-size: clamp(28px, 6vw, 44px); }
.memCard .back  { background: rgba(56,189,248,.12); border: 1px solid rgba(56,189,248,.3); color: var(--brand); font-weight: 800; }
.memCard .front { background: rgba(255,255,255,.07); border: 1px solid var(--border-light); transform: rotateY(180deg); }
.memCard.matched .front { background: rgba(34,197,94,.18); border-color: rgba(34,197,94,.4); }

/* ====================================
   Connect 4
   ==================================== */
.c4Stage { position: absolute; inset: 12px; display: grid; grid-template-columns: repeat(7,1fr); grid-template-rows: repeat(6,1fr); gap: 4px; background: rgba(56,189,248,.1); border: 1px solid rgba(56,189,248,.25); border-radius: var(--radius-md); padding: 6px; }
.c4Cell { aspect-ratio: 1/1; border-radius: 50%; background: rgba(0,0,0,.35); display: grid; place-items: center; cursor: pointer; transition: background .15s; position: relative; overflow: hidden; }
.c4Cell:hover { background: rgba(0,0,0,.5); }
.c4Cell.hint { box-shadow: inset 0 0 0 2px rgba(255,255,255,.25); }
.c4Piece { width: 88%; height: 88%; border-radius: 50%; transition: transform .25s cubic-bezier(.4,1.6,.5,1); transform: translateY(-300%); }
.c4Piece.drop { transform: translateY(0); }
.c4Piece.p1 { background: radial-gradient(circle at 30% 30%, #ff7a8c, #f43f5e); box-shadow: inset 0 -4px 0 rgba(0,0,0,.25); }
.c4Piece.p2 { background: radial-gradient(circle at 30% 30%, #ffd966, #fbbf24); box-shadow: inset 0 -4px 0 rgba(0,0,0,.25); }
.c4Cell.win { animation: c4win 1s ease infinite; }
@keyframes c4win { 0%,100% { box-shadow: inset 0 0 0 3px var(--ok); } 50% { box-shadow: inset 0 0 0 3px transparent; } }

/* ====================================
   Minesweeper
   ==================================== */
.mineStage { position: absolute; inset: 10px; display: grid; grid-template-columns: repeat(9,1fr); grid-template-rows: repeat(9,1fr); gap: 2px; background: rgba(255,255,255,.04); padding: 4px; border-radius: var(--radius-md); }
.mineCell { aspect-ratio: 1/1; display: grid; place-items: center; font-size: clamp(11px, 2.4vw, 18px); font-weight: 800; background: rgba(255,255,255,.08); border-radius: 3px; cursor: pointer; user-select: none; transition: background .1s; }
.mineCell:hover { background: rgba(255,255,255,.12); }
.mineCell.revealed { background: rgba(255,255,255,.02); cursor: default; }
.mineCell.flag { color: var(--err); }
.mineCell.mine { background: var(--err-dim); color: var(--err); }
.mineCell.boom { background: var(--err); color: #fff; }
.mineCell.n1 { color: #38bdf8; }
.mineCell.n2 { color: #22c55e; }
.mineCell.n3 { color: #fbbf24; }
.mineCell.n4 { color: #a855f7; }
.mineCell.n5 { color: #f97316; }
.mineCell.n6 { color: #06b6d4; }
.mineCell.n7 { color: #f43f5e; }
.mineCell.n8 { color: #e5e7eb; }
