.speech-history { margin-block-start: 28px; padding-block-start: 20px; border-block-start: 1px solid var(--lp-border); color: var(--lp-text); text-align: start; }
.speech-history[hidden], .speech-history [hidden] { display: none !important; }
.speech-history-title { margin: 0 0 6px; font-size: 1.1rem; line-height: 1.3; }
.speech-history-note, .speech-history-warning, .speech-history-meta { margin: 0; font-size: .8rem; line-height: 1.5; color: var(--lp-text-muted); }
.speech-history-warning { margin-block-start: 8px; color: var(--lp-warn); }
.speech-history-search {
  box-sizing: border-box; inline-size: 100%; min-block-size: 44px; margin-block-start: 14px; padding: 8px 12px;
  border: 1px solid var(--lp-border); border-radius: 10px; background: var(--lp-card); color: var(--lp-text); font: inherit; font-size: 1rem;
}
.speech-history-list { margin: 10px 0 0; padding: 0; list-style: none; }
.speech-history-item {
  display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding-block: 10px; border-block-end: 1px solid var(--lp-border);
}
.speech-history-item:last-child { border-block-end: 0; }
.speech-history-play {
  display: grid; place-items: center; inline-size: 36px; block-size: 36px; padding: 0;
  border: 1px solid var(--lp-border); border-radius: 50%; background: var(--lp-bg-soft); color: var(--lp-text); cursor: pointer;
}
.speech-history-play svg { inline-size: 16px; block-size: 16px; fill: currentColor; }
.speech-history-play:disabled { opacity: .45; cursor: default; }
.speech-history-text {
  max-block-size: 3em; margin: 0 0 2px; overflow: hidden; font-size: .9rem; line-height: 1.5; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
}
.speech-history-actions { display: flex; flex-wrap: nowrap; gap: 2px; align-items: center; }
.speech-history-save, .speech-history-delete, .speech-history-more {
  display: inline-flex; align-items: center; justify-content: center; min-block-size: 34px; padding: 4px 10px;
  border: 1px solid var(--lp-border); border-radius: 9px; background: transparent; color: var(--lp-text);
  font: inherit; font-size: .78rem; font-weight: 600; letter-spacing: .02em; text-decoration: none; cursor: pointer;
}
.speech-history-save { border-color: var(--lp-accent); background: var(--lp-accent); color: var(--lp-on-accent); font-weight: 600; }
.speech-history-save[aria-disabled] { opacity: .45; pointer-events: none; }
.speech-history-delete { inline-size: 34px; padding: 0; border-color: transparent; color: var(--lp-text-muted); }
.speech-history-delete svg { inline-size: 18px; block-size: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.speech-history-delete:hover { color: var(--lp-text); background: var(--lp-bg-soft); }
.speech-history-more { inline-size: 100%; margin-block-start: 8px; font-weight: 500; }
.speech-history-formats { position: relative; display: flex; }
.speech-history .speech-history-formats .speech-history-save { border-start-end-radius: 0; border-end-end-radius: 0; }
.speech-history .speech-history-arrow {
  display: grid; place-items: center; flex: 0 0 28px; inline-size: 28px; min-block-size: 34px; padding: 0;
  border: 1px solid var(--lp-accent); border-inline-start-color: color-mix(in srgb, var(--lp-on-accent) 25%, var(--lp-accent));
  border-radius: 0 9px 9px 0; background: var(--lp-accent); color: var(--lp-on-accent); cursor: pointer;
}
.speech-history .speech-history-arrow:disabled { opacity: .6; cursor: progress; }
.speech-history .speech-history-arrow svg { inline-size: 14px; block-size: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
.speech-history .speech-history-arrow[aria-expanded=true] svg { transform: rotate(180deg); }
.speech-history .speech-history-formats .lp-save-menu { inset-inline: auto 0; z-index: 6; }
.speech-history :is(a, button, input):focus-visible { outline: 2px solid var(--lp-accent); outline-offset: 2px; }
@media (max-width: 640px) {
  .speech-history-item { gap: 8px; }
  .speech-history-text { font-size: .86rem; line-height: 1.4; }
  .speech-history-meta { font-size: .74rem; }
}
@media (max-width: 640px) {
  .speech-history-note:not(.is-open) { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; cursor: pointer; }
}
