/* ── HelixNews design system ─────────────────────────────────────────── */
:root {
  --bg: #0A0E20;
  --bg-2: #0E1430;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-2: rgba(255, 255, 255, 0.06);
  --stroke: rgba(255, 255, 255, 0.09);
  --stroke-2: rgba(255, 255, 255, 0.14);
  --text: #EAECFB;
  --muted: #9AA3CF;
  --faint: #6B739E;
  --brand: #6D5EF6;
  --brand-2: #8B7CFF;
  --cyan: #17C3E0;
  --gold: #FFC53D;
  --danger: #FF5D73;
  --ok: #35D6A4;
  --grad: linear-gradient(135deg, #6D5EF6 0%, #5B4BE8 45%, #0BB5D6 100%);
  --grad-soft: linear-gradient(135deg, rgba(109,94,246,.16), rgba(11,181,214,.10));
  --shadow: 0 18px 50px -20px rgba(0,0,0,.7);
  --r: 18px;
  --r-sm: 12px;
  --maxw: 780px;
  --sans: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: var(--sans);
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 15% -10%, rgba(109,94,246,.28), transparent 60%),
    radial-gradient(1000px 600px at 100% 0%, rgba(11,181,214,.18), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input, select { font-family: inherit; }
::selection { background: rgba(109,94,246,.4); }
.hidden { display: none !important; }
/* inline icon SVGs default to text size (specific contexts like .nav/.pill override below).
   Without this, unconstrained 24x24 icons render at their intrinsic size — huge on wide screens. */
svg { width: 1.15em; height: 1.15em; vertical-align: -0.16em; flex-shrink: 0; }

/* scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.16); }

/* ── layout ──────────────────────────────────────────────────────────── */
.app { max-width: var(--maxw); margin: 0 auto; min-height: 100%; padding-bottom: 96px; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  backdrop-filter: blur(18px) saturate(140%);
  background: linear-gradient(180deg, rgba(10,14,32,.86), rgba(10,14,32,.55));
  border-bottom: 1px solid var(--stroke);
}
.brand { display: flex; align-items: center; gap: 11px; font-weight: 800; letter-spacing: -.3px; font-size: 19px; }
.brand img { width: 34px; height: 34px; border-radius: 9px; box-shadow: 0 6px 18px -6px rgba(109,94,246,.8); }
.brand b { background: linear-gradient(90deg, #fff, #C9D2FF); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand .live { font-size: 10px; font-weight: 700; color: var(--cyan); border: 1px solid rgba(23,195,224,.4); padding: 2px 7px; border-radius: 20px; letter-spacing: .6px; }
.topbar .spacer { flex: 1; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--stroke); color: var(--muted);
  position: relative; transition: .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--stroke-2); }
.icon-btn .dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 2px var(--bg); }

/* ── page containers ─────────────────────────────────────────────────── */
.page { padding: 20px 18px; animation: fade .3s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--faint); font-weight: 700; margin: 4px 2px 12px; }

/* ── cards ───────────────────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--stroke); border-radius: var(--r);
  box-shadow: var(--shadow); overflow: hidden;
}
.card.pad { padding: 18px; }

/* ── story cards ─────────────────────────────────────────────────────── */
.feed { display: flex; flex-direction: column; gap: 14px; }
.day-sep { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; margin: 8px 2px 0; }
.day-sep::after { content: ""; flex: 1; height: 1px; background: var(--stroke); }

