:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-subtle: #fafafd;
  --surface-inset: #f5f6f9;
  --text: #23272f;
  --text-soft: #4d5565;
  --muted: #6b7280;
  --line: #e7e9f0;
  --accent: #5b6ee1;
  --accent-dark: #4a5dd0;
  --accent-soft: #eef1fe;
  --ok: #2f9e6b;
  --ok-soft: #e7f6ec;
  --ok-strong: #1c6b48;
  --bad: #d0584f;
  --bad-soft: #fdeceb;
  --bad-strong: #8f3a33;
  --chip-bg: #eef1f7;
  --chip-text: #343b47;
  --warn-soft: #fdf3e4;
  --words: #5b6ee1;
  --words-soft: #eef1fe;
  --grammar: #2f9e8f;
  --grammar-soft: #e6f5f2;
  --kanji: #8b6cd0;
  --kanji-soft: #f1ecfd;
  --shadow: 0 1px 2px rgba(24, 32, 56, 0.04);
  --shadow-hover: 0 10px 24px rgba(24, 32, 56, 0.09);
  --focus-ring: rgba(91, 110, 225, 0.35);
  --focus-shadow: rgba(91, 110, 225, 0.14);
  --radius: 16px;
  --option-font-size: 1rem;
  --question-font-size: 1.3rem;
}

* {
  box-sizing: border-box;
}

/* 关键：作者样式表里的 display 会覆盖浏览器默认的 [hidden]{display:none}，
   例如 .modal{display:flex} 会让带 hidden 属性的模态框照样显示。
   这里统一兜底，保证任何带 hidden 属性的元素都不显示。 */
[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC",
    system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.7;
}

body.modal-open {
  overflow: hidden;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 10px 16px;
  background: var(--surface);
  border-radius: 0 0 10px 0;
}

.skip-link:focus {
  left: 0;
  z-index: 10;
}

/* ==================== 顶部：品牌 + 全局搜索 ==================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  position: relative;
  max-width: 1040px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  flex: 0 0 auto;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 19px;
  font-weight: 700;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.brand-text strong {
  font-size: 17px;
  letter-spacing: 0.5px;
}

.brand-text small {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 1px;
}

.auth-area {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  margin-left: auto;
}

.auth-button {
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-soft);
  font-family: inherit;
  font-size: 13.5px;
  cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}

.auth-button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.auth-button:focus-visible,
.auth-logout:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.auth-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 7px 5px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}

.auth-welcome {
  max-width: 180px;
  overflow: hidden;
  color: var(--text-soft);
  font-size: 13.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-logout {
  padding: 3px 8px;
  border: none;
  border-radius: 999px;
  background: var(--surface-inset);
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
}

.auth-logout:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.global-search {
  flex: 1 1 320px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.global-search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-shadow);
}

.search-icon {
  display: flex;
  color: var(--muted);
  flex: 0 0 auto;
}

.search-icon svg {
  width: 18px;
  height: 18px;
}

#global-search {
  flex: 1 1 auto;
  min-width: 0;
  padding: 6px 0;
  border: none;
  background: transparent;
  color: inherit;
  font-family: inherit;
  font-size: 15px;
}

#global-search:focus {
  outline: none;
}

.search-button {
  flex: 0 0 auto;
  padding: 8px 18px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.18s ease;
}

.search-button:hover {
  background: var(--accent-dark);
}

.search-hint {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 20px 12px;
  color: var(--muted);
  font-size: 13px;
}

/* ==================== 通用容器 ==================== */
.container {
  flex: 1 0 auto;
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 34px 20px 48px;
}

/* ==================== 首页卡片 ==================== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: #d8dcea;
}

.card:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.card-icon {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 14px;
}

.card-icon svg {
  width: 24px;
  height: 24px;
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.card-title {
  font-size: 17px;
  font-weight: 600;
}

.card-desc {
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.65;
}

.card-arrow {
  position: absolute;
  right: 18px;
  bottom: 16px;
  color: #c4c9d8;
  font-size: 16px;
  transition: transform 0.18s ease, color 0.18s ease;
}

.card:hover .card-arrow {
  transform: translateX(3px);
  color: var(--muted);
}

.card-words .card-icon {
  background: var(--words-soft);
  color: var(--words);
}

.card-grammar .card-icon {
  background: var(--grammar-soft);
  color: var(--grammar);
}

/* ==================== 通用按钮 ==================== */
.primary-button {
  display: inline-block;
  padding: 12px 30px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(91, 110, 225, 0.28);
  transition: background 0.18s ease, transform 0.18s ease;
}

.primary-button:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

.primary-button.is-small {
  padding: 8px 22px;
  font-size: 13.5px;
}

.primary-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.ghost-button {
  padding: 8px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-family: inherit;
  font-size: 13.5px;
  cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease;
}

.ghost-button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.ghost-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.primary-button:focus-visible,
.ghost-button:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

/* ==================== 单词学习：顶部信息栏 ==================== */
.words-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.group-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.group-count {
  font-size: 15px;
}

.group-count strong {
  color: var(--accent);
  font-size: 17px;
}

.words-progress {
  color: var(--muted);
  font-size: 13px;
}

.history-accuracy {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  min-height: 20px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--surface-inset);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
}

.history-accuracy[hidden] {
  display: none;
}

.group-nav {
  display: flex;
  gap: 8px;
}

.words-status {
  margin: 20px 0 0;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  font-size: 14px;
}

.words-status.is-error {
  border-color: #f0c9c5;
  background: var(--bad-soft);
  color: var(--bad-strong);
}

.words-screen {
  margin-top: 22px;
  padding: 26px 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---- 单词大字 + 注音 ---- */
.word-hero {
  margin: 0 0 26px;
  text-align: center;
  font-size: 62px;
  line-height: 1.5;
  letter-spacing: 2px;
}

.word-hero ruby {
  ruby-position: over;
}

.word-hero rt {
  color: var(--muted);
  font-size: 0.34em;
  letter-spacing: 0;
  font-weight: 400;
}

.pitch {
  margin-left: 14px;
  color: var(--muted);
  font-size: 15px;
  letter-spacing: 0;
  vertical-align: middle;
  white-space: nowrap;
}

/* ---- 单选题选项 ---- */
.quiz-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  max-width: 720px;
  margin: 0 auto;
}

