:root {
  --bg: #0a0e14;
  --bg-soft: #0f1520;
  --surface: #121a28;
  --surface-2: #1a2436;
  --surface-3: #22304a;
  --border: #233248;
  --border-strong: #33466a;
  --text: #e8eef7;
  --text-dim: #93a4c0;
  --text-faint: #6b7c99;
  --accent: #4ade80;
  --accent-strong: #22c55e;
  --accent-glow: rgba(74, 222, 128, 0.35);
  --gold: #fbbf24;
  --blue: #60a5fa;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
}

::selection { background: var(--accent-glow); color: #fff; }

/* ============ NAVBAR ============ */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 14, 20, 0.8);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.navbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-family: 'Sora', sans-serif;
  font-weight: 800;
  font-size: 1.12rem;
  letter-spacing: -0.02em;
}

.brand-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent-strong), #15803d);
  font-size: 1rem;
  box-shadow: 0 0 18px var(--accent-glow);
}

.brand em {
  font-style: normal;
  background: linear-gradient(90deg, var(--accent), #a3e635);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-links { display: flex; gap: 6px; }

.nav-link {
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.15s ease, background 0.15s ease;
}

.nav-link:hover { color: var(--text); background: var(--surface-2); }

.nav-link.active { color: var(--accent); background: rgba(74, 222, 128, 0.1); }

/* ============ HERO ============ */
.hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(900px 400px at 20% -10%, rgba(74, 222, 128, 0.12), transparent 60%),
    radial-gradient(800px 400px at 90% 10%, rgba(96, 165, 250, 0.1), transparent 60%),
    repeating-linear-gradient(45deg, rgba(35, 50, 72, 0.35) 0 2px, transparent 2px 18px),
    var(--bg-soft);
}

.hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 50%, var(--bg) 100%);
}

.hero-inner {
  position: relative;
  max-width: 900px;
  margin: 0 auto;
  padding: 72px 20px 64px;
  text-align: center;
}

.eyebrow {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(74, 222, 128, 0.1);
  border: 1px solid rgba(74, 222, 128, 0.3);
  padding: 6px 14px;
  border-radius: 100px;
  margin-bottom: 22px;
}

.hero h1 {
  font-family: 'Sora', sans-serif;
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.12;
  margin-bottom: 18px;
}

