:root {
  --bg: #f4faf6;
  --panel: #ffffff;
  --panel-soft: #edf8f1;
  --ink: #172d22;
  --muted: #62766c;
  --line: #d7e8dc;
  --accent: #55b875;
  --accent-dark: #287849;
  --accent-pale: #e6f7eb;
  --mark: #fff1a8;
  --danger: #d85b5b;
  --shadow: 0 18px 48px rgba(36, 82, 55, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(85, 184, 117, 0.2), transparent 28rem),
    var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  font-size: 18px;
  line-height: 1.65;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--line);
  background: rgba(244, 250, 246, 0.92);
  backdrop-filter: blur(14px);
}

.topbar,
.hero,
.section,
.footer {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 0;
}

.brand,
.nav-links {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  font-size: 1.25rem;
  font-weight: 900;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
}

.nav-links a {
  border-radius: 999px;
  color: var(--muted);
  padding: 6px 12px;
  font-weight: 800;
}

.nav-links a[aria-current="page"] {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 18px rgba(85, 184, 117, 0.22);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 28px;
  align-items: end;
  padding: 54px 0 34px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-size: 0.9rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 880px;
  margin: 0;
  font-size: clamp(2.35rem, 5vw, 5rem);
  line-height: 1.06;
  letter-spacing: 0;
}

.hero-card,
.sidebar,
.word-detail,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.hero-card {
  display: grid;
  gap: 8px;
  padding: 22px;
}

.mobile-panel-toggle,
.mobile-panel-head {
  display: none;
}

.hero-card span,
.hero-card p {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.hero-card strong {
  font-size: 2.6rem;
  line-height: 1;
}

.section {
  padding: 36px 0 68px;
}

.daily-page {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.daily-controls {
  display: grid;
  gap: 16px;
  position: sticky;
  top: 88px;
  padding: 20px;
}

.daily-controls label {
  color: var(--muted);
  font-weight: 900;
}

.daily-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.daily-reader {
  padding: 28px;
}

.daily-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.daily-title-row h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.08;
}

.daily-intro {
  margin: 18px 0 0;
  color: var(--muted);
  font-weight: 800;
}

.daily-audio {
  display: grid;
  grid-template-columns: auto auto minmax(220px, 1fr);
  gap: 12px;
  align-items: center;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 14px;
}

.daily-audio[hidden] {
  display: none;
}

.daily-audio audio {
  width: 100%;
  min-width: 220px;
}

.daily-lookup {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 40;
  display: grid;
  width: min(520px, calc(100vw - 44px));
  max-height: min(70vh, 520px);
  gap: 12px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 22px 60px rgba(23, 45, 34, 0.22);
  padding: 18px;
  transform: translateY(calc(100% + 34px));
  opacity: 0;
  pointer-events: none;
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.daily-lookup.open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.lookup-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding-right: 36px;
}

.lookup-close {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--ink);
  font-size: 1.35rem;
  font-weight: 900;
}

.daily-lookup h3,
.daily-lookup p {
  margin: 0;
}

.daily-lookup h3 {
  font-size: 1.35rem;
  line-height: 1.2;
}

.lookup-head > div:first-child p:last-child {
  color: var(--muted);
  font-weight: 800;
}

.lookup-meaning {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line);
  color: var(--muted);
  padding-top: 12px;
}

.lookup-meaning-list {
  display: grid;
  gap: 8px;
}

.lookup-meaning-list p {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 10px;
  margin: 0;
  color: var(--ink);
}

.lookup-meaning-list span {
  color: var(--accent-dark);
  font-weight: 900;
}

.lookup-example {
  margin-top: 14px;
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 12px;
}

.lookup-example strong,
.lookup-example small {
  color: var(--muted);
  font-weight: 900;
}

.lookup-example p {
  margin: 6px 0 4px;
  color: var(--ink);
}

.daily-content {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.daily-paragraph {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff, #f8fcf9);
  padding: 16px;
}

.daily-paragraph span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 999px;
  background: var(--accent-pale);
  color: var(--accent-dark);
  font-size: 0.9rem;
  font-weight: 900;
}

.daily-paragraph p {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.75;
}

.daily-bilingual {
  display: grid;
  gap: 10px;
}

.daily-bilingual p {
  margin: 0;
}

