@import url('https://fonts.googleapis.com/css?family=Roboto:100,300,400,700');

:root {
  --bg: #e8f1f8;
  --bg2: #f4f9fd;
  --ink: #112b3c;
  --muted: #4d6578;
  --primary: #2a93d5;
  --primary-strong: #176aa1;
  --border: rgba(255, 255, 255, 0.52);
  --glass: rgba(255, 255, 255, 0.44);
  --surface-shadow: 0 16px 34px rgba(23, 77, 118, 0.13);
  --theme-icon: #112b3c;
  --glass-reflex-light: 0.72;
  --glass-reflex-dark: 0.2;
}

/* Dark Theme */
html[data-theme="dark"],
html[data-theme="dark"] body {
  --bg: #0f1419;
  --bg2: #1a1f2e;
  --ink: #e1e8f0;
  --muted: #8b95a5;
  --primary: #4da3f5;
  --primary-strong: #2a7fd9;
  --border: rgba(255, 255, 255, 0.12);
  --glass: rgba(255, 255, 255, 0.08);
  --surface-shadow: 0 16px 34px rgba(0, 0, 0, 0.4);
  --theme-icon: #e1e8f0;
  --glass-reflex-light: 0.25;
  --glass-reflex-dark: 0.6;
}

/* Reading Theme */
html[data-theme="reading"],
html[data-theme="reading"] body {
  --bg: #fef6f0;
  --bg2: #fffaf7;
  --ink: #3e2723;
  --muted: #8d6e63;
  --primary: #d9751e;
  --primary-strong: #bf4d1a;
  --border: rgba(222, 184, 135, 0.35);
  --glass: rgba(255, 235, 205, 0.5);
  --surface-shadow: 0 8px 24px rgba(62, 39, 35, 0.1);
  --theme-icon: #8d6e63;
  --glass-reflex-light: 0.8;
  --glass-reflex-dark: 0.15;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Inter", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 10%, rgba(212, 234, 249, 0.9), transparent 34%),
    radial-gradient(circle at 86% 84%, rgba(193, 221, 244, 0.8), transparent 32%),
    linear-gradient(160deg, #f3f8fc 0%, #e7f0f8 48%, #dcebf7 100%);
  transition: background-color 0.3s ease, color 0.3s ease;
}

html[data-theme="dark"],
html[data-theme="dark"] body {
  background:
    radial-gradient(circle at 12% 10%, rgba(60, 80, 110, 0.6), transparent 34%),
    radial-gradient(circle at 86% 84%, rgba(45, 65, 95, 0.5), transparent 32%),
    linear-gradient(160deg, #0f1419 0%, #1a1f2e 48%, #0d0f14 100%);
}

html[data-theme="reading"],
html[data-theme="reading"] body {
  background:
    radial-gradient(circle at 12% 10%, rgba(210, 180, 140, 0.7), transparent 34%),
    radial-gradient(circle at 86% 84%, rgba(188, 143, 143, 0.6), transparent 32%),
    linear-gradient(160deg, #fef6f0 0%, #faf3ed 48%, #f5ede5 100%);
}

#liquid-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.ambient-layer {
  position: fixed;
  width: 100%;
  margin: 0 0 0.35rem;
  background: radial-gradient(circle at 80% 10%, rgba(131, 214, 255, 0.28), transparent 40%),
    radial-gradient(circle at 10% 90%, rgba(148, 188, 255, 0.2), transparent 35%);
}

html[data-theme="dark"] .ambient-layer {
  background: radial-gradient(circle at 80% 10%, rgba(60, 100, 140, 0.2), transparent 40%),
    radial-gradient(circle at 10% 90%, rgba(50, 80, 120, 0.15), transparent 35%);
}

html[data-theme="reading"] .ambient-layer {
  background: radial-gradient(circle at 80% 10%, rgba(210, 180, 140, 0.25), transparent 40%),
    radial-gradient(circle at 10% 90%, rgba(188, 143, 143, 0.18), transparent 35%);
}

.page-shell {
  position: relative;
  z-index: 0;
}

.nav-wrap {
  position: relative;
  z-index: 999;
}

/* --- Navigation --- */
.nav-wrap {
  margin: 1rem auto;
  width: min(1100px, 90vw);
  padding: 0.8rem 1rem;
  border-radius: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-brand {
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: 0.02em;
}

.fjalla-one-regular {
  font-family: "Fjalla One", sans-serif;
  font-weight: 400;
  font-style: normal;
  display: block;
  font-size: 1.75em;
  line-height: 1.05;
  margin-top: 0.12em;
}

.main-nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.main-nav a {
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
  letter-spacing: 0.01em;
  position: relative;
  padding-bottom: 0.18rem;
}

.main-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), transparent 85%);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 220ms ease;
}

