:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #eef2ff;
  --text: #182033;
  --muted: #667085;
  --line: #d8deea;
  --line-strong: #111827;
  --primary: #1e5bd8;
  --primary-dark: #1747aa;
  --danger: #c2410c;
  --danger-bg: #fff3ed;
  --success: #047857;
  --success-bg: #ecfdf5;
  --note: #f59e0b;
  --shadow: 0 18px 50px rgba(20, 31, 56, 0.10);
  --radius: 22px;
  --cell-size: min(10vw, 54px);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top left, #e9efff 0, transparent 32rem), var(--bg);
  line-height: 1.6;
}

a {
  color: inherit;
}

.container {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(216, 222, 234, 0.75);
}

.header-inner {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(145deg, var(--primary), #0f2f72);
  box-shadow: 0 10px 24px rgba(30, 91, 216, 0.24);
}

.brand-text {
  font-size: 1.1rem;
}

.main-nav {
  display: flex;
  gap: 18px;
  font-size: 0.95rem;
  color: var(--muted);
}

.main-nav a {
  text-decoration: none;
}

.main-nav a:hover {
  color: var(--primary);
}

.hero {
  padding: 64px 0 34px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 28px;
  align-items: stretch;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--primary);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
}

h1, h2, h3 {
  line-height: 1.15;
  letter-spacing: -0.04em;
}

h1 {
  margin: 0;
  font-size: clamp(2.2rem, 5vw, 4.8rem);
}

.hero-text {
  max-width: 780px;
  margin: 18px 0 0;
  font-size: 1.16rem;
  color: var(--muted);
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 26px;
}

.hero-card,
.game-panel,
.rules-panel,
.content-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(216, 222, 234, 0.9);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

.hero-card {
  padding: 28px;
}

.hero-card strong {
  display: block;
  font-size: 1.1rem;
  margin-bottom: 12px;
}

.hero-card ul {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

.game-section {
  padding: 28px 0 44px;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(320px, 720px) minmax(260px, 1fr);
  gap: 28px;
  align-items: start;
}

.game-panel {
  padding: clamp(16px, 3vw, 28px);
}

.game-topbar {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 14px;
  align-items: center;
  margin-bottom: 20px;
}

.label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

select {
  min-height: 42px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 12px;
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
}

.timer-box,
.status-box {
  min-width: 112px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfcff;
}

.timer-box strong,
.status-box strong {
  display: block;
  font-size: 1rem;
}

.board-wrap {
  display: flex;
  justify-content: center;
}

.sudoku-board {
  display: grid;
  grid-template-columns: repeat(9, var(--cell-size));
  grid-template-rows: repeat(9, var(--cell-size));
  border: 3px solid var(--line-strong);
  background: var(--line-strong);
  touch-action: manipulation;
  user-select: none;
}

.cell {
  position: relative;
  width: var(--cell-size);
  height: var(--cell-size);
  border: 1px solid var(--line);
  background: #fff;
  display: grid;
  place-items: center;
  font-size: clamp(1.1rem, 4.8vw, 1.7rem);
  font-weight: 750;
  color: var(--primary);
  cursor: pointer;
}

.cell:nth-child(3n) {
  border-right: 3px solid var(--line-strong);
}

.cell:nth-child(9n) {
  border-right: 1px solid var(--line);
}

.cell:nth-child(n+19):nth-child(-n+27),
.cell:nth-child(n+46):nth-child(-n+54) {
  border-bottom: 3px solid var(--line-strong);
}

.cell.given {
  color: #101828;
  background: #f8fafc;
  cursor: default;
}

.cell.selected {
  background: #dbeafe;
  outline: 2px solid var(--primary);
  z-index: 2;
}

.cell.related {
  background: #eef4ff;
}

.cell.same-number:not(.selected) {
  background: #e0edff;
}

.cell.error {
  background: var(--danger-bg);
  color: var(--danger);
}

.cell.correct {
  background: var(--success-bg);
  color: var(--success);
}

.cell .notes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: 100%;
  height: 100%;
  padding: 3px;
  font-size: clamp(0.48rem, 1.8vw, 0.68rem);
  line-height: 1;
  color: #475467;
  font-weight: 700;
}

.cell .notes span {
  display: grid;
  place-items: center;
}

.number-pad {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 8px;
  margin: 18px 0 14px;
}

