:root {
  color-scheme: light;
  --bg: #f6f5f4;
  --surface: #ffffff;
  --surface-soft: #fbfaf9;
  --ink: #181817;
  --muted: #615d59;
  --faint: #a39e98;
  --line: rgba(0, 0, 0, 0.1);
  --blue: #0075de;
  --blue-dark: #005bab;
  --blue-soft: #f2f9ff;
  --green: #18864b;
  --shadow: 0 4px 18px rgba(0, 0, 0, 0.04), 0 2px 8px rgba(0, 0, 0, 0.025);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  line-height: 1.5;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.46; }
:focus-visible { outline: 3px solid rgba(0, 117, 222, 0.25); outline-offset: 2px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 72px;
  padding: 0 clamp(20px, 4vw, 56px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.91);
  backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--ink);
  color: white;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; }
.brand small { color: var(--muted); font-size: 11px; }
.header-summary { display: flex; align-items: baseline; gap: 6px; color: var(--muted); font-size: 13px; }
.header-summary strong { color: var(--blue); font-size: 20px; }

.page-shell { width: min(1380px, calc(100% - 40px)); margin: 0 auto; padding: 46px 0 80px; }
.hero {
  min-height: 300px;
  padding: clamp(32px, 6vw, 72px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 380px);
  align-items: end;
  gap: 48px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(135deg, #fff 0%, #fff 58%, #eef7ff 100%);
  box-shadow: var(--shadow);
}
.eyebrow { color: var(--blue); font-size: 12px; font-weight: 700; letter-spacing: 0.1em; }
.hero h1 {
  margin: 12px 0 18px;
  font-size: clamp(44px, 7vw, 78px);
  line-height: 0.98;
  letter-spacing: -3px;
}
.hero p { max-width: 700px; margin: 0; color: var(--muted); font-size: 18px; }
.hero-note {
  padding: 24px;
  border: 1px solid rgba(0, 117, 222, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
}
.hero-note span { display: inline-block; margin-bottom: 16px; padding: 4px 9px; border-radius: 999px; color: var(--blue); background: var(--blue-soft); font-size: 12px; font-weight: 700; }
.hero-note strong, .hero-note small { display: block; }
.hero-note strong { font-size: 21px; line-height: 1.35; }
.hero-note small { margin-top: 8px; color: var(--muted); }

.tool-panel {
  position: sticky;
  top: 84px;
  z-index: 15;
  margin-top: 18px;
  padding: 16px;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 145px 125px auto;
  align-items: end;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}
.tool-panel label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 12px; font-weight: 650; }
.search-input-wrap { height: 44px; padding: 0 12px; display: flex; align-items: center; gap: 8px; border: 1px solid #d8d5d2; border-radius: 7px; background: white; }
.search-input-wrap span { color: var(--faint); font-size: 20px; }
.search-input-wrap input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; }
select { width: 100%; height: 44px; padding: 0 10px; border: 1px solid #d8d5d2; border-radius: 7px; color: var(--ink); background: white; }
.search-input-wrap:focus-within, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0, 117, 222, 0.1); }
.play-actions { display: flex; gap: 8px; }
.primary-button, .secondary-button, .play-button {
  min-height: 44px;
  padding: 0 15px;
  border-radius: 7px;
  font-weight: 650;
  transition: 0.16s ease;
}
.primary-button { border: 1px solid var(--blue); color: white; background: var(--blue); }
.primary-button:hover { border-color: var(--blue-dark); background: var(--blue-dark); }
.secondary-button { border: 1px solid var(--line); color: var(--ink); background: white; }
.secondary-button:hover:not(:disabled) { background: var(--bg); }