.quiz-option {
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: inherit;
  font-family: inherit;
  font-size: var(--option-font-size);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.quiz-option:hover:not(:disabled) {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.quiz-option:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.quiz-option:disabled {
  cursor: default;
}

.quiz-option.is-correct {
  border-color: var(--ok);
  background: var(--ok-soft);
  color: var(--ok-strong);
  font-weight: 600;
}

.quiz-option.is-wrong {
  border-color: var(--bad);
  background: var(--bad-soft);
  color: var(--bad-strong);
  font-weight: 600;
}

.quiz-option.is-dimmed {
  opacity: 0.55;
}

.quiz-feedback {
  margin: 20px 0 0;
  text-align: center;
  font-size: 14.5px;
  color: var(--muted);
}

.quiz-feedback.is-correct {
  color: var(--ok-strong);
  font-weight: 600;
}

.quiz-feedback.is-wrong {
  color: var(--bad-strong);
  font-weight: 600;
}

/* ==================== 单词详情页 ==================== */
.detail-layout {
  display: flex;
  align-items: stretch;
  gap: 20px;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
}

.detail-left {
  flex: 0 0 calc(40% - 10px);
  min-width: 0;
  width: calc(40% - 10px);
  max-width: calc(40% - 10px);
  max-height: 100%;
  padding-right: clamp(18px, 2.4vw, 26px);
  border-right: 1px dashed var(--line);
  box-sizing: border-box;
}

.detail-right {
  flex: 0 0 calc(60% - 10px);
  min-width: 0;
  width: calc(60% - 10px);
  max-width: calc(60% - 10px);
  max-height: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}

.detail-word {
  margin: 0 0 6px;
  font-size: 40px;
  line-height: 1.75;
  letter-spacing: 2px;
  font-weight: 600;
}

#grammar-detail .detail-word {
  margin: 0 0 18px;
  color: var(--text, #202431);
  font-size: clamp(30px, 3.8vw, 40px);
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 1.5px;
  text-align: left;
  overflow-wrap: anywhere;
}

.detail-meta {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 13.5px;
}

.detail-meta .dot {
  margin: 0 8px;
}

.detail-heading {
  margin: 20px 0 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 1px;
}

.detail-left .detail-heading:first-of-type {
  margin-top: 0;
}

.detail-section + .detail-section {
  margin-top: 20px;
}

/* 汉字超链接 + 悬浮提示 */
.kanji-link {
  position: relative;
  padding: 0;
  border: none;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  border-bottom: 2px dotted var(--accent);
}

.kanji-link:hover {
  color: var(--accent);
}

.kanji-link:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.kanji-link::after {
  content: "了解汉字";
  position: absolute;
  left: 50%;
  top: 100%;
  bottom: auto;
  transform: translate(-50%, 6px);
  z-index: 4;
  box-shadow: 0 8px 22px rgba(20, 26, 44, 0.18);
  padding: 1px 7px;
  border-radius: 8px;
  background: #2c3140;
  color: #fff;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.6;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.kanji-link:hover::after,
.kanji-link:focus-visible::after {
  opacity: 1;
}

/* 释义 / 近义词 */
.meaning-list,
.synonym-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.meaning-list li + li,
.synonym-list li + li {
  margin-top: 10px;
}

.meaning-button {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: inherit;
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.65;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.meaning-button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.meaning-button:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.synonym-item {
  padding: 10px 14px;
  border-left: 3px solid var(--kanji-soft);
  background: var(--surface-subtle);
  border-radius: 0 10px 10px 0;
  font-size: 13.5px;
}

.synonym-word {
  font-weight: 600;
}

.synonym-diff {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

/* 例句 */
.example-list {
  max-height: 62vh;
  overflow-y: auto;
  margin: 0;
  padding: 0 4px 0 0;
  list-style: none;
}

.example-item {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.example-item + .example-item {
  margin-top: 12px;
}

.example-jp {
  margin: 0 0 6px;
  font-size: 15.5px;
  line-height: 1.75;
}

.example-cn {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
}

.example-item.is-flash {
  animation: example-flash 1.3s ease;
}

@keyframes example-flash {
  0% {
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: 0 0 0 4px rgba(91, 110, 225, 0.16);
  }
  100% {
    border-color: var(--line);
    background: var(--surface);
    box-shadow: none;
  }
}

.detail-footer {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  text-align: right;
}

/* ==================== 本组完成 ==================== */
.done-card {
  text-align: center;
}

.done-title {
  margin: 0 0 10px;
  font-size: 22px;
  font-weight: 700;
}

.done-text {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 14px;
}

.done-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.study-fallback-card {
  min-height: clamp(260px, 46vh, 430px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.study-fallback .done-title {
  font-size: clamp(25px, 3.2vw, 38px);
  letter-spacing: 0.02em;
}

.study-fallback .done-text {
  max-width: 560px;
  line-height: 1.85;
}

.reset-feedback {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.reset-feedback.is-error {
  color: var(--bad-strong);
}

/* ==================== 模态框 ==================== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.is-open {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(24, 28, 40, 0.45);
}

.modal-dialog {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 80vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 18px 48px rgba(20, 26, 44, 0.22);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  margin: 0;
  font-size: 17px;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: #f1f2f7;
  color: var(--muted);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.modal-close:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.modal-close:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.modal-body {
  padding: 18px 20px 22px;
  font-size: 14px;
}

.auth-dialog {
  max-width: 420px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 18px;
  padding: 4px;
  border-radius: 12px;
  background: var(--surface-inset);
}

.auth-tab {
  padding: 9px 12px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.auth-tab.is-active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow);
}

.auth-tab:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 1px;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-security-fields {
  display: grid;
  gap: 14px;
}

.auth-field {
  display: grid;
  gap: 6px;
  color: var(--text-soft);
  font-size: 13px;
}

.auth-field input {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.auth-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-shadow);
}

.auth-forgot {
  justify-self: end;
  margin-top: -6px;
  padding: 2px 0;
  border: none;
  background: transparent;
  color: var(--accent);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}

.auth-forgot:hover {
  color: var(--accent-dark);
  text-decoration: underline;
}

.auth-forgot:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
  border-radius: 4px;
}

.forgot-question-box {
  display: grid;
  gap: 5px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-inset);
}

.forgot-question-label {
  color: var(--muted);
  font-size: 12px;
}

.forgot-question-text {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.auth-feedback {
  margin: -2px 0 0;
  font-size: 13px;
  line-height: 1.55;
}

.auth-feedback.is-error {
  color: var(--bad-strong);
}

.auth-feedback.is-success {
  color: var(--ok-strong);
}

.auth-submit {
  width: 100%;
  margin-top: 2px;
}

.study-mode-kicker {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: 0.08em;
}

.study-mode-body {
  padding-top: 14px;
}

.study-mode-summary {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12.5px;
}

.study-mode-options {
  display: grid;
  gap: 10px;
}

.study-mode-option {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfcff;
  color: inherit;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.study-mode-option:hover {
  transform: translateY(-1px);
  border-color: #d7dcec;
  background: #f6f8ff;
}

.study-mode-option:focus-visible {
  outline: 3px solid rgba(91, 110, 225, 0.32);
  outline-offset: 2px;
}

.study-mode-icon {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 17px;
  font-weight: 700;
}

.study-mode-option[data-study-mode="review"] .study-mode-icon {
  background: var(--grammar-soft);
  color: var(--grammar);
}

.study-mode-option[data-study-mode="practice"] .study-mode-icon {
  background: var(--kanji-soft);
  color: var(--kanji);
}

.study-mode-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.study-mode-copy strong {
  font-size: 14.5px;
  font-weight: 600;
}

.study-mode-copy small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.study-mode-label {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  line-height: 1.5;
}

.study-mode-label[data-mode="review"] {
  background: var(--grammar-soft);
  color: var(--grammar);
}

.study-mode-label[data-mode="practice"] {
  background: var(--kanji-soft);
  color: var(--kanji);
}

.modal-row {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
}

.modal-row:last-child {
  border-bottom: none;
}

.modal-term {
  color: var(--muted);
  font-size: 13px;
}

.modal-value {
  margin: 0;
  line-height: 1.7;
}

.modal-subheading {
  margin: 18px 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 1px;
}

.reading-item {
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--surface-subtle);
  font-size: 13.5px;
}

.reading-item + .reading-item {
  margin-top: 8px;
}

.reading-type {
  display: inline-block;
  margin-right: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--kanji-soft);
  color: var(--kanji);
  font-size: 12px;
}

.modal-empty {
  margin: 0;
  padding: 18px 0;
  text-align: center;
  color: var(--muted);
}

/* ==================== 页脚 ==================== */
.site-footer {
  flex: 0 0 auto;
  padding: 22px 20px 30px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
}

.site-footer p {
  margin: 0 0 4px;
}

/* ==================== 句法学习 ==================== */
.grammar-point {
  margin: 8px 0 32px;
  text-align: center;
  font-size: 48px;
  line-height: 1.45;
  font-weight: 600;
  letter-spacing: 1px;
}

.grammar-point.is-question {
  margin: 8px 0 26px;
  font-size: var(--question-font-size);
  line-height: 1.8;
  font-weight: 600;
  letter-spacing: 0;
}

.grammar-options .quiz-option {
  text-align: center;
}

#grammar-quiz:not([hidden]) {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
  min-height: 0;
  box-sizing: border-box;
}

#grammar-quiz > * {
  flex-shrink: 0;
}

#grammar-quiz .grammar-point {
  font-size: 39px;
}

.grammar-detail-point {
  width: 100%;
  margin: 0 0 18px;
  text-align: center;
  font-size: 32px;
  line-height: 1.45;
  font-weight: 600;
}

.grammar-text {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.85;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

#grammar-detail .meaning-card {
  width: 100%;
  margin: 0;
  padding: 18px 20px;
  border: 1px solid var(--line, #e2e4e9);
  border-radius: 16px;
  background: var(--surface, #fff);
  box-shadow: 0 8px 24px rgba(20, 26, 44, 0.055);
  box-sizing: border-box;
}

#grammar-detail .meaning-card .detail-section + .detail-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line, #e2e4e9);
}

#grammar-detail .meaning-card .grammar-text:last-child {
  margin-bottom: 0;
}

.distinction-list {
  display: grid;
  gap: 10px;
}

.distinction-item {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-subtle);
}

.distinction-head {
  margin: 0 0 4px;
  font-size: 14.5px;
  font-weight: 600;
}

.distinction-diff {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.7;
}

.distinction-example {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

/* ==================== 练习标签 ==================== */
.study-tag {
  margin: 0 0 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 1px;
}

/* ==================== 响应式 ==================== */
@media (max-width: 720px) {
  .detail-layout {
    flex-direction: column;
    gap: 18px;
  }

  .detail-left {
    padding-right: 0;
    padding-bottom: 18px;
    border-right: none;
    border-bottom: 1px dashed var(--line);
  }

  .example-list {
    max-height: none;
  }
}

@media (max-width: 720px) {
  .header-inner {
    padding: 12px 14px;
    gap: 12px;
  }

  .brand-text small {
    display: none;
  }

  .global-search {
    flex: 1 1 100%;
    order: 2;
  }

  .container {
    padding: 24px 14px 36px;
  }

  .card {
    padding: 18px;
  }

  .card-arrow {
    display: none;
  }

  .words-topbar {
    padding: 12px 14px;
  }

  .words-screen {
    padding: 20px 16px;
  }

  .word-hero {
    font-size: 46px;
  }

  .quiz-options {
    grid-template-columns: 1fr;
  }

  .detail-word {
    font-size: 32px;
  }

  .grammar-point {
    margin-bottom: 24px;
    font-size: 34px;
  }

  .grammar-point.is-question {
    margin-bottom: 20px;
    font-size: var(--question-font-size);
  }

  .grammar-detail-point {
    font-size: 26px;
  }

  .detail-footer {
    text-align: center;
  }

}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}
/* ==================== 首页重构 ==================== */
body:has(#view-home:not([hidden])) {
  background:
    radial-gradient(circle at 50% -12%, rgba(91, 110, 225, 0.11), transparent 44%),
    linear-gradient(180deg, #f8f9fc 0%, #f2f4f8 100%);
}

body:has(#view-home:not([hidden])) .site-header {
  position: relative;
  top: auto;
  z-index: 2;
  background: transparent;
  border-bottom: 0;
  backdrop-filter: none;
}

body:has(#view-home:not([hidden])) .header-inner {
  width: 100%;
  max-width: 1180px;
  min-height: 34vh;
  margin: 0 auto;
  padding: clamp(22px, 3vh, 34px) clamp(18px, 4vw, 44px) 0;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

body:has(#view-home:not([hidden])) .brand {
  flex-direction: column;
  gap: 9px;
  text-align: center;
}

body:has(#view-home:not([hidden])) .brand-mark {
  width: 50px;
  height: 50px;
  border: 1px solid rgba(91, 110, 225, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 28px rgba(37, 48, 92, 0.08);
  font-family: Georgia, 'Yu Mincho', 'Noto Serif CJK JP', serif;
  font-size: 23px;
}

body:has(#view-home:not([hidden])) .brand-text {
  align-items: center;
}

body:has(#view-home:not([hidden])) .brand-text strong {
  font-size: 20px;
  font-weight: 650;
  letter-spacing: 0.16em;
}

body:has(#view-home:not([hidden])) .brand-text small {
  margin-top: 2px;
  font-size: 11.5px;
  letter-spacing: 0.24em;
}

body:has(#view-home:not([hidden])) .auth-area {
  position: absolute;
  top: clamp(18px, 2.6vh, 28px);
  right: clamp(18px, 4vw, 44px);
  margin-left: 0;
}

body:has(#view-home:not([hidden])) .global-search {
  flex: 0 0 auto;
  width: min(76vw, 1080px);
  min-height: 68px;
  padding: 8px 8px 8px 24px;
  gap: 14px;
  border-color: rgba(37, 48, 92, 0.09);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow:
    0 22px 58px rgba(37, 48, 92, 0.1),
    0 2px 8px rgba(37, 48, 92, 0.04);
}

body:has(#view-home:not([hidden])) .search-icon svg {
  width: 22px;
  height: 22px;
}

body:has(#view-home:not([hidden])) #global-search {
  padding: 12px 0;
  font-size: 18px;
}

body:has(#view-home:not([hidden])) #global-search::placeholder {
  color: #a0a6b5;
}

body:has(#view-home:not([hidden])) .search-button {
  min-height: 50px;
  padding: 0 28px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(91, 110, 225, 0.22);
}

body:has(#view-home:not([hidden])) .search-hint {
  width: min(76vw, 1080px);
  padding: 10px 4px 0;
}

body:has(#view-home:not([hidden])) .container {
  max-width: 1180px;
  padding: 30px clamp(18px, 4vw, 44px) 48px;
}

body:has(#view-home:not([hidden])) .card-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(14px, 1.8vw, 22px);
  align-items: stretch;
}

body:has(#view-home:not([hidden])) .card {
  --card-accent: var(--accent);
  min-height: clamp(260px, 42vh, 460px);
  padding: clamp(24px, 2.6vw, 34px);
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0;
  overflow: hidden;
  border-color: rgba(37, 48, 92, 0.08);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 18px 50px rgba(37, 48, 92, 0.06);
}

body:has(#view-home:not([hidden])) .card::before {
  content: attr(data-glyph);
  position: absolute;
  right: 18px;
  bottom: -30px;
  color: var(--card-accent);
  font-family: Georgia, 'Yu Mincho', 'Noto Serif CJK JP', serif;
  font-size: clamp(100px, 10vw, 150px);
  line-height: 1;
  opacity: 0.055;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

body:has(#view-home:not([hidden])) .card:hover {
  transform: translateY(-5px);
  border-color: rgba(91, 110, 225, 0.18);
  box-shadow: 0 26px 64px rgba(37, 48, 92, 0.11);
}

body:has(#view-home:not([hidden])) .card:hover::before {
  opacity: 0.085;
  transform: translateY(-4px);
}

body:has(#view-home:not([hidden])) .card-words {
  --card-accent: var(--words);
}

body:has(#view-home:not([hidden])) .card-grammar {
  --card-accent: var(--grammar);
}

body:has(#view-home:not([hidden])) .card-icon {
  width: 62px;
  height: 62px;
  margin-bottom: clamp(22px, 4vh, 42px);
  border-radius: 19px;
}

body:has(#view-home:not([hidden])) .card-icon svg {
  width: 30px;
  height: 30px;
}

body:has(#view-home:not([hidden])) .card-body {
  margin-top: auto;
  padding-right: 38px;
  gap: 8px;
}

body:has(#view-home:not([hidden])) .card-title {
  font-size: clamp(21px, 2vw, 25px);
  font-weight: 650;
  letter-spacing: 0.02em;
}

body:has(#view-home:not([hidden])) .card-desc {
  color: #7a8191;
  font-size: 14px;
  letter-spacing: 0.04em;
}

body:has(#view-home:not([hidden])) .card-arrow {
  right: 28px;
  bottom: 28px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(37, 48, 92, 0.1);
  border-radius: 50%;
  font-size: 17px;
}

body:has(#view-home:not([hidden])) .site-footer {
  padding: 10px 20px 28px;
  border-top: 0;
  background: transparent;
}

@media (max-width: 900px) {
  body:has(#view-home:not([hidden])) .header-inner {
    min-height: 32vh;
  }

  body:has(#view-home:not([hidden])) .card {
    min-height: clamp(230px, 36vh, 360px);
    padding: 24px;
  }

  body:has(#view-home:not([hidden])) .card-icon {
    width: 54px;
    height: 54px;
    margin-bottom: 24px;
    border-radius: 17px;
  }

  body:has(#view-home:not([hidden])) .card-icon svg {
    width: 26px;
    height: 26px;
  }

  body:has(#view-home:not([hidden])) .card-title {
    font-size: 20px;
  }

  body:has(#view-home:not([hidden])) .card-desc {
    font-size: 13px;
  }
}

@media (max-width: 720px) {
  body:has(#view-home:not([hidden])) .auth-area {
    top: 14px;
    right: 14px;
  }

  .auth-welcome {
    max-width: 110px;
  }

  body:has(#view-home:not([hidden])) .header-inner {
    min-height: 30vh;
    padding: 18px 16px 0;
    gap: 20px;
  }

  body:has(#view-home:not([hidden])) .brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 15px;
    font-size: 21px;
  }

  body:has(#view-home:not([hidden])) .brand-text strong {
    font-size: 18px;
  }

  body:has(#view-home:not([hidden])) .global-search {
    width: 100%;
    min-height: 58px;
    padding: 6px 6px 6px 18px;
    gap: 10px;
    border-radius: 18px;
  }

  body:has(#view-home:not([hidden])) #global-search {
    padding: 9px 0;
    font-size: 16px;
  }

  body:has(#view-home:not([hidden])) .search-button {
    min-height: 44px;
    padding: 0 20px;
    border-radius: 12px;
    font-size: 14px;
  }

  body:has(#view-home:not([hidden])) .search-hint {
    width: 100%;
    padding: 10px 16px 0;
  }

  body:has(#view-home:not([hidden])) .container {
    padding: 18px 16px 36px;
  }

  body:has(#view-home:not([hidden])) .card-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  body:has(#view-home:not([hidden])) .card {
    min-height: 148px;
    padding: 20px;
    flex-direction: row;
    align-items: center;
    gap: 18px;
    border-radius: 20px;
  }

  body:has(#view-home:not([hidden])) .card::before {
    right: 16px;
    bottom: -30px;
    font-size: 104px;
  }

  body:has(#view-home:not([hidden])) .card-icon {
    flex: 0 0 56px;
    width: 56px;
    height: 56px;
    margin: 0;
    border-radius: 17px;
  }

  body:has(#view-home:not([hidden])) .card-icon svg {
    width: 27px;
    height: 27px;
  }

  body:has(#view-home:not([hidden])) .card-body {
    flex: 1;
    margin: 0;
    padding-right: 34px;
    gap: 4px;
  }

  body:has(#view-home:not([hidden])) .card-title {
    font-size: 21px;
  }

  body:has(#view-home:not([hidden])) .card-desc {
    font-size: 13.5px;
  }

  body:has(#view-home:not([hidden])) .card-arrow {
    right: 18px;
    bottom: auto;
    top: 50%;
    width: 30px;
    height: 30px;
    transform: translateY(-50%);
  }

  body:has(#view-home:not([hidden])) .card:hover .card-arrow {
    transform: translate(3px, -50%);
  }

  body:has(#view-home:not([hidden])) .site-footer {
    padding: 4px 16px 24px;
  }
}

@media (max-width: 420px) {
  body:has(#view-home:not([hidden])) .card {
    min-height: 138px;
    padding: 18px;
  }

  body:has(#view-home:not([hidden])) .card::before {
    font-size: 90px;
  }
}

/* ==================== 全屏单页布局 ==================== */
html {
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}

body {
  height: 100%;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
}

.container {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 18px 20px 16px;
}

.view {
  flex: 1 1 auto;
  min-height: 0;
}

#view-home:not([hidden]),
#view-search:not([hidden]),
#view-books:not([hidden]),
#view-chapters:not([hidden]),
#view-words:not([hidden]),
#view-grammar:not([hidden]),
#view-exercise:not([hidden]) {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

#view-words:not([hidden]),
#view-grammar:not([hidden]) {
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
}

.words-topbar,
.words-status,
.detail-footer,
.site-header,
.site-footer {
  flex: 0 0 auto;
}

.words-status {
  max-height: 88px;
  overflow-y: auto;
}

.words-screen {
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

#words-detail:not([hidden]),
#grammar-detail:not([hidden]) {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  max-width: 900px;
  min-height: 0;
  max-height: 100%;
  margin: 0 auto;
  overflow: hidden;
  box-sizing: border-box;
}

#grammar-detail:not([hidden]) {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  width: 100%;
  max-width: 900px;
  min-height: 0;
  max-height: 100%;
  margin: 0 auto;
  overflow: hidden;
  box-sizing: border-box;
}

#words-detail .detail-layout,
#grammar-detail .detail-layout {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  justify-content: space-between;
  gap: 20px;
  width: 100%;
  max-width: 900px;
  min-height: 0;
  flex: 1 1 auto;
  margin: 0 auto;
  overflow: hidden;
  box-sizing: border-box;
}

#words-detail .detail-left,
#words-detail .detail-right,
#grammar-detail .detail-left,
#grammar-detail .detail-right {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

#words-detail .detail-right,
#grammar-detail .detail-right {
  padding-right: 6px;
}

#grammar-detail .detail-left {
  display: flex;
  flex: 0 0 calc(40% - 10px);
  flex-direction: column;
  align-items: stretch;
  width: calc(40% - 10px);
  max-width: calc(40% - 10px);
  min-width: 0;
  max-height: 100%;
  padding-right: 20px;
  border-right: 1px dashed #ccc;
  overflow-y: auto;
  box-sizing: border-box;
}

#grammar-detail .detail-right {
  flex: 0 0 calc(60% - 10px);
  width: calc(60% - 10px);
  max-width: calc(60% - 10px);
  min-width: 0;
  max-height: 100%;
  padding-right: 4px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  box-sizing: border-box;
}

#words-detail .detail-footer,
#grammar-detail .detail-footer {
  flex: 0 0 auto;
  width: 100%;
  max-width: 900px;
  margin-top: 12px;
  padding-top: 12px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

#words-detail .example-list,
#grammar-detail .example-list {
  max-height: none;
  overflow: visible;
}

#words-done:not([hidden]),
#grammar-done:not([hidden]) {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
}

.site-footer {
  padding: 6px 20px 10px;
  font-size: 11.5px;
  line-height: 1.4;
}

body:has(#view-home:not([hidden])) .container {
  padding: 16px clamp(18px, 4vw, 44px) 14px;
}

body:has(#view-home:not([hidden])) #view-home:not([hidden]) {
  height: 100%;
  min-height: 0;
}

body:has(#view-home:not([hidden])) .card-grid {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  grid-template-rows: minmax(0, 1fr);
}

body:has(#view-home:not([hidden])) .card {
  height: auto;
  min-height: 0;
  overflow: hidden;
}

body:has(#view-home:not([hidden])) .site-footer {
  padding: 4px 16px 8px;
}

@media (max-width: 720px) {
  #words-detail:not([hidden]),
  #grammar-detail:not([hidden]) {
    overflow-y: auto;
  }

  #words-detail .detail-layout,
  #grammar-detail .detail-layout {
    display: flex;
    flex-direction: column;
    gap: 18px;
    flex: 1 1 auto;
    min-height: 0;
    overflow: visible;
    overscroll-behavior: contain;
  }

  #words-detail .detail-left,
  #words-detail .detail-right,
  #grammar-detail .detail-left,
  #grammar-detail .detail-right {
    flex: 0 0 auto;
    width: 100%;
    max-width: 100%;
    max-height: none;
    overflow: visible;
  }

  #grammar-detail .detail-left {
    padding-right: 0;
    padding-bottom: 18px;
    border-right: 0;
    border-bottom: 1px dashed #ccc;
  }
}

