/* 学习页面共用原首页颜色。新增组件集中在此，避免改动原有笔记布局。 */
.learning-banner {
  padding: 12px 16px;
  margin-bottom: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #eee8fa;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.account-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--purple);
  min-height: 44px;
}
.account-link span {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.study-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 0 0 24px;
}
.stat {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
  padding: 14px 18px;
}
.stat strong {
  font-size: 24px;
  display: block;
  color: var(--purple);
}
.stat span {
  font-size: 13px;
  color: var(--muted);
}
.learning-panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 20px;
}
.learning-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 22px;
}
.learning-head h1 {
  font-size: 28px;
}
.learning-head p {
  color: var(--muted);
  font-size: 14px;
}
.row-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.learning-panel button:disabled,
.study-surface button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
  min-width: 0;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #a49baf;
  background: white;
  color: var(--ink);
  padding: 10px 12px;
  border-radius: 10px;
  font: inherit;
  font-size: 16px;
}
.field textarea {
  resize: vertical;
  min-height: 95px;
}
.field select {
  min-height: 46px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.span-all {
  grid-column: 1/-1;
}
.browse-tools {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}
.subnav {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.subnav a {
  padding: 10px 14px;
  border-radius: 10px;
  background: white;
  border: 1px solid var(--line);
  font-size: 14px;
}
.subnav a[aria-current] {
  background: var(--lavender);
  color: var(--purple);
}
.word-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.word-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  min-width: 0;
}
.word-card h3 {
  font-size: 25px;
  line-height: 1.7;
  overflow-wrap: anywhere;
  margin: 10px 0 4px;
}
.word-card .translation {
  font-size: 18px;
  margin-bottom: 8px;
}
.word-card .small {
  overflow-wrap: anywhere;
}
.word-card .row-actions {
  margin-top: 15px;
  gap: 6px;
}
.chip {
  border: 1px solid var(--line);
  color: var(--muted);
  background: white;
  padding: 7px 10px;
  min-height: 40px;
  border-radius: 9px;
  font-size: 13px;
}
.chip[aria-pressed="true"] {
  background: var(--lavender);
  border-color: #b29adf;
  color: var(--purple);
}
.danger {
  color: #a33348 !important;
  border-color: #e2afb8 !important;
}
.category-title {
  font-size: 18px;
  margin: 22px 0 12px;
}
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin: 24px 0;
}
.subtle {
  color: var(--muted);
  font-size: 14px;
}
.warning {
  background: #fff1da;
  padding: 12px 16px;
  border-radius: 12px;
  color: #775113;
  font-size: 14px;
}
.success {
  color: #246747;
}
.error {
  color: #a33348;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.study-surface {
  max-width: 740px;
  margin: auto;
}
.study-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 14px;
}
.flashcard {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 330px;
  padding: 34px 24px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  overflow-wrap: anywhere;
  width: 100%;
  color: var(--ink);
}
.flashcard .face-label {
  font-size: 13px;
  color: var(--purple);
  margin-bottom: 20px;
}
.flashcard .face-text {
  font-size: 34px;
  line-height: 1.8;
  white-space: pre-wrap;
  max-width: 100%;
}
.flashcard .face-note {
  font-size: 16px;
  color: var(--muted);
  margin-top: 20px;
  white-space: pre-wrap;
  max-width: 100%;
}
.flashcard .flip-hint {
  margin-top: 24px;
  font-size: 14px;
  color: var(--muted);
}
.flashcard.enter {
  animation: card-enter 0.18s ease-out;
}
.ratings {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 20px 0;
}
.rating {
  border-radius: 12px;
  padding: 12px 8px;
  min-height: 70px;
  color: #5942a6;
  background: #eae7fa;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.rating small {
  font-size: 12px;
}
.rating[data-rating="easy"] {
  background: #e7f3ed;
  color: #246747;
}
.rating[data-rating="hard"] {
  background: #fff1da;
  color: #885a13;
}
.rating[data-rating="forgot"] {
  background: #fbe8eb;
  color: #a33348;
}
.study-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 16px 0;
}
.toast {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  max-width: min(92vw, 650px);
  padding: 14px 22px;
  background: #30283f;
  color: white;
  border-radius: 14px;
  z-index: 100;
  box-shadow: 0 8px 24px #0002;
  font-size: 14px;
}
.app-dialog {
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 28px;
  width: min(620px, calc(100vw - 28px));
  max-height: 90dvh;
  overflow: auto;
  color: var(--ink);
  background: white;
}
.app-dialog::backdrop {
  background: #29213566;
}
.app-dialog h2 {
  margin-bottom: 18px;
}
.app-dialog .row-actions {
  margin-top: 22px;
}
.auth-wrap {
  max-width: 480px;
  margin: 24px auto;
}
.auth-wrap .field {
  margin-bottom: 16px;
}
.auth-wrap .btn {
  min-height: 46px;
}
.sync-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.sync-grid p {
  overflow-wrap: anywhere;
}
.sync-status {
  font-size: 14px;
  overflow-wrap: anywhere;
}
.history-row {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
@keyframes card-enter {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@media (max-width: 720px) {
  .account-link {
    margin-left: auto;
    margin-right: 10px;
  }
  .account-link span {
    max-width: 90px;
    font-size: 12px;
  }
  .header-inner .brand {
    font-size: 18px;
  }
  .header-inner .brand-mark {
    width: 30px;
    height: 30px;
  }
  .study-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .word-grid,
  .form-grid,
  .sync-grid {
    grid-template-columns: 1fr;
  }
  .browse-tools {
    grid-template-columns: 1fr 1fr;
  }
  .browse-tools .field:first-child {
    grid-column: 1/-1;
  }
  .learning-panel {
    padding: 20px;
  }
  .learning-head h1 {
    font-size: 24px;
  }
  .ratings {
    grid-template-columns: repeat(2, 1fr);
  }
  .flashcard {
    min-height: 290px;
    padding: 28px 18px;
  }
  .flashcard .face-text {
    font-size: 28px;
  }
  .app-dialog {
    padding: 22px;
  }
  .span-all {
    grid-column: auto;
  }
  .row-actions .btn {
    flex-grow: 1;
  }
  .learning-banner {
    font-size: 13px;
  }
  .account-link .avatar {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .flashcard.enter {
    animation: none;
  }
}

/* 拼音优先：泰文只作辅助，不将中文答案提前放在题面。 */
.romanization-title { font-size: 28px !important; line-height: 1.55; overflow-wrap: anywhere; }
.field .romanization-input { font-size: 28px; line-height: 1.5; padding: 16px; }
.thai-script { display: block; font-size: 18px; font-weight: 400; line-height: 1.8; color: var(--muted); overflow-wrap: anywhere; }
.resource-card img { width: 100%; max-height: 420px; object-fit: contain; border-radius: 12px; background: #f5f3f8; }
.resource-card h2 { margin: 16px 0 8px; overflow-wrap: anywhere; }
.resource-description { white-space: pre-wrap; overflow-wrap: anywhere; margin-bottom: 16px; }
.resource-card .row-actions { margin-top: 18px; }
#content-form textarea { min-height: 140px; }
@media (max-width:720px) { .field .romanization-input { font-size:24px; } .thai-script { font-size:16px; } }

/* 内容管理：列表与四栏句型。窄屏分为两列，保持拼音可读。 */
.bulk-tools { margin: 18px 0; gap: 10px; }
.compact-list, .sentence-list, .cards.notes-list { grid-template-columns: minmax(0,1fr); }
.word-card details > summary { cursor:pointer; font-size:20px; font-weight:600; overflow-wrap:anywhere; }
.word-card details > summary .small { display:block; font-weight:400; }
.select-word { display:flex; align-items:center; gap:8px; min-height:44px; font-size:14px; }
.select-word input { width:20px; height:20px; }
.sentence-pattern { display:grid; grid-template-columns:1fr 1.5fr 1.4fr 1fr; gap:12px; margin:20px 0; }
.sentence-pattern section { background:#f8f6fc; border:1px solid #ddd6eb; border-radius:16px; padding:18px; min-width:0; }
.sentence-pattern section:nth-child(even) { background:#e9e3f4; }
.sentence-pattern section > div { font-size:28px; line-height:1.9; overflow-wrap:anywhere; margin-top:12px; }
.sentence-editor { border:1px solid #ddd6eb; border-radius:12px; padding:16px; display:grid; grid-template-columns:1fr 1fr; gap:12px; min-width:0; }
.sentence-editor > p { grid-column:1/-1; }
.note summary { cursor:pointer; }
.note[open] .note-summary { display:block; max-height:none; overflow:visible; -webkit-line-clamp:unset; }
.field input[type=file] { min-height:48px; cursor:pointer; }
.field input[type=file]::file-selector-button { min-height:40px; border:0; border-radius:8px; padding:8px 14px; background:#e9e3f4; color:#302442; margin-right:8px; }
@media(max-width:720px) {
  .sentence-pattern { grid-template-columns:1fr 1fr; gap:8px; }
  .sentence-pattern section { padding:12px; }
  .sentence-pattern section > div { font-size:23px; }
  .sentence-editor { grid-template-columns:1fr; }
  .bulk-tools .btn { flex:1 1 140px; }
}
