:root {
  --bg: #050814;
  --panel: rgba(15, 23, 42, 0.68);
  --panel-strong: rgba(2, 6, 23, 0.74);
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #f8fafc;
  --muted: #94a3b8;
  --soft: #cbd5e1;
  --sky: #7dd3fc;
  --sky-strong: #38bdf8;
  --orange: #fdba74;
  --orange-strong: #fb923c;
  --green: #86efac;
  --danger: #fca5a5;
  --radius-xl: 28px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  font-family: Manrope, "Segoe UI", "SF Pro Display", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 18% 10%, rgba(56, 189, 248, 0.16), transparent 28%),
    radial-gradient(circle at 88% 18%, rgba(251, 146, 60, 0.14), transparent 24%),
    radial-gradient(circle at 50% 100%, rgba(15, 23, 42, 1), transparent 34%),
    var(--bg);
  color: var(--text);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(125, 211, 252, 0.7);
  outline-offset: 2px;
}

a {
  color: inherit;
}

.app-shell {
  min-height: 100vh;
}

.stage {
  position: relative;
  display: flex;
  justify-content: center;
  gap: 32px;
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 24px 16px 36px;
}

.phone-wrap {
  position: relative;
  width: min(430px, 100%);
}

.phone-glow {
  position: absolute;
  inset: -12px;
  border-radius: 42px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.16), transparent 45%, rgba(251, 146, 60, 0.15));
  filter: blur(18px);
}

.phone {
  position: relative;
  height: min(860px, calc(100vh - 32px));
  min-height: 680px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 38px;
  background: #020617;
  box-shadow: 0 30px 110px rgba(0, 0, 0, 0.55);
}

.phone::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 50%;
  z-index: 5;
  width: 96px;
  height: 6px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
}

.scroll {
  height: 100%;
  overflow-y: auto;
  padding: 16px 16px 104px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

.topbar {
  position: sticky;
  z-index: 4;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -16px -16px 16px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(2, 6, 23, 0.84);
  backdrop-filter: blur(18px);
}

.topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.live-dot,
.boot-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #6ee7b7;
  box-shadow: 0 0 18px rgba(110, 231, 183, 0.8);
}

.topbar-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--soft);
  padding: 0 12px;
  font-size: 12px;
}

.screen {
  display: grid;
  gap: 20px;
  animation: reveal 420ms ease both;
}

.hero {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 32px;
  background:
    radial-gradient(circle at 86% 0%, rgba(56, 189, 248, 0.2), transparent 28%),
    radial-gradient(circle at 12% 100%, rgba(251, 146, 60, 0.2), transparent 34%),
    linear-gradient(135deg, #020617, rgba(30, 64, 175, 0.52), #020617);
  padding: 22px;
  box-shadow: var(--shadow);
}

.hero-badge,
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--soft);
  padding: 7px 12px;
  font-size: 12px;
}

.hero h1 {
  margin: 16px 0 0;
  font-size: clamp(30px, 9vw, 38px);
  line-height: 0.96;
  letter-spacing: -0.045em;
}

.hero p {
  max-width: 360px;
  margin: 12px 0 0;
  color: var(--soft);
  font-size: 14px;
  line-height: 1.65;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 20px;
}

.actions .span-2 {
  grid-column: 1 / -1;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  border: 0;
  border-radius: 18px;
  padding: 0 16px;
  color: #06111f;
  background: linear-gradient(135deg, #e0f2fe, #fdba74);
  font-weight: 700;
  box-shadow: 0 16px 40px rgba(56, 189, 248, 0.15);
}

.btn.secondary {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--soft);
  box-shadow: none;
}

.btn.blue {
  background: rgba(56, 189, 248, 0.14);
  color: #e0f2fe;
  border: 1px solid rgba(125, 211, 252, 0.22);
  box-shadow: none;
}

.btn.orange {
  background: rgba(251, 146, 60, 0.14);
  color: #ffedd5;
  border: 1px solid rgba(253, 186, 116, 0.24);
  box-shadow: none;
}

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

.metric {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  padding: 12px;
  text-align: center;
}

.metric strong {
  display: block;
  font-size: 18px;
}

.metric span {
  color: var(--muted);
  font-size: 11px;
}

.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.kicker {
  margin-bottom: 5px;
  color: rgba(253, 186, 116, 0.86);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.section-title h2,
.page-header h1,
.article-detail h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.section-action {
  border: 0;
  background: transparent;
  color: #bae6fd;
  font-size: 12px;
}

.card,
.article-card,
.page-header,
.topic-card,
.stat-card,
.empty-state {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--panel);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(16px);
}

.article-card {
  padding: 12px;
}
.clickable-card {
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.clickable-card:hover {
  transform: translateY(-1px);
  border-color: rgba(125, 211, 252, 0.34);
  background: rgba(15, 23, 42, 0.82);
}

.clickable-card:focus-visible {
  outline: 2px solid rgba(56, 189, 248, 0.72);
  outline-offset: 3px;
}

.clickable-card .icon-button {
  cursor: pointer;
}


.article-main {
  display: flex;
  gap: 12px;
}

.cover {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 126px;
  height: auto;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.18), rgba(251, 146, 60, 0.14)), #0f172a;
  color: white;
  font-size: 30px;
}

.cover.large {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border-radius: 30px;
  font-size: 48px;
}

.article-card h3 {
  margin: 0;
  color: white;
  font-size: 15px;
  line-height: 1.35;
}

.article-card p,
.page-header p,
.topic-card p,
.article-detail p {
  color: var(--muted);
  line-height: 1.62;
}

.article-card p {
  display: -webkit-box;
  margin: 7px 0 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: 12px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.tag {
  border: 1px solid rgba(125, 211, 252, 0.16);
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.1);
  color: #e0f2fe;
  padding: 5px 9px;
  font-size: 11px;
}

.meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 11px;
}

.meta-left {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 10px;
}

.read-button {
  width: 100%;
  margin-top: 12px;
}

.feed,
.topic-grid,
.series-list,
.stats-grid {
  display: grid;
  gap: 12px;
}

.topic-grid.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.topic-card {
  width: 100%;
  padding: 16px;
  color: inherit;
  text-align: left;
}

.topic-card h3 {
  margin: 0;
  font-size: 15px;
}

.topic-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.1);
}

.topic-card.sky {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.18), rgba(251, 146, 60, 0.08)), var(--panel);
}

