:root {
  --th-fg: #0f172a;
  --th-br: #e5e7eb;
  --th-card: #fff;
  --th-note-br: #94a3b8;
  --th-warn-br: #fb923c;
  --th-tip-br: #10b981;
  --th-info-br: #6366f1;
}

@media (prefers-color-scheme: dark) {
  :root {
    --th-fg: #e5e7eb;
    --th-br: #1f2937;
    --th-card: #0b1020;
    --th-note-br: #475569;
    --th-warn-br: #fb923c;
    --th-tip-br: #34d399;
    --th-info-br: #60a5fa;
  }
}

.th-card {
  margin: 0 0 22px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.th-body {
  padding: 0;
  background: transparent;
}

.th-note,
.th-warn,
.th-tip,
.th-info {
  border-color: transparent;
  background: transparent !important;
}

.prose-th p {
  margin: 0 0 14px;
  font-size: 1.05rem;
  line-height: 1.75;
}

.prose-th h2,
.prose-th h3 {
  margin: 6px 0 12px;
  color: #075985;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.prose-th ul,
.prose-th ol {
  margin: 0 0 14px 22px;
  padding: 0;
}

.prose-th li {
  margin: 0 0 8px;
}

.prose-th strong {
  font-weight: 700;
}

.prose-th sup,
.prose-th sub {
  font-size: 0.8em;
}

.prose-th .formula,
.prose-th .center {
  display: block;
  margin: 16px 0;
  font-size: 1.2rem;
  font-weight: 600;
  text-align: center;
}

.prose-th .callout {
  margin: 12px 0;
  padding: 14px 16px;
  border-left: 4px solid var(--th-note-br);
  border-radius: 12px;
  background: rgba(148, 163, 184, 0.12);
}

.prose-th .callout.warn {
  border-color: var(--th-warn-br);
  background: rgba(251, 146, 60, 0.12);
}

.prose-th .callout.tip {
  border-color: var(--th-tip-br);
  background: rgba(16, 185, 129, 0.12);
}

.prose-th .callout.info {
  border-color: var(--th-info-br);
  background: rgba(99, 102, 241, 0.12);
}

.ex-list {
  display: grid;
  gap: 10px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.ex-list li {
  display: grid;
  grid-template-columns: auto 24px 1fr;
  align-items: baseline;
  padding: 6px 8px;
  border-radius: 10px;
  font-size: 1.05rem;
  line-height: 1.7;
}

.ex-list li:nth-child(odd) {
  background: rgba(2, 8, 23, 0.03);
}

.ex-list .expr {
  font-weight: 600;
  letter-spacing: 0.2px;
}

.ex-list .eq {
  text-align: center;
  opacity: 0.7;
}

.ex-list sup {
  font-size: 0.8em;
}

.tw-iframe {
  width: 100%;
  border: 0;
  border-radius: 12px;
  aspect-ratio: 16 / 9;
}

.tw-video {
  width: 100%;
  max-height: 70vh;
  border-radius: 12px;
  outline: 0;
}

.tw-audio {
  width: 100%;
}

.tw-figure {
  margin: 10px 0;
}

.tw-figure img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 12px;
}

.tw-figure figcaption {
  margin-top: 6px;
  color: #64748b;
  font-size: 0.9rem;
  text-align: center;
}

.egp-wrap {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  background: #000;
  aspect-ratio: 16 / 9;
}

.egp-video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  background: #000;
  object-fit: contain;
}

.egp-bigplay {
  position: absolute;
  inset: 0;
  width: 76px;
  height: 76px;
  margin: auto;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease;
}

.egp-bigplay::before {
  display: block;
  width: 0;
  height: 0;
  margin: auto;
  border-top: 16px solid transparent;
  border-bottom: 16px solid transparent;
  border-left: 24px solid #0f172a;
  content: "";
  transform: translateX(4px);
}

.egp-bigplay:hover {
  background: #fff;
  transform: scale(1.05);
}

.egp-wrap.playing .egp-bigplay {
  opacity: 0;
  pointer-events: none;
}

.egp-controls {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.45) 60%, rgba(0, 0, 0, 0.55) 100%);
  color: #fff;
  font-size: 14px;
  opacity: 0;
  transform: translateY(8px);
  transition: 0.18s ease;
}

.egp-wrap:hover .egp-controls,
.egp-wrap.focus .egp-controls {
  opacity: 1;
  transform: translateY(0);
}

.egp-btn {
  padding: 6px 10px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  line-height: 1;
  cursor: pointer;
  appearance: none;
}

.egp-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

.egp-seek {
  flex: 1;
}

.egp-vol {
  width: 90px;
}

.egp-seek,
.egp-vol {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.3);
  outline: 0;
  appearance: none;
  -webkit-appearance: none;
}

.egp-seek::-webkit-slider-thumb,
.egp-vol::-webkit-slider-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  -webkit-appearance: none;
}

.egp-time {
  white-space: nowrap;
  opacity: 0.9;
}

:fullscreen .egp-wrap,
.egp-wrap:fullscreen {
  border-radius: 0;
}

.tg-voice {
  --tg-bg: #ecf5ff;
  --tg-fg: #0b3a66;
  --tg-play: #1d9bf0;
  --tg-play-fg: #fff;
  --wave-bg: rgba(13, 110, 253, 0.25);
  --wave-fg: #1d9bf0;

  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 18px;
  background: var(--tg-bg);
  color: var(--tg-fg);
}

.tgv-play {
  position: relative;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border: 0;
  border-radius: 50%;
  background: var(--tg-play);
  color: var(--tg-play-fg);
  box-shadow: 0 4px 14px rgba(29, 155, 240, 0.35);
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.tgv-play:hover {
  filter: brightness(1.05);
  transform: scale(1.05);
}

.tgv-play::before {
  position: absolute;
  inset: 0;
  width: 0;
  height: 0;
  margin: auto;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 12px solid var(--tg-play-fg);
  content: "";
  transform: translateX(2px);
}

.tg-voice.playing .tgv-play::before {
  width: 12px;
  height: 16px;
  border: 0;
  box-shadow: 6px 0 0 0 var(--tg-play-fg);
  transform: none;
}

.tgv-info {
  min-width: 0;
  flex: 1 1 auto;
}

.tgv-progress {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  margin: 0;
  overflow: hidden;
}

.tgv-wave {
  display: block;
  width: 100%;
  height: 36px;
}

.tgv-knob {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
}

@media (prefers-color-scheme: dark) {
  .tg-voice {
    --wave-bg: rgba(59, 130, 246, 0.35);
    --wave-fg: #60a5fa;
  }
}