.daily-bilingual small {
  display: block;
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--muted);
  padding: 10px 12px;
  font-size: 1rem;
  line-height: 1.65;
}

.daily-word {
  display: inline;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  line-height: inherit;
  padding: 0 1px;
  text-align: inherit;
}

.daily-word:hover,
.daily-word.active {
  background: var(--mark);
  color: var(--ink);
}

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

.sidebar {
  display: grid;
  gap: 16px;
  position: sticky;
  top: 88px;
  max-height: calc(100vh - 110px);
  padding: 20px;
  overflow: hidden;
}

.sidebar label {
  color: var(--muted);
  font-weight: 900;
}

.side-title {
  margin: 6px 0 10px;
  font-size: 1.08rem;
  line-height: 1.25;
}

select,
input {
  width: 100%;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 14px;
  outline: none;
}

select:focus,
input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(85, 184, 117, 0.14);
}

.progress-box {
  display: grid;
  gap: 8px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-weight: 900;
}

.progress-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e1eee6;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.25s ease;
}

.word-list {
  display: grid;
  gap: 8px;
  overflow: auto;
  padding-right: 4px;
}

.word-list.compact {
  max-height: 360px;
}

.word-item {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.word-item.active {
  border-color: var(--accent);
  background: var(--accent-pale);
}

.word-item span {
  font-weight: 900;
}

.word-item small {
  color: var(--muted);
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.word-detail {
  display: grid;
  gap: 18px;
  padding: 22px;
}

.word-hero {
  display: grid;
  justify-items: center;
  gap: 18px;
  align-items: center;
  position: relative;
  overflow: hidden;
  padding: 32px;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(230, 247, 235, 0.95)),
    var(--panel-soft);
  box-shadow: inset 0 0 0 1px rgba(85, 184, 117, 0.12), 0 14px 30px rgba(36, 82, 55, 0.09);
  text-align: center;
  touch-action: pan-y;
  transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.22s ease, box-shadow 0.26s ease;
  will-change: transform, opacity;
}

.word-hero::after {
  content: "";
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(40, 120, 73, 0.9);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1;
  opacity: 0;
  transform: translateY(-6px) scale(0.96);
  transition: opacity 0.16s ease, transform 0.16s ease;
  pointer-events: none;
}

.word-hero.switch-next::after {
  content: "下一个";
  opacity: 1;
  transform: translateY(0) scale(1);
}

.word-hero.switch-prev::after {
  content: "上一个";
  opacity: 1;
  transform: translateY(0) scale(1);
}

.word-hero.switch-out-left {
  opacity: 0.18;
  transform: translateX(-26px) scale(0.992);
  box-shadow: inset 0 0 0 1px rgba(85, 184, 117, 0.18), 0 8px 18px rgba(36, 82, 55, 0.07);
}

.word-hero.switch-out-right {
  opacity: 0.18;
  transform: translateX(26px) scale(0.992);
  box-shadow: inset 0 0 0 1px rgba(85, 184, 117, 0.18), 0 8px 18px rgba(36, 82, 55, 0.07);
}

.word-hero.switch-in-left {
  opacity: 0;
  transform: translateX(-30px) scale(0.992);
  transition-duration: 0s;
}

.word-hero.switch-in-right {
  opacity: 0;
  transform: translateX(30px) scale(0.992);
  transition-duration: 0s;
}

.word-hero h2 {
  margin: 0;
  color: var(--accent-dark);
  font-size: clamp(3.4rem, 8vw, 7rem);
  line-height: 0.98;
  letter-spacing: 0;
  word-break: break-word;
}

.phonetic {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 1.25rem;
  font-weight: 800;
}

.phonetic-badge {
  display: inline-flex;
  align-items: center;
  margin: 0 8px 8px 0;
  border: 1px solid #d6e2da;
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  padding: 6px 12px;
  font-size: 1.08rem;
  font-weight: 900;
  line-height: 1.3;
}

.ipa-vowel {
  color: #d92d20;
}

.ipa-consonant {
  color: #155eef;
}

.ipa-mark {
  color: #f79009;
}

.phonetic-muted {
  color: var(--muted);
  font-weight: 800;
}

.sound-button {
  display: grid;
  width: 68px;
  height: 68px;
  min-width: 68px;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 12px 24px rgba(85, 184, 117, 0.28);
  font-size: 1.2rem;
  font-weight: 900;
}

.sound-button span {
  position: relative;
  display: block;
  width: 0;
  height: 0;
  margin-left: 4px;
  border-top: 12px solid transparent;
  border-bottom: 12px solid transparent;
  border-left: 18px solid #fff;
}

.sound-button.is-stopped span {
  display: flex;
  width: 22px;
  height: 24px;
  margin-left: 0;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  background: transparent;
}

.sound-button.is-stopped span::before,
.sound-button.is-stopped span::after {
  content: "";
  display: block;
  width: 7px;
  height: 24px;
  border-radius: 3px;
  background: #fff;
}

.word-audio-box {
  display: grid;
  justify-items: center;
  gap: 10px;
}

.word-audio-box p {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.sound-button.is-playing {
  background: var(--accent-dark);
}

.sound-button.is-waiting {
  background: #87cfa0;
}

.sound-button.has-error {
  background: var(--danger);
}

.swipe-guide {
  display: flex;
  width: fit-content;
  max-width: 100%;
  gap: 7px;
  align-items: center;
  justify-content: center;
  justify-self: center;
  padding: 8px 10px;
  border: 1px solid rgba(85, 184, 117, 0.28);
  border-radius: 8px;
  background: rgba(230, 247, 235, 0.58);
  color: var(--accent-dark);
  text-align: center;
  font-size: 0.9rem;
  font-weight: 800;
  white-space: nowrap;
}

.swipe-guide strong::before,
.swipe-guide strong::after {
  content: "·";
  margin: 0 7px 0 0;
  color: rgba(98, 118, 108, 0.58);
  font-weight: 700;
}

.swipe-guide strong::after {
  margin: 0 0 0 7px;
}

.swipe-guide span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.button {
  display: inline-flex;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 900;
}

.primary {
  background: var(--accent);
  color: #fff;
}

.secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.floating-settings {
  display: none;
}

.panel {
  display: grid;
  gap: 16px;
  padding: 22px;
  box-shadow: none;
}

.important-panel {
  border-color: rgba(85, 184, 117, 0.45);
  background: #fbfffc;
}

.panel-heading h3 {
  margin: 0;
  font-size: clamp(1.45rem, 3vw, 2.2rem);
  line-height: 1.16;
}

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

.meaning-card,
.example-card,
.context-card,
.dictionary-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 15px;
}

.meaning-card strong,
.dictionary-card strong {
  color: var(--accent-dark);
  font-size: 1.08rem;
}

.meaning-card p,
.example-card p,
.context-card p,
.dictionary-card p {
  margin: 7px 0 0;
}

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

.usage-grid h4 {
  margin: 0 0 10px;
  font-size: 1.12rem;
}

.stack,
.context-list,
.dictionary-panel {
  display: grid;
  gap: 10px;
}

.example-card span,
.context-card span,
.context-card small,
.dictionary-card span,
.dictionary-card small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.context-card {
  display: grid;
  gap: 8px;
  background: var(--panel-soft);
}

.lesson-audio {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--accent-pale);
}

