:root {
  --bg: #0F2A23;
  --card: #0B1F1A;
  --gold: #C6A55C;
  --gold-2: #E0C27A;
  --text: #F5F5F5;
  --muted: #A8B3AE;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Inter", sans-serif;
  color: var(--text);
  background:
    radial-gradient(120% 80% at 15% 5%, rgba(198, 165, 92, 0.13), transparent 45%),
    radial-gradient(70% 110% at 85% 20%, rgba(198, 165, 92, 0.1), transparent 58%),
    linear-gradient(180deg, #0f2a23, #0b1f1a);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

input,
textarea,
select,
[contenteditable="true"] {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  border-bottom: 1px solid rgba(198, 165, 92, 0.28);
  background: rgba(11, 31, 26, 0.9);
  backdrop-filter: blur(8px);
}

.logo {
  color: var(--gold);
  font: 700 2rem "Playfair Display", serif;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.logo-mark {
  width: 118px;
  height: 62px;
  object-fit: contain;
  object-position: left center;
  padding: 0;
  flex: 0 0 auto;
  filter: brightness(0) saturate(100%) invert(79%) sepia(24%) saturate(553%) hue-rotate(356deg) brightness(90%) contrast(91%);
}

.logo-wordmark {
  line-height: 1;
}

.topbar-right { display: flex; gap: 10px; align-items: center; }
.link-btn, select, input, .btn {
  border: 1px solid rgba(198, 165, 92, 0.45);
  background: rgba(11, 31, 26, 0.6);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
}
.link-btn { text-decoration: none; }

.container { width: min(1100px, 92vw); margin: 24px auto 64px; }
.hero h1 { margin: 6px 0 10px; font: 700 clamp(2.2rem, 4vw, 3.35rem) "Playfair Display", serif; max-width: 12ch; }
.hero p { margin: 0; color: var(--muted); }
.eyebrow { color: var(--gold-2); letter-spacing: 0.12em; text-transform: uppercase; font-size: 0.82rem; }

.hero-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.8fr);
  gap: 18px;
  align-items: stretch;
}

.hero-copy,
.hero-panel {
  background:
    linear-gradient(180deg, rgba(18, 49, 40, 0.92), rgba(10, 28, 23, 0.92)),
    radial-gradient(circle at top left, rgba(198, 165, 92, 0.18), transparent 42%);
  border: 1px solid rgba(198, 165, 92, 0.18);
  border-radius: 22px;
  padding: 24px 24px 22px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
}

.hero-panel {
  display: grid;
  gap: 14px;
  align-content: start;
}

.hero-panel-title {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--gold-2);
}

.hero-panel-items {
  display: grid;
  gap: 12px;
}

.hero-panel-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(198, 165, 92, 0.14);
  background: rgba(255, 255, 255, 0.03);
}

.hero-panel-item strong {
  color: var(--gold-2);
  font-size: 0.85rem;
  letter-spacing: 0.12em;
}

.hero-panel-item span {
  color: #d8e0dc;
  line-height: 1.45;
}

.steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 24px 0 20px;
}
.step {
  min-height: 64px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(198, 165, 92, 0.2);
  color: var(--muted);
  background: rgba(11, 31, 26, 0.56);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}
.step strong {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(198, 165, 92, 0.34);
  color: var(--gold-2);
  font-size: 0.95rem;
}

.step span {
  font-size: 0.95rem;
  line-height: 1.2;
}

.step.is-active {
  border-color: rgba(198, 165, 92, 0.52);
  background: linear-gradient(180deg, rgba(198, 165, 92, 0.18), rgba(11, 31, 26, 0.88));
  color: var(--text);
  position: relative;
}

/* Glowing gold underline on the current step + a slow pulse so the
   "you are here" signal is hard to miss without being noisy. */
.step.is-active::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: -1px;
  height: 2px;
  background: var(--gold);
  border-radius: 999px;
  box-shadow: 0 0 12px rgba(198, 165, 92, 0.55);
  animation: stepPulse 1.6s ease-in-out infinite;
}

@keyframes stepPulse {
  0%, 100% { opacity: 0.55; transform: scaleX(0.92); }
  50%      { opacity: 1;    transform: scaleX(1); }
}

.step.is-active strong {
  background: var(--gold);
  color: #1a1814;
  border-color: transparent;
  font-weight: 700;
}

.step.is-complete {
  color: #dce4df;
  border-color: rgba(34, 134, 94, 0.32);
  background: linear-gradient(180deg, rgba(34, 134, 94, 0.1), rgba(11, 31, 26, 0.88));
}

