:root {
  --bg: #f6f0e6;
  --bg-deep: #efe3d2;
  --ink: #1f2430;
  --muted: #5d6573;
  --accent: #0f8a7c;
  --accent-strong: #0b6f65;
  --accent-2: #ef6c3d;
  --card: rgba(255, 255, 255, 0.9);
  --stroke: rgba(31, 36, 48, 0.14);
  --shadow: 0 18px 40px rgba(28, 25, 20, 0.2);
  --glow: 0 16px 30px rgba(15, 138, 124, 0.18);
  --radius-lg: 22px;
  --radius-md: 16px;
}

body {
  font-family: "Space Grotesk", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 10%, rgba(239, 108, 61, 0.18), transparent 45%),
    radial-gradient(circle at 80% 0%, rgba(15, 138, 124, 0.2), transparent 50%),
    linear-gradient(130deg, var(--bg) 0%, var(--bg-deep) 100%);
  min-height: 100vh;
}

body.landing-mode #landing {
  display: block;
}

body.landing-mode #content,
body.landing-mode #overlay {
  display: none !important;
}

.landing {
  display: none;
}

.landing-shell {
  position: relative;
  min-height: 100vh;
  padding: 48px 6vw 72px;
  overflow: hidden;
}

.landing-orbs {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.landing-orbs .orb {
  position: absolute;
  border-radius: 999px;
  opacity: 0.35;
}

.landing-orbs .orb-one {
  width: 220px;
  height: 220px;
  top: -60px;
  right: 12%;
  background: radial-gradient(circle, rgba(15, 138, 124, 0.55), transparent 65%);
}

.landing-orbs .orb-two {
  width: 320px;
  height: 320px;
  bottom: -100px;
  left: 6%;
  background: radial-gradient(circle, rgba(239, 108, 61, 0.45), transparent 70%);
}

.landing-orbs .orb-three {
  width: 200px;
  height: 200px;
  top: 38%;
  right: -60px;
  background: radial-gradient(circle, rgba(31, 36, 48, 0.35), transparent 70%);
}

.landing-hero,
.landing-grid,
.landing-status,
.landing-footer,
.landing-resolution {
  position: relative;
  z-index: 1;
}

.landing-hero {
  max-width: 680px;
  margin-bottom: 32px;
  animation: heroIn 0.7s ease-out both;
}

.landing-eyebrow {
  font-size: 0.68rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.landing-hero h1 {
  font-size: clamp(2rem, 3vw + 1rem, 3.4rem);
  line-height: 1.05;
  margin: 0 0 14px;
}

.landing-lead {
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 520px;
  margin: 0;
}

.landing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.landing-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 18px 20px;
  border-radius: var(--radius-lg);
  background: var(--card);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
  overflow: hidden;
  opacity: 0;
  transform: translateY(18px);
  animation: cardIn 0.6s ease forwards;
  animation-delay: var(--stagger, 0s);
}

.landing-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.35), transparent 45%);
  pointer-events: none;
}

.landing-card-header h3 {
  font-size: 1.15rem;
  margin: 0;
}

.landing-meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.landing-plans {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.plan-button {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--ink);
  color: #ffffff;
  text-decoration: none;
  position: relative;
  overflow: hidden;
  box-shadow: var(--glow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.plan-button-secondary {
  background: var(--accent);
}

.plan-button::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.15), transparent 55%);
  opacity: 0.6;
  pointer-events: none;
}

.plan-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 34px rgba(31, 36, 48, 0.25);
}