.number-pad button,
.controls button,
.btn {
  appearance: none;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 800;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.number-pad button {
  min-height: 46px;
  color: var(--primary);
  background: var(--surface-2);
  font-size: 1.1rem;
}

.number-pad button:hover,
.controls button:hover,
.btn:hover {
  transform: translateY(-1px);
}

.controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn,
.controls button {
  min-height: 44px;
  padding: 0 16px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.primary {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 10px 24px rgba(30, 91, 216, 0.22);
}

.primary:hover {
  background: var(--primary-dark);
}

.secondary {
  color: var(--primary);
  background: #eaf1ff;
}

.danger {
  color: var(--danger);
  background: var(--danger-bg);
}

.small-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.rules-panel {
  padding: 28px;
  position: sticky;
  top: 92px;
}

.rules-panel h2,
.rules-panel h3 {
  margin-top: 0;
}

.rules-panel p,
.rules-panel li {
  color: var(--muted);
}

.mini-tips {
  margin-top: 20px;
  padding: 18px;
  border-radius: 18px;
  background: #f8fafc;
  border: 1px solid var(--line);
}

.seo-content,
.faq-section {
  padding: 24px 0;
}

.content-card {
  padding: clamp(22px, 4vw, 36px);
}

.content-card h2 {
  margin-top: 0;
}

.content-card p {
  color: var(--muted);
}

details {
  padding: 18px 0;
  border-top: 1px solid var(--line);
}

details:last-child {
  border-bottom: 1px solid var(--line);
}

summary {
  cursor: pointer;
  font-weight: 800;
}

.site-footer {
  margin-top: 36px;
  padding: 30px 0;
  border-top: 1px solid var(--line);
  background: #fff;
}

.footer-grid {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  color: var(--muted);
}

.footer-grid p {
  margin: 6px 0 0;
}

.footer-grid nav {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-grid a {
  text-decoration: none;
}

.footer-grid a:hover {
  color: var(--primary);
}

.page-hero {
  padding: 56px 0 24px;
}

.article-page {
  padding: 18px 0 44px;
}

.article-page .content-card {
  max-width: 860px;
}

.article-page li {
  margin-bottom: 8px;
}

@media (max-width: 900px) {
  :root {
    --cell-size: min(10.2vw, 48px);
  }

  .header-inner {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 0;
    gap: 10px;
  }

  .main-nav {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .hero {
    padding-top: 38px;
  }

  .hero-grid,
  .game-layout {
    grid-template-columns: 1fr;
  }

  .rules-panel {
    position: static;
  }

  .game-topbar {
    grid-template-columns: 1fr 1fr;
  }

  .game-topbar > div:first-child {
    grid-column: 1 / -1;
  }

  .timer-box,
  .status-box,
  .mistakes-box {
    width: 100%;
  }

  .number-pad {
    grid-template-columns: repeat(9, 1fr);
    gap: 5px;
  }

  .number-pad button {
    min-height: 40px;
    border-radius: 10px;
  }

  .footer-grid {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .container {
    width: min(100% - 20px, 1120px);
  }

  .game-panel {
    border-radius: 18px;
    padding: 12px;
  }

  .controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .controls .primary {
    grid-column: 1 / -1;
  }

  .timer-box,
  .status-box {
    min-width: 0;
  }

  .brand-text {
    font-size: 1rem;
  }
}


.mistakes-box {
  min-width: 92px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfcff;
}

.mistakes-box strong {
  display: block;
  font-size: 1rem;
}

.mistakes-box.warning strong {
  color: var(--danger);
}

.cell.invalid-entry {
  background: var(--danger-bg);
  color: var(--danger);
  animation: shake-cell 0.24s ease-in-out;
}

.cell.conflict {
  background: #ffe7df;
  color: var(--danger);
  box-shadow: inset 0 0 0 2px rgba(194, 65, 12, 0.55);
}

.cell.paused {
  color: transparent;
}

.cell.paused::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--line);
}

.paused-board {
  filter: blur(3px);
  pointer-events: none;
}

.pause-message {
  margin: 14px auto 0;
  max-width: 520px;
  padding: 12px 16px;
  border-radius: 14px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  text-align: center;
  font-weight: 800;
}

.game-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.68);
  backdrop-filter: blur(10px);
}

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

.modal-card {
  width: min(460px, 100%);
  padding: 30px;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.28);
  text-align: center;
}

.modal-card h2 {
  margin: 0 0 10px;
  font-size: 2rem;
}

.modal-card p:not(.eyebrow) {
  color: var(--muted);
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 22px;
}

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


.internal-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.internal-links a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 999px;
  background: #eaf1ff;
  color: var(--primary);
  text-decoration: none;
  font-weight: 800;
  font-size: 0.92rem;
}

.inline-game-launch {
  margin: 20px 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f8fafc;
}

.print-grid-area {
  margin-top: 24px;
}

.print-controls,
.solver-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 18px 0;
}

.print-board,
.solver-board {
  display: grid;
  grid-template-columns: repeat(9, min(9.5vw, 48px));
  grid-template-rows: repeat(9, min(9.5vw, 48px));
  width: max-content;
  max-width: 100%;
  border: 3px solid var(--line-strong);
  background: var(--line-strong);
  margin: 20px 0;
}

.print-cell,
.solver-cell {
  width: min(9.5vw, 48px);
  height: min(9.5vw, 48px);
  border: 1px solid var(--line);
  background: #fff;
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  font-weight: 800;
  color: #101828;
}

.solver-cell {
  padding: 0;
  text-align: center;
  appearance: textfield;
  border-radius: 0;
}

.solver-cell::-webkit-outer-spin-button,
.solver-cell::-webkit-inner-spin-button {
  appearance: none;
  margin: 0;
}

.print-cell:nth-child(3n),
.solver-cell:nth-child(3n) {
  border-right: 3px solid var(--line-strong);
}

.print-cell:nth-child(9n),
.solver-cell:nth-child(9n) {
  border-right: 1px solid var(--line);
}

.print-cell:nth-child(n+19):nth-child(-n+27),
.print-cell:nth-child(n+46):nth-child(-n+54),
.solver-cell:nth-child(n+19):nth-child(-n+27),
.solver-cell:nth-child(n+46):nth-child(-n+54) {
  border-bottom: 3px solid var(--line-strong);
}

.solver-cell.locked {
  background: #f8fafc;
  color: var(--primary);
}

.solver-message {
  font-weight: 800;
  color: var(--muted);
}

@media print {
  .site-header,
  .site-footer,
  .print-controls,
  .hero-actions,
  .main-nav,
  .btn,
  .internal-links,
  .page-hero p,
  .content-card > p,
  .content-card > h2:not(.print-title),
  .content-card > ul,
  .content-card > ol {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .content-card,
  .article-page .content-card {
    box-shadow: none;
    border: 0;
    padding: 0;
  }

  .print-board {
    grid-template-columns: repeat(9, 58px);
    grid-template-rows: repeat(9, 58px);
  }

  .print-cell {
    width: 58px;
    height: 58px;
    font-size: 1.5rem;
  }
}


.number-pad button.number-complete {
  color: #667085;
  background: #e5e7eb;
  box-shadow: inset 0 0 0 1px rgba(102, 112, 133, 0.18);
  cursor: not-allowed;
  opacity: 0.72;
}

.number-pad button.number-complete::after {
  content: "✓";
  display: inline-block;
  margin-left: 4px;
  font-size: 0.78rem;
  font-weight: 900;
}

.number-pad button.number-complete:hover {
  transform: none;
}


.feature-strip {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.feature-strip span {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(216, 222, 234, 0.95);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}


/* Game completion — independent modal.
   Does not change the board structure or size. */

.completion-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.62);
  backdrop-filter: blur(10px);
}

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

