/* Daily Texts — Brand-book aligned premium stylesheet.
   All selectors live under #dailytexts-root or .dt-* namespaces. */

#dailytexts-root {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 48px 64px;
  box-sizing: border-box;
  font-family: inherit;
  color: var(--ink);
}

.dt-reader-card {
  background: var(--surface);
  border: 0;
  border-radius: 22px;
  padding: 28px;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  gap: 22px;
  box-sizing: border-box;
}

.dt-wrap {
  display: block;
  width: 100%;
}

.dt-header {
  margin-bottom: 24px;
  animation: dt-home-card-in 0.32s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.dt-h {
  margin: 0 0 8px;
  color: var(--ink1, var(--ink));
  font-family: var(--font-head, inherit);
  font-size: 32px;
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.08;
}

.dt-sub {
  margin: 0;
  max-width: 760px;
  color: var(--ink3);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.55;
}

@keyframes dt-home-card-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---- Tabs navigation (Premium segment control) ---- */
.dt-tabs {
  display: flex;
  gap: 6px;
  margin: 0 0 28px;
  background: var(--surface2);
  padding: 4px;
  border-radius: var(--r-lg, 12px);
  width: fit-content;
  border: 1px solid var(--border2);
}

.dt-tab-btn {
  padding: 8px 18px;
  border-radius: var(--r, 8px);
  border: none;
  background: none;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  color: var(--ink2);
  transition: all 0.2s ease;
  font-family: inherit;
}

.dt-tab-btn:hover {
  color: var(--ink);
}

.dt-tab-btn.active {
  background: var(--surface);
  color: var(--blue);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* ---- Custom text analyzer view ---- */
.dt-analyze-container {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 28px;
  border-radius: 22px;
  background: var(--surface);
  box-sizing: border-box;
  animation: dt-home-card-in 0.32s cubic-bezier(0.2, 0.8, 0.2, 1) 0.03s both;
}

.dt-textarea {
  width: 100%;
  min-height: 220px;
  padding: 18px 20px;
  border: 0;
  border-radius: 16px;
  background: var(--surface2);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.6;
  resize: none !important;
  box-sizing: border-box;
  font-family: inherit;
  outline: none;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.dt-textarea:focus {
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(30, 80, 255, 0.14);
}

.dt-examples-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
}

.dt-examples-label {
  font-weight: 700;
  color: var(--ink2);
  margin-right: 4px;
}

.dt-example-btn {
  padding: 6px 14px;
  border: 1px solid var(--border2);
  border-radius: var(--r-full, 99px);
  background: var(--surface2);
  color: var(--ink);
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.dt-example-btn:hover {
  background: var(--border);
  border-color: var(--ink3);
}

.dt-btn-primary {
  align-self: flex-start;
  min-height: 46px;
  padding: 0 22px;
  border-radius: 12px;
  border: none;
  background: var(--blue);
  color: #fff;
  font-family: var(--font-head, inherit);
  font-size: 14px;
  font-weight: 850;
  cursor: pointer;
  box-shadow: none;
  transition: all 0.2s ease;
}

.dt-btn-primary:hover {
  opacity: 0.95;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px var(--blue-alpha);
}

.dt-btn-primary:active {
  transform: translateY(1px);
}

/* ---- Results display ---- */
.dt-analysis-results-wrap {
  display: flex;
  flex-direction: column;
  animation: dt-home-card-in 0.32s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.dt-back-to-input {
  align-self: flex-start;
  background: var(--surface2);
  border: 0;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  cursor: pointer;
  margin-bottom: 24px;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink2);
  font-weight: 700;
  transition: all 0.15s ease;
}

.dt-back-to-input:hover {
  background: var(--border);
  color: var(--ink);
}

/* ---- Stats bar & HSK progress ---- */
.dt-stats-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--r-lg, 12px);
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.dt-score {
  padding: 6px 14px;
  border-radius: var(--r-full, 99px);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .5px;
  color: #fff;
  text-transform: uppercase;
}

.dt-score-easy { background: var(--green); }
.dt-score-medium { background: var(--amber); }
.dt-score-native { background: var(--red); }

.dt-bar {
  flex: 1;
  min-width: 280px;
  display: flex;
  height: 24px;
  border-radius: var(--r, 8px);
  overflow: hidden;
  background: var(--border2);
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  border: 1px solid var(--border2);
}

.dt-bar-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-shadow: 0 1px 1px rgba(0,0,0,0.25);
}

/* Base level solid backgrounds - strictly scoped to progress bar segments only */
.dt-bar-seg.dt-l1, .dt-bar-seg.dt-l2 { background: var(--green, #10b981); }
.dt-bar-seg.dt-l3, .dt-bar-seg.dt-l4 { background: var(--amber, #f59e0b); }
.dt-bar-seg.dt-l5, .dt-bar-seg.dt-l6 { background: var(--red, #ef4444); }
.dt-bar-seg.dt-l7 { background: var(--blue, #1E50FF); }
.dt-bar-seg.dt-out, .dt-bar-seg.dt-l-out { background: var(--ink3, #6b7280); }

.dt-total {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink2);
  white-space: nowrap;
}

.dt-hsk-list-pct {
  margin: 0;
  padding: 18px;
  background: var(--surface);
  border-radius: 18px;
  border: 0;
  box-sizing: border-box;
}

.dt-hsk-list-pct-title {
  color: var(--ink);
  font-family: var(--font-head, inherit);
  font-size: 14px;
  font-weight: 850;
  margin-bottom: 12px;
}

.dt-hsk-pct-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
  font-size: 12px;
}

.dt-hsk-pct-grid li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  background: var(--surface2);
  padding: 8px 10px;
  border-radius: 10px;
  border: 0;
  color: var(--ink);
  font-weight: 750;
}

.dt-hsk-pct-grid li b {
  color: var(--blue);
}

/* ---- Toolbar checkboxes ---- */
.dt-toolbar {
  display: flex;
  gap: 10px;
  margin: 0;
  align-items: center;
  flex-wrap: wrap;
  font-size: 13px;
  padding: 6px;
  border: 0;
  background: var(--surface2);
  border-radius: 16px;
}

.dt-toolbar .dt-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--ink);
  min-height: 36px;
  padding: 0 10px;
  border-radius: 10px;
  background: var(--surface);
  font-weight: 800;
  user-select: none;
}

.dt-toolbar .dt-toggle input {
  accent-color: var(--blue);
}

.dt-toolbar button, .dt-tts {
  background: var(--surface2);
  border: 0;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink);
  font-weight: 850;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dt-toolbar button:hover, .dt-tts:hover {
  background: var(--surface);
  box-shadow: 0 8px 18px rgba(11, 16, 32, 0.08);
  transform: translateY(-1px);
}

.dt-toolbar .dt-cloze-test-btn {
  background: var(--blue);
  color: #fff;
}

.dt-toolbar .dt-cloze-test-btn:hover,
.dt-toolbar .dt-cloze-test-btn:focus-visible {
  background: var(--blue);
  color: #fff;
}

/* ---- TTS Player ---- */
.dt-player {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.dt-player .dt-tts {
  background: var(--blue, #1E50FF);
  border-color: var(--blue, #1E50FF);
  color: #FFFFFF;
  padding: 6px 14px;
  font-weight: 700;
  min-width: 110px;
  justify-content: center;
}

.dt-player .dt-tts:hover {
  background: #0A2B7A;
  border-color: #0A2B7A;
}

.dt-player[data-state="playing"] .dt-tts {
  background: var(--surface2);
  border-color: var(--border2);
  color: var(--ink);
}

.dt-player[data-state="paused"] .dt-tts {
  background: var(--blue, #1E50FF);
  border-color: var(--blue, #1E50FF);
  color: #FFFFFF;
}

.dt-player .dt-tts-icon {
  font-size: 11px;
  line-height: 1;
}

.dt-rate {
  display: inline-flex;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}

.dt-rate-pill {
  background: transparent;
  border: none;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  font-weight: 600;
  color: var(--ink2);
  transition: all 0.12s;
  min-width: 38px;
}

.dt-rate-pill:hover {
  color: var(--ink);
}

.dt-rate-pill.active {
  background: var(--surface);
  color: var(--blue, #1E50FF);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* ---- Body / Words Text Flow (Premium Typography) ---- */
.dt-body {
  line-height: 2.8;
  font-size: 20px;
}

.dt-p {
  margin: 0 0 24px;
}

.dt-w {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  padding: 0 2px;
  margin: 0 1px;
  border-radius: var(--r, 4px);
  vertical-align: middle;
  transition: background 0.12s;
  background: transparent; /* No blocky solid background on the tokens themselves! */
}

.dt-w:hover {
  background: var(--blue-alpha);
}

.dt-py {
  font-size: 11px;
  color: var(--ink3);
  line-height: 1.1;
  min-height: 14px;
  letter-spacing: .2px;
  font-weight: 600;
  text-align: center;
}

.dt-hz {
  font-size: 24px;
  line-height: 1.3;
  color: var(--ink);
  font-family: var(--font-hanzi, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Arial Unicode MS", sans-serif);
}

.dt-punct {
  display: inline-block;
  vertical-align: middle;
  font-size: 24px;
  color: var(--ink2);
  margin: 0 1px;
}

/* Color hint = gorgeous, subtle bottom border on hanzi */
.dt-w.dt-l1 .dt-hz, .dt-w.dt-l2 .dt-hz { border-bottom: 2.5px solid var(--green, #10b981); }
.dt-w.dt-l3 .dt-hz, .dt-w.dt-l4 .dt-hz { border-bottom: 2.5px solid var(--amber, #f59e0b); }
.dt-w.dt-l5 .dt-hz, .dt-w.dt-l6 .dt-hz { border-bottom: 2.5px solid var(--red, #ef4444); }
.dt-w.dt-l7 .dt-hz { border-bottom: 2.5px solid var(--blue, #1E50FF); }
.dt-w.dt-l-out .dt-hz { border-bottom: 2.5px dashed var(--ink3); }

/* Level-specific text coloring utilities matching the official widget scheme */
.dt-lvl-col-1, .dt-lvl-col-2 { color: var(--green, #10b981) !important; }
.dt-lvl-col-3, .dt-lvl-col-4 { color: var(--amber, #f59e0b) !important; }
.dt-lvl-col-5, .dt-lvl-col-6 { color: var(--red, #ef4444) !important; }
.dt-lvl-col-7 { color: var(--blue, #1E50FF) !important; }

.dt-body.dt-no-pinyin .dt-py { display: none; }
.dt-body.dt-no-color .dt-w .dt-hz { border-bottom-color: transparent !important; }

/* ---- Daily sources list tab grid ---- */
.dt-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.dt-src {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 26px 18px;
  border: 0;
  border-radius: 22px;
  background: var(--surface);
  cursor: pointer;
  transition: transform .15s, box-shadow .15s, border-color .15s;
  font-family: inherit;
  color: var(--ink);
}

.dt-src:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(11, 16, 32, 0.08);
}

.dt-logo {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 700;
  font-family: serif;
}

.dt-src-name {
  font-size: 16px;
  font-weight: 700;
}

.dt-src-en {
  color: var(--ink2);
  font-size: 12px;
}

.dt-license {
  font-size: 11px;
  color: var(--ink2);
  padding: 2px 10px;
  background: var(--surface2);
  border-radius: 99px;
  margin-top: 4px;
  border: 1px solid var(--border2);
}

/* ---- Back button & Feed items ---- */
.dt-back {
  background: var(--surface2);
  border: 1px solid var(--border2);
  padding: 8px 16px;
  border-radius: var(--r, 8px);
  cursor: pointer;
  margin-bottom: 16px;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink);
  font-weight: 700;
}

.dt-back:hover {
  background: var(--border);
}

.dt-license-banner {
  font-size: 12px;
  color: var(--ink2);
  padding: 10px 14px;
  background: var(--surface2);
  border-radius: var(--r, 8px);
  margin-bottom: 20px;
  border: 1px solid var(--border2);
}

.dt-feed {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 16px;
}

.dt-feed-item {
  text-align: left;
  border: 0;
  border-radius: 22px;
  background: var(--surface);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: inherit;
  color: var(--ink);
  box-shadow: none;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.15s ease, box-shadow 0.2s ease;
  position: relative;
  box-sizing: border-box;
}

.dt-feed-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 34px rgba(11, 16, 32, 0.08);
}

.dt-feed-thumb {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-bottom: 1px solid var(--border2);
  background: var(--surface2);
  transition: transform 0.3s ease;
}

.dt-feed-item:hover .dt-feed-thumb {
  transform: scale(1.04);
}

.dt-feed-content-wrap {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.dt-feed-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.dt-feed-title {
  font-weight: 700;
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink);
  flex: 1;
}

.dt-feed-speak-btn {
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--blue);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.dt-feed-speak-btn:hover {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
  transform: scale(1.1);
}

.dt-feed-title-tr {
  font-size: 12px;
  color: var(--blue);
  font-weight: 600;
  line-height: 1.4;
  opacity: 0.9;
  background: var(--blue-alpha);
  padding: 4px 8px;
  border-radius: 8px;
  display: inline-block;
  align-self: flex-start;
  animation: dt-fade-in 0.3s ease forwards;
}

@keyframes dt-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.dt-feed-desc {
  color: var(--ink2);
  font-size: 13px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dt-feed-date {
  color: var(--ink3);
  font-size: 11px;
  margin-top: auto;
  border-top: 1px solid var(--border2);
  padding-top: 8px;
}

.dt-loading, .dt-error {
  padding: 40px 20px;
  text-align: center;
  color: var(--ink2);
  font-size: 14px;
  font-weight: 600;
}

.dt-error {
  color: var(--red);
}

/* ---- Premium Overlay Word Card popup (Brand-book matched) ---- */
.dt-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(2px);
}

.dt-card {
  background: var(--surface);
  border-radius: var(--r-lg, 16px);
  padding: 28px;
  min-width: 320px;
  max-width: 92vw;
  position: relative;
  box-shadow: var(--shadow, 0 10px 30px rgba(0,0,0,0.15));
  border: 1px solid var(--border);
}

.dt-card-close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: none;
  border: 0;
  font-size: 20px;
  cursor: pointer;
  color: var(--ink3);
  padding: 4px;
}

.dt-card-close:hover {
  color: var(--ink);
}

.dt-card-py {
  font-size: 18px;
  color: var(--blue);
  font-weight: 700;
  text-align: center;
}

.dt-card-hz {
  font-size: 56px;
  text-align: center;
  line-height: 1.1;
  margin: 6px 0 12px;
  font-weight: 600;
  color: var(--ink);
}

.dt-card-lvl {
  display: inline-block;
  padding: 4px 12px;
  background: var(--blue-bg);
  color: var(--blue);
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
}

.dt-card-lvl-out {
  background: var(--surface2);
  color: var(--ink3);
  border: 1px solid var(--border2);
}

.dt-card-tr {
  margin: 16px 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink2);
}

.dt-card-tr div {
  margin: 4px 0;
}

.dt-card-tr.dt-no-tr {
  color: var(--ink3);
  font-style: italic;
  text-align: center;
}

.dt-card-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.dt-card-actions button {
  flex: 1;
  padding: 10px;
  border: 1px solid var(--border2);
  border-radius: var(--r, 8px);
  background: var(--surface2);
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink);
  font-weight: 700;
  transition: all 0.15s ease;
}

.dt-card-actions button:hover:not(:disabled) {
  background: var(--border);
}

.dt-card-actions button:disabled {
  opacity: .5;
  cursor: default;
}

/* ---- Responsive & Mobile adaptiveness ---- */
@media (max-width: 720px) {
  .dt-grid { grid-template-columns: repeat(2, 1fr); }
  .dt-stats-bar { flex-direction: column; align-items: stretch; gap: 10px; }
  .dt-bar { min-width: 0; font-size: 0; }
  .dt-bar-seg { padding: 0; }
  .dt-body { font-size: 18px; line-height: 2.6; }
  .dt-hz { font-size: 22px; }
  .dt-punct { font-size: 22px; }
}

@media (max-width: 480px) {
  .dt-grid { grid-template-columns: 1fr; }
  .dt-tabs { width: 100%; display: flex; }
  .dt-tab-btn { flex: 1; padding: 8px 10px; font-size: 12px; text-align: center; }
  .dt-toolbar { flex-direction: column; align-items: stretch; gap: 12px; }
}

/* ---- Split-Screen Main Grid Workstation ---- */
.dt-main-layout {
  display: flex;
  gap: 24px;
  width: 100%;
  margin-top: 0;
  align-items: flex-start;
}

.dt-left-content {
  flex: 1;
  min-width: 0;
}

.dt-right-sidebar {
  width: 330px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 56px);
  overflow-y: auto;
}

.dt-info-panel,
.dt-sidebar-widget-container {
  background: var(--surface);
  border: 0;
  border-radius: 18px;
  padding: 18px;
  box-sizing: border-box;
}

.dt-info-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dt-info-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
}

.dt-info-row b {
  color: var(--ink3);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dt-info-value {
  color: var(--ink1, var(--ink));
  font-family: var(--font-head, inherit);
  font-weight: 900;
}

.dt-info-value.is-blue {
  color: var(--blue);
}

.dt-info-value.is-green {
  color: var(--green);
}

.dt-sidebar-widget-container {
  min-height: 250px;
}

/* Scrollbar styling for sidebar */
.dt-right-sidebar::-webkit-scrollbar {
  width: 6px;
}
.dt-right-sidebar::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: 4px;
}

/* Word character colors matching paired levels */
.dt-w.dt-l1 .dt-hz, .dt-w.dt-l2 .dt-hz { color: var(--green, #10b981) !important; }
.dt-w.dt-l3 .dt-hz, .dt-w.dt-l4 .dt-hz { color: var(--amber, #f59e0b) !important; }
.dt-w.dt-l5 .dt-hz, .dt-w.dt-l6 .dt-hz { color: var(--red, #ef4444) !important; }
.dt-w.dt-l7 .dt-hz { color: var(--blue, #1E50FF) !important; }

/* Invert colors toggle helper */
.dt-body.dt-no-color .dt-w .dt-hz {
  border-bottom-color: transparent !important;
  color: var(--ink) !important;
}

/* Color Legend styling */
.dt-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink3);
  margin-top: 4px;
  justify-content: space-between;
}
.dt-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.dt-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

/* Responsive sidebar override */
@media (max-width: 900px) {
  .dt-main-layout {
    flex-direction: column;
    align-items: stretch;
  }
  .dt-right-sidebar {
    width: 100%;
    position: static;
    max-height: none;
  }
}

/* ---- Split-Screen Translation Cards (Side-by-side alignment) ---- */
.dt-p-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.dt-body.dt-show-translation .dt-p-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dt-p-card-left {
  position: relative;
  background: var(--surface2);
  border: 0;
  border-radius: 16px;
  padding: 20px 28px 20px 20px;
  box-sizing: border-box;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.dt-p-card-right {
  position: relative;
  background: var(--surface) !important;
  border: 1px solid var(--border2) !important;
  border-left: 4px solid var(--blue) !important;
  border-radius: 12px !important;
  padding: 16px 20px !important;
  margin-top: -4px;
  box-sizing: border-box;
  min-height: 50px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.dt-saved-section {
  max-width: none;
  margin: 24px 0 0;
  padding: 24px;
  border-radius: 22px;
  background: var(--surface);
  box-sizing: border-box;
  animation: dt-home-card-in 0.32s cubic-bezier(0.2, 0.8, 0.2, 1) 0.06s both;
}

.dt-saved-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  color: var(--ink1, var(--ink));
  font-family: var(--font-head, inherit);
  font-size: 18px;
  font-weight: 850;
  letter-spacing: -0.01em;
}

.dt-saved-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}

.ai-saved-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--surface2);
  cursor: pointer;
  transition: background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.ai-saved-item:hover,
.ai-saved-item:focus-within {
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(30, 80, 255, 0.1);
}

.ai-saved-click-target {
  flex: 1;
  min-width: 0;
}

.ai-saved-title {
  overflow: hidden;
  color: var(--ink1, var(--ink));
  font-size: 13px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-saved-meta {
  margin-top: 3px;
  color: var(--ink3);
  font-size: 11px;
  font-weight: 700;
}

.ai-saved-delete-btn {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--red);
  cursor: pointer;
  font-size: 14px;
  opacity: 0.75;
  transition: background 0.18s ease, opacity 0.18s ease;
}

.ai-saved-delete-btn:hover,
.ai-saved-delete-btn:focus-visible {
  background: var(--red-bg);
  opacity: 1;
  outline: none;
}

/* Badge in top-right corner of each card */
.dt-p-badge {
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 11px;
  font-weight: 800;
  color: var(--blue, #1e50ff);
  opacity: 0.8;
  user-select: none;
}

.dt-translation-para {
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  font-weight: 500;
  margin: 0;
}

/* Final mobile safety pass for text mode. */
@media (max-width: 700px) {
  #dailytexts-root {
    padding: 16px 16px 92px;
  }

  .dt-header {
    margin-bottom: 18px;
  }

  .dt-h {
    font-size: 26px;
  }

  .dt-sub {
    font-size: 13px;
  }

  .dt-analyze-container,
  .dt-saved-section {
    padding: 20px !important;
    border-radius: 18px !important;
  }

  .dt-main-layout,
  .dt-left-content,
  .dt-right-sidebar,
  .dt-reader-card,
  .dt-info-panel,
  .dt-hsk-list-pct,
  .dt-card,
  .dt-textarea {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  .dt-main-layout {
    gap: 14px !important;
    margin-top: 10px !important;
  }

  .dt-reader-card,
  .dt-info-panel,
  .dt-hsk-list-pct {
    padding: 14px !important;
    border-radius: 16px !important;
  }

  .dt-toolbar,
  .dt-card-actions,
  .dt-stats-bar {
    flex-wrap: wrap !important;
  }

  .dt-toolbar {
    padding: 6px !important;
    gap: 8px !important;
  }

  .dt-toolbar .dt-toggle,
  .dt-toolbar button,
  .dt-player,
  .dt-player .dt-tts {
    width: 100%;
    justify-content: center;
  }

  .dt-saved-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .dt-body {
    font-size: 16px !important;
    line-height: 2.35 !important;
  }

  .dt-hz,
  .dt-punct {
    font-size: 20px !important;
  }

  .dt-card-actions button,
  .dt-tab-btn {
    min-height: 44px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dt-header,
  .dt-analyze-container,
  .dt-analysis-results-wrap,
  .dt-saved-section,
  .dt-src,
  .dt-feed-item,
  .dt-feed-thumb,
  .dt-btn-primary,
  .dt-toolbar button,
  .dt-tts,
  .ai-saved-item {
    animation: none !important;
    transition: none !important;
  }

  .dt-src:hover,
  .dt-feed-item:hover,
  .dt-feed-item:hover .dt-feed-thumb,
  .dt-btn-primary:hover,
  .dt-toolbar button:hover,
  .dt-tts:hover {
    transform: none !important;
  }
}
