/* Loading Overlay */
#loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
}

.loading-content {
  background: white;
  padding: 2rem 3rem;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #e5e7eb;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

.loading-message {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: #1f2937;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Button Loading State */
.button.loading {
  position: relative;
  pointer-events: none;
  opacity: 0.7;
}

.button-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

.post-layout {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
}

.post-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.sidebar-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 1rem;
  padding: 1.25rem;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.sidebar-section h2 {
  margin-top: 0;
  margin-bottom: 0.75rem;
  font-size: 1.1rem;
}

.related-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.related-list li a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}

.related-list img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 0.6rem;
  flex-shrink: 0;
}

@media (max-width: 900px) {
  .post-layout {
    grid-template-columns: 1fr;
  }

  .post-sidebar {
    order: -1;
  }
}
:root {
  --font-body: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  --color-bg: #f5f7fb;
  --color-surface: #ffffff;
  --color-surface-alt: #eef2ff;
  --color-accent: #2563eb;
  --color-accent-dark: #1d4ed8;
  --color-accent-light: rgba(37, 99, 235, 0.15);
  --color-text: #111827;
  --color-text-muted: #4b5563;
  --color-border: #e5e7eb;
  --color-success: #16a34a;
  --color-error: #dc2626;
  --shadow-soft: 0 16px 32px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
}

.container {
  width: min(1160px, 92vw);
  margin: 0 auto;
}

.navbar {
  background: var(--color-surface);
  backdrop-filter: blur(4px);
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
  position: sticky;
  top: 0;
  z-index: 30;
}

.nav-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
  min-height: 88px;
  max-height: 88px;
  position: relative;
}

.nav-toggle {
  display: none;
  width: 38px;
  height: 34px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  position: relative;
  z-index: 40;
}

.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--color-text);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

body.nav-open {
  overflow: hidden;
}

body.nav-open::after {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 20;
  backdrop-filter: blur(2px);
}

body.nav-open .nav-toggle span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

body.nav-open .nav-toggle span:nth-child(2) {
  opacity: 0;
}

body.nav-open .nav-toggle span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--color-text);
  font-weight: 700;
  font-size: 1.2rem;
  text-decoration: none;
  transition: all 0.2s ease;
}

.brand:hover {
  transform: translateY(-1px);
}

.brand-logo {
  height: 72px;
  width: auto;
  flex-shrink: 0;
}

.brand-text {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-text);
}

/* Show text on mobile when logo might not load */
@media (max-width: 640px) {
  .brand-text {
    display: inline !important;
  }
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 0.75rem 1rem;
  margin: 0;
  padding: 0;
  align-items: center;
  flex-wrap: wrap;
}

.nav-links a,
.nav-links a:visited {
  color: var(--color-text);
  text-decoration: none;
  transition: color 0.2s ease;
}

.nav-links a:hover {
  color: var(--color-accent);
}

/* Utility visibility helpers */
.only-mobile { display: none; }
.hide-mobile { display: block; }
.mobile-only { display: none; }

@media (max-width: 900px) {
  .mobile-only { display: block; }
  
  .brand-logo {
    height: 64px;
  }
  
  .brand-text {
    font-size: 1.1rem;
  }
}

.nav-item {
  position: relative;
}

.topics-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  font-weight: 600;
  padding: 0.35rem 0.2rem;
  border: none;
  background: transparent;
  color: inherit;
  border-radius: 0.5rem;
}

.topics-trigger:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.7);
  outline-offset: 3px;
}

.nav-topics .caret {
  transition: transform 0.15s ease;
}

.nav-topics:hover .caret,
.nav-topics:focus-within .caret {
  transform: rotate(180deg);
}

.nav-topics .mega-menu {
  position: absolute;
  top: calc(100% + 0.75rem);
  left: 50%;
  transform: translate(-50%, -10px);
  width: min(720px, 90vw);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 1rem;
  box-shadow: 0 22px 48px rgba(15, 23, 42, 0.15);
  padding: 1.5rem;
  z-index: 20;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.nav-topics .mega-menu::before {
  content: '';
  position: absolute;
  top: -0.75rem;
  left: 0;
  right: 0;
  height: 0.75rem;
}

.nav-topics:hover .mega-menu,
.nav-topics:focus-within .mega-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.mega-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin-bottom: 1rem;
}

.mega-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.9rem;
  border-radius: 0.85rem;
  text-decoration: none;
  color: inherit;
  border: 1px solid transparent;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.mega-item:hover,
.mega-item:focus-visible {
  border-color: rgba(37, 99, 235, 0.35);
  transform: translateY(-2px);
  box-shadow: 0 16px 32px rgba(37, 99, 235, 0.12);
}

.mega-title {
  font-weight: 600;
  font-size: 1rem;
}

.mega-desc {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  line-height: 1.4;
}

.mega-view-all {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  text-decoration: none;
  color: var(--color-accent);
  font-weight: 600;
}

.mega-empty {
  margin: 0;
  color: var(--color-text-muted);
}

