:root {
  --bg-main: #f5efe4;
  --bg-soft: #ebe3d4;
  --paper: #fffdf7;
  --text: #1f2a33;
  --muted: #5b6770;
  --line: #ded2c2;
  --c1: #0f766e;
  --c2: #c96b23;
  --c3: #1f5f87;
  --c4: #6a3f2d;
  --code-bg: #eef3f7;
  --shadow: 0 16px 34px rgba(25, 35, 44, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: clamp(16px, 0.2vw + 15px, 18px);
}

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 0%, #fff7e6 0%, transparent 30%),
    radial-gradient(circle at 88% 5%, #e8f6f2 0%, transparent 28%),
    linear-gradient(180deg, var(--bg-main) 0%, var(--bg-soft) 100%);
  font-family: "Verdana", "Tahoma", "Segoe UI", sans-serif;
  line-height: 1.75;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

.page-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: linear-gradient(180deg, #000 0%, transparent 95%);
}

.page {
  width: min(1100px, calc(100% - 2rem));
  margin: 1.4rem auto 2.6rem;
  position: relative;
  z-index: 1;
}

.hero {
  padding: clamp(1rem, 1.1vw + 0.9rem, 1.8rem);
  border-radius: 24px;
  background: linear-gradient(145deg, #12373b 0%, #0f766e 55%, #0c9e94 100%);
  color: #f2fffd;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.26);
}

.hero-kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: "Trebuchet MS", "Gill Sans MT", sans-serif;
  font-size: 0.78rem;
  opacity: 0.9;
}

.hero h1 {
  margin: 0.35rem 0 0;
  font-family: "Trebuchet MS", "Gill Sans MT", sans-serif;
  font-size: clamp(1.5rem, 1.9vw + 1rem, 2.5rem);
  line-height: 1.2;
}

.hero-subtitle {
  margin: 0.35rem 0 0;
  font-weight: 700;
  font-size: 1.02rem;
}

.hero-lead {
  margin: 0.8rem 0 0;
  max-width: 85ch;
}

.hero-note {
  margin: 0.65rem 0 0;
  display: inline-block;
  padding: 0.32rem 0.65rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.34);
  font-family: "Trebuchet MS", "Gill Sans MT", sans-serif;
  font-size: 0.88rem;
}

.toc {
  margin: 1rem 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.55rem;
}

.toc a {
  display: flex;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
  color: #16353a;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.5rem 0.62rem;
  font-family: "Trebuchet MS", "Gill Sans MT", sans-serif;
  font-size: 0.92rem;
  box-shadow: 0 4px 10px rgba(18, 30, 36, 0.08);
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.toc a:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(18, 30, 36, 0.12);
}

.toc a:focus-visible {
  outline: 2px solid #0f766e;
  outline-offset: 2px;
}

.question {
  margin-top: 1.1rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 9px solid var(--c1);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: clamp(1rem, 1.05vw + 0.75rem, 1.5rem);
}

.question:nth-of-type(4n+1) { border-left-color: var(--c1); }
.question:nth-of-type(4n+2) { border-left-color: var(--c2); }
.question:nth-of-type(4n+3) { border-left-color: var(--c3); }
.question:nth-of-type(4n+4) { border-left-color: var(--c4); }

.question h2,
.question h3 {
  font-family: "Trebuchet MS", "Gill Sans MT", sans-serif;
  line-height: 1.28;
}

.question h2 {
  margin: 0;
  font-size: clamp(1.18rem, 1vw + 0.96rem, 1.6rem);
  color: #1d3f55;
}

.question h3 {
  margin: 1rem 0 0.28rem;
  font-size: 1.03rem;
  color: #1e516f;
}

.question p {
  margin: 0.3rem 0 0.68rem;
  font-size: 1rem;
  line-height: 1.75;
}

.question ul,
.question ol {
  margin: 0.32rem 0 0.82rem 1.34rem;
  padding: 0;
}

.question li {
  margin: 0.24rem 0;
  font-size: 1rem;
  line-height: 1.72;
}

.label {
  margin-top: 0.7rem;
  color: var(--muted);
  font-weight: 700;
}

code {
  font-family: "Consolas", "Courier New", monospace;
  font-size: 0.95em;
  background: var(--code-bg);
  border: 1px solid #d7e0e7;
  border-radius: 6px;
  padding: 0.08rem 0.32rem;
}

.mono-list li {
  background: #f6f9fc;
  border: 1px dashed #ced8e2;
  border-radius: 10px;
  padding: 0.35rem 0.52rem;
}

.solution-steps > li {
  background: #fcfefd;
  border: 1px solid #d8e2e8;
  border-radius: 12px;
  padding: 0.45rem 0.64rem;
}

.explain-box {
  background: #eef7ff;
  border: 1px solid #cddff2;
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
}

.focus-box {
  background: #fff8e9;
  border: 1px solid #efd5a6;
  border-radius: 12px;
  padding: 0.68rem 0.78rem;
}

.rule-list > li {
  background: #fbfcfe;
  border: 1px solid #d8e2eb;
  border-radius: 10px;
  padding: 0.36rem 0.56rem;
}

.warning-list > li {
  background: #fff3e8;
  border: 1px solid #f0d4ba;
  border-radius: 10px;
  padding: 0.36rem 0.56rem;
}

.back-top {
  margin-top: 0.95rem;
}

.back-top a {
  color: #0e6159;
  text-decoration: none;
  font-weight: 700;
  font-family: "Trebuchet MS", "Gill Sans MT", sans-serif;
}

.back-top a:hover {
  color: #ab571d;
}

@media (max-width: 980px) {
  .page {
    width: min(1100px, calc(100% - 1.35rem));
  }

  .hero {
    border-radius: 20px;
  }
}

@media (max-width: 760px) {
  .page {
    width: min(1100px, calc(100% - 1rem));
    margin-top: 0.9rem;
  }

  .toc {
    grid-template-columns: 1fr;
  }

  .toc a {
    font-size: 0.96rem;
    padding: 0.62rem 0.72rem;
  }

  .question {
    border-left-width: 6px;
    padding: 0.95rem;
  }

  .hero h1 {
    font-size: clamp(1.35rem, 1.1rem + 2vw, 1.9rem);
  }

  .hero-lead,
  .hero-note {
    font-size: 0.96rem;
  }

  .question h2 {
    font-size: 1.22rem;
  }

  .question h3 {
    font-size: 1rem;
  }

  .question p,
  .question li {
    font-size: 0.99rem;
    line-height: 1.7;
  }
}

@media (max-width: 520px) {
  .page {
    width: min(1100px, calc(100% - 0.75rem));
  }

  .hero {
    padding: 0.92rem;
    border-radius: 16px;
  }

  .question {
    border-radius: 14px;
    padding: 0.84rem;
  }

  .hero-kicker {
    font-size: 0.72rem;
  }
  }
}

@media print {
  body {
    background: #fff;
  }

  .page-bg,
  .toc {
    display: none;
  }

  .hero,
  .question {
    box-shadow: none;
  }
}
