:root {
  --primary: #2e7d32;
  --primary-light: #43a047;
  --primary-soft: rgba(76, 175, 80, 0.12);
  --background: #f0fdf4;
  --card-bg: #ffffff;
  --text-main: #101827;
  --muted: #6b7280;
  --border-radius-lg: 18px;
  --shadow-soft: 0 12px 30px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  min-height: 100vh;
  background: radial-gradient(circle at top, #bbf7d0 0, #f0fdf4 45%, #e0f2f1 100%);
  color: var(--text-main);
  line-height: 1.6;
  padding: 20px 16px 32px;
  overflow-x: hidden;
  animation: bgFloat 18s ease-in-out infinite alternate;
}

@keyframes bgFloat {
  0% { background-position: 0 0; }
  100% { background-position: 0 40px; }
}

.container {
  max-width: 980px;
  margin: 0 auto;
  animation: fadeInPage 0.5s ease-out;
}

@keyframes fadeInPage {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

header {
  margin-bottom: 20px;
  text-align: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(34, 197, 94, 0.1);
  color: #166534;
  margin-bottom: 10px;
  animation: badgePulse 2.4s ease-in-out infinite;
}

@keyframes badgePulse {
  0%, 100% {
    transform: translateY(0);
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.3);
  }
  50% {
    transform: translateY(-1px);
    box-shadow: 0 0 0 7px rgba(34, 197, 94, 0);
  }
}

header h1 {
  color: var(--primary);
  margin-bottom: 6px;
  font-size: 1.9rem;
}

.subtitle {
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 640px;
  margin: 0 auto;
}

/* Layout */
main.grid-layout {
  display: grid;
  gap: 20px;
  margin-top: 22px;
  align-items: flex-start;
}

@media (min-width: 900px) {
  main.grid-layout {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  }
}

.card {
  background: var(--card-bg);
  border-radius: 24px;
  box-shadow: var(--shadow-soft);
  padding: 24px 22px 26px;
  position: relative;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.16);
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(34, 197, 94, 0.08), transparent 55%);
  opacity: 0.9;
  pointer-events: none;
}

.card-inner {
  position: relative;
  z-index: 1;
}

h2 {
  color: var(--primary);
  margin-top: 10px;
  margin-bottom: 8px;
  font-size: 1.35rem;
}

h3 {
  color: var(--primary);
  margin-top: 22px;
  margin-bottom: 10px;
  font-size: 1.05rem;
}

/* Selector */
.selector-row {
  margin-bottom: 18px;
}

.selector-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 0.9rem;
}

.selector-label small {
  color: var(--muted);
  font-size: 0.82rem;
}

select {
  width: 100%;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  padding: 10px 14px;
  font-size: 0.95rem;
  background: #f9fafb;
  min-height: 44px;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #4b5563 50%),
                    linear-gradient(135deg, #4b5563 50%, transparent 50%);
  background-position: calc(100% - 18px) 16px, calc(100% - 13px) 16px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 32px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease,
              background-color 0.18s ease, transform 0.12s ease;
}

select:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25);
  background-color: #fff;
  outline: none;
  transform: translateY(-1px);
}

/* Form */
form {
  display: grid;
  gap: 14px;
  margin-bottom: 12px;
  margin-top: 6px;
}

label {
  font-size: 0.9rem;
  font-weight: 500;
  color: #111827;
}

.required::after {
  content: " *";
  color: #dc2626;
  font-weight: 600;
}

input[type="number"],
input[type="date"] {
  width: 100%;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  padding: 11px 14px;
  font-size: 0.95rem;
  background: #f9fafb;
  min-height: 44px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease,
              background-color 0.18s ease, transform 0.1s ease;
}

input[type="number"]:focus,
input[type="date"]:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25);
  background: #fff;
  outline: none;
  transform: translateY(-1px);
}

.inline-row {
  display: flex;
  gap: 10px;
}

