:root {
  --primary: #bf1922;
  --primary-dark: #99131b;
  --primary-soft: #fdf2f2;

  --heading: #1d2547;
  --text: #3c4657;
  --muted: #535e71;

  --background: #fbf8f3;
  --panel: #ffffff;
  --panel-soft: #f8f4ef;

  --border: #e2ddd5;
  --border-strong: #d4cec5;

  --shadow: 0 12px 32px rgba(29, 37, 71, 0.08);

  --radius: 18px;
  --radius-small: 12px;

  --space-small: 12px;
  --space-medium: 20px;
  --space-large: 32px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: "Inter", Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

.app {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 32px;
}

/* Header */

.app-header {
  margin-bottom: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 22px;
}

.logo {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
}

.logo img {
  display: block;
  width: auto;
  height: 76px;
  max-width: 100%;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  color: var(--heading);
  font-family: "Manrope", Arial, Helvetica, sans-serif;
}

h1 {
  margin-bottom: 6px;
  font-size: clamp(2rem, 3vw, 2.65rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.035em;
}

h2 {
  margin-bottom: 8px;
  font-size: 1.4rem;
  font-weight: 750;
  line-height: 1.2;
}

h3 {
  margin-bottom: 16px;
  font-size: 1.05rem;
  font-weight: 750;
  line-height: 1.3;
}

p {
  margin-bottom: 0;
  color: var(--muted);
}

/* Main layout */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(350px, 0.75fr);
  gap: 24px;
  align-items: start;
}

.panel {
  min-width: 0;
  padding: var(--space-large);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.calculator-panel {
  display: grid;
  gap: 26px;
}

.panel-header {
  margin-bottom: 20px;
}

.panel-header p {
  max-width: 720px;
}

/* Calculator sections */

.camera-configuration,
.calculation-settings,
.system-options {
  min-width: 0;
}

.calculation-settings,
.system-options {
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 20px;
}

.full-width {
  grid-column: 1 / -1;
}

/* Form labels and controls */

label {
  display: grid;
  gap: 8px;
  min-width: 0;
  color: var(--heading);
  font-size: 0.84rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-width: 0;
  padding: 12px 13px;
  color: var(--text);
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  outline: none;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background-color 0.15s ease;
}

input:hover,
select:hover {
  border-color: #bdb6ad;
}

input:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(191, 25, 34, 0.14);
}

input[type="number"] {
  appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  margin: 0;
}

/* Range and number input pairs */

.slider-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 12px;
  align-items: center;
}

.slider-row input[type="number"] {
  text-align: center;
}

input[type="range"] {
  width: 100%;
  height: 22px;
  margin: 0;
  padding: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  background: #d9d5cf;
  border-radius: 999px;
}

input[type="range"]::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  margin-top: -6px;
  appearance: none;
  background: var(--primary);
  border: 3px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(29, 37, 71, 0.25);
}

input[type="range"]:focus::-webkit-slider-thumb {
  box-shadow:
    0 0 0 3px rgba(191, 25, 34, 0.16),
    0 1px 4px rgba(29, 37, 71, 0.25);
}

input[type="range"]::-moz-range-track {
  height: 6px;
  background: #d9d5cf;
  border: 0;
  border-radius: 999px;
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: var(--primary);
  border: 3px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(29, 37, 71, 0.25);
}

input[type="range"]:focus::-moz-range-thumb {
  box-shadow:
    0 0 0 3px rgba(191, 25, 34, 0.16),
    0 1px 4px rgba(29, 37, 71, 0.25);
}

/* Optional input unit wrapper */

.input-with-unit {
  position: relative;
}

.input-with-unit span {
  position: absolute;
  top: 50%;
  right: 13px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  pointer-events: none;
  transform: translateY(-50%);
}

.input-with-unit:has(span) input {
  padding-right: 54px;
}

/* Scene complexity help */

.scene-complexity-help {
  display: grid;
  gap: 6px;
  padding: 16px 18px;
  color: var(--text);
  background: var(--panel-soft);
  border-left: 4px solid var(--primary);
  border-radius: 0 var(--radius-small) var(--radius-small) 0;
  font-size: 0.86rem;
  line-height: 1.55;
}

.scene-complexity-help strong {
  color: var(--heading);
  font-family: "Manrope", Arial, Helvetica, sans-serif;
  font-size: 0.95rem;
}

.scene-complexity-help span {
  display: block;
  color: var(--muted);
}

/* Results */

.results-panel {
  position: sticky;
  top: 24px;
}

.results-panel > h2 {
  margin-bottom: 18px;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.result-card,
.summary-card {
  min-width: 0;
  padding: 18px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
}

.result-card {
  background: #fffdfb;
}

.result-card .icon {
  display: inline-flex;
  width: 36px;
  height: 36px;
  margin-bottom: 13px;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 50%;
  font-weight: 700;
}

.result-card p {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.result-card strong {
  display: block;
  overflow-wrap: anywhere;
  color: var(--heading);
  font-family: "Manrope", Arial, Helvetica, sans-serif;
  font-size: clamp(1.35rem, 2vw, 1.85rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.035em;
}

.summary-card {
  margin-top: 16px;
  background: #fffdfb;
}

.summary-card h3 {
  margin-bottom: 14px;
}

dl {
  display: grid;
  gap: 0;
  margin: 0;
}

dl div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}

dl div:first-child {
  padding-top: 0;
}

dl div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

dt {
  color: var(--muted);
  font-size: 0.86rem;
}

dd {
  margin: 0;
  color: var(--heading);
  font-size: 0.86rem;
  font-weight: 750;
  text-align: right;
}

/* Buttons retained for reuse across other tools */

.btn {
  min-height: 42px;
  padding: 10px 16px;
  color: var(--heading);
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    transform 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  color: #ffffff;
  background: var(--primary);
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-secondary {
  color: var(--primary);
  background: #ffffff;
  border-color: var(--primary);
}

.btn-secondary:hover {
  background: var(--primary-soft);
}

.btn-muted {
  color: var(--text);
  background: var(--panel-soft);
  border-color: var(--border);
}

/* Tablet */

@media (max-width: 1040px) {
  .app {
    padding: 24px;
  }

  .layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .results-panel {
    position: static;
    order: -1;
  }

  .panel {
    padding: 26px;
  }
}

.results-branding {
  margin-top: 20px;
  padding: 16px;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
}

.results-branding img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  object-fit: contain;
}

.recommendation-helper {
  margin-top: 14px;
  padding-top: 14px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  line-height: 1.5;
}

/* Mobile */

@media (max-width: 680px) {
  .app {
    padding: 16px;
  }

  .brand {
    align-items: flex-start;
    flex-direction: column;
    gap: 16px;
  }

  .logo img {
    height: 62px;
  }


  h1 {
    font-size: 2rem;
  }

  .panel {
    padding: 20px;
    border-radius: 14px;
  }

  .form-grid,
  .result-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .slider-row {
    grid-template-columns: minmax(0, 1fr) 82px;
  }

  dl div {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  dd {
    text-align: left;
  }
}