.lesson-audio strong,
.lesson-audio span {
  display: block;
}

.lesson-audio span {
  color: var(--muted);
}

audio {
  width: 100%;
}

.context-card strong {
  font-size: 1.05rem;
}

.article-page {
  display: grid;
  gap: 22px;
}

.article-page-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.article-page-head h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 1.1;
}

.article-controls {
  display: grid;
  grid-template-columns: auto minmax(190px, 1fr) auto minmax(260px, 1.2fr);
  gap: 10px;
  align-items: center;
  min-width: min(100%, 680px);
}

.article-controls label {
  color: var(--muted);
  font-weight: 900;
}

.article-reader {
  display: grid;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 22px;
}

.article-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 420px);
  gap: 18px;
  align-items: center;
  padding: 24px;
  border-radius: 8px;
  background: var(--panel-soft);
}

.article-audio-box {
  display: grid;
  justify-items: center;
  gap: 14px;
  align-content: center;
  text-align: center;
}

.article-audio-box .button {
  width: max-content;
  min-width: 140px;
}

.article-audio-box .button.is-playing {
  background: var(--accent-dark);
}

.article-audio-box p {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.article-title-row h3 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 1.12;
}

.article-title-row p {
  margin: 8px 0 0;
  color: var(--muted);
  font-weight: 800;
}

