:root {
	--red: #e30613;
	--red-dark: #a5000b;
	--ink: #0c1016;
	--panel: rgba(14, 18, 25, 0.9);
	--panel-light: rgba(255, 255, 255, 0.09);
	--muted: #b7bfcb;
	--text: #f8fafc;
	--header-height: 72px;
	--ticker-height: 54px;
	--reader-size: 1.08rem;
	--ticker-duration: 55s;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--ink); }
body.afrss-body {
	overflow: hidden;
	color: var(--text);
	font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	-webkit-font-smoothing: antialiased;
}
button, a { font: inherit; }
button { color: inherit; }

.news-app {
	position: fixed;
	inset: 0;
	height: 100vh;
	height: 100dvh;
	display: grid;
	grid-template-rows: var(--header-height) var(--ticker-height) minmax(0, 1fr);
	background: #0b0e13;
	padding-top: env(safe-area-inset-top, 0);
	padding-right: env(safe-area-inset-right, 0);
	padding-bottom: env(safe-area-inset-bottom, 0);
	padding-left: env(safe-area-inset-left, 0);
}

.topbar {
	position: relative;
	z-index: 10;
	display: grid;
	grid-template-columns: minmax(220px, 1fr) auto minmax(280px, 1fr);
	align-items: center;
	gap: 22px;
	padding: 0 clamp(18px, 3vw, 48px);
	background: rgba(9, 12, 17, 0.96);
	border-bottom: 1px solid rgba(255,255,255,.1);
	backdrop-filter: blur(20px);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; letter-spacing: -.02em; }
.brand strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1.1rem; }
.brand-kicker { color: #fff; background: var(--red); border-radius: 4px; padding: 5px 7px; font-size: .72rem; font-weight: 900; letter-spacing: .12em; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 0 rgba(227,6,19,.7); animation: pulse 1.7s infinite; }
.brand-logo img { display: block; max-height: 42px; width: auto; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(227,6,19,0); } 100% { box-shadow: 0 0 0 0 rgba(227,6,19,0); } }

.topbar-meta { display: flex; align-items: baseline; gap: 16px; color: var(--muted); font-size: .83rem; }
#current-clock { color: #fff; font-size: 1.25rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.controls { justify-self: end; display: flex; gap: 8px; align-items: center; }
.control-button, .icon-button {
	border: 1px solid rgba(255,255,255,.17);
	background: rgba(255,255,255,.06);
	border-radius: 9px;
	min-height: 40px;
	cursor: pointer;
	transition: .18s ease;
}
.control-button { padding: 0 16px; font-weight: 700; }
.icon-button { width: 40px; display: inline-grid; place-items: center; font-size: 1.55rem; line-height: 1; }
.text-size-button { font-size: 1rem; font-weight: 900; }
.control-button:hover, .icon-button:hover, .control-button:focus-visible, .icon-button:focus-visible { background: rgba(255,255,255,.14); outline: none; border-color: rgba(255,255,255,.38); }