@media (max-width: 900px) {
  .nav-topics {
    width: 100%;
  }

  .only-mobile { display: block; }
  .hide-mobile { display: none; }

  .nav-content {
    align-items: center;
    flex-wrap: nowrap;
  }

  .nav-toggle {
    display: inline-flex;
    z-index: 50;
    order: 2;
  }

  .brand {
    order: 1;
    flex: 1;
  }

  /* Clean mobile navbar */
  .navbar { 
    backdrop-filter: blur(10px); 
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  }

  .nav-links {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100vw;
    height: 100vh;
    overflow-y: auto;
    margin: 0;
    padding: 80px 0 2rem;
    background: var(--color-surface);
    z-index: 30;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
  }

  body.nav-open .nav-links {
    display: block;
    transform: translateY(0);
    -webkit-overflow-scrolling: touch;
  }

  /* Hide desktop Topics mega menu on mobile */
  .nav-links .nav-item.nav-topics {
    display: none !important;
  }

  /* nested mobile rules start (flattened) */
    .mobile-topics {
      display: block;
    }

  /* Mobile Topics Accordion */
  .mobile-topics {
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
  }

  .mobile-topics .accordion-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 500;
    border: none;
    background: transparent;
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
  }

  .mobile-topics .accordion-trigger:hover,
  .mobile-topics.open .accordion-trigger {
    background: rgba(37, 99, 235, 0.08);
    color: var(--color-accent);
  }

  .mobile-topics .accordion-trigger .caret {
    transition: transform 0.2s ease;
    opacity: 0.7;
  }

  .mobile-topics.open .accordion-trigger .caret {
    transform: rotate(180deg);
  }

  .mobile-topics .accordion-panel {
    width: 100%;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: rgba(37, 99, 235, 0.02);
    border-top: 1px solid rgba(148, 163, 184, 0.1);
    display: block;
    flex: none;
  }

  .mobile-topics.open .accordion-panel {
    max-height: calc(100vh - 300px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .mobile-topics-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: block;
  }

  .mobile-topics-list li {
    display: block;
    width: 100%;
    border-bottom: 1px solid rgba(148, 163, 184, 0.05);
  }

  .mobile-topics-list li:last-child {
    border-bottom: none;
  }

  .mobile-topics-list a {
    display: block;
    width: 100%;
    padding: 0.75rem 2.5rem;
    font-size: 1rem;
    color: var(--color-text-muted);
    text-decoration: none;
    transition: all 0.2s ease;
  }

  .mobile-topics-list a:hover {
    background: rgba(37, 99, 235, 0.08);
    color: var(--color-accent);
  }

  .mobile-topics-view-all {
    display: block;
    padding: 0.75rem 2.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-accent);
    text-decoration: none;
    border-top: 1px solid rgba(148, 163, 184, 0.1);
    transition: all 0.2s ease;
  }

  .mobile-topics-view-all:hover {
    background: rgba(37, 99, 235, 0.08);
  }

  .nav-links > li {
    width: 100%;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
  }

  .nav-links > li:last-child {
    border-bottom: none;
  }

  .nav-links a,
  .nav-links button,
  .link-button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 1rem 2rem;
    background: transparent;
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.2s ease;
  }

.nav-links a:hover,
.nav-links button:hover,
.link-button:hover {
  background: rgba(37, 99, 235, 0.08);
  color: var(--color-accent);
}

  .nav-topics .mega-menu {
    position: static;
    transform: none;
    width: 100%;
    margin: 0;
    margin-top: 0.5rem;
    box-shadow: none;
    border-radius: 0.95rem;
    opacity: 0;
    pointer-events: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.22s ease, opacity 0.22s ease;
    padding: 0;
    border: 1px solid transparent;
    background: rgba(37, 99, 235, 0.05);
  }

  /* On mobile, do NOT open on hover/focus, only via JS when desired */
  .nav-topics:hover .mega-menu,
  .nav-topics:focus-within .mega-menu { opacity: 0; pointer-events: none; max-height: 0; padding: 0; border-color: transparent; }

  .nav-topics .mega-menu.is-open {
    opacity: 1;
    pointer-events: auto;
    max-height: 520px;
    border-color: rgba(37, 99, 235, 0.2);
    padding: 0.85rem;
  }
}
.link-button {
  color: var(--color-text);
  text-decoration: none;
  font-weight: 500;
  background: transparent;
  padding: 0.6rem 0.4rem;
  border: none;
  cursor: pointer;
}

.link-button {
  padding: 0;
}

.nav-links a:hover,
.link-button:hover {
  color: var(--color-accent);
}

main {
  flex: 1 0 auto;
  padding: 2rem 0 3.5rem;
}

.footer {
  border-top: 1px solid var(--color-border);
  padding: 1.75rem 0;
  text-align: center;
  color: var(--color-text-muted);
  background: var(--color-surface);
  flex-shrink: 0;
}

