:root {
  --blue: #157df0;
  --blue-dark: #0d66c9;
  --yellow: #ffc107;
  --bg: #edf1f4;
  --text: #1f2f46;
  --muted: #6b7b93;
  --white: #ffffff;
  --line: #dce4ec;
  --shadow: 0 10px 30px rgba(26, 43, 65, 0.08);
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Inter, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
}

a { color: inherit; text-decoration: none; }
.container { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }

.hero {
  background: var(--blue);
  color: var(--white);
  padding: 44px 0 26px;
  border-bottom: 4px solid var(--blue-dark);
}
.hero__inner { display: flex; flex-direction: column; gap: 22px; }
.hero__title {
  margin: 0;
  text-align: center;
  font-size: clamp(28px, 4vw, 52px);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.search-panel {
  position: relative;
  width: min(860px, 100%);
  margin: 0 auto;
}

.pair-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
.pair-row label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.92);
}
.pair-row select {
  border: 0;
  border-radius: 12px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.98);
  color: var(--text);
  font-size: 15px;
}

.search-box {
  display: grid;
  grid-template-columns: 1fr 170px;
  background: var(--white);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.search-box input {
  border: 0;
  outline: 0;
  padding: 20px 22px;
  font-size: 24px;
  color: var(--text);
  background: var(--white);
}
.search-box button {
  border: 0;
  background: var(--yellow);
  font-size: 24px;
  font-weight: 800;
  cursor: pointer;
  color: #27211a;
}
.search-box button:hover { filter: brightness(0.97); }
.hint {
  margin: 10px 0 0;
  text-align: center;
  color: rgba(255, 255, 255, 0.92);
}

.search-results {
  display: none;
  position: absolute;
  top: calc(100% - 8px);
  left: 0;
  right: 0;
  background: var(--white);
  color: var(--text);
  border-radius: 16px;
  box-shadow: var(--shadow);
  z-index: 20;
  overflow: hidden;
}
.search-results--show { display: block; }
.suggestion-item {
  width: 100%;
  display: grid;
  gap: 3px;
  text-align: left;
  border: 0;
  background: var(--white);
  padding: 14px 18px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
}
.suggestion-item:last-child { border-bottom: 0; }
.suggestion-item:hover { background: #f7faff; }
.suggestion-item strong { font-size: 18px; color: var(--text); }
.suggestion-item small { color: #ee7f1b; font-size: 14px; }
.suggestion-item span { color: var(--muted); font-size: 14px; }

.pair-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}
.pair-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.14);
  color: #fff;
  font-size: 14px;
}
.pair-pill small {
  opacity: 0.85;
  font-size: 12px;
}
.pair-pill--active { background: rgba(255,255,255,0.28); }

.page { padding: 26px 0 60px; }
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.stat-box {
  background: var(--white);
  border-radius: 16px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 4px;
}
.stat-box strong { font-size: 28px; }
.stat-box span { color: var(--muted); text-transform: uppercase; font-size: 12px; letter-spacing: 0.08em; }

.word-card {
  background: var(--white);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 30px;
  margin-bottom: 28px;
}
.word-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}
.word-title {
  margin: 0;
  font-size: clamp(36px, 7vw, 72px);
  line-height: 0.95;
  letter-spacing: -0.04em;
}
.transcription {
  margin-top: 12px;
  font-size: 34px;
  color: #f08122;
}
.romanization { color: var(--muted); margin-top: 8px; }
.word-link {
  background: #eff6ff;
  color: var(--blue-dark);
  border-radius: 999px;
  padding: 10px 14px;
  white-space: nowrap;
}
.definition-box {
  border-left: 5px solid var(--blue);
  background: #f9fbfd;
  border-radius: 12px;
  padding: 18px 18px 18px 20px;
}
.definition-box h3 { margin: 0 0 10px; color: var(--blue-dark); }
.definition-box p { margin: 0; font-size: 21px; color: #394a62; }
.meta-section { margin-top: 18px; }
.meta-section h3 { margin: 0 0 10px; font-size: 20px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 10px; }
.tag-item {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  background: #f3f7fb;
  border-radius: 999px;
  padding: 8px 12px;
  color: #3a4f6a;
}
.tag-item b { color: var(--blue-dark); }
.tag-item small { color: var(--muted); }

.list-section { margin-top: 24px; }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
}
.section-head h2 { margin: 0; font-size: 34px; }
.section-note { color: var(--muted); }
.word-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}
.word-grid-item {
  display: grid;
  gap: 8px;
  background: var(--white);
  border-radius: 18px;
  padding: 18px;
  min-height: 190px;
  box-shadow: var(--shadow);
  border: 1px solid transparent;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.word-grid-item:hover {
  transform: translateY(-4px);
  border-color: #c9dbef;
}
.word-grid-item__title { font-size: 28px; font-weight: 800; color: var(--blue-dark); }
.word-grid-item__sub { color: #f08122; }
.word-grid-item__def { color: #4a5e77; font-size: 15px; }
.word-grid-item__more { margin-top: auto; color: var(--blue); font-weight: 700; }

.empty-card, .empty-state {
  background: var(--white);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 20px;
  color: var(--muted);
}
.footer {
  padding: 26px 0 42px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1024px) {
  .word-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
  .pair-row,
  .stats-grid,
  .word-grid,
  .search-box,
  .word-card__header,
  .section-head {
    grid-template-columns: 1fr;
    flex-direction: column;
  }
  .search-box button { padding: 16px; }
  .search-box input { font-size: 18px; padding: 16px; }
  .transcription { font-size: 24px; }
  .definition-box p { font-size: 18px; }
  .word-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 520px) {
  .container { width: min(100% - 20px, 1120px); }
  .hero { padding-top: 26px; }
  .hero__title { font-size: 26px; }
  .pair-row { grid-template-columns: 1fr; }
  .word-card { padding: 18px; }
  .word-grid { grid-template-columns: 1fr; }
  .section-head h2 { font-size: 28px; }
}