.main-nav a:hover::after {
  transform: scaleX(1);
}

.main-nav a.is-active {
  color: var(--primary-strong);
}

.main-nav a.is-active::after {
  transform: scaleX(1);
}

.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
}

.nav-toggle span {
  width: 18px;
  height: 2px;
  background: var(--ink);
  border-radius: 99px;
}

.mobile-auth-box {
  display: none;
}

.nav-logout-form {
  margin: 0;
}

.nav-logout-btn {
  border: 1px solid rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  border-radius: 10px;
  padding: 0.45rem 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.nav-logout-btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.92);
}

html[data-theme="dark"] .nav-logout-btn {
  border: 1px solid rgba(255, 133, 133, 0.6);
  background: linear-gradient(120deg, rgba(190, 39, 39, 0.92), rgba(140, 20, 20, 0.92));
  color: #ffe9e9;
}

html[data-theme="dark"] .nav-logout-btn:hover {
  background: linear-gradient(120deg, rgba(210, 52, 52, 0.95), rgba(156, 24, 24, 0.95));
}

/* --- Glass System --- */
.glass {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.62), rgba(248, 252, 255, 0.28));
  border: 1px solid var(--border);
  box-shadow: var(--surface-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(16px) saturate(125%);
  -webkit-backdrop-filter: blur(16px) saturate(125%);
  transition: all 0.3s ease;
}

html[data-theme="dark"] .glass {
  background: linear-gradient(145deg, rgba(18, 28, 41, 0.58), rgba(32, 47, 67, 0.33));
  border: 1px solid rgba(188, 216, 242, 0.18);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(194, 226, 255, 0.1);
}


/* --- Buttons --- */
.actions {
  margin-top: 1.5rem;
  display: flex;
  gap: 1rem;
}

.btn {
  border: 0;
  border-radius: 12px;
  padding: 0.8rem 1.5rem;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(24, 88, 134, 0.22);
  filter: saturate(108%);
}

.auth-snippet {
  position: fixed;
  top: 0.85rem;
  right: 0.85rem;
  z-index: 40;
  width: 180px;
  padding: 0.8rem;
  border-radius: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  box-shadow: 0 8px 24px rgba(98, 159, 206, 0.2);
}

.auth-snippet-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: 100%;
  text-align: center;
}

.auth-snippet-user {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  width: 100%;
  align-items: center;
}

.auth-snippet-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}

.auth-snippet-username {
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}

.auth-snippet-credits {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--primary);
}

.btn-logout {
  white-space: nowrap;
  padding: 0.4rem 0.7rem;
  font-size: 0.76rem;
  border-radius: 999px;
}

html[data-theme="dark"] .btn-logout {
  border: 1px solid rgba(255, 133, 133, 0.58);
  background: linear-gradient(120deg, rgba(190, 39, 39, 0.9), rgba(140, 20, 20, 0.9));
  color: #ffe9e9;
}

html[data-theme="dark"] .btn-logout:hover {
  background: linear-gradient(120deg, rgba(210, 52, 52, 0.95), rgba(156, 24, 24, 0.95));
}

