:root {
  color-scheme: light;
  --ink: #18191f;
  --muted: #5f6673;
  --line: #d9d5ca;
  --paper: #fbf8f0;
  --card: #fffdf8;
  --blue: #2667ff;
  --green: #197b63;
  --gold: #d99a00;
  --red: #d94f45;
  --shadow: 0 18px 44px rgba(36, 31, 21, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Yu Gothic", "Hiragino Sans", sans-serif;
  background: var(--paper);
  color: var(--ink);
  letter-spacing: 0;
}

.hero {
  min-height: 92vh;
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(340px, 0.98fr);
  gap: 36px;
  align-items: center;
  padding: 56px clamp(20px, 5vw, 84px) 34px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--green);
  font-size: 0.86rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2.4rem, 5.5vw, 5.8rem);
  line-height: 1.02;
  letter-spacing: 0;
  max-width: 12ch;
}

.lead {
  max-width: 680px;
  margin: 26px 0 0;
  color: #34373f;
  font-size: clamp(1.04rem, 1.7vw, 1.34rem);
  line-height: 1.85;
  font-weight: 600;
}

.hero__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.hero__stats span {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid var(--ink);
  background: #fff;
  font-weight: 800;
}

.hero__visual {
  margin: 0;
  align-self: stretch;
  display: flex;
  align-items: center;
}

.hero__visual img {
  display: block;
  width: 100%;
  height: auto;
  border: 3px solid var(--ink);
  box-shadow: var(--shadow);
}

main { padding: 28px clamp(16px, 4vw, 64px) 48px; }

.toolband {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 18px;
  align-items: end;
  padding: 16px 0 18px;
  background: rgba(251, 248, 240, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.searchbox label {
  display: block;
  margin-bottom: 7px;
  font-size: 0.78rem;
  font-weight: 900;
  color: var(--muted);
  text-transform: uppercase;
}

input[type="search"] {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 2px solid var(--ink);
  background: #fff;
  color: var(--ink);
  font-size: 1rem;
  border-radius: 6px;
}

.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

button {
  font: inherit;
  cursor: pointer;
}

.filter {
  min-height: 42px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: #fff;
  padding: 8px 12px;
  font-weight: 800;
}

.filter.is-active {
  background: var(--ink);
  color: #fff;
}

.intro-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin: 28px 0;
}

.intro-grid article,
.detail,
.group-list {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(36, 31, 21, 0.06);
}

.intro-grid article { padding: 20px; }

h2, h3, p { margin-top: 0; }

.intro-grid h2 {
  font-size: 1.05rem;
  margin-bottom: 10px;
}

.intro-grid p {
  color: #3e424b;
  line-height: 1.75;
  margin-bottom: 0;
}

.layout {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.group-list {
  position: sticky;
  top: 94px;
  max-height: calc(100vh - 116px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 { margin: 0; font-size: 1rem; }
#resultCount { color: var(--muted); font-size: 0.9rem; font-weight: 700; }

.group-list__items {
  overflow: auto;
  padding: 8px;
}

.group-button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 6px;
  background: transparent;
  padding: 12px 10px;
  color: var(--ink);
}

.group-button:hover,
.group-button.is-active { background: #efe8d8; }

.group-button strong {
  display: block;
  font-size: 0.98rem;
  margin-bottom: 6px;
}

.group-button span {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.detail {
  min-height: 70vh;
  padding: clamp(20px, 4vw, 42px);
}

.detail__top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 22px;
  margin-bottom: 24px;
}

.tag {
  display: inline-block;
  padding: 5px 9px;
  border-radius: 5px;
  background: #e8f2ef;
  color: var(--green);
  font-size: 0.82rem;
  font-weight: 900;
  margin-bottom: 12px;
}

.detail h2 {
  font-size: clamp(1.8rem, 3.6vw, 3.5rem);
  line-height: 1.1;
  margin-bottom: 14px;
}

.summary {
  color: #34373f;
  font-size: 1.06rem;
  line-height: 1.82;
  font-weight: 600;
  margin-bottom: 0;
}

.word-count {
  min-width: 94px;
  text-align: center;
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  font-weight: 900;
}

.word-count strong {
  display: block;
  font-size: 2rem;
}

.section-title {
  font-size: 1rem;
  text-transform: uppercase;
  color: var(--muted);
  margin: 28px 0 12px;
  letter-spacing: 0;
}

.axis-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.axis-card div {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 16px;
  line-height: 1.75;
}

.choice-guide {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 12px;
}

.choice-row {
  border: 1px solid var(--line);
  border-top: 5px solid var(--green);
  background: #fff;
  border-radius: 8px;
  padding: 14px;
}

.choice-row h3 {
  font-size: 1.25rem;
  margin-bottom: 8px;
}

.choice-row p {
  color: #384152;
  line-height: 1.65;
  margin-bottom: 8px;
}

.words {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.word-card {
  border: 1px solid var(--line);
  border-left: 6px solid var(--blue);
  background: #fff;
  border-radius: 8px;
  padding: 14px;
}

.word-card h3 {
  font-size: 1.35rem;
  margin-bottom: 8px;
  line-height: 1.25;
}

.word-card p {
  color: #3f4652;
  line-height: 1.65;
  margin-bottom: 10px;
}

.word-card .core {
  background: #f3f7ff;
  border-radius: 6px;
  padding: 9px;
  color: #1d3f8b;
  font-weight: 700;
}

.source {
  color: var(--muted);
  font-size: 0.82rem;
}

.examples {
  display: grid;
  gap: 10px;
  counter-reset: example;
}

.example {
  position: relative;
  padding: 14px 14px 14px 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  line-height: 1.75;
}

.example__sentence {
  font-size: 1.02rem;
  color: #151923;
  margin-bottom: 8px;
}

.example__translation,
.example__reason {
  color: #3f4652;
  margin-top: 8px;
}

.example__translation span,
.example__reason span {
  display: inline-block;
  min-width: 44px;
  margin-right: 8px;
  border-radius: 999px;
  background: #eef2f7;
  color: #283141;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 900;
}

.focus-word {
  color: #123d8c;
  text-decoration-thickness: 3px;
  text-underline-offset: 4px;
}

.example::before {
  counter-increment: example;
  content: counter(example);
  position: absolute;
  left: 13px;
  top: 14px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--gold);
  color: #111;
  display: grid;
  place-items: center;
  font-size: 0.82rem;
  font-weight: 900;
}

footer {
  padding: 20px clamp(16px, 4vw, 64px) 42px;
  color: var(--muted);
}

@media (max-width: 980px) {
  .hero,
  .layout,
  .intro-grid,
  .toolband,
  .axis-card,
  .detail__top { grid-template-columns: 1fr; }
  .hero { min-height: auto; }
  h1 { max-width: none; }
  .filters { justify-content: flex-start; }
  .group-list { position: static; max-height: none; }
}

@media (max-width: 560px) {
  .hero { padding-top: 30px; }
  main { padding-inline: 12px; }
  .hero__stats span, .filter { width: 100%; justify-content: center; }
  .word-count { width: 100%; }
}