.stage { min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) clamp(310px, 28vw, 470px); }
.article-stage { position: relative; min-width: 0; min-height: 0; overflow: hidden; isolation: isolate; }
.article-backdrop { position: absolute; inset: 0; z-index: -3; background-position: center; background-size: cover; transform: scale(1.04); transition: background-image .45s ease, opacity .3s ease; opacity: .62; }
.article-backdrop::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 65% 30%, transparent 0, rgba(7,9,13,.45) 48%, rgba(7,9,13,.95) 100%); }
.article-shade { position: absolute; inset: 0; z-index: -2; background: linear-gradient(90deg, rgba(8,11,16,.98) 0%, rgba(8,11,16,.91) 55%, rgba(8,11,16,.48) 100%), linear-gradient(0deg, rgba(8,11,16,.9), transparent 48%); }
.reader-card { height: 100%; max-width: 1020px; display: flex; flex-direction: column; padding: clamp(26px, 4vw, 68px) clamp(28px, 5vw, 86px) 24px; }
.article-meta-row { display: flex; align-items: center; gap: 13px; color: #d1d7df; font-size: .78rem; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; }
.source-badge { display: inline-flex; align-items: center; border-radius: 4px; padding: 6px 8px; background: var(--red); color: #fff; font-weight: 900; letter-spacing: .08em; }
.article-counter { margin-left: auto; color: var(--muted); }
#article-title { max-width: 920px; margin: 16px 0 10px; font-size: clamp(2rem, 4.35vw, 4.85rem); line-height: 1.02; letter-spacing: -.05em; text-wrap: balance; }
.article-lead { max-width: 850px; margin: 0 0 17px; color: #dde2e9; font-size: clamp(1.05rem, 1.45vw, 1.42rem); line-height: 1.42; font-weight: 550; }
.article-progress { height: 3px; width: min(100%, 850px); background: rgba(255,255,255,.13); overflow: hidden; border-radius: 99px; margin-bottom: 17px; }
.article-progress span { display: block; height: 100%; width: 0; background: var(--red); transition: width .12s linear; }
.article-content { flex: 1 1 auto; max-width: 850px; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 0 22px 32px 0; color: #f0f3f7; font-family: Georgia, "Times New Roman", serif; font-size: var(--reader-size); line-height: 1.72; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.35) transparent; mask-image: linear-gradient(to bottom, transparent 0, #000 18px, #000 calc(100% - 28px), transparent 100%); }
.article-content p { margin: 0 0 1.25em; }
.article-content h2 { margin: 1.5em 0 .55em; font-family: Inter, ui-sans-serif, sans-serif; font-size: 1.45em; line-height: 1.15; }
.article-content blockquote { margin: 1.4em 0; padding: .2em 0 .2em 1.15em; border-left: 4px solid var(--red); font-size: 1.15em; font-style: italic; }
.article-content a { color: #fff; text-decoration-color: var(--red); text-decoration-thickness: 2px; }
.article-content .status-box { font-family: Inter, ui-sans-serif, sans-serif; padding: 18px 20px; border: 1px solid rgba(255,255,255,.14); border-radius: 12px; background: rgba(255,255,255,.06); color: #e1e6ed; }
.reader-footer { max-width: 850px; display: flex; justify-content: space-between; gap: 18px; align-items: center; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.12); color: var(--muted); font-size: .84rem; }
.reader-footer a { color: #fff; font-weight: 800; text-decoration: none; }
.reader-footer a:hover { text-decoration: underline; text-decoration-color: var(--red); }

.headline-panel { min-height: 0; display: flex; flex-direction: column; background: var(--panel); border-left: 1px solid rgba(255,255,255,.11); backdrop-filter: blur(20px); }
.panel-heading { display: flex; justify-content: space-between; align-items: end; padding: 25px 24px 18px; border-bottom: 1px solid rgba(255,255,255,.1); }
.panel-heading h2 { margin: 3px 0 0; font-size: 1.65rem; letter-spacing: -.045em; }
.eyebrow { color: #ff727a; font-size: .7rem; font-weight: 900; letter-spacing: .13em; }
.item-count { display: inline-grid; place-items: center; min-width: 35px; height: 35px; padding: 0 8px; border-radius: 50%; background: rgba(255,255,255,.1); font-size: .82rem; font-weight: 800; }
.headline-list { min-height: 0; overflow-y: auto; scrollbar-width: none; scroll-behavior: smooth; }
.headline-list::-webkit-scrollbar { display: none; }
.headline-item { width: 100%; display: grid; grid-template-columns: 48px 1fr; gap: 13px; text-align: left; color: inherit; border: 0; border-bottom: 1px solid rgba(255,255,255,.075); background: transparent; padding: 18px 22px; cursor: pointer; transition: background .18s ease, border-color .18s ease; }
.headline-item:hover { background: rgba(255,255,255,.06); }
.headline-item.is-active { background: linear-gradient(90deg, rgba(227,6,19,.27), rgba(227,6,19,.04)); box-shadow: inset 4px 0 0 var(--red); }
.headline-time { color: #ff8790; font-size: .76rem; font-weight: 900; font-variant-numeric: tabular-nums; padding-top: 3px; }
.headline-title { display: block; font-size: 1rem; line-height: 1.3; font-weight: 750; letter-spacing: -.015em; }
.headline-summary { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 6px; color: #aeb6c2; font-size: .78rem; line-height: 1.38; }

.ticker { position: relative; z-index: 12; display: grid; grid-template-columns: auto minmax(0,1fr); background: #f6f7f9; color: #101318; overflow: hidden; box-shadow: 0 8px 30px rgba(0,0,0,.2); border-bottom: 1px solid rgba(0,0,0,.12); }
.ticker-label { display: grid; place-items: center; min-width: 118px; padding: 0 22px; background: var(--red); color: #fff; font-size: .77rem; font-weight: 950; letter-spacing: .13em; }
.ticker-window { min-width: 0; display: flex; align-items: center; overflow: hidden; }
.ticker-track { display: flex; align-items: center; width: max-content; white-space: nowrap; will-change: transform; animation: ticker var(--ticker-duration) linear infinite; }
.ticker-track.is-paused { animation-play-state: paused; }
.ticker-item { display: inline-flex; align-items: center; gap: 12px; padding: 0 42px 0 0; min-height: var(--ticker-height); border: 0; background: transparent; color: inherit; font-weight: 800; font-size: .94rem; cursor: pointer; white-space: nowrap; text-align: left; touch-action: manipulation; }
.ticker-item::after { content: "◆"; color: var(--red); font-size: .55rem; margin-left: 30px; }
.ticker-item:hover, .ticker-item:focus-visible { color: var(--red-dark); outline: none; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.ticker-item.is-active { color: var(--red-dark); }
.ticker-track:focus-within, .ticker-track:hover { animation-play-state: paused; }
.ticker-time { color: var(--red); font-size: .8rem; font-weight: 950; }
@keyframes ticker { from { transform: translateX(0); } to { transform: translateX(-50%); } }

.is-loading .article-content { opacity: .65; }
.is-loading #article-title { animation: titlePulse 1s ease-in-out infinite alternate; }
@keyframes titlePulse { from { opacity: .62; } to { opacity: 1; } }

body.reader-large { --reader-size: 1.32rem; }
body.reader-xlarge { --reader-size: 1.55rem; }

@media (max-width: 980px) {
	:root { --header-height: 64px; --ticker-height: 48px; }
	.topbar { grid-template-columns: 1fr auto; padding: 0 16px; }
	.topbar-meta { display: none; }
	.controls { gap: 5px; }
	.control-button { padding: 0 12px; }
	.stage { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) minmax(155px, 24vh); }
	.headline-panel { border-left: 0; border-top: 1px solid rgba(255,255,255,.12); }
	.panel-heading { display: none; }
	.headline-list { display: flex; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x proximity; }
	.headline-item { flex: 0 0 min(84vw, 380px); scroll-snap-align: center; border-right: 1px solid rgba(255,255,255,.08); border-bottom: 0; }
	.reader-card { padding: 25px 24px 18px; }
	#article-title { font-size: clamp(1.8rem, 7vw, 3.45rem); line-height: 1.04; }
	.article-lead { font-size: 1rem; }
	.reader-footer { padding-bottom: 4px; }
	.ticker-label { min-width: 92px; padding: 0 14px; }
}

@media (max-width: 620px) {
	:root { --header-height: 58px; --ticker-height: 44px; --reader-size: 1rem; }
	.topbar { gap: 8px; padding: 0 10px; }
	.brand { gap: 7px; }
	.brand strong { max-width: 82px; font-size: .82rem; }
	.brand-kicker { display: none; }
	.live-dot { width: 8px; height: 8px; }
	.controls { gap: 4px; }
	.icon-button { width: 38px; min-height: 42px; border-radius: 8px; }
	.control-button { min-height: 42px; padding: 0 10px; font-size: .79rem; border-radius: 8px; }
	.stage { grid-template-rows: minmax(0, 1fr) 136px; }
	.article-meta-row { font-size: .68rem; }
	.article-counter { display: none; }
	.reader-card { padding: 16px 15px 11px; }
	#article-title { margin: 9px 0 7px; font-size: clamp(1.55rem, 7.4vw, 2.45rem); line-height: 1.06; letter-spacing: -.04em; }
	.article-lead { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
	.article-progress { margin-bottom: 10px; }
	.article-content { padding: 0 7px 20px 0; line-height: 1.62; mask-image: none; }
	.reader-footer { align-items: center; flex-direction: row; gap: 8px; padding-top: 9px; font-size: .75rem; }
	.reader-footer #article-author { max-width: 42%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
	.reader-footer a { margin-left: auto; text-align: right; }
	.headline-item { flex-basis: min(88vw, 350px); grid-template-columns: 41px 1fr; gap: 9px; padding: 13px 15px; }
	.headline-title { font-size: .9rem; line-height: 1.24; }
	.headline-summary { margin-top: 4px; font-size: .72rem; -webkit-line-clamp: 1; }
	.ticker-label { min-width: 76px; padding: 0 9px; font-size: .65rem; }
	.ticker-item { gap: 8px; padding-right: 30px; font-size: .83rem; }
	.ticker-item::after { margin-left: 20px; }
}

@media (max-width: 390px) {
	.brand strong { display: none; }
	.control-button { padding: 0 8px; }
	.reader-card { padding-right: 12px; padding-left: 12px; }
	.article-lead { -webkit-line-clamp: 2; font-size: .94rem; }
	.reader-footer #article-author { display: none; }
	.reader-footer a { max-width: 100%; }
}

@media (max-height: 560px) and (orientation: landscape) {
	:root { --header-height: 52px; --ticker-height: 40px; }
	.stage { grid-template-columns: minmax(0, 1fr) minmax(220px, 34vw); grid-template-rows: minmax(0, 1fr); }
	.headline-panel { border-top: 0; border-left: 1px solid rgba(255,255,255,.12); }
	.headline-list { display: block; overflow-x: hidden; overflow-y: auto; }
	.headline-item { width: 100%; display: grid; flex: none; border-right: 0; border-bottom: 1px solid rgba(255,255,255,.075); }
	.reader-card { padding-top: 12px; padding-bottom: 8px; }
	#article-title { font-size: clamp(1.35rem, 4.2vw, 2.2rem); }
	.article-lead { -webkit-line-clamp: 2; }
	.reader-footer { display: none; }
}

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