/* Word pages (/words/) and the vocabulary test. Loaded after blog.css and uses its tokens. */

:root {
  --a1: #138a52;
  --a2: #0e8f8e;
  --b1: #2f6fe0;
  --b2: #6d3df0;
  --c1: #b0359e;
  --c2: #c2334d;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --a1: #4fd08f;
    --a2: #3fd1cf;
    --b1: #7aa7ff;
    --b2: #a98bff;
    --c1: #e57fd6;
    --c2: #f07a8f;
  }
}

:root[data-theme='dark'] {
  --a1: #4fd08f;
  --a2: #3fd1cf;
  --b1: #7aa7ff;
  --b2: #a98bff;
  --c1: #e57fd6;
  --c2: #f07a8f;
}

/* ---- Level colours ---- */
.lvl-a1 { --lvl: var(--a1); }
.lvl-a2 { --lvl: var(--a2); }
.lvl-b1 { --lvl: var(--b1); }
.lvl-b2 { --lvl: var(--b2); }
.lvl-c1 { --lvl: var(--c1); }
.lvl-c2 { --lvl: var(--c2); }

.lvl {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  color: var(--lvl, var(--brand));
  border: 1px solid currentColor;
  background: var(--bg);
  text-decoration: none;
  white-space: nowrap;
}

a.chip {
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease;
}

a.chip:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.chip.on {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.chip small {
  color: var(--text-muted);
  font-size: 13px;
}

/* ---- Word page ---- */
.word-hero {
  padding-bottom: 8px;
}

.word-hero h1 {
  font-size: clamp(2.2rem, 6vw, 3.2rem);
  margin-bottom: 8px;
}

.word-sound {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  font-size: 1.2rem;
}

.word-ipa {
  color: var(--text-muted);
  font-weight: 400;
}

.word-sound .say {
  width: 40px;
  height: 40px;
  font-size: 18px;
}

.senses {
  list-style: none;
  counter-reset: sense;
  padding: 0;
  margin: 0 0 32px;
}

.senses li {
  counter-increment: sense;
  position: relative;
  padding: 16px 0 16px 40px;
  border-bottom: 1px solid var(--line);
}

.senses li::before {
  content: counter(sense);
  position: absolute;
  left: 0;
  top: 18px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 700;
  font-size: 14px;
  display: grid;
  place-items: center;
}

.senses .pos {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--brand);
}

.senses .def {
  margin: 4px 0;
  font-size: 1.1rem;
  color: var(--text);
}

.senses .ex {
  margin: 6px 0 0;
  padding-left: 12px;
  border-left: 3px solid var(--brand-line);
  color: var(--text-soft);
  font-style: italic;
}

.phrases {
  padding-left: 20px;
}

.related-words {
  margin-bottom: 12px;
}

.discover .btn-ghost {
  margin-left: 8px;
}

@media (max-width: 560px) {
  .discover .btn-ghost {
    margin: 10px 0 0;
  }
}

/* ---- Lists ---- */
.words-hero {
  text-align: left;
  padding-bottom: 8px;
}

.words-hero p {
  max-width: 720px;
  margin: 0 0 12px;
}

.words-hero .breadcrumb {
  font-size: 14px;
}

.words-hero .chips {
  margin-top: 16px;
}

.word-list {
  list-style: none;
  padding: 0;
  margin: 24px 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}

.word-list li {
  position: relative;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  min-width: 0;
}

.word-list li:hover {
  border-color: var(--brand-line);
}

.word-list a {
  color: var(--text);
  text-decoration: none;
  font-size: 1.1rem;
  padding-right: 48px;
  display: block;
}

.word-list a::after {
  content: '';
  position: absolute;
  inset: 0;
}

.word-list .lvl {
  position: absolute;
  top: 14px;
  right: 14px;
  padding: 2px 8px;
  font-size: 12px;
}

.word-list p {
  margin: 6px 0 0;
  color: var(--text-soft);
  font-size: 15px;
}

.word-list em {
  color: var(--text-muted);
}

.level-group {
  margin-top: 40px;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 48px;
}

.pager a,
.pager span {
  min-width: 40px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  text-align: center;
  text-decoration: none;
  color: var(--text-soft);
}

.pager span {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.level-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin: 16px 0 40px;
}

.level-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--lvl);
  background: var(--bg);
  text-decoration: none;
  color: var(--text);
}

.level-card b {
  font-size: 1.8rem;
  color: var(--lvl);
}

.level-card small {
  color: var(--text-muted);
}

.topic-chips {
  margin: 16px 0 64px;
}

/* ---- Vocabulary test ---- */
.test-card {
  margin: 8px 0 40px;
  padding: 28px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg);
  box-shadow: var(--shadow);
}

.test-progress {
  height: 6px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
  margin-bottom: 20px;
}

