:root {
  --bg: #08110f;
  --bg-elevated: rgba(13, 23, 19, 0.84);
  --bg-strong: rgba(9, 18, 14, 0.92);
  --panel: rgba(14, 25, 20, 0.78);
  --panel-strong: rgba(11, 20, 16, 0.9);
  --panel-border: rgba(210, 228, 208, 0.12);
  --panel-border-strong: rgba(225, 236, 223, 0.24);
  --text: #eef3e9;
  --muted: #adc0b0;
  --accent: #d7e19f;
  --accent-strong: #99c671;
  --accent-soft: rgba(153, 198, 113, 0.14);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  --danger: #f0aaa2;
  --warn: #e6cf89;
  --info: #8fd1df;
  --success: #a8ddb0;
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --sidebar-width: 320px;
  --sidebar-collapsed-width: 104px;
  --content-max: 1520px;
  --shell-gap: 24px;
  --duration-slow: 420ms;
  --duration-fast: 220ms;
  --ease-shell: cubic-bezier(0.2, 0.8, 0.2, 1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(139, 177, 99, 0.2), transparent 28%),
    radial-gradient(circle at top right, rgba(54, 99, 75, 0.22), transparent 24%),
    linear-gradient(180deg, #07110d 0%, #08100d 44%, #09130f 100%);
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
}

body::before {
  background:
    linear-gradient(rgba(4, 9, 7, 0.5), rgba(4, 9, 7, 0.78)),
    url("../public/forest-mist.svg") center / cover no-repeat;
  opacity: 0.52;
}

body::after {
  z-index: -1;
  background:
    radial-gradient(circle at 18% 22%, rgba(194, 215, 151, 0.12), transparent 14%),
    radial-gradient(circle at 78% 16%, rgba(135, 185, 118, 0.08), transparent 12%),
    radial-gradient(circle at 48% 64%, rgba(255, 255, 255, 0.03), transparent 18%);
}

body.theme-dawn {
  --bg: #161219;
  --bg-elevated: rgba(34, 23, 33, 0.82);
  --bg-strong: rgba(26, 18, 25, 0.92);
  --panel: rgba(39, 27, 36, 0.76);
  --panel-strong: rgba(29, 20, 28, 0.88);
  --panel-border: rgba(241, 216, 193, 0.14);
  --panel-border-strong: rgba(248, 224, 204, 0.26);
  --text: #fff2ea;
  --muted: #d7c3b6;
  --accent: #ffd3a8;
  --accent-strong: #ff9f74;
  --accent-soft: rgba(255, 159, 116, 0.14);
}

body.theme-system {
  color-scheme: dark;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

a {
  color: var(--accent);
}

code,
pre {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

#app {
  min-height: 100vh;
}

.page-transition-shell {
  position: relative;
  min-height: 100vh;
  overflow: clip;
}

.page-transition-layer {
  position: absolute;
  inset: 0;
  will-change: transform, opacity, filter;
}

.page-transition-layer.is-outgoing {
  pointer-events: none;
  animation: page-fade-out 560ms cubic-bezier(0.22, 0.82, 0.24, 1) forwards;
}

.page-transition-layer.is-incoming {
  animation: page-fade-in 560ms cubic-bezier(0.22, 0.82, 0.24, 1) forwards;
}

.page-transition-home.is-incoming {
  z-index: 1;
}

.app-splash,
.landing-page {
  min-height: 100vh;
}

.app-splash,
.landing-page,
.home-shell {
  position: relative;
  isolation: isolate;
}

.app-splash::before,
.landing-page::before,
.home-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(circle at 20% 20%, rgba(179, 211, 114, 0.12), transparent 18%),
    radial-gradient(circle at 82% 22%, rgba(72, 121, 92, 0.16), transparent 20%),
    radial-gradient(circle at 40% 82%, rgba(255, 255, 255, 0.03), transparent 22%);
}

.eyebrow,
.habitat-label,
.meta-label {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.72rem;
  color: var(--accent);
}

.app-splash {
  display: grid;
  place-items: center;
  padding: 32px;
}

.splash-card,
.auth-card,
.page-panel,
.habitat-card,
.comparison-card,
.sidebar,
.content-hero,
.topbar,
.gate-card,
.settings-shell,
.overview-card,
.preference-card {
  backdrop-filter: blur(18px);
  background: linear-gradient(180deg, var(--bg-elevated), var(--bg-strong));
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
}

.splash-card {
  width: min(560px, 100%);
  padding: 32px;
  border-radius: var(--radius-xl);
}

.splash-card h1 {
  margin: 12px 0;
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(2.8rem, 7vw, 4.4rem);
  line-height: 0.92;
}

.splash-card p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.7;
}

