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

:root {
  --cream: #f7f3ed;
  --warm-white: #fdfaf6;
  --wood: #c8854a;
  --wood-light: #e8c49a;
  --wood-pale: #f5e8d8;
  --green: #4a7c59;
  --green-light: #d4e8da;
  --red: #c84a4a;
  --red-light: #f5d8d8;
  --ink: #2a2218;
  --ink-mid: #6b5d4f;
  --ink-light: #a89880;
  --border: #e2d8cc;
  --shadow: rgba(42,34,24,0.08);
}

html, body {
  height: 100%;
  background: var(--cream);
  color: var(--ink);
  font-family: 'Lato', sans-serif;
  font-weight: 300;
  overflow: hidden;
}

/* ── LAYOUT ── */
.shell {
  display: grid;
  grid-template-rows: 56px 1fr;
  height: 100vh;
}

/* ── HEADER ── */
header {
  background: var(--warm-white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 20px;
}

.logo {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  color: var(--ink);
  letter-spacing: -0.5px;
}

.logo em { color: var(--wood); font-style: italic; }

.header-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
}

.header-sub {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink-light);
}

.share-btn {
  margin-left: auto;
  background: var(--ink);
  border: none;
  color: var(--cream);
  font-family: 'Lato', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 7px 18px;
  cursor: pointer;
  transition: background 0.2s;
  border-radius: 2px;
}

.share-btn:hover { background: var(--wood); }

/* ── MAIN GRID ── */
.main {
  display: grid;
  grid-template-columns: 320px 1fr 260px;
  height: 100%;
  overflow: hidden;
}

/* ── SELECTOR COLUMN ── */
.selectors {
  background: var(--warm-white);
  border-right: 1px solid var(--border);
  padding: 24px 22px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
}

.selector-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.selector-label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pip {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.pip-blade { background: var(--wood); }
.pip-fh    { background: var(--green); }
.pip-bh    { background: var(--red); }

.selector-label-text {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink-mid);
}

.selector-label-hint {
  font-size: 10px;
  color: var(--ink-light);
  margin-left: 18px;
  margin-top: -4px;
}

.pill-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  background: var(--cream);
  border: 1.5px solid var(--border);
  border-radius: 99px;
  font-size: 11px;
  font-weight: 400;
  color: var(--ink-mid);
  padding: 5px 13px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  user-select: none;
}

.pill:hover {
  border-color: var(--ink-mid);
  color: var(--ink);
}

.pill.active-blade {
  background: var(--wood-pale);
  border-color: var(--wood);
  color: var(--wood);
  font-weight: 700;
}

.pill.active-fh {
  background: var(--green-light);
  border-color: var(--green);
  color: var(--green);
  font-weight: 700;
}

.pill.active-bh {
  background: var(--red-light);
  border-color: var(--red);
  color: var(--red);
  font-weight: 700;
}

.item-desc-box {
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px 12px;
  font-size: 11px;
  color: var(--ink-mid);
  line-height: 1.6;
  min-height: 52px;
}

.item-desc-box .item-price {
  font-weight: 700;
  color: var(--wood);
}

/* STATS TOGGLE */
.mode-row {
  margin-top: 4px;
}

.mode-label {
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--ink-light);
  margin-bottom: 6px;
}

.mode-toggle {
  display: flex;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.mode-btn {
  flex: 1;
  background: transparent;
  border: none;
  font-family: 'Lato', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ink-light);
  padding: 7px 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.mode-btn.active {
  background: var(--ink);
  color: var(--cream);
}

/* ── CENTRE: STATS ── */
.centre {
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
}

/* PLAYSTYLE HERO */
.playstyle-hero {
  background: var(--warm-white);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 20px 24px;
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

.playstyle-text { flex: 1; }

.playstyle-eyebrow {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink-light);
  margin-bottom: 4px;
}

.playstyle-title {
  font-family: 'Playfair Display', serif;
  font-size: 26px;
  font-style: italic;
  color: var(--ink);
  line-height: 1.1;
  margin-bottom: 8px;
}

.playstyle-desc {
  font-size: 12px;
  color: var(--ink-mid);
  line-height: 1.7;
  max-width: 480px;
}

.playstyle-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 2px;
  color: var(--ink-mid);
  background: var(--cream);
  border: 1px solid var(--border);
}

