:root {
  color-scheme: light dark;
  --bg: #f4f6fb;
  --panel: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.12);
  --border: #e2e8f0;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: radial-gradient(circle at 18% 0%, #fef6ff 0%, #eef2ff 45%, #e2e8f0 100%);
  color: var(--text);
  line-height: 1.35;
}

/* Desactiva selección de texto (excepto inputs) para disuadir copiado directo */
body,
.no-select {
  -webkit-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

input,
textarea,
button,
select,
option {
  -webkit-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

.view-navbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 40;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.82);
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.1);
  backdrop-filter: blur(10px);
}

.view-navbar .nav-shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 8px 14px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.view-navbar .brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  font-weight: 700;
  text-decoration: none;
  font-size: 0.95rem;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.18);
}

.view-navbar .brand span {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, #38bdf8, #6366f1);
  color: #0f172a;
  font-size: 12px;
  letter-spacing: 0.08em;
  box-shadow: 0 8px 18px rgba(99, 102, 241, 0.24);
}

.view-navbar .nav-dropdown {
  position: relative;
}

.view-navbar .nav-dropdown summary {
  list-style: none;
}

.view-navbar .nav-dropdown summary::-webkit-details-marker {
  display: none;
}

.view-navbar .nav-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.55);
  background: rgba(255, 255, 255, 0.95);
  color: #0f172a;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.1;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
  transition: all 0.2s ease, transform 0.22s ease;
}

.view-navbar .nav-toggle svg {
  width: 16px;
  height: 16px;
}

.view-navbar .nav-toggle:hover {
  transform: translateY(-1px);
  border-color: rgba(59, 130, 246, 0.6);
  box-shadow: 0 14px 30px rgba(59, 130, 246, 0.15);
}

.view-navbar .nav-dropdown[open] .nav-toggle {
  border-color: rgba(99, 102, 241, 0.9);
  box-shadow: 0 16px 36px rgba(99, 102, 241, 0.2);
}

.view-navbar .nav-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 260px;
  padding: 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(148, 163, 184, 0.28);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.14);
  backdrop-filter: blur(10px);
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: all 0.2s ease;
}

.view-navbar .nav-dropdown[open] .nav-menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.view-navbar .nav-links {
  display: grid;
  gap: 8px;
}

.view-navbar .nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.98));
  color: #0f172a;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: all 0.18s ease, transform 0.22s ease;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

.view-navbar .nav-link .tag {
  font-size: 10px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
  color: #0f172a;
  border: 1px solid rgba(15, 23, 42, 0.12);
}

.view-navbar .nav-link:hover {
  transform: translateY(-2px);
  border-color: rgba(59, 130, 246, 0.6);
  box-shadow: 0 14px 32px rgba(59, 130, 246, 0.16);
}

.view-navbar .nav-link.is-active {
  border-color: rgba(99, 102, 241, 0.9);
  box-shadow: 0 16px 36px rgba(99, 102, 241, 0.18);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.16), rgba(56, 189, 248, 0.16));
}

.view-navbar .nav-link.is-active .tag {
  background: #0f172a;
  color: #e0f2fe;
  border-color: rgba(15, 23, 42, 0.8);
}

@media (max-width: 768px) {
  .view-navbar .nav-shell {
    padding: 10px 12px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .view-navbar .brand {
    padding: 9px 12px;
  }

  .view-navbar .nav-toggle {
    width: 100%;
    justify-content: space-between;
  }

  .view-navbar .nav-menu {
    left: 0;
    right: 0;
  }
}

.resource-panel,
.viewer-panel {
  border-radius: 26px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  padding: 18px 20px;
  box-shadow: 0 30px 60px rgba(15, 23, 42, 0.12);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(24px);
  isolation: isolate;
}

.resource-panel::before,
.viewer-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(14, 165, 233, 0.08));
  pointer-events: none;
  opacity: 0.9;
}

