:root {
  --primary: #256D7B;
  --primary-dark: #1a4f59;
  --primary-light: #e8f4f6;
  --text: #1B1C22;
  --text-muted: #606371;
  --border: #D7D8DE;
  --bg: #f7f8fa;
  --card: #ffffff;
  --radius: 12px;
  --max: 720px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Noto Sans JP", "Microsoft YaHei",
    Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 1.25rem 3rem; }
header.site {
  background: var(--primary);
  color: #fff;
  padding: 0.85rem 0;
}
header.site .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0;
  flex-wrap: wrap;
}
header.site a.logo {
  color: #fff;
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
  letter-spacing: 0.02em;
}
header.site nav { display: flex; gap: 1rem; flex-wrap: wrap; }
header.site nav a {
  color: rgba(255,255,255,0.92);
  font-size: 0.92rem;
  text-decoration: none;
}
header.site nav a:hover { text-decoration: underline; }
.breadcrumb {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 1.25rem 0 0.75rem;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb span.sep { margin: 0 0.35rem; color: #9aa0ad; }
h1 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.25;
  margin: 0.4rem 0 1rem;
  color: var(--text);
}
h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 1.75rem 0 0.65rem;
  color: var(--primary-dark);
}
p { margin: 0.65rem 0; font-weight: 400; }
.lead { font-size: 1.05rem; color: var(--text-muted); font-weight: 400; }
.badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--primary-light);
  color: var(--primary-dark);
  margin-bottom: 0.5rem;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  margin: 1rem 0;
}
.card h2:first-child { margin-top: 0; }
ol.steps { padding-left: 1.25rem; margin: 0.5rem 0; }
ol.steps li { margin: 0.45rem 0; }
.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.5rem 0;
}
.btn {
  display: inline-block;
  padding: 0.7rem 1.25rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.98rem;
  text-decoration: none !important;
  border: 2px solid transparent;
  text-align: center;
}
.btn-primary {
  background: var(--primary);
  color: #fff !important;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary {
  background: #fff;
  color: var(--primary) !important;
  border-color: var(--primary);
}
.btn-secondary:hover { background: var(--primary-light); }
.btn-play {
  background: var(--primary);
  color: #fff !important;
  font-size: 1.05rem;
  padding: 0.85rem 1.5rem;
}
.hero {
  background: linear-gradient(160deg, var(--primary) 0%, #1a4f59 100%);
  color: #fff;
  padding: 2.5rem 0 2.75rem;
  margin-bottom: 1.5rem;
}
.hero .wrap { padding-bottom: 0; }
.hero h1 { color: #fff; font-size: 2rem; margin-bottom: 0.75rem; }
.hero p { color: rgba(255,255,255,0.92); font-size: 1.08rem; max-width: 36rem; }
.hero .cta-row { margin-top: 1.5rem; }
.hero .btn-primary {
  background: #fff;
  color: var(--primary) !important;
}
.hero .btn-secondary {
  background: transparent;
  color: #fff !important;
  border-color: rgba(255,255,255,0.7);
}
.features {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin: 1.25rem 0;
}
@media (min-width: 560px) {
  .features { grid-template-columns: 1fr 1fr; }
}
.feature {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}
.feature strong { display: block; color: var(--primary-dark); margin-bottom: 0.25rem; }
.feature span { font-size: 0.92rem; color: var(--text-muted); }
.level-group { margin: 1.5rem 0; }
.level-group h2 { margin-bottom: 0.5rem; }
.tech-list { list-style: none; padding: 0; margin: 0; }
.tech-list li {
  border-bottom: 1px solid var(--border);
}
.tech-list a {
  display: block;
  padding: 0.7rem 0.15rem;
  color: var(--text);
  text-decoration: none;
}
.tech-list a:hover {
  color: var(--primary);
  background: var(--primary-light);
  margin: 0 -0.5rem;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  border-radius: 6px;
}
.tech-list .sum {
  display: block;
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
  font-weight: 400;
}
.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 2rem 0 1rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}
.pager a {
  flex: 1 1 12rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  color: var(--text);
  text-decoration: none;
}
.pager a:hover { border-color: var(--primary); }
.pager .label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.2rem;
}
.pager .next { text-align: right; }
.play-banner {
  background: var(--primary-light);
  border: 1px solid #b8d9e0;
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  margin: 1.5rem 0;
  text-align: center;
}
.play-banner p { margin: 0 0 0.75rem; color: var(--primary-dark); }
.practice-cta {
  background: var(--primary-light);
  border: 1px solid #b8d9e0;
  border-radius: var(--radius);
  padding: 1.75rem 1.5rem;
  margin: 2.5rem 0 1.5rem;
  text-align: center;
}
.practice-cta h2 {
  margin: 0 0 1rem;
  font-size: 1.25rem;
  color: var(--primary-dark);
  border: none;
  padding: 0;
}
.practice-cta .btn {
  display: inline-block;
}
footer.site {
  border-top: 1px solid var(--border);
  margin-top: 2.5rem;
  padding: 1.25rem 0 1.75rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.7;
}
footer.site a {
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
}
footer.site a:hover { color: var(--primary); text-decoration: underline; }
footer.site .sep { margin: 0 0.35rem; color: var(--border); }
.board-figure {
  margin: 1rem 0 1.25rem;
  text-align: center;
}
.board-figure .sudoku-board {
  display: block;
  margin: 0 auto;
  max-width: min(360px, 100%);
  width: 100%;
  height: auto;
  border-radius: 4px;
}
.board-caption {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0.65rem 0 0;
  line-height: 1.45;
}
.hero-board {
  margin: 1.5rem auto 0;
  max-width: min(280px, 90%);
}
.hero-board .sudoku-board {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
}
.rules-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  justify-content: center;
  margin: 0.5rem 0 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}