.footer a,
.footer a:visited {
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer a:hover {
  color: var(--color-accent);
  text-decoration: underline;
}

.page-heading {
  text-align: center;
  margin-bottom: 2rem;
}

.page-heading h1 {
  font-size: clamp(2rem, 4vw, 2.8rem);
  margin-bottom: 0.6rem;
}

.page-heading p {
  color: var(--color-text-muted);
  font-size: 1rem;
}

.news-hero {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr);
  gap: 2rem;
  margin-bottom: 3rem;
}


.hero-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 1.35rem;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.hero-card .hero-layout {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
}

.hero-media {
  position: relative;
  flex: 1 1 55%;
  background: var(--color-surface-alt);
  display: flex;
  align-items: center;
}

.hero-media::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(15, 23, 42, 0.12), transparent 55%);
}

.hero-media-link {
  display: block;
  height: 100%;
}

.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.hero-media.placeholder {
  background: linear-gradient(135deg, #dbeafe, #e2e8f0);
}

.hero-content {
  flex: 1 1 45%;
  padding: 2.1rem 2.4rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: var(--color-surface);
}

.hero-content .eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-accent);
}

.hero-content h1 {
  margin: 0;
  font-size: clamp(1.9rem, 2.6vw, 2.35rem);
  line-height: 1.2;
}

.hero-content h1 a {
  color: inherit;
  text-decoration: none;
}

.hero-content h1 a:hover {
  text-decoration: underline;
}

.hero-summary {
  color: #374151;
  margin: 0;
  font-size: 1rem;
  max-width: 520px;
}

.hero-content .button.primary {
  margin-top: auto;
  padding: 0.7rem 1.4rem;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent-dark));
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none;
  width: fit-content;
}

.hero-content .button.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 30px rgba(37, 99, 235, 0.25);
}

.hero-aside {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 1.25rem;
  padding: 1.75rem;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.hero-aside h2 {
  margin: 0;
  font-size: 1.25rem;
}

.headline-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.headline-list a {
  text-decoration: none;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  color: inherit;
  font-weight: 600;
  transition: opacity 0.2s;
}

.headline-list a:hover {
  opacity: 0.7;
}

.headline-thumb {
  flex-shrink: 0;
  width: 80px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--color-surface-alt);
}

.headline-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.headline-title {
  flex: 1;
  line-height: 1.4;
  font-size: 0.95rem;
}

.post-list .grid {
  display: grid;
  gap: 1.75rem;
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 900px) {
  .post-list .grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
  }
}

@media (max-width: 640px) {
  .post-list .grid {
    grid-template-columns: 1fr !important;
    gap: 1.25rem;
  }
}

/* Magazine-style grid layout */
.magazine-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.75rem;
  grid-auto-flow: dense;
}

/* Default card - 1/3 width (4 columns) */
.magazine-grid .post-card {
  grid-column: span 4;
}

/* Large feature card - 2/3 width (8 columns) */
.magazine-grid .card-large {
  grid-column: span 8;
}

.magazine-grid .card-large .card-image {
  aspect-ratio: 2 / 1;
}

.magazine-grid .card-large h3 {
  font-size: 1.75rem;
  line-height: 1.3;
}

.magazine-grid .card-large .excerpt {
  font-size: 1.05rem;
  line-height: 1.6;
}

/* Horizontal card - full width */
.magazine-grid .card-horizontal {
  grid-column: span 12;
}

.magazine-grid .card-horizontal a {
  flex-direction: row;
  gap: 1.5rem;
}

.magazine-grid .card-horizontal .card-image {
  flex-shrink: 0;
  width: 320px;
  aspect-ratio: 16 / 9;
}

.magazine-grid .card-horizontal .card-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Text-only card with colored accent */
.magazine-grid .card-text {
  background: linear-gradient(135deg, var(--color-surface) 0%, var(--color-surface-alt) 100%);
  border-left: 4px solid var(--color-primary);
}

.magazine-grid .card-text .card-content {
  padding: 0.5rem 0;
}

/* Category badge */
.category-badge {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
  width: fit-content;
}

.card-content {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .magazine-grid {
    grid-template-columns: repeat(6, 1fr);
  }
  
  .magazine-grid .post-card {
    grid-column: span 3;
  }
  
  .magazine-grid .card-large {
    grid-column: span 6;
  }
  
  .magazine-grid .card-horizontal {
    grid-column: span 6;
  }
  
  .magazine-grid .card-horizontal .card-image {
    width: 240px;
  }
}

@media (max-width: 768px) {
  .magazine-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
  
  .magazine-grid .post-card,
  .magazine-grid .card-large,
  .magazine-grid .card-horizontal {
    grid-column: span 1;
  }
  
  .magazine-grid .card-horizontal a {
    flex-direction: column;
  }
  
  .magazine-grid .card-horizontal .card-image {
    width: 100%;
  }
  
  .magazine-grid .card-large h3 {
    font-size: 1.4rem;
  }
}

.section-heading {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
}