.resource-panel {
  min-height: 48vh;
  max-height: calc(100vh - 48px);
  transition: box-shadow 0.3s ease;
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.98), rgba(219, 234, 254, 0.9));
  border: 1px solid rgba(148, 163, 184, 0.4);
  box-shadow: 0 30px 60px rgba(15, 23, 42, 0.2);
  color: var(--text);
  overflow-y: auto;
  scrollbar-color: rgba(59, 130, 246, 0.5) transparent;
  scrollbar-width: thin;
}

.resource-panel::before {
  background: linear-gradient(165deg, rgba(59, 130, 246, 0.25), rgba(14, 165, 233, 0.15));
  opacity: 0.25;
}

.resource-search {
  margin: 10px 0 6px;
  position: relative;
}

.resource-search input {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.55);
  background: rgba(255, 255, 255, 0.92);
  padding: 12px 14px 12px 40px;
  font-size: 14px;
  color: #0f172a;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
  transition: all 0.18s ease;
}

.resource-search input:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.7);
  box-shadow: 0 14px 32px rgba(59, 130, 246, 0.16);
}

.resource-search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  color: #0f172a;
  opacity: 0.6;
  pointer-events: none;
}

.resource-search.is-hidden {
  display: none;
}

.link-item.is-hidden {
  display: none;
}

.resource-card.is-filtered-out {
  display: none;
}

.resource-panel::-webkit-scrollbar {
  width: 6px;
}

.resource-panel::-webkit-scrollbar-track {
  background: transparent;
}

.resource-panel::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.6), rgba(14, 165, 233, 0.6));
  border-radius: 999px;
}

.sidebar-toggle {
  position: relative;
  top: auto;
  align-self: flex-start;
  cursor: pointer;
  isolation: isolate;
  background: linear-gradient(135deg, rgba(219, 234, 254, 0.9), rgba(191, 219, 254, 0.95));
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: 999px;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.15);
}

.sidebar-toggle::after {
  content: '';
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  background: linear-gradient(120deg, rgba(37, 99, 235, 0.15), transparent 65%);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
  z-index: -1;
}

.sidebar-toggle:hover::after,
.sidebar-toggle:focus-visible::after {
  opacity: 1;
}

.sidebar-toggle .toggle-icon {
  width: 38px;
  height: 38px;
  border-radius: 16px;
  background: rgba(37, 99, 235, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.4);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
}

.sidebar-toggle .toggle-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
}

@media (max-width: 768px) {
  .sidebar-toggle .toggle-icon {
    width: 32px;
    height: 32px;
  }

  .sidebar-toggle {
    align-self: flex-start;
    width: auto;
    padding: 6px 10px;
    border-radius: 14px;
    gap: 6px;
    flex-direction: row;
    min-height: auto;
  }

  .resource-panel {
    min-height: auto;
    max-height: none;
  }
}

.sidebar-toggle .toggle-label {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  white-space: nowrap;
  gap: 2px;
}

.sidebar-toggle .toggle-title {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.sidebar-toggle .toggle-state {
  font-size: 0.95rem;
  color: var(--text);
}

.sidebar-toggle.is-collapsed .toggle-icon {
  transform: rotate(180deg);
}

.view-meta {
  margin-bottom: 12px;
  padding: 0;
  border-left: none;
  position: relative;
  top: auto;
  background: transparent;
  padding-bottom: 12px;
  z-index: auto;
  transition: opacity 0.25s ease, max-height 0.35s ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.view-meta::after {
  content: '';
  width: 72px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, #60a5fa, #22d3ee);
}

.resource-panel .view-meta h2 {
  color: var(--text);
}

.resource-panel .view-meta p {
  color: var(--muted);
}

.view-meta h2 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: 0.04em;
}

.view-meta p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.resource-board {
  transition: opacity 0.25s ease, max-height 0.35s ease;
  position: relative;
  overflow: visible;
  margin-top: 6px;
  z-index: 1;
}

.resource-board::before {
  display: none;
}

body.sidebar-collapsed .resource-panel {
    min-width: 68px;
    width: 68px;
    padding: 8px;
    background: transparent;
    border-color: transparent;
    box-shadow: none;
    max-height: none;
    overflow: visible;
  }

body.sidebar-collapsed .resource-panel::before {
  opacity: 0;
}

body.sidebar-collapsed .resource-panel .view-meta,
body.sidebar-collapsed .resource-panel .resource-board,
body.sidebar-collapsed .resource-panel .resource-progress,
body.sidebar-collapsed .resource-panel .resource-search {
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  margin: 0;
  pointer-events: none;
  display: none;
}

body.sidebar-collapsed .sidebar-toggle {
  width: 60px;
  padding: 10px;
  border-radius: 22px;
  gap: 0;
  box-shadow: none;
  justify-content: center;
}

body.sidebar-collapsed .sidebar-toggle::after {
  display: none;
}

body.sidebar-collapsed .sidebar-toggle .toggle-label {
  display: none;
}

.resource-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 22px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  box-shadow: 0 18px 30px rgba(15, 23, 42, 0.12);
  overflow: hidden;
  position: relative;
  z-index: 0;
}

