:root {
  --bg: #0f1218;
  --panel: #181f2b;
  --panel-2: #121823;
  --surface: #121822;
  --text: #f2f5f9;
  --muted: #a4afbd;
  --accent: #d63b4a;
  --accent-soft: #f05462;
  --border: #2a3240;
  --border-strong: rgba(240, 84, 98, .32);
  --glass: rgba(18, 24, 34, .78);
}

* {
  box-sizing: border-box;
  max-width: 100vw;
}

html {
  font-size: 13px;
  /* Aggressive shrink for Tiny R1 Screen */
}

body {
  margin: 0;
  font-family: "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
  background:
    radial-gradient(900px 350px at 10% -12%, rgba(214, 59, 74, .18), transparent 45%),
    radial-gradient(560px 240px at 100% 0%, rgba(116, 156, 255, .12), transparent 48%),
    linear-gradient(180deg, #0d1016, #0f1218 38%, #121722 100%);
  color: var(--text);
  overflow-x: hidden;
  max-width: 100vw;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Chrome nav ── */
.chrome-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: .35rem;
  padding: .3rem .4rem;
  border-bottom: 1px solid rgba(255, 255, 255, .05);
  background: rgba(11, 14, 19, .76);
  backdrop-filter: blur(14px);
}

.nav-btn {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .06);
  background: linear-gradient(180deg, rgba(35, 45, 62, .88), rgba(21, 28, 40, .92));
  color: var(--text);
  font-size: .95rem;
  cursor: pointer;
}

.nav-btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#navRefresh svg {
  width: 13px;
  height: 13px;
  stroke-width: 1.8;
}

.nav-btn:disabled {
  opacity: .42;
  cursor: default;
}

.nav-btn:focus-visible,
.search-input:focus-visible,
.region-select:focus-visible,
.source-link:focus-visible {
  outline: 2px solid rgba(240, 84, 98, .9);
  outline-offset: 2px;
}

.view-label {
  margin-left: .3rem;
  color: var(--muted);
  font-size: .78rem;
  letter-spacing: .02em;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.font-tools {
  margin-left: auto;
  display: inline-flex;
  gap: .24rem;
}

.nav-btn-font {
  width: 34px;
  font-size: .72rem;
  letter-spacing: .2px;
}

/* ── Shell ── */
.app-shell {
  max-width: 288px;
  width: 100%;
  margin: 0 auto;
  padding: 0;
  overflow-x: hidden;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.view {
  margin-top: .1rem;
  overflow-x: hidden;
  max-width: 100%;
  width: 100%;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#viewHome {
  overflow: hidden;
}

.hidden {
  display: none !important;
}

.hero {
  margin: 0 .2rem .04rem;
}

.hero h1 {
  margin: 0 .05rem;
  font-size: .85rem;
  line-height: 1.1;
}

/* ── Card panel ── */
.card {
  margin: .2rem .1rem;
  padding: .2rem .25rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  max-width: calc(100vw - .4rem);
}

.card h3 {
  margin: 0 0 .35rem;
  font-size: .78rem;
  line-height: 1.2;
}

.controls label {
  display: block;
  margin: .2rem 0 .3rem;
  color: var(--muted);
  font-size: .72rem;
}

.row {
  display: flex;
  gap: .32rem;
  flex-wrap: wrap;
}

input {
  flex: 1;
  min-width: 110px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0f141e;
  color: var(--text);
  padding: .42rem .48rem;
  font-size: .75rem;
}

/* ── Compact Top Bar ── */
.top-bar {
  display: flex;
  gap: .2rem;
  margin-bottom: .16rem;
  flex-shrink: 0;
}

.search-form {
  flex: 1;
  display: flex;
}

.search-input {
  width: 100%;
  min-height: 2.1rem;
  padding: .42rem .62rem;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, .08);
  background: linear-gradient(180deg, rgba(18, 24, 34, .94), rgba(14, 19, 28, .98));
  color: var(--text);
  font-size: .78rem;
  font-family: inherit;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .03);
}

.search-input:focus {
  border-color: var(--border-strong);
}

.region-select {
  flex: 1;
  min-height: 2.1rem;
  padding: .42rem .62rem;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, .08);
  background: linear-gradient(180deg, rgba(18, 24, 34, .94), rgba(14, 19, 28, .98));
  color: var(--text);
  font-size: .72rem;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d7ddf0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right .5rem center;
  background-size: 1rem;
  padding-right: 2rem;
}

