:root {
  --bg-0: #07111d;
  --bg-1: #0c1b2d;
  --panel: rgba(11, 22, 35, 0.90);
  --panel-strong: rgba(15, 28, 46, 0.95);
  --panel-border: rgba(155, 193, 231, 0.18);
  --text: #edf4ff;
  --muted: #a8bacf;
  --muted-2: #7f94ab;
  --accent: #73d8b8;
  --accent-2: #5ea8ff;
  --accent-3: #f1b56a;
  --danger: #ff7f7f;
  --shadow: 0 26px 70px rgba(0, 0, 0, 0.35);
  --radius: 22px;
  --radius-sm: 16px;
  --grid-gap: 24px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Trebuchet MS", "Segoe UI", "Verdana", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(115, 216, 184, 0.16), transparent 25%),
    radial-gradient(circle at top right, rgba(94, 168, 255, 0.16), transparent 24%),
    radial-gradient(circle at 50% 120%, rgba(241, 181, 106, 0.12), transparent 28%),
    linear-gradient(180deg, var(--bg-0), var(--bg-1) 70%, #09111a);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 96px 96px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.9), transparent 92%);
  pointer-events: none;
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 30px 0 48px;
}

.hero {
  max-width: 980px;
  margin-bottom: 24px;
}

.home-hero {
  max-width: 1080px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin-bottom: 14px;
  border-radius: 999px;
  background: rgba(115, 216, 184, 0.13);
  color: #bef4de;
  border: 1px solid rgba(115, 216, 184, 0.26);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.73rem;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 800;
  letter-spacing: -0.03em;
}

h1 {
  font-size: clamp(2.5rem, 5vw, 4.6rem);
  line-height: 0.98;
  margin-bottom: 12px;
}

.hero-copy,
.hero-note,
.section p,
.chart-header p,
.button-hint {
  color: var(--muted);
}

.hero-copy {
  max-width: 860px;
  margin: 0 0 10px;
  font-size: 1.05rem;
  line-height: 1.6;
}

.home-hero .hero-lead {
  color: #ffffff;
  font-size: 1.18rem;
  font-weight: 800;
  line-height: 1.4;
}

.hero-note {
  margin: 0;
  max-width: 860px;
  font-size: 0.95rem;
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(420px, 1.05fr);
  gap: var(--grid-gap);
  align-items: start;
}

.calculator-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.calculator-card {
  position: relative;
  padding: 22px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(17, 31, 50, 0.96), rgba(11, 22, 35, 0.92));
  border: 1px solid rgba(155, 193, 231, 0.16);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.calculator-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(115, 216, 184, 0.08), transparent 36%);
  pointer-events: none;
}

.calculator-card.featured {
  border-color: rgba(115, 216, 184, 0.30);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(115, 216, 184, 0.08);
}

.calculator-card > * {
  position: relative;
  z-index: 1;
}

.calculator-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.calculator-tag {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(115, 216, 184, 0.24);
  background: rgba(115, 216, 184, 0.10);
  color: #c9f8e7;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.calculator-card h2 {
  margin: 0 0 10px;
  font-size: 1.35rem;
  line-height: 1.15;
}

.calculator-card p {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.6;
}

.calculator-points {
  margin: 0 0 18px;
  padding-left: 18px;
  color: #dfe9f5;
}

.calculator-points li {
  margin-bottom: 8px;
}

.calculator-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.calculator-path {
  color: var(--muted-2);
  font-size: 0.82rem;
  font-family: "Consolas", "Courier New", monospace;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.form-panel,
.chart-panel {
  padding: 22px;
}

.chart-panel {
  position: sticky;
  top: 24px;
}

.sections {
  display: grid;
  gap: 16px;
}

.section {
  padding: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 18px;
}

.section h2 {
  font-size: 1.06rem;
  margin-bottom: 6px;
}

.section p {
  margin: 0 0 12px;
  font-size: 0.9rem;
  line-height: 1.5;
}

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

.grid-span-2 {
  grid-column: 1 / -1;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field.switch-field {
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.field label {
  color: #dfe9f5;
  font-size: 0.9rem;
  font-weight: 700;
}

.field input[type="number"] {
  width: 100%;
}

.input-shell {
  display: flex;
  align-items: center;
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  background: rgba(7, 15, 25, 0.75);
  overflow: hidden;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.input-shell:focus-within {
  border-color: rgba(115, 216, 184, 0.68);
  box-shadow: 0 0 0 4px rgba(115, 216, 184, 0.14);
}

.input-prefix {
  display: inline-flex;
  align-items: center;
  align-self: stretch;
  flex: 0 0 auto;
  padding: 0 12px 0 14px;
  color: var(--muted-2);
  font-weight: 700;
  background: rgba(255, 255, 255, 0.02);
  border-right: 1px solid rgba(255, 255, 255, 0.11);
  pointer-events: none;
}

.input-shell input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 12px 12px;
  min-height: 48px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  outline: none;
  transition: none;
}

.input-shell select {
  flex: 1 1 auto;
  min-width: 0;
  padding: 12px 12px;
  padding-right: 38px;
  min-height: 48px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted-2) 50%),
    linear-gradient(135deg, var(--muted-2) 50%, transparent 50%),
    linear-gradient(to right, transparent, transparent);
  background-position:
    calc(100% - 18px) calc(50% - 2px),
    calc(100% - 12px) calc(50% - 2px),
    0 0;
  background-size: 6px 6px, 6px 6px, 100% 100%;
  background-repeat: no-repeat;
  cursor: pointer;
}

.input-shell.has-prefix input {
  padding-left: 12px;
}

.input-shell input:focus {
  box-shadow: none;
}

.input-shell select:focus {
  box-shadow: none;
}

.field input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
  padding: 0;
  background: transparent;
}

