:root {
  --bg: #f7f8fc;
  --card: #ffffff;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --soft: #f3f4f6;
  --accent: #eef2ff;
  --blue: #1d4ed8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #fcfcff 0%, #f6f7fb 100%);
}

.wrap {
  max-width: 1380px;
  margin: 0 auto;
  padding: 24px;
}

.hero, section {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.04);
}

.hero {
  margin-bottom: 20px;
}

.eyebrow {
  display: inline-block;
  background: var(--accent);
  color: #3730a3;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 6px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}

h1 {
  margin: 0 0 10px;
  font-size: clamp(30px, 5vw, 54px);
  line-height: 1.06;
}

.lead {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
  font-size: 16px;
  max-width: 980px;
}

.toc {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.toc a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  background: #fff;
  text-align: center;
  font-weight: 700;
  font-size: 14px;
  min-height: 64px;
  line-height: 1.25;
  white-space: normal;
  word-break: break-word;
}

section {
  margin-top: 22px;
}

h2 {
  margin: 0 0 8px;
  font-size: 28px;
}

.note {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.7;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 14px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  background: #fff;
}

.grammar {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 8px;
}

.usage {
  display: inline-block;
  background: #eff6ff;
  color: var(--blue);
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 10px;
}

.row {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.jp {
  margin: 0 0 6px;
  font-size: 17px;
  line-height: 1.8;
  font-weight: 700;
}

.en,
.explain,
.pattern {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
  font-size: 14px;
}

.pattern {
  margin-bottom: 8px;
}

.explain {
  margin-top: 6px;
}

.footer {
  margin: 24px 0 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  color: var(--muted);
  line-height: 1.75;
  font-size: 14px;
}

@media (max-width: 1100px) {
  .toc {
    grid-template-columns: repeat(3, minmax(0,1fr));
  }
}

.back-to-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--blue);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  text-align: center;
  line-height: 40px;
  text-decoration: none;
  font-size: 20px;
  font-weight: bold;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  transition: background 0.3s;
  z-index: 1000;
}

.back-to-top:hover {
  background: #1e40af;
}

.nav-links {
  text-align: center;
  margin: 20px 0;
}

.nav-links a {
  display: inline-block;
  background: var(--bg); /* almost white */
  color: #111827; /* dark text */
  padding: 10px 20px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: bold;
  transition: all 0.3s;
  border: 1px solid var(--line);
}

.nav-links a:hover {
  background: var(--soft);
  color: #374151;
}

@media (max-width: 860px) {
  .grid {
    grid-template-columns: 1fr;
  }
  .toc {
    grid-template-columns: repeat(2, minmax(0,1fr));
  }
}

@media (max-width: 560px) {
  .wrap {
    padding: 14px;
  }
  .hero,
  section {
    padding: 18px;
    border-radius: 18px;
  }
  .toc {
    grid-template-columns: 1fr;
  }
  .grammar {
    font-size: 22px;
  }
}
