:root {
  --bg: #12121f;
  --bg-dark: #1a1a2e;
  --card: #16213e;
  --panel: #0f3460;
  --accent: #3b82f6;
  --accent-h: #2563eb;
  --green: #27ae60;
  --green-h: #219a52;
  --purple: #8b5cf6;
  --purple-h: #7c3aed;
  --amber: #f59e0b;
  --amber-h: #d97706;
  --slate: #475569;
  --slate-h: #334155;
  --t1: #e0e0e0;
  --t2: #a7b0c3;
  --border: #2a2a4a;
  --radius: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--t1);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.hidden { display: none !important; }

/* top bar */
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.brand { font-size: 20px; font-weight: 800; color: var(--t2); margin-right: 6px; white-space: nowrap; }
.brand span { color: var(--accent); }

#search {
  flex: 1 1 260px; min-width: 160px;
  background: var(--bg-dark); color: var(--t1);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 12px; font-size: 14px; outline: none;
}
#search:focus { border-color: var(--accent); }

select {
  background: var(--bg-dark); color: var(--t1);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 10px; font-size: 13px; max-width: 220px; outline: none;
  appearance: auto;
}

.btn {
  background: var(--slate); color: #fff; border: none; cursor: pointer;
  border-radius: 8px; padding: 9px 14px; font-size: 13px; font-weight: 600;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--slate-h); }
.btn.accent { background: var(--accent); }
.btn.accent:hover { background: var(--accent-h); }
.btn.green { background: var(--green); }
.btn.green:hover { background: var(--green-h); }
.btn.purple { background: var(--purple); }
.btn.purple:hover { background: var(--purple-h); }
.btn.amber { background: var(--amber); }
.btn.amber:hover { background: var(--amber-h); }
.btn.small { padding: 6px 10px; font-size: 12px; }
.btn.lang { background: #6d28d9; }
.btn.lang:hover { background: #5b21b6; }

/* loading panel */
.load-panel {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
}
.spinner {
  width: 46px; height: 46px; border-radius: 50%;
  border: 5px solid var(--card); border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.bar { width: min(420px, 70vw); height: 8px; background: var(--card); border-radius: 6px; overflow: hidden; }
#barFill { height: 100%; width: 0%; background: var(--accent); transition: width 0.2s; }

/* main layout */
.app { flex: 1; display: grid; grid-template-columns: 420px 1fr; min-height: 0; }
@media (max-width: 860px) { .app { grid-template-columns: 1fr; } .list-col { display: none; } }

.list-col { display: flex; flex-direction: column; background: var(--panel); min-height: 0; }
.list-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; color: var(--t2); font-size: 13px;
}
#list { flex: 1; overflow-y: auto; padding: 0 6px 12px; }

.prompt-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px; margin-bottom: 6px;
  cursor: pointer; display: flex; gap: 10px; align-items: flex-start;
}
.prompt-card:hover, .prompt-card.active { border-color: var(--accent); }
.prompt-card .thumb { width: 92px; height: 52px; object-fit: cover; border-radius: 6px; background: var(--bg-dark); flex: none; }
.prompt-card .body { min-width: 0; }
.prompt-card .title { font-size: 13px; font-weight: 700; margin-bottom: 3px; line-height: 1.25; }
.prompt-card .sub { font-size: 11px; color: var(--t2); }
.prompt-card .sub b { color: var(--t1); font-weight: 600; }

.more-btn {
  display: block; width: calc(100% - 10px); margin: 8px auto 0;
  background: var(--slate-h); color: #fff; border: none; cursor: pointer;
  border-radius: 8px; padding: 10px; font-size: 13px;
}
.more-btn:hover { background: var(--slate); }

/* detail */
.detail-col { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; padding: 16px 20px; gap: 14px; }
.empty { color: var(--t2); margin: auto; font-size: 15px; }

.detail-head { display: flex; gap: 16px; align-items: flex-start; }
.thumb-wrap { position: relative; width: 320px; flex: none; }
.thumb-wrap img { width: 100%; border-radius: var(--radius); display: block; background: var(--bg-dark); }
.thumb-wrap video { width: 100%; border-radius: var(--radius); display: none; }
.thumb-wrap.video-open img { display: none; }
.thumb-wrap.video-open video { display: block; }
.play-badge {
  position: absolute; inset: 0; margin: auto; width: 52px; height: 52px;
  background: rgba(15, 52, 96, 0.75); border: 2px solid #fff; border-radius: 50%;
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 18px; cursor: pointer; pointer-events: none;
}

.detail-text { min-width: 0; }
.detail-text h1 { font-size: 17px; margin-bottom: 6px; line-height: 1.3; }
.detail-text .meta { font-size: 12.5px; color: var(--t2); line-height: 1.5; }
.detail-text .cats { font-size: 12px; color: var(--accent); margin-top: 6px; line-height: 1.5; }

.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.actions .lang-note { font-size: 12px; color: var(--t2); margin-left: auto; }

.prompt-text {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; font-family: Consolas, "Courier New", monospace; font-size: 13.5px;
  line-height: 1.55; white-space: pre-wrap; word-break: break-word; color: var(--t1);
  max-height: 46vh; overflow-y: auto;
}

/* footer */
.statusbar {
  padding: 7px 16px; font-size: 11.5px; color: var(--t2);
  background: var(--bg-dark); border-top: 1px solid var(--border);
}

/* scrollbar */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--slate); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }