:root {
  --news-ticker-height: 38px;
  --news-ticker-duration: 70s;
}

.dsc-news-ticker {
  position: fixed;
  top: var(--safe-top, 0px);
  left: 0;
  right: 0;
  z-index: 3500;
  height: var(--news-ticker-height);
  display: flex;
  align-items: stretch;
  overflow: hidden;
  color: var(--text);
  background: rgba(21, 27, 34, .94);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 6px 18px var(--panel-shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-110%);
  transition: opacity .18s ease, transform .22s ease;
}

body.theme-light .dsc-news-ticker {
  background: rgba(255, 255, 255, .96);
}

.dsc-news-ticker.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.dsc-news-ticker-brand {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  min-width: 112px;
  margin-left: 94px;
  padding: 0 13px;
  border: 0;
  border-right: 1px solid var(--border);
  border-radius: 0;
  background: var(--info);
  color: #fff;
  font: 800 12px/1 system-ui, -apple-system, "Segoe UI", sans-serif;
  letter-spacing: 0;
  cursor: pointer;
}

.dsc-news-ticker-brand-compact {
  display: none;
}

.dsc-news-ticker-brand:focus-visible,
.dsc-news-ticker-item:focus-visible,
.dsc-news-room button:focus-visible,
.dsc-news-source-link:focus-visible {
  outline: 3px solid #ffcc00;
  outline-offset: -3px;
}

.dsc-news-new-count {
  display: inline-flex;
  min-width: 16px;
  min-height: 16px;
  margin-left: 5px;
  padding: 0 4px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #fff;
  color: #111827;
  font-size: 9px;
  line-height: 16px;
}

.dsc-news-new-count[hidden] {
  display: none;
}

.dsc-news-ticker-viewport {
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.dsc-news-ticker-track {
  display: flex;
  width: max-content;
  height: 100%;
  will-change: transform;
  animation: dsc-news-crawl var(--news-ticker-duration) linear infinite;
}

.dsc-news-ticker:hover .dsc-news-ticker-track {
  animation-play-state: paused;
}

.dsc-news-ticker-group {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 26px;
  padding-right: 26px;
}

.dsc-news-ticker-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 100%;
  max-width: 640px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font: 600 13px/1.2 system-ui, -apple-system, "Segoe UI", sans-serif;
  letter-spacing: 0;
  white-space: nowrap;
  cursor: pointer;
}

.dsc-news-ticker-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dsc-news-ticker-item::after {
  content: "";
  position: absolute;
  right: -16px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--muted);
}

.dsc-news-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 6px;
  border: 1px solid currentColor;
  border-radius: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.dsc-news-badge--italy,
