:root {
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: #d9d9df;
  --line-soft: #ececf0;
  --paper: #f5f5f7;
  --panel: #ffffff;
  --panel-2: #f7f7f9;
  --soft: #e8f2ff;
  --accent: #007aff;
  --accent-dark: #0066d6;
  --accent-light: #5ac8fa;
  --gold: #ffcc00;
  --rose: #ff3b30;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Microsoft YaHei UI", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  padding: 24px;
  display: grid;
  gap: 18px;
}

.hero {
  min-height: 156px;
  padding: 28px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: linear-gradient(145deg, #ffffff 0%, #f4f9ff 100%);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 34px;
  letter-spacing: 0;
}

.subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.hero-actions,
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-btn,
.ghost-btn,
.icon-btn {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.primary-btn {
  min-width: 112px;
  padding: 0 16px;
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
  font-weight: 800;
}

.primary-btn:hover {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
}

.ghost-btn {
  min-width: 84px;
  padding: 0 14px;
  background: var(--panel-2);
}

.icon-btn {
  width: 42px;
  font-size: 18px;
}

.toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 16px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 160px 160px 140px;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--panel-2);
}

.summary-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.summary-row div {
  min-height: 68px;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 22px rgba(0, 122, 255, 0.06);
}

.summary-row strong {
  display: block;
  font-size: 24px;
}

.summary-row span {
  color: var(--muted);
  font-size: 13px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}

.word-card {
  min-height: 332px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  display: grid;
  grid-template-rows: 150px 1fr;
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}

.word-card:hover {
  border-color: #b7d7ff;
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.word-card.playing {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15), var(--shadow);
}

.image-wrap {
  background: var(--soft);
  position: relative;
  overflow: hidden;
}

.image-wrap img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.image-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 800;
  background: linear-gradient(135deg, #f7fbff, #e8f2ff);
}

.lesson-badge {
  position: absolute;
  left: 10px;
  top: 10px;
  padding: 4px 8px;
  border-radius: 999px;
  color: #fff;
  background: rgba(0, 122, 255, 0.92);
  font-size: 12px;
  font-weight: 800;
}

.card-body {
  padding: 14px;
  display: grid;
  gap: 9px;
}

.word-line {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: start;
}

.word {
  min-width: 0;
  font-size: 24px;
  line-height: 1.15;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.phonetic {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.chinese {
  min-height: 44px;
  line-height: 1.55;
}

.note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.play-btn {
  width: 100%;
}

.fav-btn.active {
  border-color: var(--gold);
  color: #8a6d00;
  background: #fff8d7;
}

.heard-chip {
  display: none;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.word-card.heard .heard-chip {
  display: inline;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  padding: 10px 14px;
  border-radius: 8px;
  color: #fff;
  background: rgba(24, 32, 38, 0.92);
  box-shadow: var(--shadow);
  z-index: 10;
}

@media (max-width: 900px) {
  .hero {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding: 14px;
  }

  h1 {
    font-size: 28px;
  }

  .toolbar,
  .summary-row {
    grid-template-columns: 1fr;
  }

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