:root {
  --bg: #0c0f14;
  --bg-elevated: #141a24;
  --bg-input: #0e131c;
  --border: rgba(94, 234, 212, 0.12);
  --accent: #5eead4;
  --accent-dim: rgba(94, 234, 212, 0.55);
  --text: #e8edf5;
  --text-muted: #8b98ab;
  --danger: #f87171;
  --font-sans: "DM Sans", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", ui-monospace, monospace;
  --radius: 12px;
  --shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(ellipse 120% 80% at 50% -20%, rgba(94, 234, 212, 0.08), transparent),
    radial-gradient(ellipse 80% 50% at 100% 50%, rgba(56, 189, 248, 0.06), transparent),
    var(--bg);
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

header.hero {
  text-align: center;
  margin-bottom: 2.25rem;
}

header.hero h1 {
  margin: 0 0 0.35rem;
  font-weight: 700;
  font-size: clamp(1.65rem, 4vw, 2.15rem);
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #f0fdfa 0%, var(--accent) 55%, #38bdf8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

header.hero p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem 1.35rem 1.15rem;
  box-shadow: var(--shadow);
}

.panel + .panel {
  margin-top: 1.25rem;
}

.field-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-dim);
  margin-bottom: 0.45rem;
}

.field-label-spaced {
  margin-top: 1rem;
}

.calc-row {
  display: grid;
  grid-template-columns: 1fr minmax(100px, 120px);
  gap: 0.75rem 1rem;
  align-items: end;
  margin-top: 1rem;
}

.calc-row:first-of-type {
  margin-top: 0;
}

@media (max-width: 520px) {
  .calc-row {
    grid-template-columns: 1fr;
  }
}

.num-input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--text);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.num-input:focus {
  outline: none;
  border-color: rgba(94, 234, 212, 0.45);
  box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.12);
}

.num-input::placeholder {
  color: var(--text-muted);
  opacity: 0.65;
}

.unit-select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--text);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235eead4' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  padding-right: 2rem;
}

.unit-select:focus {
  outline: none;
  border-color: rgba(94, 234, 212, 0.45);
}

.unit-static {
  display: flex;
  align-items: center;
  min-height: 2.45rem;
  padding: 0 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--accent-dim);
  background: rgba(14, 19, 28, 0.55);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.toolbar {
  margin-top: 1.35rem;
}

.btn-calc {
  padding: 0.65rem 1.35rem;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  color: #042f2e;
  background: linear-gradient(135deg, #5eead4 0%, #2dd4bf 50%, #22d3ee 100%);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(45, 212, 191, 0.35);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.btn-calc:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(45, 212, 191, 0.4);
}

.btn-calc:active {
  transform: translateY(0);
}

.hint {
  margin: 0.85rem 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.error-msg {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  color: var(--danger);
}

.result-box {
  margin-top: 0.75rem;
  padding: 1rem 1.1rem;
  font-family: var(--font-mono);
  font-size: 0.92rem;
  color: var(--accent);
  background: rgba(94, 234, 212, 0.06);
  border: 1px solid rgba(94, 234, 212, 0.2);
  border-radius: 10px;
}

.result-box p {
  margin: 0;
}

.result-box .sub {
  margin-top: 0.45rem;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--text-muted);
}

footer.note {
  margin-top: 2rem;
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--text-muted);
}

footer.note code {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--accent-dim);
}
