:root {
  --bg: #130d11;
  --bg-2: #2a1014;
  --panel: rgba(28, 18, 20, 0.9);
  --panel-2: rgba(41, 24, 27, 0.9);
  --line: rgba(255, 255, 255, 0.1);
  --text: #f5ece4;
  --muted: #dfc4b2;
  --accent: #ff4f2f;
  --accent-2: #ff9f43;
  --good: #ffbe5c;
  --shadow: 0 14px 30px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background: radial-gradient(circle at 18% -10%, #8c2e1f 0%, transparent 42%),
    radial-gradient(circle at 100% 0%, #4f1a21 0%, transparent 34%),
    linear-gradient(140deg, var(--bg), var(--bg-2));
  font-family: "Barlow Condensed", sans-serif;
  min-height: 100vh;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: url("assets/dragon-valley-banner.png") center 18% / min(1200px, 95vw) auto no-repeat;
  opacity: 0.14;
  pointer-events: none;
  filter: saturate(1.05) contrast(1.05);
  z-index: -2;
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
  mask-image: radial-gradient(circle at center, black 35%, transparent 95%);
  z-index: -1;
}

.hero {
  padding: 2.2rem 1rem 1rem;
  text-align: center;
}

.eyebrow {
  margin: 0;
  letter-spacing: 0.18rem;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}

h1,
h2 {
  font-family: "Bebas Neue", sans-serif;
  letter-spacing: 0.06rem;
  margin: 0;
}

h1 {
  font-size: clamp(2.2rem, 6vw, 4rem);
  line-height: 1;
}

.subtitle {
  margin: 0.35rem auto 0;
  color: var(--muted);
  max-width: 800px;
  font-size: 1.25rem;
}

.layout {
  width: min(1200px, 96vw);
  margin: 0 auto 2rem;
  display: grid;
  gap: 1rem;
  grid-template-columns: 1.45fr 1fr;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.panel-head {
  padding: 1rem 1rem 0.6rem;
  border-bottom: 1px solid var(--line);
}

.panel-head p {
  margin: 0.2rem 0 0;
  color: var(--muted);
}

.toolbar {
  display: grid;
  grid-template-columns: max-content minmax(240px, 1fr) 190px;
  gap: 0.5rem;
  padding: 0.9rem 1rem 0.2rem;
  align-items: center;
}

.catalog-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.22rem;
  padding: 0.2rem;
  border: 1px solid rgba(255, 159, 67, 0.28);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.38), rgba(33, 13, 16, 0.55));
  width: fit-content;
}

.catalog-switch-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 10px;
  padding: 0.38rem 0.5rem;
  font: inherit;
  font-weight: 600;
  font-size: 0.86rem;
  line-height: 1.1;
  white-space: nowrap;
  text-align: center;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease, transform 0.12s ease;
}

.catalog-switch-btn:hover {
  border-color: rgba(255, 159, 67, 0.42);
  color: #ffe2cb;
}

.catalog-switch-btn.is-active {
  border-color: rgba(255, 159, 67, 0.62);
  background: linear-gradient(145deg, rgba(255, 79, 47, 0.34), rgba(255, 159, 67, 0.26));
  color: #fff2e6;
  box-shadow: 0 0 0 1px rgba(255, 159, 67, 0.2) inset;
}

.catalog-switch-btn:active {
  transform: translateY(1px);
}

input,
select {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(255, 159, 67, 0.25);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.35), rgba(30, 12, 15, 0.55));
  color: var(--text);
  padding: 0.66rem 0.78rem;
  font: inherit;
  font-size: 1.05rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 2.1rem;
  background-image: linear-gradient(180deg, rgba(0, 0, 0, 0.35), rgba(30, 12, 15, 0.55)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='M3 6l5 5 5-5' fill='none' stroke='%23ffd198' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat, no-repeat;
  background-position: center, right 0.62rem center;
  background-size: auto, 14px 14px;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline: none;
  border-color: rgba(255, 159, 67, 0.65);
  box-shadow: 0 0 0 3px rgba(255, 79, 47, 0.18);
}

input:hover,
select:hover {
  border-color: rgba(255, 159, 67, 0.45);
}

.custom-select {
  position: relative;
}

.custom-select-trigger {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(255, 159, 67, 0.25);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.35), rgba(30, 12, 15, 0.55));
  color: var(--text);
  padding: 0.66rem 2.1rem 0.66rem 0.78rem;
  font: inherit;
  font-size: 1.05rem;
  text-align: left;
  position: relative;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.custom-select-trigger::after {
  content: "";
  position: absolute;
  right: 0.62rem;
  top: 50%;
  width: 14px;
  height: 14px;
  transform: translateY(-50%);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='M3 6l5 5 5-5' fill='none' stroke='%23ffd198' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

.custom-select.is-open .custom-select-trigger,
.custom-select-trigger:hover {
  border-color: rgba(255, 159, 67, 0.45);
}

.custom-select-trigger:focus-visible {
  outline: none;
  border-color: rgba(255, 159, 67, 0.65);
  box-shadow: 0 0 0 3px rgba(255, 79, 47, 0.18);
}

.custom-select-menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow: auto;
  z-index: 20;
  padding: 0.24rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 159, 67, 0.35);
  background: linear-gradient(180deg, rgba(22, 10, 12, 0.96), rgba(38, 13, 16, 0.98));
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
  display: none;
}

.custom-select.is-open .custom-select-menu {
  display: block;
}

.custom-select-option {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 10px;
  padding: 0.45rem 0.6rem;
  font: inherit;
  font-size: 1rem;
}