.rules-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.rules-legend i {
  display: inline-block;
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 3px;
  border: 1px solid var(--border);
}

/* ---- Printable puzzles ---- */
.difficulty-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; margin: 1.5rem 0; }
.difficulty-card { display: block; padding: 1.25rem; border: 1px solid #d8e2e6; border-radius: 12px; text-decoration: none; color: inherit; background: #fff; transition: box-shadow .15s ease; }
.difficulty-card:hover { box-shadow: 0 4px 14px rgba(37,109,123,.18); text-decoration: none; }
.difficulty-card h2 { margin: 0 0 .4rem; color: var(--primary); }
.difficulty-card p { margin: 0 0 .8rem; font-size: .92rem; }
.print-toolbar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin: 1.2rem 0; }
.print-toolbar button { cursor: pointer; border: none; font-size: 1rem; }
.difficulty-switch { display: flex; gap: .5rem; flex-wrap: wrap; }
.chip { padding: .35rem .8rem; border: 1px solid #d8e2e6; border-radius: 999px; text-decoration: none; color: inherit; font-size: .88rem; }
.chip:hover { border-color: var(--primary); text-decoration: none; }
.chip-active { background: var(--primary); border-color: var(--primary); color: #fff; }
.printable-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; margin: 1.2rem 0 2rem; }
.printable-item { margin: 0; }
.printable-item figcaption { font-weight: 600; margin-bottom: .5rem; color: var(--primary-dark); }
.solutions-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

@media print {
  header.site, footer.site, .practice-cta, .print-toolbar, .hero p, aside { display: none !important; }
  body { background: #fff !important; }
  main.wrap { max-width: none; padding: 0; }
  .hero h1 { font-size: 14pt; margin: 0 0 6mm; }
  .printable-grid { grid-template-columns: repeat(2, 1fr); gap: 6mm; }
  .printable-item { break-inside: avoid; page-break-inside: avoid; }
  .printable-item svg { width: 100% !important; height: auto !important; }
  .solutions-section { page-break-before: always; }
  .solutions-grid { grid-template-columns: repeat(3, 1fr); gap: 4mm; }
}

/* ---- Daily playable widget (homepage hero) ---- */
.daily-widget { background: #fff; border-radius: 16px; padding: 1rem 1rem 1.1rem; max-width: 430px; margin: 1.8rem auto 0; box-shadow: 0 12px 34px rgba(0,0,0,.22); color: #1c2b30; text-align: left; }
.daily-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: .6rem; }
.daily-head strong { color: var(--primary-dark); font-size: 1.05rem; font-weight: 700; }
.daily-head span { color: #6b7d82; font-size: .9rem; }
.stat-pills { display: flex; gap: .5rem; margin-bottom: .6rem; }
.stat-pills .pill { flex: 1; display: flex; align-items: baseline; justify-content: center; gap: .4rem; background: #f2f7f8; border-radius: 999px; padding: .4rem .6rem; }
.stat-pills .pill small { color: #6b7d82; font-size: .78rem; font-weight: 500; }
.stat-pills .pill strong { font-size: 1.02rem; font-weight: 800; color: var(--primary-dark); font-variant-numeric: tabular-nums; }
.daily-widget .difficulty-switch { display: flex; gap: .35rem; flex-wrap: wrap; margin-bottom: .7rem; }
.daily-widget .chip { padding: .3rem .68rem; border: 1px solid #d8e2e6; background: #fff; border-radius: 999px; font-size: .82rem; font-weight: 600; color: #55686e; cursor: pointer; font-family: inherit; }
.daily-widget .chip:hover { border-color: var(--primary); }
.daily-widget .chip-active { background: var(--primary); border-color: var(--primary); color: #fff; }
.daily-board { display: grid; grid-template-columns: repeat(9, 1fr); border: 2.5px solid var(--primary-dark); border-radius: 4px; outline: none; }
.daily-board:focus { box-shadow: 0 0 0 3px rgba(37,109,123,.35); }
.dcell { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; font-size: clamp(14px, 4vw, 19px); font-weight: 600; line-height: 1; background: #fff; border: 0; border-right: 1px solid #c3d4d9; border-bottom: 1px solid #c3d4d9; color: var(--primary); padding: 0; cursor: pointer; font-family: inherit; position: relative; }
.dcell:nth-child(9n) { border-right: 0; }
.dcell:nth-child(n+73) { border-bottom: 0; }
.dcell.bR { border-right: 2.5px solid var(--primary-dark); }
.dcell.bB { border-bottom: 2.5px solid var(--primary-dark); }
.dcell.given { color: #1c2b30; background: #eef4f5; cursor: default; }
.dcell.sel { background: #cfe3e8 !important; }
.dcell.bad { color: #c62828; }
.dcell .nts { position: absolute; inset: 1px; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); }
.dcell .nts i { font-style: normal; font-weight: 500; font-size: .42em; color: #7d939a; display: flex; align-items: center; justify-content: center; }
.daily-pad { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; margin-top: .8rem; }
.daily-pad button { padding: .5rem 0; border: 1px solid #d8e2e6; background: #f7fbfc; border-radius: 8px; font-size: 1rem; font-weight: 600; color: var(--primary-dark); cursor: pointer; font-family: inherit; }
.daily-pad button:hover { background: #e4eef0; }
.tool-card { display: grid; grid-template-columns: repeat(4, 1fr); gap: .45rem; margin-top: .55rem; background: #f2f7f8; border-radius: 14px; padding: .5rem; }
.tool-card button { display: flex; align-items: center; justify-content: center; gap: .35rem; padding: .5rem .2rem; border: 0; background: #fff; border-radius: 999px; font-size: .84rem; font-weight: 600; color: var(--primary-dark); cursor: pointer; font-family: inherit; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.tool-card button:hover { background: #e4eef0; }
.tool-card button .ic { font-size: 1rem; line-height: 1; }
.tool-card button.tool-active { background: var(--primary); color: #fff; }
.daily-foot { margin-top: .7rem; display: flex; justify-content: space-between; gap: .6rem; align-items: center; font-size: .85rem; color: #55686e; flex-wrap: wrap; }
.daily-foot a { color: var(--primary); white-space: nowrap; }
#daily-status.ok { color: #2e7d32; font-weight: 700; }
@media print { .daily-widget { display: none; } }

/* ---- Homepage game embed ---- */
.hero-game { padding-bottom: 2rem; }
.hero-slim { color: #fff; font-size: 1.3rem; font-weight: 700; text-align: center; margin: .2rem 0 1rem; }
.game-embed { max-width: 480px; margin: 0 auto; }
.game-embed iframe { display: block; width: 100%; height: 80vh; min-height: 560px; max-height: 840px; border: 0; border-radius: 16px; background: #F4F3FA; box-shadow: 0 12px 34px rgba(0,0,0,.22); }
@media print { .game-embed { display: none; } }