.completion-card {
  width: min(440px, 100%);
  padding: 30px;
  border-radius: 24px;
  background: #fff;
  border: 1px solid rgba(216, 222, 234, 0.98);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.28);
  text-align: center;
  animation: completion-pop 0.22s ease-out;
}

.completion-badge {
  width: 62px;
  height: 62px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  background: var(--success);
  font-size: 1.9rem;
  font-weight: 900;
  box-shadow: 0 12px 26px rgba(4, 120, 87, 0.24);
}

.completion-card h2 {
  margin: 0 0 8px;
  font-size: clamp(1.9rem, 5vw, 2.5rem);
}

.completion-card p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
}

.completion-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 20px 0 22px;
}

.completion-stats div {
  padding: 13px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #f8fafc;
}

.completion-stats span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.completion-stats strong {
  display: block;
  margin-top: 3px;
  font-size: 1.08rem;
}

@keyframes completion-pop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 520px) {
  .completion-card {
    padding: 24px 20px;
  }
}


/* Publishing support — contact, privacy, about, cookies and footer */

.copyright {
  margin-top: 8px;
  font-size: 0.92rem;
}

.copyright a,
.legal-content a,
.contact-note a,
.about-card-sudoku a,
.cookie-notice a {
  color: var(--primary);
  font-weight: 800;
}

.contact-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
  gap: 24px;
  align-items: start;
}

.contact-form {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.contact-form label {
  display: grid;
  gap: 7px;
  color: var(--text);
  font-weight: 800;
}

.contact-form input,
.contact-form select,
.contact-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 600;
}

.contact-form textarea {
  resize: vertical;
  min-height: 150px;
}

.contact-note {
  padding: 20px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: #f8fafc;
}

.legal-content h2 {
  margin-top: 30px;
}

.legal-content h2:first-child {
  margin-top: 0;
}

.legal-disclaimer {
  margin-top: 28px;
  padding: 16px;
  border-radius: 18px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
}

.about-grid-sudoku {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(300px, 0.88fr);
  gap: 24px;
  align-items: start;
}

.about-card-sudoku h2 {
  margin-top: 0;
}