/* Completed steps swap the number out for a green checkmark glyph.
   Hide the digit via font-size:0 + render the check via ::before so
   the existing markup stays unchanged. */
.step.is-complete strong {
  background: #2c8e62;
  border-color: transparent;
  color: transparent;
  font-size: 0;
  position: relative;
}

.step.is-complete strong::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='5 12 10 17 19 7'/></svg>");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 60% 60%;
}

.card {
  background: rgba(11, 31, 26, 0.82);
  border: 1px solid rgba(198, 165, 92, 0.25);
  border-radius: 20px;
  padding: 22px;
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.2);
}
.card + .card { margin-top: 12px; }
.hidden { display: none; }

h2 { margin: 0 0 8px; font: 600 1.55rem "Playfair Display", serif; }
.section-note {
  margin: 0 0 18px;
  max-width: 58ch;
  color: var(--muted);
  line-height: 1.5;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 12px;
}
label {
  display: grid;
  gap: 7px;
  font-size: 0.95rem;
  color: var(--muted);
}
input, select { width: 100%; }
input,
select {
  min-height: 50px;
  border-radius: 14px;
  background: rgba(7, 22, 18, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.layout-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.layout-btn {
  border: 1px solid rgba(198, 165, 92, 0.45);
  background: rgba(11, 31, 26, 0.68);
  color: var(--text);
  border-radius: 16px;
  padding: 18px 16px;
  cursor: pointer;
  display: grid;
  gap: 8px;
  text-align: left;
  align-content: start;
  min-height: 156px;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}
.layout-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(198, 165, 92, 0.58);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
}
.layout-title {
  color: var(--text);
  font: 600 1.08rem "Playfair Display", serif;
}
.layout-copy {
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.94rem;
}
.layout-fit {
  margin-top: auto;
  color: var(--gold-2);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.layout-btn.active {
  background: linear-gradient(180deg, rgba(198, 165, 92, 0.18), rgba(16, 37, 31, 0.92));
  border-color: rgba(198, 165, 92, 0.68);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.18);
}
.layout-btn.active .layout-title,
.layout-btn.active .layout-fit {
  color: var(--gold-2);
}
.layout-btn.active .layout-copy {
  color: #d7e0db;
}

.pick-preview {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  min-height: 88px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(198, 165, 92, 0.14);
  background: rgba(255, 255, 255, 0.03);
}

.pick-preview.is-empty {
  grid-template-columns: 1fr;
  place-items: center start;
  /* Was --muted (#A8B3AE on the dark card = 4.2:1 contrast — barely
     WCAG AA, hard to read at 13px on phones). Bumped to a near-text
     value so the placeholder reads cleanly without being so loud
     that it competes with filled previews. */
  color: rgba(245, 245, 245, 0.78);
  border: 1px dashed rgba(198, 165, 92, 0.32);
  border-radius: 12px;
  padding: 12px;
}

.pick-preview-media {
  width: 72px;
  height: 72px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(198, 165, 92, 0.12);
  background:
    linear-gradient(180deg, rgba(19, 47, 39, 0.95), rgba(9, 24, 20, 0.95)),
    radial-gradient(circle at top left, rgba(198, 165, 92, 0.14), transparent 48%);
  display: grid;
  place-items: center;
}

.pick-preview-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pick-preview-fallback {
  color: var(--gold-2);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.pick-preview-body {
  display: grid;
  gap: 5px;
  align-content: start;
}

.pick-preview-name {
  color: var(--text);
  font-weight: 600;
  line-height: 1.4;
}

.pick-preview-meta {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.pick-preview-price {
  color: var(--gold-2);
  font-weight: 600;
}

.recommendation-note.hidden {
  display: none;
}

.checks {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.checks li {
  padding: 13px 14px;
  border-radius: 15px;
  border: 1px solid rgba(198, 165, 92, 0.16);
  background: rgba(255, 255, 255, 0.02);
  line-height: 1.45;
}

.checks li.ok {
  color: #d5eadf;
  border-color: rgba(116, 188, 151, 0.24);
  background: rgba(116, 188, 151, 0.08);
}

.checks li.warn {
  color: #f0cf90;
  border-color: rgba(198, 165, 92, 0.24);
  background: rgba(198, 165, 92, 0.08);
}

.validation-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.validation-group {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(198, 165, 92, 0.14);
  background: rgba(255, 255, 255, 0.03);
}

.validation-heading {
  display: flex;
  align-items: center;
  gap: 10px;
}

.validation-heading h3 {
  margin: 0;
  font: 600 1.02rem "Playfair Display", serif;
  color: var(--text);
}

.validation-dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  flex: 0 0 auto;
}

.validation-dot-ok {
  background: #74bc97;
  box-shadow: 0 0 0 5px rgba(116, 188, 151, 0.12);
}

.validation-dot-warn {
  background: var(--gold-2);
  box-shadow: 0 0 0 5px rgba(198, 165, 92, 0.12);
}

.summary-list { display: grid; gap: 8px; }
.summary-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(198, 165, 92, 0.16);
  background: rgba(255, 255, 255, 0.03);
}
.summary-item strong {
  color: var(--gold-2);
  white-space: nowrap;
}
.summary-total {
  display: flex;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(198, 165, 92, 0.16);
  color: var(--gold-2);
  font-size: 1.2rem;
}

.summary-meta-card {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(198, 165, 92, 0.16);
  background:
    linear-gradient(180deg, rgba(18, 49, 40, 0.88), rgba(10, 28, 23, 0.88)),
    radial-gradient(circle at top left, rgba(198, 165, 92, 0.14), transparent 42%);
}

.summary-meta-head {
  display: grid;
  gap: 6px;
}

.summary-kicker {
  margin: 0;
  color: var(--gold-2);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.8rem;
}

.summary-meta-head h3 {
  margin: 0;
  font: 600 1.2rem "Playfair Display", serif;
  color: var(--text);
}

.summary-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.summary-meta-item {
  display: grid;
  gap: 5px;
  padding: 12px 14px;
  border-radius: 15px;
  border: 1px solid rgba(198, 165, 92, 0.14);
  background: rgba(255, 255, 255, 0.03);
}

.summary-meta-label {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.summary-meta-value {
  color: var(--text);
  font-weight: 600;
  line-height: 1.4;
}

.actions { display: flex; gap: 10px; margin-top: 14px; }
/* Match the homepage's .btn token (44px / 11px 16px / 14px radius)
   so a planner button next to a homepage button looks identical.
   Was 50px which read as a stricter, taller pill on phones. */
.btn {
  cursor: pointer;
  min-height: 44px;
  padding: 11px 16px;
  border-radius: 14px;
}
.btn.solid { background: var(--gold); color: #17140f; font-weight: 700; }
.btn.outline { background: transparent; color: var(--gold-2); }
.note {
  color: var(--muted);
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  white-space: pre-line;
}

/* Reusable info-tooltip pattern for technical-choice fields. The
   .info-tip button sits next to the field label; on hover (desktop)
   or tap (mobile, via JS class toggle) a popover anchored to the
   button shows the data-tip text. Add the same pattern to other
   technical fields by reusing .label-with-tip + .info-tip + a
   data-tip-key the i18n module looks up. */
.label-with-tip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.info-tip {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid rgba(198, 165, 92, 0.55);
  background: transparent;
  color: var(--gold-2);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  font-style: italic;
  display: inline-grid;
  place-items: center;
  cursor: help;
  padding: 0;
  position: relative;
  line-height: 1;
}

.info-tip:hover,
.info-tip.is-open,
.info-tip:focus-visible {
  background: rgba(198, 165, 92, 0.18);
  outline: none;
}

.info-tip[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  width: max-content;
  max-width: 240px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(11, 31, 26, 0.96);
  border: 1px solid rgba(198, 165, 92, 0.32);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  font-style: normal;
  line-height: 1.4;
  white-space: normal;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.42);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  pointer-events: none;
  z-index: 10;
}

.info-tip:hover::after,
.info-tip.is-open::after,
.info-tip:focus-visible::after {
  opacity: 1;
  visibility: visible;
}

@media (max-width: 860px) {
  .hero-shell { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }
  .layout-grid { grid-template-columns: 1fr; }
  .validation-groups { grid-template-columns: 1fr; }
  .summary-meta-grid { grid-template-columns: 1fr; }
  .hero h1 { max-width: none; }
  /* Sticky-footer for step navigation on phones. The .actions row
     was below-the-fold for any step that had even moderate form
     content, so users had to scroll just to reach Continue. Pin it
     to the viewport bottom, give it the safe-area padding for
     iPhone home-indicator phones, and split the buttons 50/50 so
     Back + Continue both get a comfortable thumb target. */
  .card .actions {
    position: sticky;
    bottom: 0;
    margin: 14px -22px -22px;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(180deg, rgba(11, 31, 26, 0.6), rgba(11, 31, 26, 0.96));
    border-top: 1px solid rgba(198, 165, 92, 0.18);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 5;
    flex-wrap: nowrap;
  }
  .card .actions .btn {
    flex: 1 1 0;
    min-width: 0;
  }
  .pick-preview {
    grid-template-columns: 64px minmax(0, 1fr);
  }
  .pick-preview-media {
    width: 64px;
    height: 64px;
  }
}

/* ───────────────────────────────────────────────────────────────
   Accessibility — focus-visible states
   ───────────────────────────────────────────────────────────────
   Keyboard / voice-control / mobile tap-to-focus users had no cue
   that an element was focused. Adopting the same outline pattern
   the rest of orvos.uz uses (gold-2 ring + 2px offset) so the
   planner becomes WCAG 2.1 AA compliant for visible focus.
*/
.btn:focus-visible,
.btn-link:focus-visible,
.layout-btn:focus-visible,
.lang-btn:focus-visible,
.tg-deep-link:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--gold-2);
  outline-offset: 2px;
}

/* Inputs on dark background also get a gentle glow so the cue is
   visible against the darker form fill. */
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  box-shadow: 0 0 0 3px rgba(198, 165, 92, 0.18);
}