.resource-summary {
  list-style: none;
  cursor: pointer;
  border-radius: 22px;
  border: none;
  background: linear-gradient(155deg, rgba(248, 250, 255, 0.95), rgba(226, 239, 255, 0.9));
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  position: relative;
  padding: 18px 22px 18px 32px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.resource-summary::before {
  content: '';
  position: absolute;
  width: 4px;
  height: calc(100% - 24px);
  border-radius: 999px;
  background: linear-gradient(180deg, #2563eb, #22d3ee);
  left: 18px;
  top: 12px;
}

.resource-summary:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.6);
  outline-offset: 3px;
}

.resource-summary:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.12);
  background: linear-gradient(155deg, rgba(248, 250, 255, 0.98), rgba(219, 234, 254, 0.95));
}

.resource-summary::-webkit-details-marker {
  display: none;
}

.summary-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}

.summary-count {
  font-size: 0.6rem;
  color: rgba(37, 78, 124, 0.85);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: 999px;
  padding: 4px 12px;
  align-self: flex-start;
  background: rgba(219, 234, 254, 0.85);
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.12);
}

.summary-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.summary-header h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--text);
  font-weight: 600;
}

.summary-subtitle {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(71, 85, 105, 0.8);
}

.summary-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  width: 100%;
  flex-wrap: wrap;
}

.summary-meta span {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.resource-card.active .resource-summary {
  background: linear-gradient(160deg, rgba(219, 234, 254, 0.95), rgba(191, 219, 254, 0.95));
  box-shadow: 0 25px 45px rgba(37, 99, 235, 0.2);
}

.resource-card.active .resource-summary::before {
  background: linear-gradient(180deg, #2563eb, #22d3ee);
}

.card-meta {
  font-size: 0.88rem;
  color: var(--muted);
}

.resource-panel .card-meta {
  color: var(--muted);
}

.card-desc {
  margin: 0;
  color: #1e293b;
  line-height: 1.5;
}

.accordion-body {
  width: 100%;
  padding: 0 18px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border: none;
  background: rgba(248, 250, 255, 0.96);
  border-radius: 0 0 24px 24px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
  opacity: 0;
}

.resource-card[open] .accordion-body {
  max-height: 480px;
  padding: 16px 18px 20px;
  opacity: 1;
  overflow-y: auto;
  scrollbar-color: rgba(59, 130, 246, 0.5) transparent;
  scrollbar-width: thin;
}

.resource-card[open] .accordion-body::-webkit-scrollbar {
  width: 6px;
}

.resource-card[open] .accordion-body::-webkit-scrollbar-track {
  background: transparent;
}

.resource-card[open] .accordion-body::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.6), rgba(14, 165, 233, 0.6));
  border-radius: 999px;
}

.link-title-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.link-title-block h4 {
  flex: 1;
  font-weight: 600;
  color: var(--text);
}

.link-status-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 2px;
  color: var(--muted);
}