.topic-card.orange {
  background: linear-gradient(135deg, rgba(251, 146, 60, 0.18), rgba(56, 189, 248, 0.08)), var(--panel);
}

.topic-card.green {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.16), rgba(56, 189, 248, 0.08)), var(--panel);
}

.topic-card.violet {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.18), rgba(56, 189, 248, 0.08)), var(--panel);
}

.topic-card.amber,
.topic-card.cyan {
  background: linear-gradient(135deg, rgba(251, 146, 60, 0.18), rgba(14, 165, 233, 0.08)), var(--panel);
}

.input-wrap {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
}

.input-wrap .icon {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
}

.search-input,
.admin-input,
.admin-textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  outline: none;
}

.search-input {
  display: block;
  height: 48px;
  padding: 0 16px 0 42px;
  background: transparent;
  box-shadow: none;
  -webkit-appearance: none;
  appearance: none;
}

.admin-input {
  height: 44px;
  padding: 0 14px;
}

.admin-textarea {
  min-height: 118px;
  padding: 14px;
  resize: vertical;
}

.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.chip {
  flex: 0 0 auto;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--soft);
  padding: 0 12px;
  font-size: 12px;
}

.chip.active {
  border-color: rgba(125, 211, 252, 0.28);
  background: rgba(56, 189, 248, 0.15);
  color: #e0f2fe;
}

.page-header {
  padding: 22px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
}

.header-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  border-radius: 18px;
  background: rgba(56, 189, 248, 0.12);
  color: #bae6fd;
}

.series-card {
  width: 100%;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--panel-strong);
  color: inherit;
  text-align: left;
}

.series-card h3 {
  margin: 0;
}

.progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--sky-strong), var(--orange-strong));
}

.stat-card {
  padding: 16px;
}

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

.stat-value {
  margin-top: 10px;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.sparkline {
  width: 100%;
  height: 92px;
  margin-top: 10px;
}

.sparkline path.line {
  fill: none;
  stroke: var(--sky);
  stroke-width: 3;
  stroke-linecap: round;
}

.sparkline path.area {
  fill: rgba(56, 189, 248, 0.12);
}

.article-detail .detail-hero {
  padding: 18px;
}

.back-button {
  width: max-content;
}

.body-card {
  padding: 18px;
}

.body-card p {
  margin: 0 0 14px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.info-pill {
  min-height: 82px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.045);
  padding: 12px;
  color: var(--soft);
  font-size: 12px;
}

.admin-panel {
  padding: 16px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.mini-note {
  border: 1px solid rgba(125, 211, 252, 0.16);
  border-radius: 20px;
  background: rgba(56, 189, 248, 0.07);
  color: rgba(224, 242, 254, 0.8);
  padding: 12px;
  font-size: 12px;
  line-height: 1.55;
}

.bottom-nav {
  position: absolute;
  z-index: 6;
  right: 0;
  bottom: 0;
  left: 0;
  border-top: 1px solid var(--line);
  background: rgba(2, 6, 23, 0.88);
  padding: 8px 12px calc(12px + env(safe-area-inset-bottom));
  backdrop-filter: blur(20px);
}

.bottom-nav-inner {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}

.nav-item {
  display: grid;
  gap: 2px;
  place-items: center;
  min-height: 54px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
}

.nav-item.active {
  background: rgba(56, 189, 248, 0.13);
  color: white;
}

.empty-state,
.boot-card {
  padding: 24px;
  text-align: center;
}

.boot-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: min(360px, calc(100vw - 32px));
  margin: 20vh auto;
  text-align: left;
}

.boot-card strong,
.boot-card span {
  display: block;
}

.boot-card span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.toast {
  position: fixed;
  z-index: 20;
  right: 16px;
  bottom: 16px;
  max-width: min(360px, calc(100vw - 32px));
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: rgba(2, 6, 23, 0.92);
  color: white;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

.hidden {
  display: none !important;
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 920px) {
  .stage {
    padding: 0;
  }

  .phone-wrap,
  .phone {
    width: 100%;
    max-width: none;
  }

  .phone-glow,
  .phone::before {
    display: none;
  }

  .phone {
    height: 100vh;
    min-height: 100vh;
    border: 0;
    border-radius: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}

.profile-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.profile-head h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.03em;
}

.profile-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.avatar {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border: 1px solid rgba(125, 211, 252, 0.22);
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(251, 146, 60, 0.16));
  color: white;
  font-size: 22px;
  font-weight: 800;
}

.profile-metrics {
  margin: 12px 0;
}

.muted-pill {
  color: var(--soft);
  background: rgba(255, 255, 255, 0.045);
}

.spark-point-wrap {
  cursor: pointer;
}

.spark-hit {
  fill: transparent;
  stroke: transparent;
  pointer-events: all;
}

.spark-dot {
  fill: #e0f2fe;
  stroke: #020617;
  stroke-width: 2;
  opacity: 0.72;
  transition: r 160ms ease, opacity 160ms ease, fill 160ms ease;
}

.spark-dot.last {
  fill: var(--orange);
  opacity: 1;
}

.spark-point-wrap:hover .spark-dot,
.spark-point-wrap:focus .spark-dot {
  r: 5.8;
  opacity: 1;
}

@media (max-width: 920px) {
  .bottom-nav-inner {
    grid-template-columns: repeat(5, 1fr);
  }
}

html {
  scroll-behavior: smooth;
}

.icon {
  display: inline-block;
  width: 1.1em;
  height: 1.1em;
  flex: 0 0 auto;
  vertical-align: -0.18em;
  color: currentColor;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.icon-fallback {
  width: auto;
  height: auto;
}

.btn .icon,
.topbar-button .icon,
.hero-badge .icon,
.pill .icon,
.meta .icon,
.info-pill .icon,
.section-title .icon,
.nav-item .icon {
  width: 20px;
  height: 20px;
  margin-bottom: 0;
  transform: translateY(2px);
}

.header-icon .icon,
.topic-icon .icon {
  width: 24px;
  height: 24px;
}

.cover-svg {
  width: 34px;
  height: 34px;
  color: #e0f2fe;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  filter: drop-shadow(0 0 18px rgba(125, 211, 252, 0.25));
}

.cover.large .cover-svg {
  width: 54px;
  height: 54px;
}

.state-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.icon-button {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  padding: 0;
}

.icon-button .icon {
  width: 17px;
  height: 17px;
}

.admin-status {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.045);
  padding: 8px 12px;
  font-size: 12px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .screen {
    animation: none;
  }
}

select {
  font: inherit;
}

select:focus-visible {
  outline: 2px solid rgba(125, 211, 252, 0.7);
  outline-offset: 2px;
}

.scroll {
  scroll-behavior: smooth;
}

.admin-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.admin-label {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.admin-label.span-2,
.admin-actions.span-2 {
  grid-column: 1 / -1;
}

.admin-textarea.raw {
  min-height: 168px;
}

.admin-textarea.small {
  min-height: 86px;
}

.admin-actions {
  margin-top: 0;
}

.admin-input[type="date"] {
  color-scheme: dark;
}

.admin-input option {
  background: #020617;
  color: var(--text);
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

code {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 6px;
  color: var(--soft);
}

@media (max-width: 420px) {
  .admin-form {
    grid-template-columns: 1fr;
  }

  .admin-label.span-2,
  .admin-actions.span-2 {
    grid-column: auto;
  }
}

/* v4 cleanup */
.hero h1 {
  margin-top: 0;
  font-size: clamp(24px, 7vw, 30px);
  line-height: 1.05;
}

.article-content {
  min-width: 0;
  flex: 1;
}

.article-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 34px;
  margin-top: 0;
}

.article-topic {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

.article-top-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.read-check,
.detail-read-badge {
  display: inline-grid;
  place-items: center;
  color: #bbf7d0;
}

.read-check {
  width: 20px;
  height: 20px;
}

.read-check:empty,
.detail-read-badge:empty {
  display: none;
}

.article-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}

.article-date {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

.detail-cover-wrap {
  position: relative;
}

.detail-read-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(187, 247, 208, 0.34);
  border-radius: 999px;
  background: rgba(22, 163, 74, 0.22);
  backdrop-filter: blur(12px);
}

.detail-date {
  position: absolute;
  right: 16px;
  bottom: 14px;
  color: rgba(226, 232, 240, 0.76);
  font-size: 12px;
  line-height: 1.2;
  padding: 5px 9px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.44);
  backdrop-filter: blur(10px);
}

.detail-read-badge .icon,
.read-check .icon {
  width: 18px;
  height: 18px;
}

/* v6 product cleanup */
.bottom-nav-inner {
  grid-template-columns: repeat(4, 1fr);
}

.admin-list {
  display: grid;
  gap: 10px;
}

.admin-article-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.045);
  padding: 12px;
}