.section-heading h2 {
  margin: 0;
  font-size: 1.35rem;
}

.section-heading p {
  margin: 0;
  color: var(--color-text-muted);
}

.post-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  padding: 1.2rem;
  border-radius: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.06);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.post-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.1);
}

.post-card a {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  text-decoration: none;
  color: inherit;
  height: 100%;
}

.post-card .card-image {
  position: relative;
  border-radius: 0.75rem;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: var(--color-surface-alt);
}

.post-card .card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.post-card h2 {
  margin: 0;
  font-size: 1.1rem;
}

.post-card header {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-width: 72ch; /* keep readable line length for titles/meta */
}

.post-card h3 {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.45;
  font-weight: 600;
  margin-bottom: 0.1rem;
}

.post-card .meta {
  color: var(--color-text-muted);
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.post-card .excerpt {
  color: var(--color-text-muted);
  line-height: 1.7;
  font-size: 1.05rem;
  margin-top: 0.35rem;
  overflow: visible;
  display: block;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
  max-width: 72ch; /* keep readable line length for excerpts */
}

.featured-image {
  margin-top: 1.25rem;
  border-radius: 1rem;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: var(--color-surface-alt);
}

.featured-image img {
  width: 100%;
  height: auto;
  display: block;
}

.empty {
  text-align: center;
  color: var(--color-text-muted);
  font-style: italic;
}

.alert {
  border-radius: 0.75rem;
  padding: 0.9rem 1rem;
  margin-bottom: 1.5rem;
  font-weight: 500;
}

.alert-success {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

.alert-error {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.65rem 1.2rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(56, 189, 248, 0.1);
  color: var(--color-text);
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(14, 165, 233, 0.2);
}

.button.primary {
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent-dark));
  border: none;
  color: #ffffff;
}

.button.secondary {
  background: rgba(148, 163, 184, 0.12);
}

.button.danger {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
}

.button.tiny {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

.inline-form {
  display: inline-block;
  margin: 0;
}

.auth {
  max-width: 520px;
  margin: 0 auto;
  background: var(--color-surface);
  padding: 2.3rem;
  border-radius: 1.5rem;
  border: 1px solid var(--color-border);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.12);
}

.auth h1 {
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.auth p {
  color: var(--color-text-muted);
  margin-bottom: 1.75rem;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group.inline {
  max-width: 240px;
}

label {
  font-weight: 600;
  color: var(--color-text);
}

input,
textarea,
select {
  padding: 0.75rem 0.9rem;
  border-radius: 0.75rem;
  border: 1px solid var(--color-border);
  background: rgba(255, 255, 255, 0.95);
  color: var(--color-text);
  font-size: 1rem;
  box-shadow: inset 0 2px 4px rgba(15, 23, 42, 0.04);
}

textarea {
  resize: vertical;
}

.form-errors {
  list-style: disc;
  margin: 0;
  padding-left: 1.5rem;
  color: #f87171;
}

.switch-link {
  color: var(--color-text-muted);
  text-align: center;
}

.switch-link a {
  color: var(--color-accent);
  text-decoration: none;
}

.dashboard {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 2.5rem;
}

.dashboard-nav {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 1.1rem;
  padding: 1.75rem;
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: sticky;
  top: 6.5rem;
  height: fit-content;
}

.dashboard-nav h2 {
  margin: 0;
  font-size: 1.4rem;
}

.dashboard-nav nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.dashboard-tab {
  padding: 0.65rem 0.85rem;
  border-radius: 0.75rem;
  border: 1px solid transparent;
  background: rgba(37, 99, 235, 0.08);
  color: var(--color-text);
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dashboard-tab:hover {
  transform: translateX(4px);
  border-color: rgba(37, 99, 235, 0.3);
}

.dashboard-tab.active {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.2), rgba(14, 165, 233, 0.18));
  border-color: rgba(37, 99, 235, 0.35);
  box-shadow: 0 12px 22px rgba(37, 99, 235, 0.18);
}

.dashboard-cta {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.dashboard-content {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.dashboard-panel {
  display: none;
  flex-direction: column;
  gap: 2rem;
}

.dashboard-panel.active {
  display: flex;
}

.trending-topics {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 1.1rem;
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.08);
}

.topics-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  min-height: 72px;
  max-height: 72px;
}

.topics-header h2 {
  margin: 0;
  font-size: 1.4rem;
}

.panel-actions {
  display: flex;
  gap: 0.5rem;
}

@media (max-width: 900px) {
  .dashboard {
    grid-template-columns: 1fr;
  }

  .dashboard-nav {
    position: static;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
  }

  .dashboard-nav nav {
    flex-direction: row;
    gap: 0.75rem;
  }

  .dashboard-cta {
    flex-direction: row;
  }

  .dashboard-content {
    gap: 2rem;
  }
}

.topics-header p {
  margin: 0.35rem 0 0;
  color: var(--color-text-muted);
}

.topics-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.regenerate-panel {
  background: rgba(37, 99, 235, 0.05);
  border: 1px solid rgba(37, 99, 235, 0.15);
  border-radius: 0.75rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.regenerate-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.regenerate-header h3 {
  margin: 0;
  font-size: 1.25rem;
  color: var(--color-text);
}

.form-section {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--color-text);
}

.category-checkboxes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
  padding: 1rem;
  background: var(--color-bg-light, #f8f9fa);
  border-radius: 0.5rem;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 0.375rem;
  transition: background 0.15s ease;
}

.checkbox-item:hover {
  background: rgba(37, 99, 235, 0.08);
}

.checkbox-item input[type="checkbox"] {
  width: 1.125rem;
  height: 1.125rem;
  cursor: pointer;
}

.form-input-small {
  width: 120px;
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 0.375rem;
  font-size: 1rem;
}

.form-help {
  display: block;
  margin-top: 0.5rem;
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.topics-tab {
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.16);
  border-radius: 0.75rem;
  padding: 0.65rem 1rem;
  display: inline-flex;
  flex-direction: column;
  min-width: 170px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: inherit;
  text-align: left;
}

.topics-tab.active {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.18), rgba(14, 165, 233, 0.18));
  border-color: rgba(37, 99, 235, 0.3);
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.18);
}

