:root{
  --bg:#f4f7fb;
  --bg-soft:#eef3f9;
  --surface:#ffffff;
  --surface-2:#f8fbff;
  --ink:#142033;
  --muted:#627089;
  --line:#dbe5f0;
  --line-strong:#c8d5e4;
  --accent:#2563eb;
  --accent-2:#7c3aed;
  --accent-soft:rgba(37,99,235,.08);
  --chip-bg:#edf4ff;
  --chip-border:#cfe1ff;
  --success:#138a52;
  --shadow:0 10px 30px rgba(23,43,77,.08);
  --shadow-sm:0 6px 18px rgba(23,43,77,.06);
  --radius:20px;
}

*{ box-sizing:border-box; }

html{
  scroll-behavior:smooth;
}

body{
  margin:0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(37,99,235,.08), transparent 28%),
    radial-gradient(circle at top right, rgba(124,58,237,.06), transparent 26%),
    linear-gradient(180deg, #f8fbff 0%, #f3f7fc 100%);
  color:var(--ink);
  line-height:1.75;
}

a{
  color:var(--accent);
  text-decoration:none;
}

a:hover{
  text-decoration:underline;
}

.wrap{
  max-width:1180px;
  margin:0 auto;
  padding:28px 20px 40px;
}

/* Top nav */
.topbar{
  display:grid;
  grid-template-columns:1fr auto auto;
  align-items:center;
  gap:16px;
  padding:18px 20px;
  margin-bottom:22px;
  background:rgba(255,255,255,.78);
  backdrop-filter:blur(14px);
  border:1px solid rgba(255,255,255,.7);
  box-shadow:var(--shadow-sm);
  border-radius:24px;
}

@media (max-width: 980px){
  .topbar{
    grid-template-columns:1fr;
  }
}

.brand{
  display:flex;
  flex-direction:column;
  gap:6px;
}

.brand .logo{
  margin:0;
  font-size:clamp(1.25rem, 2vw, 1.8rem);
  letter-spacing:-.03em;
  font-weight:800;
  color:#0f172a;
}

.brand .tag{
  font-size:13px;
  color:var(--muted);
  letter-spacing:.02em;
}

/* Layout */
.grid{
  display:grid;
  grid-template-columns:72px minmax(0, 1fr) 320px;
  gap:20px;
  margin-top:16px;
}

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

  .share-rail{
    display:none;
  }

  .sidebar{
    order:3;
  }
}

/* Article card */
.article{
  background:linear-gradient(180deg, rgba(255,255,255,.96), rgba(248,251,255,.96));
  border:1px solid rgba(255,255,255,.9);
  border-radius:28px;
  overflow:hidden;
  box-shadow:var(--shadow);
}

.article-header{
  padding:24px 24px 18px;
  border-bottom:1px solid var(--line);
  background:
    radial-gradient(circle at top right, rgba(124,58,237,.10), transparent 28%),
    linear-gradient(180deg, rgba(37,99,235,.08), rgba(255,255,255,.45));
}

.breadcrumbs{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
  font-size:12px;
  color:var(--muted);
  margin-bottom:12px;
}

.breadcrumbs a{
  color:var(--muted);
}

.chips{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin:8px 0 12px;
}

.chip{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:7px 12px;
  border-radius:999px;
  font-size:12px;
  font-weight:700;
  background:var(--chip-bg);
  border:1px solid var(--chip-border);
  color:#2157a5;
}

h1{
  margin:10px 0 12px;
  font-size:clamp(2rem, 1vw, 3rem);
  line-height:1.08;
  letter-spacing:-.04em;
  color:#0f172a;
}

.meta{
  color:var(--muted);
  font-size:13px;
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
  font-weight:600;
}

/* Share row */
.share-row{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  align-items:center;
  margin-top:14px;
}

.btnlink{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:9px 11px;
  border-radius:12px;
  border:1px solid var(--line);
  background:#fff;
  color:#23324a;
  font-size:12px;
  font-weight:700;
  cursor:pointer;
  text-decoration:none;
  transition:all .18s ease;
  box-shadow:0 2px 8px rgba(23,43,77,.03);
}

.btnlink:hover{
  background:#f3f8ff;
  border-color:#cfe0f5;
  color:var(--accent);
  transform:translateY(-1px);
  text-decoration:none;
}

.toast{
  display:none;
  color:var(--success);
  font-size:12px;
  font-weight:700;
}

/* Sticky share rail */
.share-rail{
  position:sticky;
  top:16px;
  height:fit-content;
  display:flex;
  flex-direction:column;
  gap:10px;
  align-items:stretch;
}

.share-rail .btnlink{
  justify-content:center;
  min-height:44px;
  background:rgba(255,255,255,.84);
  backdrop-filter:blur(8px);
  box-shadow:var(--shadow-sm);
}

/* Media */
.media{
  padding:18px 24px 0;
}

.carousel-wrap{
  margin:12px 0 16px;
}

.carousel-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
  color:var(--muted);
  font-size:13px;
  margin-bottom:10px;
  font-weight:600;
}