.resource-check {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
}

.resource-check input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.resource-check .check-indicator {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  border: 1.5px solid rgba(148, 163, 184, 0.5);
  background: rgba(255, 255, 255, 0.9);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.resource-check .check-indicator::after {
  content: '';
  width: 6px;
  height: 12px;
  border-right: 2px solid transparent;
  border-bottom: 2px solid transparent;
  transform: rotate(45deg);
  transition: border-color 0.2s ease;
}

.resource-check .check-indicator.is-checked {
  background: linear-gradient(120deg, #2563eb, #0ea5e9);
  border-color: transparent;
  box-shadow: 0 10px 18px rgba(37, 99, 235, 0.3);
}

.resource-check .check-indicator.is-checked::after {
  border-color: #fff;
}

.link-item.is-seen .link-title-block h4 {
  color: var(--text);
}

.link-content {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.link-item h4 {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text);
  font-weight: 600;
}

.link-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  width: 100%;
  justify-content: flex-start;
}

.resource-action {
  border-radius: 999px;
  padding: 4px 10px;
  font-weight: 600;
  font-size: 0.7rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  letter-spacing: 0.04em;
  min-height: 26px;
}

.resource-action.primary {
  background: linear-gradient(120deg, #2563eb, #1d4ed8);
  color: #fff;
  border-color: transparent;
}

.resource-action.secondary {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text);
  border-color: rgba(148, 163, 184, 0.35);
  text-decoration: none;
}

.resource-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.12);
}

.btn-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
}

.resource-progress {
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 22px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 8px;
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.95), rgba(236, 244, 255, 0.9));
  box-shadow: 0 18px 30px rgba(15, 23, 42, 0.1);
}

.resource-progress .progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.progress-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.progress-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.26em;
  color: rgba(71, 85, 105, 0.8);
}

.progress-detail {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text);
}

.resource-progress .progress-count {
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--text);
}

.progress-shell {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(226, 232, 240, 0.8);
  overflow: hidden;
}

.progress-shell span {
  display: block;
  height: 100%;
  width: var(--progress, 0%);
  background: linear-gradient(90deg, #60a5fa, #22d3ee);
  border-radius: inherit;
}

.splash {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 20% 20%, rgba(99, 102, 241, 0.2), transparent 35%),
    radial-gradient(circle at 80% 0%, rgba(14, 165, 233, 0.22), transparent 40%),
    rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(12px);
  transition: opacity 0.4s ease;
  z-index: 999;
}

.splash.hidden {
  opacity: 0;
  pointer-events: none;
}

.splash-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(226, 232, 240, 0.9));
  border-radius: 28px;
  padding: 32px 40px;
  text-align: center;
  box-shadow: 0 28px 90px rgba(15, 23, 42, 0.4);
  min-width: 320px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  animation: splash-pop 0.45s ease forwards, splash-float 4s ease-in-out infinite;
}

.splash-overline {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.7rem;
  color: #475569;
}

#splashTitle {
  margin: 10px 0 0;
  font-size: 1.6rem;
  color: #0f172a;
  letter-spacing: 0.02em;
}

.splash-card::before,
.splash-card::after {
  content: '';
  position: absolute;
  border-radius: 999px;
  filter: blur(32px);
  opacity: 0.6;
}

.splash-card::before {
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.25), transparent 60%);
  top: -60px;
  left: -40px;
}

.splash-card::after {
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(14, 165, 233, 0.25), transparent 60%);
  bottom: -50px;
  right: -30px;
}

