:root {
  color-scheme: dark;
  --bg-1: #18120d;
  --bg-2: #251a13;
  --bg-3: #3a291d;
  --panel: rgba(48, 34, 24, 0.58);
  --panel-strong: rgba(58, 41, 28, 0.8);
  --line: rgba(255, 255, 255, 0.12);
  --line-soft: rgba(255, 255, 255, 0.06);
  --text: #f4e7d4;
  --text-soft: #d2c0ab;
  --text-muted: #b19d88;
  --gold-1: #efd2ac;
  --gold-2: #ddb786;
  --gold-3: #bc8d58;
  --success-bg: rgba(98, 199, 132, 0.18);
  --success-text: #a8efc0;
  --warn-bg: rgba(235, 198, 88, 0.18);
  --warn-text: #f5d98c;
  --danger-bg: rgba(245, 123, 123, 0.18);
  --danger-text: #ffb0b0;
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 12px 28px rgba(0, 0, 0, 0.18);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: Inter, Arial, sans-serif;
  line-height: 1.55;
  letter-spacing: 0.012em;
  background:
    radial-gradient(circle at 18% 0%, rgba(239, 189, 122, 0.16), transparent 24%),
    radial-gradient(circle at 82% 10%, rgba(194, 140, 84, 0.14), transparent 26%),
    linear-gradient(160deg, rgba(34, 24, 18, 0.84), rgba(60, 43, 29, 0.82)),
    url('/assets/design/texture-dark.jpg') center/520px repeat,
    #1b140f;
  background-attachment: fixed;
}

body::after {
  content: "";
  position: fixed;
  left: 50%;
  bottom: -150px;
  transform: translateX(-50%);
  width: 1000px;
  height: 380px;
  background: radial-gradient(circle, rgba(214, 162, 98, 0.14), transparent 72%);
  pointer-events: none;
  z-index: 0;
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 16px 48px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.02)),
    var(--panel);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow:
    var(--shadow-lg),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  padding: 22px;
  margin-bottom: 20px;
}

.hero {
  position: relative;
  overflow: hidden;
  min-height: 240px;
  padding: 0;
  background: url('/assets/design/calculator-hero.jpg') center/cover no-repeat;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      120deg,
      rgba(24, 16, 11, 0.56),
      rgba(40, 28, 18, 0.46) 55%,
      rgba(88, 61, 34, 0.28)
    );
}

.top {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 34px;
}

.hero-content {
  max-width: 700px;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  color: #f0d8b4;
  font-weight: 650;
}

h1 {
  margin: 0;
  font-size: clamp(32px, 4vw, 44px);
  line-height: 1.08;
  letter-spacing: 0.015em;
}

.hero-subtitle {
  margin-top: 14px;
  max-width: 640px;
  font-size: 17px;
  color: var(--text-soft);
}

h2 {
  margin: 0 0 18px;
  font-size: clamp(24px, 2.3vw, 30px);
  line-height: 1.18;
  letter-spacing: 0.01em;
}

h3 {
  margin: 0 0 10px;
  font-size: 19px;
  letter-spacing: 0.01em;
}

.configurator-panel {
  padding: 26px;
}

.back-link {
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  padding: 10px 15px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  transition: background-color 220ms ease, border-color 220ms ease, color 220ms ease, transform 220ms ease;
}

.back-link:hover {
  transform: translateY(-1px);
  background: rgba(240, 210, 163, 0.1);
  border-color: rgba(240, 210, 163, 0.4);
  color: var(--gold-1);
}

.step {
  display: none;
}

.step.active {
  display: block;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.field label {
  font-size: 14px;
  letter-spacing: 0.01em;
  color: var(--text-soft);
}

.field input,
.field select {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  background: rgba(30, 21, 15, 0.62);
  color: var(--text);
  padding: 13px 14px;
  font: inherit;
  transition: border-color 200ms ease, box-shadow 200ms ease, background-color 200ms ease;
}

.field input::placeholder {
  color: rgba(244, 231, 212, 0.42);
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: rgba(233, 195, 145, 0.62);
  box-shadow: 0 0 0 3px rgba(233, 195, 145, 0.14);
  background: rgba(38, 27, 19, 0.76);
}

.actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

button {
  appearance: none;
  border: none;
  border-radius: 12px;
  padding: 11px 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: transform 220ms ease, box-shadow 220ms ease, filter 220ms ease, background-position 260ms ease, background-color 220ms ease;
}

button:hover {
  transform: translateY(-1px);
}

.btn-primary {
  color: #1d130d;
  background-image: linear-gradient(132deg, #f3dcb4 0%, #d8ad69 48%, #f0cca0 100%);
  background-size: 180% 180%;
  box-shadow: 0 8px 16px rgba(184, 130, 61, 0.22);
}

.btn-primary:hover {
  box-shadow: 0 12px 20px rgba(184, 130, 61, 0.28);
  filter: saturate(1.06);
  background-position: 90% 40%;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--gold-1);
}

.result-box {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.028), rgba(255,255,255,0.016)),
    rgba(58, 41, 28, 0.28);
  margin-bottom: 14px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: var(--shadow-md);
}

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

.result-table th,
.result-table td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}

.result-table th {
  color: #dccab1;
  width: 55%;
  font-weight: 600;
}

.result-table td {
  color: var(--text);
}

.hidden {
  display: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
  text-transform: capitalize;
  font-weight: 600;
}

.badge.comfortable {
  background: var(--success-bg);
  color: var(--success-text);
}

.badge.acceptable {
  background: var(--warn-bg);
  color: var(--warn-text);
}

.badge.too_steep,
.badge.invalid {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.warning {
  color: var(--danger-text);
  margin-bottom: 8px;
  line-height: 1.5;
}

.ok {
  color: var(--success-text);
  line-height: 1.5;
}

.price-main {
  font-size: 38px;
  font-weight: 800;
  color: #f0d7b7;
  margin-bottom: 8px;
}

.muted {
  color: var(--text-muted);
}

#pageStatus {
  margin-top: 8px;
  padding: 0 8px;
  color: var(--text-muted);
}

@media (max-width: 760px) {
  .wrap {
    padding: 20px 14px 36px;
  }

  .panel {
    border-radius: 18px;
    padding: 16px;
    margin-bottom: 16px;
  }

  .hero {
    min-height: unset;
  }

  .top {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 28px 18px;
    gap: 16px;
  }

  .hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .hero-subtitle {
    font-size: 15px;
  }

  .grid {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .actions {
    flex-direction: column;
    gap: 10px;
    margin-top: 18px;
  }

  button,
  .actions .back-link,
  .top .back-link {
    width: 100%;
    text-align: center;
  }

  h2 {
    margin-bottom: 14px;
  }

  .field {
    margin-bottom: 14px;
  }
}