.field-help {
  margin: 0;
  color: var(--muted-2);
  font-size: 0.78rem;
  line-height: 1.4;
}

.warning-box {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(241, 181, 106, 0.12);
  border: 1px solid rgba(241, 181, 106, 0.32);
  color: #ffe9c8;
  white-space: pre-wrap;
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 800;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.10);
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.secondary-button:hover {
  transform: translateY(-1px);
  border-color: rgba(115, 216, 184, 0.28);
  background: rgba(255, 255, 255, 0.08);
}

.section-tools {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 12px 0 14px;
}

.section-tools p {
  margin: 0;
  color: var(--muted-2);
  font-size: 0.82rem;
  line-height: 1.45;
}

.dynamic-list {
  display: grid;
  gap: 12px;
}

.dynamic-row {
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

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

.dynamic-row-header strong {
  font-size: 0.92rem;
  letter-spacing: -0.01em;
}

.dynamic-row-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px 14px;
}

.dynamic-row-grid .field {
  min-width: 0;
}

.row-remove-button {
  padding: 9px 14px;
  font-size: 0.84rem;
}

.row-muted {
  margin: 0;
  color: var(--muted-2);
  font-size: 0.8rem;
  line-height: 1.45;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 18px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 800;
  color: #07111d;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 12px 30px rgba(94, 168, 255, 0.22);
  transition: transform 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
}

.primary-button,
.secondary-button {
  text-decoration: none;
}

.primary-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 34px rgba(94, 168, 255, 0.28);
}

.primary-button:disabled {
  opacity: 0.72;
  cursor: wait;
  transform: none;
}

.button-hint {
  font-size: 0.9rem;
}

.error-box {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 127, 127, 0.12);
  border: 1px solid rgba(255, 127, 127, 0.35);
  color: #ffd7d7;
  white-space: pre-wrap;
}

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

.chart-header p {
  margin: 6px 0 0;
  font-size: 0.92rem;
}

.winner-badge {
  padding: 9px 13px;
  border-radius: 999px;
  background: rgba(115, 216, 184, 0.13);
  border: 1px solid rgba(115, 216, 184, 0.28);
  color: #c9f8e7;
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
}

.winner-badge.winner-own {
  background: rgba(255, 127, 127, 0.12);
  border-color: rgba(255, 127, 127, 0.28);
  color: #ffd0d0;
}

.chart-wrap {
  position: relative;
  height: 480px;
  padding: 14px;
  background: rgba(246, 249, 255, 0.98);
  border-radius: 18px;
  overflow: hidden;
}

.summary-card {
  margin-top: 16px;
  padding: 18px;
  background: var(--panel-strong);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 18px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.summary-card h3 {
  margin-bottom: 10px;
}

.summary-card p {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.6;
}

.comparison-table-wrap {
  overflow-x: auto;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.03);
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

.comparison-table thead th {
  padding: 12px 14px;
  text-align: left;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-2);
  background: rgba(255, 255, 255, 0.03);
}

.comparison-table tbody th,
.comparison-table tbody td {
  padding: 12px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-variant-numeric: tabular-nums;
}

.comparison-table tbody th {
  width: 16%;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.82rem;
  color: #dfe9f5;
}

.comparison-table tbody td {
  text-align: right;
  color: var(--text);
}

.comparison-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.015);
}

.comparison-table .positive-value {
  color: #a8f3d4;
}

.comparison-table .negative-value {
  color: #ffb7b7;
}

.table-placeholder {
  padding: 18px 14px;
  text-align: center !important;
  color: var(--muted-2) !important;
}

.comparison-note {
  margin: 12px 0 0;
  color: var(--muted-2);
  font-size: 0.82rem;
  line-height: 1.45;
}

.summary-grid div {
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.budget-table {
  min-width: 420px;
}

.summary-grid dt {
  margin: 0;
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
}

.summary-grid dd {
  margin: 6px 0 0;
  font-size: 1.08rem;
  font-weight: 800;
  color: var(--text);
}

.summary-subsection {
  margin-top: 18px;
}

.summary-subsection h3 {
  margin-bottom: 10px;
}

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

  .chart-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 20px, 1440px);
    padding-top: 20px;
  }

  .form-grid,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .chart-wrap {
    height: 380px;
  }

  .chart-header {
    flex-direction: column;
  }
}
