:root {
  color-scheme: light;
  --ink: #272431;
  --muted: #6d6876;
  --canvas: #f6f4f7;
  --surface: #ffffff;
  --surface-soft: #f8f7fa;
  --line: #e7e2e9;
  --blue: #4c5dc5;
  --blue-soft: #eef0ff;
  --red: #c21d4f;
  --red-soft: #fff0f4;
  --accent: #d51f55;
  --accent-dark: #a91543;
  --site-width: 1080px;
  --reading-width: 740px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--surface);
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.7;
}

body::before {
  display: block;
  height: 5px;
  background: linear-gradient(90deg, #667eea, #764ba2 62%, #c21d4f);
  content: "";
}

a {
  color: var(--blue);
}

a:focus-visible,
summary:focus-visible {
  outline: 3px solid #f3a7bd;
  outline-offset: 3px;
}

.site-header {
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(var(--site-width), calc(100% - 40px));
  min-height: 74px;
  margin: 0 auto;
  gap: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  font-size: 1.12rem;
  font-weight: 800;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  grid-template-columns: repeat(2, 18px);
  gap: 3px;
  padding: 3px;
  border-radius: 9px;
  background: #262937;
}

.brand-mark span {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 5px;
  color: #fff;
  font-size: 0.68rem;
  line-height: 1;
}

.brand-mark .x {
  background: #3158d8;
}

.brand-mark .o {
  background: #c21d4f;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

.site-nav a {
  color: #504b58;
  font-size: 0.93rem;
  font-weight: 700;
  text-decoration: none;
}

.site-nav a[aria-current="page"] {
  color: var(--accent);
}

.site-nav .play-link,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 8px 17px;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  box-shadow: 0 8px 22px rgba(213, 31, 85, 0.22);
  font-weight: 750;
  text-decoration: none;
}

.post {
  width: min(var(--reading-width), calc(100% - 40px));
  margin: 0 auto;
  padding: 64px 0 84px;
}

.post-header {
  padding-bottom: 38px;
  border-bottom: 1px solid var(--line);
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 30px;
  color: var(--muted);
  font-size: 0.84rem;
}

.breadcrumbs a {
  color: var(--muted);
  text-decoration: none;
}

.post-kicker {
  margin: 0 0 10px;
  color: var(--red);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.post h1,
.blog-index h1 {
  margin: 0;
  font-size: clamp(2.35rem, 7vw, 4.25rem);
  line-height: 1.05;
  letter-spacing: -0.05em;
}

.post-deck {
  max-width: 680px;
  margin: 22px 0 24px;
  color: #5e5966;
  font-size: clamp(1.08rem, 2.4vw, 1.28rem);
  line-height: 1.6;
}

.post-byline {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 18px;
  color: var(--muted);
  font-size: 0.86rem;
}

.post-byline > * + *::before,
.post-summary-meta > * + *::before {
  margin-right: 18px;
  color: #c2bcc5;
  content: "•";
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
}

.post-tags a {
  display: inline-block;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #5e5865;
  background: var(--surface-soft);
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
}

.post-body {
  padding-top: 44px;
  font-size: 1.04rem;
}

.post-body h2,
.post-body h3 {
  line-height: 1.22;
}

.post-body h2 {
  margin: 0 0 18px;
  font-size: clamp(1.65rem, 4vw, 2.2rem);
  letter-spacing: -0.025em;
}

.post-body h3 {
  margin: 0 0 8px;
  font-size: 1.12rem;
}

.post-body p {
  margin: 0 0 19px;
}

.post-body section + section {
  margin-top: 58px;
}

.toc {
  margin: 0 0 52px;
  padding: 21px 24px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-soft);
}

.toc strong {
  display: block;
  margin-bottom: 9px;
  font-size: 0.92rem;
}

.toc ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc a {
  color: #54505c;
  font-size: 0.94rem;
  text-underline-offset: 3px;
}

.lead-answer {
  margin: 24px 0;
  padding: 22px 24px;
  border-left: 4px solid var(--blue);
  border-radius: 0 12px 12px 0;
  background: var(--blue-soft);
}

.lead-answer p:last-child {
  margin-bottom: 0;
}

.rule-grid,
.strategy-grid {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

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

.card {
  position: relative;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 5px 18px rgba(40, 33, 52, 0.05);
}

.rule-grid .card {
  padding-left: 72px;
}

.rule-number {
  position: absolute;
  top: 22px;
  left: 22px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  color: #fff;
  background: var(--blue);
  font-weight: 800;
}

.card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.pattern,
.mini-line,
.line-result {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.pattern {
  margin: 16px 0 12px;
}

.line-example {
  display: grid;
  gap: 7px;
  margin: 16px 0 12px;
}

.line-label {
  flex: 0 0 58px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.cell {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid #d7dae6;
  border-radius: 9px;
  background: #fff;
  font-weight: 850;
}

.mini-line .cell,
.line-result .cell {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  font-size: 0.82rem;
}

.cell.x {
  color: var(--blue);
  background: var(--blue-soft);
}

.cell.o {
  color: var(--red);
  background: var(--red-soft);
}

.cell.answer {
  border: 2px dashed #818697;
}

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

.line-result {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.not-allowed {
  margin-left: 62px;
  color: var(--red);
  font-size: 0.7rem;
  font-weight: 850;
  text-transform: uppercase;
}

.steps {
  margin: 24px 0 0;
  padding: 0;
  counter-reset: step;
  list-style: none;
}

.steps li {
  position: relative;
  min-height: 46px;
  margin-bottom: 20px;
  padding-left: 58px;
}

.steps li::before {
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 11px;
  color: var(--blue);
  background: var(--blue-soft);
  font-weight: 850;
  counter-increment: step;
  content: counter(step);
}

.photo-solver {
  padding: 30px;
  border-radius: 16px;
  color: #fff;
  background: linear-gradient(135deg, #353a70, #5c347a);
}

.photo-solver h2 {
  color: #fff;
}

.photo-solver p:last-child {
  margin-bottom: 0;
}

.faq-list {
  border-top: 1px solid var(--line);
}

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

summary {
  padding: 18px 4px;
  font-weight: 750;
  cursor: pointer;
}

details p {
  padding: 0 4px 20px;
  color: var(--muted);
}

.final-cta {
  padding: 36px 28px;
  border: 1px solid var(--line);
  border-radius: 16px;
  text-align: center;
  background: var(--surface-soft);
}

.final-cta h2 {
  margin-bottom: 10px;
}

.final-cta p {
  max-width: 580px;
  margin: 0 auto 22px;
  color: var(--muted);
}

.blog-index {
  width: min(820px, calc(100% - 40px));
  margin: 0 auto;
  padding: 72px 0 96px;
}

.blog-index-header {
  max-width: 720px;
  margin-bottom: 54px;
}

.blog-index-header.compact {
  margin-bottom: 38px;
}

.blog-index-header p:last-child {
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 1.08rem;
}

.post-list {
  border-top: 1px solid var(--line);
}

.post-summary {
  padding: 32px 0;
  border-bottom: 1px solid var(--line);
}

.post-summary h2 {
  margin: 8px 0 10px;
  font-size: clamp(1.45rem, 3vw, 2rem);
  line-height: 1.25;
}

.post-summary h2 a {
  color: var(--ink);
  text-decoration: none;
}

.post-summary > p:not(.post-summary-meta) {
  margin: 0;
  color: var(--muted);
}

.post-summary-meta {
  display: flex;
  flex-wrap: wrap;
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--canvas);
}

.site-footer-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  width: min(var(--site-width), calc(100% - 40px));
  margin: 0 auto;
  padding: 34px 0;
  gap: 30px;
  color: var(--muted);
  font-size: 0.88rem;
}

.site-footer p {
  margin: 4px 0 0;
}

.footer-brand {
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.site-footer nav a {
  color: #514b59;
  font-weight: 700;
  text-decoration: none;
}

@media (max-width: 700px) {
  .site-header-inner {
    width: min(100% - 28px, var(--site-width));
    min-height: 68px;
  }

  .site-nav {
    gap: 12px;
  }

  .site-nav > a:not(.play-link) {
    display: none;
  }

  .post {
    width: min(var(--reading-width), calc(100% - 34px));
    padding: 42px 0 60px;
  }

  .post-header {
    padding-bottom: 30px;
  }

  .breadcrumbs {
    margin-bottom: 24px;
  }

  .post-byline {
    gap: 5px 8px;
  }

  .post-byline > * + *::before,
  .post-summary-meta > * + *::before {
    margin-right: 8px;
  }

  .post-body {
    padding-top: 36px;
  }

  .toc ul,
  .strategy-grid {
    grid-template-columns: 1fr;
  }

  .post-body section + section {
    margin-top: 46px;
  }

  .rule-grid .card {
    padding: 20px;
  }

  .rule-number {
    position: static;
    margin-bottom: 14px;
  }

  .photo-solver {
    padding: 24px 20px;
  }

  .blog-index {
    width: min(100% - 34px, 820px);
    padding: 48px 0 68px;
  }

  .site-footer-inner {
    flex-direction: column;
    width: min(100% - 34px, var(--site-width));
    gap: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