.story {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 14px;
  background: var(--surface); border: 1px solid var(--stroke); border-radius: var(--r);
  padding: 16px; position: relative; transition: .18s; overflow: hidden;
}
.story::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--grad); opacity: .0; transition: .18s; }
.story:hover { border-color: var(--stroke-2); transform: translateY(-1px); background: var(--surface-2); }
.story:hover::before { opacity: 1; }
.story.pushed::before { opacity: 1; }
.story .headline { grid-column: 1; font-weight: 700; font-size: 16.5px; letter-spacing: -.2px; line-height: 1.32; }
.story .meta { grid-column: 1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--muted); font-size: 12.5px; margin-top: 8px; }
.story .snippet { grid-column: 1 / -1; color: var(--muted); font-size: 13.5px; margin-top: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.story .thumb { grid-row: 1 / span 2; grid-column: 2; width: 84px; height: 84px; border-radius: 12px; object-fit: cover; background: var(--surface-2); border: 1px solid var(--stroke); }
.story .actions { grid-column: 1 / -1; display: flex; gap: 10px; margin-top: 12px; }
.story { touch-action: pan-y; }               /* we own horizontal; browser keeps vertical scroll */
.story.swiping { user-select: none; cursor: grabbing; }
.story .dismiss {
  position: absolute; top: 8px; right: 8px; z-index: 3;
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(10, 14, 32, 0.6); backdrop-filter: blur(6px);
  border: 1px solid var(--stroke); color: var(--muted);
  opacity: 0.55; transition: opacity .15s, background .15s, color .15s, transform .15s;
}
.story .dismiss svg { width: 15px; height: 15px; }
.story:hover .dismiss { opacity: 1; }
.story .dismiss:hover { background: rgba(255, 93, 115, 0.9); color: #fff; border-color: transparent; transform: scale(1.08); }
/* nudge the headline clear of the dismiss button so long titles don't run under it */
.story .headline { padding-right: 30px; }

.feed-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; padding: 0 2px; }

.chip { font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 20px; border: 1px solid var(--stroke-2); color: var(--muted); background: var(--surface-2); white-space: nowrap; }
.chip.src { color: var(--text); }
.chip.push { color: var(--gold); border-color: rgba(255,197,61,.35); background: rgba(255,197,61,.1); }
.imp { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; }
.imp .bar { width: 46px; height: 6px; border-radius: 6px; background: rgba(255,255,255,.1); overflow: hidden; }
.imp .bar i { display: block; height: 100%; background: var(--grad); }
.imp.hot { color: var(--gold); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 18px; border-radius: 12px; font-weight: 700; font-size: 14.5px; transition: .16s; border: 1px solid transparent; }
.btn.primary { background: var(--grad); color: #fff; box-shadow: 0 12px 30px -12px rgba(109,94,246,.9); }
.btn.primary:hover { filter: brightness(1.07); transform: translateY(-1px); }
.btn.ghost { background: var(--surface); border-color: var(--stroke); color: var(--text); }
.btn.ghost:hover { background: var(--surface-2); border-color: var(--stroke-2); }
.btn.sm { padding: 8px 13px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ── empty / skeleton ────────────────────────────────────────────────── */
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty .ico { font-size: 44px; margin-bottom: 14px; opacity: .85; }
.empty h3 { color: var(--text); font-size: 18px; margin-bottom: 6px; }
.skel { height: 108px; border-radius: var(--r); background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%); background-size: 200% 100%; animation: sh 1.3s infinite; }
@keyframes sh { to { background-position: -200% 0; } }

/* ── bottom nav ──────────────────────────────────────────────────────── */
.nav {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%);
  width: min(calc(100% - 28px), 460px); z-index: 40;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
  padding: 7px; border-radius: 20px;
  background: rgba(16,20,48,.82); backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid var(--stroke-2); box-shadow: var(--shadow);
}
.nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px; border-radius: 14px; color: var(--faint); font-size: 11px; font-weight: 700; transition: .15s; }
.nav a svg { width: 22px; height: 22px; }
.nav a.active { color: #fff; background: var(--grad-soft); }
.nav a.active svg { filter: drop-shadow(0 2px 8px rgba(109,94,246,.7)); }
.nav a:hover { color: var(--text); }

/* ── forms ───────────────────────────────────────────────────────────── */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 7px; }
.input {
  width: 100%; padding: 13px 15px; border-radius: var(--r-sm);
  background: rgba(0,0,0,.25); border: 1px solid var(--stroke); color: var(--text); font-size: 15px; transition: .15s;
}
.input:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(109,94,246,.22); }
.input::placeholder { color: var(--faint); }