.values-list-sudoku {
  display: grid;
  gap: 12px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.values-list-sudoku li {
  padding: 14px 16px;
  border-radius: 16px;
  background: #eef4ff;
  border: 1px solid var(--line);
  color: var(--muted);
}

.about-avatar {
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  border-radius: 26px;
  color: #fff;
  background: linear-gradient(145deg, var(--primary), #0f2f72);
  font-weight: 900;
  font-size: 1.4rem;
  box-shadow: 0 12px 28px rgba(30, 91, 216, 0.24);
}

.cookie-notice {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(980px, calc(100% - 32px));
  margin: 0 auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 50px rgba(20, 31, 56, 0.18);
  backdrop-filter: blur(12px);
}

.cookie-notice.is-visible {
  display: flex;
}

.cookie-notice p {
  margin: 0;
  color: var(--muted);
  font-weight: 650;
  line-height: 1.45;
}

.cookie-actions {
  display: flex;
  gap: 10px;
  flex: 0 0 auto;
  flex-wrap: wrap;
}

.cookie-btn {
  min-height: 42px;
  padding: 0 14px;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  color: #fff;
  background: var(--primary);
}

.cookie-btn.secondary {
  color: var(--primary);
  background: #eaf1ff;
}

@media (max-width: 900px) {
  .contact-layout,
  .about-grid-sudoku {
    grid-template-columns: 1fr;
  }

  .cookie-notice {
    align-items: flex-start;
    flex-direction: column;
  }

  .cookie-actions {
    width: 100%;
  }

  .cookie-btn {
    flex: 1 1 auto;
  }
}


/* Page adjustments About */

.external-games-btn {
  color: var(--primary) !important;
  background: #eaf1ff !important;
}

.external-games-btn:hover {
  color: var(--primary-dark) !important;
}

.creator-card-sudoku {
  grid-column: 1 / -1;
}

.creator-avatar-sudoku {
  width: 98px;
  height: 98px;
  border-radius: 28px;
  margin-bottom: 18px;
  background:
    radial-gradient(circle at 35% 34%, #fff 0 9px, transparent 10px),
    radial-gradient(circle at 65% 34%, #fff 0 9px, transparent 10px),
    linear-gradient(135deg, var(--primary) 0 50%, #6d5dfc 51% 100%);
  box-shadow: 0 12px 28px rgba(30, 91, 216, 0.24);
  position: relative;
}

.creator-avatar-sudoku::before,
.creator-avatar-sudoku::after {
  content: "";
  position: absolute;
  top: 34px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #101828;
}

.creator-avatar-sudoku::before {
  left: 31px;
}

.creator-avatar-sudoku::after {
  right: 31px;
}

.creator-avatar-sudoku {
  border: 1px solid rgba(216, 222, 234, 0.9);
}


/* Page About — revised layout */

.about-grid-sudoku-balanced {
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
}

.about-side-stack {
  display: grid;
  gap: 24px;
}

.about-main-card p {
  font-size: 1.01rem;
}

.about-main-card h2:not(:first-child) {
  margin-top: 30px;
}

.about-side-stack .creator-card-sudoku {
  grid-column: auto;
}

@media (max-width: 900px) {
  .about-grid-sudoku-balanced {
    grid-template-columns: 1fr;
  }
}


/* Light standardization with the CleverJoy Games identity.
   Keeps the Sudoku area clean and applies visual connection only to institutional elements. */

:root {
  --cj-ink: #20124d;
  --cj-sun: #ffd74a;
  --cj-pink: #ff5d8f;
  --cj-green: #4cc986;
  --cj-mint: #c6f7df;
  --cj-paper: #fffdf6;
}

.brand-mark {
  background:
    radial-gradient(circle at 28% 28%, #ffffff 0 5px, transparent 6px),
    linear-gradient(135deg, var(--cj-sun) 0 48%, var(--cj-pink) 49% 100%);
  color: var(--cj-ink);
  border: 2px solid var(--cj-ink);
  box-shadow: 0 7px 0 rgba(32, 18, 77, 0.18);
}

.eyebrow {
  background: linear-gradient(90deg, var(--cj-mint), #eaf1ff);
  border: 1px solid rgba(32, 18, 77, 0.12);
  color: var(--cj-ink);
}

.btn.secondary {
  background: var(--cj-paper);
  color: var(--primary);
  border: 1px solid rgba(32, 18, 77, 0.10);
}

.cj-brand-note {
  margin: 18px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.cj-brand-note a {
  color: var(--primary);
  font-weight: 900;
  text-decoration: none;
}

.cj-brand-note a:hover {
  text-decoration: underline;
}

.site-footer {
  background:
    radial-gradient(circle at 8% 20%, rgba(255, 215, 74, 0.36) 0 70px, transparent 72px),
    radial-gradient(circle at 92% 28%, rgba(255, 93, 143, 0.16) 0 90px, transparent 94px),
    linear-gradient(135deg, #fffdf6 0%, #f8fbff 58%, #f3f0ff 100%);
}

.site-footer strong {
  color: var(--cj-ink);
}

.site-footer .copyright {
  color: var(--muted);
}

.site-footer .copyright a {
  color: var(--primary);
  font-weight: 900;
  text-decoration: none;
}

.site-footer .copyright a:hover {
  text-decoration: underline;
}

.cj-family-card {
  background:
    radial-gradient(circle at 88% 18%, rgba(255, 215, 74, 0.35) 0 52px, transparent 54px),
    radial-gradient(circle at 12% 88%, rgba(76, 201, 134, 0.20) 0 68px, transparent 70px),
    #fffdf6;
  border: 1px solid rgba(32, 18, 77, 0.12);
}

.cj-mini-logo {
  width: 54px;
  height: 54px;
  display: inline-block;
  margin-bottom: 16px;
  border-radius: 18px;
  border: 2px solid var(--cj-ink);
  background:
    radial-gradient(circle at 28% 28%, #ffffff 0 6px, transparent 7px),
    linear-gradient(135deg, var(--cj-sun) 0 48%, var(--cj-pink) 49% 100%);
  box-shadow: 0 7px 0 rgba(32, 18, 77, 0.16);
  position: relative;
}

.cj-mini-logo::before {
  content: "";
  position: absolute;
  width: 15px;
  height: 15px;
  left: 9px;
  bottom: 8px;
  border: 2px solid var(--cj-ink);
  border-radius: 6px;
  background: #3a86ff;
}

.cj-mini-logo::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  right: 8px;
  bottom: 8px;
  border: 2px solid var(--cj-ink);
  border-radius: 50%;
  background: var(--cj-green);
}

/* Keeps the Sudoku grid free from brand visual interference. */
.sudoku-board,
.cell,
.number-pad button {
  font-family: inherit;
}


/* CleverJoy standardization adjustment:
   removes green label strips and eliminates redundant visual elements. */

.eyebrow {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  color: var(--primary) !important;
  padding: 0 !important;
  border-radius: 0 !important;
}

.cj-family-card,
.cj-mini-logo {
  display: none !important;
}


/* Mobile-first layout for the game area.
   Keeps the desktop layout and turns Sudoku into a more app-like experience on small screens. */

@media (max-width: 760px) {
  html {
    scroll-padding-top: 10px;
  }

  .hero {
    padding: 28px 0 14px;
  }

  .hero-copy h1 {
    font-size: clamp(2.05rem, 10vw, 3.05rem);
    line-height: 1.02;
  }

  .hero-text {
    font-size: 1rem;
    margin-top: 12px;
  }

  .hero-actions {
    margin-top: 18px;
  }

  .cj-brand-note {
    font-size: 0.9rem;
  }

  .game-section {
    padding-top: 12px;
  }

  .game-layout {
    gap: 18px;
  }

  .mobile-app-game {
    padding: 10px;
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(20, 31, 56, 0.10);
  }

  .game-topbar {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 7px;
    margin-bottom: 10px;
  }

  .game-topbar > div:first-child {
    grid-column: 1 / -1;
  }

  .game-topbar select {
    min-height: 38px;
    border-radius: 11px;
    font-size: 0.95rem;
  }

  .timer-box,
  .status-box,
  .mistakes-box {
    min-width: 0;
    width: 100%;
    padding: 8px 7px;
    border-radius: 12px;
    text-align: center;
  }

  .label {
    margin-bottom: 2px;
    font-size: 0.62rem;
    letter-spacing: 0.06em;
  }

  .timer-box strong,
  .status-box strong,
  .mistakes-box strong {
    font-size: 0.88rem;
    line-height: 1.15;
  }

  .status-box strong {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .board-wrap {
    width: 100%;
    overflow: visible;
  }

  .sudoku-board {
    --mobile-cell: calc((100vw - 32px) / 9);
    grid-template-columns: repeat(9, var(--mobile-cell));
    grid-template-rows: repeat(9, var(--mobile-cell));
    width: calc(var(--mobile-cell) * 9);
    height: calc(var(--mobile-cell) * 9);
    max-width: 100%;
    max-height: calc(100vw - 32px);
    margin: 0 auto;
    border-width: 3px;
  }

  .cell {
    width: var(--mobile-cell);
    height: var(--mobile-cell);
    font-size: clamp(1rem, 6vw, 1.45rem);
    border-color: #cfd7e6;
    -webkit-tap-highlight-color: transparent;
  }

  .cell .notes {
    padding: 2px;
    font-size: clamp(0.42rem, 2.1vw, 0.58rem);
  }

  .number-pad {
    position: sticky;
    bottom: 0;
    z-index: 8;
    grid-template-columns: repeat(9, 1fr);
    gap: 5px;
    margin: 12px -4px 8px;
    padding: 7px 4px calc(7px + env(safe-area-inset-bottom));
    border-radius: 16px 16px 0 0;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(12px);
    box-shadow: 0 -10px 28px rgba(20, 31, 56, 0.08);
  }

  .number-pad button {
    min-height: 44px;
    border-radius: 11px;
    font-size: 1.08rem;
    touch-action: manipulation;
  }

  .controls {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 7px;
    margin-top: 8px;
  }

  .controls button,
  .controls .btn {
    min-height: 42px;
    padding: 0 8px;
    border-radius: 12px;
    font-size: 0.86rem;
    white-space: nowrap;
    touch-action: manipulation;
  }

  #newGameBtn {
    grid-column: span 3;
  }

  #pauseBtn,
  #undoBtn,
  #checkBtn,
  #hintBtn,
  #notesBtn,
  #eraseBtn {
    min-width: 0;
  }

  .small-note {
    margin-top: 10px;
    font-size: 0.82rem;
    text-align: center;
  }

  .rules-panel {
    padding: 18px;
    border-radius: 18px;
  }

  .rules-panel h2 {
    font-size: 1.35rem;
  }

  .rules-panel p,
  .rules-panel li {
    font-size: 0.95rem;
  }

  .mini-tips {
    padding: 14px;
    border-radius: 16px;
  }

  .cookie-notice {
    left: 10px;
    right: 10px;
    bottom: 10px;
    width: calc(100% - 20px);
    padding: 12px;
    border-radius: 16px;
    gap: 10px;
  }

  .cookie-notice p {
    font-size: 0.86rem;
  }

  .cookie-btn {
    min-height: 38px;
    font-size: 0.88rem;
  }

  .game-overlay,
  .completion-overlay {
    padding: 14px;
  }

  .modal-card,
  .completion-card {
    padding: 24px 18px;
    border-radius: 22px;
  }

  .modal-actions {
    gap: 8px;
  }

  .modal-actions .btn,
  .completion-card .btn {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .container {
    width: min(100% - 14px, 1120px);
  }

  .site-header {
    position: static;
  }

  .header-inner {
    min-height: auto;
    padding: 12px 0;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    font-size: 0.82rem;
  }

  .brand-text {
    font-size: 0.98rem;
  }

  .main-nav {
    gap: 8px;
    font-size: 0.86rem;
  }

  .main-nav a {
    flex: 0 0 auto;
  }

  .mobile-app-game {
    padding: 8px;
  }

  .sudoku-board {
    --mobile-cell: calc((100vw - 20px) / 9);
    max-height: calc(100vw - 20px);
  }

  .number-pad {
    gap: 4px;
    margin-left: -2px;
    margin-right: -2px;
  }

  .number-pad button {
    min-height: 40px;
    font-size: 1rem;
  }

  .controls {
    grid-template-columns: repeat(2, 1fr);
  }

  #newGameBtn {
    grid-column: span 2;
  }

  .controls button,
  .controls .btn {
    font-size: 0.84rem;
  }

  .small-note {
    display: none;
  }
}

@media (max-width: 360px) {
  .timer-box strong,
  .status-box strong,
  .mistakes-box strong {
    font-size: 0.78rem;
  }

  .controls button,
  .controls .btn {
    min-height: 40px;
    font-size: 0.78rem;
  }

  .number-pad button {
    min-height: 38px;
  }
}


/* Mobile app shell — brings the mobile experience closer to a Sudoku app.
   Desktop permanece inalterado. */

.mobile-menu-toggle {
  display: none;
}

@media (max-width: 760px) {
  body {
    background: #f6f7fb;
  }

  .site-header {
    position: sticky !important;
    top: 0;
    z-index: 80;
    background: rgba(255, 255, 255, 0.96);
  }

  .header-inner {
    position: relative;
    min-height: 56px !important;
    padding: 8px 0 !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px !important;
  }

  .brand {
    min-width: 0;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    font-size: 0.8rem;
  }

  .brand-text {
    font-size: 1rem;
    white-space: nowrap;
  }

  .mobile-menu-toggle {
    display: inline-grid;
    place-items: center;
    gap: 4px;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(20, 31, 56, 0.08);
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-menu-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: var(--text);
    transition: transform 0.16s ease, opacity 0.16s ease;
  }

  .mobile-menu-toggle.is-open span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
  }

  .mobile-menu-toggle.is-open span:nth-child(2) {
    opacity: 0;
  }

  .mobile-menu-toggle.is-open span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
  }

  .main-nav {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 90;
    display: none;
    max-height: min(72vh, 460px);
    overflow-y: auto;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 22px 60px rgba(20, 31, 56, 0.18);
    backdrop-filter: blur(14px);
  }

  .main-nav.is-open {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .main-nav a {
    display: flex;
    align-items: center;
    min-height: 42px;
    padding: 0 12px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text);
    font-weight: 800;
  }

  .main-nav a:hover,
  .main-nav a:focus {
    background: #eaf1ff;
    color: var(--primary);
  }

  /* On mobile, the homepage opens directly as a game/app. */
  .hero {
    display: none !important;
  }

  .game-section {
    padding: 8px 0 18px !important;
  }

  .mobile-app-game {
    margin-top: 0;
  }

  .game-topbar {
    margin-bottom: 8px;
  }

  .board-wrap {
    margin-top: 0;
  }

  .sudoku-board {
    --mobile-cell: calc((100vw - 20px) / 9);
    width: calc(var(--mobile-cell) * 9);
    height: calc(var(--mobile-cell) * 9);
    max-width: calc(100vw - 20px);
    max-height: calc(100vw - 20px);
  }

  .cell {
    width: var(--mobile-cell);
    height: var(--mobile-cell);
  }

  /* The number pad is not sticky to avoid covering the grid. */
  .number-pad {
    position: static !important;
    z-index: auto;
    margin: 10px 0 8px;
    padding: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
  }

  .number-pad button {
    min-height: 42px;
  }

  .controls {
    margin-bottom: 0;
  }

  .rules-panel {
    display: none;
  }

  .seo-content,
  .faq-section {
    padding-top: 18px;
  }
}

@media (max-width: 420px) {
  .site-header {
    position: sticky !important;
    top: 0;
  }

  .container {
    width: min(100% - 12px, 1120px);
  }

  .mobile-app-game {
    padding: 7px;
  }

  .sudoku-board {
    --mobile-cell: calc((100vw - 18px) / 9);
    max-width: calc(100vw - 18px);
    max-height: calc(100vw - 18px);
  }

  .game-topbar {
    gap: 6px;
  }

  .timer-box,
  .status-box,
  .mistakes-box {
    padding: 7px 5px;
  }

  .number-pad {
    gap: 4px;
  }

  .number-pad button {
    min-height: 39px;
  }
}


/* Version 22 — mobile-only fixes:
   1) the grid always shows the thick bottom and right borders;
   2) menu mobile oculta Easy, Medium, Hard e Print.
   Desktop preserved. */

@media (max-width: 760px) {
  .sudoku-board {
    width: min(calc(100vw - 20px), 520px) !important;
    height: auto !important;
    aspect-ratio: 1 / 1;
    grid-template-columns: repeat(9, 1fr) !important;
    grid-template-rows: repeat(9, 1fr) !important;
    border: 3px solid var(--line-strong) !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }

  .cell {
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    box-sizing: border-box !important;
  }

  .main-nav a[href="easy-sudoku.html"],
  .main-nav a[href="medium-sudoku.html"],
  .main-nav a[href="hard-sudoku.html"],
  .main-nav a[href="printable-sudoku.html"] {
    display: none !important;
  }
}

@media (max-width: 420px) {
  .sudoku-board {
    width: min(calc(100vw - 18px), 520px) !important;
  }
}


/* Version 23 — solver fixes on mobile */

.solver-cell.selected {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
  background: #dbeafe;
  z-index: 2;
}

.solver-number-pad {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0 10px;
}

.solver-number-pad button {
  min-height: 44px;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  color: var(--primary);
  background: #eaf1ff;
  font: inherit;
  font-weight: 900;
  touch-action: manipulation;
}

.solver-number-pad button[data-solver-action="erase"] {
  grid-column: span 1;
  color: var(--danger);
  background: var(--danger-bg);
  font-size: 0.86rem;
}

@media (max-width: 760px) {
  .solver-board {
    width: min(calc(100vw - 64px), 520px) !important;
    height: auto !important;
    aspect-ratio: 1 / 1;
    grid-template-columns: repeat(9, 1fr) !important;
    grid-template-rows: repeat(9, 1fr) !important;
    border: 3px solid var(--line-strong) !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    margin-left: auto;
    margin-right: auto;
  }

  .solver-cell {
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    box-sizing: border-box !important;
    font-size: clamp(1rem, 6vw, 1.45rem);
    -webkit-tap-highlight-color: transparent;
  }

  .solver-number-pad {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
  }

  .solver-number-pad button {
    min-height: 42px;
    border-radius: 12px;
  }
}

@media (max-width: 420px) {
  .solver-board {
    width: min(calc(100vw - 54px), 520px) !important;
  }

  .solver-number-pad {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 5px;
  }

  .solver-number-pad button {
    min-height: 39px;
    font-size: 0.95rem;
  }

  .solver-number-pad button[data-solver-action="erase"] {
    font-size: 0.78rem;
  }
}


/* Version 24 — solucionador mais compacto apenas no mobile.
   Desktop preserved. */

.solver-copy-mobile {
  display: none;
}

@media (max-width: 760px) {
  .solver-page .page-hero {
    display: none !important;
  }

  .solver-page .article-page {
    padding-top: 8px !important;
  }

  .solver-page .content-card {
    padding: 12px !important;
    border-radius: 18px;
  }

  .solver-copy-desktop {
    display: none !important;
  }

  .solver-copy-mobile {
    display: block;
    margin: 0 0 10px !important;
    font-size: 0.96rem;
    line-height: 1.42;
  }

  .solver-controls {
    margin: 8px 0 10px !important;
    gap: 8px;
  }

  .solver-controls .btn {
    min-height: 40px;
    padding: 0 14px;
    border-radius: 13px;
    font-size: 0.9rem;
  }

  .solver-board {
    margin-top: 10px !important;
    margin-bottom: 10px !important;
    width: min(calc(100vw - 34px), 520px) !important;
  }

  .solver-number-pad {
    margin: 10px 0 8px !important;
  }

  .solver-message {
    margin: 6px 0 0 !important;
    font-size: 0.86rem;
  }

  .solver-page .content-card > h2,
  .solver-page .content-card > ol,
  .solver-page .content-card > p:not(.solver-copy-mobile):not(.solver-message) {
    margin-top: 12px;
  }
}

@media (max-width: 420px) {
  .solver-page .content-card {
    padding: 10px !important;
  }

  .solver-board {
    width: min(calc(100vw - 30px), 520px) !important;
  }

  .solver-copy-mobile {
    font-size: 0.92rem;
  }

  .solver-controls .btn {
    min-height: 38px;
    font-size: 0.86rem;
  }
}


/* Version 25 — cookie notice only on desktop.
   On mobile, the notice is hidden so it does not cover the game area. */

@media (max-width: 760px) {
  .cookie-notice,
  .cookie-notice.is-visible {
    display: none !important;
  }
}


/* Version 27 — kids mode fixed.
   Inserted into the correct game section to work on mobile. */

.game-mode-switch {
  display: inline-flex;
  gap: 8px;
  margin: 0 0 18px;
  padding: 6px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 30px rgba(20, 31, 56, 0.08);
}

.mode-btn {
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 13px;
  cursor: pointer;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 900;
}

.mode-btn.is-active {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 8px 18px rgba(30, 91, 216, 0.20);
}

.kids-game-layout {
  display: grid;
  grid-template-columns: minmax(320px, 720px) minmax(260px, 1fr);
  gap: 28px;
  align-items: start;
}

.kids-game-layout[hidden] {
  display: none !important;
}

.kids-panel {
  padding: clamp(16px, 3vw, 28px);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(216, 222, 234, 0.9);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

.kids-topbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
}

.kids-topbar select {
  min-height: 42px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 12px;
  background: var(--surface);
  color: var(--text);
  font-weight: 800;
}

.kids-intro {
  margin: 0 0 16px;
  color: var(--muted);
  font-weight: 650;
}

.kids-board-wrap {
  display: flex;
  justify-content: center;
}

.kids-board {
  display: grid;
  border: 3px solid var(--line-strong);
  background: var(--line-strong);
  touch-action: manipulation;
  user-select: none;
  overflow: hidden;
  box-sizing: border-box;
}

.kids-board.kids-size-4 {
  width: min(72vw, 420px);
  height: auto;
  aspect-ratio: 1 / 1;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
}

.kids-board.kids-size-6 {
  width: min(78vw, 480px);
  height: auto;
  aspect-ratio: 1 / 1;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(6, 1fr);
}

.kids-cell {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--line);
  background: #fff;
  font-size: clamp(1.55rem, 8vw, 2.3rem);
  cursor: pointer;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

.kids-size-6 .kids-cell {
  font-size: clamp(1.2rem, 6vw, 1.9rem);
}

.kids-cell.given {
  background: #f8fafc;
  cursor: default;
}

.kids-cell.selected {
  background: #dbeafe;
  outline: 2px solid var(--primary);
  outline-offset: -2px;
  z-index: 2;
}

.kids-cell.correct {
  background: var(--success-bg);
}

.kids-cell.wrong {
  background: var(--danger-bg);
  animation: shake-cell 0.24s ease-in-out;
}

.kids-cell.block-right {
  border-right: 3px solid var(--line-strong);
}

.kids-cell.block-bottom {
  border-bottom: 3px solid var(--line-strong);
}

.kids-pad {
  display: grid;
  gap: 8px;
  margin: 18px 0 14px;
}

.kids-pad.kids-pad-4 {
  grid-template-columns: repeat(4, 1fr);
}

.kids-pad.kids-pad-6 {
  grid-template-columns: repeat(6, 1fr);
}

.kids-pad button {
  min-height: 52px;
  border: 0;
  border-radius: 16px;
  cursor: pointer;
  background: #eaf1ff;
  font-size: 1.7rem;
  box-shadow: 0 8px 20px rgba(20, 31, 56, 0.08);
  touch-action: manipulation;
}

.kids-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.kids-rules-panel {
  position: sticky;
  top: 92px;
}

@media (max-width: 900px) {
  .kids-game-layout {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .kids-rules-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  .game-mode-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    margin: 0 0 8px;
  }

  .mode-btn {
    min-height: 40px;
  }

  .kids-panel {
    padding: 10px;
    border-radius: 18px;
  }

  .kids-topbar {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 8px;
  }

  .kids-intro {
    display: none;
  }

  .kids-board.kids-size-4,
  .kids-board.kids-size-6 {
    width: min(calc(100vw - 20px), 520px);
    height: auto;
    aspect-ratio: 1 / 1;
  }

  .kids-pad {
    gap: 5px;
    margin: 10px 0 8px;
  }

  .kids-pad button {
    min-height: 46px;
    border-radius: 12px;
    font-size: 1.45rem;
  }

  .kids-pad.kids-pad-6 {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .kids-controls {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 7px;
  }

  .kids-controls .btn {
    min-height: 42px;
    padding: 0 8px;
    border-radius: 12px;
    font-size: 0.86rem;
    white-space: nowrap;
  }

  .kids-note,
  .kids-rules-panel {
    display: none;
  }
}

@media (max-width: 420px) {
  .kids-panel {
    padding: 8px;
  }

  .kids-board.kids-size-4,
  .kids-board.kids-size-6 {
    width: min(calc(100vw - 18px), 520px);
  }

  .kids-pad button {
    min-height: 40px;
    font-size: 1.25rem;
  }

  .kids-controls .btn {
    min-height: 40px;
    font-size: 0.82rem;
  }
}


/* Version 28 — robust mode switch fix Adult/Kids.
   Garante funcionamento no mobile mesmo quando hidden/display entram em conflito. */

body.mode-kids #adultGame {
  display: none !important;
}

body.mode-kids #kidsGame {
  display: grid !important;
}

body.mode-adult #adultGame {
  display: grid !important;
}

body.mode-adult #kidsGame {
  display: none !important;
}

@media (max-width: 760px) {
  body.mode-kids #kidsGame {
    display: grid !important;
    grid-template-columns: 1fr !important;
  }

  body.mode-adult #adultGame {
    display: grid !important;
    grid-template-columns: 1fr !important;
  }
}


/* Version 29 — Adult/Kids buttons beside level on mobile.
   Desktop preserved. */

.mobile-mode-switch {
  display: none;
}

@media (max-width: 760px) {
  .game-section > .container > .game-mode-switch {
    display: none !important;
  }

  .mobile-mode-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    align-self: end;
    min-width: 142px;
    padding: 4px;
    border-radius: 13px;
    background: #eef4ff;
    border: 1px solid rgba(216, 222, 234, 0.95);
  }

  .mobile-mode-btn {
    min-height: 36px;
    padding: 0 8px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 900;
    white-space: nowrap;
    touch-action: manipulation;
  }

  .mobile-mode-btn.is-active {
    color: #fff;
    background: var(--primary);
    box-shadow: 0 6px 14px rgba(30, 91, 216, 0.18);
  }

  .game-topbar {
    grid-template-columns: minmax(0, 1fr) auto !important;
    gap: 7px !important;
    align-items: end;
  }

  .game-topbar > .level-control {
    grid-column: 1;
  }

  .game-topbar > .mobile-mode-switch {
    grid-column: 2;
  }

  .game-topbar > .timer-box {
    grid-column: 1;
  }

  .game-topbar > .status-box {
    grid-column: 2;
  }

  .game-topbar > .mistakes-box {
    grid-column: 1 / -1;
  }

  .kids-topbar {
    grid-template-columns: minmax(0, 1fr) auto !important;
    gap: 7px !important;
    align-items: end;
    margin-bottom: 8px;
  }

  .kids-topbar > .level-control {
    grid-column: 1;
  }

  .kids-topbar > .mobile-mode-switch {
    grid-column: 2;
  }

  .kids-topbar > .kids-status-box {
    grid-column: 1 / -1;
  }

  .level-control select,
  .kids-topbar select {
    min-height: 38px;
  }

  .kids-status-box {
    text-align: center;
    padding: 7px 5px;
  }
}