.region-select:focus {
  border-color: var(--border-strong);
}

/* ── Breaking wheel nav ── */
.breaking-section {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin-top: 0;
  border: none;
  padding: 0;
  background: transparent;
}

.breaking-section h3 {
  flex-shrink: 0;
  margin: 0 0 .05rem 0;
  font-size: .75rem;
  color: #ffced3;
  text-align: center;
}

.breaking-section .deck {
  flex: 1;
  height: 156px;
  min-height: 0;
  margin: .35rem .1rem 0;
}

.breaking-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: 0 0 .1rem;
}

.breaking-arrow {
  font-size: .55rem;
  padding: .2rem .35rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #111826;
  color: #dfe7f3;
  cursor: pointer;
}

.break-counter {
  font-size: .6rem;
  color: var(--muted);
  min-width: 2rem;
  text-align: center;
}

/* ── Empty state ── */
.empty-state {
  display: flex;
  align-items: center;
  gap: .4rem;
  color: var(--muted);
  font-size: .68rem;
  padding: .2rem 0;
}

.empty-emoji {
  font-size: .9rem;
}

/* ── 3D Wheel Deck ── */
.deck {
  position: relative;
  height: 208px;
  margin: .7rem .1rem .1rem;
  perspective: 260px;
  perspective-origin: center 46%;
  transform-style: preserve-3d;
  overflow: visible;
}

.card-counter {
  text-align: center;
  color: #ffd6db;
  background: rgba(17, 24, 38, .88);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .06);
  padding: .34rem .72rem;
  font-size: .62rem;
  letter-spacing: .42px;
  width: max-content;
  margin: .38rem auto -10.7vh;
  position: relative;
  z-index: 50;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .24);
}

.more-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .28rem;
  width: max-content;
  margin: -9.8vh auto 0;
  padding: .22rem .55rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .08);
  background: rgba(17, 24, 38, .9);
  color: #ffd0d5;
  font-size: .58rem;
  letter-spacing: .22px;
  position: relative;
  z-index: 50;
  pointer-events: none;
}

.more-hint__icon {
  font-size: .7rem;
  line-height: 1;
}

/* ── News card (wheel item) ── */
.news-card {
  position: absolute;
  top: 6px;
  left: 0;
  width: 100%;
  cursor: pointer;
  will-change: transform, opacity;
  transform-origin: center center;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  contain: layout paint;
}

.news-card-shell {
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .06);
  background:
    linear-gradient(180deg, rgba(29, 38, 53, .98), rgba(16, 22, 32, .98)),
    linear-gradient(135deg, rgba(255, 255, 255, .02), rgba(255, 255, 255, 0));
  box-shadow: 0 8px 22px rgba(0, 0, 0, .34);
  transform: translateZ(0);
  transition: border-color .16s ease, box-shadow .16s ease, opacity .16s ease;
  backface-visibility: hidden;
}

.news-card.is-active .news-card-shell {
  border-color: rgba(240, 84, 98, .88);
  box-shadow: 0 0 18px rgba(240, 84, 98, .22), 0 12px 28px rgba(0, 0, 0, .42);
}

.news-card-image {
  width: 100%;
  height: 92px;
  object-fit: cover;
  display: block;
  background: #0b111a;
}

.news-card-image--placeholder {
  display: grid;
  place-items: center;
  font-size: .65rem;
  color: #ffced3;
  background: linear-gradient(135deg, rgba(214, 59, 74, .28), rgba(240, 84, 98, .12));
}

.news-card-content {
  padding: .34rem .48rem .48rem;
  display: grid;
  gap: .24rem;
}

.news-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .34rem;
  color: #b5c0cf;
  font-size: .53rem;
  letter-spacing: .24px;
  text-transform: uppercase;
}

.news-card-source {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.news-card-age {
  color: #ffced3;
  flex-shrink: 0;
}

.news-card-flags {
  display: inline-flex;
  align-items: center;
  gap: .18rem;
  margin-left: auto;
}

.news-card-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.7rem;
  padding: .08rem .28rem;
  border-radius: 999px;
  border: 1px solid rgba(240, 84, 98, .28);
  background: rgba(255, 208, 213, .08);
  color: #ffd0d5;
  font-size: .49rem;
  letter-spacing: .24px;
}

.news-card-flag--source {
  border-color: rgba(255, 214, 102, .35);
  background: rgba(255, 214, 102, .08);
  color: #ffe5a0;
}

