:root {
  --bg: #f3efe5;
  --panel: rgba(255, 252, 245, 0.88);
  --ink: #182126;
  --muted: #5f6a6f;
  --accent: #0f766e;
  --accent-strong: #0b4f52;
  --line: rgba(24, 33, 38, 0.12);
  --shadow: 0 22px 60px rgba(24, 33, 38, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Noto Sans TC", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(217, 164, 65, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(15, 118, 110, 0.14), transparent 24%),
    linear-gradient(180deg, #faf6ef 0%, var(--bg) 100%);
}

.page {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.hero,
.results,
.input-grid,
.card-grid,
.section-head {
  display: grid;
  gap: 18px;
}

.toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.lang-switch {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(24, 33, 38, 0.06);
}

.lang-button {
  min-width: 88px;
  padding: 8px 12px;
  background: transparent;
  color: var(--ink);
  border: 1px solid transparent;
  font-size: 0.92rem;
  font-weight: 700;
}

.lang-button:hover {
  transform: none;
  background: rgba(15, 118, 110, 0.1);
}

.lang-button.is-active {
  background: var(--accent);
  color: #fff;
}

.hero {
  grid-template-columns: 2fr 1fr;
  align-items: end;
  margin-bottom: 18px;
}

.hero h1,
.panel h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: 0.02em;
}

.hero h1 {
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 0.95;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.lead,
.section-head p,
.status,
label small {
  color: var(--muted);
}

.lead {
  color: #324047;
}

.credit {
  margin: 10px 0 8px;
  color: #48606a;
  font-size: 0.95rem;
}

.panel {
  background: var(--panel);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 18px;
}

.hero-note {
  padding: 18px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(15, 118, 110, 0.96), rgba(11, 79, 82, 0.96));
  color: #fff;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.hero-note p,
.hero-note strong,
.hero-note span {
  margin: 0;
}

.hero-note p {
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.88);
}

.hero-note strong {
  margin-top: 8px;
  font-size: 1.6rem;
}

.hero-note span {
  color: rgba(255, 255, 255, 0.96);
  margin-top: 8px;
}

.calculator {
  position: relative;
  overflow: hidden;
}

.calculator::after {
  content: "";
  position: absolute;
  inset: auto -60px -70px auto;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(217, 164, 65, 0.16);
  pointer-events: none;
}

.input-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
  gap: 14px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.95rem;
}

input {
  width: 100%;
  padding: 11px 13px;
  border-radius: 14px;
  border: 1px solid var(--line);
  font-size: 0.96rem;
  background: rgba(255, 255, 255, 0.86);
}

label span {
  font-weight: 600;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 999px;
  padding: 11px 16px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  transition: transform 0.18s ease, background 0.18s ease;
}

button:hover {
  transform: translateY(-1px);
  background: var(--accent-strong);
}

button.secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: stretch;
}

.chart-actions {
  margin-top: 18px;
  margin-bottom: 14px;
}

.status {
  margin: 12px 0 0;
  font-size: 0.92rem;
}

.status[data-error="true"] {
  color: #a3312f;
}

.results {
  grid-template-columns: 1.15fr 1.35fr;
  gap: 16px;
}

.card-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  padding: 14px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(15, 118, 110, 0.08), rgba(255, 255, 255, 0.52));
  border: 1px solid rgba(15, 118, 110, 0.12);
  min-height: 98px;
}

.metric span,
th {
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.metric span {
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin: 6px 0 2px;
  font-size: clamp(1rem, 1.8vw, 1.35rem);
  line-height: 1.2;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.table-wrap,
.chart-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.secondary-chart {
  margin-top: 14px;
}

#reference-chart,
#humidity-chart {
  width: 100%;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0.84));
  display: block;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

tbody tr:hover {
  background: rgba(15, 118, 110, 0.04);
}

@media (max-width: 920px) {
  .hero,
  .results,
  .input-grid {
    grid-template-columns: 1fr;
  }

  .hero-note {
    min-height: unset;
  }
}

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

  .panel {
    padding: 16px;
    border-radius: 20px;
  }

  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toolbar {
    justify-content: stretch;
  }

  .lang-switch {
    width: 100%;
  }

  .lang-button {
    flex: 1 1 0;
    min-width: 0;
  }

  .hero h1 {
    line-height: 1;
  }

  .credit,
  .lead,
  .section-head p,
  .status {
    font-size: 0.92rem;
  }

  .input-grid {
    gap: 12px;
  }

  .actions {
    flex-direction: column;
  }

  .actions button,
  .chart-actions button {
    width: 100%;
  }

  th,
  td {
    padding: 9px 10px;
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .page {
    width: calc(100% - 16px);
    padding-top: 16px;
    padding-bottom: 24px;
  }

  .hero,
  .results,
  .section-head,
  .card-grid {
    gap: 12px;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .metric {
    min-height: unset;
    padding: 12px;
  }

  .metric strong {
    font-size: 1.02rem;
  }

  .hero-note strong {
    font-size: 1.35rem;
  }
}