@media (max-width: 720px) {
  .container {
    padding: 12px 14px 10px;
  }

  body:has(#view-home:not([hidden])) .container {
    padding: 10px 14px 8px;
  }

  body:has(#view-home:not([hidden])) .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: minmax(0, 1fr);
    gap: 8px;
  }

  body:has(#view-home:not([hidden])) .card {
    height: auto;
    min-height: 0;
    padding: 14px 12px;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 8px;
  }

  body:has(#view-home:not([hidden])) .card-icon {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    margin: 0;
    border-radius: 13px;
  }

  body:has(#view-home:not([hidden])) .card-title {
    font-size: clamp(14px, 4vw, 19px);
  }

  body:has(#view-home:not([hidden])) .card-body {
    flex: 0 0 auto;
    margin: 0;
    padding-right: 0;
  }

  body:has(#view-home:not([hidden])) .card-desc,
  body:has(#view-home:not([hidden])) .card-arrow {
    display: none;
  }

  body:has(#view-home:not([hidden])) .card::before {
    right: 4px;
    bottom: -14px;
    font-size: 64px;
  }

  body:has(#view-home:not([hidden])) .site-footer {
    padding: 3px 14px 7px;
  }

  .words-screen {
    margin-top: 10px;
    padding: 18px 16px;
  }

  .words-topbar {
    padding: 10px 14px;
  }
}

@media (max-height: 640px) {
  body:has(#view-home:not([hidden])) .header-inner {
    min-height: 150px;
    padding-top: 12px;
    gap: 12px;
  }

  body:has(#view-home:not([hidden])) .brand {
    flex-direction: row;
    gap: 8px;
    text-align: left;
  }

  body:has(#view-home:not([hidden])) .brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 13px;
    font-size: 19px;
  }

  body:has(#view-home:not([hidden])) .brand-text {
    align-items: flex-start;
  }

  body:has(#view-home:not([hidden])) .brand-text small {
    display: none;
  }

  body:has(#view-home:not([hidden])) .global-search {
    min-height: 52px;
  }

  body:has(#view-home:not([hidden])) .search-button {
    min-height: 40px;
  }

  body:has(#view-home:not([hidden])) .card {
    padding-top: 12px;
    padding-bottom: 12px;
  }

  body:has(#view-home:not([hidden])) .card-icon {
    flex-basis: 42px;
    width: 42px;
    height: 42px;
  }
}

/* ==================== 搜索结果 ==================== */
.search-results-head {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 2px 18px;
  border-bottom: 1px solid var(--line);
}

.search-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: 0.18em;
}

