body {
  overflow-x: hidden;
  background: #f8f9fa;
}

body.theme-classic {
  position: relative;
  isolation: isolate;
  background:
    radial-gradient(circle at 6% 8%, rgba(74, 128, 243, 0.14), transparent 32%),
    radial-gradient(circle at 96% 0%, rgba(42, 73, 155, 0.12), transparent 30%),
    linear-gradient(180deg, #edf3ff 0%, #f6f8fc 40%, #fbfcff 100%);
  background-attachment: fixed;
  min-height: 100vh;
}

body.theme-classic::before,
body.theme-classic::after {
  content: '';
  position: fixed;
  pointer-events: none;
  z-index: -1;
}

body.theme-classic::before {
  width: min(60vmin, 640px);
  height: min(60vmin, 640px);
  right: -10vmin;
  top: 14vh;
  opacity: 0.22;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 640 640'%3E%3Cg fill='none' stroke='%23274a97' stroke-linecap='round'%3E%3Ccircle cx='320' cy='320' r='250' stroke-width='3'/%3E%3Cellipse cx='320' cy='320' rx='250' ry='112' stroke-width='2.2'/%3E%3Cellipse cx='320' cy='320' rx='250' ry='184' stroke-width='2.2'/%3E%3Cellipse cx='320' cy='320' rx='110' ry='250' stroke-width='2.2'/%3E%3Cellipse cx='320' cy='320' rx='175' ry='250' stroke-width='2.2'/%3E%3Cpath d='M70 320h500M106 230h428M106 410h428' stroke-width='2.1'/%3E%3C/g%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  filter: drop-shadow(0 20px 36px rgba(30, 58, 133, 0.12));
}

body.theme-classic::after {
  width: 320px;
  height: 320px;
  left: -120px;
  bottom: -120px;
  opacity: 0.14;
  border-radius: 999px;
  background:
    radial-gradient(circle at 35% 35%, rgba(60, 105, 210, 0.45), rgba(60, 105, 210, 0.08) 45%, transparent 70%);
}

body.theme-classic #appHeader.bg-primary {
  position: relative;
  overflow: visible;
  background:
    linear-gradient(128deg, #1f5fd9 0%, #2448b4 56%, #1d2f78 100%) !important;
  border-bottom: 1px solid rgba(19, 39, 95, 0.45);
  box-shadow: 0 12px 28px rgba(20, 47, 117, 0.24);
}

body.theme-classic #appHeader.bg-primary::before,
body.theme-classic #appHeader.bg-primary::after {
  content: '';
  position: absolute;
  pointer-events: none;
}

body.theme-classic #appHeader.bg-primary::before {
  inset: 0;
  background:
    linear-gradient(100deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 42%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0 2px, rgba(255, 255, 255, 0) 2px 10px);
  opacity: 0.55;
}

body.theme-classic #appHeader.bg-primary::after {
  left: 1rem;
  right: 1rem;
  bottom: 0.55rem;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.65), rgba(173, 208, 255, 0.35), rgba(255, 255, 255, 0.1));
}

body.theme-classic #appHeader .container {
  position: relative;
  z-index: 1;
}

@media (max-width: 768px) {
  body.theme-classic::before {
    width: 72vmin;
    height: 72vmin;
    right: -22vmin;
    top: 20vh;
    opacity: 0.16;
  }
}

body.theme-classic #appSubtitle {
  opacity: 0.88 !important;
  font-weight: 500;
  letter-spacing: 0.01em;
}

body.theme-classic #appTitle {
  font-family: "Bodoni Moda", "Times New Roman", serif;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.02;
  text-shadow: 0 6px 18px rgba(9, 25, 66, 0.28);
}

.settings-wrap {
  position: relative;
  flex: 0 0 auto;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.header-search {
  position: relative;
  width: min(280px, 42vw);
}

.header-search-input {
  width: 100%;
  height: 2rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 0 1.85rem 0 0.75rem;
  font-size: 0.88rem;
  line-height: 1;
}

.header-search-input::placeholder {
  color: rgba(255, 255, 255, 0.8);
}

.header-search-input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.72);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.16);
}

.header-search-clear {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.35rem;
  height: 1.35rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.88);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
}

.header-search-clear:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.header-search-clear:disabled {
  opacity: 0.45;
  pointer-events: none;
}

.settings-trigger {
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: 0;
  width: 2rem;
  height: 2rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  outline: none;
  opacity: 0.9;
}

.settings-trigger:hover {
  opacity: 1;
}

.settings-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  width: min(16rem, 80vw);
  z-index: 1200;
  border-radius: 0.8rem;
  box-shadow: 0 10px 26px rgba(18, 50, 84, 0.18), 0 2px 6px rgba(18, 50, 84, 0.1);
}

.theme-uplifting .settings-trigger {
  color: #17324d;
}

.theme-uplifting .header-search-input {
  border-color: rgba(23, 50, 77, 0.25);
  background: rgba(255, 255, 255, 0.72);
  color: #17324d;
}

