:root{
  --bg:#0b0d12;
  --card:#101420;
  --card2:#0f1320;
  --text:#e9ecf1;
  --muted:#a7b0c0;
  --line:rgba(255,255,255,.08);
  --accent:#b3001b;
  --accent2:#ff3b5c;
  --ok:#36d399;
  --warn:#fbbf24;
  --err:#fb7185;

  --radius:18px;
  --shadow:0 10px 30px rgba(0,0,0,.35);
  --serif: ui-serif, Georgia, "Times New Roman", serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  background:radial-gradient(1200px 800px at 20% -10%, rgba(179,0,27,.25), transparent 60%),
             radial-gradient(900px 600px at 110% 0%, rgba(255,59,92,.12), transparent 55%),
             var(--bg);
  color:var(--text);
  font-family:var(--sans);
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
}

.skip{
  position:absolute; left:-999px; top:auto; width:1px; height:1px; overflow:hidden;
}
.skip:focus{
  left:12px; top:12px; width:auto; height:auto;
  background:var(--card); padding:10px 12px; border-radius:12px; z-index:9999;
}

.topbar{
  position:sticky; top:0; z-index:50;
  backdrop-filter: blur(12px);
  background: linear-gradient(to bottom, rgba(11,13,18,.92), rgba(11,13,18,.72));
  border-bottom:1px solid var(--line);
  padding: env(safe-area-inset-top) 14px 10px 14px;
}

.topbar__row{
  display:grid;
  grid-template-columns: 1.2fr 2fr 1fr;
  gap:12px;
  align-items:center;
}