.search-result-title {
  margin: 4px 0 4px;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.25;
  letter-spacing: 0.02em;
  word-break: break-word;
}

.search-result-summary {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.search-status {
  flex: 0 0 auto;
  margin: 14px 2px 0;
  color: var(--muted);
  font-size: 13.5px;
}

.search-results {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 22px 2px 32px;
  scrollbar-gutter: stable;
}

.search-group + .search-group {
  margin-top: 30px;
}

.search-group-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
}

.search-group-title {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
}

.search-group-count {
  color: var(--muted);
  font-size: 12px;
}

.search-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.search-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: inherit;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.search-card:hover {
  transform: translateY(-3px);
  border-color: rgba(91, 110, 225, 0.24);
  box-shadow: var(--shadow-hover);
}

.search-card:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.search-kanji-card {
  background: linear-gradient(180deg, #ffffff 0%, #fbfbfe 100%);
}

.search-kanji-pair {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 6px 0 4px;
}

.search-kanji-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 86px;
}

.search-kanji-label {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.12em;
}

.search-kanji-char {
  font-family: Georgia, "Yu Mincho", "Noto Serif CJK JP", serif;
  font-size: clamp(46px, 6vw, 64px);
  font-weight: 600;
  line-height: 1.05;
}

.search-kanji-char.is-cn {
  color: var(--accent);
}

