:root {
  color-scheme: dark;
  --bg: #0f172a;
  --bg-top: #111827;
  --bg-bottom: #0b1220;
  --panel: #111c2f;
  --panel-soft: #0f1a2b;
  --text: #e5eefc;
  --muted: #a5b4cf;
  --border: #24324a;
  --accent: #5b8cff;
  --accent-soft: #182846;
  --danger: #f87171;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: linear-gradient(145deg, var(--bg-top) 0%, var(--bg) 52%, var(--bg-bottom) 100%);
}

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

.hero {
  max-width: 760px;
  margin-bottom: 12px;
}

.section-label {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
}

.hero h1,
.results-header h2,
.card-heading h2 {
  margin: 0;
  letter-spacing: -0.05em;
  line-height: 1.05;
}

.hero h1 {
  font-size: clamp(1.8rem, 3.4vw, 2.8rem);
  font-weight: 800;
}

.hero-copy {
  margin: 10px 0 0;
  max-width: 640px;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.55;
}

.tool-layout {
  display: grid;
  grid-template-columns: minmax(320px, 390px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.tool-card,
.results-panel {
  background: rgba(17, 28, 47, 0.9);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.tool-card {
  border-radius: var(--radius-lg);
  padding: 18px;
  position: sticky;
  top: 20px;
}

.results-panel {
  border-radius: var(--radius-lg);
  padding: 18px;
}

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

.descriptor-chip {
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 0.83rem;
  font-weight: 700;
  white-space: nowrap;
  color: var(--accent);
  background: var(--accent-soft);
}

.tool-form {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 9px;
}

.field span {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

input,
select {
  width: 100%;
  height: 58px;
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  color: var(--text);
  padding: 0 14px;
  font: inherit;
  font-size: 0.98rem;
  font-weight: 700;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(49, 95, 159, 0.14);
}

.input-with-unit {
  display: grid;
  grid-template-columns: 1fr 104px;
  gap: 10px;
}

.unit-select {
  text-align: center;
}

.validation-message {
  min-height: 24px;
  margin: 16px 2px 0;
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 600;
}

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

.stat-card {
  display: grid;
  gap: 9px;
  min-height: 82px;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--panel);
}

.stat-card-primary {
  background: var(--panel);
  color: var(--text);
}

.stat-card-primary .stat-label,
.stat-card-primary .stat-hint,
.stat-card-primary .stat-value {
  color: inherit;
}

.stat-label {
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat-value {
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: clamp(1rem, 1.9vw, 1.35rem);
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.stat-hint {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.info-panel {
  margin-top: 14px;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: rgba(17, 28, 47, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.info-panel h3 {
  margin: 0 0 10px;
  font-size: 1.08rem;
  letter-spacing: -0.03em;
}

.info-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

@media (min-width: 1000px) {
  .results-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

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

  .tool-card {
    position: static;
  }
}

@media (max-width: 820px) {
  .page-shell {
    width: min(100% - 20px, 1120px);
    padding: 24px 0;
  }

  .tool-card,
  .results-panel {
    padding: 16px;
    border-radius: 22px;
  }

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

  .results-header,
  .card-heading {
    flex-direction: column;
  }

  .input-with-unit {
    display: grid;
  }

  .descriptor-chip {
    white-space: normal;
  }
}