.article-content {
  display: grid;
  gap: 10px;
}

.article-line {
  display: grid;
  gap: 6px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.article-line p {
  margin: 0;
  font-size: 1.22rem;
  font-weight: 900;
  line-height: 1.45;
}

.article-line span {
  color: var(--muted);
}

.phonetic-hero {
  padding-bottom: 20px;
}

.phonetic-page {
  padding-top: 20px;
}

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

.phonetic-picker {
  display: grid;
  gap: 18px;
  position: sticky;
  top: 88px;
  max-height: calc(100vh - 110px);
  overflow: auto;
  padding: 20px;
}

.phonetic-settings {
  display: none;
}

.phonetic-groups,
.phonetic-group {
  display: grid;
  gap: 12px;
}

.phonetic-group {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.phonetic-group:first-child {
  padding-top: 0;
  border-top: 0;
}

.phonetic-group h3 {
  margin: 0;
  color: var(--accent-dark);
  font-size: 1rem;
}

.phonetic-chip-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.phonetic-chip {
  display: grid;
  min-height: 74px;
  align-content: center;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: center;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.phonetic-chip strong {
  font-size: 1.5rem;
  line-height: 1.05;
}

.phonetic-chip span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 900;
}

.phonetic-chip:hover,
.phonetic-chip.active {
  border-color: rgba(85, 184, 117, 0.8);
  background: var(--accent-pale);
  box-shadow: 0 10px 24px rgba(36, 82, 55, 0.1);
  transform: translateY(-1px);
}

.phonetic-study {
  display: grid;
  gap: 18px;
  padding: 22px;
}

.phonetic-video-card {
  display: grid;
  gap: 16px;
  padding: 22px;
  border: 1px solid rgba(85, 184, 117, 0.24);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(230, 247, 235, 0.88)),
    var(--panel-soft);
}

.phonetic-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.phonetic-title-row h2 {
  margin: 0;
  color: var(--accent-dark);
  font-size: clamp(3rem, 7vw, 5.4rem);
  line-height: 1;
}

.phonetic-video-card video {
  width: 100%;
  min-height: 260px;
  max-height: 520px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #102015;
  object-fit: contain;
}

.phonetic-info-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 16px;
}

.phonetic-info-grid h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.phonetic-tip {
  display: grid;
  gap: 8px;
}

.phonetic-tip p {
  margin: 0;
  font-weight: 700;
  line-height: 1.55;
}

.phonetic-tip span {
  display: block;
  padding: 9px 11px;
  border: 1px solid rgba(85, 184, 117, 0.28);
  border-radius: 8px;
  background: rgba(230, 247, 235, 0.62);
  color: var(--accent-dark);
  font-weight: 700;
  line-height: 1.45;
}

.phonetic-word-list {
  display: grid;
  gap: 10px;
}

.phonetic-word-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 8px 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.phonetic-word-card > div {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}

.phonetic-word-card strong {
  color: var(--accent-dark);
  font-size: 1.28rem;
  line-height: 1.1;
  font-weight: 800;
}

.phonetic-word-card span {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 900;
}

.meaning-lines,
.phonetic-word-card small {
  grid-column: 1 / -1;
  margin: 0;
}

.meaning-lines {
  display: grid;
  gap: 4px;
  padding-left: 1.1em;
  color: var(--ink);
  font-weight: 500;
  line-height: 1.45;
}

.meaning-lines li::marker {
  color: var(--accent);
}

.phonetic-word-card small {
  color: var(--muted);
  font-weight: 500;
  line-height: 1.45;
}

.phonetic-word-card.is-loading {
  opacity: 0.72;
}

.dict-hero h1 {
  max-width: 720px;
}