.search-kanji-arrow {
  color: var(--muted);
  font-size: 18px;
}

.search-kanji-diff {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.7;
}

.search-word-top {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
}

.search-word-word {
  font-size: 26px;
  font-weight: 650;
  line-height: 1.7;
  letter-spacing: 0.02em;
}

.search-word-meaning {
  margin: 0;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.7;
}

.search-empty {
  flex: 1 1 auto;
  display: grid;
  place-items: center;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

/* 从搜索结果直接打开单词详情时，隐藏学习进度栏 */
#view-words.is-search-detail .words-topbar,
#view-words.is-search-detail .words-status {
  display: none;
}

#view-words.is-search-detail .words-screen {
  margin-top: 0;
}

/* 模态框中的大号中日对比字 */
.modal-kanji-hero {
  display: flex;
  justify-content: center;
  gap: 18px;
  padding: 6px 0 16px;
}

.modal-kanji-cell {
  flex: 1 1 0;
  max-width: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 12px 10px 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, var(--surface-subtle) 100%);
}

.modal-kanji-label {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.12em;
}

.modal-kanji-char {
  font-family: Georgia, "Yu Mincho", "Noto Serif CJK JP", serif;
  font-size: clamp(58px, 9vw, 82px);
  font-weight: 600;
  line-height: 1.05;
}