/* interest tags */
.tags { display: flex; flex-wrap: wrap; gap: 9px; }
.tag { display: inline-flex; align-items: center; gap: 8px; padding: 8px 13px; border-radius: 20px; background: var(--grad-soft); border: 1px solid var(--stroke-2); font-size: 14px; font-weight: 600; animation: pop .2s ease; }
@keyframes pop { from { transform: scale(.8); opacity: 0; } to { transform: none; opacity: 1; } }
.tag button { color: var(--faint); font-size: 17px; line-height: 1; }
.tag button:hover { color: var(--danger); }
.suggest { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.suggest button { padding: 7px 12px; border-radius: 18px; border: 1px dashed var(--stroke-2); color: var(--muted); font-size: 13px; transition: .14s; }
.suggest button:hover { color: var(--text); border-color: var(--brand-2); background: var(--surface); }

/* range / toggle */
.dial { margin: 6px 0 2px; }
input[type=range] { -webkit-appearance: none; width: 100%; height: 8px; border-radius: 8px; background: linear-gradient(90deg, var(--brand), var(--cyan)); outline: none; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 3px solid var(--brand); box-shadow: 0 4px 12px rgba(0,0,0,.4); cursor: pointer; }
.dial-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--faint); margin-top: 8px; }
.toggle { position: relative; width: 52px; height: 30px; border-radius: 30px; background: rgba(255,255,255,.12); transition: .2s; border: 1px solid var(--stroke); flex-shrink: 0; }
.toggle.on { background: var(--grad); }
.toggle i { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 2px 6px rgba(0,0,0,.4); }
.toggle.on i { left: 25px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 15px 0; border-bottom: 1px solid var(--stroke); }
.row:last-child { border-bottom: 0; }
.row .lbl { font-weight: 600; }
.row .sub { font-size: 12.5px; color: var(--faint); margin-top: 3px; }

/* ── auth / landing ──────────────────────────────────────────────────── */
.hero { text-align: center; padding: 40px 22px 24px; }
.hero .logo { width: 88px; height: 88px; border-radius: 22px; margin: 0 auto 20px; box-shadow: 0 22px 55px -20px rgba(109,94,246,.9); animation: float 5s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.hero h1 { font-size: clamp(28px, 7vw, 40px); letter-spacing: -1px; line-height: 1.08; font-weight: 800; }
.hero h1 .g { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--muted); font-size: 16px; max-width: 460px; margin: 14px auto 0; }
.pills { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 22px 0 6px; }
.pill { font-size: 12.5px; color: var(--muted); background: var(--surface); border: 1px solid var(--stroke); padding: 7px 13px; border-radius: 20px; display: inline-flex; align-items: center; gap: 7px; }
.pill svg { width: 15px; height: 15px; color: var(--cyan); }

.authcard { max-width: 420px; margin: 8px auto 0; }
.seg { display: flex; background: rgba(0,0,0,.25); border: 1px solid var(--stroke); border-radius: 12px; padding: 4px; margin-bottom: 18px; }
.seg button { flex: 1; padding: 9px; border-radius: 9px; font-weight: 700; font-size: 14px; color: var(--muted); transition: .15s; }
.seg button.active { background: var(--grad); color: #fff; }
.err { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 16px; text-align: center; }

/* onboarding steps */
.steps { display: flex; gap: 6px; justify-content: center; margin-bottom: 22px; }
.steps i { width: 34px; height: 5px; border-radius: 5px; background: var(--stroke); transition: .25s; }
.steps i.on { background: var(--grad); width: 44px; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%) translateY(20px); z-index: 100; background: rgba(16,20,48,.96); border: 1px solid var(--stroke-2); color: var(--text); padding: 13px 18px; border-radius: 14px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow); opacity: 0; transition: .25s; pointer-events: none; max-width: 90%; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok { border-color: rgba(53,214,164,.5); }
.toast.err { border-color: rgba(255,93,115,.5); }

/* banner */
.banner { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--r); background: var(--grad-soft); border: 1px solid var(--stroke-2); margin-bottom: 16px; }
.banner .txt { flex: 1; font-size: 13.5px; }
.banner .txt b { display: block; margin-bottom: 2px; }

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0; }
.stat { text-align: center; background: var(--surface); border: 1px solid var(--stroke); border-radius: 14px; padding: 14px 8px; }
.stat b { display: block; font-size: 22px; font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat span { font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .5px; }

.center-col { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; }
