:root {
  --bg: #ebd5ab;
  --surface: #fffdf7;
  --surface-2: #f3e8ca;
  --text: #1b211a;
  --muted: #628141;
  --accent: #628141;
  --accent-hover: #4e6933;
  --soft: #8bae66;
  --border: rgba(98, 129, 65, 0.28);
  --danger: #a83b35;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Inter", sans-serif;
  background:
    radial-gradient(circle at 12% 10%, rgba(139, 174, 102, 0.22), transparent 30rem),
    radial-gradient(circle at 88% 88%, rgba(98, 129, 65, 0.16), transparent 26rem),
    var(--bg);
}

button,
input {
  font: inherit;
}

.site-header {
  width: 100%;
  background-color: #1b211a;
  border-bottom: 1px solid rgba(139, 174, 102, 0.25);
}

.site-header-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px 20px;
}

.site-logo {
  color: #ebd5ab;
  font-family: "Coustard", serif;
  font-size: 1.8rem;
  font-weight: 900;
  text-decoration: none;
}

.site-logo:hover {
  color: #8bae66;
}

.life-page {
  width: min(100%, 1020px);
  margin: 0 auto;
  padding: 48px 20px 56px;
}

.life-card {
  padding: clamp(26px, 5vw, 48px);
  border: 2px solid var(--border);
  border-radius: 20px;
  background: rgba(255, 253, 247, 0.94);
  box-shadow: 0 22px 55px rgba(27, 33, 26, 0.14);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.13em;
}

h1,
h2,
h3 {
  font-family: "Coustard", serif;
  color: var(--text);
}

h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(2.2rem, 7vw, 4rem);
  line-height: 1.05;
}

.intro {
  max-width: 720px;
  margin: 16px 0 30px;
  color: var(--muted);
  line-height: 1.65;
}

.life-form {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(235, 213, 171, 0.3);
}

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

.field label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

.field input {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 12px;
  outline: none;
  color: var(--text);
  background: var(--surface);
}

.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(98, 129, 65, 0.1);
}

.field-note {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.76rem;
}

.calculate-button {
  width: 100%;
  min-height: 52px;
  margin-top: 18px;
  border: 0;
  border-radius: 12px;
  color: #fffdf7;
  background: var(--accent);
  cursor: pointer;
  font-weight: 800;
}

.calculate-button:hover {
  background: var(--accent-hover);
}

.form-error {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--danger);
  font-size: 0.86rem;
  font-weight: 700;
}

.result {
  display: none;
  margin-top: 34px;
  padding-top: 34px;
  border-top: 2px solid var(--border);
}

.result.visible {
  display: block;
}

.result-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.result-heading h2 {
  margin: 0;
  font-size: clamp(1.8rem, 5vw, 2.7rem);
}

.since-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  text-align: right;
}

.time-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.time-unit {
  min-width: 0;
  padding: 20px 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  text-align: center;
}

.time-unit strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-family: "Coustard", serif;
  font-size: clamp(1.55rem, 4vw, 2.25rem);
  font-weight: 900;
  text-overflow: ellipsis;
}

.time-unit span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.totals {
  margin-top: 28px;
  padding: 22px;
  border-radius: 16px;
  background: #1b211a;
}

.totals h3 {
  margin: 0 0 16px;
  color: #ebd5ab;
  font-size: 1rem;
}

.totals-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.totals-grid div {
  min-width: 0;
}

.totals-grid span {
  display: block;
  overflow: hidden;
  color: #ebd5ab;
  font-weight: 800;
  text-overflow: ellipsis;
}

.totals-grid small {
  color: #8bae66;
}

@media (max-width: 760px) {
  .time-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

@media (max-width: 560px) {
  .life-page {
    padding: 0;
  }

  .life-card {
    min-height: calc(100vh - 73px);
    padding: 30px 18px;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .result-heading {
    align-items: start;
    flex-direction: column;
  }

  .since-label {
    text-align: left;
  }

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

}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b211a;
    --surface: #293027;
    --surface-2: #343d30;
    --text: #ebd5ab;
    --muted: #a9c28e;
    --accent: #8bae66;
    --accent-hover: #9cbe78;
    --soft: #628141;
    --border: rgba(139, 174, 102, 0.3);
    --danger: #dc7770;
  }

  body {
    background:
      radial-gradient(circle at 12% 10%, rgba(139, 174, 102, 0.11), transparent 30rem),
      radial-gradient(circle at 88% 88%, rgba(98, 129, 65, 0.1), transparent 26rem),
      var(--bg);
  }

  .life-card {
    background: rgba(41, 48, 39, 0.96);
  }

  .life-form {
    background: rgba(98, 129, 65, 0.08);
  }

  .calculate-button {
    color: #1b211a;
  }

}
