:root {
  --bg: #f4f2ee;
  --panel: #ffffff;
  --sidebar: #faf9f6;
  --ink: #1f1d1a;
  --muted: #78736a;
  --faint: #a8a29a;
  --line: #e5e0d8;
  --line-strong: #d8d0c4;
  --accent: #b45309;
  --accent-strong: #92400e;
  --accent-soft: #fdf2e3;
  --ok: #1f9d63;
  --warn: #c98a12;
  --bad: #c2410c;
  --shadow: 0 10px 30px rgba(40, 32, 20, 0.08);
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC",
    system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app {
  display: grid;
  grid-template-columns: 256px minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  transition: grid-template-columns 180ms ease;
}

/* ------------------------------------------------------------- sidebar */

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  overflow: hidden;
  padding: 22px 16px 16px;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  transition: padding 180ms ease, gap 180ms ease;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 4px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-name {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.brand-sub {
  margin-top: 1px;
  color: var(--faint);
  font-size: 11px;
  letter-spacing: 0.12em;
}

.sidebar-toggle {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 120ms ease, color 120ms ease;
}

.sidebar-toggle:hover {
  border-color: var(--line-strong);
  color: var(--accent);
}

.new-chat {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease;
}

.new-chat:hover {
  border-color: var(--line-strong);
  background: #fff;
}

.new-chat-plus {
  color: var(--accent);
  font-size: 16px;
  line-height: 1;
}

.sidebar-section {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.sidebar-label {
  padding: 0 6px;
  margin: 10px 0 6px;
  color: var(--faint);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.sidebar-section > .sidebar-label {
  margin-top: 0;
}

.session-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: #d7cfc2 transparent;
}

.session-list::-webkit-scrollbar {
  width: 8px;
}

.session-list::-webkit-scrollbar-thumb {
  border: 2px solid var(--sidebar);
  border-radius: 999px;
  background: #d7cfc2;
}

.session-item {
  display: block;
  padding: 9px 10px;
  border-radius: 9px;
  text-decoration: none;
  transition: background 120ms ease;
}

.session-item:hover {
  background: #f1ede6;
}

.session-item.active {
  background: var(--accent-soft);
  box-shadow: inset 2px 0 0 var(--accent);
}

.session-title {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-meta {
  display: block;
  margin-top: 3px;
  color: var(--faint);
  font-size: 11px;
}

.sidebar-empty {
  padding: 10px 8px;
  color: var(--muted);
  font-size: 12px;
}

.sidebar-empty p {
  margin: 0 0 4px;
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 12px;
  cursor: pointer;
}

.muted-small {
  color: var(--faint);
  font-size: 11px;
}

.sidebar-links {
  display: flex;
  gap: 16px;
  padding: 12px 6px 0;
  border-top: 1px solid var(--line);
}

.sidebar-link {
  color: var(--muted);
  font-size: 12px;
  text-decoration: none;
}

.sidebar-link:hover {
  color: var(--accent);
}

.link-short {
  display: none;
}

.shared-warning {
  margin: 0;
  padding: 10px 6px 0;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 11px;
  line-height: 1.6;
}

.app.sidebar-collapsed {
  grid-template-columns: 58px minmax(0, 1fr);
}

.sidebar-collapsed .sidebar {
  align-items: center;
  gap: 12px;
  padding: 18px 8px 12px;
}

.sidebar-collapsed .sidebar-head {
  justify-content: center;
  width: 100%;
  padding: 0;
}

.sidebar-collapsed .brand,
.sidebar-collapsed .sidebar-section,
.sidebar-collapsed .shared-warning {
  display: none;
}

.sidebar-collapsed .new-chat {
  width: 40px;
  height: 40px;
  padding: 0;
}

.sidebar-collapsed .new-chat-label,
.sidebar-collapsed .link-full {
  display: none;
}

.sidebar-collapsed .link-short {
  display: inline;
}

.sidebar-collapsed .sidebar-links {
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 0 0;
}

/* ---------------------------------------------------------------- main */

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background:
    radial-gradient(1200px 500px at 80% -10%, #fbf7f0 0%, transparent 60%),
    var(--bg);
}

.topbar {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 16px;
  height: 52px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(8px);
}

.topbar-home {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  flex: 0 0 auto;
  padding: 0 12px;
  border: 1px solid #f0d9bd;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.topbar-home[hidden] {
  display: none;
}

.topbar-home:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.topbar-home-arrow {
  font-size: 13px;
  line-height: 1;
}

.topbar-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-left: auto;
  overflow: hidden;
  color: var(--faint);
  font-size: 12px;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

#coverage-text {
  overflow: hidden;
  min-width: 0;
  text-overflow: ellipsis;
}

.coverage-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--ok);
}

.topbar-meta[data-state="loading"] .coverage-dot {
  background: var(--warn);
  animation: pulse 1.2s ease-in-out infinite;
}

.topbar-meta[data-state="error"] .coverage-dot {
  background: var(--bad);
}

.topbar-library {
  color: var(--accent);
}

.view {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 34px 40px 12px;
  scrollbar-width: thin;
  scrollbar-color: #d7cfc2 transparent;
}

.view::-webkit-scrollbar {
  width: 10px;
}

.view::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: #d7cfc2;
  background-clip: content-box;
}

