/* CrownGrid — original styling. Mobile-first; puzzle players skew mobile. */
:root {
  --bg: #0f1226;
  --bg-soft: #1a1e3a;
  --panel: #ffffff;
  --ink: #1b1d2b;
  --ink-soft: #5b6072;
  --accent: #6c5ce7;
  --accent-2: #00b894;
  --line: #2b2f52;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .18);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #eef0ff;
  background: radial-gradient(1200px 600px at 50% -10%, #20264f 0%, var(--bg) 60%);
  min-height: 100vh;
  line-height: 1.55;
}

a { color: #a9b1ff; }

.container { width: 100%; max-width: 920px; margin: 0 auto; padding: 0 16px; }

/* Header / nav */
.site-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px; max-width: 920px; margin: 0 auto; gap: 12px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.25rem; text-decoration: none; color: #fff; }
.brand .crown { font-size: 1.4rem; }
.nav a { margin-left: 16px; text-decoration: none; font-weight: 600; color: #c7ccff; }
.nav a:hover { color: #fff; }

/* Hero */
.hero { text-align: center; padding: 28px 16px 8px; }
.hero h1 { font-size: clamp(1.8rem, 5vw, 2.8rem); margin: 0 0 8px; letter-spacing: -.5px; }
.hero p { color: #c2c7ee; max-width: 640px; margin: 0 auto 18px; font-size: 1.05rem; }
.badges { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 18px; }
.badge { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); padding: 5px 12px; border-radius: 999px; font-size: .85rem; }

.cta { display: inline-flex; align-items: center; gap: 8px; background: var(--accent); color: #fff;
  text-decoration: none; font-weight: 700; padding: 14px 26px; border-radius: 999px; box-shadow: var(--shadow); border: 0; cursor: pointer; font-size: 1.05rem; }
.cta:hover { filter: brightness(1.07); }
.cta--ghost { background: rgba(255,255,255,.1); }

/* Game panel */
.game-card { background: var(--panel); color: var(--ink); border-radius: 20px; box-shadow: var(--shadow); padding: 18px; margin: 18px auto; max-width: 560px; }
.game-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
#mode-label { font-weight: 700; color: var(--ink); }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; background: #eef0fb; border-radius: 10px; padding: 4px 12px; color: var(--ink); }

.stats { display: flex; gap: 8px; justify-content: center; margin-bottom: 12px; }
.stat { flex: 1; background: #f4f5fb; border-radius: 12px; padding: 8px; text-align: center; }
.stat b { display: block; font-size: 1.25rem; color: var(--accent); }
.stat span { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); }

/* Board */
.board {
  display: grid;
  grid-template-columns: repeat(var(--n, 8), 1fr);
  grid-template-rows: repeat(var(--n, 8), 1fr);
  gap: 3px;
  background: #2b2f52;
  padding: 3px;
  border-radius: 12px;
  aspect-ratio: 1 / 1;
  width: 100%;
  margin: 0 auto 14px;
  touch-action: none; /* let drag-to-mark work without scrolling the page */
}
.cell {
  border: 0; margin: 0; padding: 0;
  min-width: 0; min-height: 0; /* stop the glyph from stretching its grid track */
  overflow: hidden;
  border-radius: 4px;
  font-size: clamp(16px, 5.5vw, 30px);
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: #1b1d2b;
  transition: transform .05s ease, box-shadow .1s ease;
  user-select: none; -webkit-user-select: none;
}
.cell:hover { box-shadow: inset 0 0 0 2px rgba(0,0,0,.18); }
.cell:active { transform: scale(.94); }
.cell.is-mark { color: rgba(0,0,0,.6); font-size: clamp(12px, 4vw, 20px); }
.cell.is-auto { color: rgba(0,0,0,.32); font-size: clamp(12px, 4vw, 20px); } /* auto-filled ✕ is fainter */
.cell.is-crown { color: #1b1d2b; }
.cell.is-bad { box-shadow: inset 0 0 0 3px #e74c3c; animation: shake .25s; }
.cell.flash { box-shadow: inset 0 0 0 3px var(--accent-2); }

@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-2px)} 75%{transform:translateX(2px)} }

.message { min-height: 24px; text-align: center; font-weight: 700; margin-bottom: 10px; }
.message--ok { color: var(--accent-2); }
.message--warn { color: #d35400; }

/* Controls */
.controls { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.btn { border: 0; cursor: pointer; font-weight: 700; padding: 11px 16px; border-radius: 12px; background: #eef0fb; color: var(--ink); }
.btn:hover { background: #e3e6fb; }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { filter: brightness(1.07); }
.size-wrap { display: flex; align-items: center; gap: 6px; background: #eef0fb; border-radius: 12px; padding: 4px 10px; color: var(--ink); font-weight: 600; }
.size-wrap select { border: 0; background: transparent; font-weight: 700; font-size: 1rem; color: var(--ink); }

/* Ad slots — replace data-ad-* + script with your AdSense code after approval */
.ad-slot { max-width: 728px; margin: 22px auto; min-height: 90px; display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.04); border: 1px dashed rgba(255,255,255,.18); border-radius: 12px; color: #8b90c0; font-size: .85rem; }

/* SunMoon (binary-logic puzzle) board */
.sm-board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--n, 6), 1fr);
  grid-template-rows: repeat(var(--n, 6), 1fr);
  gap: 4px; background: #2b2f52; padding: 4px; border-radius: 12px;
  aspect-ratio: 1 / 1; width: 100%; max-width: 440px; margin: 0 auto 14px;
  touch-action: manipulation;
}
.sm-cell {
  border: 0; margin: 0; padding: 0; min-width: 0; min-height: 0;
  border-radius: 8px; background: #eef0fb;
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(20px, 7vw, 34px); line-height: 1; cursor: pointer;
  user-select: none; -webkit-user-select: none; transition: transform .05s ease;
}
.sm-cell:active { transform: scale(.93); }
.sm-cell.is-given { background: #d4d9f2; cursor: default; }
.sm-cell.is-bad { box-shadow: inset 0 0 0 3px #e74c3c; }
.sm-cell.flash { box-shadow: inset 0 0 0 3px var(--accent-2); }
.sm-edge {
  position: absolute; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; color: #1b1d2b; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px; transform: translate(-50%, -50%); z-index: 5;
  box-shadow: 0 1px 3px rgba(0,0,0,.45); pointer-events: none;
}
.sm-edge--ne { color: #e74c3c; }

/* SunMoon symbols drawn as discs (so the moon reads clearly darker than the sun) */
.sm-cell.is-sun::before, .sm-cell.is-moon::before {
  content: ""; display: block; width: 62%; height: 62%; border-radius: 50%;
}
.sm-cell.is-sun::before {
  background: radial-gradient(circle at 35% 32%, #ffe08a, #ff9e2c);
  box-shadow: 0 0 6px rgba(255, 160, 40, .45);
}
.sm-cell.is-moon::before {
  background: radial-gradient(circle at 35% 32%, #3a4080, #14163a);
  box-shadow: 0 0 5px rgba(20, 22, 58, .5);
}

/* Small SunMoon icon (matches the in-game discs: gold sun + dark moon) */
.sm-ico { display: inline-flex; gap: .12em; align-items: center; vertical-align: middle; }
.sm-ico i { display: inline-block; width: .72em; height: .72em; border-radius: 50%; }
.sm-ico .s { background: radial-gradient(circle at 35% 32%, #ffe08a, #ff9e2c); }
.sm-ico .m { background: radial-gradient(circle at 35% 32%, #3a4080, #14163a); }

/* Win modal (shared by all games) */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
  background: rgba(8, 10, 26, .68); padding: 20px; }
.modal[hidden] { display: none; }
.modal__card { position: relative; background: var(--panel); color: var(--ink); border-radius: 20px;
  padding: 28px 24px; max-width: 360px; width: 100%; text-align: center; box-shadow: var(--shadow); animation: pop .18s ease; }
@keyframes pop { from { transform: scale(.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal__card h2 { margin: 0 0 6px; font-size: 1.6rem; }
.modal__card p { color: var(--ink-soft); margin: 0 0 18px; }
.modal__actions { display: flex; flex-direction: column; gap: 10px; }
.modal__actions .btn { width: 100%; text-decoration: none; text-align: center; }
.modal__close { position: absolute; top: 10px; right: 12px; border: 0; background: transparent;
  font-size: 1.1rem; color: var(--ink-soft); cursor: pointer; }

/* Sudoku board */
.su-board { display: grid; grid-template-columns: repeat(9, 1fr); grid-template-rows: repeat(9, 1fr);
  aspect-ratio: 1 / 1; width: 100%; max-width: 460px; margin: 0 auto 12px; background: #1b1d2b;
  border: 3px solid #1b1d2b; border-radius: 10px; overflow: hidden; touch-action: manipulation; }
.su-cell { border: 0; margin: 0; padding: 0; min-width: 0; min-height: 0; background: #fbfcff;
  font-size: clamp(16px, 5.5vw, 26px); font-weight: 600; color: var(--accent); cursor: pointer;
  display: flex; align-items: center; justify-content: center; box-shadow: inset 0 0 0 .5px #c7cbe6;
  user-select: none; -webkit-user-select: none; }
.su-cell.is-given { color: #1b1d2b; font-weight: 800; background: #eef0fb; cursor: default; }
.su-cell.is-sel { background: #d8dcfb; }
.su-cell.is-peer { background: #f0f1fb; }
.su-cell.is-same { background: #c7e0ff; }
.su-cell.is-bad { color: #e74c3c; }
/* thick 3×3 box separators */
.su-cell[data-c="2"], .su-cell[data-c="5"] { box-shadow: inset 0 0 0 .5px #c7cbe6, inset -2px 0 0 0 #1b1d2b; }
.su-cell[data-r="2"], .su-cell[data-r="5"] { box-shadow: inset 0 0 0 .5px #c7cbe6, inset 0 -2px 0 0 #1b1d2b; }
.su-cell[data-c="2"][data-r="2"], .su-cell[data-c="2"][data-r="5"], .su-cell[data-c="5"][data-r="2"], .su-cell[data-c="5"][data-r="5"] {
  box-shadow: inset 0 0 0 .5px #c7cbe6, inset -2px 0 0 0 #1b1d2b, inset 0 -2px 0 0 #1b1d2b; }
.su-pad { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; max-width: 460px; margin: 0 auto 8px; }
.su-pad button { border: 0; border-radius: 10px; background: #eef0fb; color: var(--ink); font-size: 1.2rem;
  font-weight: 700; padding: 12px 0; cursor: pointer; }
.su-pad button:hover { background: #e3e6fb; }

/* Zip board (draw one path through all cells, in number order) */
.zip-board { position: relative; display: grid;
  grid-template-columns: repeat(var(--n, 6), 1fr); grid-template-rows: repeat(var(--n, 6), 1fr);
  aspect-ratio: 1 / 1; width: 100%; max-width: 460px; margin: 0 auto 12px;
  background: #fff; border: 2px solid #1b1d2b; border-radius: 10px; overflow: hidden; touch-action: none; }
.zip-cell { min-width: 0; min-height: 0; box-shadow: inset 0 0 0 .5px #dcdff0;
  display: flex; align-items: center; justify-content: center; position: relative; z-index: 2;
  user-select: none; -webkit-user-select: none; }
.zip-cell.visited { background: rgba(108, 92, 231, .14); }
.zip-badge { display: flex; width: 72%; height: 72%; border-radius: 50%; background: #1b1d2b; color: #fff;
  align-items: center; justify-content: center; font-weight: 800; font-size: clamp(13px, 4vw, 20px); z-index: 4; }
.zip-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }
.zip-path { fill: none; stroke: var(--accent); stroke-width: 7; stroke-linejoin: round; stroke-linecap: round; }

/* Games hub grid */
.games-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin: 18px auto; }
.game-tile { display: block; text-decoration: none; color: var(--ink); background: var(--panel);
  border-radius: 18px; padding: 22px; box-shadow: var(--shadow); transition: transform .08s ease, box-shadow .12s ease; }
.game-tile:hover { transform: translateY(-3px); box-shadow: 0 16px 38px rgba(0,0,0,.26); }
.game-tile h2 { margin: 6px 0 8px; }
.game-tile p { color: var(--ink-soft); margin: 0 0 14px; }
.game-tile__icon { font-size: 2.4rem; line-height: 1; }
.game-tile__cta { font-weight: 800; color: var(--accent); }
.game-tile--soon { opacity: .72; cursor: default; }
.game-tile--soon .game-tile__cta { color: var(--ink-soft); }

/* Content sections (SEO) */
.section { background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); border-radius: 16px; padding: 22px; margin: 18px auto; }
.section h2 { margin-top: 0; }
.section h3 { margin-bottom: 4px; }
.faq dt { font-weight: 700; margin-top: 14px; }
.faq dd { margin: 4px 0 0; color: #c2c7ee; }
.steps { padding-left: 20px; }
.steps li { margin: 8px 0; }

/* Footer */
.site-footer { text-align: center; padding: 30px 16px 50px; color: #9aa0cf; font-size: .85rem; }
.site-footer a { color: #c7ccff; }
.disclaimer { max-width: 680px; margin: 14px auto 0; font-size: .78rem; color: #7d83b3; }

@media (max-width: 480px) {
  .nav a { margin-left: 12px; font-size: .9rem; }
  .game-card { padding: 12px; border-radius: 16px; }
}
