/* ============================================================
   PLAYBOOK -- app.css
   Shared styles across all pages
   ============================================================ */

/*  Google Fonts loaded via PHP layout  */

:root {
  --accent:       #534AB7;
  --accent-light: #EEEDFE;
  --accent-mid:   #7F77DD;
  --bg:           #f7f7f8;
  --surface:      #ffffff;
  --border:       #e8e8eb;
  --text:         #111118;
  --muted:        #6b6b78;
  --danger:       #dc2626;
  --danger-bg:    #fef2f2;
  --danger-border:#fecaca;
  --success:      #16a34a;
  --success-bg:   #f0fdf4;
  --success-border:#bbf7d0;
  --warning-bg:   #fef3c7;
  --warning-text: #92400e;
  --sidebar-w:    260px;
  --radius:       12px;
  --radius-sm:    8px;
}

/* ── Dark mode ──────────────────────────────────────────── */
[data-theme="dark"] {
  --bg:             #171717;
  --surface:        #212121;
  --border:         #333333;
  --text:           #ececec;
  --muted:          #999999;
  --accent-light:   #2d2545;
  --danger-bg:      #2c1518;
  --danger-border:  #5c2828;
  --success-bg:     #162016;
  --success-border: #1e5c2e;
  --warning-bg:     #2a2210;
  --warning-text:   #e8c46a;
}
[data-theme="dark"] .btn { background: var(--surface); border-color: var(--border); color: var(--text); }
[data-theme="dark"] .btn:hover { background: var(--border); }
[data-theme="dark"] .btn-primary,
[data-theme="dark"] .btn-primary:hover { color: #fff; }
[data-theme="dark"] .btn-danger { color: #f87171; border-color: var(--danger-border); }
[data-theme="dark"] .btn-danger:hover { background: var(--danger-bg); }
[data-theme="dark"] .btn-new { color: #fff; }
[data-theme="dark"] img { opacity: .92; }
[data-theme="dark"] img:hover { opacity: 1; }
[data-theme="dark"] .card-thumb-empty { background: var(--surface); color: var(--muted); }
[data-theme="dark"] .drop-zone { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .drop-zone:hover,
[data-theme="dark"] .drop-zone.dragover { border-color: var(--accent); background: var(--accent-light); }
[data-theme="dark"] select { background: var(--bg); color: var(--text); }
[data-theme="dark"] .admin-table th { background: var(--bg); }
[data-theme="dark"] .admin-table tr:hover td { background: var(--surface); }
[data-theme="dark"] .filter-chip { background: var(--accent-light); color: var(--accent-mid); }
[data-theme="dark"] .filter-chip:hover { background: var(--accent-light); }
[data-theme="dark"] .filter-chip-clear:hover { background: var(--danger-bg); color: #f87171; }
[data-theme="dark"] .stat-pill { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .modal-backdrop { background: rgba(0,0,0,.65); }
[data-theme="dark"] .hero { background: #111111; }
[data-theme="dark"] .prompt-text { background: var(--bg); border-color: var(--border); }
[data-theme="dark"] .prompt-text.modified { background: #241f35; border-color: #3d3660; }
[data-theme="dark"] .media-item-pdf { background: var(--danger-bg); }
[data-theme="dark"] .media-item-pdf:hover { background: #351a1e; }
[data-theme="dark"] .sidebar-label:hover { background: var(--bg); }
/* Play detail page -- brighten accent elements for dark readability */
[data-theme="dark"] .meta-link { color: var(--accent-mid); }
[data-theme="dark"] .source-url-banner { background: #262626; border: 1px solid var(--border); }
[data-theme="dark"] .source-url-banner a { color: var(--accent-mid); }
[data-theme="dark"] .step-num { background: #2d2545; color: var(--accent-mid); border: 1px solid #3d3660; }
[data-theme="dark"] .step-connector { background: var(--border); }
[data-theme="dark"] .filter-link.active { color: var(--accent-mid); }
[data-theme="dark"] .media-source-link { color: var(--accent-mid); }
[data-theme="dark"] .section-body a:not(.btn) { color: var(--accent-mid); }
[data-theme="dark"] .section-body a:not(.btn):hover { color: #b0a6f0; }
[data-theme="dark"] .page-body a:not(.btn):not(.topbar-logo) { color: var(--accent-mid); }
[data-theme="dark"] .sidebar-bottom .user-link { color: var(--muted); }
[data-theme="dark"] .sidebar-bottom .user-link.danger { color: #f87171; }
[data-theme="dark"] .upload-warning { background: var(--warning-bg); border-color: #5c4a20; }
[data-theme="dark"] .upload-warning-error { background: var(--danger-bg); border-color: var(--danger-border); }
/* Fix browser autofill white background in dark mode */
[data-theme="dark"] input:-webkit-autofill,
[data-theme="dark"] input:-webkit-autofill:hover,
[data-theme="dark"] input:-webkit-autofill:focus,
[data-theme="dark"] select:-webkit-autofill,
[data-theme="dark"] textarea:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px var(--bg) inset !important;
  -webkit-text-fill-color: var(--text) !important;
  border-color: var(--border) !important;
  transition: background-color 5000s ease-in-out 0s;
}
/* Dark scrollbar */
[data-theme="dark"] { scrollbar-color: #333333 #171717; }
[data-theme="dark"] ::-webkit-scrollbar { width: 10px; height: 10px; }
[data-theme="dark"] ::-webkit-scrollbar-track { background: var(--bg); }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #383838; border-radius: 5px; }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #4a4a4a; }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/*  Buttons  */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  text-decoration: none;
  transition: background .12s, color .12s, border-color .12s;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  white-space: nowrap;
}
.btn:hover { background: var(--bg); }
.btn svg   { flex-shrink: 0; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover { background: #4338ca; border-color: #4338ca; }

.btn-danger  { color: var(--danger); border-color: var(--danger-border); }
.btn-danger:hover  { background: var(--danger-bg); }

.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn-lg { height: 42px; padding: 0 20px; font-size: 14px; }

/*  Logo mark  */
.logo-mark {
  width: 32px; height: 32px;
  border-radius: 8px;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.logo-mark.sm { width: 28px; height: 28px; border-radius: 7px; }
.logo-mark svg { display: block; width: 100%; height: 100%; }

.logo-name {
  font-family: 'Syne', sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

/*  Topbar (simple -- play.php, admin pages)  */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 1rem;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 50;
  overflow: hidden;
}
.topbar-logo {
  display: flex; align-items: center; gap: 9px;
  text-decoration: none; flex-shrink: 0;
}
.topbar-sep   { color: var(--border); font-size: 20px; flex-shrink: 0; }
.topbar-title {
  font-size: 13px; font-weight: 500;
  color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 0; flex: 1;
}
.topbar-actions {
  margin-left: auto; display: flex; gap: 6px; align-items: center;
  flex-shrink: 0;
}
/* Hide text labels on small screens, keep icons */
@media (max-width: 500px) {
  .topbar-actions .btn span,
  .topbar-actions .btn:not([title="Go back"]) { font-size: 0; padding: 0 8px; }
  .topbar-actions .btn svg { display: block; }
  .topbar-sep { display: none; }
  .topbar-title { display: none; }
}

/*  Sidebar layout  */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow: hidden;
  z-index: 100;
}

/* Scrollable area -- everything above the user block */
.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
}
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
}
.sidebar-version {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 8px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s, color .15s;
  user-select: none;
}
.sidebar-version:hover {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent-mid);
}
.sidebar-section { padding: 1rem 1rem 0; }
/*  Accordion sidebar  */
.sidebar-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 6px .25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  border-radius: var(--radius-sm);
  transition: background .12s;
}
.sidebar-label:hover { background: var(--bg); }
.sidebar-label .acc-chevron {
  font-style: normal;
  font-size: 10px;
  transition: transform .2s;
  color: var(--muted);
}
.sidebar-section.collapsed .acc-chevron { transform: rotate(-90deg); }
.sidebar-section.collapsed .acc-body    { display: none; }
.acc-body { padding-top: 2px; }
.filter-link {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--muted);
  text-decoration: none;
  transition: background .12s, color .12s;
  cursor: pointer;
  border: none; background: none;
  width: 100%; text-align: left;
}
.filter-link:hover  { background: var(--bg); color: var(--text); }
.filter-link.active { background: var(--accent-light); color: var(--accent); font-weight: 500; }

.filter-dot {
  width: 8px; height: 8px;
  border-radius: 50%; flex-shrink: 0;
}
.cat-children   { padding-left: 16px; margin-top: 2px; }
.sidebar-divider { height: 1px; background: var(--border); margin: 1rem 0; }

.sidebar-bottom {
  margin-top: auto;
  padding: 1rem;
  border-top: 1px solid var(--border);
}
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius-sm); }
.user-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent-light); color: var(--accent);
  font-size: 12px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.user-name  { font-size: 13px; font-weight: 500; }
.user-links { display: flex; gap: 12px; margin-top: 4px; }
.user-link  { font-size: 12px; color: var(--muted); text-decoration: none; transition: color .12s; }
.user-link:hover        { color: var(--text); }
.user-link.danger:hover { color: var(--danger); }

.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-x: hidden;
}

/*  Search topbar (index.php)  */
.topbar-search {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: .75rem 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 50;
  overflow: hidden;
}
.search-wrap     { flex: 1; position: relative; min-width: 0; }
.search-icon     { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-wrap .search-input,
.search-input {
  width: 100%; height: 38px;
  padding: 0 12px 0 42px !important;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13.5px;
  font-family: 'DM Sans', sans-serif;
  background: var(--bg); color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
  background: var(--surface);
}
.sort-select {
  height: 38px; padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  background: var(--bg); color: var(--text);
  outline: none; cursor: pointer;
  flex-shrink: 0;
  max-width: 130px;
}
.btn-new {
  display: flex; align-items: center; gap: 7px;
  height: 38px; padding: 0 16px;
  background: var(--accent); color: #fff;
  border: none; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer; text-decoration: none;
  transition: background .15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-new:hover { background: #4338ca; }

/*  Stats bar  */
.stats-bar { display: flex; gap: 1px; background: var(--border); border-bottom: 1px solid var(--border); overflow: hidden; }
.stat-pill { flex: 1; background: var(--surface); padding: .6rem 1rem; display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.stat-n    { font-family: 'Syne', sans-serif; font-size: 20px; font-weight: 700; color: var(--text); flex-shrink: 0; }
.stat-label { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/*  Content area  */
.content { padding: 1.25rem; flex: 1; min-width: 0; overflow-x: hidden; }
.content-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; gap: 8px; flex-wrap: wrap; }
.content-title  { font-family: 'Syne', sans-serif; font-size: 16px; font-weight: 600; }
.content-count  { font-size: 13px; color: var(--muted); }

/*  View toggle button  */
.view-toggle { display: flex; gap: 4px; }
.view-btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
  text-decoration: none;
}
.view-btn:hover  { background: var(--bg); color: var(--text); }
.view-btn.active { background: var(--accent-light); color: var(--accent); border-color: var(--accent-mid); }

/*  Play card grid -- 3:4  */
.plays-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.play-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow .15s, transform .15s;
  text-decoration: none; color: inherit;
  display: flex; flex-direction: column;
}
.play-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,.07); transform: translateY(-2px); }

.card-thumb { aspect-ratio: 3/4; background: var(--bg); position: relative; overflow: hidden; }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-thumb-empty { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.card-thumb-empty svg { opacity: .2; }
.card-badge-workflow {
  position: absolute; top: 8px; right: 8px;
  background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 600; letter-spacing: .04em;
  padding: 3px 8px; border-radius: 20px;
}
.card-badge-fav {
  position: absolute; top: 8px; left: 8px;
  color: #f59e0b; font-size: 16px;
  text-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.card-badge-draft {
  position: absolute; bottom: 8px; right: 8px;
  background: #f59e0b; color: #fff;
  font-size: 10px; font-weight: 700; letter-spacing: .04em;
  padding: 3px 8px; border-radius: 20px;
}
.card-body { padding: 12px 14px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.card-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card-cat  { font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 20px; }
.card-source { font-size: 11px; color: var(--muted); }
.card-title {
  font-family: 'Syne', sans-serif;
  font-size: 14px; font-weight: 600; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-desc {
  font-size: 12px; color: var(--muted); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px; margin-top: auto;
  border-top: 1px solid var(--border); background: var(--bg);
}
.card-stars { color: #f59e0b; font-size: 11px; letter-spacing: 1px; }
.card-date  { font-size: 11px; color: var(--muted); }

/*  List view  */
.plays-list { display: flex; flex-direction: column; gap: 8px; }
.play-list-item-wrap {
  display: flex; align-items: center; gap: 10px;
}
.play-list-item-wrap.bulk-selected .play-list-item {
  outline: 2px solid var(--accent);
  background: var(--accent-light);
}
.play-list-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex; align-items: center; gap: 16px;
  text-decoration: none; color: inherit;
  padding: 12px 16px;
  transition: background .12s, box-shadow .12s;
  flex: 1; min-width: 0; overflow: hidden;
}
.play-list-item:hover { background: var(--bg); box-shadow: 0 2px 8px rgba(0,0,0,.05); }
.play-list-thumb {
  width: 52px; height: 52px;
  border-radius: var(--radius-sm); overflow: hidden;
  flex-shrink: 0; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
}
.play-list-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.play-list-body  { flex: 1; min-width: 0; }
.play-list-title {
  font-family: 'Syne', sans-serif;
  font-size: 14px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.play-list-meta { display: flex; align-items: center; gap: 8px; margin-top: 3px; flex-wrap: wrap; }
.play-list-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }

/*  Pagination  */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 4px; margin-top: 2rem; padding-bottom: 1rem; flex-wrap: wrap;
}
.page-btn {
  min-width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font-size: 13px; text-decoration: none;
  transition: background .12s, color .12s, border-color .12s;
  padding: 0 10px;
}
.page-btn:hover   { background: var(--bg); border-color: var(--accent-mid); color: var(--accent); }
.page-btn.active  { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
.page-btn.dots    { border-color: transparent; background: transparent; cursor: default; color: var(--muted); }
.page-info        { font-size: 12px; color: var(--muted); text-align: center; margin-top: .5rem; }

/*  Zoom lightbox  */
.lightbox {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.92);
  z-index: 1000; align-items: center; justify-content: center;
  cursor: zoom-out;
}
.lightbox.open { display: flex; }
.lightbox-inner {
  position: relative;
  max-width: 92vw; max-height: 92vh;
  display: flex; align-items: center; justify-content: center;
  cursor: default;
}
.lightbox-inner img,
.lightbox-inner video {
  max-width: 92vw; max-height: 88vh;
  object-fit: contain; border-radius: var(--radius-sm);
  display: block;
}
.lightbox-close {
  position: fixed; top: 16px; right: 20px;
  width: 38px; height: 38px;
  background: rgba(255,255,255,.15); border: none; border-radius: 50%;
  color: #fff; font-size: 22px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .15s; z-index: 1001;
}
.lightbox-close:hover { background: rgba(255,255,255,.3); }
.lightbox-caption {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  color: rgba(255,255,255,.7); font-size: 13px;
  text-align: center; max-width: 600px; padding: 0 1rem;
}
.zoomable { cursor: zoom-in !important; }

/*  Hero portrait layout on play.php (3:4 image + info side by side)  */
/* Hero compact thumbnail -- replaces old portrait layout */
.hero-compact {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-top: .75rem;
}
.hero-compact-thumb {
  position: relative;
  width: 90px;
  min-width: 90px;
  aspect-ratio: 3/4;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: zoom-in;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
  transition: box-shadow .15s;
}
.hero-compact-thumb:hover { box-shadow: 0 4px 16px rgba(0,0,0,.25); }
.hero-compact-thumb img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}
.hero-compact-zoom {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.35);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .15s;
}
.hero-compact-thumb:hover .hero-compact-zoom { opacity: 1; }

/* Keep old portrait classes for backwards compat -- hidden now */
.hero-portrait { display: none; }
.hero-portrait-img { display: none; }
.hero-portrait-info { display: none; }
.hero-portrait-badges  { display: flex; gap: 8px; flex-wrap: wrap; }
.hero-portrait-title   { font-family: 'Syne', sans-serif; font-size: 24px; font-weight: 700; line-height: 1.2; }
.hero-portrait-desc    { font-size: 14px; color: var(--muted); line-height: 1.65; }

@media (max-width: 680px) {
  .hero-portrait { grid-template-columns: 1fr; }
  .hero-portrait-img { aspect-ratio: 3/4; max-height: 340px; }
  .hero-portrait-info { padding: 1.25rem; }
  .hero-portrait-title { font-size: 20px; }
}

/*  Active filter chips  */
.active-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 1rem; }
.filter-chip {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  background: var(--accent-light); color: var(--accent);
  border-radius: 20px; font-size: 12px; font-weight: 500;
  text-decoration: none;
}
.filter-chip:hover { background: #dddcfc; }
.filter-chip-clear { background: #fee2e2; color: var(--danger); }
.filter-chip-clear:hover { background: #fecaca; }

/*  Empty state  */
.empty { text-align: center; padding: 5rem 2rem; color: var(--muted); }
.empty-icon { font-size: 48px; margin-bottom: 1rem; opacity: .4; }
.empty h2   { font-family: 'Syne', sans-serif; font-size: 18px; color: var(--text); margin-bottom: .5rem; }
.empty p    { font-size: 14px; }

/*  Alerts / Flash messages  */
.alert {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin-bottom: 1.25rem;
  border: 1px solid;
}
.alert-success { background: var(--success-bg); border-color: var(--success-border); color: var(--success); }
.alert-error   { background: var(--danger-bg);  border-color: var(--danger-border);  color: var(--danger); }
.alert-warning { background: var(--warning-bg); border-color: #fcd34d; color: var(--warning-text); }

/*  Section card (play.php, admin)  */
.section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.section-head {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.section-head h2 {
  font-family: 'Syne', sans-serif;
  font-size: 14px; font-weight: 600;
}
.section-body { padding: 20px; }

/*  Badges  */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; letter-spacing: .04em;
  padding: 3px 10px; border-radius: 20px;
}
.badge-workflow { background: var(--accent); color: #fff; }
.badge-draft    { background: #fbbf24; color: #78350f; }
.badge-fav      { background: var(--warning-bg); color: var(--warning-text); }

/*  Form elements  */
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 1rem; }
.form-row   { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-start; }
.form-row .form-group { flex: 1; min-width: 140px; }

label.field-label {
  font-size: 12px; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted);
}
.field-hint { font-size: 12px; color: var(--muted); margin-top: 3px; }

input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input[type="text"]:focus,
input[type="email"]:focus,
input[type="url"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
  background: var(--surface);
}
textarea { resize: vertical; min-height: 80px; line-height: 1.6; }

.input-mono { font-family: 'Courier New', monospace; font-size: 13px; }

/* Star rating -- visual state managed by JS via .lit class */
.star-rating {
  display: flex;
  flex-direction: row;
  gap: 4px;
}
.star-rating input { display: none; }
.star-rating label {
  font-size: 24px;
  color: var(--border);
  cursor: pointer;
  transition: color .1s;
  text-transform: none;
  letter-spacing: 0;
  line-height: 1;
}
.star-rating label.lit { color: #f59e0b; }

/*  Modal  */
.modal-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 200;
  align-items: center; justify-content: center;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.75rem;
  max-width: 400px; width: 90%;
  border: 1px solid var(--border);
}
.modal h3   { font-family: 'Syne', sans-serif; font-size: 17px; font-weight: 700; margin-bottom: .5rem; }
.modal p    { font-size: 14px; color: var(--muted); margin-bottom: 1.25rem; line-height: 1.5; }
.modal-btns { display: flex; gap: 8px; justify-content: flex-end; }

/*  Admin table  */
.admin-table {
  width: 100%; border-collapse: collapse;
  font-size: 13.5px;
}
.admin-table th {
  text-align: left; padding: 10px 16px;
  font-size: 11px; font-weight: 600;
  letter-spacing: .05em; text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.admin-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; max-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-table td.td-actions-cell { max-width: none; white-space: nowrap; width: 120px; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--bg); }
.td-actions { display: flex; gap: 6px; justify-content: flex-end; }
.admin-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/*  Upload / drop zone  */
.drop-zone {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  font-size: 13px; color: var(--muted);
}
.drop-zone:hover,
.drop-zone.dragover { border-color: var(--accent); background: var(--accent-light); }
.drop-zone label { color: var(--accent); cursor: pointer; font-weight: 500; }

.file-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 11px; color: var(--muted);
  background: var(--bg);
}
.file-chip button {
  border: none; background: none; cursor: pointer;
  color: var(--muted); font-size: 14px; padding: 0; line-height: 1;
  transition: color .1s;
}
.file-chip button:hover { color: var(--danger); }

/*  Existing media in edit form  */
.existing-media { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.existing-media-item {
  position: relative;
  width: 90px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg);
  flex-shrink: 0;
}
.existing-media-item img,
.existing-media-item video {
  width: 100%; height: 70px;
  object-fit: cover; display: block;
}
.existing-media-item audio {
  width: 100%; display: block;
  padding: 4px;
  height: 36px;
}
.existing-media-label {
  font-size: 10px; color: var(--muted);
  padding: 3px 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border-top: 1px solid var(--border);
}
.existing-media-delete {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px;
  background: rgba(220,38,38,.85);
  border: none; border-radius: 50%;
  color: #fff; font-size: 14px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .12s;
  padding: 0;
}
.existing-media-delete:hover { background: rgba(185,28,28,1); }
.existing-media-item.deleting { opacity: .4; pointer-events: none; }
.existing-media-role {
  font-size: 9px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase;
  padding: 2px 5px;
  background: var(--accent-light); color: var(--accent);
  border-bottom: 1px solid var(--border);
}

/*  Step builder  */
.step-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
}
.step-card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}
.step-badge {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent-light); color: var(--accent);
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-family: 'Syne', sans-serif;
}
.step-card-title {
  flex: 1; font-size: 13px; font-weight: 500; color: var(--text);
}
.step-chevron { transition: transform .2s; color: var(--muted); font-style: normal; }
.step-card.collapsed .step-chevron { transform: rotate(-90deg); }
.step-card-body { overflow: hidden; transition: max-height .2s ease; }
.step-card.collapsed .step-card-body { max-height: 0 !important; }
.step-card-inner { padding: 16px; display: flex; flex-direction: column; gap: 12px; }

.prompt-tabs { display: flex; gap: 4px; margin-bottom: 6px; }
.tab-btn {
  font-size: 12px; padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent; color: var(--muted);
  cursor: pointer; font-family: 'DM Sans', sans-serif;
  transition: background .12s, color .12s;
}
.tab-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/*  Prose  */
.prose { font-size: 14.5px; line-height: 1.7; white-space: pre-wrap; }

/*  Hero image on play.php  */
.hero { position: relative; width: 100%; max-height: 380px; overflow: hidden; background: #18181b; }
.hero img { width: 100%; max-height: 380px; object-fit: cover; display: block; opacity: .92; }
.hero-overlay { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.65) 0%, transparent 60%); }
.hero-content { position: absolute; bottom: 0; left: 0; right: 0; padding: 1.5rem 2rem; }
.hero-badges  { display: flex; gap: 8px; margin-bottom: .75rem; flex-wrap: wrap; }
.hero-title   { font-family: 'Syne', sans-serif; font-size: 28px; font-weight: 700; color: #fff; line-height: 1.2; text-shadow: 0 2px 8px rgba(0,0,0,.3); }
.page-header  { background: var(--surface); border-bottom: 1px solid var(--border); padding: 1.75rem 2rem 1.5rem; }
.page-header .hero-title { color: var(--text); text-shadow: none; font-size: 26px; }

/*  Prompt blocks on play.php  */
.prompt-block { border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 10px; }
.prompt-block-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 12px;
  background: var(--bg);
  border: 1px solid var(--border); border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.prompt-block-label { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.prompt-block-label.modified { color: var(--accent); }
.prompt-text {
  font-size: 13px; line-height: 1.65; padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border); border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  white-space: pre-wrap; word-break: break-word;
  font-family: 'Courier New', monospace;
}
.prompt-text.modified { background: #EEEDFE18; border-color: #AFA9EC; }

/*  Copy button  */
.copy-btn {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--muted);
  background: none; border: none; cursor: pointer;
  padding: 2px 6px; border-radius: 4px;
  font-family: 'DM Sans', sans-serif;
  transition: color .12s, background .12s;
}
.copy-btn:hover  { color: var(--accent); background: var(--accent-light); }
.copy-btn.copied { color: var(--success); }

/*  Media grid on play.php  */
.media-section       { margin-top: 14px; }
.media-section-label { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.media-item { border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); background: var(--bg); position: relative; }
.media-item img   { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.media-item video,
.media-item audio { width: 100%; display: block; }
.media-item audio { padding: 8px; }
/* Markdown files span full grid width */
.media-item--md {
  grid-column: 1 / -1;
  overflow: visible;
  border: none;
  background: none;
}
.media-role-tag   { position: absolute; top: 6px; left: 6px; font-size: 9px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 2px 6px; border-radius: 4px; }
.role-reference   { background: rgba(0,0,0,.55); color: #e2e8f0; }
.role-result      { background: rgba(83,74,183,.85); color: #fff; }
.media-label      { padding: 6px 8px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--border); }
.media-source-link { display: block; padding: 4px 8px; font-size: 11px; color: var(--accent); text-decoration: none; border-top: 1px solid var(--border); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-source-link:hover { text-decoration: underline; }

/*  Steps timeline on play.php  */
.steps { display: flex; flex-direction: column; }
.step-item { display: flex; gap: 0; position: relative; }
.step-line { display: flex; flex-direction: column; align-items: center; width: 44px; flex-shrink: 0; }
.step-num  { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-light); color: var(--accent); font-family: 'Syne', sans-serif; font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; position: relative; z-index: 1; }
.step-connector { width: 2px; flex: 1; background: var(--border); min-height: 20px; }
.step-item:last-child .step-connector { display: none; }
.step-content { flex: 1; padding-bottom: 28px; padding-left: 16px; min-width: 0; }
.step-item:last-child .step-content { padding-bottom: 0; }
.step-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.step-title  { font-family: 'Syne', sans-serif; font-size: 15px; font-weight: 600; }
.platform-badge { font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 20px; }
.model-tag  { font-size: 11px; color: var(--muted); background: var(--bg); border: 1px solid var(--border); padding: 2px 8px; border-radius: 20px; }
.step-notes-text { font-size: 13.5px; color: var(--muted); line-height: 1.6; padding: 10px 0 0; white-space: pre-wrap; }

/*  Source URL banner  */
.source-url-banner { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--accent-light); border-radius: var(--radius-sm); font-size: 13.5px; }
.source-url-banner a { color: var(--accent); text-decoration: none; font-weight: 500; word-break: break-all; }
.source-url-banner a:hover { text-decoration: underline; }

/*  Meta row on play.php  */
.meta-row   { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.meta-item  { display: flex; align-items: center; gap: 5px; }
.meta-stars { color: #f59e0b; letter-spacing: 1px; }
.meta-link  { color: var(--accent); text-decoration: none; }
.meta-link:hover { text-decoration: underline; }

/*  Page body wrapper  */
.page-body { max-width: 900px; margin: 0 auto; padding: 2rem 1.5rem; display: flex; flex-direction: column; gap: 1.5rem; }

/*  Responsive  */
@media (max-width: 768px) {
  :root { --sidebar-w: 260px; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 200;
    box-shadow: 4px 0 24px rgba(0,0,0,.12);
  }
  .sidebar.open { transform: translateX(0); }

  .sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.35);
    z-index: 199;
  }
  .sidebar-overlay.open { display: block; }

  .main { margin-left: 0; width: 100%; max-width: 100vw; }

  /* Hamburger button -- shown only on mobile */
  .mobile-menu-btn {
    display: flex !important;
    align-items: center; justify-content: center;
    width: 36px; height: 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    cursor: pointer;
    flex-shrink: 0;
  }

  .plays-grid { grid-template-columns: repeat(auto-fill, minmax(240px,1fr)); }
  .form-row   { flex-direction: column; }

  .topbar-search { padding: .75rem 1rem; gap: 8px; }
  .sort-select { max-width: 130px; }
}

@media (min-width: 769px) {
  .mobile-menu-btn    { display: none !important; }
  .sidebar-overlay    { display: none !important; }
}

@media (max-width: 640px) {
  .hero-title  { font-size: 22px; }
  .page-body   { padding: 1.25rem 1rem; }
  .media-grid  { grid-template-columns: repeat(2, 1fr); }
  .stats-bar   { flex-wrap: wrap; }
  .stat-pill   { min-width: 80px; }
  .btn-new span { display: none; } /* hide "New play" text, keep + icon */
}

/*  Upload progress bar  */
.upload-progress-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--border);
  z-index: 9999;
  display: none;
  pointer-events: none;
  overflow: hidden;
}
.upload-progress-bar.active { display: block; }

/* Indeterminate animation -- moving stripe */
.upload-progress-fill {
  position: absolute;
  top: 0; height: 100%;
  width: 35%;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--accent) 30%,
    #a78bfa 60%,
    var(--accent) 80%,
    transparent 100%);
  animation: progress-indeterminate 1.2s ease-in-out infinite;
  border-radius: 2px;
}
@keyframes progress-indeterminate {
  0%   { left: -40%; }
  100% { left: 110%; }
}

.upload-status-badge {
  position: fixed;
  bottom: 24px; right: 24px;
  background: #18181b;
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 13px; font-weight: 500;
  display: none;
  align-items: center;
  gap: 10px;
  z-index: 9999;
  box-shadow: 0 4px 20px rgba(0,0,0,.2);
  max-width: 320px;
  transition: opacity .2s;
}
.upload-status-badge.active  { display: flex; }
.upload-status-badge.success { background: #15803d; }
.upload-status-badge.error   { background: #b91c1c; }

.upload-spinner {
  width: 16px; height: 16px; flex-shrink: 0;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: upspin .7s linear infinite;
}
@keyframes upspin { to { transform: rotate(360deg); } }

/*  PDF media item  */
.media-item-pdf {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4/3;
  background: #fef2f2;
  border-radius: var(--radius-sm);
  text-decoration: none;
  gap: 6px;
  transition: background .12s;
}
.media-item-pdf:hover { background: #fee2e2; }
.media-item-pdf-icon  { font-size: 32px; line-height: 1; }
.media-item-pdf-name  { font-size: 10px; color: #b91c1c; font-weight: 500; text-align: center; padding: 0 6px; word-break: break-all; max-width: 100%; }

/*  General play media (reference board)  */
.general-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.general-media-item {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg);
  aspect-ratio: 1/1;
}
.general-media-item img,
.general-media-item video {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}
.general-media-label {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,.55);
  color: #fff; font-size: 10px;
  padding: 3px 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.general-media-delete {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px;
  background: rgba(220,38,38,.85);
  border: none; border-radius: 50%;
  color: #fff; font-size: 14px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.general-media-delete:hover { background: rgba(185,28,28,1); }

/*  Print styles  */
@media print {
  .topbar, .topbar-search, .stats-bar, .sidebar,
  .modal-backdrop, .lightbox, .btn, .copy-btn,
  .print-hide, .existing-media-delete,
  .upload-progress-bar, .upload-status-badge { display: none !important; }

  body { background: #fff !important; font-size: 12pt; }
  .main { margin-left: 0 !important; }
  .page-body { padding: 0 !important; max-width: 100% !important; }
  .hero-portrait { grid-template-columns: 200px 1fr; break-inside: avoid; }
  .hero-portrait-img img { max-height: 200px; }
  .section-card { border: 1px solid #ddd !important; break-inside: avoid; margin-bottom: 16pt; }
  .media-grid { grid-template-columns: repeat(4, 1fr) !important; }
  .media-item img { max-height: 120px; }
  .prompt-text { background: #f9f9f9 !important; border: 1px solid #eee !important; }
  .step-num { background: #eee !important; }
  a[href]::after { content: none !important; }
}

/*  Upload validation warnings  */
.upload-warning {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  color: #92400e;
  margin-top: 10px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  line-height: 1.5;
}
.upload-warning-icon { flex-shrink: 0; font-size: 15px; }
.upload-warning-error {
  background: #fef2f2;
  border-color: #dc2626;
  color: #7f1d1d;
}

/* ── Markdown card ─────────────────────────────────────────── */
.md-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
  margin-bottom: 12px;
}
.md-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.md-filename {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.md-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.md-rendered {
  padding: 1.25rem 1.5rem;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  overflow-x: auto;
  overflow-y: auto;
  max-height: 600px;
  transition: max-height .3s ease;
}
.md-rendered.expanded {
  max-height: none;
}
.md-rendered h1,.md-rendered h2,.md-rendered h3,
.md-rendered h4,.md-rendered h5,.md-rendered h6 {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  margin: 1.25rem 0 .5rem;
  line-height: 1.25;
  color: var(--text);
}
.md-rendered h1 { font-size: 22px; }
.md-rendered h2 { font-size: 18px; }
.md-rendered h3 { font-size: 15px; }
.md-rendered h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.md-rendered p  { margin-bottom: .75rem; }
.md-rendered ul,.md-rendered ol { padding-left: 1.5rem; margin-bottom: .75rem; }
.md-rendered li { margin-bottom: .25rem; }
.md-rendered strong { font-weight: 700; }
.md-rendered em { font-style: italic; }
.md-rendered del { text-decoration: line-through; color: var(--muted); }
.md-rendered code {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: 'Courier New', monospace;
  font-size: 12.5px;
}
.md-rendered pre {
  background: #1e1e2e;
  color: #cdd6f4;
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin-bottom: .75rem;
}
.md-rendered pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 13px;
  color: inherit;
}
.md-rendered blockquote {
  border-left: 3px solid var(--accent);
  padding: .5rem 1rem;
  margin: .75rem 0;
  background: var(--accent-light);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--muted);
  font-style: italic;
}
.md-rendered a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.md-rendered hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1rem 0;
}
.md-rendered table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: .75rem;
}
.md-rendered th {
  background: var(--bg);
  font-weight: 600;
  text-align: left;
  padding: 7px 12px;
  border: 1px solid var(--border);
}
.md-rendered td {
  padding: 6px 12px;
  border: 1px solid var(--border);
  vertical-align: top;
}
.md-rendered tr:nth-child(even) td { background: var(--bg); }
.md-rendered img { max-width: 100%; border-radius: var(--radius-sm); }
.md-raw {
  padding: 1rem 1.25rem;
  font-family: 'Courier New', monospace;
  font-size: 12.5px;
  line-height: 1.6;
  background: #1e1e2e;
  color: #cdd6f4;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}
/* MD items span full width in media grid */
.general-media-item--md {
  grid-column: 1 / -1;
}

/*  Theme toggle  */
.theme-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.theme-toggle:hover { background: var(--bg); border-color: var(--accent); color: var(--text); }
.theme-toggle svg { width: 14px; height: 14px; flex-shrink: 0; }