.custom-select-option:hover {
  color: #ffe2cb;
  border-color: rgba(255, 159, 67, 0.35);
  background: rgba(255, 79, 47, 0.15);
}

.custom-select-option.is-active {
  color: #fff2e6;
  border-color: rgba(255, 159, 67, 0.55);
  background: linear-gradient(145deg, rgba(255, 79, 47, 0.3), rgba(255, 159, 67, 0.22));
}

.summary {
  padding: 0.8rem 1rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
}

.summary div {
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.6rem;
}

.label {
  display: block;
  color: var(--muted);
  font-size: 0.95rem;
}

.catalog-grid {
  max-height: 62vh;
  overflow: auto;
  padding: 0.3rem 0.8rem 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.6rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 159, 67, 0.55) rgba(0, 0, 0, 0.25);
}

.catalog-grid::-webkit-scrollbar,
.custom-select-menu::-webkit-scrollbar {
  width: 10px;
}

.catalog-grid::-webkit-scrollbar-track,
.custom-select-menu::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.22);
  border-radius: 999px;
}

.catalog-grid::-webkit-scrollbar-thumb,
.custom-select-menu::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(255, 159, 67, 0.75), rgba(255, 79, 47, 0.8));
  border-radius: 999px;
  border: 2px solid rgba(0, 0, 0, 0.18);
}

.catalog-grid::-webkit-scrollbar-thumb:hover,
.custom-select-menu::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(255, 190, 92, 0.92), rgba(255, 79, 47, 0.92));
}

.item-card {
  background: linear-gradient(130deg, var(--panel-2), rgba(0, 0, 0, 0.2));
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.65rem;
  display: grid;
  gap: 0.5rem;
}

.item-card h3 {
  margin: 0;
  font-size: 1.24rem;
}

.meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 0.2rem;
}

.category-tag {
  color: var(--muted);
}

.price-tag {
  color: var(--accent);
  font-size: 1.3rem;
  font-weight: 700;
}

.card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.add-to-cart {
  border: 1px solid rgba(255, 159, 67, 0.52);
  background: linear-gradient(145deg, rgba(255, 79, 47, 0.38), rgba(255, 159, 67, 0.24));
  color: #fff2e6;
  border-radius: 12px;
  padding: 0.42rem 0.72rem;
  font: inherit;
  font-weight: 600;
  letter-spacing: 0.01rem;
  cursor: pointer;
  transition: transform 0.14s ease, filter 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}

.add-to-cart:hover,
.btn:hover,
.remove-btn:hover {
  filter: brightness(1.06);
  border-color: rgba(255, 190, 92, 0.72);
}

.add-to-cart:active,
.btn:active,
.remove-btn:active {
  transform: translateY(1px);
}

.calculator-panel {
  position: sticky;
  top: 0.8rem;
  height: fit-content;
}

.calc-grid {
  display: grid;
  gap: 0.65rem;
  padding: 0.9rem 1rem 0;
}

.recipe-builder {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.16);
  padding: 0.7rem;
}

.recipe-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.55rem;
  color: var(--muted);
}

.recipe-lines {
  display: grid;
  gap: 0.5rem;
}

.cart-empty {
  color: var(--muted);
  padding: 0.4rem 0;
}

.recipe-line {
  display: grid;
  grid-template-columns: 1fr 90px 38px;
  gap: 0.45rem;
}

.qty-input {
  text-align: center;
}

.line-total {
  color: var(--muted);
  font-size: 0.92rem;
  margin-top: 0.1rem;
}

.btn {
  border: 1px solid rgba(255, 159, 67, 0.52);
  background: linear-gradient(145deg, rgba(255, 79, 47, 0.35), rgba(255, 159, 67, 0.2));
  color: #fff2e6;
  border-radius: 12px;
  padding: 0.46rem 0.76rem;
  font: inherit;
  font-weight: 600;
  letter-spacing: 0.01rem;
  cursor: pointer;
  transition: transform 0.14s ease, filter 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}

.btn-soft {
  margin-top: 0;
  width: auto;
  border-color: rgba(255, 159, 67, 0.35);
  background: linear-gradient(145deg, rgba(45, 16, 20, 0.85), rgba(20, 10, 12, 0.92));
}

.remove-btn {
  border: 1px solid rgba(255, 159, 67, 0.35);
  background: linear-gradient(145deg, rgba(68, 20, 24, 0.85), rgba(28, 10, 13, 0.92));
  color: #ffcfb0;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.14s ease, filter 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}

.calc-grid label {
  display: grid;
  gap: 0.3rem;
  color: var(--muted);
  font-size: 1.02rem;
}

.formula {
  margin: 0.9rem 1rem 0;
  padding: 0.65rem;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--muted);
}

.result {
  margin: 0.9rem 1rem 1rem;
  padding: 0.9rem;
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(255, 79, 47, 0.2), rgba(0, 0, 0, 0.2));
  border: 1px solid rgba(255, 159, 67, 0.38);
}

.result span {
  display: block;
  color: var(--muted);
}

.result strong {
  font-size: 2rem;
  color: #ffd198;
}

.result small {
  display: block;
  color: var(--muted);
}

@media (max-width: 950px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .calculator-panel {
    position: static;
  }

  .catalog-grid {
    max-height: none;
  }
}

@media (max-width: 620px) {
  .toolbar {
    grid-template-columns: 1fr;
  }

  .catalog-switch {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .catalog-switch-btn {
    font-size: 0.82rem;
    padding: 0.42rem 0.3rem;
  }

  .summary {
    grid-template-columns: 1fr;
  }

  .recipe-line {
    grid-template-columns: 1fr 70px 34px;
  }

  .card-actions {
    flex-direction: column;
    align-items: stretch;
  }
}