.admin-article-row strong {
  display: block;
  margin-top: 5px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.35;
}

.admin-article-row p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.admin-row-actions {
  display: inline-flex;
  gap: 6px;
}

.section-action.danger,
.icon-button.danger {
  color: var(--danger);
}

.admin-two-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.mini-row {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--soft);
  padding: 10px;
  text-align: left;
  font-size: 12px;
  line-height: 1.35;
}

.mini-row + .mini-row {
  margin-top: 8px;
}

.mini-row b {
  color: white;
}

.wide-metric {
  grid-column: span 1;
}

.article-card {
  position: relative;
}

.article-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.icon-button.active,
.icon-button:has(.icon) {
  min-width: 34px;
  min-height: 34px;
}

.article-card .tags {
  margin-top: 10px;
}

.article-card-footer {
  padding-top: 2px;
}

@media (max-width: 420px) {
  .admin-article-row,
  .admin-two-cols {
    grid-template-columns: 1fr;
  }

  .admin-row-actions {
    justify-content: flex-start;
  }
}

.article-cover-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: inherit;
  transform: scale(1.01);
}

.cover.image-cover {
  background: linear-gradient(135deg, rgba(2, 6, 23, 0.65), rgba(15, 23, 42, 0.9));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}

.cover.image-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.06), rgba(15, 23, 42, 0.24));
  pointer-events: none;
}

.article-gallery {
  margin-top: 18px;
  display: grid;
  gap: 12px;
}

.article-gallery img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 24px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: 0 18px 50px rgba(2, 6, 23, 0.34);
}


/* v8: 16:9 media and Markdown reading/editor layer */
.article-main {
  align-items: flex-start;
}

.article-card .cover {
  width: 124px;
  min-width: 124px;
  aspect-ratio: 16 / 9;
  height: auto;
  border-radius: 18px;
}

.detail-hero .cover.large {
  aspect-ratio: 16 / 9;
  height: auto;
  border-radius: 28px;
}

.article-gallery img {
  aspect-ratio: 16 / 9;
  height: auto;
}

.body-card h2,
.body-card h3,
.body-card h4 {
  margin: 22px 0 10px;
  color: #f8fafc;
  line-height: 1.22;
  letter-spacing: -0.02em;
}

.body-card h2 {
  font-size: 22px;
}

.body-card h3 {
  font-size: 18px;
}

.body-card h4 {
  font-size: 16px;
}

.body-card p {
  margin: 12px 0;
}

.body-card strong {
  color: #ffffff;
  font-weight: 760;
}

.body-card em {
  color: #dbeafe;
}

.body-card s {
  color: #94a3b8;
}

.body-card code {
  border: 1px solid rgba(125, 211, 252, 0.2);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.75);
  color: #bae6fd;
  padding: 2px 6px;
  font-size: 0.92em;
}

.body-card a {
  color: #7dd3fc;
  text-decoration: none;
  border-bottom: 1px solid rgba(125, 211, 252, 0.45);
}

.body-card blockquote {
  margin: 18px 0;
  border-left: 3px solid rgba(251, 146, 60, 0.75);
  border-radius: 0 18px 18px 0;
  background: rgba(251, 146, 60, 0.07);
  color: #fed7aa;
  padding: 12px 14px;
  line-height: 1.62;
}

.body-card ul {
  margin: 12px 0 14px;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.62;
}

.body-card li + li {
  margin-top: 6px;
}

.md-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 8px;
}

.md-tool {
  min-height: 34px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.72);
  color: #dbeafe;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
}

.md-tool:active {
  transform: translateY(1px);
}

.markdown-editor {
  min-height: 260px;
  font-family: inherit;
  line-height: 1.55;
}

.admin-hint {
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

@media (max-width: 420px) {
  .article-main {
    gap: 12px;
  }

  .article-card .cover {
    width: 112px;
    min-width: 112px;
    border-radius: 16px;
  }
}

/* Hybrid article format: Mini App as navigator to Telegram */
.teaser-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.lead-text {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  line-height: 1.65;
}

.teaser-block {
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.035);
  border-radius: 20px;
}

