:root {
  --ink: #0f172a;
  --dim: #64748b;
  --blue: #2563eb;
  --blue-dark: #1e40af;
  --rose: #e11d48;
  --cyan: #0891b2;
  --page: #eef2f9;
  --card: #ffffff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--page);
  color: var(--ink);
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100%;
}

body { padding-bottom: 32px; }

/* --- App bar ------------------------------------------------------------ */
.appbar {
  background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 45%, #0891b2 100%);
  color: #fff;
  padding: 18px 16px 0;
  border-radius: 0 0 22px 22px;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.28);
  position: sticky;
  top: 0;
  z-index: 10;
}

.appbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
}

.appbar-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }

.logo-bubble {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.18);
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 17px;
  letter-spacing: 0.5px;
  backdrop-filter: blur(4px);
}

.appbar-brand h1 { font-size: 17.5px; font-weight: 900; letter-spacing: 0.2px; }

.appbar-brand p {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.82);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

/* --- Category pills ------------------------------------------------------ */
.nav-wrap { position: relative; }

.pillbar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 0 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.85) transparent;
  cursor: grab;
  user-select: none;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
}

.pillbar:active { cursor: grabbing; }

.pillbar::-webkit-scrollbar { height: 5px; }
.pillbar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.85); border-radius: 3px; }
.pillbar::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.2); }

.edge {
  position: absolute;
  top: 0;
  bottom: 16px;
  width: 34px;
  border: none;
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 2;
  padding: 0;
}

.edge-l { left: 0; background: linear-gradient(90deg, #1d4ed8 55%, transparent); }
.edge-r { right: 0; background: linear-gradient(270deg, #0891b2 55%, transparent); }
.edge[hidden] { display: none; }

.pill {
  flex: 0 0 auto;
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
}

.pill.active { background: #fff; color: var(--blue-dark); border-color: #fff; }

/* --- Feed ----------------------------------------------------------------- */
.feed { padding: 16px 14px; display: flex; flex-direction: column; gap: 14px; }

.spotlight {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  cursor: pointer;
  min-height: 260px;
  display: flex;
  align-items: flex-end;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.16);
}

.spotlight img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.spotlight::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0) 25%, rgba(15, 23, 42, 0.9) 90%);
}

.spotlight-body { position: relative; z-index: 1; padding: 18px; color: #fff; }

.spotlight-body h2 { font-size: 21px; font-weight: 800; line-height: 1.22; margin: 10px 0 8px; }

.cat-chip {
  display: inline-block;
  background: var(--rose);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
}

.meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.75);
}

.meta-row .dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; }

.mcard {
  background: var(--card);
  border-radius: 18px;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  gap: 0;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.07);
  transition: transform 0.15s ease;
}

.mcard:active { transform: scale(0.98); }

.mcard-media { flex: 0 0 118px; width: 118px; min-height: 108px; }
.mcard-media img { width: 100%; height: 100%; object-fit: cover; display: block; }

.mcard-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }

.mcard-cat {
  font-size: 9.5px;
  font-weight: 900;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--blue);
}

.mcard h3 {
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.32;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mcard .meta-row { color: var(--dim); margin-top: auto; }

/* --- Load state ------------------------------------------------------------ */
.loadstate { text-align: center; color: var(--dim); padding: 48px 16px; font-size: 14px; }

/* --- Article sheet ---------------------------------------------------------- */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(3px);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.sheet-overlay.open { opacity: 1; pointer-events: auto; }

.sheet {
  background: var(--card);
  width: 100%;
  max-height: 92%;
  overflow-y: auto;
  border-radius: 24px 24px 0 0;
  transform: translateY(40px);
  transition: transform 0.22s ease;
}

.sheet-overlay.open .sheet { transform: translateY(0); }

.sheet-media { position: relative; height: 240px; }
.sheet-media img { width: 100%; height: 100%; object-fit: cover; display: block; }

.sheet-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(15, 23, 42, 0.55);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  backdrop-filter: blur(4px);
}

.sheet-chip {
  position: absolute;
  left: 16px;
  bottom: -13px;
  background: var(--rose);
  color: #fff;
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(225, 29, 72, 0.4);
}

.sheet-body { padding: 26px 20px 40px; }

.sheet-body h2 { font-size: 22.5px; font-weight: 800; line-height: 1.24; }

.sheet-meta {
  margin: 10px 0 14px;
  font-size: 12px;
  color: var(--dim);
  font-weight: 600;
}

.sheet-body p { font-size: 15.5px; line-height: 1.68; color: #334155; }

.sheet-actions { display: flex; gap: 10px; margin-top: 26px; }

.mbtn {
  flex: 1;
  text-align: center;
  text-decoration: none;
  font-size: 14px;
  font-weight: 800;
  padding: 14px;
  border-radius: 14px;
  border: none;
  cursor: pointer;
}

.mbtn-fill {
  background: linear-gradient(135deg, var(--blue) 0%, var(--cyan) 100%);
  color: #fff;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

.mbtn-soft { background: #e2e8f0; color: var(--ink); }
