/* "Danh ngôn" (quotes.js): mobile QuotationList/QuotationDetail style (the hero gradient
   hero → lerp(hero, primary, 45 %), the accent-rule quote cards, TipCard, Mầm Chat), laid out for
   the web: page head with "Tra từ điển" and "Báo cáo", the featured quote as a wide hero beside the
   tip, the rest as a masonry of cards; the detail as .web-split (quote + discussion | tip + others).
   The second half styles mobile's shared CommentCard / CommentComposer (.comment-*, from
   audio-comments-ui.js) for every discussion that uses them. Phones keep the app's single column. */
.quotes-page,
.quotes-detail {
  --qt-hero: var(--md-hero);
  --qt-hero-end: #007063;
  --qt-link: var(--md-hero);
  --qt-rule: #00796b73;
  --qt-shadow: var(--md-card-shadow);
  --qt-shadow-hover: var(--md-card-shadow-hover);
  gap: 24px;
}
.quotes-page .mi,
.quotes-detail .mi {
  width: 20px;
  height: 20px;
  flex: none;
}
.quotes-page blockquote,
.quotes-detail blockquote {
  margin: 0;
}
.quotes-page ul,
.quotes-detail ul,
.quotes-detail ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ---------- page head ---------- */
.quotes-head {
  align-items: center;
}
.quotes-intro {
  display: grid;
  gap: 4px;
}
.quotes-intro p {
  max-width: 640px;
}
.quotes-intro .quotes-count {
  color: var(--md-on-surface-variant);
  font-size: 14px;
}
.quotes-actions {
  flex: none;
  flex-wrap: nowrap;
}
.quotes-action {
  min-height: 46px;
  padding: 0 20px 0 16px;
  border-radius: 999px;
  border-color: var(--md-outline-variant);
  color: var(--qt-link);
  font: 700 14px/20px var(--font-app-bold);
  white-space: nowrap;
  text-decoration: none;
}
.quotes-action .mi {
  color: var(--md-primary);
}

/* ---------- states ---------- */
.quotes-loading {
  padding: 64px 0;
}
.quotes-state {
  padding-top: 32px;
}
.quotes-empty {
  padding: 72px 24px;
  border: 1px solid var(--md-outline-variant);
  border-radius: 20px;
  background: var(--md-surface);
  color: var(--md-on-surface-variant);
  font-size: 16px;
  text-align: center;
}
.quotes-note {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  padding: 6px 8px 6px 14px;
  border-radius: 14px;
  background: var(--md-streak-container);
  color: var(--md-on-streak-container);
  font-size: 14px;
  line-height: 20px;
}
.quotes-note span {
  flex: 1;
  min-width: 0;
}
.quotes-note .button {
  min-height: 40px;
  padding: 6px 14px;
  color: var(--md-warning);
  font-weight: 700;
}
.quotes-detail > .quotes-note {
  margin-bottom: 0;
}

/* ---------- FeaturedQuotationCard (list) and the detail's quote ---------- */
.quotes-hero {
  position: relative;
  display: grid;
  align-content: start;
  gap: 14px;
  min-width: 0;
  padding: 22px 20px 18px;
  overflow: hidden;
  border-radius: 24px;
  background: linear-gradient(135deg, var(--qt-hero), var(--qt-hero-end));
  box-shadow: 0 10px 28px #00695c2e;
  color: #fff;
}
.quotes-hero > * {
  position: relative;
}
.quotes-hero .quotes-hero-glyph {
  position: absolute;
  top: 4px;
  right: 8px;
  width: 84px;
  height: 84px;
  color: #ffffff24;
}
.quotes-hero-label {
  font: 700 12px/16px var(--font-app-bold);
  letter-spacing: 0.3px;
  color: var(--md-on-hero-muted);
}
.quotes-hero-text {
  font: 600 24px/32px var(--font-app);
  overflow-wrap: anywhere;
}
.quotes-hero-author {
  color: var(--md-on-hero-muted);
  font-size: 14px;
  line-height: 20px;
}
.quotes-hero-actions,
.quotes-hero-foot {
  display: flex;
  align-items: center;
  gap: 8px;
}
.quotes-like-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  background: #ffffff29;
  font: 600 12px/16px var(--font-app);
}
.quotes-hero .quotes-like-chip .mi {
  width: 16px;
  height: 16px;
}
.quotes-hero-open {
  display: inline-flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  background: #fff;
  color: var(--qt-hero);
  font: 700 14px/20px var(--font-app-bold);
  text-decoration: none;
  white-space: nowrap;
}
.quotes-hero-open .mi {
  width: 18px;
  height: 18px;
}
.quotes-hero-open:hover {
  background: var(--md-primary-container);
}
.quotes-hero-foot .quotes-hero-author {
  flex: 1;
  min-width: 0;
}
.quotes-hero-report {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  margin-left: auto;
  padding: 0 16px 0 12px;
  border: 1px solid #ffffff59;
  border-radius: 999px;
  color: #fff;
  font: 600 13px/18px var(--font-app);
  text-decoration: none;
}
.quotes-hero-report .mi {
  width: 18px;
  height: 18px;
}
.quotes-hero-report:hover {
  background: #ffffff1f;
}
.quotes-hero :focus-visible {
  outline-color: #ffd28a;
}