.teaser-block p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.takeaway-list {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.takeaway-list li {
  position: relative;
  padding: 11px 12px 11px 34px;
  border-radius: 16px;
  color: var(--text);
  line-height: 1.45;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.065);
}

.takeaway-list li::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 18px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 18px rgba(246, 142, 74, 0.4);
}

.telegram-main-cta {
  min-height: 54px;
  justify-content: center;
  font-size: 15px;
}

.archive-editor {
  min-height: 180px;
}

.article-detail .actions .btn:first-child {
  font-weight: 800;
}

/* v10: link catalog mode - no in-app reading, no covers in user UI */
.bottom-nav-inner {
  grid-template-columns: repeat(3, 1fr);
}

.catalog-hero h1 {
  max-width: 420px;
}

.tag-cloud-card {
  padding: 16px;
}

.tag-cloud {
  margin-top: 10px;
}

.catalog-count {
  padding: 0 2px;
}

.catalog-feed {
  margin-top: 10px;
}

.article-card.link-card {
  padding: 16px;
  display: grid;
  gap: 12px;
}

.article-card.link-card h3 {
  margin: 2px 0 0;
  font-size: 18px;
  line-height: 1.28;
  letter-spacing: -0.02em;
}

.article-card-top.compact {
  min-height: 30px;
  margin: 0;
}

.article-card.link-card .tags {
  margin-top: 0;
}

.link-detail .detail-link-card {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.detail-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.detail-link-card h1 {
  font-size: clamp(28px, 8vw, 40px);
  line-height: 1.05;
}

.detail-tags {
  margin-top: 0;
}

.detail-link-card .telegram-main-cta {
  width: 100%;
}

.compact-actions {
  grid-template-columns: 1fr 1fr;
}

.compact-actions .span-2 {
  grid-column: span 2;
}

@media (max-width: 420px) {
  .article-card.link-card h3 {
    font-size: 17px;
  }

  .compact-actions {
    grid-template-columns: 1fr;
  }

  .compact-actions .span-2 {
    grid-column: span 1;
  }
}

/* v11: corrected link-catalog mobile layout */
body {
  overflow-x: hidden;
}

.scroll {
  overflow-x: hidden;
}

.screen {
  gap: 18px;
}

.home-screen {
  gap: 18px;
}

.home-hero {
  padding: 18px;
  border-radius: 28px;
  background:
    radial-gradient(circle at 88% 0%, rgba(56, 189, 248, 0.16), transparent 30%),
    radial-gradient(circle at 12% 100%, rgba(251, 146, 60, 0.14), transparent 34%),
    rgba(15, 23, 42, 0.74);
  box-shadow: 0 18px 58px rgba(0, 0, 0, 0.22);
}

.home-hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.home-hero h1 {
  margin: 4px 0 0;
  max-width: 310px;
  font-size: clamp(24px, 7vw, 31px);
  line-height: 1.08;
  letter-spacing: -0.045em;
}

.home-profile-btn {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border: 1px solid rgba(125, 211, 252, 0.2);
  border-radius: 16px;
  color: #dbeafe;
  background: rgba(56, 189, 248, 0.1);
}

.home-profile-btn .icon {
  width: 20px;
  height: 20px;
}

.home-stats-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 16px;
}

.home-stats-row > div {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.045);
  padding: 11px 8px;
  text-align: center;
}

.home-stats-row strong,
.home-stats-row span {
  display: block;
}

.home-stats-row strong {
  font-size: 18px;
  line-height: 1.1;
}

.home-stats-row span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.2;
}

.home-catalog-btn {
  width: 100%;
  margin-top: 14px;
  min-height: 48px;
  border-radius: 18px;
  color: #06111f !important;
  white-space: nowrap;
}

.home-catalog-btn .icon {
  color: #06111f;
}

.tag-cloud-card {
  max-width: 100%;
  overflow: hidden;
}

.compact-title h2 {
  font-size: 19px;
}

.chip-row {
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}

.chip-row::-webkit-scrollbar {
  display: none;
}

.article-card.link-card {
  padding: 15px;
  border-radius: 24px;
}

.article-card.link-card h3 {
  font-size: 17px;
  line-height: 1.32;
  overflow-wrap: anywhere;
}

.article-card-top.compact {
  align-items: flex-start;
}

.article-top-actions {
  gap: 6px;
}

.icon-button {
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
}

.tags {
  gap: 6px;
}