@media (max-width: 390px) {
  .mobile-mode-switch {
    min-width: 128px;
  }

  .mobile-mode-btn {
    min-height: 34px;
    padding: 0 6px;
    font-size: 0.72rem;
  }

  .level-control select,
  .kids-topbar select {
    font-size: 0.88rem;
    padding: 0 8px;
  }
}


/* Version 30 — level selector beside Adult/Kids buttons on mobile.
   Fixes the previous rule that made the first topbar item occupy the whole row.
   Desktop preserved. */

@media (max-width: 760px) {
  .game-topbar {
    grid-template-columns: minmax(0, 1fr) minmax(136px, auto) !important;
    align-items: end !important;
  }

  .game-topbar > div:first-child {
    grid-column: 1 !important;
  }

  .game-topbar > .level-control {
    grid-column: 1 !important;
    min-width: 0 !important;
  }

  .game-topbar > .level-control select {
    width: 100% !important;
    min-width: 0 !important;
  }

  .game-topbar > .mobile-mode-switch {
    grid-column: 2 !important;
    width: 136px !important;
    min-width: 136px !important;
  }

  .game-topbar > .timer-box {
    grid-column: 1 !important;
  }

  .game-topbar > .status-box {
    grid-column: 2 !important;
  }

  .game-topbar > .mistakes-box {
    grid-column: 1 / -1 !important;
  }

  .kids-topbar {
    grid-template-columns: minmax(0, 1fr) minmax(136px, auto) !important;
    align-items: end !important;
  }

  .kids-topbar > div:first-child {
    grid-column: 1 !important;
  }

  .kids-topbar > .level-control {
    grid-column: 1 !important;
    min-width: 0 !important;
  }

  .kids-topbar > .level-control select {
    width: 100% !important;
    min-width: 0 !important;
  }

  .kids-topbar > .mobile-mode-switch {
    grid-column: 2 !important;
    width: 136px !important;
    min-width: 136px !important;
  }
}

