.hidden { display: none !important; }

.brand-mark {
  display: block;
  object-fit: cover;
  border-radius: 0;
  background: transparent;
  box-shadow: 0 4px 10px rgba(14, 165, 233, .28);
}

.center-stage {
  min-height: calc(100vh - var(--topbar-h) - 56px);
  display: grid;
  place-items: center;
}

.auth-card {
  max-width: 520px;
  padding: 28px;
}

.workspace {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.submit-panel {
  padding: 20px;
  display: grid;
  grid-template-columns: minmax(220px, 360px) 1fr;
  gap: 18px;
  align-items: end;
}

.url-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.library-detail-grid {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.library-panel {
  padding: 16px;
  position: sticky;
  top: calc(var(--topbar-h) + 16px);
  max-height: calc(100vh - var(--topbar-h) - 48px);
  overflow: auto;
}

.panel-head,
.video-card-head,
.detail-head,
.action-row,
.tabbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-head,
.detail-head {
  justify-content: space-between;
}

.video-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.video-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 10px;
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: 10px;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
}

.video-card:hover,
.video-card.active {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.thumb {
  width: 82px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.video-title {
  font-weight: 600;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-meta {
  margin-top: 6px;
  color: var(--text-3);
  font-size: 12px;
}

.status-dots {
  display: flex;
  gap: 5px;
  margin-top: 8px;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border-strong);
}

.dot.ready { background: var(--accent); }
.dot.working { background: var(--warning); }
.dot.failed { background: var(--danger); }

.detail-panel {
  min-width: 0;
}

.empty-state,
.video-detail {
  padding: 18px;
}

.video-detail {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.video-hero {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  margin-bottom: 18px;
}

.hero-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.video-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.tabbar {
  border-bottom: 1px solid var(--border);
  margin: 10px -18px 0;
  padding: 0 18px;
  overflow-x: auto;
}

.tab-button {
  border: 0;
  background: transparent;
  color: var(--text-2);
  padding: 12px 4px;
  margin-right: 16px;
  border-bottom: 2px solid transparent;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.tab-button.active {
  color: var(--accent-text);
  border-bottom-color: var(--accent);
}

.tab-content {
  padding-top: 18px;
}

.reader {
  max-width: 880px;
  line-height: 1.65;
  color: var(--text);
}

.reader h1,
.reader h2,
.reader h3 {
  line-height: 1.25;
  margin: 22px 0 10px;
}

.reader h1 { font-size: 24px; }
.reader h2 { font-size: 20px; }
.reader h3 { font-size: 16px; }
.reader h4 { font-size: 15px; }

.reader p {
  margin: 0 0 14px;
}

.reader ul,
.reader ol {
  margin: 0 0 16px 22px;
  padding: 0;
}

.reader li {
  margin-bottom: 7px;
}

.reader strong {
  font-weight: 700;
}

.reader em {
  font-style: italic;
}

.reader blockquote {
  margin: 0 0 16px;
  padding: 10px 14px;
  border-left: 3px solid var(--accent);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  color: var(--text-2);
}

.reader blockquote p:last-child {
  margin-bottom: 0;
}

.reader pre {
  overflow: auto;
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.reader pre code {
  padding: 0;
  background: transparent;
}

.reader .table-scroll {
  overflow-x: auto;
  margin: 0 0 18px;
}

.reader table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.reader th,
.reader td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

.reader th {
  background: var(--surface-2);
  font-weight: 700;
}

.reader hr {
  margin: 20px 0;
}

.pre-wrap {
  white-space: pre-wrap;
  font-family: inherit;
}

.tool-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.model-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 4px 10px;
  color: var(--text-2);
  font-size: 12px;
}

.notice {
  border: 1px solid var(--warning);
  background: var(--warning-soft);
  color: var(--warning-text);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 12px;
}

.toast-wrap {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius);
  padding: 11px 13px;
  min-width: 260px;
  max-width: 380px;
}

.toast-danger {
  border-color: var(--danger);
  color: var(--danger-text);
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 980px) {
  .submit-panel,
  .library-detail-grid,
  .video-hero {
    grid-template-columns: 1fr;
  }

  .library-panel {
    position: static;
    max-height: none;
  }
}

@media (max-width: 640px) {
  .content {
    padding: 14px;
  }

  .url-form {
    grid-template-columns: 1fr;
  }

  .video-detail {
    padding: 14px;
  }

  .tabbar {
    margin-left: -14px;
    margin-right: -14px;
    padding: 0 14px;
  }

  .toast-wrap {
    left: 12px;
    right: 12px;
  }
}
