/* Recordings (the 2026-10 redesign): the readers' "Danh sách ghi âm của bạn" card (mobile RecordCard /
   RecordRow on the app's standard card), the record bar (RecordingBar), the aside entry, "File ghi âm
   của bạn" (#records: RecordsScreen, RecordItem, EmptyRecordsView) and their dialogs (ConfirmSheet + Mầm).
   Web layout: the card ends the English tab; the bar docks where the player bar sits (a floating
   card on desktop); #records is a page head with the Mầm intro, one card per story and a sticky
   "Theo bài đọc" filter. Phones keep the app's single column and full-width bar.
   The web has one (light) theme: the record red's dark value (#e5484d) waits for a dark theme. */
.story-records-card,
.story-records-bar,
.story-records-entry,
.records-page,
.records-dialog {
  --records-red: #d93025; /* the record button and the "Đang ghi âm" state */
  --records-red-hover: #b3261e;
  --records-success: var(--md-success); /* AppTokens.colors.success: the saved state */
  --records-pro: var(--sn-pro); /* AppTokens.colors.pro / onPro: the playing disc and progress */
  --records-on-pro: var(--sn-on-pro);
  --records-warning: var(--md-warning); /* warning / warningContainer: the playing row */
  --records-warning-container: var(--md-streak-container);
  --records-track: #f1dcc0; /* the playing row's progress track, on warningContainer */
  --records-on-primary-container: var(--md-on-primary-container);
  --records-error: var(--md-error);
  --records-shadow: var(--md-card-shadow);
}

/* ---------- LevelBars (three bars that bounce while something plays) ---------- */
.records-bars {
  display: inline-flex;
  flex: none;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
  color: var(--records-pro);
}
.records-bars i {
  display: block;
  width: 3px;
  height: 100%;
  border-radius: 2px;
  background: currentColor;
  transform: scaleY(0.35);
  transform-origin: 50% 100%;
}
.records-row.is-playing .records-bars i,
.story-record-row.is-playing .records-bars i {
  animation: records-level 0.45s ease-in-out infinite alternate;
}
.records-row.is-playing .records-bars i:nth-child(2),
.story-record-row.is-playing .records-bars i:nth-child(2) {
  animation-delay: 0.15s;
}
.records-row.is-playing .records-bars i:nth-child(3),
.story-record-row.is-playing .records-bars i:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes records-level {
  from {
    transform: scaleY(0.35);
  }
  to {
    transform: scaleY(1);
  }
}