.plan-code {
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.plan-year {
  font-size: 0.78rem;
  opacity: 0.75;
}

.landing-status {
  margin-top: 20px;
  color: var(--muted);
}

.landing-footer {
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid var(--stroke);
  color: var(--muted);
  font-size: 0.85rem;
}

.landing-resolution {
  margin-top: 20px;
  display: flex;
  justify-content: center;
}

.landing-resolution-btn {
  padding: 12px 26px;
  box-shadow: var(--glow);
}

/* Shared theme for landing + malla */
body.landing-mode .help-widget {
  display: none;
}

.help-widget {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.help-panel {
  width: min(360px, 92vw);
  max-height: min(70vh, 420px);
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 16px 18px 18px;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.help-panel.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.help-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.help-panel-header h2 {
  font-size: 1.05rem;
  margin: 0;
}

.help-panel-body {
  color: var(--muted);
  font-size: 0.95rem;
}

.help-panel-body p {
  margin: 0 0 10px;
}

.help-panel-body ul {
  margin: 0;
  padding-left: 18px;
}

.help-panel-body li {
  margin-bottom: 6px;
}

.help-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border-radius: 999px;
  padding: 10px 16px;
  box-shadow: var(--shadow);
}

.help-button-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.2);
  font-weight: 700;
}

.help-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: transparent;
  color: var(--ink);
  font-size: 0.85rem;
}

.help-close:hover {
  background: rgba(15, 138, 124, 0.1);
}

.help-button:focus-visible,
.help-close:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

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

body a:hover {
  color: var(--accent-2);
}

#content {
  color: var(--ink);
  background: transparent;
}

#content section.container-fluid {
  padding: 20px 4vw 40px;
}

.navbar.bg-light {
  background: var(--card) !important;
  border-bottom: 1px solid var(--stroke);
  box-shadow: 0 8px 20px rgba(31, 36, 48, 0.08);
  backdrop-filter: blur(10px);
}

.navbar .navbar-brand,
.navbar .nav-link,
.navbar .dropdown-item {
  color: var(--ink) !important;
}

.navbar .nav-link:hover,
.navbar .dropdown-item:hover {
  color: var(--accent-strong) !important;
}

.dropdown-menu {
  background: var(--card);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
}

.dropdown-item:hover {
  background: rgba(15, 138, 124, 0.08);
}

.navbar-toggler {
  border-color: var(--stroke);
}

footer .bg-light {
  background: var(--card) !important;
  border-top: 1px solid var(--stroke);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  padding: 10px 12px;
}

.malla-sidebar {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.malla-sidebar.border-right {
  border-right: none !important;
}

.malla-stage .canvas {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 18px 18px 26px;
}

.malla-stage .canvas svg {
  background: #ffffff;
  border-radius: 0;
  box-shadow: 0 14px 28px rgba(31, 36, 48, 0.16);
}

.btn {
  border-radius: 16px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.btn-landing {
  background: transparent;
  border: 1px solid var(--stroke);
  color: var(--ink);
}

.btn-landing:hover {
  background: rgba(15, 138, 124, 0.12);
  border-color: var(--accent-strong);
  color: var(--accent-strong);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent-strong);
}

.btn-primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.btn-secondary {
  background: var(--ink);
  border-color: var(--ink);
}

.btn-secondary:hover {
  background: #11141c;
  border-color: #11141c;
}

.btn-success {
  background: #1b8a6b;
  border-color: #15745a;
}

.btn-success:hover {
  background: #15745a;
  border-color: #15745a;
}

.btn-info {
  background: var(--accent-2);
  border-color: #d65b2d;
  color: #ffffff;
}

.btn-info:hover {
  background: #d65b2d;
  border-color: #d65b2d;
}

.alert-warning {
  background: rgba(239, 108, 61, 0.12);
  border-color: rgba(239, 108, 61, 0.45);
  color: var(--ink);
}

.alert-warning .alert-heading {
  color: var(--ink) !important;
}

#credit-counter-container {
  background: rgba(31, 36, 48, 0.05);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  color: var(--ink);
}

#credit-counter-container.exceeded {
  background: rgba(220, 53, 69, 0.12);
  color: #b12534;
  border-color: rgba(220, 53, 69, 0.4);
}

@media (min-width: 1200px) {
  .malla-sidebar {
    margin-bottom: 0;
  }
}

@keyframes heroIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@media (max-width: 640px) {
  .landing-shell {
    padding: 40px 5vw 60px;
  }

  .landing-hero {
    margin-bottom: 24px;
  }

  .landing-card {
    padding: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .landing-hero,
  .landing-card {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .plan-button {
    transition: none;
  }
}