.tag {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-link-card h1 {
  font-size: clamp(24px, 7.2vw, 34px);
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.detail-meta-row .detail-read-badge {
  position: static;
  width: 28px;
  height: 28px;
  border-radius: 999px;
}

.profile-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.profile-metrics .metric:nth-child(4) {
  display: none;
}

@media (max-width: 420px) {
  .scroll {
    padding: 14px 14px 98px;
  }

  .topbar {
    margin: -14px -14px 14px;
    padding: 13px 14px 11px;
  }

  .home-hero {
    padding: 16px;
    border-radius: 26px;
  }

  .home-hero h1 {
    font-size: 27px;
  }

  .section-title h2,
  .page-header h1,
  .article-detail h1 {
    font-size: 20px;
  }

  .tag-cloud-card {
    padding: 14px;
  }

  .bottom-nav {
    padding-left: 10px;
    padding-right: 10px;
  }

  .nav-item {
    min-height: 52px;
    font-size: 10.5px;
  }
}


/* v12: compact mobile catalog polish */
:root {
  --radius-xl: 16px;
}

.phone-glow { border-radius: 24px; }
.phone { border-radius: 22px; }
.hero { border-radius: 16px; }
.card,
.article-card,
.page-header,
.topic-card,
.stat-card,
.empty-state,
.series-card { border-radius: 16px; }
.btn,
.search-input,
.admin-input,
.admin-textarea,
.metric,
.info-pill,
.mini-note,
.toast { border-radius: 10px; }
.topbar-button,
.chip,
.tag,
.pill,
.progress,
.live-dot,
.boot-dot { border-radius: 999px; }
.nav-item,
.home-profile-btn,
.icon-button,
.header-icon,
.topic-icon { border-radius: 10px; }
.home-hero,
.cover,
.cover.large { border-radius: 16px; }
.home-stats-row > div { border-radius: 10px; }

.input-wrap {
  margin-top: 8px;
}

[data-filter-group="tag"] {
  margin-top: -6px;
}

[data-filter-group="sort"] {
  margin-top: -10px;
}

.sort-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sort-chip .icon {
  width: 14px;
  height: 14px;
}

.sort-chip.active {
  border-color: rgba(253, 186, 116, 0.42);
  background: rgba(251, 146, 60, 0.16);
  color: #ffedd5;
}

.bottom-nav-inner {
  grid-template-columns: repeat(3, 1fr) !important;
}

.article-card.link-card {
  padding: 12px;
  border-radius: 16px;
}

.article-row-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.article-card.link-card h3 {
  margin: 0;
  padding-top: 2px;
  font-size: 16px;
  line-height: 1.28;
  letter-spacing: -0.018em;
  overflow-wrap: anywhere;
}

.article-card-actions {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 6px;
  justify-content: flex-end;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  min-width: 34px;
  padding: 0;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(255, 255, 255, 0.035);
  color: #cbd5e1;
}

.icon-button.active,
.icon-button[data-state-label="bookmark"]:has(.icon),
.icon-button[data-state-label="favorite"]:has(.icon) {
  color: #e0f2fe;
}

.read-toggle.active {
  border-color: rgba(134, 239, 172, 0.36);
  background: rgba(34, 197, 94, 0.13);
  color: #bbf7d0;
}

.article-row-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 12px;
}

.article-card.link-card .tags {
  min-width: 0;
  margin-top: 0;
}

.article-card.link-card .article-date {
  justify-self: end;
  white-space: nowrap;
  color: rgba(148, 163, 184, 0.9);
  font-size: 10.5px;
}

.profile-card .mini-note,
.profile-card + .stats-grid {
  display: none;
}

.profile-more {
  width: max-content;
  justify-self: start;
  margin-top: -8px;
  padding: 0;
  color: #fdba74;
}

.compact-saved-feed {
  max-height: none;
}

.catalog-count {
  margin-top: -8px;
}

@media (max-width: 420px) {
  .article-card.link-card h3 {
    font-size: 15.5px;
  }
  .icon-button {
    width: 32px;
    height: 32px;
    min-width: 32px;
  }
  .article-card-actions {
    gap: 5px;
  }
  .article-row-main {
    gap: 8px;
  }
}

.profile-activity-card {
  padding: 14px;
  overflow: hidden;
}

.activity-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.activity-head h2 {
  margin: 2px 0 3px;
  font-size: 19px;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.activity-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.activity-total {
  min-width: 78px;
  padding: 9px 10px;
  border: 1px solid rgba(125, 211, 252, 0.16);
  border-radius: 14px;
  background: rgba(125, 211, 252, 0.06);
  text-align: center;
}

.activity-total strong {
  display: block;
  font-size: 21px;
  line-height: 1;
}

.activity-total span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.range-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 10px 0 8px;
}

.range-tab {
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--soft);
  font-size: 12px;
}

.range-tab.active {
  border-color: rgba(125, 211, 252, 0.38);
  background: rgba(56, 189, 248, 0.13);
  color: #e0f2fe;
}

.activity-chart {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 6px;
  overflow: visible;
}

.chart-grid line {
  stroke: rgba(255, 255, 255, 0.075);
  stroke-width: 1;
}

.chart-grid text,
.chart-x-labels text {
  fill: rgba(203, 213, 225, 0.72);
  font-size: 10px;
}

.activity-area {
  fill: rgba(56, 189, 248, 0.1);
}