/* ---------- reader card (the app's standard card: surface, outlineVariant hairline, radius 16) ---------- */
.story-records-card {
  /* Clear the sticky top bar and the reader's sticky tabs when "Đến danh sách ghi âm" scrolls here. */
  scroll-margin-top: calc(var(--story-topbar, 64px) + 76px);
  margin: 32px 0 8px;
  padding: 18px 20px 20px;
  border: 1px solid var(--md-outline-variant);
  border-radius: var(--md-radius-l, 16px);
  background: var(--md-surface);
  box-shadow: var(--records-shadow);
  color: var(--md-on-surface);
  font: 400 15px/1.5 var(--font-app);
}
.story-records-card + .story-notes-card {
  margin-top: 20px;
}
.story-records-head {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0 12px;
}
.story-records-tile {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--md-primary-container);
  color: var(--md-primary);
}
.story-records-tile .mi {
  width: 22px;
  height: 22px;
}
.story-records-heading {
  min-width: 0;
}
.story-records-title {
  margin: 0;
  color: var(--md-on-surface);
  font: 700 17px/22px var(--font-app-bold);
}
.story-records-title:focus {
  outline: none;
}
.story-records-title:focus-visible {
  outline: 3px solid #bb7815;
  outline-offset: 4px;
}
.story-records-sub {
  margin: 2px 0 0;
  color: var(--md-on-surface-variant);
  font: 400 13px/18px var(--font-app);
}
.story-records-all {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 2px;
  color: var(--md-primary);
  font: 600 13px/18px var(--font-app);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
  white-space: nowrap;
}
.story-records-all:hover {
  text-decoration-color: currentColor;
}
.story-records-tip {
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--md-surface-container);
  color: var(--md-on-surface-variant);
  font: 400 14px/21px var(--font-app);
}
.story-records-error {
  margin: 12px 0 0;
  color: var(--records-error);
  font-size: 14px;
}
/* The takes: hairline rows edge to edge in the card, the playing one tinted amber. */
.story-records-rows {
  margin: 14px -20px 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--md-divider);
  border-bottom: 1px solid var(--md-divider);
}
.story-record-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0 8px;
  min-height: 64px;
  padding: 8px 12px 8px 16px;
}
.story-record-row + .story-record-row {
  border-top: 1px solid var(--md-divider);
}
.story-record-row.is-playing {
  background: var(--records-warning-container);
}
.story-record-text {
  display: grid;
  gap: 1px;
  min-width: 0;
  padding-left: 2px;
}
.story-record-label {
  color: var(--md-on-surface);
  font: 600 15px/20px var(--font-app);
}
.story-record-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--md-on-surface-variant);
  font: 400 13px/18px var(--font-app);
  font-variant-numeric: tabular-nums;
}
.story-record-row.is-current .story-record-meta {
  color: var(--records-warning);
  font-weight: 700;
}
.story-record-bars {
  display: none;
}
.story-record-row.is-playing .story-record-bars {
  display: inline-flex;
}
.story-record-progress {
  display: none;
  height: 3px;
  margin: 5px 0 1px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--records-track);
}
.story-record-row.is-current .story-record-progress {
  display: block;
}
.story-record-progress i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--records-pro);
}
.story-record-play,
.story-record-download,
.story-record-delete {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--md-on-surface-variant);
  cursor: pointer;
}
.story-record-download .mi,
.story-record-delete .mi {
  width: 22px;
  height: 22px;
}
.story-record-download:hover {
  background: #00796b14;
  color: var(--md-primary);
}
.story-record-delete:hover {
  background: #ba1a1a14;
  color: var(--records-error);
}
/* The play disc: primaryContainer ↔ pro while playing (as RecordItem). */
.story-record-disc {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--md-primary-container);
  color: var(--records-on-primary-container);
}
.story-record-disc .mi {
  width: 22px;
  height: 22px;
}
.story-record-play:hover .story-record-disc {
  background: #c6e6df;
}
.story-record-row.is-playing .story-record-disc {
  background: var(--records-pro);
  color: var(--records-on-pro);
}
.button.story-records-record {
  width: 100%;
  min-height: 48px;
  margin-top: 16px;
  background: var(--md-primary);
  font: 600 15px/20px var(--font-app);
}
.button.story-records-record:hover {
  background: var(--md-hero);
}
.button.story-records-record .mi {
  width: 20px;
  height: 20px;
}

/* The aside / tools-sheet entry (same look as "Thảo luận" / "Danh sách ghi chú"). */
.story-records-entry {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 4px 12px;
}
.story-records-entry .story-discuss-tile .mi {
  width: 22px;
  height: 22px;
}
.story-records-entry strong {
  color: var(--sn-ink);
  font: 600 15px/20px var(--font-app);
}
.story-records-entry p {
  margin: 2px 0 0;
  color: var(--sn-muted);
  font-size: 12px;
  line-height: 16px;
}
.story-records-entry-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin-top: 6px;
}
.story-records-entry-actions .button .mi {
  width: 18px;
  height: 18px;
}
.audio-tools .story-records-entry-actions .button {
  min-height: 40px;
  padding: 6px 16px;
  border-radius: 999px;
}