/* ---------- the top row: hero + TipCard ---------- */
.quotes-top {
  display: grid;
  gap: 12px;
  margin-bottom: 28px;
}
.quotes-top .story-tip,
.quotes-tip-home .story-tip,
.quotes-tip-slot .story-tip {
  margin: 0;
  padding: 16px 6px 6px 16px;
  font: 400 14px/21px var(--font-app);
}
.quotes-tip-home:not(:has(.story-tip)),
.quotes-tip-slot:not(:has(.story-tip)) {
  display: none;
}

/* ---------- "Tất cả trích dẫn": QuotationItem cards in a masonry ---------- */
.quotes-section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.quotes-badge {
  min-width: 30px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--md-primary-container);
  color: #00413a;
  font: 700 13px/20px var(--font-app-bold);
  text-align: center;
}
.quotes-grid {
  columns: 300px;
  column-gap: 16px;
}
.quotes-grid > li {
  break-inside: avoid;
  margin-bottom: 16px;
}
.quotes-card {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 18px 18px 12px 32px;
  border: 1px solid var(--md-outline-variant);
  border-radius: 18px;
  background: var(--md-surface);
  box-shadow: var(--qt-shadow);
  color: var(--md-on-surface);
  text-decoration: none;
}
.quotes-card::before {
  content: "";
  position: absolute;
  top: 18px;
  bottom: 14px;
  left: 16px;
  width: 4px;
  border-radius: 4px;
  background: var(--qt-rule);
}
.quotes-card-text {
  font: italic 400 16px/24px var(--font-app);
  overflow-wrap: anywhere;
}
.quotes-card-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
  color: var(--md-on-surface-variant);
  font-size: 13px;
  line-height: 18px;
}
.quotes-card-author {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.quotes-card .quotes-card-chevron {
  color: var(--md-outline);
  opacity: 0.55;
}
.quotes-card:hover {
  border-color: #b9dbd3;
  box-shadow: var(--qt-shadow-hover);
}
.quotes-card:hover .quotes-card-chevron {
  color: var(--md-primary);
  opacity: 1;
}

/* ---------- detail: quote + discussion | tip + "Trích dẫn khác" ---------- */
.quotes-main {
  display: grid;
  gap: 20px;
  min-width: 0;
}
.quotes-hero.is-detail {
  gap: 18px;
  padding: 28px 24px 18px;
}
.quotes-hero.is-detail .quotes-hero-text {
  padding-right: 48px;
}
.quotes-discussion {
  display: grid;
  gap: 14px;
  padding: 24px;
}
.quotes-comments-title:focus {
  outline: none;
}
.quotes-comment-status:empty {
  display: none;
}
.quotes-comment-status {
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--md-primary-container);
  color: #00413a;
  font-size: 14px;
  line-height: 20px;
}
.quotes-comment-status a {
  margin-left: 4px;
  color: var(--qt-link);
  font-weight: 700;
}
.quotes-comments .quotes-loading {
  padding: 32px 0;
}
.quotes-aside-title {
  margin: 0 0 12px;
  font: 700 17px/24px var(--font-app-bold);
}
.quotes-related {
  padding: 20px;
}
.quotes-related-list {
  display: grid;
  gap: 10px;
}
.quotes-related-card {
  position: relative;
  display: grid;
  gap: 4px;
  padding: 12px 14px 12px 24px;
  border: 1px solid var(--md-outline-variant);
  border-radius: 14px;
  color: var(--md-on-surface);
  text-decoration: none;
}
.quotes-related-card::before {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 12px;
  width: 3px;
  border-radius: 3px;
  background: var(--qt-rule);
}
.quotes-related-text {
  display: -webkit-box;
  overflow: hidden;
  font: italic 400 14px/21px var(--font-app);
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}
.quotes-related-card small {
  color: var(--md-on-surface-variant);
  font-size: 12px;
  line-height: 16px;
}
.quotes-related-card:hover {
  border-color: #b9dbd3;
  background: #f7faf9;
}
.quotes-related-all {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 44px;
  margin-top: 6px;
  color: var(--qt-link);
  font: 700 14px/20px var(--font-app-bold);
  text-decoration: none;
}
.quotes-related-all:hover {
  text-decoration: underline;
}