.hero h1 .grad {
  background: linear-gradient(90deg, var(--accent), #a3e635 60%, var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  max-width: 620px;
  margin: 0 auto 36px;
  color: var(--text-dim);
  font-size: 1.05rem;
}

.stats {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.stat {
  min-width: 150px;
  padding: 18px 22px;
  border-radius: var(--radius);
  background: rgba(18, 26, 40, 0.75);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.stat-num {
  display: block;
  font-family: 'Sora', sans-serif;
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.1;
}

.stat-label {
  display: block;
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* ============ LAYOUT ============ */
.container {
  flex: 1;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

/* ============ TOOLBAR ============ */
.toolbar {
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  position: sticky;
  top: 74px;
  z-index: 50;
  box-shadow: var(--shadow);
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 16px;
}

.search-icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--text-faint);
  pointer-events: none;
}

.search-box input {
  flex: 1;
  padding: 13px 46px 13px 44px;
  font-size: 0.98rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-box input::placeholder { color: var(--text-faint); }

.search-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.clear-btn {
  position: absolute;
  right: 8px;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 8px;
  background: var(--surface-3);
  color: var(--text-dim);
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.clear-btn:hover { background: #e53935; color: #fff; }

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.filter-group { display: flex; flex-direction: column; gap: 6px; }

.filter-group[hidden] { display: none; }

.filter-group label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}

.filter-group select,
.filter-group input[type="number"] {
  width: 100%;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2393a4c0' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.filter-group select:focus,
.filter-group input[type="number"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.filter-group input[type="number"] { appearance: auto; -webkit-appearance: auto; }

.bank-fee-control {
  min-width: 180px;
}

.bank-fee-control > label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.bank-fee-control input[type="checkbox"] { accent-color: var(--accent); }

.bank-fee-input {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
  color: var(--text-faint);
  font-size: 0.78rem;
}

.bank-fee-input input {
  width: 58px;
  padding: 7px 8px;
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
}

/* ============ RESULT INFO ============ */
.result-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.count {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-dim);
}

.reset-btn {
  padding: 8px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.reset-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(74, 222, 128, 0.08);
}

/* ============ GRID & CARDS ============ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px;
  background: linear-gradient(180deg, var(--surface), var(--bg-soft));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
  transition: opacity 0.16s ease;
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

.card:hover::before { opacity: 1; }

.card .name {
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.card .badges { display: flex; flex-wrap: wrap; gap: 6px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 100px;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.badge.vanilla { background: rgba(74, 222, 128, 0.12); border: 1px solid rgba(74, 222, 128, 0.35); color: #6ee7a0; }
.badge.mod { background: rgba(96, 165, 250, 0.12); border: 1px solid rgba(96, 165, 250, 0.35); color: #93c5fd; }
.badge.cat { background: rgba(251, 191, 36, 0.1); border: 1px solid rgba(251, 191, 36, 0.3); color: #fcd34d; }

.card .price {
  margin-top: auto;
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-family: 'Sora', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.card .price .unit {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-faint);
}

.price-label {
  width: 100%;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.buy-price {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.buy-price strong { color: #6ee7a0; }

.card .currency {
  font-size: 0.76rem;
  color: var(--text-faint);
  line-height: 1.45;
}

/* ============ CALCULATOR ============ */
.calc {
  margin-top: 10px;
  padding: 10px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.calc-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.calc-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.calc-stepper {
  display: grid;
  grid-template-columns: 30px 1fr 30px;
  align-items: stretch;
  gap: 4px;
}

.step-btn {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s ease;
}

.step-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(74, 222, 128, 0.1);
}

.calc-field input {
  width: 100%;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.calc-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.calc-stepper input {
  border-radius: 0;
  text-align: center;
}

.calc-field input::-webkit-outer-spin-button,
.calc-field input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.calc-field input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.calc-unit {
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
}

.calc-totals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  border-top: 1px dashed var(--border);
  padding-top: 8px;
}

.calc-total {
  display: flex;
  flex-direction: column;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  font-family: 'Sora', sans-serif;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-faint);
}

.calc-total-label {
  font-family: inherit;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.calc-total .calc-result {
  color: var(--accent);
}

.calc-buy-total .calc-buy-result { color: #6ee7a0; }

.calc-discount {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gold);
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: 100px;
  padding: 3px 10px;
  align-self: center;
}

/* ============ RECIPES ============ */
.card.has-recipe { cursor: default; }

.recipe-toggle {
  align-self: flex-start;
  margin-top: 4px;
  padding: 7px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--accent);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.recipe-toggle:hover {
  border-color: var(--accent);
  background: rgba(74, 222, 128, 0.1);
}

.recipes {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.recipes[hidden] { display: none; }

.recipe { position: relative; }

.craft-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  width: 100%;
  max-width: 150px;
}

.craft-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  padding: 4px;
  font-size: 0.58rem;
  text-align: center;
  line-height: 1.2;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  color: var(--text);
  word-break: break-word;
}

.craft-cell.empty {
  background: rgba(10, 14, 20, 0.6);
  border-color: var(--border);
}

.recipe-count {
  position: absolute;
  top: -8px;
  right: 0;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--gold);
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 100px;
  border: 1px solid var(--border);
}

.shapeless-ingredients {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ing-chip {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 100px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  color: var(--text-dim);
}

/* ============ MAP ============ */
.map-section {
  flex: 1;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

.map-header { margin-bottom: 18px; }

.map-header h2 {
  font-family: 'Sora', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.map-header p { color: var(--text-dim); font-size: 0.95rem; }

.map-frame {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--bg-soft);
}

.map-frame iframe {
  display: block;
  width: 100%;
  height: calc(100vh - 260px);
  min-height: 480px;
  border: none;
}

/* ============ MODAL ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  background: rgba(5, 8, 14, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  overflow-y: auto;
}

.modal-overlay[hidden] { display: none; }

.modal {
  width: 100%;
  max-width: 460px;
  background: linear-gradient(180deg, var(--surface), var(--bg-soft));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: modalIn 0.18s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-head h3 {
  font-family: 'Sora', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.modal-close:hover {
  border-color: #e53935;
  color: #fff;
  background: #e53935;
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-price {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.modal-price-num {
  font-family: 'Sora', sans-serif;
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.modal-price-unit {
  font-size: 0.78rem;
  color: var(--text-faint);
}

.modal-buy-price {
  display: flex;
  align-items: baseline;
  gap: 10px;
  color: var(--text-faint);
  font-size: 0.78rem;
}

.modal-buy-price strong {
  font-family: 'Sora', sans-serif;
  font-size: 1.25rem;
  color: #6ee7a0;
}

.modal-section { display: flex; flex-direction: column; gap: 10px; }

.modal-section .recipe-toggle { align-self: flex-start; }

/* ============ EMPTY ============ */
.empty {
  text-align: center;
  padding: 60px 0;
  color: var(--text-faint);
  font-size: 1.05rem;
}

/* ============ ABOUT ============ */
.about {
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
}

.about-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 56px 20px;
  text-align: center;
}

.about h2 {
  font-family: 'Sora', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 14px;
}

.about p {
  color: var(--text-dim);
  font-size: 0.98rem;
}

/* ============ FOOTER ============ */
.footer {
  text-align: center;
  padding: 20px 16px;
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 0.82rem;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 720px) {
  .nav-links { display: none; }

  .hero-inner { padding: 48px 20px 44px; }

  .toolbar { top: 62px; }

  .result-info { flex-direction: column; align-items: flex-start; }

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

  .map-frame iframe { height: calc(100vh - 220px); min-height: 420px; }
}
