/* ========== Reset ========== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ========== Design Tokens ========== */
:root {
  --primary: #0175c2;
  --primary-dark: #015fa0;
  --primary-light: #e8f3fb;
  --text-main: #1a1a2e;
  --text-sub: #555;
  --bg: #f9fafb;
  --card-bg: #ffffff;
  --radius: 12px;
}

/* ========== Base ========== */
body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial,
    "Noto Sans JP", sans-serif;
  background: var(--bg);
  color: var(--text-main);
  line-height: 1.6;
}

/* ========== Site Nav ========== */
.site-nav {
  background: var(--primary-dark);
  padding: 0 24px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}

.site-nav a {
  display: inline-block;
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  font-size: 0.875rem;
  padding: 10px 12px;
  transition: color 0.15s;
}

.site-nav a:hover {
  color: #fff;
}

.site-nav a[aria-current="page"] {
  color: #fff;
  font-weight: 700;
}

/* ========== Page Hero ========== */
.page-hero {
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-dark) 100%
  );
  color: #fff;
  padding: 52px 24px 64px;
  text-align: center;
}

.page-hero h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 14px;
}

.page-hero p {
  font-size: 1.05rem;
  opacity: 0.9;
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.7;
}

/* ========== Buttons ========== */
.btn {
  display: inline-block;
  padding: 14px 28px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  transition:
    transform 0.15s,
    box-shadow 0.15s;
  cursor: pointer;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.btn-cta {
  background: var(--primary);
  color: #fff;
  font-size: 1.05rem;
  padding: 16px 36px;
  border-radius: 8px;
  display: inline-block;
  text-decoration: none;
  font-weight: 600;
  transition:
    background 0.15s,
    box-shadow 0.15s,
    transform 0.15s;
}

.btn-cta:hover {
  background: var(--primary-dark);
  box-shadow: 0 6px 20px rgba(1, 117, 194, 0.35);
  transform: translateY(-2px);
}

.btn-outline-dark {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
  padding: 14px 28px;
  border-radius: 8px;
}

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

/* ========== Store Badges ========== */
.store-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
}

.store-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: var(--text-main);
  color: #fff;
  border-radius: 10px;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
  transition:
    background 0.15s,
    transform 0.15s;
}

.store-badge:hover {
  background: #2d2d4e;
  transform: translateY(-2px);
}

.store-badge svg {
  flex-shrink: 0;
}

/* ========== Footer ========== */
footer {
  background: var(--text-main);
  color: rgba(255, 255, 255, 0.6);
  text-align: center;
  padding: 24px;
  font-size: 0.85rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 16px;
  margin-bottom: 12px;
}

footer a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
}

footer a:hover {
  color: #fff;
}

/* ========== Design Tokens (Technique Badge Colors) ========== */
:root {
  --badge-basic-bg: #d4edda;
  --badge-basic-color: #155724;
  --badge-mid-bg: #fff3cd;
  --badge-mid-color: #856404;
}

/* ========== TOC ========== */
.toc-section {
  background: var(--primary-light);
  padding: 32px 24px;
}

.toc-inner {
  max-width: 860px;
  margin: 0 auto;
}

.toc-inner h2 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--primary-dark);
}

.toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.toc-list li {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.toc-list li a {
  color: var(--primary);
  text-decoration: none;
  font-size: 0.97rem;
  font-weight: 500;
}

.toc-list li a:hover {
  text-decoration: underline;
}

/* ========== TOC Badge ========== */
.toc-badge {
  display: inline-block;
  border-radius: 4px;
  padding: 1px 7px;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.toc-badge-basic {
  background: var(--badge-basic-bg);
  color: var(--badge-basic-color);
}

.toc-badge-mid {
  background: var(--badge-mid-bg);
  color: var(--badge-mid-color);
}

/* ========== Content Layout ========== */
.content {
  max-width: 800px;
  margin: 0 auto;
  padding: 56px 24px 72px;
}

body.content-width-wide .content {
  max-width: 860px;
}

body.content-spacing-medium .content {
  padding: 48px 24px 64px;
}

/* ========== Section Header ========== */
.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--primary-light);
}

.section-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  font-size: 0.95rem;
  font-weight: 700;
  flex-shrink: 0;
}

.section-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
}

.content p {
  font-size: 0.97rem;
  color: var(--text-sub);
  margin-bottom: 16px;
  line-height: 1.75;
}

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