@media (max-width: 390px) {
  .game-topbar,
  .kids-topbar {
    grid-template-columns: minmax(0, 1fr) minmax(124px, auto) !important;
  }

  .game-topbar > .mobile-mode-switch,
  .kids-topbar > .mobile-mode-switch {
    width: 124px !important;
    min-width: 124px !important;
  }
}


/* Version 31 — mobile topbar in two rows:
   Line 1: Level spans 2 columns; Adult/Kids spans 1 column.
   Line 2: Time, Status and Mistakes stay in the same row.
   Desktop preserved. */

@media (max-width: 760px) {
  .game-topbar {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 7px !important;
    align-items: end !important;
  }

  .game-topbar > div:first-child {
    grid-column: 1 / span 2 !important;
  }

  .game-topbar > .level-control {
    grid-column: 1 / span 2 !important;
    min-width: 0 !important;
  }

  .game-topbar > .level-control select {
    width: 100% !important;
    min-width: 0 !important;
  }

  .game-topbar > .mobile-mode-switch {
    grid-column: 3 !important;
    width: 100% !important;
    min-width: 0 !important;
    align-self: end !important;
  }

  .mobile-mode-switch {
    grid-template-columns: 1fr 1fr !important;
    gap: 3px !important;
    padding: 4px !important;
  }

  .mobile-mode-btn {
    min-height: 36px !important;
    padding: 0 4px !important;
    font-size: 0.70rem !important;
    letter-spacing: -0.02em;
  }

  .game-topbar > .timer-box {
    grid-column: 1 !important;
  }

  .game-topbar > .status-box {
    grid-column: 2 !important;
  }

  .game-topbar > .mistakes-box {
    grid-column: 3 !important;
  }

  .timer-box,
  .status-box,
  .mistakes-box {
    min-width: 0 !important;
    width: 100% !important;
    padding: 8px 5px !important;
  }

  .timer-box strong,
  .status-box strong,
  .mistakes-box strong {
    font-size: 0.82rem !important;
  }

  .status-box strong {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media (max-width: 390px) {
  .mobile-mode-btn {
    min-height: 34px !important;
    padding: 0 3px !important;
    font-size: 0.66rem !important;
  }

  .timer-box strong,
  .status-box strong,
  .mistakes-box strong {
    font-size: 0.78rem !important;
  }
}
