/* SnipMD Web — compact dark theme.
   Palette/type scale follow Sources/SnipAI/Resources/PrivacyPolicy.html
   (brand #5B5BFF, SF system stack, 8px radius language), inverted to dark. */

:root {
  --brand: #5B5BFF;
  --brand-soft: #2a2a66;
  --text: #e8e8ed;
  --muted: #9a9aa3;
  --rule: #33333a;
  --bg: #141416;
  --bg-soft: #1d1d21;
  --bg-card: #1a1a1f;
  --danger: #ff6b6b;
  --ok: #4cd964;
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "PingFang SC", sans-serif;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

button {
  font: inherit;
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 6px 14px;
  cursor: pointer;
}
button:hover { border-color: var(--brand); }
button.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 600;
  padding: 10px 22px;
}
button:disabled { opacity: 0.45; cursor: default; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }

/* ---- splash / signed-out ---- */
.center-view {
  max-width: 560px;
  margin: 0 auto;
  padding: 96px 24px 64px;
  text-align: center;
}
.center-view h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}
.center-view h1::after {
  content: '';
  display: block;
  width: 56px;
  height: 3px;
  background: var(--brand);
  border-radius: 2px;
  margin: 14px auto 0;
}
.center-view p { font-size: 15px; color: var(--muted); }
.retry-hint { margin-top: 18px; font-size: 13px; }

/* ---- banners / errors ---- */
.banner {
  max-width: 760px;
  margin: 16px auto 0;
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--bg-soft);
  border-left: 3px solid var(--danger);
  font-size: 14px;
}
.banner.warn { border-left-color: #ffcc00; }
.banner code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12.5px;
  background: var(--bg);
  padding: 1px 5px;
  border-radius: 3px;
}

/* ---- main layout ---- */
.layout {
  display: flex;
  height: 100vh;
}
.sidebar {
  width: 300px;
  min-width: 300px;
  border-right: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
}
.sidebar-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-header h2 { font-size: 15px; margin: 0; flex: 1; }
.item-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}
.sidebar-footer {
  padding: 10px;
  border-top: 1px solid var(--rule);
  text-align: center;
}

.item {
  display: flex;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  align-items: center;
}
.item:hover { background: var(--bg-soft); }
.item.selected { background: var(--brand-soft); }
.item img {
  width: 64px;
  height: 44px;
  object-fit: contain;
  background: #000;
  border-radius: 5px;
  flex-shrink: 0;
}
.item .thumb-placeholder {
  width: 64px;
  height: 44px;
  background: var(--bg-soft);
  border-radius: 5px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 18px;
}
.item .meta { min-width: 0; flex: 1; }
.item .time { font-size: 12.5px; }
.item .preview {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.badge {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand);
  margin-left: 6px;
  vertical-align: 1px;
}

/* ---- detail ---- */
.detail {
  flex: 1;
  overflow-y: auto;
  padding: 20px 28px 64px;
}
.detail-empty {
  display: flex;
  height: 100%;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}
.detail img.full {
  max-width: 100%;
  max-height: 46vh;
  object-fit: contain;
  background: #000;
  border-radius: 8px;
  border: 1px solid var(--rule);
}
.detail .actions {
  display: flex;
  gap: 10px;
  margin: 14px 0;
  align-items: center;
}
.detail h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 22px 0 8px;
}
.markdown-body {
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 14px 18px;
  font-size: 14px;
  overflow-wrap: anywhere;
}
.markdown-body pre, pre.raw {
  background: var(--bg);
  border: 1px solid var(--rule);
  padding: 10px 12px;
  border-radius: 6px;
  overflow-x: auto;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12.5px;
}
pre.raw { white-space: pre-wrap; }

@media (max-width: 760px) {
  .layout { flex-direction: column; height: auto; }
  .sidebar { width: 100%; min-width: 0; border-right: none; border-bottom: 1px solid var(--rule); }
  .item-list { max-height: 40vh; }
}