body.content-section-gap-24 .content section {
  margin-bottom: 24px;
}

body.content-section-gap-40 .content section {
  margin-bottom: 40px;
}

body.content-section-gap-56 .content section {
  margin-bottom: 56px;
}

body.content-section-gap-64 .content section {
  margin-bottom: 64px;
}

.content section:last-child {
  margin-bottom: 0;
}

/* ========== Difficulty Badge ========== */
.difficulty-badge {
  display: inline-block;
  border-radius: 5px;
  padding: 2px 10px;
  font-size: 0.82rem;
  font-weight: 700;
  width: fit-content;
}

.difficulty-badge-basic {
  background: var(--badge-basic-bg);
  color: var(--badge-basic-color);
}

.difficulty-badge-mid {
  background: var(--badge-mid-bg);
  color: var(--badge-mid-color);
}

/* ========== Difficulty Table ========== */
.diff-table-wrap {
  overflow-x: auto;
  margin-top: 20px;
  border-radius: var(--radius);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card-bg);
  font-size: 0.92rem;
}

thead th {
  background: var(--primary);
  color: #fff;
  padding: 12px 16px;
  text-align: left;
  font-weight: 700;
}

tbody tr:nth-child(even) {
  background: var(--primary-light);
}

tbody td {
  padding: 12px 16px;
  color: var(--text-sub);
  border-bottom: 1px solid #eaeaea;
  vertical-align: top;
}

tbody tr:last-child td {
  border-bottom: none;
}

.badge-easy {
  display: inline-block;
  background: #d4edda;
  color: #155724;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-medium {
  display: inline-block;
  background: #fff3cd;
  color: #856404;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-hard {
  display: inline-block;
  background: #f8d7da;
  color: #721c24;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-expert {
  display: inline-block;
  background: #e2d9f3;
  color: #432874;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.stats-note {
  font-size: 0.85rem;
  color: var(--text-sub);
  margin-top: 12px;
  font-style: italic;
}

/* ========== Effective Date ========== */
.effective-date {
  color: var(--text-sub);
}

/* ========== Grid Figure ========== */
.grid-figure {
  max-width: 580px;
  width: 100%;
  margin: 16px auto;
  display: block;
}

.grid-figure svg {
  width: 100%;
  height: auto;
}

.grid-figure svg[viewBox="-30 -30 420 420"] {
  max-width: 480px;
  margin: 0 auto;
  display: block;
}

/* ========== Internal Link Box ========== */
.internal-link-box {
  background: var(--primary-light);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.internal-link-box p {
  font-size: 0.92rem;
  color: var(--text-main);
  margin-bottom: 0;
}

.internal-link-box a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  font-size: 0.92rem;
}

.internal-link-box a:hover {
  text-decoration: underline;
}

/* ========== CTA Section ========== */
.cta-section {
  background: var(--card-bg);
  padding: 60px 24px;
  text-align: center;
  border-top: 1px solid #eaeaea;
}

.cta-section h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.cta-section p {
  color: var(--text-sub);
  margin-bottom: 28px;
  font-size: 0.97rem;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.7;
}

.cta-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}

/* ========== Responsive ========== */
@media (max-width: 480px) {
  .site-nav {
    padding: 4px 12px;
    justify-content: center;
    gap: 2px 4px;
  }

  .site-nav a {
    padding: 8px 10px;
    font-size: 0.825rem;
  }

  .page-hero h1 {
    font-size: 1.6rem;
  }

  .section-header h2 {
    font-size: 1.2rem;
  }

  thead th,
  tbody td {
    padding: 10px 12px;
  }

  .cta-buttons {
    flex-direction: column;
    align-items: center;
  }

  .btn-cta,
  .btn-outline-dark {
    width: 100%;
    max-width: 320px;
    text-align: center;
  }

  .store-badges {
    flex-direction: column;
    align-items: center;
  }

  .store-badge {
    width: 100%;
    max-width: 300px;
    justify-content: center;
  }

  .internal-link-box {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ========== Technique Detail Components ========== */

.technique-section {
  margin-bottom: 72px;
  scroll-margin-top: 24px;
}

.technique-section:last-child {
  margin-bottom: 0;
}

.technique-section-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--primary-light);
}

.technique-section-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  font-size: 1rem;
  font-weight: 700;
  flex-shrink: 0;
}

.technique-section-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.technique-section-title-wrap h2 {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.3;
}

.subsection {
  margin-bottom: 28px;
}

.subsection h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.subsection h3::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 1em;
  background: var(--primary);
  border-radius: 2px;
  flex-shrink: 0;
}

.subsection p {
  font-size: 0.97rem;
  color: var(--text-sub);
  line-height: 1.8;
  margin-bottom: 12px;
}

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

.step-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.step-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-start;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--primary-light);
  color: var(--primary-dark);
  border-radius: 50%;
  font-size: 0.82rem;
  font-weight: 700;
  flex-shrink: 0;
}

.step-body {
  font-size: 0.95rem;
  color: var(--text-sub);
  line-height: 1.7;
  padding-top: 3px;
}

.example-box {
  background: var(--card-bg);
  border-radius: var(--radius);
  border-left: 4px solid var(--primary);
  padding: 20px 22px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
  margin-top: 4px;
}

.example-box p {
  font-size: 0.95rem;
  color: var(--text-sub);
  line-height: 1.8;
  margin-bottom: 10px;
}

.example-box p:last-child {
  margin-bottom: 0;
}

.example-box strong {
  color: var(--text-main);
}

.coord {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary-dark);
  border-radius: 4px;
  padding: 0 5px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.88em;
  font-weight: 600;
}

.tip-box {
  background: #fffbea;
  border: 1px solid #f0d44a;
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-top: 4px;
}

.tip-box-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: #856404;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tip-box p {
  font-size: 0.93rem;
  color: #665000;
  line-height: 1.75;
  margin-bottom: 8px;
}

.tip-box p:last-child {
  margin-bottom: 0;
}

.figure-context {
  font-size: 0.92rem;
  color: var(--text-sub);
  line-height: 1.7;
  margin: 0 0 8px;
}

.quiz-box {
  background: var(--primary-light);
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  margin: 20px 0;
  overflow: hidden;
}

.quiz-box summary {
  padding: 16px 20px;
  cursor: pointer;
  font-weight: 700;
  color: var(--primary-dark);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.quiz-box summary::before {
  content: "❓";
}

.quiz-box[open] summary {
  border-bottom: 1px solid var(--primary);
}

.quiz-box .quiz-answer {
  padding: 16px 20px;
  background: var(--card-bg);
}

.quiz-reveal {
  margin-top: 16px;
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  overflow: hidden;
}

.quiz-reveal summary {
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 700;
  color: var(--primary-dark);
  background: var(--primary-light);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.quiz-reveal summary::before {
  content: "💡";
}

.quiz-reveal[open] summary {
  border-bottom: 1px solid var(--primary);
}

.quiz-reveal-content {
  padding: 16px 20px;
}

.mistake-box {
  background: #fff5f5;
  border-left: 4px solid #dc3545;
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 20px 24px;
  margin: 20px 0;
}

.mistake-box-label {
  font-weight: 700;
  color: #dc3545;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.mistake-box-label::before {
  content: "⚠";
}

.technique-nav {
  display: flex;
  justify-content: space-between;
  max-width: 800px;
  margin: 32px auto;
  padding: 0 20px;
  font-size: 0.95rem;
}

.technique-nav a {
  color: var(--primary);
  text-decoration: none;
}

.technique-nav a:hover {
  text-decoration: underline;
}

.concept-figure {
  max-width: 580px;
  margin: 20px auto;
}

.concept-figure svg {
  width: 100%;
  height: auto;
}

.step-figure {
  flex-basis: 100%;
  display: flex;
  justify-content: center;
  margin: 12px 0 4px;
}

.step-figure svg {
  width: 100%;
  max-width: 580px;
  height: auto;
}

.step-figure svg[viewBox="-30 -30 420 420"] {
  max-width: 480px;
}

/* ========== Responsive: Technique Detail ========== */
@media (max-width: 480px) {
  .technique-section-header {
    flex-direction: column;
    gap: 10px;
  }

  .technique-section-number {
    width: 34px;
    height: 34px;
    font-size: 0.9rem;
  }

  .technique-section-title-wrap h2 {
    font-size: 1.2rem;
  }

  .concept-figure {
    max-width: 100%;
  }

  .step-figure svg {
    max-width: 100%;
  }
}