/* ---------- the record bar: close · status · record button (phones: full width above the tools row) ---------- */
.story-records-bar {
  --records-level: 0;
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0 8px;
  min-height: 80px;
  padding: 10px 14px 10px 6px;
  overflow: clip; /* the voice halo never spills out of the dock (no sideways scroll on phones) */
  border-bottom: 1px solid var(--sn-line);
  background: var(--sn-surface);
  color: var(--sn-ink);
  font-family: var(--font-app);
}
.story-records-bar[hidden] {
  display: none;
}
.story-records-bar.is-entering {
  animation: records-bar-in 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes records-bar-in {
  from {
    transform: translateY(14px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
.story-records-bar-close {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--sn-muted);
  cursor: pointer;
}
.story-records-bar-close:hover {
  background: var(--sn-soft);
  color: var(--sn-ink);
}
.story-records-bar-close .mi {
  width: 24px;
  height: 24px;
}
.story-records-bar-status {
  display: grid;
  gap: 2px;
  min-width: 0;
}
/* Line 1: what is going on. */
.story-records-bar-label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  margin: 0;
  color: var(--sn-ink);
  font: 700 15px/20px var(--font-app-bold);
}
.story-records-bar-text {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.story-records-bar-dot,
.story-records-bar-check {
  display: none;
  flex: none;
}
.story-records-bar[data-state="recording"] .story-records-bar-label {
  color: var(--records-red);
}
.story-records-bar[data-state="recording"] .story-records-bar-dot {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--records-red);
}
.story-records-bar[data-state="saved"] .story-records-bar-label {
  color: var(--records-success);
}
.story-records-bar[data-state="saved"] .story-records-bar-check {
  display: grid;
}
.story-records-bar-check .mi {
  width: 18px;
  height: 18px;
}
/* Line 2: the hint, the latest take + "Nghe lại", or the timer + live waveform. */
.story-records-bar-line {
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 30px;
  color: var(--sn-muted);
  font: 400 13px/18px var(--font-app);
}
.story-records-bar-hint,
.story-records-bar-last,
.story-records-bar-live {
  display: none;
  min-width: 0;
}
.story-records-bar[data-state="idle"]:not(.has-last) .story-records-bar-hint,
.story-records-bar[data-state="saved"]:not(.has-last) .story-records-bar-hint {
  display: block;
}
.story-records-bar.has-last:is([data-state="idle"], [data-state="saved"]) .story-records-bar-last {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
}
.story-records-bar:is([data-state="recording"], [data-state="saving"]) .story-records-bar-live {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 12px;
}
.story-records-bar-hint span {
  white-space: nowrap; /* phones break the hint at its " · " only */
}
.story-records-bar-take {
  font-variant-numeric: tabular-nums;
}
.story-records-replay {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 30px;
  padding: 0 12px 0 8px;
  border: 1px solid var(--md-outline-variant);
  border-radius: 999px;
  background: var(--sn-surface);
  color: var(--md-primary);
  font: 600 13px/18px var(--font-app);
  cursor: pointer;
}
.story-records-replay::after {
  /* A 44px target around the small pill. */
  content: "";
  position: absolute;
  inset: -7px -2px;
}
.story-records-replay:hover {
  background: var(--md-primary-container);
}
.story-records-replay .mi {
  width: 18px;
  height: 18px;
}
.story-records-replay[aria-pressed="true"] {
  border-color: transparent;
  background: var(--records-warning-container);
  color: var(--records-warning);
}
.story-records-bar-time {
  flex: none;
  min-width: 5ch;
  color: var(--sn-ink);
  font: 700 16px/20px var(--font-app-bold);
  font-variant-numeric: tabular-nums;
}
.story-records-wave {
  display: block;
  flex: 1;
  width: 100%;
  min-width: 0;
  max-width: 420px;
  height: 26px;
  color: var(--records-red);
}
.story-records-bar.is-still .story-records-wave {
  display: none;
}
/* The record button: red with a mic → red with a stop square and a halo that follows the voice →
   neutral with a spinner while saving → success green with a check. */
.story-records-bar-toggle {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  margin: 0 2px 0 6px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--records-red);
  color: #fff;
  box-shadow: 0 4px 14px #d9302540;
  cursor: pointer;
}
.story-records-bar-toggle::before {
  content: "";
  position: absolute;
  inset: -4px;
  z-index: -1;
  border-radius: 50%;
  background: var(--records-red);
  opacity: 0;
  transform: scale(calc(1 + var(--records-level) * 0.18));
  transition: transform 0.1s linear, opacity 0.2s;
}
.story-records-bar[data-state="recording"] .story-records-bar-toggle::before {
  opacity: 0.2;
}
.story-records-bar:is([data-state="idle"], [data-state="recording"]) .story-records-bar-toggle:hover {
  background: var(--records-red-hover);
}
.story-records-bar[data-state="saving"] .story-records-bar-toggle {
  background: var(--md-surface-container);
  color: var(--md-primary);
  box-shadow: inset 0 0 0 1px var(--md-outline-variant);
  cursor: default;
}
.story-records-bar[data-state="saved"] .story-records-bar-toggle {
  background: var(--records-success);
  box-shadow: 0 4px 14px #2e7d3240;
  cursor: default;
}
.story-records-bar-glyph {
  display: grid;
  place-items: center;
}
.story-records-bar-glyph .mi {
  width: 28px;
  height: 28px;
}
.story-records-bar[data-state="recording"] .story-records-bar-glyph .mi {
  width: 26px;
  height: 26px;
}
.story-records-spinner {
  display: block;
  width: 24px;
  height: 24px;
  border: 3px solid #00796b33;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: story-spin 0.8s linear infinite;
}
.story-records-bar :focus-visible {
  outline: 3px solid #bb7815;
  outline-offset: 2px;
}
.story-records-bar-toggle:focus-visible {
  outline-offset: 4px;
}
/* Mobile draws the bar over the player bar (and the text reader's transport) while it is open. */
.story-dock.has-records-bar > .audio-player,
.story-dock.has-records-bar > .story-transport {
  display: none;
}

/* ---------- #records ---------- */
.records-page {
  grid-template-columns: minmax(0, 1fr); /* long story names never widen the page */
  gap: 24px;
}
.records-page p,
.records-page h2,
.records-page h3 {
  margin: 0;
}
.records-head {
  align-items: center;
}
.records-head > div:first-child p {
  color: var(--md-on-surface-variant);
}
/* The page head as the mobile MascotCard: Mầm Speak, the count and the intro, "Báo cáo" on the right. */
.records-head.is-card {
  gap: 12px 20px;
  min-height: 104px;
  padding: 12px 24px 12px 12px;
  border: 1px solid var(--md-outline-variant);
  border-radius: 20px;
  background: var(--md-surface);
  box-shadow: var(--records-shadow);
}
.records-intro {
  display: flex;
  flex: 1 1 320px;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.records-intro-mam {
  flex: none;
  width: 72px;
}
.records-head .records-intro-count {
  color: var(--md-on-surface);
  font: 700 16px/22px var(--font-app-bold);
}
.records-head .records-intro-count + p {
  margin-top: 2px;
  color: var(--md-on-surface-variant);
  font-size: 13px;
  line-height: 18px;
}
.records-action .mi {
  width: 18px;
  height: 18px;
  color: var(--md-primary);
}
.records-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  align-items: start;
  gap: 28px;
}
.records-main {
  display: grid;
  gap: 14px;
  min-width: 0;
}
.records-list-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}
.records-list-head h2 {
  min-width: 0;
  overflow-wrap: anywhere;
}
.records-list-head h2:focus {
  outline: none;
}
.records-pill {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--md-primary-container);
  color: var(--records-on-primary-container);
  font: 600 13px/1 var(--font-app);
}
.records-groups {
  display: grid;
  gap: 16px;
}
/* One card per story (the app's standard card): its title and "Mở bài", then its takes. */
.records-card {
  overflow: hidden;
  border: 1px solid var(--md-outline-variant);
  border-radius: var(--md-radius-l, 16px);
  background: var(--md-surface);
  box-shadow: var(--records-shadow);
}
.records-group-head {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0 12px;
  padding: 12px 10px 12px 18px;
  border-bottom: 1px solid var(--md-divider);
}
.records-group-tile {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--md-primary-container);
  color: var(--md-primary);
}
.records-group-tile .mi {
  width: 22px;
  height: 22px;
}
.records-group-text {
  min-width: 0;
}
.records-group-title {
  overflow: hidden;
  color: var(--md-on-surface);
  font: 700 16px/22px var(--font-app-bold);
  white-space: nowrap;
  text-overflow: ellipsis;
}
.records-page .records-group-count {
  color: var(--md-on-surface-variant);
  font: 400 13px/18px var(--font-app);
}
.button.records-open {
  gap: 2px;
  min-height: 44px;
  padding: 8px 8px 8px 14px;
  color: var(--md-primary);
  font: 600 14px/20px var(--font-app);
}
.records-open .mi {
  width: 20px;
  height: 20px;
}
.records-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.records-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 2px 14px;
  min-height: 64px;
  padding: 8px 12px 8px 18px;
}
.records-row + .records-row {
  border-top: 1px solid var(--md-divider);
}
.records-row.is-playing {
  background: var(--records-warning-container);
}
/* RecordItem's 44dp FilledIconButton: primaryContainer ↔ pro. */
.records-play {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--md-primary-container);
  color: var(--records-on-primary-container);
  cursor: pointer;
}
.records-play .mi {
  width: 24px;
  height: 24px;
}
.records-play:hover {
  background: #c6e6df;
}
.records-row.is-playing .records-play {
  background: var(--records-pro);
  color: var(--records-on-pro);
}
.records-row.is-playing .records-play:hover {
  background: #c96d00;
}
.records-info {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.records-name {
  overflow: hidden;
  color: var(--md-on-surface);
  font: 600 15px/20px var(--font-app);
  white-space: nowrap;
  text-overflow: ellipsis;
}
.records-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--md-on-surface-variant);
  font: 400 13px/18px var(--font-app);
}
.records-status {
  min-width: 0;
  font-variant-numeric: tabular-nums;
}
.records-status .records-bars {
  margin-right: 6px;
  vertical-align: -1px;
}
.records-playing,
.records-paused {
  color: var(--records-warning);
  font: 700 13px/18px var(--font-app-bold);
}
.records-row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
}
.records-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--md-on-surface-variant);
  cursor: pointer;
}
.records-icon .mi {
  width: 22px;
  height: 22px;
}
.records-download:hover {
  background: #00796b14;
  color: var(--md-primary);
}
.records-delete:hover {
  background: #ba1a1a14;
  color: var(--records-error);
}
/* The current take's seek line (a thin progress the user can drag). */
.records-progress {
  grid-column: 2 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin-top: -4px;
}
.records-progress[hidden],
.records-progress .records-download {
  display: none;
}
.records-seek {
  flex: 1;
  min-width: 0;
  height: 24px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}