.controls{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.carousel{
  display:flex;
  gap:14px;
  overflow-x:auto;
  scroll-snap-type:x mandatory;
  border:1px solid var(--line);
  border-radius:20px;
  background:linear-gradient(180deg, #f9fbff, #f2f6fb);
  padding:12px;
  -webkit-overflow-scrolling:touch;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.8);
}

.carousel::-webkit-scrollbar{
  height:10px;
}

.carousel::-webkit-scrollbar-thumb{
  background:#cfdceb;
  border-radius:999px;
}

.slide{
  flex:0 0 92%;
  scroll-snap-align:center;
  border-radius:18px;
  overflow:hidden;
  border:1px solid #dbe5f0;
  background:#eaf0f8;
  aspect-ratio:16 / 9;
  display:flex;
  align-items:center;
  justify-content:center;
  position:relative;
  box-shadow:var(--shadow-sm);
}

.slide img{
  width:100%;
  height:100%;
  object-fit:contain;
  display:block;
  background:#edf2f8;
}

@media (min-width: 900px){
  .slide{
    flex-basis:72%;
  }
}

.caption{
  position:absolute;
  left:12px;
  bottom:12px;
  background:rgba(20,32,51,.72);
  color:#fff;
  padding:7px 11px;
  border-radius:999px;
  font-size:12px;
  backdrop-filter:blur(4px);
}

/* Article body */
.body{
  padding:8px 24px 24px;
}

.article-text{
  color:#314056;
  font-size:16px;
  white-space:pre-wrap;
  margin:0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

/* Sidebar */
.sidebar{
  position:sticky;
  top:16px;
  height:fit-content;
  display:flex;
  flex-direction:column;
  gap:14px;
}

.panel{
  border:1px solid rgba(255,255,255,.85);
  border-radius:24px;
  background:rgba(255,255,255,.82);
  backdrop-filter:blur(12px);
  padding:18px;
  box-shadow:var(--shadow-sm);
}

.panel h3{
  margin:0 0 12px;
  font-size:13px;
  text-transform:uppercase;
  letter-spacing:.12em;
  color:#3c4a63;
}

.rel a{
  color:#152338;
  text-decoration:none;
  font-weight:700;
}

.rel a:hover{
  color:var(--accent);
  text-decoration:none;
}

.rel-item{
  padding:12px 0;
  border-top:1px solid var(--line);
}

.rel-item:first-child{
  border-top:none;
  padding-top:0;
}

.smallmuted{
  color:var(--muted);
  font-size:12px;
  margin-top:4px;
}

/* Auth */
.site-auth{
  display:flex;
  align-items:center;
  gap:12px;
  padding:8px 12px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.82);
  border-radius:16px;
  box-shadow:var(--shadow-sm);
}

.site-auth__welcome{
  font-size:13px;
  color:#22314a;
  font-weight:600;
}

.site-auth__logout{
  margin:0;
  display:inline-block;
}

.site-auth button{
  padding:8px 12px;
  border:1px solid #d7e1ec;
  background:#fff;
  color:#1f2e45;
  border-radius:12px;
  cursor:pointer;
  font-weight:700;
  box-shadow:none;
}

.site-auth button:hover{
  background:#f6f9fd;
}

/* Nav */
.nav{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
}

.nav a{
  color:#22314a;
  font-size:13px;
  font-weight:700;
  padding:9px 12px;
  border-radius:999px;
  border:1px solid var(--line);
  text-decoration:none;
  background:rgba(255,255,255,.86);
  transition:all .18s ease;
}

.nav a:hover{
  color:var(--accent);
  border-color:#cfe0f5;
  background:#f4f8ff;
  text-decoration:none;
}

.comments-panel{
  border:1px solid rgba(255,255,255,.85);
  border-radius:24px;
  background:rgba(255,255,255,.82);
  backdrop-filter:blur(12px);
  box-shadow:0 6px 18px rgba(23,43,77,.06);
  padding:18px;
  margin-top:18px;
}

.comments-panel h3{
  margin:0 0 12px;
  font-size:18px;
  color:#0f172a;
  letter-spacing:-.02em;
}

.comment-msg{
  padding:12px 14px;
  border-radius:14px;
  margin-bottom:12px;
  font-size:14px;
  line-height:1.55;
}

.comment-msg--ok{
  background:#e9f9ef;
  border:1px solid #bfe9cb;
  color:#11663f;
}

.comment-msg--err{
  background:#fff1f1;
  border:1px solid #f2c4c4;
  color:#9f1d1d;
}

.comment-form{
  display:flex;
  flex-direction:column;
  gap:10px;
  align-items:stretch;
}

.comment-form textarea{
  width:100%;
  min-height:120px;
  padding:12px 13px;
  border:1px solid #dbe5f0;
  border-radius:14px;
  background:#fff;
  color:#142033;
  font:inherit;
  resize:vertical;
  outline:none;
}

.comment-form textarea:focus{
  border-color:rgba(37,99,235,.45);
  box-shadow:0 0 0 4px rgba(37,99,235,.10);
}

.comment-list{
  display:flex;
  flex-direction:column;
  gap:12px;
  margin-top:14px;
}

.comment-item{
  padding:14px 16px;
  border:1px solid #dbe5f0;
  border-radius:16px;
  background:rgba(255,255,255,.72);
}

.comment-meta{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
  margin-bottom:8px;
  font-size:12px;
  color:#627089;
}

.comment-author{
  font-weight:800;
  color:#132238;
}

.comment-body{
  margin:0;
  white-space:pre-wrap;
  color:#314056;
  line-height:1.7;
  font-size:14px;
}

.comment-empty{
  color:#627089;
  font-size:14px;
  padding:14px 0 4px;
}

.comment-login-note{
  color:#627089;
  font-size:14px;
}