/* Skim — лаконичная тёмная тема, акцент жёлтый. */
:root {
  --bg: #0a0a0a;
  --bg-soft: #131313;
  --bg-card: #161616;
  --border: #262626;
  --border-strong: #333;
  --fg: #ededed;
  --muted: #9a9a9a;
  --dim: #6b6b6b;
  --accent: #fde047;
  --accent-soft: #fde04722;
  --danger: #f87171;
  --radius: 14px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, "Inter", "SF Pro Text", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100dvh;
  background:
    radial-gradient(circle at 20% -10%, #1c1c1c 0%, transparent 50%),
    radial-gradient(circle at 90% 10%, #181818 0%, transparent 45%),
    var(--bg);
}

.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100dvh;
}

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 64px 24px 96px;
  width: 100%;
}

/* SIDEBAR */
.sidebar {
  background: #0d0d0d;
  border-right: 1px solid var(--border);
  padding: 24px 14px;
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow-y: auto;
  scrollbar-width: thin;
}
.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.sidebar-head h3 {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}
.ghost-mini {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 16px;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  line-height: 1;
}
.ghost-mini:hover {
  color: var(--fg);
  background: #1c1c1c;
  border-color: var(--border-strong);
}
.ghost-mini.danger:hover {
  color: var(--danger);
  border-color: var(--danger);
}

.history {
  list-style: none;
  margin: 0;
  padding: 0;
}
.history .empty {
  padding: 12px 8px;
  text-align: center;
}
.history-item {
  padding: 10px 10px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  margin-bottom: 4px;
  transition: background .12s, border-color .12s;
}
.history-item:hover {
  background: #161616;
  border-color: var(--border);
}
.history-item.active {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.history-item .h-title {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--fg);
  line-height: 1.35;
  margin: 0 0 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.history-item .h-meta {
  font-size: 11.5px;
  color: var(--dim);
  display: flex;
  gap: 6px;
  align-items: center;
}
.history-item .h-meta .h-channel {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.meta-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  justify-content: space-between;
}
.meta-top h2 { flex: 1; }

.cached-tag {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 12px;
  font-weight: 500;
}

/* HEADER */
.hero { margin-bottom: 40px; }
.hero h1 {
  font-size: 56px;
  font-weight: 800;
  letter-spacing: -0.04em;
  margin: 0 0 12px;
  line-height: 1;
}
.hero h1 .dot { color: var(--accent); }
.tagline {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  max-width: 560px;
}
.tagline .aside {
  display: inline-block;
  margin-top: 6px;
  color: var(--dim);
  font-size: 14.5px;
}

/* FORM CARD */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 28px;
}
.label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}
.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
input[type="url"] {
  flex: 1 1 320px;
  min-width: 0;
  background: var(--bg-soft);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 14px 16px;
  color: var(--fg);
  font: 15px var(--mono);
  outline: none;
  transition: border-color .15s;
}
input[type="url"]::placeholder { color: var(--dim); }
input[type="url"]:focus { border-color: var(--accent); }

button, .ghost {
  cursor: pointer;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--bg-soft);
  color: var(--fg);
  padding: 14px 20px;
  transition: background .15s, border-color .15s, transform .05s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}
button:hover, .ghost:hover {
  background: #1d1d1d;
  border-color: var(--accent);
}
button:active { transform: translateY(1px); }

#go {
  background: var(--accent);
  color: #0a0a0a;
  border-color: var(--accent);
}
#go:hover { background: #fef08a; border-color: #fef08a; }
#go[disabled] { opacity: 0.6; cursor: progress; }

.btn-spin {
  width: 14px;
  height: 14px;
  border: 2px solid #0a0a0a44;
  border-top-color: #0a0a0a;
  border-radius: 50%;
  display: none;
  animation: spin .8s linear infinite;
}
#go.loading .btn-label { opacity: 0.5; }
#go.loading .btn-spin { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.hint { margin: 12px 0 0; font-size: 13px; color: var(--dim); }

/* RESULT */
.hidden { display: none !important; }

.result { margin-top: 28px; }
.meta { margin-bottom: 18px; }
.meta h2 {
  font-size: 22px;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
  line-height: 1.3;
}
.meta-line {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}
.sep { color: var(--dim); margin: 0 8px; }

.tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 12px 14px;
  color: var(--muted);
  font-size: 14.5px;
  font-weight: 500;
  white-space: nowrap;
}
.tab:hover { color: var(--fg); background: transparent; }
.tab.active {
  color: var(--fg);
  border-bottom-color: var(--accent);
}

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.panel-tools {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.panel-tools .ghost {
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
}

.content {
  white-space: pre-wrap;
  word-wrap: break-word;
  font: 15px/1.7 var(--sans);
  color: var(--fg);
  margin: 0;
  max-height: 60vh;
  overflow-y: auto;
  padding: 4px;
}
/* Summary rendering — markdown-ish */
.summary {
  font-size: 15.5px;
  line-height: 1.7;
}
.summary h1, .summary h2, .summary h3 {
  font-size: 16px;
  margin: 18px 0 8px;
  letter-spacing: -0.005em;
}
.summary ul, .summary ol { padding-left: 20px; }
.summary li { margin: 4px 0; }
.summary p { margin: 10px 0; }
.summary strong { color: var(--accent); font-weight: 600; }

.summary-placeholder {
  text-align: center;
  padding: 32px 16px;
  color: var(--muted);
}
.summary-placeholder button {
  margin-top: 14px;
  background: var(--accent);
  color: #0a0a0a;
  border-color: var(--accent);
}
.summary-placeholder button:hover { background: #fef08a; }
.summary-placeholder .joke { color: var(--dim); font-size: 13px; margin-top: 12px; }

/* ERROR */
.err {
  background: #2a1414;
  border: 1px solid #5a2a2a;
  border-radius: var(--radius);
  padding: 18px;
  margin-top: 24px;
  color: #fecaca;
}
.err p { margin: 0 0 12px; }

/* FOOTER */
footer {
  margin-top: 64px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 14px;
}
footer p { margin: 6px 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; color: var(--dim); }

/* USER BAR */
.user-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.user-bar form { margin: 0; }
.user-bar .ghost-mini { font-size: 13px; padding: 4px 10px; }

/* LOGIN PAGE */
body.centered { display: grid; place-items: center; padding: 24px; }
.login-wrap {
  max-width: 460px;
  width: 100%;
  text-align: center;
}
.login-logo {
  font-size: 64px;
  font-weight: 800;
  letter-spacing: -0.04em;
  margin: 0 0 12px;
  line-height: 1;
}
.login-logo .dot { color: var(--accent); }
.login-tagline {
  color: var(--muted);
  font-size: 16px;
  margin: 0 0 32px;
  line-height: 1.55;
}
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 24px;
  margin-bottom: 24px;
}
.login-hint {
  color: var(--muted);
  font-size: 14.5px;
  margin: 0 0 20px;
  line-height: 1.55;
}
.tg-login-slot {
  display: flex;
  justify-content: center;
  min-height: 50px;
}
.login-state {
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 12px;
}
.login-state.pending { color: var(--accent); }
.login-state.banned { color: var(--danger); }
.login-foot {
  margin-top: 24px;
}
.login-foot a {
  color: var(--accent);
  text-decoration: none;
}
.login-foot a:hover { text-decoration: underline; }

/* mobile */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    max-height: 240px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}
@media (max-width: 560px) {
  main { padding: 32px 16px 64px; }
  .hero h1 { font-size: 42px; }
  .tagline { font-size: 16px; }
  #go { width: 100%; justify-content: center; }
  input[type="url"] { flex-basis: 100%; }
}