.tag.hl { background: var(--wood-pale); border-color: var(--wood-light); color: var(--wood); }

/* RADAR + BARS ROW */
.viz-row {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
  min-height: 0;
}

.radar-card {
  background: var(--warm-white);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

canvas#radar {
  display: block;
  max-width: 200px;
}

.bars-card {
  background: var(--warm-white);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
}

.bar-row { display: flex; flex-direction: column; gap: 5px; }

.bar-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.bar-name {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--ink-mid);
}

.bar-score {
  font-family: 'Playfair Display', serif;
  font-size: 16px;
  color: var(--ink);
}

.bar-track {
  height: 5px;
  background: var(--cream);
  border-radius: 99px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.5s cubic-bezier(0.16,1,0.3,1);
}

/* ── RIGHT: SUMMARY ── */
.summary {
  background: var(--warm-white);
  border-left: 1px solid var(--border);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.summary-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink-light);
  margin-bottom: 10px;
}

/* COMPONENT CARDS */
.component-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.comp-card {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 12px 14px;
  transition: border-color 0.2s;
}

.comp-card:hover { border-color: var(--ink-light); }

.comp-card-top {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.comp-type {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink-light);
}

.comp-name {
  font-family: 'Playfair Display', serif;
  font-size: 15px;
  color: var(--ink);
  margin-bottom: 1px;
}

.comp-brand {
  font-size: 10px;
  color: var(--ink-light);
}

.comp-price {
  font-size: 12px;
  font-weight: 700;
  color: var(--wood);
  margin-top: 6px;
}

/* PRICE TOTAL */
.price-block {
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 14px 16px;
}

.price-lines { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }

.price-line {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--ink-mid);
}

.price-line.total {
  border-top: 1px solid var(--border);
  padding-top: 8px;
  margin-top: 4px;
  font-weight: 700;
  color: var(--ink);
  font-size: 13px;
}

.price-line.total .total-num {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  color: var(--wood);
}

/* BUY BTNS */
.buy-btns { display: flex; flex-direction: column; gap: 8px; margin-top: auto; }

.buy-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--cream);
  border: 1.5px solid var(--border);
  border-radius: 4px;
  font-family: 'Lato', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ink-mid);
  text-decoration: none;
  transition: all 0.15s;
  cursor: pointer;
}

.buy-btn:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--cream);
}

.buy-btn.primary {
  background: var(--green);
  border-color: var(--green);
  color: white;
}

.buy-btn.primary:hover { background: var(--ink); border-color: var(--ink); }

/* TOAST */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(60px);
  background: var(--ink);
  color: var(--cream);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 10px 24px;
  border-radius: 99px;
  transition: transform 0.3s cubic-bezier(0.16,1,0.3,1);
  pointer-events: none;
  white-space: nowrap;
}

.toast.show { transform: translateX(-50%) translateY(0); }

/* Scrollbar */
.selectors::-webkit-scrollbar { width: 4px; }
.selectors::-webkit-scrollbar-track { background: transparent; }
.selectors::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.centre::-webkit-scrollbar { width: 4px; }
.centre::-webkit-scrollbar-track { background: transparent; }
.centre::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── MOBILE ── */
@media (max-width: 768px) {
  html, body { overflow: auto; height: auto; }

  .shell {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 100vh;
  }

  .main {
    display: flex;
    flex-direction: column;
    height: auto;
    overflow: visible;
  }

  .selectors {
    order: 1;
    border-right: none;
    border-bottom: 1px solid var(--border);
    overflow-y: visible;
  }

  .centre {
    order: 2;
    overflow: visible;
    padding: 20px 16px;
  }

  .summary {
    order: 3;
    border-left: none;
    border-top: 1px solid var(--border);
  }

  .viz-row {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  .radar-card {
    padding: 20px;
  }

  canvas#radar {
    max-width: 240px;
    width: 240px;
  }

  .pill {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    font-size: 12px;
  }

  .playstyle-title { font-size: 22px; }

  header { padding: 0 16px; }
  .selectors { padding: 20px 16px; }
  .summary { padding: 20px 16px; }

  .buy-btns { margin-top: 0; }
}

