:root {
  --bg: #f7f8fc;
  --card: #ffffff;
  --text: #1c2333;
  --muted: #5c667f;
  --accent: #4f46e5;
  --accent-2: #06b6d4;
  --danger: #b00020;
  --border: #dde3f1;
  --shadow: 0 8px 20px rgba(11, 37, 89, 0.08);
  --roi-good: #0f9d58;
  --roi-mid: #2563eb;
  --roi-warn: #d97706;
  --roi-focus: #7c3aed;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: Arial, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #eef3ff 0%, #f7f8fc 44%, #f4f8ff 100%);
}

.container {
  max-width: 1120px;
  margin: 1.25rem auto 2rem;
  padding: 0 1rem;
  display: grid;
  gap: 1rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 1rem;
}

.hero h1 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.hero {
  background: linear-gradient(130deg, #ffffff 0%, #eef7ff 62%, #f7f4ff 100%);
}

.hero p {
  margin: 0.3rem 0;
}

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

h2 {
  margin-top: 0;
}

.layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.layout > .result {
  order: -1;
}

.sticky {
  position: static;
}

.field {
  margin-bottom: 1rem;
  border: none;
  padding: 0;
}

label,
legend {
  font-weight: bold;
  margin-bottom: 0.35rem;
  display: block;
}

select,
button,
input[type="number"] {
  font: inherit;
}

select,
input[type="number"] {
  width: 100%;
  max-width: 420px;
  padding: 0.5rem 0.7rem;
  border-radius: 10px;
  border: 1px solid #bdc8e4;
  background: #fff;
}

.inline-option {
  font-weight: normal;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-right: 1rem;
  margin-bottom: 0.4rem;
}

.team-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 0.45rem;
  margin-top: 0.45rem;
  align-items: end;
}

.team-mode {
  background: linear-gradient(180deg, #fcfeff 0%, #f7fbff 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.55rem 0.6rem;
}

.team-mode label {
  margin-bottom: 0.2rem;
}

.team-mode .inline-option {
  margin-bottom: 0.2rem;
}

.team-fields label {
  font-size: 0.82rem;
}

.team-fields input[type="number"],
.team-fields select {
  max-width: 170px;
  padding: 0.35rem 0.5rem;
  font-size: 0.9rem;
  border-radius: 8px;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 0.6rem;
}

.tool-item {
  border: 1px solid #cbd6ef;
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  background: #fcfdff;
}

.tool-item:has(input:checked) {
  border-color: #8da9ff;
  background: #f1f6ff;
}

.tool-item input {
  margin-top: 0.2rem;
}

.tool-meta {
  font-size: 0.9rem;
  color: var(--muted);
}

.error {
  min-height: 1.2rem;
  color: var(--danger);
  margin-top: 0;
}

.cta {
  border: none;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #fff;
  font-weight: bold;
  padding: 0.65rem 1.1rem;
  cursor: pointer;
}

.cta:hover,
.cta:focus-visible {
  filter: brightness(1.03);
}

.cta-secondary {
  background: #eef4ff;
  color: #23335d;
  border: 1px solid #c8d8ff;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.8rem;
}

.kpi {
  border: 1px solid #cfd9f3;
  border-radius: 10px;
  padding: 0.8rem;
  background: #fbfcff;
}

.kpi h3 {
  font-size: 0.95rem;
  margin: 0 0 0.4rem 0;
}

.kpi p {
  font-size: 1.25rem;
  margin: 0;
  font-weight: bold;
}

.pitch {
  margin-top: 1rem;
  border: 1px dashed #9cb2e6;
  border-radius: 10px;
  padding: 0.8rem;
  background: #f8fbff;
}

.result-badge {
  display: inline-block;
  background: #ebf1ff;
  border: 1px solid #bfd0f8;
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-weight: bold;
  margin-top: 0;
}

.result.roi-good .result-badge {
  background: #e7f7ee;
  border-color: #9dd9b4;
  color: #0d6a3d;
}

.result.roi-mid .result-badge {
  background: #ebf2ff;
  border-color: #bfd0f8;
  color: #1d4ed8;
}

.result.roi-warn .result-badge {
  background: #fff6e8;
  border-color: #f2d29d;
  color: #9a5a05;
}

.result.roi-focus .result-badge {
  background: #f3edff;
  border-color: #d1befd;
  color: #5b21b6;
}

.result.roi-good .pitch {
  border-color: #9dd9b4;
  background: linear-gradient(180deg, #f4fcf7 0%, #f8fbff 100%);
}

.result.roi-mid .pitch {
  border-color: #bfd0f8;
  background: linear-gradient(180deg, #f4f7ff 0%, #f8fbff 100%);
}

.result.roi-warn .pitch {
  border-color: #f2d29d;
  background: linear-gradient(180deg, #fffbf5 0%, #f8fbff 100%);
}

.result.roi-focus .pitch {
  border-color: #d1befd;
  background: linear-gradient(180deg, #faf7ff 0%, #f8fbff 100%);
}

.share-row {
  margin-top: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.site-footer {
  margin-top: 0.1rem;
  padding: 0.75rem 1rem;
}

.site-footer p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--muted);
}

.site-footer a {
  color: #324fb6;
  text-decoration: none;
  border-bottom: 1px dashed #8fa3e8;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  color: #1f3f9a;
}

@media (min-width: 980px) {
  .layout {
    grid-template-columns: 1.12fr 0.88fr;
    align-items: start;
  }

  .layout > .result {
    order: 2;
  }

  .sticky {
    position: sticky;
    top: 1rem;
  }
}

@media (max-width: 620px) {
  html {
    -webkit-text-size-adjust: 100%;
  }

  .hero h1 {
    font-size: 1.4rem;
  }

  .container {
    margin-top: 0.8rem;
    padding: 0 max(0.8rem, env(safe-area-inset-left));
    padding-right: max(0.8rem, env(safe-area-inset-right));
  }

  .card {
    padding: 0.85rem;
    border-radius: 12px;
  }

  .kpis {
    grid-template-columns: 1fr;
    gap: 0.55rem;
  }

  .kpi p {
    font-size: 1.15rem;
  }

  .share-row {
    flex-direction: column;
    align-items: stretch;
  }

  .share-row .cta {
    width: 100%;
    text-align: center;
  }

  .team-fields {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .team-fields input[type="number"],
  .team-fields select {
    max-width: 100%;
  }
}