.theme-uplifting .header-search-input::placeholder {
  color: rgba(23, 50, 77, 0.72);
}

.theme-uplifting .header-search-clear {
  color: rgba(23, 50, 77, 0.75);
}

.theme-uplifting .header-search-clear:hover {
  background: rgba(23, 50, 77, 0.14);
  color: #17324d;
}

@media (max-width: 767.98px) {
  .header-controls {
    width: 100%;
  }

  .header-search {
    flex: 1;
    width: auto;
    min-width: 0;
  }

  .header-search-input,
  .settings-trigger {
    height: 2.75rem;
  }

  .header-search-input {
    font-size: 1rem;
  }

  .settings-trigger {
    width: 2.75rem;
  }

  .day-separator {
    flex-wrap: wrap;
  }
}

.settings-popover,
#topicTabs,
.article-card,
.day-separator {
  overflow-wrap: anywhere;
}

.summary-text {
  line-height: 1.5;
  overflow: hidden;
  max-height: 4.5em;
  transition: max-height 0.3s ease;
  position: relative;
}

.summary-text.is-truncated::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1.8em;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0), #ffffff 80%);
}

.summary-text.is-expandable {
  cursor: pointer;
}

.collapse-toggle {
  color: #0b5ed7;
  width: auto;
  padding: 0;
  line-height: 1;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  outline: none;
  box-shadow: none;
}

.collapse-toggle::before {
  content: '';
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
  display: block;
}

.collapse-toggle[aria-expanded="true"]::before {
  transform: rotate(-135deg);
}

.article-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.article-action-btn {
  border: 1px solid #d5d9e2;
  background: #fff;
  color: #41516a;
  border-radius: 999px;
  font-size: 0.72rem;
  line-height: 1;
  padding: 0.32rem 0.58rem;
}

.article-action-btn:hover {
  border-color: #9cadcc;
  color: #244a8f;
}

.article-action-btn.is-active {
  background: #e9f1ff;
  border-color: #8aaee8;
  color: #1f4e98;
}

.external-icon {
  width: 0.9rem;
  height: 0.9rem;
  margin-left: 0.35rem;
  vertical-align: text-top;
  fill: currentColor;
  opacity: 0.9;
}

.article-card {
  border: 1px solid #dee2e6;
  border-radius: 0.75rem;
  background: #fff;
  overflow: hidden;
  height: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

body.theme-classic .article-card {
  border: 1px solid rgba(49, 80, 158, 0.18);
  box-shadow:
    0 10px 22px rgba(22, 50, 124, 0.1),
    0 2px 7px rgba(22, 50, 124, 0.06);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

body.theme-classic .article-card:hover {
  transform: translateY(-3px);
  box-shadow:
    0 16px 28px rgba(22, 50, 124, 0.15),
    0 4px 10px rgba(22, 50, 124, 0.09);
}

.article-cover {
  position: relative;
  min-height: 220px;
  background-size: cover;
  background-position: center;
}

.article-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0.15));
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1rem;
  color: #fff;
}

.mark-wrap {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.status-icon {
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  border: 1px solid rgba(255, 255, 255, 0.45);
}

.status-icon svg {
  width: 1rem;
  height: 1rem;
  display: block;
  fill: currentColor;
}

.status-icon.quality {
  color: #ffc107;
}

.status-icon.nicety {
  color: #20c997;
}

.overlay-title {
  margin: 0;
  line-height: 1.2;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.alternate-source-icon {
  position: absolute;
  right: 0.85rem;
  bottom: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffcf4a;
  font-size: 1rem;
  line-height: 1;
  min-width: 1rem;
  min-height: 1rem;
  text-decoration: none;
  background: transparent;
  border: 0;
  outline: none;
  box-shadow: none;
  z-index: 2;
  pointer-events: auto;
}

.alternate-source-icon:hover,
.alternate-source-icon:focus-visible {
  color: #ffe28b;
  background: transparent;
  border: 0;
  outline: none;
  box-shadow: none;
}

.alternate-source-icon i {
  display: block;
  line-height: 1;
}

.day-separator {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid #d0d7de;
}

.day-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: #1f2933;
}

.day-count {
  font-size: 0.8rem;
  color: #52606d;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

body.theme-classic #topicTabs {
  border-bottom: 0;
  gap: 0.45rem;
}

body.theme-classic #topicTabs .nav-link {
  border: 1px solid rgba(56, 86, 164, 0.2);
  color: #2e487d;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  padding: 0.42rem 0.9rem;
  font-weight: 600;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

body.theme-classic #topicTabs .nav-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 15px rgba(31, 60, 132, 0.16);
}

body.theme-classic #topicTabs .nav-link.active {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(130deg, #2f6de0, #2b54bf 56%, #253f90);
  box-shadow: 0 11px 20px rgba(37, 68, 143, 0.26);
}

body.theme-classic .day-separator {
  border-bottom: 1px solid rgba(56, 88, 162, 0.24);
}

body.theme-classic .day-title {
  color: #273f70;
}

body.theme-classic .day-count {
  color: #4a6498;
}