.modal-kanji-char.is-cn {
  color: var(--accent);
}

@media (max-width: 720px) {
  .search-results-head {
    flex-direction: column;
    align-items: stretch;
  }

  .search-results-head .ghost-button {
    align-self: flex-start;
  }

  .search-grid {
    grid-template-columns: 1fr;
  }

  .search-kanji-pair {
    gap: 12px;
  }

  .modal-kanji-hero {
    gap: 10px;
  }

  .modal-kanji-cell {
    max-width: none;
    padding: 10px 6px;
  }

  .modal-kanji-char {
    font-size: 56px;
  }
}

/* ==================== 条件渲染补充 ==================== */
.search-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.search-card-tag,
.modal-tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--kanji-soft);
  color: var(--kanji);
  font-size: 11.5px;
  line-height: 1.5;
  word-break: break-word;
}

.modal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 12px;
}

.modal-section + .modal-section {
  margin-top: 16px;
}

/* ==================== 中日字形字体隔离 ====================
 * “角”“直”等中日共用码位的字，浏览器只能靠 lang 选择字体。
 * 这里同时覆盖大字号汉字，避免原有 serif 规则把日文字形渲成中文字形。
 */
[lang="ja"] {
  font-family: 'Yu Gothic', 'Meiryo', 'Noto Sans JP', sans-serif;
}

[lang="zh-CN"] {
  font-family: 'Microsoft YaHei', 'PingFang SC', 'Noto Sans SC', sans-serif;
}

.search-kanji-char[lang="ja"],
.modal-kanji-char[lang="ja"] {
  font-family: 'Yu Gothic', 'Meiryo', 'Noto Sans JP', sans-serif;
}