.records-seek::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(to right, var(--records-pro) var(--records-fill, 0%), var(--records-track) var(--records-fill, 0%));
}
.records-seek::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(to right, var(--records-pro) var(--records-fill, 0%), var(--records-track) var(--records-fill, 0%));
}
.records-seek::-webkit-slider-thumb {
  width: 12px;
  height: 12px;
  margin-top: -4px;
  border: 0;
  border-radius: 50%;
  background: var(--records-pro);
  box-shadow: 0 0 0 3px #fff, 0 1px 4px #0e242040;
  appearance: none;
  -webkit-appearance: none;
}
.records-seek::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 0;
  border-radius: 50%;
  background: var(--records-pro);
}
.records-aside {
  position: sticky;
  top: 88px;
  display: grid;
  gap: 14px;
}
.records-filter {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
  padding: 18px 14px 14px;
  border: 1px solid var(--md-outline-variant);
  border-radius: 20px;
  background: var(--md-surface);
}
.records-filter h2 {
  padding: 0 6px;
  font: 700 16px/22px var(--font-app-bold);
}
.records-filter-list {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.records-filter-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--md-on-surface);
  font: 400 14px/20px var(--font-app);
  text-align: left;
  cursor: pointer;
}
.records-filter-option:hover {
  background: var(--md-background);
}
.records-filter-option[aria-pressed="true"] {
  background: var(--md-primary-container);
  color: var(--records-on-primary-container);
  font-weight: 600;
}
.records-filter-option .mi {
  flex: none;
  width: 18px;
  height: 18px;
  color: var(--md-outline);
}
.records-filter-option[aria-pressed="true"] .mi {
  color: var(--md-primary);
}
.records-filter-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.records-filter-count {
  flex: none;
  color: var(--md-on-surface-variant);
  font-size: 13px;
}
.records-local {
  margin: 0;
  padding: 0 6px;
}
.records-empty {
  justify-self: center;
  width: min(100%, 560px);
}
.records-empty-mam {
  width: 150px;
}
.records-empty .records-empty-account {
  max-width: 420px;
  color: var(--md-on-surface-variant);
  font-size: 13px;
}
.records-empty .story-empty-actions .button .mi {
  width: 20px;
  height: 20px;
}
.records-page.is-empty .records-local {
  text-align: center;
}

