:root {
  color-scheme: light;
  --ink: #1f2a28;
  --muted: #626b6a;
  --line: #dcdedc;
  --surface: #ffffff;
  --page: #ffffff;
  --brand: #5a1f5f;
  --brand-strong: #421346;
  --brand-soft: #7b4a80;
  --danger: #9f2d2d;
  --danger-bg: #fff1ef;
  --focus: #5d8fbd;
  --shadow: 0 18px 45px rgba(35, 35, 35, 0.11);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

.calculator-shell {
  min-height: 100vh;
  padding: 24px;
}

.workspace {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

h1,
h2 {
  margin: 0;
  line-height: 1.1;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.3rem);
}

h2 {
  font-size: 1.15rem;
}

.panel-title {
  color: var(--ink);
  font-size: 1.15rem;
  font-weight: 800;
}

.tool-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(360px, 1.05fr);
  gap: 18px;
  align-items: start;
}

.input-panel,
.results-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.input-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 20px;
}

.field-group {
  min-width: 0;
}

.span-2 {
  grid-column: span 2;
}

label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

select,
input {
  width: 100%;
  min-height: 46px;
  border: 1px solid #cbd5d0;
  border-radius: 6px;
  background: #fbfcfb;
  color: var(--ink);
  padding: 0 12px;
}

select:focus,
input:focus,
button:focus-visible {
  outline: 3px solid rgba(36, 111, 203, 0.22);
  outline-offset: 2px;
  border-color: var(--focus);
}

.actions {
  display: flex;
  justify-content: flex-end;
}

button {
  min-height: 46px;
  border: 0;
  border-radius: 6px;
  background: var(--brand);
  color: #ffffff;
  padding: 0 20px;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  background: var(--brand-strong);
}

.results-panel {
  min-height: 100%;
  padding: 20px;
}

.results-art-slot {
  display: none;
  width: 112px;
  height: 62px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}

.alert {
  margin-top: 16px;
  border: 1px solid #e1b5ad;
  border-radius: 6px;
  background: var(--danger-bg);
  color: var(--danger);
  padding: 12px;
  font-weight: 700;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 0;
}

.metric {
  min-height: 118px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 15px;
  background: #fbfcfb;
}

.metric dt {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.metric dd {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  font-weight: 800;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

@media (max-width: 860px) {
  .calculator-shell {
    padding: 16px;
  }

  .tool-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .results-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .input-panel,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: span 1;
  }

  .actions {
    justify-content: stretch;
  }

  button {
    width: 100%;
  }
}