@keyframes splash-pop {
  0% {
    transform: translateY(10px) scale(0.96);
    opacity: 0;
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@keyframes splash-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

.viewer-panel {
  min-height: 85vh;
}

.viewer-header h3 {
  margin: 0 0 4px;
}

.viewer-header p {
  margin: 0;
}

.viewer-slider {
  display: flex;
  align-items: center;
  gap: 12px;
  align-self: flex-end;
  margin-top: -6px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(248, 250, 252, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.12);
}

.viewer-slider.hidden {
  display: none;
}

.slider-tabs {
  display: grid;
  grid-auto-flow: column;
  gap: 6px;
}

.slider-tab {
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(255, 255, 255, 0.85);
  color: #0f172a;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s ease, border 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.slider-tab.is-active {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(14, 165, 233, 0.15));
  border-color: rgba(59, 130, 246, 0.55);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.12);
}

.slider-tab:hover,
.slider-tab:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 12px 20px rgba(15, 23, 42, 0.12);
  outline: none;
}

.slider-arrows {
  display: flex;
  align-items: center;
  gap: 8px;
}

.slider-btn {
  border: none;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.12), rgba(37, 99, 235, 0.12));
  border-radius: 12px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #0f172a;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.slider-btn:hover,
.slider-btn:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 12px 20px rgba(15, 23, 42, 0.12);
  outline: none;
}

.slider-chip {
  padding: 6px 10px;
  border-radius: 12px;
  background: rgba(14, 165, 233, 0.08);
  color: #0f172a;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.media-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 4px;
}

.media-card {
  background: rgba(248, 250, 252, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 24px;
  padding: 18px;
  box-shadow: 0 24px 45px rgba(15, 23, 42, 0.1);
}

.media-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.media-card-head h4 {
  margin: 4px 0 0;
  font-size: 1.15rem;
}

.media-overline {
  margin: 0;
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--muted);
}

.media-link {
  font-size: 0.82rem;
  color: #0ea5e9;
  font-weight: 600;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(14, 165, 233, 0.4);
  transition: background 0.2s ease, color 0.2s ease;
  white-space: nowrap;
}

.media-link:hover,
.media-link:focus-visible {
  background: rgba(14, 165, 233, 0.1);
  outline: none;
}

.video-card .video-frame {
  width: 100%;
  border-radius: 20px;
  overflow: hidden;
  background: #0f172a;
  aspect-ratio: 16 / 9;
  position: relative;
}

.video-card iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.notes-card {
  padding: 20px;
}

.notes-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.notes-list li {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(226, 232, 240, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.4);
}

.notes-list .note-label {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.notes-list p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text);
  line-height: 1.4;
}

.viewer-frame {
  position: relative;
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
}

.capture-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  color: #e2e8f0;
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  backdrop-filter: blur(4px);
}

.capture-overlay.show {
  display: flex;
}

.viewer-frame::after {
  content: 'myenglishbro';
  position: absolute;
  inset: 24px;
  pointer-events: none;
  display: grid;
  place-items: center;
  font-size: 3.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: rgba(15, 23, 42, 0.08);
  text-transform: uppercase;
  transform: rotate(-18deg);
  mix-blend-mode: multiply;
  z-index: 2;
}

.viewer-frame iframe {
  width: 100%;
  flex: 1;
  border: none;
  border-radius: 28px;
  background: #f8fafc;
  min-height: 65vh;
  box-shadow: 0 35px 60px rgba(15, 23, 42, 0.18);
}

.iframe-mask {
  position: absolute;
  top: 8px;
  right: -10px;
  z-index: 5;
  left: auto;
  border: none;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 16px 28px rgba(15, 23, 42, 0.35);
  color: #fff;
  font: inherit;
  padding: 6px 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  min-width: 148px;
  letter-spacing: normal;
  text-transform: none;
  backdrop-filter: blur(8px);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.iframe-mask:hover {
  transform: translate(-1px, -1px);
  box-shadow: 0 22px 40px rgba(15, 23, 42, 0.45);
}

.iframe-mask:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.8);
  outline-offset: 3px;
}