.brand{display:flex; gap:10px; align-items:center}
.brand__mark{
  width:40px;height:40px;border-radius:14px;
  background:linear-gradient(135deg,var(--accent),#5a0010);
  display:grid;place-items:center;
  font-weight:900;
  box-shadow:0 10px 22px rgba(179,0,27,.35);
}
.brand__name{font-weight:900; letter-spacing:.06em}
.brand__tag{font-size:12px; color:var(--muted)}

.topbar__actions{display:flex; gap:10px; justify-content:flex-end; align-items:center}

.refreshline{
  background:rgba(16,20,32,.65);
  border:1px solid var(--line);
  border-radius:16px;
  padding:10px 12px;
}
.refreshline__text{
  font-size:12px; color:var(--muted);
  display:flex; flex-wrap:wrap; gap:8px; align-items:center;
}
.refreshline__text strong{color:var(--text)}
.dot{opacity:.5}

.progress{
  margin-top:8px;
  height:8px;
  border-radius:999px;
  background:rgba(255,255,255,.06);
  overflow:hidden;
}
.progress__bar{
  height:100%;
  background:linear-gradient(90deg,var(--accent),var(--accent2));
  width:0%;
  transition:width .18s ease;
}

.pills{
  display:flex; gap:8px;
  margin-top:10px;
  padding-bottom:4px;
  overflow:auto;
  -webkit-overflow-scrolling: touch;
}
.pill{
  touch-action: manipulation;
  border:1px solid var(--line);
  background:rgba(16,20,32,.55);
  color:var(--text);
  padding:9px 12px;
  border-radius:999px;
  font-size:13px;
  white-space:nowrap;
  cursor:pointer;
}
.pill[aria-pressed="true"]{
  border-color:rgba(179,0,27,.45);
  background:rgba(179,0,27,.18);
}

.main{
  padding:18px 14px 60px 14px;
  max-width:1180px;
  margin:0 auto;
}

.section{margin-top:20px}
.section__head{
  display:flex; align-items:flex-end; justify-content:space-between;
  gap:12px;
}
.section__title{
  font-family:var(--serif);
  font-weight:900;
  font-size:28px;
  margin:0;
  letter-spacing:.01em;
}
.section__actions{display:flex; gap:10px; align-items:center}

.hint{
  margin-top:8px;
  font-size:13px;
  color:var(--muted);
}

.btn{
  touch-action: manipulation;
  border:1px solid rgba(179,0,27,.35);
  background:linear-gradient(135deg, rgba(179,0,27,.95), rgba(255,59,92,.55));
  color:var(--text);
  padding:10px 12px;
  border-radius:14px;
  cursor:pointer;
  font-weight:800;
}
.btn:active{transform:translateY(1px)}
.btn--ghost{
  border:1px solid var(--line);
  background:rgba(16,20,32,.55);
  font-weight:700;
}

.storylist{
  margin-top:12px;
  display:grid;
  gap:10px;
}

.card{
  border:1px solid var(--line);
  border-radius:var(--radius);
  background:linear-gradient(to bottom, rgba(16,20,32,.92), rgba(16,20,32,.72));
  box-shadow:var(--shadow);
  overflow:hidden;
}
.card__inner{padding:12px 12px 10px 12px}
.card__top{
  display:flex; align-items:flex-start; justify-content:space-between; gap:10px;
}
.card__title{
  font-family:var(--serif);
  font-weight:900;
  font-size:18px;
  margin:0;
  line-height:1.2;
}
.card__title a{
  color:inherit;
  text-decoration:none;
}
.card__title a:hover{text-decoration:underline}
.card__meta{
  margin-top:6px;
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  color:var(--muted);
  font-size:12px;
  align-items:center;
}
.badge{
  border:1px solid var(--line);
  padding:4px 8px;
  border-radius:999px;
  font-size:12px;
  color:var(--text);
  background:rgba(255,255,255,.04);
}
.badge--ok{border-color:rgba(54,211,153,.35)}
.badge--warn{border-color:rgba(251,191,36,.35)}
.badge--err{border-color:rgba(251,113,133,.35)}
.tags{display:flex; gap:6px; flex-wrap:wrap}
.tag{
  border:1px solid rgba(255,255,255,.10);
  color:var(--muted);
  padding:3px 8px;
  border-radius:999px;
  font-size:12px;
}
.tag--hot{border-color:rgba(179,0,27,.45); color:rgba(255,255,255,.9); background:rgba(179,0,27,.12)}

.card__actions{
  margin-top:10px;
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}
.iconbtn{
  touch-action: manipulation;
  border:1px solid var(--line);
  background:rgba(255,255,255,.04);
  color:var(--text);
  padding:8px 10px;
  border-radius:12px;
  cursor:pointer;
  font-weight:700;
}
.iconbtn[aria-pressed="true"]{border-color:rgba(179,0,27,.45); background:rgba(179,0,27,.12)}
.read{opacity:.62}
.read .card__title{font-weight:800}
.small{font-size:12px; color:var(--muted)}
.muted{color:var(--muted)}

.details{
  border-top:1px solid var(--line);
  padding:10px 12px;
  background:rgba(0,0,0,.12);
}
.details__title{font-weight:800; margin-bottom:6px}
.details__list{display:grid; gap:6px}
.details__item{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding:8px 10px;
  border:1px solid var(--line);
  border-radius:14px;
  background:rgba(255,255,255,.03);
}
.details__item a{color:var(--text); text-decoration:none}
.details__item a:hover{text-decoration:underline}

.streamsgrid{
  margin-top:12px;
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap:12px;
}

.stream.is-hidden{display:none}
.stream{
  border:1px solid var(--line);
  border-radius:var(--radius);
  background:linear-gradient(to bottom, rgba(16,20,32,.88), rgba(16,20,32,.64));
  box-shadow:var(--shadow);
  overflow:hidden;
}
.stream__head{
  padding:12px;
  border-bottom:1px solid var(--line);
  display:flex; align-items:center; justify-content:space-between; gap:10px;
}
.stream__title{
  font-family:var(--serif);
  font-weight:900;
  margin:0;
}
.stream__list{padding:10px 12px 12px 12px; display:grid; gap:10px}
.mini a{color:var(--text); text-decoration:none}
.mini a:hover{text-decoration:underline}
.mini__title{font-weight:900; font-family:var(--serif); line-height:1.2}
.mini__meta{margin-top:4px; font-size:12px; color:var(--muted); display:flex; gap:8px; flex-wrap:wrap}

.sourceslayout{
  margin-top:12px;
  display:grid;
  grid-template-columns: 340px 1fr;
  gap:12px;
}
.sourceslist{
  border:1px solid var(--line);
  border-radius:var(--radius);
  background:rgba(16,20,32,.55);
  overflow:hidden;
}
.sourceRow{
  width:100%;
  text-align:left;
  border:0;
  border-bottom:1px solid var(--line);
  background:transparent;
  color:var(--text);
  padding:12px;
  cursor:pointer;
  touch-action: manipulation;
}
.sourceRow:hover{background:rgba(255,255,255,.04)}
.sourceRow[aria-current="true"]{background:rgba(179,0,27,.14)}
.sourceRow__top{display:flex; align-items:center; justify-content:space-between; gap:10px}
.sourceRow__name{font-weight:900}
.sourceRow__meta{margin-top:6px; font-size:12px; color:var(--muted); display:flex; gap:8px; flex-wrap:wrap}
.pillmini{
  font-size:11px;
  padding:3px 8px;
  border-radius:999px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.03);
}

