/* =====================================================================
   News - magazine-style feed reader
   ===================================================================== */
.app-news { background: var(--surface); container-type: inline-size; }
.nw-side { width: 232px; }
.nw-side .side-item .nw-src { flex: 0 0 auto; }
.nw-srchead { display: flex; align-items: center; justify-content: space-between; padding-right: 4px; }
.nw-add { width: 24px; height: 24px; }
.nw-feeditem { gap: 9px; }
.nw-addrow { color: var(--text-2); }
.nw-src {
  display: inline-grid; place-items: center; border-radius: 6px; color: #fff; font-weight: 800; line-height: 1;
  background: linear-gradient(135deg, var(--a), var(--b)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14); flex: 0 0 auto;
}
.nw-dot { margin-left: auto; display: grid; place-items: center; flex: 0 0 auto; }
.nw-dot + .count { margin-left: 6px; }
.side-item .nw-dot.warn .ic { color: #d97706; }
.side-item .nw-dot.err .ic { color: #e5484d; }
.nw-dot.spin { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: spin .8s linear infinite; }

.nw-main { position: relative; overflow: hidden; overflow: clip; }
.nw-toolbar { gap: 6px; padding: 0 10px 0 18px; }
.nw-title { margin: 0; font-family: var(--font-display); font-size: 20px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.nw-search { flex: 0 1 250px; min-width: 110px; }
.nw-search .input { height: 34px; }
.nw-refresh .spinner { width: 16px; height: 16px; }
.nw-chips { display: none; }

.nw-feed { flex: 1; min-height: 0; padding: 16px 22px 28px; }
.nw-mag { max-width: 1180px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }

/* banner */
.nw-banner {
  max-width: 1180px; margin: 0 auto 14px; display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 14px; border-radius: 12px;
  background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); font-size: 13px; color: var(--text-2);
}
.nw-banner > span:first-child { display: grid; color: var(--text-3); }
.nw-banner.warn { background: rgba(217, 119, 6, .1); box-shadow: inset 0 0 0 1px rgba(217, 119, 6, .25); }
.nw-banner.warn > span:first-child { color: #d97706; }
.nw-banner-txt { flex: 1; min-width: 0; line-height: 1.4; }
.nw-banner-txt b { color: var(--text); font-weight: 700; }
.nw-why { max-width: 1180px; margin: -6px auto 16px; padding: 4px 16px 6px; font-size: 13px; line-height: 1.5; color: var(--text); }
.nw-why p { margin: 6px 0; }

/* cards */
.nw-card {
  position: relative; display: flex; flex-direction: column; min-width: 0; border-radius: 16px; overflow: hidden; cursor: default;
  background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow .15s, transform .12s, background .15s;
}
.nw-card:hover { box-shadow: inset 0 0 0 1px var(--line-2), 0 10px 26px -16px rgba(0, 0, 0, .45); }
.nw-card:active { transform: scale(.995); }
.nw-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.nw-img { position: relative; flex: 0 0 auto; aspect-ratio: 16 / 9; overflow: hidden; background: var(--surface-3); }
.nw-img img { display: block; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .3s, transform .5s var(--ease); }
.nw-img.ok img { opacity: 1; }
.nw-card:hover .nw-img img { transform: scale(1.025); }
.nw-body { flex: 1; display: flex; flex-direction: column; gap: 7px; padding: 12px 14px 14px; min-width: 0; }
.nw-meta { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 11.5px; font-weight: 600; color: var(--text-3); }
.nw-meta-src { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.nw-meta-dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.nw-meta > span:last-child { white-space: nowrap; }
.nw-h { margin: 0; font-size: 15.5px; font-weight: 600; line-height: 1.3; color: var(--text-2); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; text-wrap: pretty; }
.nw-card.unread .nw-h { color: var(--text); font-weight: 700; }
.nw-card.unread .nw-meta::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: 0 0 auto; margin-right: 1px; }
.nw-sum { margin: 0; font-size: 13px; line-height: 1.45; color: var(--text-2); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.nw-card.noimg .nw-sum { -webkit-line-clamp: 6; }
.nw-card.noimg { background: linear-gradient(180deg, var(--surface-2), var(--surface-2)); }
.nw-save {
  position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; border-radius: 10px; opacity: 0; transition: opacity .12s;
  background: rgba(0, 0, 0, .45); color: #fff; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.nw-save:hover { background: rgba(0, 0, 0, .6); color: #fff; }
.nw-card.noimg .nw-save, .nw-mini .nw-save { background: var(--tile); color: var(--text-2); }
.nw-card:hover .nw-save, .nw-save:focus-visible, .nw-save.on { opacity: 1; }
.nw-save.on { color: #fff; background: var(--accent); }
@media (hover: none) { .nw-save { opacity: 1; } }

/* top block: hero + three minis */
.nw-top { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); gap: 16px; }
.nw-hero .nw-img { aspect-ratio: 16 / 8.4; }
.nw-hero .nw-body { padding: 16px 18px 18px; gap: 9px; }
.nw-hero .nw-h { font-family: var(--font-display); font-size: 26px; font-weight: 500; line-height: 1.18; letter-spacing: -.01em; -webkit-line-clamp: 3; }
.nw-hero.unread .nw-h { font-weight: 600; }
.nw-hero .nw-sum { font-size: 14px; -webkit-line-clamp: 3; }
.nw-toplist { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.nw-mini { flex: 1; flex-direction: row; align-items: stretch; min-height: 96px; }
.nw-mini .nw-img { flex: 0 0 32%; aspect-ratio: auto; }
.nw-mini .nw-body { padding: 10px 12px; justify-content: center; }
.nw-mini .nw-h { font-size: 14px; -webkit-line-clamp: 3; }
.nw-mini .nw-save { top: auto; bottom: 6px; right: 6px; width: 28px; height: 28px; }
.nw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.nw-more { display: flex; justify-content: center; padding: 6px 0 0; }

/* states */
.nw-empty { min-height: 320px; }
.nw-empty p { max-width: 400px; }
.nw-empty-ic { width: 60px; height: 60px; border-radius: 18px; display: grid; place-items: center; background: rgba(var(--accent-rgb), .12); color: var(--accent); }
.nw-empty-acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 10px; }
.nw-skel { max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; animation: nw-pulse 1.2s ease-in-out infinite; }
.nw-skel-hero { grid-column: 1 / -1; height: 220px; border-radius: 16px; background: var(--surface-2); }
.nw-skel-card { display: flex; flex-direction: column; gap: 9px; padding-bottom: 14px; border-radius: 16px; overflow: hidden; background: var(--surface-2); }
.nw-skel-card i { display: block; aspect-ratio: 16 / 9; background: var(--surface-3); }
.nw-skel-card b, .nw-skel-card small { display: block; height: 10px; margin: 0 14px; border-radius: 5px; background: var(--surface-3); }
.nw-skel-card b + b { width: 60%; }
.nw-skel-card small { width: 35%; }
@keyframes nw-pulse { 50% { opacity: .55; } }

/* reader */
.nw-reader {
  position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; background: var(--surface);
  transform: translateX(100%); visibility: hidden; transition: transform .26s var(--ease), visibility 0s .26s;
}
.nw-reader.open { transform: none; visibility: visible; transition: transform .26s var(--ease); }
.reduce-motion .nw-reader { transition: none; }
.nw-r-bar { flex: 0 0 auto; height: 48px; display: flex; align-items: center; gap: 6px; padding: 0 10px; border-bottom: 1px solid var(--line); }
.nw-r-src { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; font-weight: 600; color: var(--text-2); }
.nw-r-src > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nw-r-bar .icon-btn.on { color: var(--accent); }
.nw-r-open { flex: 0 0 auto; }
.nw-r-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.nw-r-art { max-width: 700px; margin: 0 auto; padding: 30px 26px 70px; user-select: text; -webkit-user-select: text; }
.nw-r-kicker { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); }
.nw-r-title { margin: 10px 0 8px; font-family: var(--font-display); font-size: 34px; font-weight: 600; line-height: 1.15; letter-spacing: -.015em; text-wrap: balance; }
.nw-r-by { font-size: 13.5px; color: var(--text-2); margin-bottom: 6px; }
.nw-r-hero { margin: 20px 0 6px; border-radius: 14px; overflow: hidden; background: var(--surface-2); }
.nw-r-hero img { display: block; width: 100%; height: auto; max-height: 380px; object-fit: cover; }
.nw-r-lede { margin: 22px 0 0; font-family: ui-serif, Georgia, 'Times New Roman', serif; font-size: 19px; line-height: 1.6; color: var(--text); }
.nw-r-content { margin-top: 22px; font-family: ui-serif, Georgia, 'Times New Roman', serif; font-size: 17.5px; line-height: 1.7; color: var(--text); overflow-wrap: anywhere; }
.nw-r-content p { margin: 0 0 1.05em; }
.nw-r-content h2, .nw-r-content h3, .nw-r-content h4 { font-family: var(--font); line-height: 1.3; margin: 1.6em 0 .5em; }
.nw-r-content h2 { font-size: 22px; } .nw-r-content h3 { font-size: 19px; } .nw-r-content h4 { font-size: 17px; }
.nw-r-content a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
.nw-r-content img { display: block; max-width: 100%; height: auto; margin: 1.2em auto; border-radius: 10px; }
.nw-r-content figure { margin: 1.4em 0; }
.nw-r-content figcaption { font-family: var(--font); font-size: 13px; line-height: 1.45; color: var(--text-2); margin-top: -.6em; }
.nw-r-content blockquote { margin: 1.2em 0; padding: 2px 0 2px 18px; border-left: 3px solid var(--accent); color: var(--text-2); font-style: italic; }
.nw-r-content pre { overflow-x: auto; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); font-size: 13.5px; line-height: 1.5; }
.nw-r-content code { font-family: var(--mono); font-size: .86em; }
.nw-r-content ul, .nw-r-content ol { padding-left: 1.3em; margin: 0 0 1.05em; }
.nw-r-content li { margin: .25em 0; }
.nw-r-content table { width: 100%; border-collapse: collapse; font-family: var(--font); font-size: 14px; margin: 1em 0; display: block; overflow-x: auto; }
.nw-r-content td, .nw-r-content th { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; }
.nw-r-content hr { border: 0; border-top: 1px solid var(--line-2); margin: 2em 0; }
.nw-r-end { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 13px; color: var(--text-2); }
.nw-r-cta { margin-top: 26px; padding: 18px 18px 16px; border-radius: 14px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.nw-r-cta p { margin: 0 0 12px; font-size: 14px; color: var(--text-2); }
.nw-r-cta-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.nw-r-cta .nw-r-note { margin: 12px 0 0; font-size: 12.5px; }

/* add-a-source sheet */
.nw-sheet-layer {
  position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; padding: 16px;
  background: rgba(0, 0, 0, .32); animation: nw-fade .16s ease both;
}
.nw-sheet-layer.closing { animation: nw-fade .16s ease reverse both; }
@keyframes nw-fade { from { opacity: 0; } }
.nw-sheet {
  width: min(440px, 100%); display: flex; flex-direction: column; gap: 10px; padding: 22px 22px 18px; border-radius: 18px;
  background: var(--surface); box-shadow: var(--shadow-pop); animation: nw-pop .2s var(--ease) both;
}
@keyframes nw-pop { from { transform: translateY(8px) scale(.98); } }
.nw-sheet-ic { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; background: rgba(var(--accent-rgb), .14); color: var(--accent); }
.nw-sheet h2 { margin: 2px 0 0; font-size: 18px; }
.nw-sheet p { margin: 0; font-size: 13px; line-height: 1.45; }
.nw-sheet .input { margin-top: 4px; }
.nw-sheet-label { margin-top: 4px; font-size: 12px; font-weight: 700; color: var(--text-3); }
.nw-seg { align-self: flex-start; flex-wrap: wrap; }
.nw-sheet-msg { display: flex; align-items: flex-start; gap: 8px; min-height: 18px; font-size: 13px; line-height: 1.4; color: var(--text-2); }
.nw-sheet-msg .ic, .nw-sheet-msg .spinner { flex: 0 0 auto; margin-top: 1px; }
.nw-sheet-msg .spinner { width: 15px; height: 15px; }
.nw-sheet-msg.err { color: #e5484d; }
.nw-sheet-msg.warn { color: #b45309; }
:root[data-theme="dark"] .nw-sheet-msg.warn { color: #f5a524; }
.nw-sheet-acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

/* ---------- narrow / phone ---------- */
@container (max-width: 820px) {
  .nw-top { grid-template-columns: 1fr; }
  .nw-toplist { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}
@container (max-width: 700px) {
  .nw-side { display: none; }
  .nw-chips { display: flex; gap: 6px; padding: 8px 12px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); flex: 0 0 auto; }
  .nw-chips::-webkit-scrollbar { display: none; }
  .nw-feed { padding: 12px 12px 24px; }
  .nw-grid { grid-template-columns: 1fr; gap: 12px; }
  .nw-hero .nw-h { font-size: 22px; }
  .nw-r-art { padding: 22px 18px 60px; }
  .nw-r-title { font-size: 27px; }
  .nw-r-content { font-size: 17px; }
  .nw-r-open span { display: none; }
}
@container (max-width: 460px) {
  .nw-title { font-size: 17px; }
  .nw-toolbar { padding-left: 14px; }
  .nw-search { flex-basis: 150px; }
  .nw-toplist { grid-template-columns: 1fr; }
  .nw-mini .nw-img { flex-basis: 34%; }
}