/* Desktop: auth-snippet above the fold, not floating */
@media (min-width: 901px) {
  .auth-snippet {
    position: fixed;
    top: 0.85rem;
    right: 0.85rem;
    width: 180px;
    margin: 0;
  }

  .auth-snippet-content {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
  }
}

.cnn-login-gate {
  border-radius: 18px;
  padding: 1.5rem;
  display: grid;
  gap: 1.2rem;
  text-align: center;
}

.cnn-login-gate h2 {
  margin: 0 0 0.3rem 0;
  font-size: 1.4rem;
}

.cnn-login-gate > p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.credits-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 0.5rem 0;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 14px;
}

.credits-info-item {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  padding: 0.8rem;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 10px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.credits-info-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(98, 159, 206, 0.15);
}

.credits-badge {
  font-size: 1.6rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  background: rgba(99, 184, 255, 0.15);
  border-radius: 10px;
}

.credits-info-text {
  text-align: left;
}

.credits-info-text strong {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.15rem;
  color: var(--ink);
}

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

.cnn-login-gate .actions {
  margin-top: 0.8rem;
  flex-wrap: wrap;
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.cnn-login-gate .btn {
  min-width: 160px;
}

.btn-primary {
  background: linear-gradient(120deg, var(--primary), var(--primary-strong));
  color: #fff;
}

.btn-soft {
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.9);
}

.btn-warm-cta {
  background: linear-gradient(120deg, #e13f43, #d7681b);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.28);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.25);
}

.btn-warm-cta:hover {
  box-shadow: 0 10px 24px rgba(214, 84, 40, 0.38);
  filter: saturate(114%);
}




.panel {
  border-radius: 18px;
  padding: 1rem;
}

.muted {
  color: var(--muted);
}

.field-error {
  color: #a03f55;
  font-size: 0.9rem;
}

.messages {
  margin-bottom: 1rem;
}

.message {
  border-radius: 12px;
  padding: 0.7rem;
  margin-bottom: 0.4rem;
}

.tilt-card {
  transform-style: preserve-3d;
  transition: transform 0.2s ease;
}

/* --- Theme Switcher (Dashboard only) --- */
.theme-switcher {
  position: static;
  display: flex;
  align-items: center;
  gap: 6px;
  width: auto;
  height: 50px;
  box-sizing: border-box;
  padding: 6px 8px 7px;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: 99em;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.62), rgba(248, 252, 255, 0.28));
  box-shadow: var(--surface-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(16px) saturate(125%);
  -webkit-backdrop-filter: blur(16px) saturate(125%);
  transition: all 400ms cubic-bezier(1, 0, 0.4, 1);
}

@media (max-width: 900px) {
  .nav-wrap {
    position: relative;
    align-items: center;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .main-nav {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    left: 0;
    display: none;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.8rem;
    padding: 0.9rem 1rem 1rem;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(244, 250, 255, 0.88));
    box-shadow: var(--surface-shadow);
    z-index: 60;
  }

  .main-nav.is-open {
    display: flex;
  }

  .main-nav a {
    width: 100%;
    padding: 0.15rem 0;
  }

  .main-nav .nav-logout-form {
    display: none;
  }

  .mobile-auth-box {
    display: flex;
    width: 100%;
    margin-top: 0.35rem;
    padding-top: 0.8rem;
    border-top: 1px solid rgba(255, 255, 255, 0.7);
    flex-direction: column;
    gap: 0.55rem;
    border-radius: 10px;
  }

  .mobile-auth-user {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
  }

  .mobile-auth-label {
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    font-weight: 700;
  }

  .mobile-auth-username {
    font-weight: 700;
    font-size: 0.9rem;
  }

  .mobile-auth-credits {
    font-size: 0.8rem;
    color: var(--primary);
    font-weight: 600;
  }

  .mobile-auth-box .btn-logout {
    width: 100%;
    justify-content: center;
  }

  .auth-snippet {
    display: none;
  }

  .dashboard-theme-row {
    justify-content: center;
  }

  .dashboard-theme-label {
    display: none;
  }

  .theme-switcher {
    gap: 4px;
    padding: 5px 6px;
    height: 44px;
  }

  .theme-switcher__option {
    width: 34px;
    padding: 0 8px;
  }

  .theme-switcher__icon {
    width: 18px;
    height: 18px;
  }
}