.activity-line {
  fill: none;
  stroke: #60a5fa;
  stroke-width: 2.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.activity-point {
  cursor: pointer;
}

.activity-hover-line {
  opacity: 0;
  stroke: rgba(255, 255, 255, 0.18);
  stroke-width: 1;
}

.activity-point:hover .activity-hover-line,
.activity-point:focus .activity-hover-line {
  opacity: 1;
}

.activity-hit {
  fill: transparent;
  stroke: transparent;
  r: 13;
}

.activity-dot {
  display: none;
}

.activity-point:hover .activity-dot,
.activity-point:focus .activity-dot {
  display: none;
}

.activity-overview {
  display: block;
  width: 100%;
  height: 48px;
  margin-top: 4px;
  overflow: visible;
}

.overview-bg {
  fill: rgba(226, 232, 240, 0.08);
}

.overview-line {
  fill: none;
  stroke: rgba(96, 165, 250, 0.82);
  stroke-width: 1.4;
}

.overview-window {
  fill: rgba(203, 213, 225, 0.16);
  stroke: rgba(203, 213, 225, 0.28);
}

.overview-handle {
  stroke: rgba(226, 232, 240, 0.72);
  stroke-width: 3;
  stroke-linecap: round;
}

.activity-overview-wrap {
  width: 100%;
  margin-top: 4px;
  touch-action: none;
  user-select: none;
}

.activity-overview-wrap .overview-window {
  cursor: grab;
}

.activity-overview-wrap .overview-handle,
.activity-overview-wrap .overview-handle-hit {
  cursor: ew-resize;
}

.overview-handle-hit {
  fill: transparent;
  stroke: transparent;
  pointer-events: all;
}

.dragging-activity-range,
.dragging-activity-range * {
  cursor: grabbing !important;
  user-select: none !important;
}

.range-help {
  margin: 7px 2px 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

/* v16: add breathing room below the sticky top status bar on the first cards */
.home-screen {
  padding-top: 12px;
}

.profile-card {
  margin-top: 12px;
}

@media (max-width: 520px) {
  .home-screen {
    padding-top: 10px;
  }
  .profile-card {
    margin-top: 10px;
  }
}

/* v17: clearer sort control with date direction toggle */
.sort-control {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.sort-label {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #fdba74;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.sort-label .icon {
  width: 14px;
  height: 14px;
}

.sort-control .sort-chip.active,
.date-sort-chip.active {
  border-color: rgba(125, 211, 252, 0.34);
  background: rgba(56, 189, 248, 0.12);
  color: #e0f2fe;
}

@media (max-width: 420px) {
  .sort-control {
    gap: 7px;
  }
  .sort-current {
    font-size: 10.5px;
  }
}

/* v18: hashtag guide, series collections and smoother profile graph updates */
.tag-guide {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.tag-guide-group {
  display: grid;
  gap: 8px;
}

.tag-guide-group h3 {
  margin: 0;
  color: #fdba74;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.tag-guide-list {
  display: grid;
  gap: 8px;
}

.tag-guide-item {
  width: 100%;
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px 11px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  text-align: left;
}

.tag-guide-item:active {
  transform: translateY(1px);
}

.tag-guide-item strong {
  display: block;
  margin-bottom: 3px;
  color: #eaf2ff;
  font-size: 13px;
  line-height: 1.1;
}

.tag-guide-item small {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.35;
}

.tag-guide-badge {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: rgba(125, 211, 252, 0.08);
  color: #cfe8ff;
}

.tag-guide-badge .icon {
  width: 16px;
  height: 16px;
}

.focus-tags p {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.tag-cloud-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
  overflow: hidden;
}

.tag-cloud-grid.collapsed {
  max-height: 112px;
}

.tag-cloud-grid.expanded {
  max-height: none;
}

.tag-cloud-chip {
  min-height: 32px;
  font-size: 12px;
}

.cloud-toggle {
  margin-top: 2px;
  padding: 0;
  color: #fdba74;
}

.home-series-card {
  padding: 16px;
}

.series-intro {
  margin: 2px 0 12px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
}

.series-compact-list {
  display: grid;
  gap: 8px;
}

.series-compact-card {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 13px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  text-align: left;
}

.series-compact-card strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
  line-height: 1.15;
}

.series-compact-card small {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.35;
}

.series-compact-card em {
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(125, 211, 252, 0.08);
  color: #bfdbfe;
  font-style: normal;
  font-size: 11px;
  white-space: nowrap;
}

.profile-activity-card {
  contain: layout paint;
}

.range-tab,
.activity-overview-wrap,
.activity-overview-wrap * {
  -webkit-tap-highlight-color: transparent;
}

@media (max-width: 420px) {
  .tag-guide-item {
    padding: 9px 10px;
  }
  .tag-guide-item small {
    font-size: 11px;
  }
  .series-compact-card {
    padding: 11px;
  }
}


.catalog-tags-wrap {
  margin-top: 12px;
}

.catalog-tags-wrap .tag-cloud-grid {
  padding-right: 2px;
}

.catalog-tags-wrap .chip,
.tag-cloud-grid .chip {
  white-space: nowrap;
}

@media (max-width: 420px) {
  .sort-label {
    gap: 5px;
  }
  .tag-guide-badge {
    width: 28px;
    height: 28px;
  }
  .tag-cloud-grid.collapsed {
    max-height: 116px;
  }
}

.date-sort-chip .icon {
  width: 12px;
  height: 12px;
}

.collection-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  color: #dbe7f7;
  font-size: 12px;
}
.collection-banner strong { color: #fff; }
.collection-clear { padding: 0; color: #fdba74; white-space: nowrap; }

/* v22: admin collection editor */
.collection-hint {
  margin: -4px 0 14px;
}

.collection-description {
  min-height: 74px;
}

.collection-editor-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 16px;
}

.collection-column {
  display: grid;
  gap: 9px;
}

.collection-selected-list,
.collection-available-list,
.collection-existing-list {
  display: grid;
  gap: 8px;
}

.collection-available-list {
  max-height: 360px;
  overflow: auto;
  padding-right: 2px;
}

.collection-row,
.collection-existing-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 11px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  background: rgba(255,255,255,0.035);
}

.collection-row strong {
  display: block;
  color: #eaf2ff;
  font-size: 12.5px;
  line-height: 1.25;
}

.collection-row small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.3;
}

.collection-row-actions {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.collection-row-actions .section-action {
  padding: 4px;
}

.collection-row-actions .icon {
  width: 14px;
  height: 14px;
}

.collection-existing-row {
  padding: 0;
  border: none;
  background: transparent;
  grid-template-columns: minmax(0, 1fr) auto;
}

.collection-existing-row .series-compact-card {
  min-width: 0;
}

.danger-soft {
  border-color: rgba(248, 113, 113, 0.22);
  color: #fecaca;
}

@media (min-width: 760px) {
  .collection-editor-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* v24: theme switcher and light theme */
.home-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.home-theme-btn,
.home-profile-btn {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border: 1px solid rgba(125, 211, 252, 0.2);
  border-radius: 16px;
  color: #dbeafe;
  background: rgba(56, 189, 248, 0.1);
}

.home-theme-btn .icon,
.home-profile-btn .icon {
  width: 20px;
  height: 20px;
}

:root[data-theme="light"] {
  --bg: #f5f7fb;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-strong: rgba(255, 255, 255, 0.96);
  --line: rgba(15, 23, 42, 0.10);
  --line-strong: rgba(15, 23, 42, 0.16);
  --text: #0f172a;
  --muted: #64748b;
  --soft: #334155;
  --sky: #0284c7;
  --sky-strong: #0369a1;
  --orange: #c2410c;
  --orange-strong: #ea580c;
  --green: #15803d;
  --danger: #dc2626;
  --shadow: 0 24px 70px rgba(15, 23, 42, 0.14);
}

:root[data-theme="light"] body {
  background:
    radial-gradient(circle at 18% 10%, rgba(14, 165, 233, 0.18), transparent 28%),
    radial-gradient(circle at 88% 18%, rgba(251, 146, 60, 0.18), transparent 24%),
    linear-gradient(180deg, #f8fafc 0%, #eef4fb 100%);
  color: var(--text);
}

:root[data-theme="light"] .phone {
  border-color: rgba(15, 23, 42, 0.12);
  background: #f8fafc;
  box-shadow: 0 28px 90px rgba(15, 23, 42, 0.18);
}

:root[data-theme="light"] .phone::before {
  background: rgba(15, 23, 42, 0.18);
}

:root[data-theme="light"] .phone-glow {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.20), transparent 45%, rgba(251, 146, 60, 0.20));
}

:root[data-theme="light"] .topbar {
  background: rgba(248, 250, 252, 0.84);
  border-bottom-color: rgba(15, 23, 42, 0.08);
}

:root[data-theme="light"] .bottom-nav {
  background: rgba(248, 250, 252, 0.92);
  border-top-color: rgba(15, 23, 42, 0.10);
}

:root[data-theme="light"] .nav-item.active {
  background: rgba(14, 165, 233, 0.13);
  color: #0f172a;
}

:root[data-theme="light"] .card,
:root[data-theme="light"] .article-card,
:root[data-theme="light"] .page-header,
:root[data-theme="light"] .topic-card,
:root[data-theme="light"] .stat-card,
:root[data-theme="light"] .empty-state,
:root[data-theme="light"] .series-compact-card,
:root[data-theme="light"] .tag-guide-item,
:root[data-theme="light"] .collection-banner,
:root[data-theme="light"] .input-wrap {
  border-color: rgba(15, 23, 42, 0.10);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
}

:root[data-theme="light"] .home-hero {
  background:
    radial-gradient(circle at 88% 0%, rgba(14, 165, 233, 0.16), transparent 30%),
    radial-gradient(circle at 12% 100%, rgba(251, 146, 60, 0.18), transparent 34%),
    rgba(255, 255, 255, 0.86);
  box-shadow: 0 18px 52px rgba(15, 23, 42, 0.10);
}

:root[data-theme="light"] .home-stats-row > div,
:root[data-theme="light"] .icon-button,
:root[data-theme="light"] .activity-total,
:root[data-theme="light"] .range-tab,
:root[data-theme="light"] .chip,
:root[data-theme="light"] .tag,
:root[data-theme="light"] .series-compact-card em {
  border-color: rgba(15, 23, 42, 0.10);
  background: rgba(241, 245, 249, 0.88);
  color: #1e293b;
}

:root[data-theme="light"] .home-theme-btn,
:root[data-theme="light"] .home-profile-btn,
:root[data-theme="light"] .tag-guide-badge {
  border-color: rgba(2, 132, 199, 0.20);
  background: rgba(14, 165, 233, 0.10);
  color: #0369a1;
}

:root[data-theme="light"] .btn,
:root[data-theme="light"] .home-catalog-btn {
  color: #0f172a;
}

:root[data-theme="light"] .btn.secondary {
  background: rgba(241, 245, 249, 0.90);
  border-color: rgba(15, 23, 42, 0.12);
  color: #0f172a;
}

:root[data-theme="light"] .article-card.link-card h3,
:root[data-theme="light"] .tag-guide-item strong,
:root[data-theme="light"] .series-compact-card strong,
:root[data-theme="light"] .detail-link-card h1 {
  color: #0f172a;
}

:root[data-theme="light"] .clickable-card:hover {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(14, 165, 233, 0.30);
}

:root[data-theme="light"] .sort-control .sort-chip.active,
:root[data-theme="light"] .date-sort-chip.active,
:root[data-theme="light"] .chip.active,
:root[data-theme="light"] .range-tab.active,
:root[data-theme="light"] .read-toggle.active {
  border-color: rgba(2, 132, 199, 0.30);
  background: rgba(14, 165, 233, 0.12);
  color: #075985;
}

:root[data-theme="light"] .telegram-main-cta,
:root[data-theme="light"] .home-catalog-btn,
:root[data-theme="light"] .btn.orange {
  background: linear-gradient(135deg, #e0f2fe, #fed7aa);
  border-color: rgba(251, 146, 60, 0.28);
}

:root[data-theme="light"] .activity-area {
  fill: rgba(14, 165, 233, 0.12);
}

:root[data-theme="light"] .chart-grid line {
  stroke: rgba(15, 23, 42, 0.09);
}

:root[data-theme="light"] .chart-grid text,
:root[data-theme="light"] .chart-x-labels text {
  fill: rgba(51, 65, 85, 0.70);
}

:root[data-theme="light"] .overview-bg {
  fill: rgba(148, 163, 184, 0.22);
}

:root[data-theme="light"] .overview-window {
  fill: rgba(14, 165, 233, 0.18);
  stroke: rgba(2, 132, 199, 0.28);
}

:root[data-theme="light"] .input-wrap .search-input {
  background: transparent;
  border-color: transparent;
}

:root[data-theme="light"] .input-wrap:focus-within {
  border-color: rgba(59, 130, 246, 0.24);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.08), 0 18px 50px rgba(15, 23, 42, 0.08);
}

/* v28: compact carousel for featured Simple Analytics issues */
.featured-issues-card {
  padding: 14px;
}

.featured-issues-title {
  margin-bottom: 10px;
}

.featured-issues-title h2 {
  font-size: 18px;
  line-height: 1.1;
}

.featured-issues-carousel {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 2px 2px 6px;
  margin: 0 -2px -4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.featured-issues-carousel::-webkit-scrollbar {
  display: none;
}

.featured-issue-card {
  flex: 0 0 72%;
  max-width: 260px;
  display: grid;
  gap: 8px;
  scroll-snap-align: start;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  text-align: left;
}

.featured-issue-card img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.featured-issue-caption {
  display: grid;
  gap: 2px;
  padding: 0 2px 2px;
}

.featured-issue-caption strong {
  color: var(--text);
  font-size: 13px;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.featured-issue-caption small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

.featured-issue-caption em {
  color: #fdba74;
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
  line-height: 1.2;
}

.featured-issue-card:active {
  transform: translateY(1px);
}

:root[data-theme="light"] .featured-issue-card {
  border-color: rgba(15, 23, 42, 0.10);
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 12px 34px rgba(15, 23, 42, 0.07);
}

:root[data-theme="light"] .featured-issue-card img {
  border-color: rgba(15, 23, 42, 0.08);
}

:root[data-theme="light"] .featured-issue-caption em {
  color: #b45309;
}

@media (max-width: 420px) {
  .featured-issue-card {
    flex-basis: 74%;
  }
}

.emoji-badge {
  font-size: 17px;
  line-height: 1;
}

:root[data-theme="light"] .collection-banner {
  color: #334155;
}

:root[data-theme="light"] .collection-banner strong {
  color: #0f172a;
}

/* v30: catalog filter drawer */
.catalog-toolbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}

.filter-main-chip {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
}

.filter-main-chip .icon {
  width: 15px;
  height: 15px;
}

.compact-sort {
  margin-top: 0 !important;
  justify-content: flex-end;
  max-width: 100%;
}

.compact-sort .sort-label {
  margin-right: -2px;
}

.active-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  margin-top: 10px;
}

.active-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid rgba(125, 211, 252, 0.24);
  border-radius: 999px;
  background: rgba(14, 165, 233, 0.10);
  color: #dbeafe;
  font-size: 12px;
  font-weight: 700;
}

.active-filter-chip span {
  color: rgba(226, 232, 240, 0.75);
}

.active-filter-reset {
  padding: 0;
  color: #fdba74;
}

.filter-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(2, 6, 23, 0.50);
  backdrop-filter: blur(3px);
}