.page-shell {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 64px;
}

.entry-shell.landing-page {
  display: block;
  align-items: initial;
  padding: 24px 0 64px;
}

.entry-shell .hero {
  position: relative;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 420px);
  gap: 32px;
  align-items: end;
  padding: 72px 0 40px;
  isolation: isolate;
}

.entry-shell .mist-layer,
.entry-shell .canopy,
.entry-shell .floating-leaf,
.entry-shell .animal-sketch {
  position: absolute;
  pointer-events: none;
}

.entry-shell .mist-layer {
  inset: 10% 0 6%;
  background:
    radial-gradient(circle at 50% 20%, rgba(203, 224, 184, 0.12), transparent 26%),
    radial-gradient(circle at 30% 38%, rgba(132, 181, 109, 0.08), transparent 24%),
    radial-gradient(circle at 75% 42%, rgba(132, 181, 109, 0.07), transparent 20%);
  filter: blur(16px);
  z-index: -1;
}

.entry-shell .canopy {
  width: 400px;
  height: 400px;
  background:
    radial-gradient(circle at 50% 50%, rgba(157, 202, 114, 0.22), transparent 42%),
    radial-gradient(circle at 48% 52%, rgba(23, 58, 39, 0.92), rgba(10, 26, 18, 0.18) 72%, transparent 73%);
  filter: blur(2px);
}

.entry-shell .canopy::before,
.entry-shell .canopy::after,
.entry-shell .floating-leaf::before,
.entry-shell .floating-leaf::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 60% 0 60% 0;
  background: linear-gradient(145deg, rgba(136, 185, 94, 0.44), rgba(12, 42, 25, 0.78));
  transform: rotate(14deg);
}

.entry-shell .canopy::after {
  transform: rotate(-26deg) scale(0.86);
  opacity: 0.85;
}

.entry-shell .canopy-left {
  top: -90px;
  left: -110px;
  transform: rotate(-12deg);
}

.entry-shell .canopy-right {
  top: -120px;
  right: -120px;
  transform: rotate(10deg);
}

.entry-shell .floating-leaf {
  width: 150px;
  height: 150px;
  opacity: 0.6;
  animation: drift 11s ease-in-out infinite;
}

.entry-shell .leaf-a {
  top: 18%;
  left: 10%;
}

.entry-shell .leaf-b {
  top: 35%;
  right: 12%;
  animation-delay: -4s;
}

.entry-shell .leaf-c {
  bottom: 14%;
  left: 40%;
  width: 100px;
  height: 100px;
  animation-delay: -7s;
}

.entry-shell .animal-sketch {
  opacity: 0.2;
  filter: drop-shadow(0 16px 30px rgba(0, 0, 0, 0.24));
}