/* ───────────────────────────────────────────────────────────────
   Narrow phones (<=480px) — iPhone SE / mini, small Android.
   ───────────────────────────────────────────────────────────────
   The 860px breakpoint above already stacks columns; this one
   tightens padding + font sizes so the content area isn't crushed
   by 22px card padding eating ~50px of a 375px viewport. The step
   indicator drops to 3 columns and labels wrap so the words don't
   collide.
*/
@media (max-width: 480px) {
  .container { width: min(1100px, 96vw); margin: 12px auto 32px; }
  .topbar { padding: 10px 12px; }
  .card { padding: 16px; border-radius: 16px; }
  .card + .card { margin-top: 10px; }
  .hero-shell { gap: 10px; }
  .hero { padding: 18px; }
  .hero h1 { font-size: 1.6rem; line-height: 1.15; }
  /* Step indicator: 3 columns instead of 5 keeps each step >100px
     wide on a 360px viewport so the label doesn't shrink below
     readable size. The 4th + 5th wrap onto a 2nd row. */
  .steps { grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 16px 0 14px; }
  .step { min-height: 56px; padding: 8px 10px; gap: 8px; border-radius: 14px; }
  .step-num { width: 28px; height: 28px; font-size: 0.85rem; }
  .step-label { font-size: 0.85rem; }
  /* Action buttons get a softer min-height so they don't dominate
     the small viewport. */
  .btn { padding: 10px 14px; font-size: 0.95rem; }
  /* Hero side-panel ("What you will get") eats ~280px above the
     fold on phones — kill it under 480px so the eyebrow + h1 +
     CTA carry the conversion above the scroll. The panel content
     is repeated essentially in the step indicator below. */
  .hero-panel { display: none; }
}