.search-kanji-char[lang="zh-CN"],
.modal-kanji-char[lang="zh-CN"] {
  font-family: 'Microsoft YaHei', 'PingFang SC', 'Noto Sans SC', sans-serif;
}

/* ==================== 字源探秘 ==================== */
.etymology-box {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid rgba(91, 110, 225, 0.10);
  border-radius: 12px;
  background: var(--surface-inset);
  text-align: left;
}

.etymology-title {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.etymology-text {
  margin: 0;
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.85;
  word-break: break-word;
}

.search-etymology-box {
  margin-top: 2px;
}

/* ==================== 弹窗例词分类 ==================== */
.example-group {
  margin-top: 10px;
}

.example-group:first-of-type {
  margin-top: 0;
}

.example-group-title {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.example-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
}

.example-tag {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 10px 16px;
  border-radius: 16px;
  background: var(--chip-bg);
  color: var(--chip-text);
  font-size: 1.25rem;
  line-height: 1.55;
  word-break: break-word;
  box-shadow: inset 0 0 0 1px rgba(80, 94, 125, 0.05);
}

.modal-etymology {
  margin-top: 18px;
}

/* ==================== 综合练习 ==================== */
#exercise-question:not([hidden]),
#exercise-result:not([hidden]),
#exercise-done:not([hidden]) {
  display: flex;
  flex-direction: column;
}

.exercise-screen .study-tag {
  align-self: center;
  margin-bottom: 6px;
}

.exercise-question {
  width: min(920px, 100%);
  margin: 0 auto 26px;
  text-align: center;
  font-size: var(--question-font-size);
  font-weight: 600;
  line-height: 1.7;
  word-break: break-word;
}

.exercise-options {
  grid-template-columns: 1fr;
  max-width: 760px;
}

.sentence-builder {
  width: min(920px, 100%);
  margin: 0 auto;
  padding: 8px 0 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sentence-bank,
.sentence-answer {
  display: flex;
  align-content: flex-start;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  min-height: 58px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  transition: border-color 0.22s ease;
}

.sentence-bank {
  align-items: flex-end;
}

.sentence-answer {
  min-height: 82px;
  margin-top: clamp(18px, 4vh, 40px);
  padding-bottom: 16px;
  align-items: flex-end;
  border-bottom: 1px dashed rgba(91, 110, 225, 0.28);
}

.sentence-answer.is-correct {
  border-bottom-color: rgba(47, 158, 107, 0.55);
}

.sentence-answer.is-wrong {
  border-bottom-color: rgba(208, 88, 79, 0.55);
}

.sentence-answer.is-correct .sentence-token {
  background: var(--ok-soft);
  color: var(--ok-strong);
  box-shadow: 0 5px 14px rgba(47, 158, 107, 0.11);
}

.sentence-answer.is-wrong .sentence-token {
  background: var(--bad-soft);
  color: var(--bad-strong);
  box-shadow: 0 5px 14px rgba(208, 88, 79, 0.1);
}

.sentence-token {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 10px 19px;
  border: 0;
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 1.12rem;
  line-height: 1.45;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37, 47, 78, 0.075);
  transition: transform 0.2s cubic-bezier(0.22, 0.8, 0.3, 1), background 0.2s ease,
    color 0.2s ease, box-shadow 0.2s ease;
}

.sentence-token:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.035);
  background: #e7ebf5;
  box-shadow: 0 8px 20px rgba(37, 47, 78, 0.12);
}

.sentence-token:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.sentence-token.is-placed {
  background: var(--accent-soft);
  color: var(--accent-dark);
  box-shadow: 0 6px 16px rgba(91, 110, 225, 0.12);
}

.sentence-token.is-flipping {
  position: relative;
  z-index: 2;
  will-change: transform;
  transition: transform 300ms cubic-bezier(0.22, 0.8, 0.3, 1);
}

.sentence-token:disabled {
  cursor: default;
  opacity: 0.82;
  transform: none;
}

#exercise-sentence-submit {
  align-self: center;
  min-width: 140px;
  margin-top: 2px;
}

.exercise-fill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}

#exercise-fill-input {
  width: min(420px, 100%);
  min-width: 240px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: inherit;
  font-family: inherit;
  font-size: 20px;
  text-align: center;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

#exercise-fill-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-shadow);
}

#exercise-fill-input.is-correct {
  border-color: var(--ok);
  background: var(--ok-soft);
  color: var(--ok-strong);
}

#exercise-fill-input.is-wrong {
  border-color: var(--bad);
  background: var(--bad-soft);
  color: var(--bad-strong);
}

.exercise-result-card {
  width: min(820px, 100%);
  margin: auto;
}

.exercise-result-status {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  margin: 0 0 16px;
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

.exercise-result-status.is-correct {
  background: var(--ok-soft);
  color: var(--ok-strong);
}

.exercise-result-status.is-wrong {
  background: var(--bad-soft);
  color: var(--bad-strong);
}

.exercise-result-heading {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.exercise-result-question {
  margin: 0 0 20px;
  font-size: var(--question-font-size);
  line-height: 1.7;
  word-break: break-word;
}

.exercise-answer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 18px;
}

.exercise-answer-grid > div {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-subtle);
}

.exercise-answer-grid dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.exercise-answer-grid dd {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  word-break: break-word;
}

.exercise-explanation {
  padding: 17px 19px;
  border: 0;
  border-radius: 14px;
  background: var(--surface-inset);
  color: var(--text-soft);
}

.exercise-explanation-title {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.exercise-explanation p {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.85;
  white-space: pre-line;
}

.exercise-result-actions {
  margin-top: 18px;
  text-align: right;
}

@media (max-width: 720px) {
  .exercise-question {
    margin-bottom: 20px;
    font-size: var(--question-font-size);
  }

  .exercise-fill {
    flex-direction: column;
  }

  #exercise-fill-input {
    width: 100%;
    min-width: 0;
  }

  .sentence-builder {
    gap: 12px;
    padding-bottom: 14px;
  }

  .sentence-bank,
  .sentence-answer {
    gap: 8px;
    min-height: 48px;
    padding: 0;
    border-radius: 0;
  }

  .sentence-answer {
    min-height: 70px;
    margin-top: 18px;
    padding-bottom: 14px;
  }

  .sentence-token {
    min-height: 40px;
    padding: 8px 14px;
    font-size: 1rem;
  }

  .exercise-answer-grid {
    grid-template-columns: 1fr;
  }

  .exercise-result-actions {
    text-align: center;
  }
}

