:root {
  --bg: #0f1115;
  --card: #171a21;
  --text: #eceef2;
  --muted: #9aa1ad;
  --accent: #f2b84b;
  --line: #262a33;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overscroll-behavior: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
[hidden] { display: none !important; }

#bar {
  position: fixed; inset: 0 0 auto 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: linear-gradient(var(--bg) 40%, transparent);
}
#bar .logo { font-weight: 800; font-size: 22px; letter-spacing: .5px; color: var(--accent); }
#bar button { font-size: 20px; padding: 6px 8px; opacity: .85; }

#feed {
  height: 100dvh; overflow-y: auto;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
}
#feed::-webkit-scrollbar { display: none; }

.card {
  height: 100dvh; scroll-snap-align: start; scroll-snap-stop: always;
  display: flex; flex-direction: column; justify-content: center;
  padding: calc(env(safe-area-inset-top) + 70px) 24px calc(env(safe-area-inset-bottom) + 40px);
  max-width: 680px; margin: 0 auto; position: relative;
}
.card::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(120% 60% at 0% 0%, hsl(var(--hue) 60% 30% / .35), transparent 60%);
}
.meta { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; font-size: 13px; }
.topic { padding: 4px 10px; border-radius: 99px; background: hsl(var(--hue) 55% 45% / .25); color: hsl(var(--hue) 80% 78%); font-weight: 600; }
.kind { color: var(--muted); text-transform: uppercase; letter-spacing: 1px; font-size: 11px; }
.title { font-size: clamp(26px, 7vw, 38px); line-height: 1.15; margin: 0 0 18px; font-weight: 750; cursor: pointer; }
.hook { font-size: 18px; line-height: 1.55; color: #cfd3da; margin: 0; cursor: pointer; }
.actions { display: flex; gap: 8px; margin-top: 32px; align-items: center; }
.actions button { font-size: 20px; width: 48px; height: 48px; border-radius: 50%; background: var(--card); border: 1px solid var(--line); transition: transform .1s; }
.actions button:active { transform: scale(.9); }
.actions button.on { background: hsl(var(--hue) 55% 45% / .35); border-color: hsl(var(--hue) 60% 55%); }
.actions .read { width: auto; padding: 0 22px; border-radius: 99px; font-size: 16px; font-weight: 600; margin-left: auto; background: var(--accent); color: #1a1406; border: 0; }
.follow { margin-top: 18px; align-self: flex-start; font-size: 14px; color: var(--accent); border: 1px dashed var(--accent); padding: 8px 14px; border-radius: 99px; }

.card.info { text-align: center; align-items: center; color: var(--muted); }
.card.info h2 { color: var(--text); }
.spinner { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 20px; }
@keyframes spin { to { transform: rotate(360deg); } }

.sheet { position: fixed; inset: 0; z-index: 10; background: rgb(0 0 0 / .55); display: flex; align-items: flex-end; justify-content: center; }
.sheet-inner {
  background: var(--card); width: 100%; max-width: 720px; max-height: 92dvh; overflow-y: auto;
  border-radius: 20px 20px 0 0; padding: 26px 24px calc(env(safe-area-inset-bottom) + 40px); position: relative;
  animation: up .2s ease-out;
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.close { position: sticky; top: 0; float: right; font-size: 18px; width: 36px; height: 36px; border-radius: 50%; background: var(--line); }
.sheet h2 { font-size: 26px; line-height: 1.2; margin: 8px 0 18px; }
.sheet h3 { margin: 26px 0 10px; font-size: 15px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.body p { font-size: 18px; line-height: 1.65; color: #d9dce2; }
.sources a { display: block; color: var(--accent); margin: 6px 0; font-size: 14px; word-break: break-word; }
.sheet .actions { margin-top: 24px; }

.interest { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.interest .name { flex: 1; }
.interest .bar { width: 70px; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.interest .bar i { display: block; height: 100%; background: var(--accent); }
.interest button { color: var(--muted); padding: 4px 8px; }
.add { display: flex; gap: 8px; margin: 16px 0; }
.add input, #login input {
  flex: 1; font: inherit; font-size: 16px; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
}
.add button, #login button { background: var(--accent); color: #1a1406; font-weight: 600; padding: 0 18px; border-radius: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { border: 1px solid var(--line); padding: 7px 12px; border-radius: 99px; font-size: 14px; color: var(--muted); }
.hint { color: var(--muted); font-size: 14px; line-height: 1.5; }

.saved-item { padding: 14px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.saved-item b { display: block; margin-bottom: 4px; }
.saved-item span { color: var(--muted); font-size: 13px; }

.screen { position: fixed; inset: 0; z-index: 20; background: var(--bg); display: flex; align-items: center; justify-content: center; }
#login form { display: flex; flex-direction: column; gap: 12px; width: min(320px, 86vw); }
#login h1 { color: var(--accent); text-align: center; }
#login button { padding: 12px; }
.error { color: #ff7b7b; min-height: 1em; text-align: center; }