/* ───────────────────────────────────────────────────────────────
   Inline status banner — replaces the alert() that fired when
   loadCatalog failed. Spinner during the sequential category →
   subcategory → product fetch chain (slow on 3G), error message
   with a Retry button if anything in the chain rejects.
*/
.planner-status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin: 0 0 16px;
  border-radius: 14px;
  background: rgba(11, 31, 26, 0.7);
  border: 1px solid rgba(198, 165, 92, 0.28);
  font-size: 0.95rem;
  color: var(--text);
}
.planner-status[hidden] { display: none; }
.planner-status.is-error {
  border-color: rgba(208, 80, 96, 0.5);
  background: rgba(208, 80, 96, 0.12);
}
.planner-status-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(198, 165, 92, 0.35);
  border-top-color: var(--gold-2);
  animation: planner-spin 0.9s linear infinite;
  flex: 0 0 auto;
}
.planner-status.is-error .planner-status-dot {
  animation: none;
  border: 2px solid rgba(208, 80, 96, 0.7);
  border-top-color: rgba(208, 80, 96, 0.7);
}
.planner-status-text { flex: 1 1 auto; min-width: 0; }
.planner-status-retry {
  flex: 0 0 auto;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(198, 165, 92, 0.4);
  background: rgba(198, 165, 92, 0.18);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}
.planner-status-retry[hidden] { display: none; }
@keyframes planner-spin {
  to { transform: rotate(360deg); }
}

/* "Saved" pill — fades in after savePlannerState, fades out 1.6s
   later. Anchored bottom-right so it doesn't clash with the
   sticky topbar or the step indicator. */
.planner-saved-pill {
  position: fixed;
  right: 16px;
  bottom: 16px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(15, 42, 35, 0.92);
  border: 1px solid rgba(198, 165, 92, 0.4);
  color: var(--gold-2);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 50;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}
.planner-saved-pill.is-visible {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  .planner-saved-pill { transition: none; }
}