.filter-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 90;
  width: min(390px, 92vw);
  height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  border-left: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(7, 11, 25, 0.98);
  color: var(--text);
  box-shadow: -28px 0 80px rgba(0, 0, 0, 0.42);
  animation: drawer-in 180ms ease-out;
}

@keyframes drawer-in {
  from { transform: translateX(16px); opacity: 0.7; }
  to { transform: translateX(0); opacity: 1; }
}

.filter-drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 16px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.filter-drawer-head h2 {
  margin: 2px 0 0;
  font-size: 24px;
  line-height: 1.1;
}

.filter-drawer-body {
  min-height: 0;
  overflow-y: auto;
  padding: 14px 16px 18px;
  display: grid;
  gap: 18px;
}

.filter-group {
  display: grid;
  gap: 8px;
}

.filter-group h3 {
  margin: 0 0 2px;
  color: #fdba74;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.filter-option {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 9px;
  align-items: center;
  width: 100%;
  min-height: 38px;
  padding: 9px 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--soft);
  text-align: left;
  font-size: 13px;
}

.filter-option .icon {
  width: 18px;
  height: 18px;
}

.filter-option.active {
  border-color: rgba(125, 211, 252, 0.34);
  background: rgba(56, 189, 248, 0.12);
  color: #e0f2fe;
}