.content-layout { margin-top: 34px; display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; align-items: start; }
.unit-panel { position: sticky; top: 176px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.unit-heading { padding: 5px 8px 12px; display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; font-weight: 650; }
.unit-heading small { color: var(--faint); font-weight: 500; }
.unit-list { display: grid; gap: 3px; }
.unit-button {
  width: 100%;
  min-height: 43px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  text-align: left;
  font-weight: 600;
}
.unit-button span:last-child { color: var(--faint); font-size: 11px; font-weight: 500; }
.unit-button:hover { color: var(--ink); background: var(--bg); }
.unit-button.is-active { color: var(--ink); background: #f0efed; }
.unit-button.is-active span:first-child { color: var(--blue); }

.word-section { min-width: 0; }
.section-heading { margin-bottom: 18px; display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.section-heading h2 { margin: 4px 0 0; font-size: clamp(32px, 4vw, 48px); line-height: 1; letter-spacing: -1.5px; }
.result-count { display: flex; align-items: baseline; gap: 5px; color: var(--muted); font-size: 12px; }
.result-count strong { color: var(--ink); font-size: 30px; letter-spacing: -1px; }
.speech-notice { margin-bottom: 14px; padding: 12px 14px; border: 1px solid #edcfae; border-radius: 8px; color: #8d4b13; background: #fff7ed; }
.word-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.word-card {
  min-width: 0;
  padding: 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.025);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}
.word-card:hover { border-color: rgba(0, 117, 222, 0.28); box-shadow: var(--shadow); transform: translateY(-1px); }
.word-card.is-playing { border-color: var(--blue); background: var(--blue-soft); box-shadow: 0 0 0 3px rgba(0, 117, 222, 0.08); }
.word-meta { min-width: 0; }
.word-topline { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.word-text { overflow-wrap: anywhere; font-size: 24px; line-height: 1.15; letter-spacing: -0.45px; }
.phonetic { color: var(--blue); font-size: 14px; }
.meaning { margin: 8px 0 7px; color: var(--muted); }
.card-footer { display: flex; flex-wrap: wrap; gap: 7px; color: var(--faint); font-size: 11px; }
.card-footer span { padding: 2px 6px; border-radius: 999px; background: var(--bg); }
.play-button {
  width: 52px;
  height: 52px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(0, 117, 222, 0.22);
  border-radius: 50%;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 20px;
}
.play-button:hover { color: white; background: var(--blue); transform: scale(1.04); }
.word-card.is-playing .play-button { color: white; background: var(--blue); animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(0, 117, 222, 0.1); } }
.empty-state { padding: 70px 20px; border: 1px dashed #ccc8c4; border-radius: 14px; color: var(--muted); text-align: center; }
.empty-state strong, .empty-state span { display: block; }
.empty-state strong { color: var(--ink); font-size: 22px; }
.empty-state span { margin-top: 7px; }
.toast {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: 26px;
  padding: 11px 16px;
  border-radius: 8px;
  color: white;
  background: #222;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 18px);
  transition: 0.2s ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1120px) {
  .tool-panel { grid-template-columns: minmax(260px, 1fr) 140px 120px; }
  .play-actions { grid-column: 1 / -1; }
  .word-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .site-header { height: 64px; padding: 0 16px; }
  .header-summary span { display: none; }
  .page-shell { width: min(100% - 24px, 1380px); padding-top: 20px; }
  .hero { min-height: auto; padding: 28px 22px; grid-template-columns: 1fr; gap: 26px; }
  .hero h1 { font-size: clamp(40px, 13vw, 58px); letter-spacing: -2px; }
  .hero p { font-size: 16px; }
  .tool-panel { position: static; grid-template-columns: 1fr 1fr; padding: 12px; }
  .search-box, .play-actions { grid-column: 1 / -1; }
  .play-actions > * { flex: 1; }
  .content-layout { grid-template-columns: 1fr; gap: 24px; }
  .unit-panel { position: static; padding: 10px; overflow: hidden; }
  .unit-heading { padding-bottom: 8px; }
  .unit-list { display: flex; overflow-x: auto; gap: 6px; padding-bottom: 3px; scrollbar-width: thin; }
  .unit-button { flex: 0 0 auto; width: auto; padding: 0 12px; border: 1px solid var(--line); }
  .unit-button span:last-child { margin-left: 5px; }
  .section-heading { align-items: center; }
  .word-card { padding: 17px; }
}

@media (max-width: 430px) {
  .brand small { display: none; }
  .header-summary strong { font-size: 17px; }
  .tool-panel { grid-template-columns: 1fr; }
  .search-box, .play-actions { grid-column: auto; }
  .play-actions { display: grid; grid-template-columns: 1fr; }
  .section-heading h2 { font-size: 34px; }
  .word-text { font-size: 22px; }
  .word-card { grid-template-columns: minmax(0, 1fr) 48px; gap: 10px; }
  .play-button { width: 46px; height: 46px; }
}