/* ── QUIZ OVERLAY ── */
.quiz-overlay {
  position: fixed;
  inset: 0;
  background: var(--cream);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.quiz-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.quiz-inner {
  max-width: 520px;
  width: 100%;
}

.quiz-brand {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  color: var(--ink);
  margin-bottom: 32px;
  letter-spacing: -0.3px;
}

.quiz-brand em { color: var(--wood); font-style: italic; }

.quiz-progress {
  display: flex;
  gap: 6px;
  margin-bottom: 28px;
}

.quiz-progress-dot {
  width: 32px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  transition: background 0.3s;
}

.quiz-progress-dot.done { background: var(--wood); }

.quiz-step {
  display: none;
  flex-direction: column;
  gap: 20px;
}

.quiz-step.active {
  display: flex;
  animation: quizIn 0.3s cubic-bezier(0.16,1,0.3,1);
}

@keyframes quizIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.quiz-question {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  font-style: italic;
  color: var(--ink);
  line-height: 1.2;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quiz-option {
  background: var(--warm-white);
  border: 1.5px solid var(--border);
  border-radius: 6px;
  padding: 16px 20px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
  font-family: 'Lato', sans-serif;
  font-size: 14px;
  color: var(--ink);
  font-weight: 300;
  width: 100%;
}

.quiz-option:hover {
  border-color: var(--wood);
  background: var(--wood-pale);
}

.quiz-footer {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

.quiz-skip {
  font-size: 12px;
  color: var(--ink-light);
  cursor: pointer;
  text-decoration: underline;
  background: none;
  border: none;
  font-family: 'Lato', sans-serif;
  padding: 4px 8px;
}

.quiz-skip:hover { color: var(--ink); }

@media (max-width: 768px) {
  .quiz-question { font-size: 22px; }
  .quiz-option { min-height: 56px; display: flex; align-items: center; }
}

/* ── SWAP CARDS ── */
.swap-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.swap-slot-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink-light);
  margin-bottom: 8px;
}

.swap-cards-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.swap-card {
  background: var(--warm-white);
  border: 1.5px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.15s;
  flex: 1;
  min-width: 140px;
  max-width: 200px;
}

.swap-card:hover {
  border-color: var(--wood);
  box-shadow: 0 2px 8px var(--shadow);
}

.swap-card-name {
  font-family: 'Playfair Display', serif;
  font-size: 13px;
  color: var(--ink);
  margin-bottom: 1px;
}

.swap-card-brand {
  font-size: 10px;
  color: var(--ink-light);
  margin-bottom: 8px;
}

.swap-card-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.diff-chip {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 2px;
}

.diff-chip.positive {
  background: var(--green-light);
  color: var(--green);
}

.diff-chip.negative {
  background: var(--red-light);
  color: var(--red);
}

.diff-chip.price-down {
  background: var(--green-light);
  color: var(--green);
}

.diff-chip.price-up {
  background: var(--red-light);
  color: var(--red);
}

@media (max-width: 768px) {
  .swap-cards-row { flex-direction: column; }
  .swap-card { max-width: 100%; }
}

/* ── WARNING BANNERS ── */
.warnings-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.warning-banner {
  border-radius: 4px;
  padding: 9px 13px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--ink-mid);
}

.warning-banner.caution {
  background: var(--wood-pale);
  border-left: 3px solid var(--wood);
}

.warning-banner.info {
  background: var(--green-light);
  border-left: 3px solid var(--green);
}
