:root {
  --ink: #172033;
  --muted: #5f6b7c;
  --line: #dfe7f2;
  --purple: #6757f5;
  --purple-dark: #4b3ee3;
  --blue: #4078ff;
  --soft-blue: #deecff;
  --soft-yellow: #fff1cb;
  --soft-green: #e4f9ee;
  --soft-pink: #ffe1ee;
  --soft-purple: #eee8ff;
  --shadow: 0 18px 45px rgba(34, 50, 84, 0.11);
  --shadow-soft: 0 10px 25px rgba(34, 50, 84, 0.08);
  --radius-xl: 30px;
  --radius-lg: 24px;
  --radius-md: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 10%, rgba(255, 191, 77, 0.22), transparent 28%),
    radial-gradient(circle at 88% 14%, rgba(103, 87, 245, 0.14), transparent 30%),
    linear-gradient(180deg, #fbfdff 0%, #f4f8ff 45%, #fff9f1 100%);
  min-height: 100vh;
  line-height: 1.55;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
.container { width: min(1120px, calc(100% - 44px)); margin: 0 auto; }
.hidden { display: none !important; }

/* Header: same feel as Puzzle Games page */
.puzzle-site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(223, 231, 242, 0.9);
}
.puzzle-header-inner {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.brand { display: inline-flex; align-items: center; gap: 12px; min-width: fit-content; }
.brand-badge {
  width: 44px; height: 44px; border-radius: 15px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 0.92rem; font-weight: 900;
  background: linear-gradient(135deg, #4078ff, #6757f5);
  box-shadow: 0 12px 22px rgba(64, 120, 255, 0.22);
}
.logo { display: block; font-size: 1.55rem; font-weight: 900; letter-spacing: -0.04em; line-height: 1; color: var(--ink); }
.tagline { display: block; margin-top: 7px; color: #718096; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.18em; }
.site-nav { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.site-nav a {
  padding: 8px 12px; border-radius: 999px; color: #435067;
  font-size: 0.87rem; font-weight: 800; border: 1px solid transparent;
}
.site-nav a:hover, .site-nav a.active { color: #fff; background: var(--purple); }
.menu-toggle {
  display: none; width: 42px; height: 42px; border: 1px solid var(--line);
  border-radius: 14px; background: #fff; cursor: pointer; font-size: 1.2rem;
}

.puzzle-subnav-card {
  width: min(1120px, calc(100% - 44px));
  margin: 14px auto 0;
  padding: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(223, 231, 242, 0.9);
  border-radius: 24px;
  box-shadow: var(--shadow-soft);
}
.puzzle-subnav-card a {
  padding: 10px 14px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  color: #435067;
  font-weight: 900;
  font-size: 0.9rem;
}
.puzzle-subnav-card a:hover, .puzzle-subnav-card a.active {
  color: #fff;
  background: var(--purple);
  border-color: var(--purple);
}

/* Page hero */
.sudoku-hero {
  padding: 68px 0 28px;
  text-align: center;
}
.sudoku-hero-inner { max-width: 850px; }
.eyebrow {
  display: inline-flex;
  width: fit-content;
  color: var(--purple);
  background: rgba(103, 87, 245, 0.08);
  border: 1px solid rgba(103, 87, 245, 0.12);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.sudoku-hero h1 {
  margin: 18px 0 12px;
  font-size: clamp(2.25rem, 5vw, 4rem);
  line-height: 1;
  letter-spacing: -0.07em;
}
.sudoku-hero p:not(.eyebrow) {
  max-width: 690px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 1.05rem;
}

/* Main game layout */
.sudoku-play-section {
  padding: 28px 0 54px;
  border-top: 1px solid rgba(223, 231, 242, 0.75);
  border-bottom: 1px solid rgba(223, 231, 242, 0.75);
  background: rgba(255, 255, 255, 0.42);
}
.sudoku-play-grid {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 22px;
  align-items: start;
}
.sudoku-control-card,
.sudoku-card {
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow-soft);
}
.sudoku-control-card {
  padding: 24px;
  position: sticky;
  top: 116px;
}
.control-icon {
  width: 58px;
  height: 58px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 19px;
  background: linear-gradient(135deg, var(--soft-blue), #f7fbff);
  font-size: 1.85rem;
  box-shadow: 0 9px 18px rgba(34, 50, 84, 0.08);
}
.sudoku-control-card h2 {
  margin: 16px 0 14px;
  font-size: 1.45rem;
  line-height: 1.1;
  letter-spacing: -0.04em;
}
.sudoku-controls {
  display: grid;
  gap: 10px;
}
.sudoku-controls label {
  display: grid;
  gap: 7px;
  color: #435067;
  font-size: 0.92rem;
  font-weight: 900;
}
.sudoku-select {
  width: 100%;
  min-height: 46px;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 0 15px;
  outline: none;
  color: var(--ink);
  background: #fff;
}
.sudoku-select:focus,
.sudoku-cell:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 4px rgba(103, 87, 245, 0.12);
  outline: none;
}
.primary-btn, .secondary-btn {
  min-height: 44px;
  border-radius: 999px;
  padding: 0 16px;
  font-weight: 900;
  cursor: pointer;
  border: 0;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.primary-btn:hover, .secondary-btn:hover { transform: translateY(-2px); }
.primary-btn {
  color: #fff;
  background: linear-gradient(135deg, var(--purple), var(--blue));
  box-shadow: 0 13px 24px rgba(64, 120, 255, 0.2);
}
.secondary-btn {
  color: var(--purple-dark);
  background: #fff;
  border: 1px solid rgba(103, 87, 245, 0.18);
}
.how-to-card {
  margin-top: 20px;
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(135deg, var(--soft-yellow), #fffaf0);
  border: 1px solid rgba(255, 210, 119, 0.45);
}
.how-to-card h3 { margin: 0 0 8px; font-size: 1.05rem; }
.how-to-card ul { margin: 0; padding-left: 18px; color: #5b6372; font-size: 0.92rem; }
.how-to-card li + li { margin-top: 5px; }

.sudoku-game-wrap { position: relative; }
.sudoku-card {
  padding: 24px;
  background: linear-gradient(135deg, rgba(222, 236, 255, 0.78), rgba(255, 255, 255, 0.92));
}
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}
.section-heading h3 {
  margin: 2px 0 0;
  font-size: 1.6rem;
  line-height: 1.05;
  letter-spacing: -0.045em;
}
.small-label {
  margin: 0;
  color: var(--purple);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.board-frame {
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  padding: 16px;
  border-radius: 26px;
  background: rgba(255,255,255,0.76);
  border: 1px solid rgba(223,231,242,0.9);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.7);
}
.sudoku-board {
  display: grid;
  grid-template-columns: repeat(9, minmax(34px, 58px));
  justify-content: center;
  border: 4px solid #6b7a96;
  border-radius: 10px;
  overflow: hidden;
  background: #6b7a96;
}
.sudoku-cell {
  width: 100%;
  aspect-ratio: 1 / 1;
  min-width: 38px;
  border: 1px solid #cdd7e4;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--ink);
  background: #ffffff;
}
.sudoku-cell.fixed {
  background: #eef4ff;
  color: #25385f;
}
.sudoku-cell.invalid {
  background: #ffe8e8;
  color: #8d1f1f;
}
.sudoku-cell.box-right {
  border-right: 4px solid #6b7a96;
}
.sudoku-cell.box-bottom {
  border-bottom: 4px solid #6b7a96;
}
.result-message {
  margin: 18px auto 0;
  max-width: 560px;
  padding: 13px 16px;
  border-radius: 18px;
  text-align: center;
  font-weight: 900;
  color: #536176;
  background: rgba(255,255,255,0.75);
  border: 1px solid rgba(223,231,242,0.92);
}
.result-message.success {
  color: #137a4b;
  background: #e6f8ef;
  border-color: #b9ead0;
}
.result-message.error {
  color: #9d2c2c;
  background: #ffe9e9;
  border-color: #ffc8c8;
}

.share-wrap {
  width: min(1120px, calc(100% - 44px));
  margin: 26px auto 18px;
  text-align: center;
}
.share-panel-icons {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.share-icon-btn,
.share-panel-icons button {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #435067;
  cursor: pointer;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(34, 50, 84, 0.06);
}
.share-feedback { min-height: 20px; color: var(--muted); }

.puzzle-site-footer {
  margin-top: 32px;
  padding: 32px 0;
  background: rgba(255,255,255,0.62);
  border-top: 1px solid rgba(223, 231, 242, 0.9);
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}
.site-footer h3 { margin: 0 0 5px; font-size: 1rem; font-weight: 900; }
.site-footer p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.footer-nav { display: flex; gap: 18px; flex-wrap: wrap; }
.footer-nav a { color: #435067; font-size: 0.9rem; font-weight: 800; }
.footer-nav a:hover { color: var(--purple); }

@media (max-width: 980px) {
  .sudoku-play-grid { grid-template-columns: 1fr; }
  .sudoku-control-card { position: static; }
  .sudoku-controls { grid-template-columns: 1fr 1fr; }
  .sudoku-controls label { grid-column: 1 / -1; }
}

@media (max-width: 820px) {
  .menu-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .site-nav {
    position: absolute;
    top: calc(100% + 10px);
    left: 22px;
    right: 22px;
    display: none;
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    border-radius: 22px;
    background: rgba(255,255,255,0.96);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-soft);
  }
  .site-nav.open { display: flex; }
  .site-nav a { text-align: center; }
}

@media (max-width: 680px) {
  .container,
  .share-wrap,
  .puzzle-subnav-card { width: min(100% - 28px, 1120px); }
  .puzzle-header-inner { min-height: 74px; }
  .brand-badge { width: 40px; height: 40px; }
  .logo { font-size: 1.3rem; }
  .tagline { font-size: 0.58rem; }
  .sudoku-hero { padding: 44px 0 24px; }
  .sudoku-hero h1 { font-size: clamp(2.1rem, 12vw, 3.4rem); }
  .sudoku-controls { grid-template-columns: 1fr; }
  .sudoku-card,
  .sudoku-control-card { padding: 18px; border-radius: 24px; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .board-frame { width: 100%; padding: 10px; border-radius: 20px; overflow-x: auto; }
  .sudoku-board {
    width: min(78vw, 330px);
    grid-template-columns: repeat(9, 1fr);
    margin: 0 auto;
  }
  .sudoku-cell { min-width: 0; font-size: 1.05rem; }
  .puzzle-subnav-card { justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; }
  .puzzle-subnav-card a { white-space: nowrap; }
  .footer-inner { align-items: flex-start; flex-direction: column; }
}
