 :root {
  --bg: #fffaf7;
  --bg-soft: #fffdfb;
  --panel: #ffffff;
  --panel-tint: #fff7f9;
  --text: #544b63;
  --text-strong: #3f3650;
  --muted: #8f87a1;
  --line: #eadfee;
  --line-strong: #dccce5;
  --gas: #9bd9be;
  --hyb: #a9c9f0;
  --ev: #f2a9c9;
  --aging: #f5b48c;
  --battery: #f4d693;
  --depreciation: #c7b5f4;
  --warn-bg: #fff1e8;
  --warn-border: #f2b38f;
  --warn-text: #8f5d42;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(circle at top left, #ffeef6 0%, transparent 35%),
    radial-gradient(circle at top right, #eef7ff 0%, transparent 30%),
    linear-gradient(180deg, #fffdfb 0%, #fff7f9 100%);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px;
}

/* Header */
header {
  margin-bottom: 28px;
}

.header-top {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.lang-toggle {
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text-strong);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
  box-shadow: 0 10px 24px rgba(228, 204, 223, 0.18);
}

.lang-toggle:hover {
  transform: translateY(-1px);
  border-color: #d6bfd8;
  background: #ffffff;
  box-shadow: 0 14px 28px rgba(228, 204, 223, 0.28);
}

.lang-toggle:focus-visible {
  outline: none;
  border-color: #a9c9f0;
  box-shadow: 0 0 0 4px rgba(169, 201, 240, 0.22);
}

header h1,
header .subtitle {
  text-align: center;
}

header h1 {
  font-size: 1.8rem;
  color: var(--text-strong);
  margin-bottom: 6px;
}

header .subtitle {
  color: var(--muted);
  font-size: 0.95rem;
}

/* Section Titles */
h2 {
  font-size: 1.1rem;
  color: var(--text-strong);
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.page-section {
  margin-bottom: 22px;
}

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

.section-heading h2 {
  margin-bottom: 4px;
}

.section-heading p {
  color: var(--muted);
  font-size: 0.88rem;
}

.vehicle-section {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 18px 36px rgba(230, 214, 226, 0.16);
  overflow: hidden;
}

.vehicle-section > summary {
  list-style: none;
  cursor: pointer;
  padding: 18px 20px 8px;
}

.vehicle-section > summary::-webkit-details-marker {
  display: none;
}

.collapsible-heading {
  margin-bottom: 0;
}

.collapse-hint {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #b19ab5;
  font-size: 0.82rem;
  white-space: nowrap;
  padding-top: 6px;
}

.collapse-arrow {
  display: inline-block;
  font-size: 0.9rem;
  transition: transform 0.2s ease;
}

.vehicle-section:not([open]) .collapse-arrow {
  transform: rotate(-90deg);
}

.vehicle-section[open] .car-types {
  padding: 0 16px 16px;
  margin-bottom: 0;
}

/* Shared Parameters */
.shared-params {
  background: rgba(255, 255, 255, 0.8);
  border-radius: 18px;
  padding: 18px 20px;
  margin-bottom: 20px;
  border: 1px solid var(--line);
  box-shadow: 0 18px 40px rgba(228, 204, 223, 0.22);
}

.validation-banner {
  display: none;
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid var(--warn-border);
  border-radius: 8px;
  background: var(--warn-bg);
  color: var(--warn-text);
  font-size: 0.85rem;
  line-height: 1.5;
}

.validation-banner.visible {
  display: block;
}

.input-error {
  border-color: var(--warn-border) !important;
  box-shadow: 0 0 0 3px rgba(242, 179, 143, 0.2);
}

.param-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.param-row .param-group {
  flex: 1;
  min-width: 160px;
}

/* Car Types - Three Columns */
.car-types {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.car-column {
  flex: 1;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-top: 6px solid transparent;
  box-shadow: 0 18px 36px rgba(230, 214, 226, 0.2);
}

.car-column.gasoline { border-top-color: var(--gas); background: linear-gradient(180deg, #fcfff7 0%, #ffffff 24%); }
.car-column.hybrid { border-top-color: var(--hyb); background: linear-gradient(180deg, #f8fbff 0%, #ffffff 24%); }
.car-column.ev { border-top-color: var(--ev); background: linear-gradient(180deg, #fff8fc 0%, #ffffff 24%); }

.car-header {
  text-align: center;
  margin-bottom: 14px;
}

.car-icon {
  font-size: 1.6rem;
  display: block;
  margin-bottom: 2px;
}

.car-header h3 {
  font-size: 1.05rem;
}

.gasoline .car-header h3 { color: #69b994; }
.hybrid .car-header h3 { color: #7eaee3; }
.ev .car-header h3 { color: #d977a9; }

/* Param Groups */
.param-group {
  margin-bottom: 10px;
}

.param-group label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 3px;
}

.field-note {
  margin-top: 4px;
  font-size: 0.72rem;
  color: #a59cb4;
  line-height: 1.4;
}

.param-group input {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 7px 10px;
  color: var(--text-strong);
  font-size: 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}

.param-group input:focus {
  outline: none;
  border-color: var(--hyb);
  box-shadow: 0 0 0 4px rgba(169, 201, 240, 0.2);
  background: #ffffff;
}

.param-group input::-webkit-inner-spin-button {
  opacity: 0.5;
}

/* Param Sections (aging, battery, depreciation) */
.param-section {
  margin-top: 10px;
}

.section-title {
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 8px;
  padding-top: 10px;
  border-top: 1px dashed var(--line-strong);
}

.aging-title { color: #dd8e66; }
.battery-title { color: #c7a14b; }
.depreciation-title { color: #8d77d9; }

.battery-trigger-info {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.4;
}

/* Charts */
.charts {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}

.charts-single .chart-wrapper {
  width: 100%;
}

.chart-wrapper {
  flex: 1;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  box-shadow: 0 18px 36px rgba(230, 214, 226, 0.18);
}

.chart-wrapper h3 {
  font-size: 0.95rem;
  color: var(--text-strong);
  text-align: center;
  margin-bottom: 10px;
}

.chart-wrapper canvas {
  width: 100% !important;
  max-height: 320px;
}

/* Summary */
.summary {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 18px;
  padding: 20px;
  margin-bottom: 16px;
  text-align: center;
  border: 1px solid var(--line);
  box-shadow: 0 18px 36px rgba(230, 214, 226, 0.16);
}

.summary-cards {
  display: flex;
  justify-content: center;
  gap: 28px;
  margin-bottom: 12px;
}

.summary-card {
  text-align: center;
}

.summary-card .cost {
  font-size: 1.6rem;
  font-weight: 700;
}

.summary-card .car-label {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 2px;
}

.summary-card .cost-detail {
  font-size: 0.7rem;
  color: #9b92aa;
  margin-top: 2px;
}

.summary-card.gasoline .cost { color: #69b994; }
.summary-card.hybrid .cost { color: #7eaee3; }
.summary-card.ev .cost { color: #d977a9; }

.summary-best {
  font-size: 0.9rem;
  color: #69b994;
  margin-top: 8px;
}

/* Battery Warning */
.battery-warning {
  background: #fff8ea;
  border: 1px solid #f2d48b;
  border-radius: 16px;
  padding: 16px 20px;
  margin-bottom: 16px;
  display: none;
  box-shadow: 0 14px 30px rgba(242, 212, 139, 0.18);
}

.battery-warning.visible {
  display: block;
}

.battery-warning-title {
  color: #b88b2d;
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.battery-warning-text {
  color: #8b7351;
  font-size: 0.85rem;
  line-height: 1.6;
}

/* Battery Toggle */
.battery-toggle {
  text-align: center;
  margin-bottom: 24px;
}

.battery-toggle-inline {
  text-align: left;
  margin-bottom: 12px;
}

.battery-toggle-section {
  margin-bottom: 16px;
}

.battery-toggle label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--text);
  cursor: pointer;
  background: #fffafc;
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.battery-toggle label:hover {
  border-color: #f0c9dd;
  box-shadow: 0 8px 20px rgba(240, 201, 221, 0.22);
  transform: translateY(-1px);
}

.battery-toggle input[type="checkbox"] {
  accent-color: #d977a9;
  width: 16px;
  height: 16px;
}

/* Responsive */
@media (max-width: 768px) {
  .header-top {
    justify-content: center;
  }

  .section-heading {
    flex-direction: column;
  }

  .car-types {
    flex-direction: column;
  }

  .charts {
    flex-direction: column;
  }

  .param-row {
    flex-direction: column;
  }

  .summary-cards {
    flex-direction: column;
    align-items: center;
    gap: 16px;
  }

  header h1 {
    font-size: 1.4rem;
  }
}
