:root {
  --dg-success: #4f6c5d;
  --dg-danger: #9f3f3a;
  --dg-focus: #345e6e;
}

.dg-hidden,
[hidden].dg-hidden {
  display: none !important;
}

.dg-topbar {
  position: fixed;
  top: 0.7rem;
  right: 0.9rem;
  z-index: 900;
  display: flex;
  gap: 0.45rem;
  align-items: center;
  font-family: var(--sans, system-ui, sans-serif);
}

.dg-pill,
.dg-link-btn,
.dg-primary,
.dg-secondary,
.dg-danger {
  min-height: 2rem;
  border-radius: 4px;
  border: 1px solid var(--warm-light, #d4c5b0);
  font-family: var(--sans, system-ui, sans-serif);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.16s, border-color 0.16s, color 0.16s, transform 0.16s;
}

.dg-pill,
.dg-secondary,
.dg-link-btn {
  background: var(--paper-card, #fbf6ee);
  color: var(--secondary, #8b7355);
  padding: 0.42rem 0.78rem;
}

.dg-primary {
  background: var(--secondary, #8b7355);
  border-color: var(--secondary, #8b7355);
  color: var(--paper, #f6f1ea);
  padding: 0.48rem 0.9rem;
}

.dg-danger {
  background: transparent;
  color: var(--dg-danger);
  border-color: rgba(159, 63, 58, 0.35);
  padding: 0.42rem 0.78rem;
}

.dg-pill:hover,
.dg-secondary:hover,
.dg-link-btn:hover {
  background: var(--paper-soft, #efe9df);
  border-color: var(--warm, #a89279);
  color: var(--ink, #1a1714);
  text-decoration: none;
}

.dg-primary:hover {
  background: var(--ink, #1a1714);
  border-color: var(--ink, #1a1714);
}

.dg-user-chip {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  text-transform: none;
  letter-spacing: 0;
}

.signin-btn {
  font-family: var(--sans, system-ui, sans-serif);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--secondary, #8b7355);
  background: var(--paper-card, #fbf6ee);
  border: 1px solid var(--warm-light, #d4c5b0);
  border-radius: 4px;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}
.signin-btn:hover {
  background: var(--secondary, #8b7355);
  color: var(--paper, #f6f1ea);
  border-color: var(--secondary, #8b7355);
}


.dg-avatar,
.dg-comment-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--secondary, #8b7355);
  color: var(--paper, #f6f1ea);
  font-family: var(--sans, system-ui, sans-serif);
  font-weight: 700;
}

.dg-avatar {
  width: 1.7rem;
  height: 1.7rem;
  font-size: 0.7rem;
}

.dg-user-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.1;
}

.dg-user-meta small {
  color: var(--gray-light, #9a9490);
  font-size: 0.58rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dg-block-discussion {
  border-top: 1px dashed var(--warm-pale, #ebe4da);
  margin: 0.55rem -1.4rem -0.45rem;
  padding: 0.65rem 1.4rem 0.85rem;
  background: rgba(168, 146, 121, 0.045);
}

.dg-block-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.dg-action {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--gray, #6b6560);
  cursor: pointer;
  font-family: var(--sans, system-ui, sans-serif);
  font-size: 0.68rem;
  letter-spacing: 0.03em;
  padding: 0.28rem 0.65rem;
}

.dg-action:hover,
.dg-action.dg-active {
  background: var(--paper-card, #fbf6ee);
  border-color: var(--warm-pale, #ebe4da);
  color: var(--secondary, #8b7355);
}

.dg-action.dg-liked {
  color: var(--dg-danger);
}

.dg-count {
  color: var(--gray-light, #9a9490);
  font-size: 0.62rem;
}

.dg-block-panel {
  margin-top: 0.65rem;
  border: 1px solid var(--warm-pale, #ebe4da);
  background: var(--paper-card, #fbf6ee);
  border-radius: var(--radius, 8px);
  overflow: hidden;
}

.dg-panel-inner {
  padding: 0.85rem 0.95rem;
}

.dg-composer {
  display: grid;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.dg-composer textarea {
  width: 100%;
  min-height: 5.2rem;
  resize: vertical;
  border: 1px solid var(--warm-pale, #ebe4da);
  border-radius: 5px;
  background: var(--paper, #f6f1ea);
  color: var(--ink, #1a1714);
  font-family: var(--serif, Georgia, serif);
  font-size: 0.98rem;
  line-height: 1.5;
  padding: 0.75rem 0.85rem;
}

.dg-composer textarea:focus,
.dg-field input:focus,
.dg-field select:focus {
  outline: 2px solid rgba(52, 94, 110, 0.18);
  border-color: var(--dg-focus);
}

.dg-composer-row,
.dg-inline-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.dg-note {
  color: var(--gray-light, #9a9490);
  font-family: var(--sans, system-ui, sans-serif);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
}

.dg-thread-list {
  display: grid;
  gap: 0.65rem;
}

.dg-thread-empty {
  color: var(--gray-light, #9a9490);
  font-family: var(--serif, Georgia, serif);
  font-style: italic;
  padding: 0.3rem 0;
}

.dg-post {
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: 0.7rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--warm-pale, #ebe4da);
}

.dg-post:first-child {
  border-top: none;
}

.dg-answer {
  margin-left: 2.7rem;
  border-top-style: dashed;
}

.dg-comment-reply {
  margin-left: 2.7rem;
  border-top-style: dashed;
}

.dg-comment-avatar {
  width: 2rem;
  height: 2rem;
  font-size: 0.72rem;
}

.dg-post-meta {
  display: flex;
  gap: 0.45rem;
  align-items: baseline;
  flex-wrap: wrap;
  color: var(--gray-light, #9a9490);
  font-family: var(--sans, system-ui, sans-serif);
  font-size: 0.64rem;
  letter-spacing: 0.04em;
}

.dg-author {
  color: var(--ink, #1a1714);
  font-weight: 700;
  letter-spacing: 0;
}

.dg-tag {
  border-radius: 3px;
  background: rgba(110, 138, 120, 0.16);
  color: var(--dg-success);
  font-size: 0.54rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 1px 6px;
  text-transform: uppercase;
}

.dg-tag.dg-question {
  background: rgba(122, 107, 145, 0.16);
  color: var(--accent-question, #7a6b91);
}

.dg-tag.dg-accepted {
  background: rgba(79, 108, 93, 0.18);
}

.dg-post-body {
  margin: 0.26rem 0 0;
  color: var(--ink, #1a1714);
  font-family: var(--serif, Georgia, serif);
  line-height: 1.55;
  white-space: pre-wrap;
}

.dg-post-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.45rem;
  flex-wrap: wrap;
}

.dg-text-action {
  border: none;
  border-bottom: 1px solid transparent;
  background: transparent;
  color: var(--gray, #6b6560);
  cursor: pointer;
  font-family: var(--sans, system-ui, sans-serif);
  font-size: 0.64rem;
  letter-spacing: 0.06em;
  padding: 0;
  text-transform: uppercase;
}

.dg-text-action:hover {
  border-color: var(--warm-light, #d4c5b0);
  color: var(--secondary, #8b7355);
}

.dg-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.2rem;
  background: rgba(26, 23, 20, 0.42);
}

.dg-modal.dg-open {
  display: flex;
}

.dg-modal-card {
  width: min(440px, 100%);
  max-height: min(90vh, 720px);
  overflow: auto;
  border: 1px solid var(--warm-light, #d4c5b0);
  border-radius: 8px;
  background: var(--paper, #f6f1ea);
  box-shadow: 0 22px 65px rgba(0, 0, 0, 0.22);
}

.dg-modal-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--warm-pale, #ebe4da);
}

.dg-modal-title {
  color: var(--ink, #1a1714);
  font-family: var(--serif, Georgia, serif);
  font-size: 1.35rem;
  font-weight: 500;
}

.dg-close {
  border: none;
  background: transparent;
  color: var(--gray, #6b6560);
  cursor: pointer;
  font-size: 1.3rem;
  line-height: 1;
}

.dg-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--warm-pale, #ebe4da);
}

.dg-tab {
  border: none;
  background: var(--paper-soft, #efe9df);
  color: var(--gray, #6b6560);
  cursor: pointer;
  font-family: var(--sans, system-ui, sans-serif);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 0.75rem;
  text-transform: uppercase;
}

.dg-tab.dg-active {
  background: var(--paper, #f6f1ea);
  color: var(--secondary, #8b7355);
}

.dg-form {
  display: grid;
  gap: 0.85rem;
  padding: 1.1rem;
}

.dg-field {
  display: grid;
  gap: 0.28rem;
}

.dg-field label {
  color: var(--gray, #6b6560);
  font-family: var(--sans, system-ui, sans-serif);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.dg-field input {
  border: 1px solid var(--warm-pale, #ebe4da);
  border-radius: 5px;
  background: var(--paper-card, #fbf6ee);
  color: var(--ink, #1a1714);
  font: 1rem var(--sans, system-ui, sans-serif);
  padding: 0.65rem 0.75rem;
}

.dg-field select {
  border: 1px solid var(--warm-pale, #ebe4da);
  border-radius: 5px;
  background: var(--paper-card, #fbf6ee);
  color: var(--ink, #1a1714);
  font: 0.86rem var(--sans, system-ui, sans-serif);
  min-height: 2.45rem;
  padding: 0.55rem 0.65rem;
}

.dg-error {
  color: var(--dg-danger);
  font-family: var(--sans, system-ui, sans-serif);
  font-size: 0.78rem;
}

.dg-toast {
  position: fixed;
  left: 50%;
  bottom: 1.4rem;
  z-index: 1300;
  max-width: min(92vw, 560px);
  transform: translateX(-50%) translateY(16px);
  border-radius: 5px;
  background: var(--ink, #1a1714);
  color: var(--paper, #f6f1ea);
  font-family: var(--sans, system-ui, sans-serif);
  font-size: 0.76rem;
  letter-spacing: 0.03em;
  opacity: 0;
  padding: 0.65rem 0.95rem;
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
}

.dg-toast.dg-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.dg-admin-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 2rem 1.2rem 4rem;
}

.dg-admin-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  border-bottom: 1px solid var(--warm-pale, #ebe4da);
  margin-bottom: 1.2rem;
  padding-bottom: 1rem;
}

.dg-admin-title {
  color: var(--ink, #1a1714);
  font-family: var(--serif, Georgia, serif);
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 300;
  letter-spacing: -0.02em;
  line-height: 1;
}

.dg-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 0.6rem;
  margin: 1.2rem 0;
}

.dg-stat,
.dg-admin-section {
  border: 1px solid var(--warm-pale, #ebe4da);
  border-radius: 8px;
  background: var(--paper-card, #fbf6ee);
}

.dg-stat {
  padding: 0.85rem;
}

.dg-stat strong {
  display: block;
  color: var(--ink, #1a1714);
  font-family: var(--sans, system-ui, sans-serif);
  font-variant-numeric: tabular-nums;
  font-size: 1.8rem;
  font-weight: 600;
}

.dg-stat span,
.dg-admin-muted {
  color: var(--gray-light, #9a9490);
  font-family: var(--sans, system-ui, sans-serif);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dg-admin-grid {
  display: grid;
  grid-template-columns: minmax(250px, 0.7fr) minmax(280px, 0.9fr) minmax(320px, 1.3fr);
  gap: 0.9rem;
}

.dg-admin-section {
  overflow: hidden;
}

.dg-admin-section h2 {
  border-bottom: 1px solid var(--warm-pale, #ebe4da);
  color: var(--ink, #1a1714);
  font-family: var(--serif, Georgia, serif);
  font-size: 1.25rem;
  font-weight: 500;
  padding: 0.8rem 0.9rem;
}

.dg-admin-list {
  display: grid;
}

.dg-admin-tools {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(105px, 0.45fr) minmax(105px, 0.45fr) minmax(120px, 0.5fr);
  gap: 0.6rem;
  align-items: end;
  border-bottom: 1px solid var(--warm-pale, #ebe4da);
  padding: 0.8rem 0.9rem;
}

.dg-admin-count,
.dg-admin-empty {
  color: var(--gray-light, #9a9490);
  font-family: var(--sans, system-ui, sans-serif);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dg-admin-count {
  grid-column: 1 / -1;
}

.dg-admin-empty {
  padding: 0.9rem;
}

.dg-admin-form {
  display: grid;
  gap: 0.75rem;
  padding: 0.9rem;
}

.dg-check {
  display: inline-flex;
  gap: 0.45rem;
  align-items: center;
  color: var(--gray, #6b6560);
  font-family: var(--sans, system-ui, sans-serif);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.dg-check input {
  accent-color: var(--secondary, #8b7355);
}

.dg-admin-row {
  display: grid;
  gap: 0.45rem;
  border-bottom: 1px solid var(--warm-pale, #ebe4da);
  padding: 0.8rem 0.9rem;
}

.dg-admin-row:last-child {
  border-bottom: none;
}

.dg-admin-row-title {
  color: var(--ink, #1a1714);
  font-family: var(--sans, system-ui, sans-serif);
  font-size: 0.84rem;
  font-weight: 700;
}

.dg-admin-row-body {
  color: var(--gray, #6b6560);
  font-family: var(--serif, Georgia, serif);
  font-size: 0.92rem;
  line-height: 1.45;
  max-height: 5.4rem;
  overflow: auto;
  white-space: pre-wrap;
}

@media (max-width: 900px) {
  .dg-topbar {
    position: static;
    justify-content: flex-end;
    padding: 0.7rem 1rem 0;
  }

  .dg-block-discussion {
    margin-left: -1rem;
    margin-right: -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .dg-admin-grid {
    grid-template-columns: 1fr;
  }

  .dg-admin-tools {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .dg-answer {
    margin-left: 0;
  }

  .dg-comment-reply {
    margin-left: 0;
  }

  .dg-admin-tools {
    grid-template-columns: 1fr;
  }

  .dg-post {
    grid-template-columns: 1.75rem 1fr;
  }

  .dg-comment-avatar {
    width: 1.75rem;
    height: 1.75rem;
    font-size: 0.64rem;
  }
}

/* ═══════════════════════════════════════════════════
   LAYOUT SWITCHER
═══════════════════════════════════════════════════ */
.dg-layout-bar {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.45rem 0.8rem;
  border-top: 1px solid var(--warm-pale);
  background: var(--paper-soft);
  flex-shrink: 0;
}
.dg-layout-bar-label {
  font-family: var(--sans, system-ui);
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gray-light);
  margin-right: 0.2rem;
}
.dg-layout-btn {
  padding: 0.3rem 0.55rem;
  border: 1px solid var(--warm-light);
  border-radius: 4px;
  background: var(--paper-card);
  color: var(--gray);
  font-family: var(--sans, system-ui);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.dg-layout-btn:hover {
  background: var(--paper-soft);
  border-color: var(--warm);
  color: var(--ink);
}
.dg-layout-btn.active {
  background: var(--secondary);
  border-color: var(--secondary);
  color: var(--paper);
}

/* ═══════════════════════════════════════════════════
   LAYOUT MODES — full viewport, no wasted space
═══════════════════════════════════════════════════ */

/* Shared: all layout modes kill the .content-inner narrow-column
   so content breathes across the full panel width */
body.layout-split .content-inner,
body.layout-top   .content-inner,
body.layout-focus .content-inner {
  max-width: 100%;
  padding: 1.6rem 2rem 4rem;
}

/* ── Split: video left | content right ── */
body.layout-split .main-layout {
  display: grid;
  grid-template-columns: minmax(320px, 48%) 1fr;
  width: 100%;
  height: calc(100vh - 60px);
  overflow: hidden;
}
body.layout-split .video-panel {
  position: sticky;
  top: 0;
  width: 100%;
  height: calc(100vh - 60px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
body.layout-split .content-panel {
  overflow-y: auto;
  height: calc(100vh - 60px);
  width: 100%;
}

/* ── Top Freeze: video + transcript bar pinned, content scrolls full width below ── */
body.layout-top .main-layout {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: auto;
  overflow: visible;
}
body.layout-top .video-panel {
  position: sticky;
  top: 0;
  z-index: 200;
  width: 100%;
  height: auto;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  border-right: none;
  border-bottom: 2px solid var(--warm-pale);
  background: var(--paper-soft);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
body.layout-top .video-wrapper {
  flex: 0 0 55%;
  padding-top: 0;
  height: clamp(220px, 30vw, 380px);
  position: relative;
  background: #000;
}
body.layout-top .video-wrapper iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
}
body.layout-top .video-footer {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  border-left: 1px solid var(--warm-pale);
  overflow: hidden;
}
body.layout-top .section-nav {
  flex: 1 1 100%;
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  display: flex;
  flex-direction: row;
  gap: 0.3rem;
  padding: 0.4rem 0.8rem;
  border-top: 1px solid var(--warm-pale);
  max-height: 3.5rem;
}
body.layout-top .section-nav .nav-pill {
  flex-shrink: 0;
  white-space: nowrap;
  flex-direction: row;
  padding: 0.25rem 0.6rem;
  min-height: 2rem;
  align-items: center;
}
body.layout-top .section-nav .nav-pill .pill-title {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.layout-top .content-panel {
  flex: 1 1 auto;
  overflow: visible;
  height: auto;
  width: 100%;
  padding: 0;
}
body.layout-top .dg-layout-bar {
  width: 100%;
}

/* ── Focus: big content left | video column right ── */
body.layout-focus .main-layout {
  display: grid;
  grid-template-columns: 1fr minmax(340px, 38%);
  width: 100%;
  height: calc(100vh - 60px);
  overflow: hidden;
}
body.layout-focus .video-panel {
  position: sticky;
  top: 0;
  width: 100%;
  height: calc(100vh - 60px);
  overflow: hidden;
  order: 1;
  border-right: none;
  border-left: 1px solid var(--warm-pale);
  display: flex;
  flex-direction: column;
}
body.layout-focus .video-panel .video-wrapper {
  flex: 0 0 auto;
  padding-top: 56.25%;
  position: relative;
  width: 100%;
}
body.layout-focus .content-panel {
  order: 0;
  overflow-y: auto;
  height: calc(100vh - 60px);
  width: 100%;
}


/* ── Flipped: content left | video right (mirror of split) ── */
body.layout-flip .main-layout {
  display: grid;
  grid-template-columns: 1fr minmax(320px, 48%);
  width: 100%;
  height: calc(100vh - 60px);
  overflow: hidden;
}
body.layout-flip .video-panel {
  position: sticky;
  top: 0;
  width: 100%;
  height: calc(100vh - 60px);
  overflow: hidden;
  order: 1;
  border-right: none;
  border-left: 1px solid var(--warm-pale);
  display: flex;
  flex-direction: column;
}
body.layout-flip .content-panel {
  order: 0;
  overflow-y: auto;
  height: calc(100vh - 60px);
  width: 100%;
}

/* ── Theater: full-width video frozen at top, full-width content below ── */
body.layout-theater .main-layout {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: auto;
  overflow: visible;
}
body.layout-theater .video-panel {
  position: sticky;
  top: 0;
  z-index: 200;
  width: 100%;
  display: flex;
  flex-direction: column;
  border-bottom: 2px solid var(--warm-pale);
  
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}
body.layout-theater .video-wrapper {
  flex: 0 0 auto;
  width: 100%;
  padding-top: 0;
  height: clamp(260px, 42vw, 520px);
  position: relative;
  background: #000;
}
body.layout-theater .video-wrapper iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
}
body.layout-theater .video-footer {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
  background: var(--paper-soft);
  border-top: 1px solid var(--warm-pale);
  padding: 0;
  width: 100%;
  max-height: 3.4rem;
  overflow: hidden;
}
body.layout-theater .progress-container {
  flex: 0 0 auto;
  width: 100%;
  padding: 0.4rem 1rem 0;
  position: absolute;
  bottom: 0;
  left: 0;
  display: none;
}
body.layout-theater .now-playing {
  flex: 1;
  padding: 0.6rem 1rem;
  font-size: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.layout-theater .section-nav {
  flex: 2;
  overflow-x: auto;
  overflow-y: hidden;
  display: flex;
  flex-direction: row;
  gap: 0.3rem;
  padding: 0.4rem 0.8rem;
  border-left: 1px solid var(--warm-pale);
  max-height: 3.4rem;
}
body.layout-theater .section-nav .nav-pill {
  flex-shrink: 0;
  white-space: nowrap;
  flex-direction: row;
  padding: 0.2rem 0.5rem;
  min-height: 1.8rem;
  align-items: center;
}
body.layout-theater .section-nav .nav-pill .pill-title {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.layout-theater .dg-layout-bar {
  flex: 0 0 auto;
  border-left: 1px solid var(--warm-pale);
  padding: 0.4rem 0.8rem;
  max-height: 3.4rem;
  display: flex;
  align-items: center;
}
body.layout-theater .content-panel {
  flex: 1 1 auto;
  overflow: visible;
  height: auto;
  width: 100%;
  padding: 0;
}
body.layout-theater .content-inner,
body.layout-flip  .content-inner {
  max-width: 100%;
  padding: 1.6rem 2rem 4rem;
}
body.layout-theater .dg-transcript-panel { display: none; }

/* ═══════════════════════════════════════════════════
   INLINE VIDEO (replaces duplicate embed)
═══════════════════════════════════════════════════ */
.dg-inline-video-replaced {
  background: var(--paper-soft);
  border: 1px solid var(--warm-pale);
  border-radius: 6px;
  padding: 0.7rem 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--sans);
  font-size: 0.82rem;
  color: var(--gray);
  margin: 0.5rem 0;
  cursor: pointer;
  transition: all 0.15s;
}
.dg-inline-video-replaced:hover {
  background: var(--paper-card);
  border-color: var(--warm);
  color: var(--ink);
}
.dg-inline-video-replaced .play-icon {
  font-size: 1.2rem;
  color: var(--secondary);
}

/* ═══════════════════════════════════════════════════
   NOTES SYSTEM
═══════════════════════════════════════════════════ */
.dg-note-btn {
  background: transparent;
  border: 1px solid var(--warm-light);
  border-radius: 4px;
  color: var(--warm);
  font-family: var(--sans, system-ui);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.28rem 0.6rem;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.dg-note-btn:hover {
  background: var(--paper-soft);
  border-color: var(--accent-concept);
  color: var(--accent-concept);
}
.dg-note-btn.has-note {
  background: rgba(107,90,138,0.08);
  border-color: var(--accent-concept);
  color: var(--accent-concept);
}
.dg-note-btn .note-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-concept);
  display: none;
}
.dg-note-btn.has-note .note-dot {
  display: inline-block;
}

.dg-note-editor {
  margin-top: 0.7rem;
  background: rgba(107,90,138,0.04);
  border: 1px solid rgba(107,90,138,0.2);
  border-radius: 6px;
  padding: 0.8rem;
  display: none;
}
.dg-note-editor.open {
  display: block;
}
.dg-note-editor textarea {
  width: 100%;
  min-height: 80px;
  background: var(--paper-card);
  border: 1px solid var(--warm-pale);
  border-radius: 4px;
  padding: 0.5rem 0.7rem;
  font-family: var(--serif);
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--ink);
  resize: vertical;
  box-sizing: border-box;
}
.dg-note-editor textarea:focus {
  outline: none;
  border-color: var(--accent-concept);
  box-shadow: 0 0 0 2px rgba(107,90,138,0.12);
}
.dg-note-editor-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
  gap: 0.5rem;
}
.dg-note-editor-hint {
  font-family: var(--sans);
  font-size: 0.7rem;
  color: var(--gray-light);
}
.dg-note-editor-actions {
  display: flex;
  gap: 0.4rem;
}
.dg-note-saved-indicator {
  font-family: var(--sans);
  font-size: 0.7rem;
  color: var(--dg-success, #4f6c5d);
  opacity: 0;
  transition: opacity 0.4s;
}
.dg-note-saved-indicator.show {
  opacity: 1;
}

/* ═══════════════════════════════════════════════════
   MY NOTES LINK IN HEADER
═══════════════════════════════════════════════════ */
.dg-notes-nav-link {
  font-family: var(--sans);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-concept) !important;
  padding: 0.35rem 0.75rem;
  border: 1px solid rgba(107,90,138,0.3);
  border-radius: 3px;
  white-space: nowrap;
  transition: all 0.2s;
  text-decoration: none;
}
.dg-notes-nav-link:hover {
  background: rgba(107,90,138,0.08);
  border-color: var(--accent-concept);
  text-decoration: none;
}

/* ═══════════════════════════════════════════════════
   TOP FREEZE — FOLLOW-ALONG TRANSCRIPT PANEL
═══════════════════════════════════════════════════ */
body.layout-top .video-footer {
  padding: 0;
  gap: 0;
  overflow: hidden;
}
body.layout-top .progress-container {
  padding: 0.5rem 0.9rem 0.3rem;
  flex-shrink: 0;
}
body.layout-top .now-playing {
  padding: 0 0.9rem 0.4rem;
  flex-shrink: 0;
}
.dg-transcript-panel {
  display: none;
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  padding: 0.6rem 0.9rem 0.8rem;
  border-top: 1px solid var(--warm-pale);
  scroll-behavior: smooth;
}
body.layout-top .dg-transcript-panel {
  display: block;
}
.dg-transcript-header {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}
.dg-transcript-kind {
  font-family: var(--sans);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  background: var(--paper-soft);
  color: var(--gray);
}
.dg-transcript-title {
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dg-transcript-time {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--secondary);
  cursor: pointer;
  border: 1px solid var(--warm-light);
  border-radius: 3px;
  padding: 0.1rem 0.35rem;
  transition: all 0.15s;
  flex-shrink: 0;
}
.dg-transcript-time:hover {
  background: var(--paper-soft);
  border-color: var(--warm);
}
.dg-transcript-body {
  font-family: var(--serif);
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--ink);
}
.dg-transcript-body p { margin: 0 0 0.5em; }
.dg-transcript-body ul, .dg-transcript-body ol { padding-left: 1.2em; margin: 0 0 0.5em; }
.dg-transcript-body table { font-size: 0.82rem; border-collapse: collapse; width: 100%; margin-bottom: 0.5em; }
.dg-transcript-body th, .dg-transcript-body td { padding: 0.2rem 0.4rem; border: 1px solid var(--warm-pale); }
.dg-transcript-body th { background: var(--paper-soft); font-family: var(--sans); font-size: 0.7rem; }
.dg-transcript-body h3 { font-size: 0.9rem; margin: 0.4em 0 0.3em; font-weight: 500; }
.dg-transcript-body a { color: var(--secondary); }
.dg-transcript-empty {
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--gray-light);
  font-style: italic;
  padding: 0.5rem 0;
}
/* Accent colors per section type */
body.layout-top .dg-transcript-kind.kind-concept    { background: rgba(107,90,138,0.12); color: var(--accent-concept); }
body.layout-top .dg-transcript-kind.kind-equation   { background: rgba(79,108,125,0.12); color: var(--accent-equation); }
body.layout-top .dg-transcript-kind.kind-analogy    { background: rgba(176,141,82,0.12); color: var(--accent-analogy); }
body.layout-top .dg-transcript-kind.kind-simulation { background: rgba(110,138,120,0.12); color: var(--accent-simulation); }
body.layout-top .dg-transcript-kind.kind-question   { background: rgba(122,107,145,0.12); color: var(--accent-question); }

/* Admin dot at bottom of sign-in modal */
.dg-auth-admin-dot {
  text-align: center;
  padding: 0.5rem 0 0.1rem;
  line-height: 1;
}
.dg-auth-admin-dot a {
  font-size: 1.2rem;
  color: var(--warm-pale, #ddd);
  text-decoration: none;
  display: inline-block;
  width: 1.5rem;
  height: 1.5rem;
  line-height: 1.5rem;
  border-radius: 50%;
  transition: color 0.2s;
}
.dg-auth-admin-dot a:hover {
  color: var(--secondary, #999);
}

/* Leaderboard link in header */
a.dg-lb-link {
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--secondary);
  text-decoration: none;
  opacity: 0.8;
  transition: opacity 0.2s;
  white-space: nowrap;
}
a.dg-lb-link:hover { opacity: 1; }

/* =============================================
   EPISODE DISCUSSION SECTION
   ============================================= */
.dg-episode-discussion {
  margin: 3rem 0 2rem;
  border-top: 2px solid var(--warm-pale, #e8e0d0);
  padding-top: 2rem;
}
.dg-episode-discussion h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--ink, #2a2010);
  margin: 0 0 1.4rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.dg-episode-discussion h2 .dg-disc-count {
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--warm-pale, #e8e0d0);
  color: var(--ink-soft, #6b5c40);
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  min-width: 1.8rem;
  text-align: center;
}

/* Compose box */
.dg-disc-compose {
  background: var(--paper-soft, #f8f4ee);
  border: 1.5px solid var(--warm-pale, #e8e0d0);
  border-radius: 12px;
  padding: 1.2rem;
  margin-bottom: 1.6rem;
}
.dg-disc-compose-row {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 0.7rem;
  align-items: center;
  flex-wrap: wrap;
}
.dg-disc-kind-btn {
  padding: 0.3rem 0.9rem;
  border-radius: 999px;
  border: 1.5px solid var(--warm-pale, #e8e0d0);
  background: white;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--ink-soft, #6b5c40);
}
.dg-disc-kind-btn.active {
  background: var(--accent, #c8a96e);
  border-color: var(--accent, #c8a96e);
  color: white;
}
.dg-disc-textarea {
  width: 100%;
  min-height: 90px;
  border: 1.5px solid var(--warm-pale, #e8e0d0);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--ink, #2a2010);
  background: white;
  resize: vertical;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.15s;
}
.dg-disc-textarea:focus {
  border-color: var(--accent, #c8a96e);
}
.dg-disc-submit {
  margin-top: 0.7rem;
  padding: 0.5rem 1.4rem;
  background: var(--accent, #c8a96e);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
}
.dg-disc-submit:hover { opacity: 0.85; }
.dg-disc-submit:disabled { opacity: 0.5; cursor: not-allowed; }
.dg-disc-guest {
  text-align: center;
  padding: 1rem;
  color: var(--ink-soft, #6b5c40);
  font-size: 0.9rem;
  background: var(--paper-soft, #f8f4ee);
  border-radius: 10px;
  border: 1.5px dashed var(--warm-pale, #e8e0d0);
  margin-bottom: 1.6rem;
}
.dg-disc-guest a {
  color: var(--accent, #c8a96e);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

/* Post list */
.dg-disc-posts { display: flex; flex-direction: column; gap: 1rem; }
.dg-disc-empty {
  text-align: center;
  color: var(--ink-soft, #6b5c40);
  padding: 2rem;
  font-style: italic;
  opacity: 0.7;
}

/* Individual post */
.dg-disc-post {
  background: white;
  border: 1.5px solid var(--warm-pale, #e8e0d0);
  border-radius: 12px;
  padding: 1.1rem 1.3rem;
  transition: border-color 0.15s;
}
.dg-disc-post:hover { border-color: var(--accent, #c8a96e); }
.dg-disc-post-header {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.7rem;
  flex-wrap: wrap;
}
.dg-disc-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent, #c8a96e);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.dg-disc-post-meta { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.dg-disc-post-author { font-weight: 700; font-size: 0.9rem; color: var(--ink, #2a2010); }
.dg-disc-post-time { font-size: 0.78rem; color: var(--ink-soft, #6b5c40); }
.dg-disc-kind-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.dg-disc-kind-badge.comment { background: #e8f0fe; color: #1a73e8; }
.dg-disc-kind-badge.question { background: #fef3e2; color: #e8890c; }
.dg-disc-kind-badge.answer { background: #e6f4ea; color: #1e7e34; }

.dg-disc-post-body {
  font-size: 0.93rem;
  line-height: 1.6;
  color: var(--ink, #2a2010);
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 0.8rem;
}
.dg-disc-post-actions {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  flex-wrap: wrap;
}
.dg-disc-like-btn, .dg-disc-reply-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--ink-soft, #6b5c40);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  transition: background 0.12s, color 0.12s;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.dg-disc-like-btn:hover, .dg-disc-reply-btn:hover {
  background: var(--warm-pale, #e8e0d0);
  color: var(--ink, #2a2010);
}
.dg-disc-like-btn.liked { color: var(--accent, #c8a96e); font-weight: 700; }

/* Replies indent */
.dg-disc-replies {
  margin-top: 0.8rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--warm-pale, #e8e0d0);
  padding-left: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.dg-disc-reply-form {
  margin-top: 0.5rem;
  padding: 0.7rem;
  background: var(--paper-soft, #f8f4ee);
  border-radius: 8px;
  border: 1.5px solid var(--warm-pale, #e8e0d0);
}
.dg-disc-reply-textarea {
  width: 100%;
  min-height: 60px;
  border: 1.5px solid var(--warm-pale, #e8e0d0);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-family: inherit;
  font-size: 0.88rem;
  resize: vertical;
  box-sizing: border-box;
  outline: none;
}
.dg-disc-reply-textarea:focus { border-color: var(--accent, #c8a96e); }
.dg-disc-reply-submit {
  margin-top: 0.5rem;
  padding: 0.35rem 1rem;
  background: var(--accent, #c8a96e);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

/* Admin Revamp v20260511-ADMIN1 */
.dg-admin-shell-v2 {
  max-width: 1320px;
}
.dg-admin-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.15rem;
  border: 1px solid var(--warm-pale, #ebe4da);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(251,246,238,0.98), rgba(244,234,219,0.82));
  box-shadow: 0 18px 50px rgba(40, 31, 21, 0.07);
  margin-bottom: 0.9rem;
}
.dg-admin-kicker {
  color: var(--secondary, #8b7355);
  font-family: var(--sans, system-ui, sans-serif);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}
.dg-admin-hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.45rem;
}
.dg-admin-alert-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 0.55rem;
  margin: 0.85rem 0;
}
.dg-admin-alert-strip > div {
  border: 1px solid var(--warm-pale, #ebe4da);
  border-radius: 12px;
  background: var(--paper-card, #fbf6ee);
  padding: 0.75rem 0.85rem;
}
.dg-admin-alert-strip strong {
  display: block;
  color: var(--ink, #1a1714);
  font-size: 1.35rem;
  font-family: var(--sans, system-ui, sans-serif);
}
.dg-admin-alert-strip span {
  color: var(--gray-light, #9a9490);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.dg-admin-alert-strip .dg-admin-attn {
  border-color: rgba(160, 60, 40, 0.35);
  background: rgba(160, 60, 40, 0.08);
}
.dg-stats-v2 .dg-stat {
  border-radius: 12px;
}
.dg-admin-grid-v2 {
  grid-template-columns: minmax(330px, 0.95fr) minmax(270px, 0.75fr) minmax(260px, 0.7fr);
  align-items: start;
}
.dg-admin-posts-v2 {
  grid-column: 1 / -1;
}
.dg-admin-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  border-bottom: 1px solid var(--warm-pale, #ebe4da);
  padding: 0.8rem 0.9rem;
}
.dg-admin-section-head h2 {
  border-bottom: none;
  padding: 0;
  margin: 0;
}
.dg-admin-section-head span {
  color: var(--gray-light, #9a9490);
  font-family: var(--sans, system-ui, sans-serif);
  font-size: 0.62rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.dg-admin-guide {
  color: var(--gray, #6b6560);
  display: grid;
  gap: 0.65rem;
  font-family: var(--sans, system-ui, sans-serif);
  font-size: 0.84rem;
  line-height: 1.5;
  padding: 0.95rem;
}
.dg-admin-user-card {
  gap: 0.65rem;
}
.dg-admin-user-main {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.dg-admin-user-avatar {
  width: 2.45rem;
  height: 2.45rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--ink, #1a1714);
  color: var(--paper, #fff9f0);
  font-family: var(--sans, system-ui, sans-serif);
  font-weight: 800;
  letter-spacing: 0.04em;
}
.dg-admin-user-meta,
.dg-admin-post-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.dg-admin-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--warm-pale, #ebe4da);
  border-radius: 999px;
  background: rgba(255,255,255,0.58);
  color: var(--gray, #6b6560);
  font-family: var(--sans, system-ui, sans-serif);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1;
  padding: 0.36rem 0.52rem;
  text-transform: uppercase;
}
.dg-admin-pill-admin {
  border-color: rgba(99, 88, 145, 0.35);
  background: rgba(99, 88, 145, 0.1);
  color: #4b4078;
}
.dg-admin-pill-member {
  border-color: rgba(139, 115, 85, 0.32);
  background: rgba(139, 115, 85, 0.1);
}
.dg-admin-pill-ok {
  border-color: rgba(60, 130, 83, 0.35);
  background: rgba(60, 130, 83, 0.1);
  color: #2f7146;
}
.dg-admin-pill-danger {
  border-color: rgba(160, 60, 40, 0.38);
  background: rgba(160, 60, 40, 0.1);
  color: #9b3928;
}
.dg-admin-user-actions,
.dg-admin-post-actions {
  gap: 0.4rem;
}
.dg-admin-reset {
  border: 2px solid #b83d2f !important;
  color: #9b2e22 !important;
  font-weight: 800 !important;
}
.dg-admin-tools-v2 {
  grid-template-columns: minmax(260px, 1.2fr) repeat(3, minmax(130px, 0.5fr));
  background: rgba(255,255,255,0.38);
}
.dg-admin-post-list {
  display: grid;
  gap: 0;
}
.dg-admin-post-card {
  gap: 0.65rem;
}
.dg-admin-post-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}
.dg-admin-kind {
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  color: #fff;
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  margin-right: 0.35rem;
  padding: 0.22rem 0.38rem;
  text-transform: uppercase;
  vertical-align: middle;
}
.dg-admin-kind-comment { background: #68717c; }
.dg-admin-kind-question { background: #7a5b9a; }
.dg-admin-kind-answer { background: #3f7a54; }
.dg-admin-post-context {
  color: var(--secondary, #8b7355);
  font-family: var(--sans, system-ui, sans-serif);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
@media (max-width: 980px) {
  .dg-admin-hero,
  .dg-admin-post-top {
    flex-direction: column;
  }
  .dg-admin-hero-actions {
    justify-content: flex-start;
  }
  .dg-admin-alert-strip,
  .dg-admin-grid-v2 {
    grid-template-columns: 1fr;
  }
  .dg-admin-tools-v2 {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 560px) {
  .dg-admin-alert-strip,
  .dg-admin-tools-v2 {
    grid-template-columns: 1fr;
  }
}

/* Theater Study Mode Revamp v20260511-THEATER1
   Goal: keep video available while making episode content and notes visible/usable. */
body.layout-theater {
  overflow: hidden;
}
body.layout-theater .site-header {
  position: sticky;
  top: 0;
  z-index: 260;
}
body.layout-theater .main-layout {
  display: grid;
  grid-template-columns: minmax(360px, 42vw) minmax(0, 1fr);
  gap: 0;
  width: 100%;
  height: calc(100vh - 82px);
  min-height: 560px;
  overflow: hidden;
  background: var(--paper, #f6f1ea);
}
body.layout-theater .video-panel {
  position: sticky;
  top: 82px;
  z-index: 180;
  align-self: start;
  width: 100%;
  height: calc(100vh - 82px);
  max-height: calc(100vh - 82px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 2px solid var(--warm-pale, #ebe4da);
  border-bottom: none;
  background: var(--paper-soft, #efe9df);
  box-shadow: 2px 0 18px rgba(0,0,0,0.10);
}
body.layout-theater .video-wrapper {
  flex: 0 0 auto;
  width: 100%;
  height: clamp(230px, 25vw, 430px);
  max-height: 48vh;
  padding-top: 0;
  position: relative;
  background: #000;
}
body.layout-theater .video-wrapper iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
body.layout-theater .video-footer {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 0;
  background: var(--paper-soft, #efe9df);
  border-top: 1px solid var(--warm-pale, #ebe4da);
  padding: 0;
  width: 100%;
  max-height: none;
  overflow: hidden;
}
body.layout-theater .now-playing {
  flex: none;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--warm-pale, #ebe4da);
  font-size: 0.78rem;
  line-height: 1.25;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}
body.layout-theater .dg-layout-bar {
  flex: none;
  border-left: none;
  border-bottom: 1px solid var(--warm-pale, #ebe4da);
  padding: 0.55rem 0.75rem;
  max-height: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}
body.layout-theater .dg-layout-bar-label {
  width: 100%;
  margin: 0 0 0.15rem;
}
body.layout-theater .dg-layout-btn {
  font-size: 0.58rem;
  padding: 0.28rem 0.45rem;
}
body.layout-theater .section-nav {
  flex: none;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: grid;
  align-content: start;
  grid-auto-rows: min-content;
  gap: 0.25rem;
  padding: 0.65rem 0.75rem 1rem;
  border-left: none;
  max-height: none;
}
body.layout-theater .section-nav .nav-pill {
  width: 100%;
  flex-shrink: 1;
  white-space: normal;
  flex-direction: row;
  justify-content: flex-start;
  padding: 0.42rem 0.55rem;
  min-height: 2rem;
  align-items: center;
}
body.layout-theater .section-nav .nav-pill .pill-title {
  max-width: none;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.layout-theater .content-panel {
  min-width: 0;
  width: 100%;
  height: calc(100vh - 82px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0;
  scroll-behavior: smooth;
}
body.layout-theater .content-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 1.25rem clamp(1rem, 2.2vw, 2.25rem) 5rem;
}
body.layout-theater .section-card {
  scroll-margin-top: 1.1rem;
}
body.layout-theater .section-card:first-of-type {
  margin-top: 0;
}
body.layout-theater .dg-block-actions {
  position: sticky;
  top: 0;
  z-index: 12;
  margin: 0.65rem -0.3rem 0.35rem;
  padding: 0.45rem 0.35rem;
  border: 1px solid rgba(235,228,218,0.9);
  border-radius: 8px;
  background: rgba(251,246,238,0.94);
  backdrop-filter: blur(10px);
}
body.layout-theater .dg-note-btn {
  border: 2px solid rgba(107,90,138,0.38);
  background: rgba(107,90,138,0.08);
  color: var(--accent-concept, #6b5a8a);
  font-weight: 800;
}
body.layout-theater .dg-note-btn:hover,
body.layout-theater .dg-note-btn.has-note {
  background: rgba(107,90,138,0.15);
  border-color: var(--accent-concept, #6b5a8a);
}
body.layout-theater .dg-note-editor.open {
  display: block;
  position: sticky;
  top: 3.25rem;
  z-index: 11;
  margin: 0.85rem 0 1rem;
  padding: 0.95rem;
  border: 2px solid rgba(107,90,138,0.24);
  box-shadow: 0 16px 38px rgba(40,31,21,0.10);
  background: rgba(251,246,238,0.98);
}
body.layout-theater .dg-note-editor textarea {
  min-height: 150px;
  font-size: 1rem;
  line-height: 1.55;
}
body.layout-theater .dg-note-editor-row {
  flex-wrap: wrap;
}
body.layout-theater .dg-transcript-panel {
  display: block;
  position: static;
  max-height: 16vh;
  overflow: auto;
  border-top: 1px solid var(--warm-pale, #ebe4da);
  border-left: none;
  border-right: none;
  border-radius: 0;
  box-shadow: none;
}
@media (min-width: 1280px) {
  body.layout-theater .main-layout {
    grid-template-columns: minmax(420px, 38vw) minmax(0, 1fr);
  }
  body.layout-theater .content-inner {
    max-width: 1080px;
  }
}
@media (max-width: 980px) {
  body.layout-theater {
    overflow: auto;
  }
  body.layout-theater .site-header {
    position: relative;
    top: auto;
  }
  body.layout-theater .main-layout {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 0;
    overflow: visible;
  }
  body.layout-theater .video-panel {
    position: sticky;
    top: 0;
    height: auto;
    max-height: none;
    border-right: none;
    border-bottom: 2px solid var(--warm-pale, #ebe4da);
  }
  body.layout-theater .video-wrapper {
    height: clamp(210px, 54vw, 360px);
    max-height: none;
  }
  body.layout-theater .video-footer {
    display: block;
    max-height: 42vh;
    overflow: auto;
  }
  body.layout-theater .section-nav {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.45rem 0.65rem;
  }
  body.layout-theater .section-nav .nav-pill {
    width: auto;
    min-width: 170px;
    white-space: nowrap;
  }
  body.layout-theater .content-panel {
    height: auto;
    overflow: visible;
  }
  body.layout-theater .content-inner {
    max-width: 100%;
    padding: 1rem 1rem 4rem;
  }
  body.layout-theater .dg-block-actions {
    position: static;
  }
  body.layout-theater .dg-note-editor.open {
    position: static;
  }
}

/* Top Bar Transcript + Theater Refinement v20260511-TOPTHEATER2
   Top Bar: video left, transcript follows along in the right space.
   Theater: tighter study rail so content gets more room and notes stay usable. */
:root { --dg-header-h: 82px; }
body.layout-top .video-panel {
  display: grid;
  grid-template-columns: minmax(360px, 52vw) minmax(320px, 1fr);
  align-items: stretch;
  min-height: clamp(300px, 36vh, 430px);
  max-height: min(48vh, 460px);
}
body.layout-top .video-wrapper {
  flex: none;
  width: 100%;
  height: 100%;
  min-height: clamp(300px, 36vh, 430px);
}
body.layout-top .video-footer {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--warm-pale, #ebe4da);
  background: rgba(251,246,238,0.98);
}
body.layout-top .now-playing {
  order: 1;
  padding: 0.65rem 0.9rem 0.55rem;
  border-bottom: 1px solid var(--warm-pale, #ebe4da);
  background: var(--paper-card, #fbf6ee);
  font-weight: 700;
}
body.layout-top .dg-transcript-panel {
  order: 2;
  display: block;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0.85rem 1rem 1rem;
  border-top: none;
  border-bottom: 1px solid var(--warm-pale, #ebe4da);
  background: var(--paper, #f6f1ea);
}
body.layout-top .dg-transcript-panel::before {
  content: 'Follow Along';
  display: block;
  color: var(--secondary, #8b7355);
  font-family: var(--sans, system-ui, sans-serif);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 0.45rem;
}
body.layout-top .dg-transcript-header {
  position: sticky;
  top: -0.85rem;
  z-index: 2;
  margin: -0.2rem -0.1rem 0.65rem;
  padding: 0.35rem 0 0.45rem;
  background: linear-gradient(var(--paper, #f6f1ea) 78%, rgba(246,241,234,0));
}
body.layout-top .dg-transcript-title {
  white-space: normal;
  line-height: 1.25;
}
body.layout-top .dg-transcript-body {
  font-size: 0.94rem;
  line-height: 1.62;
}
body.layout-top .dg-layout-bar {
  order: 3;
  width: 100%;
  flex-shrink: 0;
  padding: 0.45rem 0.65rem;
  border-top: none;
  border-bottom: 1px solid var(--warm-pale, #ebe4da);
  flex-wrap: wrap;
}
body.layout-top .section-nav {
  order: 4;
  flex: 0 0 auto;
  max-height: 3.2rem;
  padding: 0.35rem 0.65rem;
  background: var(--paper-soft, #efe9df);
}
body.layout-top .progress-container {
  display: none;
}

/* Theater refinements over THEATER1 */
body.layout-theater .main-layout {
  grid-template-columns: minmax(330px, 34vw) minmax(0, 1fr);
  height: calc(100vh - var(--dg-header-h, 82px));
  min-height: 520px;
}
body.layout-theater .video-panel {
  top: var(--dg-header-h, 82px);
  height: calc(100vh - var(--dg-header-h, 82px));
  max-height: calc(100vh - var(--dg-header-h, 82px));
}
body.layout-theater .video-wrapper {
  height: clamp(190px, 20vw, 340px);
  max-height: 40vh;
}
body.layout-theater .content-panel {
  height: calc(100vh - var(--dg-header-h, 82px));
}
body.layout-theater .content-inner {
  max-width: 1120px;
  padding-top: 1rem;
}
body.layout-theater .dg-transcript-panel {
  display: block;
  flex: 0 1 auto;
  max-height: 22vh;
  border-top: 1px solid var(--warm-pale, #ebe4da);
  background: var(--paper, #f6f1ea);
}
body.layout-theater .dg-transcript-panel::before {
  content: 'Current Section';
  display: block;
  color: var(--secondary, #8b7355);
  font-family: var(--sans, system-ui, sans-serif);
  font-size: 0.56rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}
body.layout-theater .section-nav {
  padding-bottom: 0.65rem;
}
body.layout-theater .dg-note-editor.open {
  top: 3.05rem;
}
@media (max-width: 1080px) {
  body.layout-top .video-panel {
    grid-template-columns: minmax(320px, 50vw) minmax(300px, 1fr);
  }
  body.layout-theater .main-layout {
    grid-template-columns: minmax(310px, 38vw) minmax(0, 1fr);
  }
}
@media (max-width: 820px) {
  body.layout-top .video-panel {
    display: flex;
    flex-direction: column;
    max-height: none;
  }
  body.layout-top .video-wrapper {
    height: clamp(210px, 54vw, 360px);
    min-height: 210px;
  }
  body.layout-top .video-footer {
    min-height: 260px;
  }
  body.layout-top .dg-transcript-panel {
    min-height: 180px;
    max-height: 34vh;
  }
  body.layout-theater .video-panel {
    top: 0;
  }
}



/* Admin Security + Traffic v20260512-SECADMIN1 */
.dg-admin-security-panel,
.dg-admin-traffic-panel,
.dg-admin-audit-panel { grid-column: 1 / -1; }
.dg-security-counters { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 0.65rem; margin-bottom: 0.9rem; }
.dg-signal-list { display: grid; gap: 0.55rem; }
.dg-signal { border: 1px solid var(--warm-pale); border-left: 5px solid var(--warm); border-radius: 8px; padding: 0.7rem 0.85rem; background: var(--paper-card); display:flex; flex-direction:column; gap:0.2rem; }
.dg-signal strong { font-family: var(--sans); font-size: 0.85rem; }
.dg-signal span { color: var(--gray); font-size: 0.82rem; }
.dg-signal-high { border-left-color: #9f3d35; background: rgba(159,61,53,0.06); }
.dg-signal-medium { border-left-color: #b08d52; background: rgba(176,141,82,0.08); }
.dg-signal-ok { border-left-color: #4f7a5d; background: rgba(79,122,93,0.08); }
.dg-traffic-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; }
.dg-traffic-grid h3 { font-family: var(--sans); font-size: 0.78rem; letter-spacing:0.08em; text-transform:uppercase; color:var(--gray); margin:0 0 0.45rem; }
.dg-traffic-list { display:grid; gap:0.35rem; }
.dg-traffic-list > div { display:flex; justify-content:space-between; gap:0.75rem; align-items:center; padding:0.45rem 0.55rem; border:1px solid var(--warm-pale); border-radius:6px; background:rgba(251,246,238,0.7); font-family:var(--sans); font-size:0.78rem; }
.dg-traffic-list span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.dg-audit-list { display:grid; gap:0.4rem; max-height:360px; overflow:auto; padding-right:0.25rem; }
.dg-audit-row { display:flex; justify-content:space-between; gap:1rem; align-items:flex-start; padding:0.55rem 0.7rem; border:1px solid var(--warm-pale); border-radius:7px; background:var(--paper-card); }
.dg-audit-row div { display:flex; flex-direction:column; gap:0.15rem; min-width:0; }
.dg-audit-row strong { font-family:var(--sans); font-size:0.82rem; }
.dg-audit-row span, .dg-audit-row small { color:var(--gray); font-size:0.74rem; }

/* Mobile Video Control Fix v20260514-MOBILEVIDEO1
   On phones/tablets, every viewing mode becomes video-first and scroll-safe.
   This prevents desktop fixed-height grids from hiding the YouTube iframe or
   making controls hard to tap. */
@media (max-width: 820px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  body.layout-split .main-layout,
  body.layout-flip .main-layout,
  body.layout-focus .main-layout,
  body.layout-top .main-layout,
  body.layout-theater .main-layout {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    grid-template-columns: none !important;
  }

  body.layout-split .video-panel,
  body.layout-flip .video-panel,
  body.layout-focus .video-panel,
  body.layout-top .video-panel,
  body.layout-theater .video-panel {
    order: 0 !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 350 !important;
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    height: auto !important;
    max-height: 78dvh !important;
    min-height: 0 !important;
    overflow: auto !important;
    overscroll-behavior: contain !important;
    border-left: 0 !important;
    border-right: 0 !important;
    border-bottom: 2px solid var(--warm-pale, #ebe4da) !important;
    background: var(--paper-card, #fbf6ee) !important;
    box-shadow: 0 8px 22px rgba(30, 22, 12, 0.16) !important;
    -webkit-overflow-scrolling: touch;
  }

  body.layout-split .video-wrapper,
  body.layout-flip .video-wrapper,
  body.layout-focus .video-wrapper,
  body.layout-top .video-wrapper,
  body.layout-theater .video-wrapper,
  body.layout-focus .video-panel .video-wrapper {
    order: 0 !important;
    flex: 0 0 auto !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    aspect-ratio: 16 / 9 !important;
    padding-top: 0 !important;
    position: relative !important;
    background: #000 !important;
    touch-action: manipulation !important;
  }

  body.layout-split .video-wrapper iframe,
  body.layout-flip .video-wrapper iframe,
  body.layout-focus .video-wrapper iframe,
  body.layout-top .video-wrapper iframe,
  body.layout-theater .video-wrapper iframe {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    border: 0 !important;
    pointer-events: auto !important;
    touch-action: manipulation !important;
  }

  body.layout-split .video-footer,
  body.layout-flip .video-footer,
  body.layout-focus .video-footer,
  body.layout-top .video-footer,
  body.layout-theater .video-footer {
    order: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: 34dvh !important;
    overflow: auto !important;
    padding: 0 !important;
    background: var(--paper-soft, #efe9df) !important;
    border-left: 0 !important;
    -webkit-overflow-scrolling: touch;
  }

  body.layout-split .now-playing,
  body.layout-flip .now-playing,
  body.layout-focus .now-playing,
  body.layout-top .now-playing,
  body.layout-theater .now-playing {
    order: 0 !important;
    flex: 0 0 auto !important;
    padding: 0.45rem 0.7rem !important;
    font-size: 0.76rem !important;
    line-height: 1.25 !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    border-bottom: 1px solid var(--warm-pale, #ebe4da) !important;
  }

  body.layout-split .dg-layout-bar,
  body.layout-flip .dg-layout-bar,
  body.layout-focus .dg-layout-bar,
  body.layout-top .dg-layout-bar,
  body.layout-theater .dg-layout-bar {
    order: 1 !important;
    flex: 0 0 auto !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 0.35rem !important;
    width: 100% !important;
    max-height: none !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    padding: 0.45rem 0.65rem !important;
    border-left: 0 !important;
    border-top: 0 !important;
    border-bottom: 1px solid var(--warm-pale, #ebe4da) !important;
    scrollbar-width: thin;
  }

  .dg-layout-bar-label {
    flex: 0 0 auto !important;
    width: auto !important;
    margin: 0 0.15rem 0 0 !important;
    align-self: center !important;
  }

  .dg-layout-btn {
    flex: 0 0 auto !important;
    min-height: 34px !important;
    padding: 0.42rem 0.58rem !important;
    font-size: 0.58rem !important;
    touch-action: manipulation !important;
  }

  body.layout-split .section-nav,
  body.layout-flip .section-nav,
  body.layout-focus .section-nav,
  body.layout-top .section-nav,
  body.layout-theater .section-nav {
    order: 3 !important;
    flex: 0 0 auto !important;
    display: flex !important;
    flex-direction: row !important;
    gap: 0.35rem !important;
    width: 100% !important;
    max-height: 3.4rem !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    padding: 0.42rem 0.65rem !important;
    border-left: 0 !important;
    -webkit-overflow-scrolling: touch;
  }

  body.layout-split .section-nav .nav-pill,
  body.layout-flip .section-nav .nav-pill,
  body.layout-focus .section-nav .nav-pill,
  body.layout-top .section-nav .nav-pill,
  body.layout-theater .section-nav .nav-pill {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 135px !important;
    max-width: 210px !important;
    min-height: 34px !important;
    padding: 0.32rem 0.55rem !important;
    white-space: nowrap !important;
    touch-action: manipulation !important;
  }

  body.layout-top .dg-transcript-panel,
  body.layout-theater .dg-transcript-panel {
    order: 2 !important;
    display: block !important;
    flex: 0 0 auto !important;
    min-height: 5.5rem !important;
    max-height: 22dvh !important;
    overflow-y: auto !important;
    padding: 0.6rem 0.75rem !important;
    border-top: 0 !important;
    border-bottom: 1px solid var(--warm-pale, #ebe4da) !important;
    background: var(--paper, #f6f1ea) !important;
    -webkit-overflow-scrolling: touch;
  }

  body.layout-split .content-panel,
  body.layout-flip .content-panel,
  body.layout-focus .content-panel,
  body.layout-top .content-panel,
  body.layout-theater .content-panel {
    order: 1 !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    padding: 0 !important;
  }

  body.layout-split .content-inner,
  body.layout-flip .content-inner,
  body.layout-focus .content-inner,
  body.layout-top .content-inner,
  body.layout-theater .content-inner {
    max-width: 100% !important;
    width: 100% !important;
    padding: 0.9rem 0.85rem 4.5rem !important;
    box-sizing: border-box !important;
  }

  .section-card {
    scroll-margin-top: calc(56.25vw + 145px) !important;
  }

  .dg-note-editor.open {
    position: static !important;
  }

  .dg-note-editor textarea {
    min-height: 120px !important;
    font-size: 16px !important; /* prevents iOS zoom while typing notes */
  }
}

@media (max-width: 420px) {
  body.layout-split .video-panel,
  body.layout-flip .video-panel,
  body.layout-focus .video-panel,
  body.layout-top .video-panel,
  body.layout-theater .video-panel {
    max-height: 72dvh !important;
  }

  body.layout-split .video-footer,
  body.layout-flip .video-footer,
  body.layout-focus .video-footer,
  body.layout-top .video-footer,
  body.layout-theater .video-footer {
    max-height: 30dvh !important;
  }

  body.layout-top .dg-transcript-panel,
  body.layout-theater .dg-transcript-panel {
    min-height: 4.5rem !important;
    max-height: 18dvh !important;
  }

  .site-header {
    gap: 0.55rem !important;
  }
}

/* Mobile Video Control Fix v20260514-MOBILEVIDEO2
   Fixes top/theater transcript overlap on phones by preventing the video footer
   from inheriting desktop flex: 1 1 0 collapse behavior. */
@media (max-width: 820px) {
  body.layout-split .video-footer,
  body.layout-flip .video-footer,
  body.layout-focus .video-footer,
  body.layout-top .video-footer,
  body.layout-theater .video-footer {
    flex: 0 0 auto !important;
    box-sizing: border-box !important;
    contain: layout paint !important;
  }

  body.layout-top .video-footer,
  body.layout-theater .video-footer {
    max-height: none !important;
    overflow: visible !important;
  }

  body.layout-top .dg-transcript-panel,
  body.layout-theater .dg-transcript-panel {
    position: static !important;
    flex: 0 0 auto !important;
    box-sizing: border-box !important;
  }

  body.layout-top .video-panel,
  body.layout-theater .video-panel {
    max-height: none !important;
    overflow: visible !important;
  }

  body.layout-top .content-panel,
  body.layout-theater .content-panel {
    clear: both !important;
  }
}

@media (max-width: 420px) {
  body.layout-top .video-panel,
  body.layout-theater .video-panel {
    max-height: none !important;
  }
}

/* Analytics/Admin v3 */
.dg-admin-shell-v3 { max-width: 1380px; }
.dg-admin-tabs {
  display:flex; gap:0.45rem; flex-wrap:wrap; margin: 1rem 0 1.1rem;
  border-bottom:1px solid var(--warm-pale); padding-bottom:0.65rem;
}
.dg-admin-tab {
  border:1px solid var(--warm-pale); background:rgba(251,246,238,0.78); color:var(--ink);
  border-radius:999px; padding:0.55rem 0.85rem; font-family:var(--sans); font-weight:600;
  cursor:pointer; transition: all .15s ease;
}
.dg-admin-tab:hover { border-color:var(--secondary); transform:translateY(-1px); }
.dg-admin-tab.is-active { background:var(--primary); color:#fff; border-color:var(--primary); }
.dg-admin-analytics-panel, .dg-ipban-panel, .dg-admin-intel-panel { grid-column: 1 / -1; }
.dg-analytics-grid { margin-top: 0.9rem; }
.dg-analytics-bars {
  display:flex; align-items:end; gap:4px; height:96px; padding:10px; margin:1rem 0;
  border:1px solid var(--warm-pale); border-radius:12px; background:rgba(251,246,238,0.65);
}
.dg-mini-bar { flex:1; height:100%; display:flex; align-items:end; min-width:4px; }
.dg-mini-bar span { display:block; width:100%; border-radius:5px 5px 0 0; background:linear-gradient(180deg,var(--secondary),var(--primary)); opacity:.82; }
.dg-google-btn {
  display:flex; align-items:center; justify-content:center; gap:.55rem; text-decoration:none;
  border:1px solid var(--warm-pale); border-radius:10px; padding:.68rem .85rem;
  background:#fff; color:var(--ink); font-family:var(--sans); font-weight:700; margin-top:.65rem;
}
.dg-google-btn span { width:1.35rem; height:1.35rem; border-radius:50%; display:inline-grid; place-items:center; color:#fff; background:#4285f4; font-weight:800; }
.dg-google-note { margin-top:.55rem; font-size:.78rem; opacity:.76; }
.dg-ipban-form { grid-template-columns: minmax(160px, 1fr) minmax(200px, 2fr) auto; align-items:end; }
.dg-subhead { margin-top:1rem; padding-top:1rem; border-top:1px dashed var(--warm-pale); }
@media (max-width: 760px) { .dg-ipban-form { grid-template-columns:1fr; } .dg-admin-tabs { overflow-x:auto; flex-wrap:nowrap; padding-bottom:.8rem; } .dg-admin-tab { white-space:nowrap; } }

/* Analytics / content management additions v20260525-SQL1 */
.dg-trend-grid h3 { margin: 0 0 .65rem; color: #f6e4bf; font-size: 1rem; }
.dg-blog-form textarea { min-height: 180px; resize: vertical; }
.dg-math-inline { color: #f6e4bf; background: rgba(246,228,191,.08); border-radius: .35rem; padding: .05rem .25rem; }
.dg-math-block { display:block; margin:.75rem 0; padding:.75rem 1rem; overflow-x:auto; border:1px solid rgba(212,170,92,.28); background:rgba(25,18,10,.42); border-radius:.75rem; }
.dg-mention { color:#8bd3ff; font-weight:700; background:rgba(139,211,255,.1); padding:.05rem .25rem; border-radius:.35rem; }
.dg-check { display:flex; align-items:center; gap:.5rem; color:#e9d9b8; margin:.5rem 0; }

/* Visible global search, notifications, news v20260525-SQL2 */
.dg-global-tools{display:flex;align-items:center;gap:.55rem;position:relative;margin-left:auto;z-index:50;max-width:min(720px,100%)}
.dg-global-search{display:flex;align-items:center;gap:.35rem;min-width:min(480px,45vw)}
.dg-global-search input{width:100%;border:1px solid rgba(212,170,92,.35);border-radius:999px;background:rgba(16,12,8,.72);color:#f8ead0;padding:.55rem .85rem;font:inherit;outline:none}
.dg-global-search button,.dg-notify-bell{border:1px solid rgba(212,170,92,.42);border-radius:999px;background:rgba(93,55,20,.55);color:#f8ead0;padding:.52rem .8rem;cursor:pointer;font:inherit;white-space:nowrap}
.dg-notify-bell{position:relative;min-width:2.4rem}.dg-notify-bell span:not(:empty){position:absolute;right:-.25rem;top:-.35rem;background:#d94b4b;color:white;border-radius:999px;font-size:.7rem;line-height:1;padding:.18rem .34rem}
.dg-global-search-results,.dg-notify-panel{position:absolute;right:0;top:calc(100% + .55rem);width:min(680px,92vw);max-height:70vh;overflow:auto;background:rgba(29,20,12,.98);border:1px solid rgba(212,170,92,.35);box-shadow:0 18px 50px rgba(0,0,0,.45);border-radius:1rem;padding:.75rem;color:#f8ead0;z-index:1000}
.dg-search-head{display:flex;justify-content:space-between;align-items:center;gap:1rem;margin-bottom:.5rem}.dg-search-head button{border:0;background:rgba(255,255,255,.08);color:#f8ead0;border-radius:.5rem;padding:.25rem .5rem;cursor:pointer}
.dg-search-result,.dg-notify-item{display:block;text-decoration:none;color:#f8ead0;border:1px solid rgba(255,255,255,.08);background:rgba(255,255,255,.035);border-radius:.75rem;padding:.7rem .8rem;margin:.45rem 0}.dg-search-result:hover,.dg-notify-item:hover{border-color:rgba(212,170,92,.5);background:rgba(212,170,92,.08)}
.dg-search-result span,.dg-search-result small,.dg-notify-item small,.dg-notify-item span{display:block;color:#d8c49e}.dg-search-result strong,.dg-notify-item strong{display:block;color:#ffe5ad;margin:.15rem 0}.dg-notify-item.unread{border-left:4px solid #8bd3ff}.dg-search-loading{padding:.8rem;color:#d8c49e}
.dg-news-shell{max-width:980px;margin:2rem auto;padding:0 1rem}.dg-news-card{border:1px solid rgba(212,170,92,.28);background:rgba(49,34,20,.62);border-radius:1rem;padding:1rem 1.15rem;margin:1rem 0;box-shadow:0 12px 30px rgba(0,0,0,.18)}.dg-news-card h2{margin:.1rem 0 .4rem;color:#ffe5ad}.dg-news-card time{color:#d8c49e;font-size:.9rem}.dg-news-card p{color:#f3dfbc;line-height:1.6}
@media(max-width:760px){.dg-global-tools{width:100%;margin:.75rem 0 0;flex-wrap:wrap}.dg-global-search{min-width:0;width:calc(100% - 3rem)}.dg-global-search-results,.dg-notify-panel{left:0;right:auto;width:92vw}}

/* Modern Warm Refresh + Dark Mode v20260525-MODERN1
   Additive-only skin: keeps Dimensionology paper identity, improves polish, adds persistent dark mode. */
:root {
  color-scheme: light;
  --dg-radius-xs: 8px;
  --dg-radius-sm: 12px;
  --dg-radius-md: 18px;
  --dg-radius-lg: 26px;
  --dg-shadow-soft: 0 14px 40px rgba(58, 42, 25, 0.10);
  --dg-shadow-card: 0 18px 55px rgba(58, 42, 25, 0.13);
  --dg-glass: rgba(255, 251, 244, 0.74);
  --dg-border: rgba(168, 146, 121, 0.30);
  --dg-border-strong: rgba(139, 115, 85, 0.42);
  --dg-accent: #9b6b36;
  --dg-accent-2: #345e6e;
  --dg-page-gradient:
    radial-gradient(circle at 8% 0%, rgba(214, 170, 92, 0.14), transparent 34rem),
    radial-gradient(circle at 96% 12%, rgba(52, 94, 110, 0.10), transparent 30rem),
    linear-gradient(135deg, #f7f0e6 0%, #efe3d2 100%);
}

html[data-theme="dark"], body.dg-theme-dark {
  color-scheme: dark;
  --paper: #15110d;
  --paper-soft: #1d1711;
  --paper-card: #241b13;
  --ink: #f6ead8;
  --gray: #c8bba8;
  --gray-light: #9f927f;
  --warm-pale: rgba(231, 198, 145, 0.16);
  --warm-light: rgba(231, 198, 145, 0.25);
  --warm: #c59d61;
  --primary: #d7a65a;
  --secondary: #e2bd7d;
  --dg-glass: rgba(29, 23, 17, 0.78);
  --dg-border: rgba(231, 198, 145, 0.18);
  --dg-border-strong: rgba(231, 198, 145, 0.34);
  --dg-shadow-soft: 0 18px 55px rgba(0, 0, 0, 0.34);
  --dg-shadow-card: 0 24px 70px rgba(0, 0, 0, 0.44);
  --dg-page-gradient:
    radial-gradient(circle at 8% 0%, rgba(214, 166, 90, 0.18), transparent 34rem),
    radial-gradient(circle at 96% 12%, rgba(91, 166, 190, 0.13), transparent 30rem),
    linear-gradient(135deg, #110d09 0%, #1d1711 58%, #251b12 100%);
}

body {
  background: var(--dg-page-gradient) !important;
  color: var(--ink, #1a1714) !important;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

.site-header,
.header,
nav.site-header {
  background: var(--dg-glass) !important;
  border: 1px solid var(--dg-border) !important;
  border-radius: var(--dg-radius-lg) !important;
  box-shadow: var(--dg-shadow-soft) !important;
  backdrop-filter: blur(18px) saturate(1.12);
  -webkit-backdrop-filter: blur(18px) saturate(1.12);
}

.site-header a,
.site-header .brand,
.site-header .nav a {
  color: var(--ink, #1a1714) !important;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}

.site-header .nav a:hover,
.site-header a:hover {
  color: var(--dg-accent, #9b6b36) !important;
}

.section-card,
.content-card,
.dg-card,
.dg-admin-card,
.dg-news-card,
.modal-card,
.auth-card,
.sim-inline,
.episode-nav,
.dg-block-discussion,
.dg-note-editor,
.dg-comment,
.dg-question-card,
.dg-answer-card {
  background: color-mix(in srgb, var(--paper-card, #fbf6ee) 88%, transparent) !important;
  border: 1px solid var(--dg-border) !important;
  border-radius: var(--dg-radius-md) !important;
  box-shadow: var(--dg-shadow-card) !important;
}

.section-card {
  padding: clamp(1.05rem, 1.8vw, 1.65rem) !important;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.section-card:hover {
  transform: translateY(-2px);
  border-color: var(--dg-border-strong) !important;
}

.section-card h2,
.section-card h3,
.content-inner h1,
.content-inner h2,
.dg-news-card h2 {
  color: var(--ink, #1a1714) !important;
  letter-spacing: -0.025em;
}

.section-card p,
.section-card li,
.content-inner p,
.content-inner li,
.dg-news-card p {
  color: color-mix(in srgb, var(--ink, #1a1714) 82%, var(--gray, #6b6560)) !important;
  line-height: 1.72;
}

button,
.signin-btn,
.dg-pill,
.dg-link-btn,
.dg-primary,
.dg-secondary,
.dg-danger,
.dg-admin-tab,
.layout-btn,
.video-btn,
.dg-action,
.dg-global-search button,
.dg-notify-bell,
.dg-theme-toggle {
  border-radius: 999px !important;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease, background .16s ease, color .16s ease !important;
}
button:hover,
.signin-btn:hover,
.dg-pill:hover,
.dg-link-btn:hover,
.dg-primary:hover,
.dg-secondary:hover,
.dg-admin-tab:hover,
.layout-btn:hover,
.video-btn:hover,
.dg-action:hover,
.dg-global-search button:hover,
.dg-notify-bell:hover,
.dg-theme-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(58,42,25,.12);
}

.dg-theme-toggle {
  border: 1px solid var(--dg-border-strong) !important;
  background: color-mix(in srgb, var(--paper-card, #fbf6ee) 82%, transparent) !important;
  color: var(--ink, #1a1714) !important;
  padding: .52rem .78rem !important;
  cursor: pointer;
  font: inherit;
  white-space: nowrap;
}

input,
textarea,
select,
.dg-global-search input {
  background: color-mix(in srgb, var(--paper-card, #fbf6ee) 88%, transparent) !important;
  color: var(--ink, #1a1714) !important;
  border: 1px solid var(--dg-border-strong) !important;
  border-radius: var(--dg-radius-sm) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}
input:focus,
textarea:focus,
select:focus,
.dg-global-search input:focus {
  outline: 2px solid color-mix(in srgb, var(--secondary, #8b7355) 32%, transparent) !important;
  outline-offset: 2px;
  border-color: var(--secondary, #8b7355) !important;
}

.dg-global-search-results,
.dg-notify-panel {
  background: color-mix(in srgb, var(--paper-card, #fbf6ee) 96%, #000 4%) !important;
  color: var(--ink, #1a1714) !important;
  border: 1px solid var(--dg-border-strong) !important;
  box-shadow: 0 24px 70px rgba(0,0,0,.28) !important;
}
.dg-search-result,
.dg-notify-item {
  color: var(--ink, #1a1714) !important;
  background: color-mix(in srgb, var(--paper-soft, #efe9df) 70%, transparent) !important;
  border-color: var(--dg-border) !important;
}
.dg-search-result strong,
.dg-notify-item strong { color: var(--ink, #1a1714) !important; }
.dg-search-result span,
.dg-search-result small,
.dg-notify-item span,
.dg-notify-item small { color: var(--gray, #6b6560) !important; }

.video-panel,
.video-shell,
.player-shell,
.youtube-wrap,
iframe[src*="youtube"] {
  border-radius: var(--dg-radius-md) !important;
  overflow: hidden;
  box-shadow: var(--dg-shadow-card);
}

mjx-container,
.math-card,
.equation-card,
.dg-math-block,
.formula-card {
  color: var(--ink, #1a1714) !important;
  background: color-mix(in srgb, var(--paper-soft, #efe9df) 80%, transparent) !important;
  border: 1px solid var(--dg-border) !important;
  border-radius: var(--dg-radius-sm) !important;
}

html[data-theme="dark"] .dg-google-btn,
body.dg-theme-dark .dg-google-btn { background: #1f1f1f !important; color: #f6ead8 !important; }
html[data-theme="dark"] img,
body.dg-theme-dark img { filter: saturate(.95) contrast(1.02); }

@media (max-width: 760px) {
  .site-header { border-radius: 0 0 var(--dg-radius-md) var(--dg-radius-md) !important; }
  .section-card { border-radius: var(--dg-radius-sm) !important; }
  .dg-theme-toggle { padding: .5rem .68rem !important; }
}

/* Modern Refresh Corrections v20260525-MODERN2
   Fixes MODERN1 overlap, keeps light mode as the default, and increases readable type size. */
:root {
  --dg-readable-size: clamp(17px, 1.05vw, 19px);
  --dg-readable-line: 1.78;
}

html { font-size: 17px; }
body { font-size: var(--dg-readable-size) !important; }

/* Keep the warm paper style as the default. Dark only applies after explicit toggle. */
html:not([data-theme="dark"]),
body.dg-theme-light {
  color-scheme: light;
}

/* Stop top-right controls from stacking over title/nav/account controls. */
.site-header {
  position: relative !important;
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: .85rem 1rem !important;
  padding: clamp(.8rem, 1.3vw, 1.2rem) clamp(1rem, 2vw, 1.6rem) !important;
  min-height: auto !important;
  overflow: visible !important;
}
.site-header .brand,
.site-header .title,
.site-header h1,
.site-header .episode-meta {
  flex: 1 1 260px !important;
  min-width: 220px !important;
}
.site-header .nav {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: .55rem !important;
  min-width: 0 !important;
}

.dg-global-tools {
  position: static !important;
  flex: 1 1 520px !important;
  width: auto !important;
  max-width: 760px !important;
  margin-left: auto !important;
  display: flex !important;
  flex-wrap: nowrap !important;
  justify-content: flex-end !important;
  align-items: center !important;
  gap: .45rem !important;
  z-index: 20 !important;
}
.dg-global-search {
  flex: 1 1 320px !important;
  min-width: 220px !important;
  max-width: 520px !important;
}
.dg-global-search input {
  min-height: 2.65rem !important;
  font-size: 1rem !important;
  padding: .68rem 1rem !important;
}
.dg-global-search button,
.dg-notify-bell,
.dg-theme-toggle,
.signin-btn,
.dg-user-chip {
  min-height: 2.55rem !important;
  font-size: .82rem !important;
  padding: .62rem .9rem !important;
}
.dg-theme-toggle {
  min-width: 5.6rem !important;
}
.dg-notify-bell {
  min-width: 2.7rem !important;
}

/* Larger, more comfortable reading typography. */
.content-inner,
.section-card,
.dg-news-shell,
.dg-admin-shell,
.dg-modal,
.modal-card {
  font-size: 1rem !important;
}
.content-inner p,
.content-inner li,
.section-card p,
.section-card li,
.dg-news-card p,
.dg-comment-body,
.dg-answer-body,
.dg-question-body {
  font-size: clamp(1.02rem, 1.12vw, 1.16rem) !important;
  line-height: var(--dg-readable-line) !important;
}
.section-card h2,
.content-inner h2 { font-size: clamp(1.55rem, 2vw, 2.15rem) !important; }
.section-card h3,
.content-inner h3 { font-size: clamp(1.25rem, 1.45vw, 1.55rem) !important; }
.content-inner h1 { font-size: clamp(2.15rem, 4vw, 4rem) !important; }

/* Keep formula blocks readable and unclipped. */
mjx-container,
.math-card,
.equation-card,
.dg-math-block,
.formula-card {
  font-size: 1.05em !important;
  line-height: 1.55 !important;
  overflow-x: auto !important;
  max-width: 100% !important;
}

/* Light theme search/menu panels should be light unless user toggles dark. */
html:not([data-theme="dark"]) .dg-global-search input,
body.dg-theme-light .dg-global-search input {
  background: rgba(255,251,244,.86) !important;
  color: #1a1714 !important;
}
html:not([data-theme="dark"]) .dg-global-search button,
html:not([data-theme="dark"]) .dg-notify-bell,
html:not([data-theme="dark"]) .dg-theme-toggle,
body.dg-theme-light .dg-global-search button,
body.dg-theme-light .dg-notify-bell,
body.dg-theme-light .dg-theme-toggle {
  background: rgba(251,246,238,.92) !important;
  color: #1a1714 !important;
  border-color: rgba(139,115,85,.38) !important;
}

@media (max-width: 1050px) {
  .dg-global-tools {
    flex: 1 1 100% !important;
    width: 100% !important;
    max-width: none !important;
    margin-left: 0 !important;
    justify-content: stretch !important;
  }
  .dg-global-search { max-width: none !important; }
}
@media (max-width: 760px) {
  html { font-size: 16.5px; }
  .site-header { border-radius: 0 0 18px 18px !important; }
  .dg-global-tools {
    display: grid !important;
    grid-template-columns: 1fr auto auto !important;
    gap: .45rem !important;
  }
  .dg-global-search { min-width: 0 !important; width: 100% !important; }
  .dg-global-search button { padding-left: .7rem !important; padding-right: .7rem !important; }
  .dg-theme-toggle { min-width: 4.7rem !important; padding-left: .65rem !important; padding-right: .65rem !important; }
}
@media (max-width: 520px) {
  .dg-global-tools { grid-template-columns: 1fr 1fr auto !important; }
  .dg-global-search { grid-column: 1 / -1 !important; }
  .dg-global-search input { font-size: 16px !important; }
}

/* Modern Corrections v20260525-MODERN3
   Search/tools are now a separate row, light is default, reading text is larger. */
:root { --dg-readable-size: clamp(18px, 1.12vw, 20px); }
html { font-size: 18px; }
body { font-size: var(--dg-readable-size) !important; }
html:not([data-theme="dark"]) body,
body.dg-theme-light { background: var(--dg-page-gradient) !important; }

/* Dedicated global-tools row: no overlap with title, nav, auth, or account chips. */
#dg-global-tools.dg-global-tools,
.dg-global-tools {
  position: relative !important;
  inset: auto !important;
  top: auto !important;
  right: auto !important;
  left: auto !important;
  bottom: auto !important;
  transform: none !important;
  width: min(1180px, calc(100vw - 2rem)) !important;
  max-width: 1180px !important;
  margin: .85rem auto 1.15rem !important;
  padding: .65rem !important;
  display: grid !important;
  grid-template-columns: minmax(260px, 1fr) auto auto !important;
  align-items: center !important;
  gap: .55rem !important;
  z-index: 30 !important;
  border: 1px solid var(--dg-border) !important;
  border-radius: 24px !important;
  background: rgba(255,251,244,.72) !important;
  box-shadow: 0 12px 34px rgba(58,42,25,.10) !important;
  backdrop-filter: blur(16px) saturate(1.08) !important;
  -webkit-backdrop-filter: blur(16px) saturate(1.08) !important;
}
html[data-theme="dark"] #dg-global-tools.dg-global-tools,
body.dg-theme-dark #dg-global-tools.dg-global-tools {
  background: rgba(29,23,17,.78) !important;
}
.dg-global-search {
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  gap: .45rem !important;
}
.dg-global-search input {
  width: 100% !important;
  min-height: 2.8rem !important;
  font-size: 1.04rem !important;
}
.dg-global-search button,
.dg-theme-toggle,
.dg-notify-bell {
  min-height: 2.8rem !important;
  font-size: .92rem !important;
  font-weight: 700 !important;
}
.site-header { margin-top: .8rem !important; }

/* Typography bump. */
.content-inner,
.section-card,
.dg-news-shell,
.dg-admin-shell { font-size: 1.06rem !important; }
.content-inner p,
.content-inner li,
.section-card p,
.section-card li,
.dg-comment-body,
.dg-answer-body,
.dg-question-body,
.dg-news-card p {
  font-size: clamp(1.08rem, 1.22vw, 1.22rem) !important;
  line-height: 1.82 !important;
}
.section-card h2, .content-inner h2 { font-size: clamp(1.75rem, 2.35vw, 2.45rem) !important; }
.section-card h3, .content-inner h3 { font-size: clamp(1.32rem, 1.6vw, 1.72rem) !important; }
.content-inner h1 { font-size: clamp(2.4rem, 4.4vw, 4.4rem) !important; }
.section-card { padding: clamp(1.25rem, 2vw, 1.95rem) !important; }

@media (max-width: 760px) {
  html { font-size: 17px; }
  #dg-global-tools.dg-global-tools,
  .dg-global-tools {
    width: calc(100vw - 1rem) !important;
    margin: .5rem auto .8rem !important;
    grid-template-columns: 1fr auto auto !important;
    border-radius: 18px !important;
    padding: .5rem !important;
  }
  .dg-global-search { grid-column: 1 / -1 !important; }
  .dg-global-search input { font-size: 16px !important; }
  .dg-global-search button,
  .dg-theme-toggle,
  .dg-notify-bell { min-height: 2.55rem !important; font-size: .84rem !important; }
}


/* Secret Search + Google-like wordmark v20260525-MATH1 */
#dg-global-tools.dg-global-tools,
.dg-global-tools {
  grid-template-columns: minmax(280px, 1fr) auto !important;
  align-items: end !important;
  padding: 1rem .85rem .85rem !important;
}
.dg-search-stage {
  display: grid;
  grid-template-rows: auto auto;
  justify-items: center;
  gap: .42rem;
  min-width: 0;
}

.dg-tool-buttons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .55rem;
  align-self: end;
  padding-bottom: .08rem;
}
.dg-secret-demo-card {
  padding: 1rem;
  border: 1px solid var(--dg-border-strong, rgba(139,115,85,.42));
  border-radius: 18px;
  background: color-mix(in srgb, var(--paper-card, #fbf6ee) 88%, transparent);
  box-shadow: var(--dg-shadow-soft, 0 14px 40px rgba(58,42,25,.10));
}
.dg-secret-demo-card h3 { margin: .2rem 0 .45rem; font-size: 1.35rem; color: var(--ink, #1a1714); }
.dg-secret-demo-card p { margin: 0 0 .85rem; color: color-mix(in srgb, var(--ink, #1a1714) 78%, var(--gray, #6b6560)); line-height: 1.55; }
.dg-secret-kicker { color: var(--secondary, #8b7355); font-family: var(--sans, system-ui, sans-serif); font-size: .76rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.dg-secret-actions { display:flex; flex-wrap:wrap; gap:.55rem; align-items:center; margin:.75rem 0; }
.dg-secret-frame-wrap { margin-top: .85rem; border-radius: 16px; overflow: hidden; border: 1px solid var(--dg-border-strong, rgba(139,115,85,.42)); background:#05070b; }
.dg-secret-frame-wrap iframe { display:block; width:100%; height:min(74vh, 720px); border:0; background:#05070b; }
html[data-theme="dark"] .dg-secret-demo-card, body.dg-theme-dark .dg-secret-demo-card { background: rgba(22,17,12,.88); }
@media (max-width: 760px) {
  #dg-global-tools.dg-global-tools,
  .dg-global-tools { grid-template-columns: 1fr !important; align-items: stretch !important; }
  .dg-tool-buttons { justify-content: center; padding-bottom: 0; }
  .dg-secret-frame-wrap iframe { height: 68vh; }
}

/* Math-aware search snippets v20260525-MATH1 */
.dg-search-result small.math-aware {
  font-size: 0.95rem;
  line-height: 1.55;
}
.dg-search-result small.math-aware mjx-container[jax="CHTML"] {
  font-size: 105% !important;
}
.dg-search-result small.math-aware mjx-container[display="true"] {
  display: block;
  margin: 0.45rem 0;
  overflow-x: auto;
  overflow-y: hidden;
}

/* Homepage search card crop + horizontal tools v20260525-CARDFIX1
   Fixes index body flex stretching #dg-global-tools into a giant empty 520px card. */
#dg-global-tools.dg-global-tools,
.dg-global-tools {
  flex: 0 0 auto !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  grid-template-columns: minmax(280px, 1fr) auto !important;
  grid-auto-rows: auto !important;
  align-items: center !important;
  align-content: center !important;
  padding: .72rem .8rem !important;
}
.dg-search-stage {
  width: 100% !important;
  align-self: center !important;
}
.dg-global-search {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: center !important;
}
.dg-tool-buttons {
  display: flex !important;
  flex-flow: row nowrap !important;
  align-items: center !important;
  justify-content: flex-end !important;
  align-self: center !important;
  padding-bottom: 0 !important;
  white-space: nowrap !important;
}
@media (max-width: 760px) {
  #dg-global-tools.dg-global-tools,
  .dg-global-tools {
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center !important;
  }
  .dg-tool-buttons { justify-content: flex-end !important; }
}

/* Episode header home link + top nav removal support v20260525-NAVFIX1 */
a.series-badge {
  text-decoration: none !important;
  color: inherit !important;
  cursor: pointer;
}
a.series-badge:hover,
a.series-badge:focus-visible {
  color: var(--secondary, #8b7355) !important;
  text-decoration: none !important;
}
html[data-theme="dark"] a.series-badge:hover,
body.dg-theme-dark a.series-badge:hover,
html[data-theme="dark"] a.series-badge:focus-visible,
body.dg-theme-dark a.series-badge:focus-visible {
  color: #f6d89c !important;
}

/* Episode navigation cleanup v20260525-NAVFIX2
   Static top/bottom episode nav blocks are removed from episode HTML.
   The single retained episode navigation is the generated footer nav (#episodeFooterNav). */

/* Secret menu demo list v20260525-SECRETMENU1 */
.dg-secret-menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: .85rem;
  margin-top: 1rem;
}
.dg-secret-menu-item {
  border: 1px solid var(--dg-border, rgba(168,146,121,.30));
  border-radius: 16px;
  padding: .95rem;
  background: color-mix(in srgb, var(--paper-card, #fbf6ee) 88%, transparent);
  box-shadow: var(--dg-shadow-soft, 0 14px 40px rgba(58,42,25,.10));
}
.dg-secret-menu-item h4 { margin: .25rem 0 .45rem; font-size: 1.05rem; }
.dg-secret-menu-item p { margin: 0 0 .75rem; line-height: 1.5; }
html[data-theme="dark"] .dg-secret-menu-item,
body.dg-theme-dark .dg-secret-menu-item { background: rgba(22,17,12,.88); }

/* Secret menu 600-cell refresh v20260525-SECRETMENU2 */
.dg-secret-menu-card h3::after {
  content: " · 600-cell lab pack added";
  color: var(--gray, #6b6560);
  font-size: .85rem;
  font-weight: 400;
}

/* Hide any legacy/static episode nav blocks; keep only #episodeFooterNav. v20260525-NAVDEDUP1 */
nav.ep-nav,
.ep-nav.top,
.ep-nav.bottom {
  display: none !important;
}

/* Defensive duplicate episode footer hiding v20260525-NAVDEDUP2 */
nav.episode-footer-nav:not(#episodeFooterNav),
.content-inner > nav.ep-nav,
#contentPanel nav.ep-nav {
  display: none !important;
}
