/* Vertex Play - shared stylesheet */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f172a;
  --bg-soft: #1e293b;
  --card: #1e293b;
  --card-hover: #273449;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #22d3ee;
  --accent-2: #f59e0b;
  --green: #22c55e;
  --red: #ef4444;
  --radius: 12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

.container { width: min(1100px, 92%); margin: 0 auto; }

/* Header */
header.site-header {
  background: #0b1220;
  border-bottom: 1px solid #243449;
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 0;
  flex-wrap: wrap;
}
.logo { font-size: 1.5rem; font-weight: 800; color: #fff; letter-spacing: -0.5px; }
.logo span { color: var(--accent); }
.logo:hover { text-decoration: none; }
nav.main-nav { display: flex; gap: 4px; flex-wrap: wrap; }
nav.main-nav a {
  color: var(--text);
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
}
nav.main-nav a:hover, nav.main-nav a.active { background: var(--bg-soft); color: var(--accent); text-decoration: none; }

/* Hero */
.hero { text-align: center; padding: 48px 0 32px; }
.hero h1 { font-size: 2.4rem; line-height: 1.2; margin-bottom: 12px; }
.hero p { color: var(--muted); font-size: 1.1rem; max-width: 640px; margin: 0 auto; }
.hero .tagline { color: var(--accent-2); font-weight: 700; }

/* Game grid */
.section-title { font-size: 1.4rem; margin: 28px 0 16px; border-left: 4px solid var(--accent); padding-left: 12px; }
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}
.game-card {
  background: var(--card);
  border: 1px solid #2b3a52;
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .15s ease, border-color .15s ease;
  display: flex;
  flex-direction: column;
}
.game-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.game-card a.card-link { color: inherit; display: flex; flex-direction: column; flex: 1; }
.game-card a.card-link:hover { text-decoration: none; }
.game-thumb {
  font-size: 3rem;
  text-align: center;
  padding: 26px 0 10px;
  background: linear-gradient(135deg, #16213a, #1e293b);
}
.game-card h3 { padding: 6px 16px 0; font-size: 1.1rem; color: #fff; }
.game-card p { padding: 4px 16px 14px; color: var(--muted); font-size: 0.9rem; flex: 1; }
.game-card .badge {
  display: inline-block;
  margin: 0 16px 14px;
  align-self: flex-start;
  background: #0b1220;
  color: var(--accent);
  border: 1px solid #2b3a52;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Category chips */
.chip-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 8px 0 4px; }
.chip {
  background: var(--bg-soft);
  border: 1px solid #2b3a52;
  color: var(--text);
  padding: 8px 16px;
  border-radius: 24px;
  font-weight: 600;
}
.chip:hover, .chip.active { background: var(--accent); color: #06222b; border-color: var(--accent); text-decoration: none; }

/* Game page */
.game-page { padding: 28px 0 8px; }
.game-page h1 { font-size: 1.8rem; margin-bottom: 6px; }
.game-meta { color: var(--muted); margin-bottom: 18px; }
.game-shell {
  background: var(--bg-soft);
  border: 1px solid #2b3a52;
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.scorebar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.scorebar .score { font-size: 1.1rem; font-weight: 700; }
.scorebar .score b { color: var(--accent-2); font-size: 1.3rem; }
.btn {
  display: inline-block;
  background: var(--accent);
  color: #06222b;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
}
.btn:hover { background: #67e8f9; }
.btn.secondary { background: #334155; color: var(--text); }
.btn.secondary:hover { background: #475569; }
.status-msg { font-weight: 700; min-height: 1.5em; }
.status-msg.win { color: var(--green); }
.status-msg.lose { color: var(--red); }
.howto { margin-bottom: 28px; }
.howto h2 { font-size: 1.2rem; margin-bottom: 8px; }
.howto ul { padding-left: 20px; color: var(--muted); }
.howto li { margin-bottom: 4px; }
.related { margin-bottom: 28px; }

/* 2048 */
.board-2048 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  width: min(420px, 100%);
  margin: 0 auto;
  background: #0b1220;
  padding: 8px;
  border-radius: 10px;
  touch-action: none;
}
.tile {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
  border-radius: 8px;
  background: #243449;
  color: transparent;
}
.tile.t2 { background: #eee4da; color: #776e65; }
.tile.t4 { background: #ede0c8; color: #776e65; }
.tile.t8 { background: #f2b179; color: #fff; }
.tile.t16 { background: #f59563; color: #fff; }
.tile.t32 { background: #f67c5f; color: #fff; }
.tile.t64 { background: #f65e3b; color: #fff; }
.tile.t128 { background: #edcf72; color: #fff; font-size: 1.3rem; }
.tile.t256 { background: #edcc61; color: #fff; font-size: 1.3rem; }
.tile.t512 { background: #edc850; color: #fff; font-size: 1.3rem; }
.tile.t1024 { background: #edc53f; color: #fff; font-size: 1.1rem; }
.tile.t2048 { background: #edc22e; color: #fff; font-size: 1.1rem; }

/* Snake / Breakout canvas */
canvas.game-canvas {
  display: block;
  margin: 0 auto;
  background: #0b1220;
  border-radius: 10px;
  max-width: 100%;
  touch-action: none;
}
.dpad { display: none; justify-content: center; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.dpad button {
  width: 56px; height: 48px;
  font-size: 1.2rem;
  background: #334155; color: #fff;
  border: none; border-radius: 8px; cursor: pointer;
}
@media (max-width: 640px) { .dpad { display: flex; } }

/* Memory */
.memory-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  width: min(480px, 100%);
  margin: 0 auto;
}
.memory-card {
  aspect-ratio: 1;
  perspective: 600px;
  cursor: pointer;
}
.memory-card .inner {
  position: relative;
  width: 100%; height: 100%;
  transform-style: preserve-3d;
  transition: transform .35s ease;
}
.memory-card.flipped .inner { transform: rotateY(180deg); }
.memory-card .face {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
  border-radius: 10px;
  backface-visibility: hidden;
}
.memory-card .front { background: #243449; }
.memory-card .back { background: #f8fafc; transform: rotateY(180deg); }
.memory-card.matched .back { background: #dcfce7; }

/* Minesweeper */
.ms-board {
  display: grid;
  gap: 2px;
  width: max-content;
  margin: 0 auto;
  background: #0b1220;
  padding: 6px;
  border-radius: 10px;
}
.ms-cell {
  width: 34px; height: 34px;
  background: #334155;
  border: none;
  border-radius: 4px;
  font-weight: 800;
  font-size: 1rem;
  color: #fff;
  cursor: pointer;
  padding: 0;
}
.ms-cell:hover { background: #475569; }
.ms-cell.open { background: #1e293b; cursor: default; }
.ms-cell.mine { background: var(--red); }
.ms-cell.flagged { background: #78350f; }
.ms-cell.n1 { color: #60a5fa; } .ms-cell.n2 { color: #4ade80; }
.ms-cell.n3 { color: #f87171; } .ms-cell.n4 { color: #c084fc; }
.ms-cell.n5 { color: #facc15; } .ms-cell.n6 { color: #2dd4bf; }
.ms-cell.n7 { color: #f472b6; } .ms-cell.n8 { color: #a1a1aa; }
@media (max-width: 480px) { .ms-cell { width: 30px; height: 30px; } }

/* Tic Tac Toe */
.ttt-board {
  display: grid;
  grid-template-columns: repeat(3, 96px);
  gap: 8px;
  width: max-content;
  margin: 0 auto;
}
.ttt-cell {
  width: 96px; height: 96px;
  font-size: 2.6rem; font-weight: 800;
  background: #243449;
  border: none; border-radius: 10px;
  color: #fff; cursor: pointer;
}
.ttt-cell:hover { background: #334155; }
.ttt-cell:disabled { cursor: default; }

/* Whack-a-mole */
.whack-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: min(420px, 100%);
  margin: 0 auto;
}
.whack-hole {
  aspect-ratio: 1;
  background: #0b1220;
  border: 2px solid #243449;
  border-radius: 50%;
  font-size: 2.4rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
}
.whack-hole:hover { border-color: var(--accent); }

/* Simon */
.simon-board {
  display: grid;
  grid-template-columns: repeat(2, 140px);
  gap: 12px;
  width: max-content;
  margin: 0 auto;
}
.simon-pad {
  width: 140px; height: 140px;
  border: none; border-radius: 16px;
  opacity: 0.45; cursor: pointer;
  transition: opacity .15s ease;
}
.simon-pad.lit { opacity: 1; box-shadow: 0 0 24px rgba(255,255,255,.45); }
.simon-pad.green { background: #22c55e; }
.simon-pad.red { background: #ef4444; }
.simon-pad.yellow { background: #eab308; }
.simon-pad.blue { background: #3b82f6; }
.simon-pad:disabled { cursor: default; }

/* Content pages */
.content-page { padding: 32px 0 40px; max-width: 760px; }
.content-page h1 { margin-bottom: 16px; }
.content-page h2 { margin: 24px 0 8px; font-size: 1.25rem; }
.content-page p, .content-page li { color: #cbd5e1; margin-bottom: 10px; }
.content-page ul { padding-left: 22px; }
.contact-form { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.contact-form label { font-weight: 600; }
.contact-form input, .contact-form textarea, .contact-form select {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #334155;
  background: var(--bg-soft);
  color: var(--text);
  font-size: 1rem;
  width: 100%;
}
.form-note { color: var(--muted); font-size: 0.9rem; }

/* Footer */
footer.site-footer {
  margin-top: auto;
  background: #0b1220;
  border-top: 1px solid #243449;
  padding: 28px 0;
  color: var(--muted);
  font-size: 0.9rem;
}
.footer-inner { display: flex; flex-wrap: wrap; gap: 24px; justify-content: space-between; }
.footer-inner nav { display: flex; gap: 16px; flex-wrap: wrap; }
.footer-inner nav a { color: var(--muted); }
.footer-inner nav a:hover { color: var(--accent); }

main { flex: 1; }

@media (max-width: 640px) {
  .hero h1 { font-size: 1.8rem; }
  .header-inner { gap: 10px; }
  .simon-board { grid-template-columns: repeat(2, 110px); }
  .simon-pad { width: 110px; height: 110px; }
  .ttt-board { grid-template-columns: repeat(3, 84px); }
  .ttt-cell { width: 84px; height: 84px; }
}
