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

:root {
  --color-primary: #000;
  --color-primary-hover: #333;
  --color-text: #1a1a1a;
  --color-text-light: #666;
  --color-text-muted: #999;
  --color-background: #f5f5f7;
  --color-white: #fff;
  --color-border: #e5e7eb;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --transition: all 0.2s ease;
}

body {
  font-family: "Poppins", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--color-background);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
}

.gradient-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 18px;
  background: linear-gradient(to right, #21DAFF 0%, #74EC8D 20%, #E0FF20 40%, #EBB016 60%, #FF5C1A 80%, #FF1A6A 100%);
  z-index: 100;
}

.header {
  background: var(--color-white);
  padding: 24px 0;
  border-bottom: 1px solid var(--color-border);
  margin-top: 18px;
  position: sticky;
  top: 18px;
  z-index: 50;
}

.container {
  width: 100%;
  padding: 0 24px;
}

.logo {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.4px;
}

.logo-separator { margin: 0 8px; color: var(--color-text-muted); font-weight: 300; }
.logo-subtitle { font-size: 1.45rem; font-weight: 400; color: var(--color-text-light); }

.main-content { padding: 24px 0 70px; }
.section-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 12px; }
.view-section { margin-top: 10px; }
.hidden { display: none !important; }

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
  width: 100%;
}

.mode-btn {
  width: 100%;
  min-height: 64px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-white);
  color: var(--color-text);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
}

.mode-btn:hover { background: #f8fafc; }
.mode-btn.active {
  background: var(--color-primary);
  color: var(--color-white);
  border-color: var(--color-primary);
}

.mode-btn-icon {
  font-size: 1.05rem;
  line-height: 1;
}

.toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 10px 0 18px;
}

.search-input, .session-select {
  height: 42px;
  border: 1px solid var(--color-border);
  background: var(--color-white);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--color-text);
}

.search-input { flex: 1; min-width: 260px; }
.session-select { min-width: 220px; }

.videos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  justify-content: stretch;
  gap: 18px;
}

.video-card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  transition: var(--transition);
}

.video-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.video-embed {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--color-border);
  margin-bottom: 12px;
  background: #000;
}

.video-embed iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.video-session {
  font-size: 0.73rem;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}

.video-title { font-size: 1rem; font-weight: 600; margin-bottom: 8px; line-height: 1.4; }
.video-meta { font-size: 0.84rem; color: var(--color-text-light); margin-bottom: 10px; }
.video-resume-preview {
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  color: var(--color-text);
  font-family: inherit;
  font-size: 0.88rem;
  line-height: 1.45;
  cursor: pointer;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  position: relative;
  padding-right: 4px;
}

.video-resume-preview::after {
  content: " ...";
  color: var(--color-text-muted);
}

.video-resume-preview.expanded {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
}

.video-resume-preview.expanded::after {
  content: "";
}

.video-points-list {
  margin: 0 0 12px 18px;
  color: var(--color-text-light);
  font-size: 0.82rem;
}

.video-points-list li {
  margin-bottom: 6px;
}

.btn-open-player, .btn-focus-video {
  border: 1px solid var(--color-border);
  background: var(--color-white);
  border-radius: var(--radius-sm);
  height: 32px;
  padding: 0 10px;
  font-size: 0.77rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-open-player:hover, .btn-focus-video:hover { background: #f8fafc; }

.empty-state {
  background: var(--color-white);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  text-align: center;
  padding: 22px;
  color: var(--color-text-light);
  font-size: 0.9rem;
}

.assistant-layout {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(420px, 1.2fr);
  gap: 16px;
  align-items: stretch;
  height: var(--assistant-layout-height, calc(100dvh - 220px));
  min-height: 320px;
}

.chat-pane, .player-pane {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  height: 100%;
  min-height: 0;
  max-height: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pane-header {
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.pane-title { font-size: 0.85rem; font-weight: 600; }

.chat-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background:
    linear-gradient(
      135deg,
      rgba(33, 218, 255, 0.08) 0%,
      rgba(116, 236, 141, 0.07) 20%,
      rgba(224, 255, 32, 0.06) 40%,
      rgba(235, 176, 22, 0.05) 60%,
      rgba(255, 92, 26, 0.05) 80%,
      rgba(255, 26, 106, 0.05) 100%
    ),
    #fafafa;
}

.chat-message {
  max-width: 92%;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.86rem;
  line-height: 1.5;
  border: 1px solid transparent;
  word-break: break-word;
}

.chat-message.user {
  align-self: flex-end;
  background: #eef6ff;
  border-color: #d8e7ff;
}

.chat-message.assistant {
  align-self: flex-start;
  background: var(--color-white);
  border-color: var(--color-border);
}

.chat-message h4 { font-size: 0.86rem; margin-bottom: 4px; }
.chat-message ul { margin: 6px 0 0 18px; }
.chat-message p + p, .chat-message ul + p { margin-top: 6px; }

.chat-video-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.btn-play-video {
  border: 1px solid #000;
  background: #000;
  color: #fff;
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-play-video:hover {
  background: #222;
  border-color: #222;
}

.btn-play-video:focus-visible {
  outline: 3px solid #21DAFF;
  outline-offset: 2px;
}

.chat-video-link {
  vertical-align: middle;
  margin: 0 4px;
}

.chat-form {
  border-top: 1px solid var(--color-border);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.chat-input {
  width: 100%;
  min-height: 72px;
  resize: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 10px;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.4;
}

.chat-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.btn-send {
  border: none;
  background: var(--color-primary);
  color: var(--color-white);
  border-radius: var(--radius-sm);
  height: 34px;
  padding: 0 14px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
}

.btn-send:hover { background: var(--color-primary-hover); }

.player-body {
  flex: 1;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.focus-player {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  overflow: hidden;
  background: #000;
}

.focus-player iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.focus-meta {
  background: #fafafa;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.focus-title { font-size: 0.9rem; font-weight: 600; margin-bottom: 4px; }
.focus-subtitle { font-size: 0.8rem; color: var(--color-text-light); }
.focus-resume {
  margin-top: 8px;
  font-size: 0.84rem;
  color: var(--color-text);
  line-height: 1.45;
}

.focus-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.footer {
  text-align: center;
  padding: 24px 20px;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

@media (max-width: 1200px) {
  .assistant-layout {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
  }
  .chat-pane, .player-pane {
    height: auto;
    min-height: 420px;
  }
}

@media (max-width: 768px) {
  .container { padding: 0 16px; }
  .logo, .logo-subtitle { font-size: 1.2rem; }
  .logo-subtitle, .logo-separator { display: none; }
  .mode-switch { grid-template-columns: 1fr; }
  .videos-grid { grid-template-columns: 1fr; }
  .chat-actions { flex-direction: column; align-items: flex-start; }
  .btn-send { width: 100%; }
  .assistant-layout { min-height: auto; }
  .chat-pane, .player-pane { min-height: 360px; }
}