/* ==================== 统一注音排版 ==================== */
ruby {
  ruby-position: over;
  ruby-align: center;
}

rt {
  color: var(--muted);
  font-size: 0.38em;
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: 0;
}

.detail-ruby rt {
  font-size: 0.34em;
}

.search-word-word rt {
  font-size: 0.4em;
}

.example-jp ruby,
.example-cn ruby,
.grammar-text ruby,
.distinction-diff ruby,
.search-word-meaning ruby,
.search-kanji-diff ruby,
.etymology-text ruby,
.modal-value ruby {
  line-height: 1.8;
}

.example-jp rt,
.example-cn rt,
.grammar-text rt,
.distinction-diff rt,
.search-word-meaning rt,
.search-kanji-diff rt,
.etymology-text rt,
.modal-value rt,
.example-tag rt {
  font-size: 0.46em;
  line-height: 1.15;
  color: #8a8f99;
}

.example-tag ruby {
  line-height: 1.7;
}

/* ==================== 单词拼写测试 ==================== */
#words-spelling:not([hidden]) {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.spelling-panel:not([hidden]) {
  display: flex;
  width: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
}

.spelling-reveal-word {
  margin: 0;
}

.spelling-reveal-word rt {
  font-size: 0.34em;
}

.spelling-meaning {
  width: min(820px, 100%);
  margin: 0;
  font-size: clamp(24px, 4vw, 40px);
  font-weight: 600;
  line-height: 1.7;
  word-break: break-word;
}

.spelling-form {
  display: flex;
  width: min(680px, 100%);
  gap: 12px;
}

#spelling-input,
#spelling-recognition-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 15px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: inherit;
  font-family: inherit;
  font-size: 24px;
  text-align: center;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

#spelling-input:focus,
#spelling-recognition-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-shadow);
}

#spelling-input.is-wrong,
#spelling-recognition-input.is-wrong {
  border-color: var(--bad);
  background: var(--bad-soft);
  color: var(--bad-strong);
}

@media (max-width: 720px) {
  .spelling-form {
    flex-direction: column;
  }

  .spelling-form .primary-button {
    width: 100%;
  }
}

/* ==================== 教材 / 章节层级页面 ==================== */
#view-books:not([hidden]),
#view-chapters:not([hidden]) {
  overflow: hidden;
}

.catalog-head {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 4px 2px 20px;
  border-bottom: 1px solid var(--line);
}

.catalog-kicker {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.catalog-title {
  margin: 0;
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1.35;
  letter-spacing: 0.02em;
}

.catalog-subtitle {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13.5px;
}

.catalog-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 8px;
}

.book-grid {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-content: center;
  gap: 18px;
  padding: 24px 2px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.book-card {
  position: relative;
  min-height: 190px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    radial-gradient(circle at 100% 0%, rgba(91, 110, 225, 0.10), transparent 42%),
    var(--surface);
  color: inherit;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.book-card:hover {
  transform: translateY(-3px);
  border-color: #cfd5ee;
  box-shadow: var(--shadow-hover);
}

.book-card:focus-visible,
.chapter-card:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.book-number {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.book-copy {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.book-title {
  font-size: clamp(17px, 2vw, 21px);
  line-height: 1.5;
}

.book-meta {
  color: var(--muted);
  font-size: 13px;
}

.book-arrow {
  position: absolute;
  right: 22px;
  top: 27px;
  color: #b9bfd3;
  font-size: 19px;
  transition: transform 0.18s ease, color 0.18s ease;
}

.book-card:hover .book-arrow {
  transform: translateX(3px);
  color: var(--accent);
}

.chapter-grid {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-content: start;
  gap: 12px;
  margin-top: 18px;
  padding: 0 4px 18px 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.chapter-card {
  position: relative;
  min-height: 104px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 16px 42px 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: inherit;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(24, 32, 56, 0.025);
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.chapter-card:hover {
  transform: translateY(-2px);
  border-color: #cfd5ee;
  box-shadow: 0 8px 20px rgba(24, 32, 56, 0.07);
}

.chapter-card.is-empty {
  background: #fafbfc;
}

.chapter-number {
  font-size: 15.5px;
  font-weight: 650;
}

.chapter-count {
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
}

.chapter-count::before {
  content: "·";
  margin-right: 7px;
  color: #b9bfcc;
}

.chapter-card.is-empty .chapter-number,
.chapter-card.is-empty .chapter-count {
  color: #9aa0ad;
}

.chapter-arrow {
  position: absolute;
  right: 16px;
  top: 50%;
  color: #c3c8d6;
  font-size: 16px;
  transform: translateY(-50%);
  transition: transform 0.16s ease, color 0.16s ease;
}

.chapter-card:hover .chapter-arrow {
  transform: translate(2px, -50%);
  color: var(--accent);
}

@media (max-width: 900px) {
  .book-grid {
    grid-template-columns: 1fr;
    align-content: start;
    gap: 12px;
    padding: 16px 2px;
  }

  .book-card {
    min-height: 132px;
    padding: 20px;
  }

  .book-arrow {
    right: 20px;
    top: 22px;
  }

  .chapter-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .catalog-head {
    align-items: flex-start;
    gap: 12px;
    padding-bottom: 14px;
  }

  .catalog-actions {
    justify-content: flex-end;
  }

  .catalog-actions .ghost-button {
    padding: 7px 12px;
    font-size: 12px;
  }

  .chapter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    margin-top: 12px;
  }

  .chapter-card {
    min-height: 88px;
    padding: 13px 34px 13px 14px;
  }

  .chapter-number {
    font-size: 14.5px;
  }

  .chapter-count {
    font-size: 11.5px;
  }

  .chapter-arrow {
    right: 12px;
  }
}

@media (max-width: 560px) {
  body:has(#view-home:not([hidden])) .card-grid {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(2, minmax(0, 1fr));
  }

  body:has(#view-home:not([hidden])) .card {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 14px;
    padding: 18px;
  }

  body:has(#view-home:not([hidden])) .card-body {
    flex: 1 1 auto;
  }

  body:has(#view-home:not([hidden])) .card-desc,
  body:has(#view-home:not([hidden])) .card-arrow {
    display: initial;
  }

  .catalog-head {
    flex-wrap: wrap;
  }

  .catalog-actions {
    width: 100%;
  }
}