.dict-page {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.dict-filter {
  position: sticky;
  top: 88px;
}

.dict-filter label,
.dict-filter-block strong {
  color: var(--muted);
  font-weight: 900;
}

.dict-filter-block {
  display: grid;
  gap: 10px;
}

.dict-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dict-filter-chip {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  padding: 6px 12px;
  font-size: 0.9rem;
  font-weight: 900;
}

.dict-static-chip {
  min-height: 36px;
  border: 1px solid rgba(85, 184, 117, 0.28);
  border-radius: 999px;
  background: var(--accent-pale);
  color: var(--accent-dark);
  padding: 6px 12px;
  font-size: 0.9rem;
  font-weight: 900;
}

.dict-filter-chip.active {
  border-color: rgba(85, 184, 117, 0.8);
  background: var(--accent-pale);
  color: var(--accent-dark);
}

.dict-content,
.dict-groups,
.dict-group,
.dict-tag-section {
  display: grid;
  gap: 16px;
}

.dict-heading-row,
.dict-group-title,
.dict-tag-title,
.dict-card-top,
.dict-word-row > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.dict-result-count,
.dict-group-title span,
.dict-tag-title span,
.dict-preview-meta {
  color: var(--muted);
  font-weight: 800;
}

.dict-group-title h4 {
  margin: 0;
  color: var(--accent-dark);
  font-size: 1.35rem;
}

.dict-tag-title {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

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

.dict-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
}

.dict-card.compact {
  background: var(--panel-soft);
}

.dict-card-top p,
.dict-card-top h4,
.dict-card-desc,
.dict-preview-meta {
  margin: 0;
}

.dict-card-top p {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 900;
}

.dict-card-top h4 {
  font-size: 1.25rem;
  line-height: 1.18;
}

.dict-card-top strong {
  color: var(--accent-dark);
  font-size: 1.35rem;
  line-height: 1;
}

.dict-card-desc {
  min-height: 2.8em;
  color: var(--muted);
  line-height: 1.45;
}

.dict-card-tags {
  display: flex;
  min-height: 28px;
  flex-wrap: wrap;
  gap: 6px;
}

.dict-card-tags span {
  border-radius: 999px;
  background: var(--accent-pale);
  color: var(--accent-dark);
  padding: 3px 9px;
  font-size: 0.78rem;
  font-weight: 900;
}

.dict-card .button {
  width: 100%;
}

.dict-feature-blocks,
.dict-feature-section {
  display: grid;
  gap: 16px;
}

.dict-feature-section {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.dict-feature-section:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.dict-feature-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
}

.dict-feature-title h4 {
  margin: 0;
  color: var(--accent-dark);
  font-size: 1.32rem;
  line-height: 1.2;
}

.dict-study-detail .example-card span {
  white-space: pre-line;
}

.dict-search-results {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
}

.dict-search-result {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
  text-align: left;
}

.dict-search-result strong {
  color: var(--accent-dark);
  font-size: 1rem;
}

.dict-search-result span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.dict-preview-panel {
  scroll-margin-top: 92px;
}

.dict-preview-list {
  display: grid;
  gap: 10px;
}

.dict-word-row {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.dict-word-row strong {
  color: var(--accent-dark);
  font-size: 1.3rem;
}

.dict-word-phonetic {
  color: var(--muted);
  font-weight: 900;
}

.dict-word-row ul {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 1.2em;
}

.dict-word-row li span {
  margin-right: 6px;
  color: var(--accent-dark);
  font-weight: 900;
}

.word-sound-mini {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
}

.word-sound-mini.is-loading {
  background: #87cfa0;
}

.word-sound-mini.is-playing {
  background: var(--accent-dark);
}

.word-sound-mini.has-error {
  background: var(--danger);
}

.word-sound-mini:disabled {
  opacity: 0.48;
}

.word-sound-mini span {
  position: relative;
  display: block;
  width: 0;
  height: 0;
  margin-left: 3px;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 12px solid #fff;
}

.word-sound-mini.is-loading span,
.word-sound-mini.is-playing span {
  display: flex;
  width: 16px;
  height: 18px;
  margin-left: 0;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 0;
}

.word-sound-mini.is-loading span::before,
.word-sound-mini.is-playing span::before,
.word-sound-mini.is-loading span::after,
.word-sound-mini.is-playing span::after {
  content: "";
  display: block;
  width: 5px;
  height: 18px;
  border-radius: 2px;
  background: #fff;
}

mark {
  border-radius: 4px;
  background: var(--mark);
  color: var(--ink);
  padding: 0 3px;
}

.empty {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.footer {
  padding: 28px 0 44px;
  color: var(--muted);
  font-size: 1rem;
}

.footer a {
  color: var(--accent-dark);
  font-weight: 900;
}

@media (max-width: 980px) {
  .hero,
  .study-grid,
  .phonetic-layout,
  .daily-page,
  .dict-page,
  .article-title-row {
    grid-template-columns: 1fr;
  }

  .article-page-head {
    align-items: stretch;
    flex-direction: column;
  }

  .article-controls {
    grid-template-columns: 1fr;
  }

  .dict-filter {
    position: static;
  }

  .daily-controls {
    position: static;
  }

  .dict-card-grid {
    grid-template-columns: 1fr;
  }

  .phonetic-picker {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    width: min(88vw, 380px);
    max-height: none;
    overflow: auto;
    border-radius: 8px 0 0 8px;
    transform: translateX(105%);
    transition: transform 0.22s ease;
  }

  .phonetic-info-grid {
    grid-template-columns: 1fr;
  }

  .phonetic-study {
    order: 1;
  }

  .phonetic-settings {
    display: grid;
  }

  body.phonetic-settings-open::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgba(23, 45, 34, 0.28);
  }

  body.phonetic-settings-open .phonetic-picker {
    transform: translateX(0);
  }

  .sidebar {
    position: static;
    max-height: none;
  }

  .word-list {
    max-height: 360px;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 16px;
  }

  .topbar,
  .hero,
  .section,
  .footer {
    width: calc(100% - 24px);
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-links {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 0.9rem;
  }

  .hero {
    padding-top: 36px;
  }

  .mobile-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 4px;
  }

  .mobile-panel-head strong {
    font-size: 1.1rem;
  }

  .mobile-panel-head button {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 8px;
    background: var(--panel-soft);
    color: var(--ink);
    font-size: 1.5rem;
    font-weight: 900;
  }

  .sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    width: min(88vw, 360px);
    max-height: none;
    overflow: auto;
    border-radius: 8px 0 0 8px;
    transform: translateX(105%);
    transition: transform 0.22s ease;
  }

  .floating-settings {
    display: grid;
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 20;
    width: 56px;
    height: 56px;
    place-items: center;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    box-shadow: 0 16px 34px rgba(40, 120, 73, 0.28);
    font-size: 1.35rem;
    font-weight: 900;
  }

  .floating-settings span {
    position: relative;
    width: 24px;
    height: 24px;
    border: 4px solid #fff;
    border-radius: 999px;
  }

  .floating-settings span::before,
  .floating-settings span::after {
    content: "";
    position: absolute;
    inset: -9px 7px;
    border-radius: 999px;
    background: #fff;
  }

  .floating-settings span::after {
    transform: rotate(90deg);
  }

  body.settings-open::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgba(23, 45, 34, 0.28);
  }

  body.settings-open .sidebar {
    transform: translateX(0);
  }

  .word-detail,
  .sidebar,
  .panel {
    padding: 16px;
  }

  .word-hero {
    padding: 22px;
  }

  .word-hero h2 {
    font-size: 3.65rem;
  }

  .usage-grid,
  .meaning-grid,
  .daily-title-row,
  .phonetic-title-row {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .daily-reader {
    padding: 18px;
  }

  .daily-audio {
    grid-template-columns: 1fr;
  }

  .daily-audio audio {
    min-width: 0;
  }

  .daily-lookup {
    right: 12px;
    bottom: 12px;
    width: calc(100vw - 24px);
    max-height: 58vh;
    padding: 16px;
  }

  .daily-paragraph {
    grid-template-columns: 1fr;
  }

  .phonetic-hero .hero-card {
    display: none;
  }

  .phonetic-chip-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .phonetic-video-card {
    padding: 16px;
  }

  .phonetic-video-card video {
    min-height: 210px;
  }

  .button {
    width: 100%;
  }

  .swipe-guide {
    gap: 4px;
    padding: 6px 8px;
    font-size: 0.76rem;
    overflow: hidden;
  }

  .swipe-guide span {
    font-size: 0.7rem;
  }

  .swipe-guide strong::before,
  .swipe-guide strong::after {
    margin: 0 4px 0 0;
  }

  .swipe-guide strong::after {
    margin: 0 0 0 4px;
  }
}