.topics-tab:hover {
  transform: translateY(-2px);
  border-color: rgba(37, 99, 235, 0.35);
}

.tab-label {
  font-weight: 600;
}

.tab-count {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.topics-deck {
  position: relative;
}

.topics-panel {
  display: none;
  flex-direction: column;
  gap: 1rem;
}

.topics-panel.active {
  display: flex;
}

.category-description {
  margin: 0;
  color: var(--color-text-muted);
}

.suggestion-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.suggestion-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 0.9rem;
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

.suggestion-card details {
  background: rgba(37, 99, 235, 0.08);
  border-radius: 0.65rem;
  border: 1px solid rgba(37, 99, 235, 0.18);
  padding: 0.6rem 0.75rem;
  color: var(--color-text);
}

.suggestion-card details summary {
  cursor: pointer;
  font-weight: 600;
  outline: none;
}

.suggestion-card details pre {
  margin: 0.75rem 0 0;
  font-size: 0.8rem;
  line-height: 1.5;
  white-space: pre-wrap;
  color: var(--color-text-muted);
}

.suggestion-card button {
  align-self: flex-start;
}

.generate-actions {
  display: flex;
  gap: 0.5rem;
  width: 100%;
}

.generate-actions form {
  margin: 0;
}

.generate-actions button {
  width: 100%;
  white-space: nowrap;
  position: relative;
  transition: all 0.2s ease;
}

.generate-actions button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.generate-actions button:active {
  transform: translateY(0);
}

/* Loading state for buttons */
.generate-actions form[data-loading].is-loading button {
  pointer-events: none;
  opacity: 0.7;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 0.9; }
}

/* Post navigation */
.post-navigation {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.post-navigation button,
.post-navigation a {
  margin: 0;
}

.post-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

.post-table th,
.post-table td {
  text-align: left;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.95rem;
}

.post-table thead {
  background: rgba(37, 99, 235, 0.08);
}

.post-table tr:last-child td {
  border-bottom: none;
}

.post-table a {
  color: var(--color-text);
  font-weight: 600;
}

.post-table a:hover {
  color: var(--color-accent);
}

.tag {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.15rem 0.5rem;
  border-radius: 0.75rem;
  background: rgba(37, 99, 235, 0.15);
  color: var(--color-accent);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.status.published {
  color: var(--color-success);
}

.status.draft {
  color: var(--color-text-muted);
}

.post-detail {
  max-width: 860px;
  margin: 0 auto;
  background: var(--color-surface);
  padding: 2.5rem;
  border-radius: 1.5rem;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-soft);
}

.post-detail header {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
}

.post-detail .meta {
  color: var(--color-text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.95rem;
}

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

.post-detail .content {
  line-height: 1.8;
  color: var(--color-text);
  font-size: 1.03rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.post-detail .content h1,
.post-detail .content h2,
.post-detail .content h3,
.post-detail .content h4 {
  margin: 1.5rem 0 0.75rem;
  line-height: 1.3;
  color: var(--color-text);
}

.post-detail .content p {
  margin: 0;
}

.post-detail .content ul,
.post-detail .content ol {
  padding-left: 1.4rem;
  margin: 0;
  color: var(--color-text);
}

.post-detail .content blockquote {
  margin: 0;
  padding: 0.75rem 1rem;
  border-left: 4px solid var(--color-accent);
  background: var(--color-surface-alt);
  color: var(--color-text-muted);
}

/* Comments Section */
.comments-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 2px solid var(--color-border);
}

.comments-section h2 {
  margin: 0 0 1.5rem;
  font-size: 1.5rem;
  color: var(--color-text);
}

.comment-form {
  background: var(--color-surface-alt);
  padding: 1.5rem;
  border-radius: 8px;
  margin-bottom: 2rem;
}

.comment-form .form-group {
  margin-bottom: 1rem;
}

.comment-form label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--color-text);
}