/* ---------------------------------------------------------------- home */

.home {
  width: 100%;
  max-width: 1060px;
  margin: 0 auto;
}

.hero {
  margin: 4px 0 26px;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.14em;
}

.hero h1 {
  margin: 8px 0 8px;
  font-size: 30px;
  font-weight: 680;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.lede {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.hero-meta {
  margin: 8px 0 0;
  color: var(--faint);
  font-size: 12px;
}

.guide-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 15px;
  margin: 0 0 14px;
  border: 1px solid #f0d9bd;
  border-radius: var(--radius);
  background:
    radial-gradient(520px 120px at 92% -20%, #fbe6c8 0%, transparent 70%),
    linear-gradient(120deg, #fffaf1, #fdf2e3);
}

.guide-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  box-shadow: 0 4px 12px rgba(180, 83, 9, 0.22);
}

.guide-copy {
  flex: 1;
  min-width: 0;
}

.guide-kicker {
  margin: 0;
  color: var(--accent-strong);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.12em;
}

.guide-card h2 {
  margin: 1px 0 2px;
  font-size: 14.5px;
  font-weight: 650;
}

.guide-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.guide-start {
  flex: 0 0 auto;
}

.groups {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.group {
  display: flex;
  flex-direction: column;
  min-height: 158px;
  padding: 15px 14px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  transition: border-color 140ms ease, box-shadow 140ms ease,
    transform 140ms ease;
}

.group:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.group h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
}

.group-hint {
  margin: 4px 0 10px;
  color: var(--faint);
  font-size: 11.5px;
}

.group-queries {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: auto;
}

.query-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 5px 8px 5px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbf9f5;
  color: var(--ink);
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.query-chip-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.query-chip-go {
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 12px;
  opacity: 0.55;
  transition: opacity 120ms ease, transform 120ms ease;
}

.query-chip:hover {
  border-color: #e8c9a3;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.query-chip:hover .query-chip-go,
.query-chip:focus-visible .query-chip-go {
  opacity: 1;
  transform: translateX(2px);
}

.pill {
  padding: 2px 6px;
  border: 1px solid #f0d9bd;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 10px;
  letter-spacing: 0.04em;
}

/* ---------------------------------------------------------------- search */

.search-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  max-width: 1060px;
  margin: 0 auto 16px;
}

.search-head-main {
  min-width: 0;
}

.search-head h1 {
  margin: 0 0 6px;
  font-size: 26px;
  font-weight: 660;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.search-head-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
  padding-top: 5px;
}

.notice-line {
  width: 100%;
  max-width: 1060px;
  padding: 8px 12px;
  margin: 0 auto 12px;
  border: 1px solid #f0dfc6;
  border-radius: 9px;
  background: #fffaf1;
  color: var(--muted);
  font-size: 12px;
}

.result-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 1060px;
  margin: 0 auto;
}

.result-card {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  gap: 14px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  cursor: pointer;
  transition: border-color 140ms ease, box-shadow 140ms ease,
    transform 140ms ease;
}

.result-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.result-thumb {
  position: relative;
  overflow: hidden;
  border-radius: 9px;
  background:
    linear-gradient(135deg, rgba(180, 83, 9, 0.08), transparent 55%),
    linear-gradient(135deg, #ede5d8, #f7f3ec);
  aspect-ratio: 16 / 9;
}

.result-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.result-thumb.thumb-missing {
  display: grid;
  place-items: center;
}

.thumb-fallback {
  color: #a08b72;
  font-size: 10.5px;
}

.result-play {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(20, 17, 12, 0.62);
  color: #fff;
  font-size: 11px;
  opacity: 0;
  transform: translate(-50%, -50%);
  transition: opacity 140ms ease;
}

.result-card:hover .result-play,
.result-card:focus-visible .result-play {
  opacity: 1;
}

.result-duration {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(20, 17, 12, 0.66);
  color: #fff;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.result-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  padding: 2px 2px 1px 0;
}

.result-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.result-title {
  overflow: hidden;
  font-size: 13.5px;
  font-weight: 640;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-timecode {
  flex: 0 0 auto;
  color: var(--accent-strong);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.result-track {
  flex: 0 0 auto;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #faf7f2;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.result-text {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: var(--ink);
  font-size: 12.5px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.result-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.result-matched {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
}

.match-chip {
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 10.5px;
}

.result-score {
  flex: 0 0 auto;
  color: var(--faint);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.result-reason {
  overflow: hidden;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: 1060px;
  margin: 14px auto 0;
}

.result-actions .btn:disabled {
  cursor: default;
  opacity: 0.6;
}

.result-note {
  margin: 12px 0 0;
  color: var(--faint);
  font-size: 11px;
  text-align: center;
}

.zero-state {
  max-width: 560px;
  padding: 30px 26px;
  margin: 28px auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  text-align: center;
}

.zero-state h2 {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 650;
}

.zero-state p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 13px;
}

.zero-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.zero-actions .btn {
  text-decoration: none;
}

/* ---------------------------------------------------------------- player */

.player-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(20, 17, 12, 0.66);
  backdrop-filter: blur(3px);
}

.player-panel {
  display: flex;
  flex-direction: column;
  width: min(980px, 100%);
  max-height: calc(100dvh - 48px);
  overflow: hidden;
  border-radius: 16px;
  background: #17140f;
  color: #fff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

.player-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 16px 12px;
}

.player-heading {
  min-width: 0;
}

.player-kicker {
  margin: 0 0 3px;
  color: #d6b184;
  font-size: 10.5px;
  letter-spacing: 0.06em;
}

.player-head h2 {
  margin: 0 0 3px;
  overflow: hidden;
  font-size: 17px;
  font-weight: 640;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-meta {
  margin: 0;
  color: #a9a094;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}

.player-close {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  background: transparent;
  color: #d8d1c6;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.player-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.player-stage {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #000;
}

.player-video {
  display: block;
  width: 100%;
  max-height: min(56vh, 520px);
  background: #000;
}

.player-video[hidden],
.player-error[hidden] {
  display: none;
}

.player-error {
  padding: 22px 18px;
  color: #ffd9c6;
  font-size: 13px;
}

.player-error p {
  margin: 0 0 12px;
}

.player-foot {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 11px 16px 14px;
  color: #b8b0a4;
  font-size: 12px;
}

.player-text {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.player-link {
  flex: 0 0 auto;
  color: #f0c48a;
  text-decoration: none;
}

.player-link:hover {
  text-decoration: underline;
}

/* ---------------------------------------------------------------- pages */

.page-head {
  margin: 0 0 20px;
}

.page-head h1 {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 660;
  letter-spacing: -0.01em;
}

.page-sub {
  margin: 0;
  color: var(--faint);
  font-size: 12px;
}

.empty-line {
  margin: 24px 0;
  color: var(--muted);
  font-size: 13px;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.video-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}

.video-thumb {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  margin-bottom: 10px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(180, 83, 9, 0.08), transparent 55%),
    linear-gradient(135deg, #ede5d8, #f7f3ec);
  aspect-ratio: 16 / 9;
}

.video-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-thumb.thumb-missing {
  background: linear-gradient(135deg, #ede5d8, #f7f3ec);
}

.video-id {
  color: #a08b72;
  font-size: 12px;
  letter-spacing: 0.14em;
}

.video-card h3 {
  margin: 0 0 3px;
  font-size: 14px;
  font-weight: 620;
}

.video-meta {
  margin: 0 0 10px;
  color: var(--faint);
  font-size: 11.5px;
}

.btn {
  padding: 7px 12px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
}

.btn:hover {
  background: var(--accent-strong);
}

.btn.subtle {
  background: #f4f0e9;
  color: var(--ink);
}

.btn.subtle:hover {
  background: #ece5d9;
}

.history-table {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  background: var(--panel);
  font-size: 13px;
}

.history-table th {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: #fbf9f6;
  color: var(--faint);
  font-size: 11px;
  font-weight: 500;
  text-align: left;
}

.history-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
}

.history-table tr:last-child td {
  border-bottom: 0;
}

.history-table a {
  text-decoration: none;
}

.history-table a:hover {
  color: var(--accent);
}

.history-table .muted {
  color: var(--muted);
}

.table-note {
  margin: 8px 2px 0;
}

.message-card {
  padding: 14px 16px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}

.message-query {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
}

.message-meta {
  margin: 0;
  color: var(--faint);
  font-size: 11.5px;
}

.message-hits {
  margin: 8px 0 0;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}

.error-card {
  max-width: 560px;
  padding: 18px;
  border: 1px solid #f0d0c0;
  border-radius: 12px;
  background: #fff8f4;
}

.error-card h2 {
  margin: 0 0 6px;
  font-size: 15px;
}

.error-card p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
}

/* -------------------------------------------------------------- loading */

.skeleton {
  border-radius: 8px;
  background: linear-gradient(90deg, #ece7df 25%, #f6f2ec 37%, #ece7df 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}

.session-skeleton {
  height: 38px;
  margin-bottom: 8px;
}

.group-skeleton {
  min-height: 158px;
}

.video-skeleton {
  height: 186px;
}

.line {
  width: 100%;
  height: 12px;
  margin: 8px 0;
}

.line.wide {
  width: 80%;
}

.line.short {
  width: 40%;
}

.line.tall {
  height: 28px;
}

.loading-block {
  padding: 18px 0;
}

.loading-text {
  margin: 0 0 12px;
  color: var(--faint);
  font-size: 12px;
}

/* -------------------------------------------------------------- composer */

.composer {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
  width: min(1060px, calc(100% - 80px));
  padding: 8px 8px 8px 16px;
  margin: 0 auto 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: 0 6px 24px rgba(40, 32, 20, 0.06);
}

.composer:focus-within {
  border-color: #d9c3a6;
  box-shadow: 0 8px 28px rgba(40, 32, 20, 0.1);
}

.composer input {
  flex: 1;
  min-width: 0;
  height: 38px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
}

.composer input::placeholder {
  color: var(--faint);
}

.send {
  height: 38px;
  padding: 0 18px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 120ms ease, transform 120ms ease;
}

.send:hover {
  background: var(--accent-strong);
}

.send:active {
  transform: translateY(1px);
}

/* ----------------------------------------------------------------- misc */

.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  z-index: 50;
  padding: 10px 16px;
  border-radius: 999px;
  background: #1f1d1a;
  color: #fff;
  font-size: 12.5px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ------------------------------------------------------------- guidance */

.driver-popover.shipindao-tour {
  max-width: 330px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--ink);
  font-family: inherit;
  box-shadow: var(--shadow);
}

.shipindao-tour .driver-popover-title {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0;
}

.shipindao-tour .driver-popover-description {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}

.shipindao-tour .driver-popover-footer {
  margin-top: 14px;
}

.shipindao-tour .driver-popover-progress-text {
  color: var(--faint);
  font-size: 11px;
}

.shipindao-tour .driver-popover-footer-btn {
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--ink);
  font-family: inherit;
  font-size: 12px;
}

.shipindao-tour .driver-popover-footer-btn:hover {
  background: #f6f2ec;
}

.shipindao-tour .driver-popover-next-btn,
.shipindao-tour .driver-popover-done-btn {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.shipindao-tour .driver-popover-next-btn:hover,
.shipindao-tour .driver-popover-done-btn:hover {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

.shipindao-tour .driver-popover-close-btn {
  color: var(--faint);
}

.shipindao-tour .driver-popover-close-btn:hover,
.shipindao-tour .driver-popover-close-btn:focus-visible {
  color: var(--ink);
}

noscript {
  display: block;
  padding: 20px;
  color: var(--muted);
}

@keyframes shimmer {
  0% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0 50%;
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

@media (max-width: 1180px) {
  .app {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .groups {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .video-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: visible;
  }

  .app.sidebar-collapsed {
    grid-template-columns: minmax(0, 1fr);
  }

  body {
    overflow: auto;
  }

  .sidebar {
    display: none;
  }

  .main {
    min-height: 100vh;
    min-height: 100dvh;
  }

  .topbar {
    padding: 0 16px;
  }

  .view {
    overflow: visible;
    padding: 24px 18px 8px;
  }

  .composer {
    width: calc(100% - 32px);
    margin-bottom: 16px;
  }

  .groups,
  .video-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero h1 {
    font-size: 26px;
  }

  .result-card {
    grid-template-columns: 116px minmax(0, 1fr);
    gap: 10px;
  }

  .search-head {
    flex-wrap: wrap;
  }

  .search-head-actions {
    padding-top: 0;
  }

  .guide-card {
    flex-wrap: wrap;
  }

  .guide-start {
    margin-left: 48px;
  }

  .result-score {
    display: none;
  }

  .player-overlay {
    padding: 10px;
  }
}

@media (max-width: 560px) {
  .groups,
  .video-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .topbar-meta {
    display: none;
  }

  .result-top {
    flex-wrap: wrap;
    gap: 4px 8px;
  }

  .player-head h2 {
    white-space: normal;
  }

  .player-foot {
    flex-direction: column;
    gap: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
