.study-page {
  padding: 0.5rem 0 3rem;
}

.study-page-header {
  margin-bottom: 2rem;
}

.study-page-header h1 {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 400;
  margin-bottom: 0.35rem;
}

.study-page-header p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Display mode（由导航栏「设置」控制） */
.study-page[data-display-mode="en"] .content-zh {
  display: none !important;
}

.study-page[data-display-mode="zh"] .content-en {
  display: none !important;
}

.study-page[data-display-mode="zh"] .content-zh-only {
  display: block;
}

.study-page[data-display-mode="en"] .content-zh-only,
.study-page[data-display-mode="both"] .content-zh-only {
  display: none !important;
}

.study-page[data-display-mode="zh"] .word-card-top {
  justify-content: flex-start;
}

.study-page[data-display-mode="zh"] .word-card .word-en {
  display: none;
}

.study-page[data-display-mode="zh"] .word-card .word-zh {
  font-size: 1.2rem;
  color: var(--accent);
  font-weight: 600;
  margin: 0;
}

.study-page[data-display-mode="en"] .article-title-fallback,
.study-page[data-display-mode="both"] .article-title-fallback {
  display: none !important;
}

.study-page[data-display-mode="zh"] .article-title-fallback {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0.25rem 0 0.35rem;
}

.study-page[data-display-mode="en"] .article-card h3.content-zh {
  display: none !important;
}

.content-zh-only {
  display: none;
  font-size: 0.88rem;
  color: var(--text-muted);
  padding: 1rem;
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  margin-top: 1rem;
}

.study-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 3rem;
}

/* Quick grid on home */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

@media (max-width: 900px) {
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
}

.quick-card {
  display: block;
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s, border-color 0.2s;
}

.quick-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
}

.quick-icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.75rem;
}

.quick-card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.35rem;
}

.quick-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Words */
.word-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.word-card {
  padding: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color 0.25s, box-shadow 0.25s;
}

.word-card:hover {
  border-color: var(--primary);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.1);
}

.word-card.is-speaking {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary-soft), 0 10px 28px rgba(99, 102, 241, 0.15);
}

.word-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.word-card-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

/* 记单词：发音按钮更紧凑 */
.word-card .btn-pronounce {
  width: 1.55rem;
  height: 1.55rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.word-card .btn-pronounce:hover {
  transform: scale(1.05);
}

.word-card .icon-speaker-sm {
  width: 12px;
  height: 12px;
}

.word-card .btn-fav-inline {
  font-size: 1rem;
  padding: 0.1rem;
}

.word-en {
  font-size: 1.35rem;
  color: var(--accent);
  font-weight: 600;
  flex: 1;
  min-width: 0;
}

.word-phonetic {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  margin: 0.35rem 0 0.5rem;
  padding: 0.35rem 0.65rem;
  background: var(--bg-deep);
  border-radius: 8px;
  border: 1px solid var(--border);
  width: fit-content;
  max-width: 100%;
}

.phonetic-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary-text);
  font-weight: 600;
  flex-shrink: 0;
}

.phonetic-text {
  color: var(--text-muted);
  font-family: "DM Sans", system-ui, sans-serif;
}

.word-zh {
  font-size: 0.95rem;
  line-height: 1.5;
}

.btn-fav-inline {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.15rem;
  line-height: 1;
  transition: color 0.2s, transform 0.2s;
}

.btn-fav-inline:hover,
.btn-fav-inline.faved {
  color: var(--accent);
  transform: scale(1.15);
}

/* Pronunciation (words + sentences) */
.speech-page-hint {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1.15rem;
  padding: 0.55rem 0.85rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.icon-speaker-hint {
  opacity: 0.9;
}

.icon-speaker {
  display: block;
  width: 22px;
  height: 22px;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

html[data-theme="light"] .icon-speaker {
  filter: brightness(0.25);
}

.btn-pronounce {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.65rem;
  height: 2.65rem;
  padding: 0;
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(99, 102, 241, 0.2), rgba(0, 0, 0, 0.25));
  cursor: pointer;
  transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s, background 0.2s;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

html[data-theme="light"] .btn-pronounce {
  background: linear-gradient(145deg, var(--primary-soft), #fff);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.12);
}

.btn-pronounce:hover {
  border-color: var(--primary);
  transform: scale(1.08);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

.btn-pronounce.is-speaking {
  border-color: var(--accent);
  background: linear-gradient(145deg, rgba(201, 162, 39, 0.25), rgba(99, 102, 241, 0.2));
  animation: speakPulse 1s ease-in-out infinite;
}

.btn-pronounce.is-speaking .icon-speaker {
  animation: speakerWave 0.6s ease-in-out infinite alternate;
}

@keyframes speakerWave {
  from { transform: scale(1); opacity: 0.85; }
  to { transform: scale(1.12); opacity: 1; }
}

/* Sentences */

.sentence-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sentence-card {
  padding: 1.25rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color 0.25s, box-shadow 0.25s;
}

.sentence-card.is-speaking {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary-soft), 0 8px 24px rgba(99, 102, 241, 0.12);
}

.sentence-card-top {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.sentence-en {
  flex: 1;
  font-size: 1.05rem;
  line-height: 1.7;
  margin: 0;
}

@keyframes speakPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(99, 102, 241, 0); }
}

.sentence-zh {
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.sentence-card-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.sentence-tag {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  background: var(--primary-soft);
  color: var(--primary-text);
  border-radius: 6px;
}

/* Articles */
.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.article-card {
  display: block;
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s;
}

.article-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
}

.article-level {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  background: var(--accent-glow);
  color: var(--accent);
  border-radius: 4px;
}

.article-card h3 {
  margin: 0.75rem 0 0.35rem;
  font-size: 1.15rem;
}

.article-title-en {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.article-summary {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.article-detail {
  max-width: 720px;
  margin: 0 auto;
}

.article-detail h1 {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  margin: 0.5rem 0;
}

.article-subtitle {
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.article-summary-box {
  padding: 1rem;
  background: var(--bg-passage);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.article-body {
  line-height: 1.85;
  font-size: 1.05rem;
  white-space: pre-wrap;
  color: var(--text-passage);
}

/* Translate tool */
.translate-tool {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.translate-dir {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.dir-btn {
  flex: 1;
  padding: 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
}

.dir-btn.active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-text);
}

.translate-input-wrap textarea {
  width: 100%;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-deep);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  resize: vertical;
  margin: 0.5rem 0 1rem;
}

.translate-output-wrap {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.translate-output-wrap > span {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.translate-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 0.25rem;
}

.translate-actions .btn-primary {
  flex: 1;
  min-width: 140px;
}

.btn-ai {
  flex: 1;
  min-width: 160px;
  border-color: var(--accent) !important;
  color: var(--accent) !important;
}

.btn-ai:hover {
  background: var(--accent-glow) !important;
}

.output-label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.translate-output {
  min-height: 5rem;
  max-height: 520px;
  overflow-y: auto;
  padding: 1rem 1.1rem;
  margin: 0 0 0.5rem;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  line-height: 1.6;
}

.translate-output:not(.md-rendered) {
  white-space: pre-wrap;
}