.iframe-mask .mask-icon {
  width: 22px;
  height: 22px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.iframe-mask .mask-icon svg {
  width: 16px;
  height: 16px;
  stroke: #fff;
  fill: none;
}

.iframe-mask .mask-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.iframe-mask .mask-status {
  text-transform: uppercase;
  font-size: 0.58rem;
  letter-spacing: 0.18em;
  opacity: 0.7;
}

.iframe-mask .mask-state {
  font-size: 0.78rem;
  font-weight: 600;
}

.iframe-mask .mask-hint {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.iframe-mask .mask-hint svg {
  width: 12px;
  height: 12px;
  stroke: #fff;
  fill: none;
}

.iframe-mask.unlocked {
  display: none;
}
@media (max-width: 1024px) {
  .viewer-panel {
    min-height: 60vh;
  }

  .viewer-frame iframe {
    min-height: 360px;
  }

  .iframe-mask {
    top: 6px;
    right: -4px;
    padding: 8px 12px;
  }

  body.sidebar-collapsed .resource-panel {
    width: 100%;
    min-width: auto;
    flex-direction: row;
    padding: 12px 16px;
    justify-content: flex-start;
  }

  body.sidebar-collapsed .sidebar-toggle {
    width: auto;
    padding: 10px 14px;
  }
}

@media (max-width: 768px) {
  .resource-panel,
  .viewer-panel {
    padding: 20px;
  }

  .viewer-frame iframe {
    min-height: 300px;
  }

  .viewer-frame {
    gap: 12px;
  }

  .link-actions {
    gap: 6px;
  }

  .resource-summary {
    flex-direction: column;
    align-items: flex-start;
  }
}

.check-text {
  font-size: 0.58rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--muted);
}

.link-item.is-seen .check-text {
  color: var(--text);
}
.viewer-panel {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.6);
  color: var(--text);
}

.viewer-panel::before {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(14, 165, 233, 0.08));
  opacity: 0.9;
}
.accordion-body .card-meta {
  color: var(--muted);
}

.accordion-body p,
.accordion-body ul {
  color: #1f2937;
}

.resource-board details > summary::-webkit-details-marker,
.resource-board details > summary::marker {
  display: none;
}

.resource-board details .resource-summary::after {
  content: '›';
  position: absolute;
  right: 24px;
  top: 26px;
  width: 24px;
  height: 24px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, background 0.2s ease, border 0.2s ease;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 6px 12px rgba(15, 23, 42, 0.12);
  font-size: 0.85rem;
  color: rgba(71, 85, 105, 0.9);
  line-height: 24px;
}

.resource-board details[open] .resource-summary::after {
  transform: rotate(90deg);
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.35);
  color: #1d4ed8;
}

.link-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.link-item {
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 18px;
  padding: 12px 16px;
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.98), rgba(236, 244, 255, 0.95));
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 16px 26px rgba(15, 23, 42, 0.08);
}

.link-item:hover {
  transform: translateY(-2px);
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow: 0 20px 34px rgba(37, 99, 235, 0.15);
}

.link-item.is-seen {
  border-color: rgba(14, 165, 233, 0.5);
  box-shadow: 0 24px 36px rgba(14, 165, 233, 0.18);
  background: linear-gradient(160deg, rgba(224, 231, 255, 0.95), rgba(236, 254, 255, 0.9));
}

/* Overrides de colapso: ocultar búsqueda y expandir visor */
body.sidebar-collapsed .resource-search,
body.sidebar-collapsed .resource-panel .resource-search {
  display: none !important;
}

body.sidebar-collapsed .resource-panel {
  min-width: 88px;
  width: 88px;
  padding: 8px;
}

body.sidebar-collapsed .sidebar-toggle {
  width: 52px;
  padding: 10px;
  border-radius: 18px;
  justify-content: center;
}

body.sidebar-collapsed .layout {
  grid-template-columns: 96px minmax(0, 1fr) !important;
}

body.sidebar-collapsed .viewer-panel {
  grid-column: auto;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr !important;
  }

  body.sidebar-collapsed .layout {
    grid-template-columns: 1fr !important;
  }

  body.sidebar-collapsed .resource-panel {
    width: 100%;
    min-width: auto;
    padding: 10px 14px;
  }

  body.sidebar-collapsed .viewer-panel {
    grid-column: 1 / -1;
  }
}