/* ---------- dialogs (the notes dialog shell, notes.css) ---------- */
.records-permission-tile {
  display: inline-grid;
  place-items: center;
  margin-bottom: 12px;
  color: var(--md-primary);
}
.records-permission-tile .mi {
  width: 22px;
  height: 22px;
}
dialog.records-permission {
  text-align: left;
}
.records-dialog .records-dialog-hint {
  color: var(--md-on-surface-variant);
  font-size: 13px;
}
.records-steps {
  margin: 4px 0 0;
  padding-left: 22px;
  color: var(--md-on-surface);
  font-size: 14px;
  line-height: 21px;
}
.records-steps li + li {
  margin-top: 4px;
}

/* ---------- tablet + desktop: the bar as the dock's toolbar (a floating card on desktop) ---------- */
@media (min-width: 768px) {
  .story-records-bar {
    min-height: 84px;
    padding: 10px 16px 10px 10px;
    gap: 0 12px;
  }
}
@media (min-width: 1024px) {
  .story-records-bar {
    border: 1px solid var(--sn-line);
    border-radius: 20px;
    background: #fffffff7;
    box-shadow: 0 10px 34px #0e242024;
    backdrop-filter: blur(10px);
  }
  .story-records-bar[data-state="recording"] {
    border-color: #d930254d;
  }
  .story-records-wave {
    max-width: 640px;
  }
  /* The text reader has no docked player on desktop: the dock appears only for the record bar. */
  .reading-detail .story-reader-layout > .story-dock.has-records-bar {
    display: block;
  }
}