.entry-shell .animal-sketch svg {
  width: 100%;
  height: auto;
  fill: none;
  stroke: rgba(216, 225, 207, 0.62);
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.entry-shell .sketch-owl {
  top: 16%;
  left: 18%;
  width: 120px;
}

.entry-shell .sketch-fox {
  bottom: 26%;
  left: 6%;
  width: 180px;
}

.entry-shell .sketch-jaguar {
  top: 22%;
  right: 9%;
  width: 200px;
}

.entry-shell .sketch-gecko {
  bottom: 10%;
  right: 23%;
  width: 140px;
}

.entry-shell .hero-copy,
.entry-shell .auth-panel {
  position: relative;
  z-index: 1;
}

.entry-shell .hero-copy {
  max-width: 680px;
  padding: 36px 0 90px;
}

.entry-shell .auth-kicker,
.entry-shell .feature-label {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  font-size: 0.75rem;
  color: var(--accent);
}

.entry-shell .hero-title {
  margin: 16px 0 12px;
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(4rem, 10vw, 8rem);
  line-height: 0.9;
  font-weight: 600;
}

.entry-shell .title-line {
  display: block;
  opacity: 0;
  transform: translateY(30px);
  animation: reveal-up 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.entry-shell .title-line:nth-child(2) {
  animation-delay: 0.12s;
}

.entry-shell .title-line:nth-child(3) {
  animation-delay: 0.22s;
}

.entry-shell .hero-description,
.entry-shell .auth-note {
  color: var(--muted);
  line-height: 1.75;
}

.entry-shell .hero-description {
  max-width: 560px;
  margin: 24px 0 0;
  font-size: clamp(1rem, 2vw, 1.18rem);
  opacity: 0;
  animation: reveal-up 0.9s ease 0.35s forwards;
}

.entry-shell .hero-signals {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 30px;
  opacity: 0;
  animation: reveal-up 0.9s ease 0.46s forwards;
}

.entry-shell .signal-chip {
  min-width: 150px;
  padding: 16px 18px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(225, 236, 223, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.entry-shell .signal-chip strong {
  display: block;
  font-size: 1.75rem;
  line-height: 1;
  color: var(--accent);
  font-family: "Cormorant Garamond", serif;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.entry-shell .signal-chip span {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  line-height: 1.5;
}

.entry-shell .auth-panel,
.entry-shell .feature-card {
  backdrop-filter: blur(18px);
  background: linear-gradient(180deg, rgba(14, 32, 23, 0.86), rgba(7, 18, 13, 0.82));
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
}

.entry-shell .auth-panel {
  padding: 32px;
  align-self: center;
  border-radius: 28px;
  border-top-color: rgba(215, 225, 159, 0.28);
  border-top-width: 2px;
}

.entry-shell .auth-header h2,
.entry-shell .feature-card h3 {
  margin: 10px 0 8px;
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
}

.entry-shell .auth-header h2 {
  font-size: clamp(2rem, 4vw, 2.8rem);
  line-height: 1.1;
}

.entry-shell .firebase-warning,
.entry-shell .status-card {
  margin-bottom: 16px;
  padding: 13px 14px;
  border-radius: 16px;
  font-size: 0.95rem;
  line-height: 1.5;
}

.entry-shell .firebase-warning {
  background: rgba(229, 207, 132, 0.12);
  color: var(--warn);
  border: 1px solid rgba(229, 207, 132, 0.2);
}

.entry-shell .status-card {
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.entry-shell .status-card[data-tone="error"] {
  color: var(--danger);
  border-color: rgba(240, 168, 159, 0.24);
}

.entry-shell .status-card[data-tone="warn"] {
  color: var(--warn);
  border-color: rgba(229, 207, 132, 0.24);
}

.entry-shell .status-card[data-tone="info"] {
  color: var(--info);
  border-color: rgba(143, 209, 223, 0.24);
}

.entry-shell .status-card[data-tone="success"] {
  color: var(--success);
  border-color: rgba(149, 216, 172, 0.24);
}

.entry-shell .auth-actions,
.entry-shell .email-actions {
  display: grid;
  gap: 12px;
}

.entry-shell .auth-btn,
.entry-shell .ghost-btn,
.entry-shell .toggle-email {
  border: 0;
  border-radius: 999px;
  padding: 14px 18px;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease, border-color 180ms ease;
}

.entry-shell .auth-btn:hover,
.entry-shell .ghost-btn:hover,
.entry-shell .toggle-email:hover {
  transform: translateY(-2px);
}

.entry-shell .auth-btn-google:hover {
  box-shadow: 0 6px 24px rgba(215, 225, 159, 0.3);
}

.entry-shell .auth-btn-google {
  background: linear-gradient(135deg, #edf0e4, #cfdabf);
  color: #102019;
  box-shadow: 0 4px 18px rgba(215, 225, 159, 0.2);
  font-weight: 600;
}

.entry-shell .auth-btn-anon,
.entry-shell .auth-btn-secondary {
  background: linear-gradient(135deg, rgba(34, 59, 46, 0.96), rgba(18, 32, 24, 0.96));
  color: var(--text);
  border: 1px solid rgba(214, 229, 209, 0.08);
}

.entry-shell .ghost-btn,
.entry-shell .toggle-email {
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.entry-shell .ghost-btn.is-active {
  color: var(--text);
  border-color: var(--panel-border-strong);
  background: rgba(214, 229, 209, 0.09);
}

.entry-shell .email-form {
  display: grid;
  gap: 14px;
  margin: 16px 0;
}

.entry-shell .email-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.entry-shell .email-form input {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 12px 14px;
  background: rgba(5, 12, 9, 0.46);
  color: var(--text);
}

.entry-shell .feature-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin-top: 8px;
  padding-bottom: 48px;
}

.entry-shell .feature-card {
  padding: 28px;
  border-radius: 24px;
  transform: translateY(24px);
  opacity: 0;
  animation: reveal-up 0.8s ease 0.48s forwards;
  position: relative;
}

.entry-shell .feature-card::after {
  content: "";
  position: absolute;
  inset: auto 28px 0;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(215, 225, 159, 0), rgba(215, 225, 159, 0.95), rgba(215, 225, 159, 0));
  opacity: 0.8;
}

.entry-shell .feature-card:nth-child(2) {
  animation-delay: 0.6s;
}

.entry-shell .feature-card:nth-child(3) {
  animation-delay: 0.72s;
}

.entry-shell .feature-card h3 {
  font-size: 1.7rem;
  line-height: 1.15;
}

.entry-shell .feature-card p:last-child {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.landing-page {
  display: grid;
  align-items: center;
  padding: 36px;
}

.landing-backdrop {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(115deg, rgba(8, 17, 13, 0.4), rgba(8, 17, 13, 0.82)),
    radial-gradient(circle at 16% 20%, rgba(175, 208, 126, 0.16), transparent 16%),
    radial-gradient(circle at 80% 24%, rgba(92, 141, 109, 0.14), transparent 18%);
  z-index: -1;
}

.landing-hero {
  width: min(var(--content-max), 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 440px);
  gap: 32px;
  align-items: center;
}

.landing-copy {
  padding: 32px 0;
}

.landing-copy h1,
.content-hero h1 {
  margin: 14px 0 18px;
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(4rem, 10vw, 7rem);
  line-height: 0.88;
  font-weight: 600;
}

.landing-lede,
.auth-card-header p,
.landing-points p,
.sidebar-copy,
.comparison-empty p,
.page-panel p,
.page-panel li,
.section-heading p,
.content-hero > div:first-child > p:last-child,
.topbar-copy {
  color: var(--muted);
  line-height: 1.75;
}

.landing-metrics {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin: 28px 0;
}

.landing-metrics div {
  min-width: 160px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.04);
}

.landing-metrics strong {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
}

.landing-metrics span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.landing-points {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.landing-points article {
  padding: 22px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.landing-points h2,
.auth-card h2,
.section-heading h2,
.comparison-head h3,
.overview-card h3,
.settings-header h2,
.content-hero h1 {
  margin: 8px 0 12px;
}

.landing-points h2,
.auth-card h2,
.section-heading h2,
.overview-card h3,
.settings-header h2,
.comparison-head h3 {
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
}

.auth-card {
  padding: 28px;
  border-radius: var(--radius-xl);
}

.auth-card-header h2 {
  font-size: clamp(2.3rem, 5vw, 3rem);
}

.auth-form {
  display: grid;
  gap: 14px;
  margin: 22px 0 18px;
}

.auth-form label,
.habitat-select,
.preference-card {
  display: grid;
  gap: 8px;
}

.auth-form span,
.habitat-select span,
.preference-title {
  color: var(--muted);
  font-size: 0.92rem;
}

.auth-form input,
.habitat-select select,
.preference-card select {
  width: 100%;
  min-height: 50px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(5, 11, 8, 0.44);
  color: var(--text);
  padding: 12px 14px;
}

.auth-actions {
  display: grid;
  gap: 12px;
}

.primary-button,
.secondary-button,
.ghost-button,
.menu-button,
.icon-button,
.sidebar-link,
.habitat-add {
  border: 0;
  transition:
    transform var(--duration-fast) ease,
    background var(--duration-fast) ease,
    border-color var(--duration-fast) ease,
    opacity var(--duration-fast) ease,
    box-shadow var(--duration-fast) ease;
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.menu-button:hover,
.icon-button:hover,
.sidebar-link:hover,
.habitat-add:hover {
  transform: translateY(-1px);
}

.primary-button,
.menu-button {
  border-radius: 999px;
  min-height: 50px;
  padding: 0 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #0f160f;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.secondary-button,
.ghost-button,
.icon-button,
.sidebar-link,
.habitat-add {
  border-radius: 18px;
  padding: 14px 16px;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
}

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

.icon-button {
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  padding: 0;
}

.status-banner {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.status-error {
  color: var(--danger);
  border-color: rgba(240, 170, 162, 0.26);
}

.status-warn {
  color: var(--warn);
  border-color: rgba(230, 207, 137, 0.22);
}

.status-info {
  color: var(--info);
  border-color: rgba(143, 209, 223, 0.22);
}

.status-success {
  color: var(--success);
  border-color: rgba(168, 221, 176, 0.22);
}

@keyframes drift {
  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
  50% {
    transform: translate3d(0, -10px, 0) rotate(6deg);
  }
}

@keyframes reveal-up {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes page-fade-in {
  from {
    opacity: 0;
    transform: translate3d(0, 38px, 0) scale(0.985);
    filter: blur(10px);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
    filter: blur(0);
  }
}

@keyframes page-fade-out {
  from {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
    filter: blur(0);
  }
  to {
    opacity: 0;
    transform: translate3d(0, -24px, 0) scale(1.012);
    filter: blur(14px);
  }
}

.home-shell {
  width: min(var(--content-max), calc(100% - 32px));
  margin: 0 auto;
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  gap: var(--shell-gap);
  padding: 20px 0 28px;
}

.home-shell.sidebar-closed.desktop-shell {
  grid-template-columns: 0 minmax(0, 1fr);
  gap: 0;
}

.home-shell.desktop-shell .sidebar,
.home-shell.desktop-shell .content-shell {
  transition:
    width var(--duration-slow) var(--ease-shell),
    transform var(--duration-slow) var(--ease-shell),
    opacity var(--duration-fast) ease,
    grid-template-columns var(--duration-slow) var(--ease-shell);
}

.mobile-overlay {
  display: none;
}

.sidebar {
  position: sticky;
  top: 20px;
  height: calc(100vh - 40px);
  padding: 20px;
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.sidebar::before,
.content-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.04), transparent 28%);
}

.sidebar-head,
.habitat-card-head,
.settings-header,
.content-meta,
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.sidebar-head h2 {
  margin: 8px 0 0;
  font-family: "Cormorant Garamond", serif;
  font-size: 2rem;
}

.sidebar-copy {
  margin: 18px 0 22px;
}

.sidebar-nav {
  display: grid;
  gap: 10px;
}

.sidebar-link {
  width: 100%;
  text-align: left;
  display: grid;
  gap: 2px;
}

.sidebar-link span {
  font-weight: 700;
}

.sidebar-link small {
  color: var(--muted);
}

.sidebar-link.active {
  background: var(--accent-soft);
  border-color: var(--panel-border-strong);
}

.sidebar-foot {
  margin-top: 20px;
  display: grid;
  gap: 14px;
}

.gate-card {
  padding: 18px;
  border-radius: 22px;
}

.gate-card strong {
  display: block;
  margin: 8px 0 6px;
}

.gate-card small {
  color: var(--muted);
  line-height: 1.6;
}

.gate-card.gate-open {
  border-color: rgba(173, 216, 136, 0.26);
}

.sidebar-account {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--panel-border);
}

.sidebar-account-label {
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.content-shell {
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto auto auto 1fr;
  gap: 18px;
}

.topbar {
  padding: 18px 20px;
  border-radius: 24px;
  align-items: center;
}

.topbar-logout {
  margin-left: auto;
}

.topbar-copy strong {
  display: block;
  margin-top: 4px;
  color: var(--text);
}

.content-hero {
  padding: 28px;
  border-radius: var(--radius-xl);
}

.content-hero > div:first-child > p:last-child {
  margin-bottom: 0;
  max-width: 760px;
}

.content-meta {
  flex-wrap: wrap;
}

.content-meta > div {
  min-width: 140px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.content-meta strong {
  display: block;
  margin-top: 6px;
}

.habitat-strip,
.comparison-section {
  display: grid;
  gap: 18px;
}

.section-heading h2,
.settings-header h2 {
  font-size: clamp(2rem, 4vw, 3rem);
}

.section-heading p:last-child,
.settings-header p:last-child {
  margin-bottom: 0;
}

.habitat-grid,
.comparison-grid,
.overview-grid,
.language-toggle-grid,
.preference-grid {
  display: grid;
  gap: 18px;
}

.habitat-grid {
  grid-template-columns: minmax(0, 1fr);
}

.habitat-grid.two-open,
.overview-grid,
.preference-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.habitat-card,
.habitat-add,
.comparison-card,
.page-panel,
.overview-card,
.preference-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
}

.habitat-card,
.comparison-card,
.page-panel,
.overview-card,
.preference-card {
  padding: 22px;
}

.habitat-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.habitat-add {
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 6px;
  min-height: 176px;
}

.habitat-add span {
  font-size: 2rem;
  font-weight: 700;
}

.habitat-add strong {
  font-size: 1.15rem;
}

.habitat-add small {
  color: var(--muted);
  line-height: 1.65;
}

.page-stack {
  display: grid;
  gap: 18px;
  padding-bottom: 20px;
}

.doc-prose > :first-child,
.comparison-content > :first-child {
  margin-top: 0;
}

.doc-prose > :last-child,
.comparison-content > :last-child,
.comparison-empty > :last-child,
.overview-card > :last-child {
  margin-bottom: 0;
}

.doc-prose h2,
.doc-prose h3,
.doc-prose h4,
.comparison-content h2,
.comparison-content h3 {
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
}

.doc-prose h2,
.comparison-content h2 {
  font-size: clamp(2rem, 4vw, 2.8rem);
}

.doc-prose h3,
.comparison-content h3 {
  font-size: 1.75rem;
}

.doc-prose ul,
.doc-prose ol,
.comparison-content ul,
.comparison-content ol {
  padding-left: 20px;
}

.doc-prose li + li,
.comparison-content li + li {
  margin-top: 8px;
}

.doc-note {
  margin: 30px 0;
  border-radius: var(--radius-lg);
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid var(--panel-border-strong);
  overflow: hidden;
}

.doc-note-title {
  display: block;
  margin: 0;
  padding: 11px 20px 10px;
  font-size: 0.73rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  background: rgba(255, 255, 255, 0.035);
  border-bottom: 1px solid var(--panel-border);
}

.code-block {
  margin: 18px 0;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(4, 8, 6, 0.68);
  overflow: auto;
}

.code-block code {
  display: block;
  white-space: pre-wrap;
  color: #eaf2d9;
}

.comparison-grid.comparison-count-1 {
  grid-template-columns: minmax(0, 1fr);
}

.comparison-grid.comparison-count-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.comparison-card {
  border-top: 3px solid var(--language-accent);
}

.comparison-head h3 {
  font-size: 2rem;
}

.comparison-empty {
  padding-top: 8px;
}

.placeholder-panel {
  border-style: dashed;
}

.welcome-overview {
  display: grid;
  gap: 20px;
}

.language-cloud {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.language-pill {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--language-accent, var(--accent)) 52%, white 10%);
  background: color-mix(in srgb, var(--language-accent, var(--accent)) 14%, rgba(255, 255, 255, 0.04));
  color: var(--text);
}

.language-pill.muted {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.settings-shell {
  padding: 22px;
  border-radius: var(--radius-lg);
}

.settings-metrics {
  min-width: 132px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.settings-metrics span {
  display: block;
  font-size: 1.7rem;
  font-weight: 700;
}

.settings-metrics small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.6;
}

.language-toggle-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 18px;
}

.language-toggle {
  display: grid;
  gap: 6px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.language-toggle input {
  accent-color: var(--accent-strong);
}

.language-toggle.active {
  background: var(--accent-soft);
  border-color: var(--panel-border-strong);
}

.language-toggle-title {
  font-weight: 700;
}

.language-toggle small {
  color: var(--muted);
}

.preference-grid {
  margin-top: 18px;
}

.preference-card {
  padding: 18px;
}

.shell-entering .sidebar,
.shell-entering .content-shell {
  animation: shell-enter var(--duration-slow) var(--ease-shell);
}

@keyframes shell-enter {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}

body.motion-reduced *,
body.motion-minimal * {
  animation-duration: 1ms !important;
}

body.motion-minimal *,
body.motion-minimal *::before,
body.motion-minimal *::after {
  transition-duration: 1ms !important;
}

@media (max-width: 1180px) {
  .entry-shell .hero {
    grid-template-columns: 1fr;
    align-items: start;
    min-height: auto;
  }

  .entry-shell .hero-copy {
    padding-bottom: 0;
  }

  .entry-shell .feature-strip {
    grid-template-columns: 1fr;
  }

  .entry-shell .hero-signals {
    max-width: 620px;
  }

  .entry-shell .sketch-jaguar,
  .entry-shell .sketch-gecko {
    display: none;
  }

  .landing-hero,
  .home-shell {
    width: min(calc(100% - 24px), var(--content-max));
  }

  .landing-hero {
    grid-template-columns: 1fr;
  }

  .language-toggle-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .page-shell,
  .entry-shell.landing-page {
    width: min(100%, calc(100% - 24px));
  }

  .entry-shell .hero {
    padding-top: 48px;
  }

  .entry-shell .hero-title {
    font-size: clamp(3rem, 16vw, 4.8rem);
  }

  .entry-shell .animal-sketch {
    opacity: 0.14;
  }

  .entry-shell .hero-signals {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .landing-page {
    padding: 18px;
  }

  .landing-points,
  .habitat-grid.two-open,
  .comparison-grid.comparison-count-2,
  .overview-grid,
  .preference-grid,
  .settings-header,
  .content-hero,
  .topbar {
    grid-template-columns: 1fr;
  }

  .landing-points,
  .content-meta {
    display: grid;
  }

  .home-shell.mobile-shell {
    display: block;
    width: min(calc(100% - 20px), var(--content-max));
    padding: 10px 0 24px;
  }

  .mobile-overlay {
    position: fixed;
    inset: 0;
    z-index: 20;
    background: rgba(3, 7, 5, 0.58);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--duration-fast) ease;
    display: block;
  }

  .mobile-overlay.visible {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar {
    position: fixed;
    left: 10px;
    top: 10px;
    bottom: 10px;
    width: min(86vw, 340px);
    height: auto;
    z-index: 30;
    transform: translateX(-108%);
    transition: transform var(--duration-slow) var(--ease-shell);
  }

  .home-shell.mobile-shell.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .content-shell {
    gap: 16px;
  }

  .content-hero,
  .topbar,
  .settings-shell,
  .page-panel,
  .comparison-card,
  .habitat-card,
  .habitat-add {
    padding: 20px;
  }

  .content-hero h1 {
    font-size: clamp(3rem, 13vw, 4.6rem);
  }
}

@media (min-width: 861px) {
  .home-shell.desktop-shell.sidebar-closed .sidebar {
    width: 0;
    opacity: 0;
    pointer-events: none;
    transform: translateX(calc(-100% - var(--shell-gap)));
    padding: 0;
    border-width: 0;
  }
}

@media (max-width: 640px) {
  .entry-shell .sketch-fox,
  .entry-shell .sketch-owl {
    display: none;
  }

  .entry-shell .hero-signals {
    grid-template-columns: 1fr;
  }

  .landing-metrics,
  .content-meta {
    display: grid;
    grid-template-columns: 1fr;
  }

  .language-toggle-grid {
    grid-template-columns: 1fr;
  }

  .landing-copy h1,
  .splash-card h1 {
    font-size: clamp(2.8rem, 18vw, 4.6rem);
  }
}

/* ===================================
   Inline Tab Groups
   =================================== */

.inline-tab-group {
  margin: 20px 0;
  border: 1px solid var(--panel-border-strong);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: rgba(0, 0, 0, 0.18);
}

.itab-bar {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 2px;
  padding: 8px 8px 0;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--panel-border);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.itab-bar::-webkit-scrollbar {
  height: 4px;
}

.itab-bar::-webkit-scrollbar-track {
  background: transparent;
}

.itab-bar::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
}

.itab-btn {
  padding: 6px 14px;
  min-height: 34px;
  flex-shrink: 0;
  white-space: nowrap;
  border-radius: 8px 8px 0 0;
  border: 1px solid transparent;
  border-bottom: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 140ms, background 140ms, border-color 140ms;
  flex-shrink: 0;
  white-space: nowrap;
}

.itab-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.itab-btn.is-active {
  color: var(--accent);
  border-color: var(--panel-border-strong);
  border-bottom-color: transparent;
  background: rgba(0, 0, 0, 0.28);
}

.itab-panels {
  padding: 20px 22px;
}

.itab-panel {
  display: none;
}

.itab-panel.is-visible {
  display: block;
}

/* Nested tab group inside doc-note: flush edges */
.doc-note .inline-tab-group {
  margin: 16px -22px -20px;
  border-left: none;
  border-right: none;
  border-bottom: none;
  border-top: 1px solid var(--panel-border);
  border-radius: 0;
  background: transparent;
}

.doc-note .inline-tab-group:first-child {
  margin-top: -20px;
  border-top: none;
}


/* ===================================
   Details / Collapsible Blocks
   =================================== */

.doc-details {
  margin: 14px 0;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.doc-details summary.doc-details-title {
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--accent);
  list-style: none;
  background: rgba(255, 255, 255, 0.04);
  user-select: none;
}

.doc-details summary.doc-details-title::-webkit-details-marker {
  display: none;
}

.doc-details summary.doc-details-title::before {
  content: "▶";
  display: inline-block;
  font-size: 0.65em;
  margin-right: 8px;
  opacity: 0.7;
  transition: transform 180ms ease;
}

.doc-details[open] summary.doc-details-title::before {
  transform: rotate(90deg);
}

.doc-details[open] summary.doc-details-title {
  border-bottom: 1px solid var(--panel-border);
}

.doc-details-body {
  padding: 16px 18px;
}

/* ===================================
   Table Styling
   =================================== */

.doc-table-wrap {
  overflow-x: auto;
  margin: 16px 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--panel-border);
}

.doc-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.doc-table-wrap th {
  padding: 10px 14px;
  text-align: left;
  background: rgba(255, 255, 255, 0.06);
  border-bottom: 2px solid var(--panel-border-strong);
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

.doc-table-wrap td {
  padding: 12px 14px;
  vertical-align: top;
  border-bottom: 1px solid var(--panel-border);
}

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

.doc-table-wrap pre {
  margin: 6px 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.38);
  font-size: 0.82rem;
  overflow-x: auto;
  white-space: pre;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

.doc-table-wrap code {
  font-size: 0.84rem;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

/* ===================================
   Doc-prose improvements
   =================================== */

.doc-prose {
  line-height: 1.72;
}

.doc-prose p,
.itab-panel p,
.doc-note-body p,
.doc-details-body p {
  margin: 0 0 14px;
}

.doc-prose p:last-child,
.itab-panel p:last-child,
.doc-note-body p:last-child,
.doc-details-body p:last-child {
  margin-bottom: 0;
}

/* Habitat box body */
.doc-note-body {
  padding: 20px 22px;
}

/* Code block language badge */
.code-block::before {
  content: attr(data-language);
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 8px;
  opacity: 0.65;
}

/* ===================================
   General link and inline code polish
   =================================== */

.doc-prose a,
.itab-panel a,
.doc-note-body a,
.doc-details-body a,
.comparison-content a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(215, 225, 159, 0.38);
  text-underline-offset: 3px;
}

.doc-prose a:hover,
.itab-panel a:hover,
.doc-note-body a:hover,
.doc-details-body a:hover,
.comparison-content a:hover {
  text-decoration-color: var(--accent);
}

.doc-prose code,
.itab-panel code,
.doc-note-body code,
.doc-details-body code,
.comparison-content code {
  padding: 2px 5px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.09);
  font-size: 0.875em;
  color: #d4f0c0;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

.doc-prose strong,
.itab-panel strong,
.doc-note-body strong,
.doc-details-body strong,
.comparison-content strong {
  color: var(--text);
  font-weight: 700;
}

/* Mobile adjustments for inline tabs */
@media (max-width: 640px) {
  .itab-btn {
    font-size: 0.78rem;
    padding: 5px 10px;
  }

  .itab-panels {
    padding: 14px 16px;
  }

  .doc-table-wrap th,
  .doc-table-wrap td {
    padding: 8px 10px;
  }
}