.dsc-news-badge--operations { color: #36b37e; }
.dsc-news-badge--regulation,
.dsc-news-badge--europe { color: #4ea1ff; }
.dsc-news-badge--safety,
.dsc-news-badge--defence { color: #ff6b6b; }
.dsc-news-badge--fpv,
.dsc-news-badge--technology { color: #d58cff; }
.dsc-news-badge--world,
.dsc-news-badge--market { color: #ffb454; }
.dsc-news-badge--uspace,
.dsc-news-badge--events { color: #36c5d0; }

/* La PWA usa un marchio compatto: la linguetta laterale conserva lo spazio
 * a sinistra, mentre il ticker recupera larghezza per i titoli. */
body.pwa-standalone .dsc-news-ticker-brand {
  min-width: 44px;
  width: 44px;
  margin-left: 86px;
  padding: 0;
}

body.pwa-standalone .dsc-news-ticker-brand-full {
  display: none;
}

body.pwa-standalone .dsc-news-ticker-brand-compact {
  display: inline;
}

body.pwa-standalone .dsc-news-new-count {
  position: absolute;
  top: 2px;
  right: -6px;
  margin-left: 0;
}

@keyframes dsc-news-crawl {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-50%, 0, 0); }
}

.dsc-news-room-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: grid;
  place-items: center;
  padding: max(18px, var(--safe-top, 0px)) 18px max(18px, var(--safe-bottom, 0px));
  background: rgba(3, 8, 13, .72);
  backdrop-filter: blur(5px);
}

.dsc-news-room-overlay[hidden] {
  display: none;
}

.dsc-news-room {
  width: min(1180px, calc(100vw - 36px));
  height: min(900px, calc(100dvh - 36px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .48);
}

.dsc-news-room-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 26px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

.dsc-news-room-header h2 {
  margin: 0;
  color: var(--text);
  font-size: 25px;
  line-height: 1.1;
  letter-spacing: 0;
}

.dsc-news-room-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.dsc-news-room-close {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.dsc-news-room-close:hover,
.dsc-news-filters button:hover,
.dsc-news-load-more:hover {
  background: var(--hover-bg);
}

.dsc-news-filters {
  display: flex;
  flex: 0 0 auto;
  gap: 4px;
  padding: 10px 18px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  scrollbar-width: none;
}

.dsc-news-filters::-webkit-scrollbar {
  display: none;
}

.dsc-news-filters button {
  min-height: 38px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font: 700 11px/1 system-ui, -apple-system, "Segoe UI", sans-serif;
  letter-spacing: 0;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
}

.dsc-news-filters button[aria-pressed="true"] {
  border-color: var(--info);
  background: var(--hover-bg);
  color: var(--text);
}

.dsc-news-room-scroll {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 26px 26px;
}

.dsc-news-room-status {
  min-height: 20px;
  margin: 14px 0;
  color: var(--muted);
  font-size: 13px;
}

.dsc-news-room-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.dsc-news-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 13px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
}

.dsc-news-card.is-featured {
  grid-column: 1 / -1;
  padding: 24px;
  border-left: 4px solid var(--info);
}

.dsc-news-card.is-selected {
  outline: 3px solid var(--info);
  outline-offset: 2px;
}

.dsc-news-card-kicker {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.dsc-news-featured-label {
  color: var(--text);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.dsc-news-card h3 {
  margin: 0;
  color: var(--text);
  font-size: 19px;
  line-height: 1.28;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.dsc-news-card.is-featured h3 {
  font-size: 24px;
}

.dsc-news-card-summary {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.dsc-news-card-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-top: auto;
  padding-top: 3px;
}

.dsc-news-card-meta {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.dsc-news-source-link {
  color: var(--info);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

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

.dsc-news-room-footer {
  display: flex;
  justify-content: center;
  padding: 22px 0 4px;
}

.dsc-news-load-more {
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  font: 700 13px/1 system-ui, -apple-system, "Segoe UI", sans-serif;
  cursor: pointer;
}

@media (max-width: 760px) {
  :root { --news-ticker-height: 36px; }

  .dsc-news-ticker-brand {
    min-width: 100px;
    margin-left: 86px;
    padding: 0 9px;
    font-size: 11px;
  }

  .dsc-news-ticker-group {
    gap: 22px;
    padding-right: 22px;
  }

  .dsc-news-ticker-item {
    max-width: 390px;
    font-size: 12px;
  }

  .dsc-news-room-overlay {
    padding: var(--safe-top, 0px) 0 var(--safe-bottom, 0px);
  }

  .dsc-news-room {
    width: 100vw;
    height: 100dvh;
    border-width: 0;
    border-radius: 0;
  }

  .dsc-news-room-header {
    padding: 16px;
  }

  .dsc-news-room-header h2 { font-size: 21px; }
  .dsc-news-room-close { width: 44px; height: 44px; }
  .dsc-news-filters { padding: 8px 12px; }
  .dsc-news-room-scroll { padding: 0 14px 18px; }
  .dsc-news-room-list { grid-template-columns: 1fr; }
  .dsc-news-card,
  .dsc-news-card.is-featured { grid-column: auto; padding: 17px; }
  .dsc-news-card.is-featured h3,
  .dsc-news-card h3 { font-size: 18px; }
  .dsc-news-card-footer { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  .dsc-news-ticker,
  .dsc-news-ticker-track {
    transition: none;
    animation: none;
  }

  .dsc-news-ticker-group[aria-hidden="true"],
  .dsc-news-ticker-group:first-child .dsc-news-ticker-item:not(:first-child) {
    display: none;
  }
}