.filter-empty {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.filter-drawer-footer {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 10px;
  padding: 12px 16px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(7, 11, 25, 0.98);
}

.link-detail .compact-actions {
  margin-top: 10px;
}

:root[data-theme="light"] .active-filter-chip {
  border-color: rgba(14, 165, 233, 0.26);
  background: rgba(14, 165, 233, 0.09);
  color: #0f3f65;
}

:root[data-theme="light"] .active-filter-chip span {
  color: rgba(15, 23, 42, 0.58);
}

:root[data-theme="light"] .filter-backdrop {
  background: rgba(15, 23, 42, 0.25);
}

:root[data-theme="light"] .filter-drawer,
:root[data-theme="light"] .filter-drawer-footer {
  border-color: rgba(15, 23, 42, 0.10);
  background: rgba(248, 250, 252, 0.98);
  color: var(--text);
  box-shadow: -24px 0 70px rgba(15, 23, 42, 0.16);
}

:root[data-theme="light"] .filter-drawer-head,
:root[data-theme="light"] .filter-drawer-footer {
  border-color: rgba(15, 23, 42, 0.10);
}

:root[data-theme="light"] .filter-option {
  border-color: rgba(15, 23, 42, 0.09);
  background: rgba(255, 255, 255, 0.72);
  color: #334155;
}

:root[data-theme="light"] .filter-option.active {
  border-color: rgba(14, 165, 233, 0.30);
  background: rgba(14, 165, 233, 0.10);
  color: #0f3f65;
}

@media (max-width: 420px) {
  .catalog-toolbar {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .compact-sort {
    justify-content: flex-start;
  }
  .filter-drawer {
    width: min(360px, 94vw);
  }
}

/* v31: profile metric switcher and interests chart */
.metric-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 10px 0 8px;
}

.metric-tab {
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--soft);
  font-size: 12px;
  font-weight: 700;
}

.metric-tab.active {
  border-color: rgba(253, 186, 116, 0.42);
  background: rgba(251, 146, 60, 0.16);
  color: #ffedd5;
}

.hidden {
  display: none !important;
}

.interest-bars {
  display: grid;
  gap: 9px;
  margin-top: 12px;
}

.interest-row {
  display: grid;
  grid-template-columns: minmax(92px, 1fr) minmax(90px, 1.2fr) 28px;
  gap: 10px;
  align-items: center;
  min-height: 34px;
  padding: 7px 8px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  text-align: left;
}

.interest-label {
  min-width: 0;
  overflow: hidden;
  color: #dbeafe;
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.interest-track {
  position: relative;
  display: block;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.13);
}

.interest-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.78), rgba(251, 146, 60, 0.86));
}

.interest-row strong {
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

:root[data-theme="light"] .metric-tab,
:root[data-theme="light"] .interest-row {
  border-color: rgba(15, 23, 42, 0.10);
  background: rgba(255, 255, 255, 0.72);
  color: #1e293b;
}

:root[data-theme="light"] .metric-tab.active {
  border-color: rgba(14, 165, 233, 0.28);
  background: rgba(14, 165, 233, 0.12);
  color: #0f172a;
}

:root[data-theme="light"] .interest-label {
  color: #0f172a;
}

:root[data-theme="light"] .interest-track {
  background: rgba(15, 23, 42, 0.10);
}

/* v32: profile analytics polish and catalog pagination */
.catalog-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 12px 0 4px;
  color: var(--muted);
  font-size: 12px;
}

.pagination-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
}

.pagination-chip[disabled] {
  opacity: 0.45;
  pointer-events: none;
}

.catalog-toolbar {
  grid-template-columns: auto 1fr;
}

.compact-sort {
  min-width: 0;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}

.compact-sort::-webkit-scrollbar {
  display: none;
}

.compact-sort .sort-label {
  flex: 0 0 auto;
}

.activity-overview-wrap {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  border-radius: 9px;
}

.activity-overview {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.overview-window {
  rx: 7px;
}

.interest-bars.histogram-bars {
  gap: 10px;
}

.histogram-bars .interest-row {
  grid-template-columns: minmax(104px, 1fr) minmax(120px, 1.5fr) 32px;
  min-height: 39px;
  padding: 8px 9px;
}

.histogram-bars .interest-track {
  height: 13px;
  border-radius: 6px;
}

.histogram-bars .interest-track i {
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.80), rgba(251, 146, 60, 0.86));
}

.histogram-bars .interest-label {
  font-size: 12.5px;
}

@media (max-width: 420px) {
  .catalog-toolbar {
    grid-template-columns: 1fr;
  }
  .histogram-bars .interest-row {
    grid-template-columns: minmax(92px, 1fr) minmax(96px, 1.25fr) 28px;
  }
}

/* v35: richer admin analytics */
.admin-analytics-panel .stats-grid,
.admin-chart-grid {
  margin-top: 12px;
}

.analytics-summary-grid {
  margin-bottom: 12px;
}

.analytics-periods .wide-metric small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.35;
}

.analytics-lists {
  margin-top: 14px;
}

.analytics-lists .mini-row {
  min-height: 38px;
}

:root[data-theme="light"] .analytics-periods .wide-metric small {
  color: #64748b;
}