.comment-form textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.5;
  resize: vertical;
  background: var(--color-surface);
  color: var(--color-text);
}

.comment-form textarea:focus {
  outline: none;
  border-color: var(--color-accent);
}

.login-prompt {
  text-align: center;
  padding: 2rem;
  background: var(--color-surface-alt);
  border-radius: 8px;
  color: var(--color-text-muted);
}

.login-prompt a {
  color: var(--color-accent);
  font-weight: 600;
  text-decoration: none;
}

.login-prompt a:hover {
  text-decoration: underline;
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.comment {
  background: var(--color-surface-alt);
  padding: 1.25rem;
  border-radius: 8px;
  border-left: 3px solid var(--color-accent);
}

.comment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.comment-author {
  color: var(--color-text);
  font-weight: 600;
  font-size: 0.95rem;
}

.comment-date {
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.comment-content {
  margin: 0 0 0.75rem;
  line-height: 1.6;
  color: var(--color-text);
  word-wrap: break-word;
}

.no-comments {
  text-align: center;
  padding: 2rem;
  color: var(--color-text-muted);
  font-style: italic;
}

/* Gamification Styles */
.gamification-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.stat-card {
  background: var(--color-surface);
  padding: 1.5rem;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-soft);
}

.stat-card h3 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
  color: var(--color-text);
}

.level-card {
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-dark) 100%);
  color: white;
  border: none;
}

.level-card .card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.level-card h2 {
  margin: 0;
  font-size: 2rem;
  color: white;
}

.points-badge {
  background: rgba(255, 255, 255, 0.2);
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
}

.progress-section {
  margin-top: 1rem;
}

.progress-bar {
  width: 100%;
  height: 12px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-fill {
  height: 100%;
  background: white;
  border-radius: 6px;
  transition: width 0.3s ease;
}

.progress-text {
  margin: 0;
  font-size: 0.9rem;
  opacity: 0.9;
}

.max-level {
  margin: 1rem 0 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--color-border);
}

.stat-row:last-child {
  border-bottom: none;
}

.stat-label {
  color: var(--color-text-muted);
}

.stat-value {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--color-accent);
}

.streaks-card .streak-item {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--color-border);
}

.streaks-card .streak-item:last-child {
  border-bottom: none;
}

.streak-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.streak-current {
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--color-accent);
}

.streak-best {
  margin: 0;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.achievements-section {
  margin-bottom: 2rem;
}

.achievements-section h2 {
  margin: 0 0 1.5rem;
  color: var(--color-text);
}

.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.achievement-card {
  background: var(--color-surface);
  padding: 1.25rem;
  border-radius: 10px;
  border: 2px solid var(--color-border);
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s;
}

.achievement-card.earned {
  border-color: var(--color-accent);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, rgba(37, 99, 235, 0.02) 100%);
}

.achievement-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.achievement-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.achievement-card h4 {
  margin: 0.5rem 0 0.25rem;
  font-size: 1rem;
  color: var(--color-text);
}

.achievement-card p {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.earned-date {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.no-achievements {
  text-align: center;
  padding: 3rem;
  color: var(--color-text-muted);
}

.profile-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 2rem;
}

/* Leaderboard */
.leaderboard-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 0;
}

.user-rank-card {
  background: var(--color-surface);
  padding: 1.5rem;
  border-radius: 12px;
  border: 2px solid var(--color-accent);
  text-align: center;
  margin-bottom: 2rem;
}

.user-rank-card p {
  margin: 0 0 1rem;
  font-size: 1.1rem;
}

.user-rank-card strong {
  color: var(--color-accent);
  font-size: 1.5rem;
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--color-surface);
  padding: 1.25rem;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  transition: transform 0.2s, box-shadow 0.2s;
}

.leaderboard-item:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-soft);
}

.leaderboard-item.current-user {
  border-color: var(--color-accent);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, rgba(37, 99, 235, 0.02) 100%);
}

.leaderboard-item .rank {
  flex-shrink: 0;
  width: 50px;
  text-align: center;
}

.medal {
  font-size: 2rem;
}

.rank-number {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text-muted);
}

.leader-info {
  flex-grow: 1;
}

.leader-name {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
  color: var(--color-text);
}

.leader-stats {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.stat-badge {
  padding: 0.25rem 0.6rem;
  background: var(--color-surface-alt);
  border-radius: 12px;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.leader-points {
  text-align: right;
  flex-shrink: 0;
}

.leader-points strong {
  display: block;
  font-size: 1.5rem;
  color: var(--color-accent);
}

.points-label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.leaderboard-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 2rem;
}

.no-data {
  text-align: center;
  padding: 3rem;
  color: var(--color-text-muted);
}

/* Gamification Guide */
.guide-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 0;
}