.test-progress i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--brand);
  transition: width 0.25s ease;
}

.test-count {
  margin: 0 0 6px;
  color: var(--text-muted);
  font-size: 14px;
}

.test-word {
  margin: 0 0 4px;
  font-size: clamp(2rem, 6vw, 2.6rem);
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
}

.test-q {
  margin: 0 0 20px;
  color: var(--text-soft);
}

.test-options {
  display: grid;
  gap: 10px;
}

.test-options button {
  text-align: left;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-alt);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.test-options button:hover,
.test-options button:focus-visible {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.test-options .idk {
  background: transparent;
  color: var(--text-muted);
  text-align: center;
}

.result-level {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 12px;
  margin: 4px 0 8px;
}

.result-level b {
  font-size: 3.4rem;
  line-height: 1;
  color: var(--lvl, var(--brand));
}

.result-bars {
  list-style: none;
  padding: 0;
  margin: 24px 0;
  display: grid;
  gap: 8px;
}

.result-bars li {
  display: grid;
  grid-template-columns: 36px 1fr 44px;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
}

.result-bars .bar {
  height: 10px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.result-bars .bar i {
  display: block;
  height: 100%;
  background: var(--lvl);
}

.missed {
  padding-left: 20px;
}

.missed li {
  margin-bottom: 6px;
}

.share-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

/* ---- Word list pages ---- */
.list-nav {
  margin: 0 0 24px;
}

.word-table td:first-child,
.word-table th:first-child {
  width: 44px;
  color: var(--text-muted);
  text-align: right;
}

.word-table td:nth-child(2) {
  white-space: nowrap;
}

.word-table td:nth-child(4) {
  color: var(--text-soft);
  font-style: italic;
}

.word-table em {
  color: var(--text-muted);
}

.list-cards {
  margin-top: 16px;
}

.list-cards .card h3 {
  font-size: 1.05rem;
}

.source-note {
  font-size: 14px;
  color: var(--text-muted);
}

/* ---- Compact Discover bar under the page title ---- */
.discover-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 4px 0 28px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--brand-line);
  background: var(--brand-soft);
  color: var(--text-soft);
  text-decoration: none;
  font-size: 15px;
  line-height: 1.45;
  transition: border-color 0.15s ease;
}

.discover-bar:hover {
  border-color: var(--brand);
}

.discover-bar-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
}

.discover-bar-icon svg {
  width: 20px;
  height: 20px;
}

.discover-bar-text strong {
  display: block;
  color: var(--text);
}

.discover-bar-btn {
  flex: none;
  margin-left: auto;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
}

@media (max-width: 560px) {
  .discover-bar {
    flex-wrap: wrap;
  }
  .discover-bar-btn {
    margin-left: 50px;
  }
}

/* ---- Test start card (prominent) ---- */
.test-intro {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 24px;
  align-items: center;
  padding: 36px;
  border: 1px solid var(--brand-line);
  background:
    radial-gradient(circle at 100% 0%, rgba(141, 41, 218, 0.18), transparent 55%),
    linear-gradient(135deg, var(--brand-soft), var(--bg));
  box-shadow: 0 18px 48px rgba(141, 41, 218, 0.16);
}

.intro-tag {
  display: inline-block;
  margin-bottom: 12px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.test-intro .test-word {
  font-size: clamp(1.7rem, 4.5vw, 2.3rem);
  line-height: 1.15;
  margin-bottom: 16px;
}

.intro-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.intro-facts li {
  padding: 6px 10px;
  border-radius: 12px;
  border: 1px solid var(--brand-line);
  background: var(--bg);
  font-size: 14px;
  color: var(--text-soft);
}

.intro-facts strong {
  color: var(--brand);
  font-size: 16px;
  margin-right: 2px;
}

.btn.btn-lg {
  padding: 16px 32px;
  font-size: 18px;
  box-shadow: 0 8px 24px rgba(141, 41, 218, 0.35);
}

.intro-preview {
  padding: 20px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--bg);
  box-shadow: var(--shadow);
  transform: rotate(1.5deg);
}

.intro-preview-label {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.intro-preview-word {
  margin: 4px 0 12px;
  font-size: 1.5rem;
  font-weight: 800;
}

.intro-opt {
  display: block;
  margin-top: 8px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font-size: 14px;
  color: var(--text-soft);
}

.intro-opt.is-right {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--text);
  font-weight: 600;
}

.intro-opt.idk {
  border-style: dashed;
  color: var(--text-muted);
}

@media (max-width: 720px) {
  .test-intro {
    grid-template-columns: 1fr;
    padding: 24px;
  }
  .intro-preview {
    display: none;
  }
  .btn.btn-lg {
    width: 100%;
    text-align: center;
  }
}