.inline-row > * {
  flex: 1;
}

@media (max-width: 600px) {
  .inline-row {
    flex-direction: column;
  }
}

.helper {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: -4px;
}

/* Radios */
.radio-row {
  display: flex;
  gap: 16px;
  font-size: 0.9rem;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.radio-row label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 999px;
  background: #f3f4f6;
  transition: background 0.18s ease, transform 0.15s ease, box-shadow 0.18s ease;
  box-shadow: 0 0 0 rgba(15, 23, 42, 0.05);
}

.radio-row input {
  accent-color: var(--primary);
}

.radio-row label:hover {
  background: #e5e7eb;
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.12);
}

button {
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 12px 14px;
  font-size: 0.98rem;
  font-weight: 600;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  color: #fff;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(22, 163, 74, 0.35);
  transition: transform 0.16s ease, box-shadow 0.18s ease, opacity 0.12s ease;
  min-height: 46px;
  margin-top: 4px;
  position: relative;
  overflow: hidden;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(22, 163, 74, 0.4);
  opacity: 0.96;
}

button:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 8px 16px rgba(22, 163, 74, 0.28);
  opacity: 0.9;
}

/* Water droplet effect */
.droplet {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 20%, #e0f7fa 0, #0284c7 60%, #0369a1 100%);
  opacity: 0.9;
  pointer-events: none;
  animation: dropletFloat 900ms ease-out forwards;
}

@keyframes dropletFloat {
  0% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  60% {
    transform: translateY(-18px) scale(1.4);
    opacity: 0.95;
  }
  100% {
    transform: translateY(-28px) scale(0.7);
    opacity: 0;
  }
}

/* Results */
.result-card {
  margin-top: 14px;
  background: linear-gradient(135deg, #e8f5e9, #f5fdf7);
  border-radius: var(--border-radius-lg);
  padding: 12px 14px;
  border: 1px solid rgba(34, 197, 94, 0.22);
  position: relative;
  overflow: hidden;
  transform-origin: top left;
  transform: scale(0.97);
  opacity: 0;
}

.result-card.show {
  animation: popIn 0.22s ease-out forwards;
}

.result-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(34, 197, 94, 0.12), transparent);
  opacity: 0;
  transform: translateX(-40%);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.result-card.show::before {
  opacity: 1;
  transform: translateX(0);
}

@keyframes popIn {
  from {
    transform: scale(0.96) translateY(4px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.result-main {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--primary);
}

.result-sub {
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 3px;
}

.result-list {
  margin-top: 6px;
  font-size: 0.9rem;
}

.result-list ul {
  margin-left: 18px;
  margin-top: 6px;
}

/* Sections toggle */
.calc-section {
  display: none;
  animation: fadeInSection 0.22s ease-out;
}

.calc-section.active {
  display: block;
}

@keyframes fadeInSection {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.wrapper-section {
  display: none;
  margin-bottom: 32px;
  background: var(--card-bg);
  border-radius: 24px;
  padding: 20px 20px 22px;
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
}

.wrapper-section::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top left, rgba(34, 197, 94, 0.12), transparent 55%);
  opacity: 0.9;
  pointer-events: none;
}

.wrapper-inner {
  position: relative;
  z-index: 1;
}

.wrapper-section.active {
  display: block;
  animation: fadeInSection 0.22s ease-out;
}

.wrapper-section p {
  margin-bottom: 12px;
  font-size: 0.94rem;
}

ul {
  margin-left: 18px;
  margin-bottom: 14px;
  font-size: 0.93rem;
}

.note {
  background: var(--primary-soft);
  padding: 10px 12px;
  border-left: 4px solid var(--primary-light);
  margin-bottom: 16px;
  border-radius: 12px;
  font-size: 0.9rem;
}

em {
  font-size: 0.86rem;
  color: var(--muted);
}

.footer-note {
  margin-top: 20px;
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
}