/* ---------- CommentComposer (shared) ---------- */
.comment-composer {
  display: grid;
  gap: 8px;
  padding: 12px 14px 10px;
  border: 1px solid var(--md-outline-variant);
  border-radius: 18px;
  background: #f7faf9;
  font-family: var(--font-app);
}
.comment-identity {
  display: flex;
  align-items: center;
  gap: 8px;
}
.comment-identity-label {
  flex: none;
  color: var(--md-on-surface-variant);
  font-size: 13px;
  line-height: 18px;
}
.comment-seg {
  display: grid;
  flex: 1;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  gap: 4px;
  max-width: 380px;
  min-width: 0;
  padding: 4px;
  border-radius: 14px;
  background: #e7eeec;
}
.comment-seg.is-single {
  max-width: 190px;
}
.comment-seg-option {
  position: relative;
  min-width: 0;
  margin: 0;
  font-weight: inherit;
}
.comment-seg-option input {
  position: absolute;
  inset: -2px 0;
  z-index: 1;
  width: 100%;
  height: calc(100% + 4px);
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.comment-seg-option span {
  display: block;
  min-height: 40px;
  padding: 10px 8px;
  overflow: hidden;
  border-radius: 10px;
  color: var(--md-on-surface-variant);
  font: 700 14px/20px var(--font-app-bold);
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.comment-seg-option input:checked + span {
  background: var(--md-surface);
  box-shadow: 0 1px 3px #0e24201f;
  color: var(--qt-link, #00695c);
}
.comment-seg-option input:focus-visible + span {
  outline: 3px solid #bb7815;
  outline-offset: 1px;
}
.comment-field-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.comment-field {
  flex: 1;
  min-width: 0;
  min-height: 46px;
  max-height: 124px;
  padding: 11px 16px;
  resize: none;
  border: 1.5px solid var(--md-outline-variant);
  border-radius: 23px;
  background: var(--md-surface);
  color: var(--md-on-surface);
  font: 400 15px/22px var(--font-app);
}
.comment-field::placeholder {
  color: var(--md-on-surface-variant);
}
.comment-field:focus-visible {
  border-color: var(--md-primary);
  outline: 2px solid var(--md-primary);
  outline-offset: 1px;
}
.comment-send {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 0;
  border-radius: 23px;
  background: var(--md-primary);
  color: #fff;
  font: 700 14px/20px var(--font-app-bold);
}
.comment-send .mi {
  width: 20px;
  height: 20px;
}
.comment-send:hover {
  background: var(--md-hero);
}
.comment-send-label {
  display: none;
}
.comment-hint {
  color: var(--md-on-surface-variant);
  font-size: 12px;
  line-height: 18px;
}
.comment-hint a {
  color: var(--md-hero);
  font-weight: 700;
}
.comment-policy {
  color: var(--md-outline);
  font-size: 11px;
  line-height: 16px;
  text-align: center;
}
@media (hover: none) {
  .comment-keys {
    display: none;
  }
  .comment-hint:not(:has(a)) {
    display: none;
  }
}

/* ---------- CommentCard (shared) ---------- */
.comment-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.comment-card {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  font-family: var(--font-app);
}
.comment-avatar {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  background: var(--md-primary-container);
  color: #00413a;
  font: 700 14px/1 var(--font-app-bold);
}
.comment-avatar[data-tint="1"] {
  background: var(--md-streak-container);
  color: var(--md-on-streak-container);
}
.comment-avatar[data-tint="2"] {
  background: #bcebf1;
  color: #002023;
}
.comment-avatar .mi {
  width: 20px;
  height: 20px;
}
.comment-bubble {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px 12px 8px;
  border: 1px solid var(--md-outline-variant);
  border-radius: 4px 18px 18px 18px;
  background: var(--md-surface);
}
.comment-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.comment-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--md-on-surface);
  font: 700 14px/20px var(--font-app-bold);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.comment-time {
  flex: none;
  color: var(--md-outline);
  font-size: 13px;
  line-height: 18px;
}
.comment-text {
  color: var(--md-on-surface);
  font: 400 16px/24px var(--font-app);
  overflow-wrap: anywhere;
  white-space: pre-line;
}
.comment-reactions {
  display: flex;
  gap: 6px;
  padding-top: 2px;
}
.comment-reaction {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--md-outline-variant);
  border-radius: 999px;
  background: transparent;
  color: var(--md-on-surface-variant);
  font: 600 12px/16px var(--font-app);
}
/* 44 px tap target around the 32 px pill. */
.comment-reaction::after {
  content: "";
  position: absolute;
  inset: -6px -2px;
}
.comment-reaction .mi {
  width: 16px;
  height: 16px;
}
.comment-reaction:hover {
  border-color: var(--md-primary);
  background: #00796b0f;
  color: var(--md-primary);
}
.comment-empty {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 8px 16px 16px;
  text-align: center;
}
.comment-empty-mam {
  width: 160px;
}
.comment-empty.is-error .comment-empty-mam {
  width: 120px;
}
.comment-empty h3 {
  margin-top: 4px;
  font: 700 18px/24px var(--font-app-bold);
  color: var(--md-on-surface);
}
.comment-empty p {
  max-width: 360px;
  color: var(--md-on-surface-variant);
  font-size: 15px;
  line-height: 22px;
}
.comment-empty .button {
  margin-top: 8px;
}

/* ---------- widths ---------- */
@media (min-width: 768px) {
  .comment-send {
    width: auto;
    padding: 0 18px 0 14px;
  }
  .comment-send-label {
    display: inline;
  }
  .comment-composer {
    padding: 14px 16px 10px;
  }
}
@media (min-width: 1024px) {
  .quotes-hero.is-featured {
    gap: 16px;
    min-height: 260px;
    padding: 34px 40px 30px;
  }
  .quotes-hero.is-featured .quotes-hero-text {
    max-width: 760px;
    padding-right: 96px;
    font-size: 30px;
    line-height: 40px;
  }
  .quotes-hero.is-featured .quotes-hero-glyph,
  .quotes-hero.is-detail .quotes-hero-glyph {
    top: 10px;
    right: 18px;
    width: 140px;
    height: 140px;
  }
  .quotes-hero.is-featured .quotes-hero-actions {
    margin-top: 6px;
  }
  .quotes-hero.is-featured .quotes-hero-open {
    flex: none;
    padding: 0 24px;
  }
  .quotes-hero.is-detail {
    padding: 30px 28px 22px;
  }
  .quotes-hero.is-detail .quotes-hero-text {
    padding-right: 24px;
    font-size: 24px;
    line-height: 33px;
  }
  .quotes-split {
    grid-template-columns: minmax(0, 1fr) 300px;
  }
  .quotes-aside .story-tip {
    padding: 18px 8px 8px 18px;
    border-radius: 20px;
  }
}
/* Wide enough for the featured quote and the tip side by side; below this the tip sits under it. */
@media (min-width: 1280px) {
  .quotes-top.has-tip {
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 20px;
  }
  .quotes-top .story-tip {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px 8px 8px 20px;
    border-radius: 24px;
    font-size: 15px;
    line-height: 23px;
  }
  .quotes-hero.is-detail {
    padding: 34px 36px 24px;
  }
  .quotes-hero.is-detail .quotes-hero-text {
    padding-right: 96px;
    font-size: 28px;
    line-height: 38px;
  }
  .quotes-split {
    grid-template-columns: minmax(0, 1fr) 340px;
  }
  .quotes-discussion {
    padding: 28px 32px;
  }
}
@media (max-width: 767px) {
  .quotes-page,
  .quotes-detail {
    gap: 16px;
  }
  .quotes-head {
    align-items: stretch;
  }
  .quotes-intro p:first-child {
    font-size: 14px;
    line-height: 20px;
  }
  .quotes-actions {
    width: 100%;
  }
  .quotes-action {
    flex: 1;
    min-height: 44px;
    padding: 0 12px;
  }
  .quotes-top {
    margin-bottom: 20px;
  }
  .quotes-section-head {
    margin-bottom: 12px;
  }
  .quotes-section-head .web-section-title {
    font-size: 18px;
    line-height: 24px;
  }
  .quotes-grid {
    columns: auto;
  }
  .quotes-grid > li {
    margin-bottom: 12px;
  }
  .quotes-card {
    padding: 14px 16px 10px 32px;
  }
  .quotes-card::before {
    top: 14px;
    bottom: 12px;
  }
  .quotes-hero.is-detail {
    padding: 22px 20px 16px;
  }
  .quotes-hero.is-detail .quotes-hero-text {
    font-size: 22px;
    line-height: 30px;
  }
  .quotes-discussion {
    padding: 16px 14px;
    border-radius: 18px;
  }
  .comment-identity-label {
    font-size: 12px;
  }
  .quotes-note {
    margin-bottom: 0;
  }
}
@media (prefers-reduced-motion: no-preference) {
  .quotes-card,
  .quotes-related-card,
  .quotes-hero-open,
  .comment-reaction {
    transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s, background-color 0.18s, color 0.18s;
  }
  .quotes-card:hover {
    transform: translateY(-2px);
  }
  .comment-card.is-new .comment-bubble {
    animation: comment-new 2.4s ease-out;
  }
  @keyframes comment-new {
    from {
      border-color: var(--md-primary);
      background: var(--md-primary-container);
    }
  }
}