.sourceitems{
  border:1px solid var(--line);
  border-radius:var(--radius);
  background:rgba(16,20,32,.55);
  overflow:hidden;
}
.sourceitems__head{
  padding:12px;
  border-bottom:1px solid var(--line);
  display:flex; align-items:flex-start; justify-content:space-between; gap:12px;
}
.sourceitems__title{font-weight:900; font-size:16px}
.sourceitems__sub{margin-top:4px; font-size:12px; color:var(--muted)}
.sourceitems__actions{display:flex; gap:10px}

.toTop{
  position:fixed;
  right:14px;
  bottom:14px;
  z-index:60;
  width:46px;
  height:46px;
  border-radius:16px;
  border:1px solid var(--line);
  background:rgba(16,20,32,.75);
  color:var(--text);
  cursor:pointer;
  touch-action: manipulation;
  display:none;
}
.toTop.show{display:block}
@media (max-width:640px){
  .toTop{right:12px; bottom: calc(12px + env(safe-area-inset-bottom));}
}

.overlay{
  position:fixed; inset:0;
  background:rgba(0,0,0,.62);
  z-index:100;
  display:flex;
  align-items:flex-start;
  justify-content:center;
  padding: calc(14px + env(safe-area-inset-top)) 14px calc(14px + env(safe-area-inset-bottom)) 14px;
  overflow:auto;
}
.overlay.hidden{display:none}
.overlay__card{
  width:min(920px, 100%);
  border-radius:22px;
  border:1px solid var(--line);
  background:linear-gradient(to bottom, rgba(16,20,32,.96), rgba(16,20,32,.82));
  box-shadow:0 25px 60px rgba(0,0,0,.55);
  overflow:hidden;
}
.overlay__card--small{width:min(720px,100%)}
.overlay__top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px;
  border-bottom:1px solid var(--line);
}
.overlay__title{font-weight:900}
.overlay__nav{display:flex; gap:10px; flex-wrap:wrap}

.reader{padding:16px}
.reader__meta{color:var(--muted); font-size:12px}
.reader__title{
  margin:10px 0 0 0;
  font-family:var(--serif);
  font-size:32px;
  line-height:1.1;
}
.reader__actions{margin-top:12px; display:flex; gap:10px; flex-wrap:wrap}
.reader__body{margin-top:14px; color:rgba(233,236,241,.92); font-size:16px; line-height:1.65}
.reader__sources{margin-top:18px; border-top:1px solid var(--line); padding-top:12px}
.reader__sources h4{margin:0 0 10px 0; font-family:var(--serif)}
.reader__sources .details__list{margin-top:8px}

.copybox{padding:12px}
.textarea{
  width:100%;
  border-radius:16px;
  border:1px solid var(--line);
  background:rgba(0,0,0,.20);
  color:var(--text);
  padding:12px;
  resize:vertical;
}
.row{display:flex; justify-content:flex-end; gap:10px; margin-top:10px; flex-wrap:wrap}

.logs{padding:12px}
.logs__meta{color:var(--muted); font-size:12px}
.logs__list{
  margin-top:10px;
  display:grid; gap:8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size:12px;
}
.logline{
  border:1px solid var(--line);
  background:rgba(0,0,0,.18);
  border-radius:14px;
  padding:10px;
}
.logline--err{border-color:rgba(251,113,133,.35)}
.logline--warn{border-color:rgba(251,191,36,.35)}
.logline__meta{color:var(--muted); margin-bottom:6px}

.toast{
  position:fixed;
  left:50%;
  transform:translateX(-50%);
  bottom: calc(14px + env(safe-area-inset-bottom));
  z-index:200;
  border:1px solid var(--line);
  background:rgba(16,20,32,.9);
  padding:10px 12px;
  border-radius:14px;
  box-shadow:0 20px 50px rgba(0,0,0,.45);
}
.toast.hidden{display:none}

@media (max-width: 980px){
  .topbar__row{grid-template-columns:1fr}
  .topbar__actions{justify-content:flex-start}
  .streamsgrid{grid-template-columns:1fr}
  .sourceslayout{grid-template-columns:1fr}
  .section__title{font-size:26px}
  .reader__title{font-size:28px}
}
