*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f0f4f8;
  color: #1e293b;
  min-height: 100vh;
  padding: 16px;
}

.container {
  max-width: 640px;
  margin: 0 auto;
}

h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: #1e40af;
  margin-bottom: 4px;
}

.subtitle {
  font-size: 0.875rem;
  color: #64748b;
  margin-bottom: 24px;
}

/* Input section */
.input-section {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  margin-bottom: 24px;
}

.input-group {
  margin-bottom: 16px;
}

.input-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 6px;
}

.input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-wrap input {
  flex: 1;
  padding: 10px 12px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-size: 1rem;
  color: #1e293b;
  transition: border-color 0.2s;
  -moz-appearance: textfield;
}

.input-wrap input::-webkit-outer-spin-button,
.input-wrap input::-webkit-inner-spin-button {
  -webkit-appearance: none;
}

.input-wrap input:focus {
  outline: none;
  border-color: #2563eb;
}

.unit {
  font-size: 0.9rem;
  color: #64748b;
  min-width: 20px;
}

.calc-btn {
  width: 100%;
  padding: 12px;
  background: #2563eb;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 4px;
  transition: background 0.2s;
}

.calc-btn:hover {
  background: #1d4ed8;
}

/* Result section */
.result-section {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.result-section h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1e40af;
  margin-bottom: 16px;
}

.result-cards {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.card {
  background: #fff;
  border-radius: 10px;
  padding: 14px 10px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.card.highlight {
  background: #2563eb;
  color: #fff;
}

.card.accent {
  background: #ecfdf5;
}

.card-label {
  font-size: 0.72rem;
  color: #64748b;
  margin-bottom: 6px;
}

.card.highlight .card-label {
  color: #bfdbfe;
}

.card.accent .card-label {
  color: #059669;
}

.card-value {
  font-size: 1rem;
  font-weight: 700;
  word-break: break-all;
}

.card.accent .card-value {
  color: #059669;
}

/* Chart */
.chart-wrap {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  margin-bottom: 24px;
}

.chart-wrap h3,
.table-wrap h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 12px;
}

canvas {
  width: 100% !important;
  height: auto;
}

/* Table */
.table-wrap {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

th {
  background: #f1f5f9;
  padding: 8px 10px;
  text-align: right;
  color: #475569;
  font-weight: 600;
}

th:first-child { text-align: center; }

td {
  padding: 7px 10px;
  text-align: right;
  border-bottom: 1px solid #f1f5f9;
}

td:first-child { text-align: center; color: #64748b; }

tr:last-child td { border-bottom: none; }

tr:hover td { background: #f8fafc; }

/* Responsive */
@media (max-width: 480px) {
  .result-cards {
    grid-template-columns: 1fr;
  }
  .card-value {
    font-size: 1.1rem;
  }
}