.news-card-content h3 {
  margin: 0;
  font-size: .8rem;
  line-height: 1.3;
  letter-spacing: -.01em;
}

.news-card-content p {
  margin: 0;
  color: #d3dceb;
  line-height: 1.28;
  max-height: 3.2em;
  overflow: hidden;
  font-size: .66rem;
}

.news-card-loadmore {
  display: grid;
  gap: .08rem;
  margin-top: .1rem;
  padding-top: .28rem;
  border-top: 1px solid rgba(255, 255, 255, .08);
}

.news-card-loadmore-label {
  display: inline-flex;
  align-items: center;
  width: max-content;
  padding: .08rem .34rem;
  border-radius: 999px;
  border: 1px solid rgba(240, 84, 98, .22);
  background: rgba(240, 84, 98, .08);
  color: #ffd5da;
  font-size: .5rem;
  letter-spacing: .28px;
  text-transform: uppercase;
}

.news-card-loadmore-text {
  color: #f5d4d8;
  font-size: .62rem;
  line-height: 1.3;
}

/* ── #14 Error card ── */
.error-card {
  text-align: center;
  padding: 1.2rem .8rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: linear-gradient(180deg, #1b2230, #121824);
  margin: .35rem .2rem;
}

.error-card p {
  color: var(--muted);
  font-size: .7rem;
  margin: .4rem 0 .6rem;
}

/* ── Article ── */
.article-lead-image {
  width: 100%;
  max-height: 80px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: .3rem;
  display: block;
}

.article-shell h2 {
  margin: 0;
  line-height: 1.2;
  font-size: .85em;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Force article shell to never overflow */
.article-shell {
  overflow-x: hidden;
  max-width: 100%;
}

.source-link {
  color: #ffb6bf;
  text-decoration: none;
  font-size: .72rem;
}

.source-link:hover {
  text-decoration: underline;
}

.source-link-bottom {
  display: inline-block;
  margin-top: .62rem;
}

.article-sections {
  margin-top: .25rem;
  display: grid;
  gap: .35rem;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

.article-note {
  margin-top: .28rem;
  padding: .22rem .3rem;
  border-radius: 8px;
  border: 1px solid rgba(240, 84, 98, .22);
  background: rgba(255, 208, 213, .06);
  color: #ffced3;
  font-size: .64rem;
  line-height: 1.3;
}

.article-note--warn {
  border-color: rgba(255, 214, 102, .34);
  background: rgba(255, 214, 102, .08);
  color: #ffe5a0;
}

.article-chunk {
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: .3rem;
  background: #111722;
  overflow: hidden;
  word-wrap: break-word;
  overflow-wrap: break-word;
  min-width: 0;
  max-width: 100%;
}

.article-chunk p {
  margin: 0;
  color: #d6deeb;
  line-height: 1.35;
  font-size: .72em;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Constrain all images inside article content for R1 screen */
.article-chunk img {
  max-width: 100% !important;
  width: auto !important;
  height: auto !important;
  max-height: 100px;
  object-fit: contain;
  border-radius: 4px;
  display: block;
  margin: .3rem 0;
}

/* Constrain iframes, videos, tables inside articles */
.article-chunk iframe,
.article-chunk video,
.article-chunk table,
.article-chunk figure {
  max-width: 100% !important;
  width: auto !important;
  height: auto !important;
  overflow: hidden;
}

/* Nuclear: force ALL children inside article content to fit */
.article-chunk * {
  max-width: 100% !important;
  box-sizing: border-box;
}

/* Override any inline width/height attributes on divs and spans */
.article-chunk div,
.article-chunk span,
.article-chunk pre,
.article-chunk code,
.article-chunk blockquote {
  max-width: 100% !important;
  overflow-x: hidden;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.article-chunk--plain p+p {
  margin-top: .62rem;
}

/* ── Status bar ── */
.status {
  max-width: 250px;
  margin: .08rem auto .28rem;
  padding: 0 .45rem;
  min-height: 1rem;
  color: #b5c1cf;
  font-size: .68rem;
  line-height: 1.3;
  transition: opacity .2s ease;
}

.status--loading {
  animation: pulse-loading 1.2s ease-in-out infinite;
}

/* ── #3 Animations ── */
@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-in {
  animation: fade-up .3s ease both;
}

@keyframes card-shell-intro {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.news-card-shell--intro {
  animation: card-shell-intro .28s ease both;
}

@keyframes pulse-loading {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: .45;
  }
}
