:root {
  --bg: #f4efe6;
  --panel: rgba(255, 251, 245, 0.82);
  --panel-strong: #fffaf2;
  --text: #1f2a22;
  --muted: #687264;
  --line: rgba(61, 73, 58, 0.14);
  --accent: #214f43;
  --accent-soft: #dbe9df;
  --accent-2: #c7792f;
  --accent-2-soft: #f9e5d1;
  --shadow: 0 24px 60px rgba(31, 42, 34, 0.12);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(199, 121, 47, 0.18), transparent 30%),
    radial-gradient(circle at top right, rgba(33, 79, 67, 0.18), transparent 34%),
    linear-gradient(180deg, #f8f3eb 0%, #efe7da 100%);
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  z-index: -1;
  border-radius: 999px;
  filter: blur(12px);
  opacity: 0.5;
}

body::before {
  width: 280px;
  height: 280px;
  top: 90px;
  left: -60px;
  background: rgba(199, 121, 47, 0.12);
}

body::after {
  width: 360px;
  height: 360px;
  right: -120px;
  bottom: 60px;
  background: rgba(33, 79, 67, 0.12);
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 32px auto;
}

.hero {
  margin-bottom: 22px;
}

.hero-card,
.panel,
.result-card {
  background: var(--panel);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.hero-card {
  padding: 30px;
}

.hero-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.hero-title {
  margin: 0;
  flex: 1;
  color: var(--text);
  font-size: clamp(2.3rem, 5vw, 4.5rem);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.06em;
}

.language-switch {
  display: grid;
  gap: 8px;
  justify-items: end;
  flex: 0 0 auto;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.language-actions {
  display: inline-flex;
  gap: 8px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(61, 73, 58, 0.12);
}

.language-actions button {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
  transition:
    transform 160ms ease,
    background-color 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.language-actions button:hover {
  transform: translateY(-1px);
  background: rgba(33, 79, 67, 0.08);
}

.language-actions button.active {
  background: linear-gradient(135deg, var(--accent), #2a6355);
  border-color: rgba(33, 79, 67, 0.3);
  box-shadow: 0 10px 20px rgba(33, 79, 67, 0.18);
}

.language-actions button:focus-visible {
  outline: none;
  border-color: rgba(33, 79, 67, 0.42);
  box-shadow: 0 0 0 4px rgba(33, 79, 67, 0.1);
}

.layout {
  display: grid;
  grid-template-columns: 0.94fr 1.06fr;
  gap: 22px;
}

.panel {
  padding: 24px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-head h2 {
  margin: 0;
  font-size: 1.2rem;
  letter-spacing: -0.03em;
}

.section-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.mode-switch {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 8px;
  margin-bottom: 24px;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  border: 1px solid var(--line);
}

.mode-switch button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 12px 16px;
  font: inherit;
  font-weight: 700;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  transition: 180ms ease;
}

.mode-switch button.active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #2a6355);
  box-shadow: 0 10px 24px rgba(33, 79, 67, 0.24);
}

.input-grid,
.card-grid {
  display: grid;
  gap: 18px;
}

.field-card {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.52);
  border: 1px solid var(--line);
}

.field-card.hidden,
.result-card.hidden {
  display: none;
}

.field-card h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.info-tooltip {
  position: relative;
}

.field-label-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.info-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid rgba(33, 79, 67, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--accent);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1;
  cursor: help;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.info-trigger:hover,
.info-trigger:focus-visible {
  outline: none;
  transform: translateY(-1px);
  border-color: rgba(33, 79, 67, 0.36);
  box-shadow: 0 0 0 4px rgba(33, 79, 67, 0.08);
}

.tooltip-bubble {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  z-index: 5;
  width: min(280px, 72vw);
  padding: 12px 14px;
  border-radius: 14px;
  background: #214f43;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.45;
  box-shadow: 0 18px 34px rgba(31, 42, 34, 0.2);
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(6px);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.tooltip-bubble::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  width: 10px;
  height: 10px;
  background: #214f43;
  transform: translateX(-50%) rotate(45deg);
}

.info-tooltip:hover .tooltip-bubble,
.info-tooltip:focus-within .tooltip-bubble {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.field-card p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

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

label {
  display: grid;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 700;
}

label span {
  color: var(--muted);
  font-weight: 600;
}

input {
  width: 100%;
  appearance: none;
  border: 1px solid rgba(61, 73, 58, 0.18);
  border-radius: var(--radius-md);
  padding: 14px 15px;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.88);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

input:focus {
  outline: none;
  border-color: rgba(33, 79, 67, 0.42);
  box-shadow: 0 0 0 4px rgba(33, 79, 67, 0.1);
  transform: translateY(-1px);
}

.result-card {
  padding: 22px;
}

.result-card.soft {
  background: linear-gradient(180deg, rgba(255, 250, 242, 0.86), rgba(255, 255, 255, 0.75));
}

.result-card.strong {
  color: #fff;
  background: linear-gradient(145deg, #193b32, #2a6355 68%, #357865 100%);
}

.result-card.warn {
  color: #fff;
  background: linear-gradient(145deg, #7b4120, #b05c2c 70%, #c67838 100%);
}

.result-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.result-title {
  margin: 0;
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.88;
}

.result-amount {
  margin: 8px 0 0;
  font-size: clamp(2rem, 4vw, 3.1rem);
  line-height: 0.95;
  letter-spacing: -0.06em;
}

.pill {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pill.soft {
  color: var(--accent);
  background: rgba(33, 79, 67, 0.1);
}

.pill.light {
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
}

.breakdown {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 12px;
}

.breakdown li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(61, 73, 58, 0.12);
}

.strong .breakdown li,
.warn .breakdown li {
  border-top-color: rgba(255, 255, 255, 0.16);
}

.breakdown li:first-child {
  padding-top: 0;
  border-top: 0;
}

.breakdown small {
  display: block;
  margin-top: 4px;
  font-size: 0.78rem;
  opacity: 0.74;
}

.spreadsheet-note {
  margin-top: 18px;
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(219, 233, 223, 0.65);
  border: 1px solid rgba(33, 79, 67, 0.14);
  color: var(--accent);
  line-height: 1.55;
}

details {
  margin-top: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.52);
  border: 1px solid var(--line);
  overflow: hidden;
}

summary {
  cursor: pointer;
  padding: 16px 18px;
  font-weight: 800;
}

.details-content {
  padding: 0 18px 18px;
  color: var(--muted);
  line-height: 1.6;
}

.details-content ul {
  margin: 10px 0 0;
  padding-left: 20px;
}

.details-content li + li {
  margin-top: 8px;
}

.assumption-footnote {
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 20px, 1180px);
    margin: 18px auto;
  }

  .hero-card,
  .panel,
  .result-card {
    border-radius: 22px;
  }

  .hero-card {
    padding: 24px;
  }

  .hero-head,
  .section-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .fields,
  .assumption-grid,
  .mode-switch {
    grid-template-columns: 1fr;
  }

  .tooltip-bubble {
    left: 0;
    transform: translateY(6px);
  }

  .tooltip-bubble::before {
    left: 18px;
    transform: rotate(45deg);
  }

  .info-tooltip:hover .tooltip-bubble,
  .info-tooltip:focus-within .tooltip-bubble {
    transform: translateY(0);
  }
}