.guide-section {
  background: var(--color-surface);
  padding: 2rem;
  border-radius: 12px;
  margin-bottom: 2rem;
  border: 1px solid var(--color-border);
}

.guide-section h2 {
  margin: 0 0 1rem;
  color: var(--color-text);
}

.guide-section > p {
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
}

.points-list {
  display: grid;
  gap: 1rem;
}

.point-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--color-surface-alt);
  border-radius: 8px;
}

.point-icon {
  font-size: 2rem;
  flex-shrink: 0;
}

.point-info strong {
  display: block;
  color: var(--color-text);
  margin-bottom: 0.25rem;
}

.point-info p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.levels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem;
}

.level-box {
  padding: 1rem;
  background: var(--color-surface-alt);
  border: 2px solid var(--color-border);
  border-radius: 8px;
  text-align: center;
  font-weight: 600;
  color: var(--color-text);
}

.level-box span {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  font-weight: 400;
}

.level-box.level-max {
  border-color: var(--color-accent);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.1) 0%, rgba(37, 99, 235, 0.05) 100%);
}

.achievement-category {
  margin-bottom: 2rem;
}

.achievement-category:last-child {
  margin-bottom: 0;
}

.achievement-category h3 {
  margin: 0 0 1rem;
  color: var(--color-text);
  font-size: 1.1rem;
}

.achievement-list {
  display: grid;
  gap: 0.75rem;
}

.achievement-item {
  display: flex;
  align-items: start;
  gap: 1rem;
  padding: 1rem;
  background: var(--color-surface-alt);
  border-radius: 8px;
}

.ach-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
}

.achievement-item strong {
  display: block;
  color: var(--color-text);
  margin-bottom: 0.25rem;
}

.achievement-item p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.feature-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.75rem;
}

.feature-list li {
  padding: 0.75rem 1rem;
  background: var(--color-surface-alt);
  border-radius: 6px;
  color: var(--color-text);
}

.guide-cta {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 3rem;
}

/* Gamification Sidebar Widget */
.gamification-widget {
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-dark) 100%);
  color: white;
  border: none;
}

.gamification-widget h2 {
  color: white;
  margin-bottom: 1rem;
}

.widget-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.widget-level {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.level-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  flex-shrink: 0;
}

.level-number {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
}