/* ---------- up to 1279px: one column (the list needs the width), the filter as chips above it ---------- */
@media (max-width: 1279px) {
  .records-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }
  .records-aside {
    display: contents;
  }
  .records-filter {
    order: -1;
    padding: 0;
    border: 0;
    background: none;
  }
  .records-filter.is-single {
    display: none;
  }
  .records-filter h2 {
    padding: 0;
    font-size: 14px;
  }
  .records-filter-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .records-filter-list li {
    min-width: 0;
    max-width: 100%;
  }
  .records-filter-option {
    width: auto;
    max-width: 100%;
    min-height: 40px;
    padding: 6px 14px;
    border: 1px solid var(--md-outline-variant);
    border-radius: 999px;
    background: var(--md-surface);
  }
  .records-filter-option[aria-pressed="true"] {
    border-color: transparent;
  }
  .records-local {
    padding: 0;
  }
}
@media (max-width: 767px) {
  .story-records-card {
    margin-top: 24px;
    padding: 16px 14px 16px;
  }
  .story-records-head {
    grid-template-columns: 40px minmax(0, 1fr);
  }
  /* "Tất cả bản ghi âm" goes under the heading, lined up with the title. */
  .story-records-all {
    grid-column: 2;
    justify-self: start;
    min-height: 36px;
    margin: 2px 0 -6px;
  }
  .story-records-rows {
    margin-inline: -14px;
  }
  .story-record-row {
    gap: 0 4px;
    padding: 8px 4px 8px 10px;
  }
  .story-record-meta {
    font-size: 12px;
  }
  .story-records-bar {
    padding-right: 12px;
  }
  .story-records-bar-toggle {
    width: 56px;
    height: 56px;
    margin: 0;
  }
  .records-head.is-card {
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 4px;
    min-height: 96px;
    padding: 8px 6px 8px 8px;
  }
  .records-intro {
    flex: 1 1 auto;
    align-self: center;
  }
  /* "Báo cáo" becomes the app bar's icon button, in the card's corner. */
  .records-head.is-card .records-action {
    width: 44px;
    min-height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
  }
  .records-head.is-card .records-action-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .records-head.is-card .records-action .mi {
    width: 22px;
    height: 22px;
  }
  .records-group-head {
    padding: 10px 4px 10px 12px;
    gap: 0 10px;
  }
  .button.records-open {
    padding-left: 10px;
  }
  .records-row {
    gap: 2px 10px;
    padding: 8px 4px 8px 12px;
  }
  /* The story filter: one row of chips that scrolls sideways inside the page. */
  .records-filter-list {
    position: relative; /* keeps the visually hidden counts inside the scroller */
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  .records-filter-list::-webkit-scrollbar {
    display: none;
  }
  .records-filter-list li {
    flex: none;
    max-width: 240px;
  }
  /* RecordItem has one action (delete): "Tải về" moves into the current take's seek line. */
  .records-row-actions .records-download {
    display: none;
  }
  .records-progress .records-download {
    display: grid;
    flex: none;
    margin: -6px -4px -6px 0;
  }
  .records-row-actions {
    gap: 0;
  }
  .records-empty-mam {
    width: 130px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .records-row.is-playing .records-bars i,
  .story-record-row.is-playing .records-bars i {
    animation: none;
  }
  /* Still "playing" bars without motion. */
  .records-row.is-playing .records-bars i:nth-child(1),
  .story-record-row.is-playing .records-bars i:nth-child(1) {
    transform: scaleY(0.55);
  }
  .records-row.is-playing .records-bars i:nth-child(2),
  .story-record-row.is-playing .records-bars i:nth-child(2) {
    transform: scaleY(1);
  }
  .records-row.is-playing .records-bars i:nth-child(3),
  .story-record-row.is-playing .records-bars i:nth-child(3) {
    transform: scaleY(0.75);
  }
  .story-records-bar.is-entering,
  .story-records-spinner {
    animation: none;
  }
  .story-records-bar-toggle::before {
    transition: none;
  }
}
@media (prefers-reduced-motion: no-preference) {
  .records-row,
  .records-play,
  .story-record-row,
  .story-record-disc {
    transition: background-color 0.18s;
  }
  .story-record-progress i {
    transition: width 0.25s linear;
  }
  .story-records-bar[data-state="recording"] .story-records-bar-dot {
    animation: records-dot 1.2s ease-in-out infinite;
  }
}
@keyframes records-dot {
  50% {
    opacity: 0.25;
  }
}