html[data-theme="dark"] .theme-switcher {
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.6), rgba(15, 23, 42, 0.35));
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--surface-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

html[data-theme="reading"] .theme-switcher {
  background: linear-gradient(145deg, rgba(255, 235, 205, 0.7), rgba(255, 248, 240, 0.4));
  border: 1px solid rgba(210, 180, 140, 0.3);
  box-shadow: 0 8px 24px rgba(62, 39, 35, 0.1), inset 0 1px 0 rgba(255, 245, 238, 0.8);
}

.theme-switcher__legend {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  border: 0;
  padding: 0;
  white-space: nowrap;
  clip-path: inset(100%);
  clip: rect(0 0 0 0);
  overflow: hidden;
}

.theme-switcher__input {
  clip: rect(0 0 0 0);
  clip-path: inset(100%);
  height: 1px;
  width: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
}

.theme-switcher__icon {
  display: block;
  width: 22px;
  height: 22px;
  transition: scale 200ms cubic-bezier(0.5, 0, 0, 1);
}

.theme-switcher__filter {
  position: absolute;
  width: 0;
  height: 0;
  z-index: -1;
}

.theme-switcher__option {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 10px;
  width: 38px;
  height: 100%;
  box-sizing: border-box;
  border-radius: 99em;
  opacity: 0.6;
  transition: all 160ms cubic-bezier(0.5, 0, 0, 1);
  cursor: pointer;
}

.theme-switcher__option:hover {
  opacity: 1;
}

.theme-switcher__option:hover .theme-switcher__icon {
  scale: 1.15;
}

.theme-switcher__option:has(input:checked) {
  opacity: 1;
  background: rgba(255, 255, 255, 0.3);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.4), inset 0 -2px 4px rgba(0, 0, 0, 0.1);
}

html[data-theme="dark"] .theme-switcher__option:has(input:checked) {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.15), inset 0 -2px 4px rgba(0, 0, 0, 0.3);
}

html[data-theme="reading"] .theme-switcher__option:has(input:checked) {
  background: rgba(210, 180, 140, 0.25);
  box-shadow: inset 0 1px 2px rgba(255, 245, 238, 0.6), inset 0 -2px 4px rgba(139, 110, 99, 0.1);
}

.rank {
  font-weight: bold;
  color: var(--primary);
}

.species {
  font-weight: 600;
}

.confidence {
  text-align: right;
  font-weight: bold;
}

.confidence-bar {
  grid-column: 1 / -1;
  height: 6px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #5cb6ff, #7ac6ff);
  border-radius: 3px;
}

.model-location {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 1.5rem;
  margin-top: 1.5rem;
}

.code-block {
  display: block;
  background: rgba(0, 0, 0, 0.2);
  padding: 1rem;
  border-radius: 8px;
  font-family: 'Courier New', monospace;
  overflow-x: auto;
  margin: 0.8rem 0;
  font-size: 0.9rem;
}

.info-text {
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 0.5rem;
}

.version-info {
  margin-top: 2rem;
}

.roadmap {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.roadmap-item {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 8px;
}

.version-badge {
  background: var(--primary);
  color: white;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  font-weight: bold;
  font-size: 0.85rem;
  white-space: nowrap;
  margin-top: 0.2rem;
}

.roadmap-item.completed .version-badge {
  background: #5cb6ff;
}

.roadmap-item.pending .version-badge {
  background: #9fbcff;
  opacity: 0.6;
}

.roadmap-item p {
  margin: 0;
}

.spinner {
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid var(--primary);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 2rem auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}