.level-label {
  font-size: 0.7rem;
  opacity: 0.9;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.level-info {
  flex-grow: 1;
}

.level-progress {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.level-progress-bar {
  height: 100%;
  background: white;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.level-text {
  margin: 0;
  font-size: 0.85rem;
  opacity: 0.9;
}

.widget-streaks {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.streak-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.streak-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.streak-info {
  display: flex;
  flex-direction: column;
}

.streak-info strong {
  font-size: 1.1rem;
  line-height: 1.2;
}

.streak-label {
  font-size: 0.75rem;
  opacity: 0.8;
}

.widget-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.widget-link {
  color: white;
  font-size: 0.85rem;
  text-decoration: none;
  opacity: 0.9;
  transition: opacity 0.2s;
}

.widget-link:hover {
  opacity: 1;
  text-decoration: underline;
}

/* Widget spacing in hero-aside */
.hero-aside .gamification-widget {
  margin-bottom: 2rem;
}

.hero-aside h2:not(.gamification-widget h2) {
  margin-top: 0;
}

@media (max-width: 640px) {
  .brand-logo {
    height: 56px;
{{ ... }}
  }

  .nav-links {
    gap: 0.4rem;
    font-size: 0.95rem;
  }

  .nav-content {
    padding: 0.75rem 0;
  }

  main {
    padding: 1.5rem 0 3rem;
  }

  .container {
    padding: 0 1rem;
  }

  .page-heading {
    margin-bottom: 1.5rem;
    text-align: left;
  }

  .page-heading h1 {
    font-size: 1.8rem;
  }

  /* Enhanced News Hero Mobile */
  .news-hero {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
  }

  .hero-card .hero-layout {
    flex-direction: column;
    max-width: none;
  }

  .hero-content {
    padding: 1.25rem 1.4rem;
    gap: 0.75rem;
  }

  .hero-content h1 {
    font-size: 1.4rem;
    line-height: 1.3;
  }

  .hero-summary {
    font-size: 0.95rem;
    line-height: 1.5;
  }

  .hero-media {
    order: -1;
  }

  .hero-aside {
    order: 1;
  }

  .headline-list {
    gap: 0.75rem;
  }

  .headline-list a {
    padding: 0.75rem;
  }

  .headline-title {
    font-size: 0.9rem;
    line-height: 1.3;
  }

  /* Enhanced Post Grid Mobile */
  .post-list {
    margin-top: 2rem;
  }

  .post-list .section-heading {
    margin-bottom: 1rem;
    text-align: left;
    padding: 0 1rem;
  }

  .post-list .section-heading h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
  }

  .post-list .section-heading p {
    font-size: 0.95rem;
    color: var(--color-text-muted);
  }

  .post-card {
    padding: 1.25rem;
    border-radius: 0.875rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    transition: all 0.2s ease;
    margin: 0 1rem;
  }

  .post-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  }

  .post-card .card-image {
    margin: -1.25rem -1.25rem 1rem -1.25rem;
    border-radius: 0.875rem 0.875rem 0 0;
    overflow: hidden;
  }

  .post-card .card-image img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
  }

  .post-card:hover .card-image img {
    transform: scale(1.02);
  }

  .post-card h3 {
    font-size: 1.15rem;
    line-height: 1.3;
    margin-bottom: 0.75rem;
    font-weight: 600;
    color: var(--color-text);
  }

  .post-card .meta {
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
  }

  .post-card .tag {
    background: var(--color-accent-light);
    color: var(--color-accent);
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
  }

  .post-card .excerpt {
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--color-text-muted);
  }

  /* Tables Mobile */
  .post-table {
    display: block;
    overflow-x: auto;
    border-radius: 0.75rem;
    font-size: 0.9rem;
  }

  .post-table thead {
    display: none;
  }

  .post-table tr {
    display: block;
    margin-bottom: 1rem;
    border: 1px solid var(--color-border);
    border-radius: 0.75rem;
    padding: 1rem;
  }

  .post-table td {
    display: block;
    text-align: left;
    border: none;
    padding: 0.25rem 0;
  }

  .post-table td:before {
    content: attr(data-label) ': ';
    font-weight: 600;
    color: var(--color-text-muted);
  }

  .post-table .actions {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--color-border);
  }

  .post-table .actions:before {
    display: none;
  }

  /* Auth Forms Mobile */
  .auth {
    padding: 1.35rem;
    border-radius: 1rem;
    margin: 0 auto;
    max-width: 400px;
  }

  .form-group {
    margin-bottom: 1rem;
  }

  .form-control {
    font-size: 16px; /* Prevents zoom on iOS */
  }

  /* Post Detail Mobile */
  .post-detail {
    padding: 1.5rem;
  }

  .post-layout {
    gap: 1.5rem;
  }

  /* Dashboard Mobile */
  .dashboard {
    flex-direction: column;
    gap: 1rem;
  }

  .dashboard-nav {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding: 1rem;
    border-radius: 0.75rem;
    position: static;
    width: 100%;
  }

  .dashboard-nav nav {
    flex-direction: row;
    gap: 0.5rem;
    overflow-x: auto;
  }

  .dashboard-tab {
    white-space: nowrap;
    min-width: auto;
    flex-shrink: 0;
  }

  .dashboard-cta {
    flex-direction: row;
    gap: 0.5rem;
  }

  .dashboard-content {
    width: 100%;
    padding: 0;
  }

  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    text-align: left;
  }

  .panel-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  /* Trending Topics Mobile */
  .topics-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .topics-tabs {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .topics-tab {
    flex: 1 1 calc(50% - 0.25rem);
    min-width: 120px;
  }
  
  .category-checkboxes {
    grid-template-columns: 1fr;
  }

  .suggestion-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .suggestion-card {
    padding: 1rem;
  }

  .suggestion-card h3 {
    font-size: 1rem;
  }

  .suggestion-card p {
    font-size: 0.9rem;
  }

  /* Forms and Buttons Mobile */
  .button {
    min-height: 44px; /* Touch target size */
  }

  .button.tiny {
    min-height: 36px;
    font-size: 0.85rem;
  }

  .inline-form {
    display: inline-block;
    margin-left: 0.5rem;
  }

  /* Post Create/Edit Forms Mobile */
  .post-form {
    max-width: 100%;
    padding: 1rem;
  }

  .post-form header {
    margin-bottom: 1.5rem;
    text-align: left;
  }

  .post-form h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
  }

  .form-group {
    margin-bottom: 1.25rem;
  }

  .form-group.inline {
    flex-direction: column;
    align-items: stretch;
  }

  .form-group.inline select {
    margin-top: 0.5rem;
  }

  .form-control,
  .form-control[type="text"],
  .form-control[type="email"], 
  textarea,
  select {
    font-size: 16px; /* Prevents zoom on iOS */
    min-height: 44px;
  }

  textarea {
    min-height: 200px;
    resize: vertical;
  }

  .form-actions {
    flex-direction: column;
    gap: 0.75rem;
  }

  .form-actions .button {
    width: 100%;
  }

  /* Generate Form Mobile */
  .generate-form {
    max-width: 100%;
    padding: 1rem;
  }

  .generate-form .form-group {
    margin-bottom: 1.25rem;
  }

  .generate-form textarea {
    min-height: 120px;
  }

  /* Category Pages Mobile */
  .categories-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .category-card {
    padding: 1rem;
  }

  .category-card h3 {
    font-size: 1.1rem;
  }

  /* Favorites Page Mobile */
  .favorites-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  /* Error Pages Mobile */
  .error-page {
    padding: 2rem 1rem;
    text-align: center;
  }

  .error-page h1 {
    font-size: 2rem;
  }
}
