/* Written phone-first; the few desktop adjustments are at the bottom. */
:root {
  --bg: #f6f6f8;
  --surface: #fff;
  --text: #17171c;
  --muted: #6c6c78;
  --border: #e2e2e8;
  --accent: #d6006f;
  --accent-soft: #fde8f2;
  --dark: #121216;
  --radius: 12px;
  --topbar: 56px;
  --cartbar: 60px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  padding-bottom: calc(var(--cartbar) + env(safe-area-inset-bottom));
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

h1, h2, h3, p { margin: 0; }
/* 16px form text keeps iOS from zooming the page when a field gets focus */
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
a { color: inherit; }

.page { max-width: 720px; margin: 0 auto; padding: 0 12px; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 10; background: var(--dark); color: #fff; padding-top: env(safe-area-inset-top); }
.topbar-inner { max-width: 720px; height: var(--topbar); margin: 0 auto; padding: 0 12px; display: flex; align-items: center; gap: 8px; }
.brand { margin-right: auto; font-weight: 800; font-size: 1.1rem; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar select {
  height: 40px; padding: 0 4px; max-width: 108px;
  background: transparent; color: #fff; border: 1px solid #44444e; border-radius: 8px;
}
.topbar select option { color: #000; }
.cart-btn { display: none; }
.badge {
  min-width: 24px; padding: 0 7px; border-radius: 999px;
  background: #fff; color: var(--accent); font-size: .85rem; font-weight: 800; line-height: 24px; text-align: center;
}

/* Bottom cart bar */
.cartbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  height: calc(var(--cartbar) + env(safe-area-inset-bottom));
  padding: 0 16px env(safe-area-inset-bottom);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 0; background: var(--accent); color: #fff; font-weight: 700; font-size: 1.05rem;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, .18);
}
.cartbar:active, .cart-btn:active, .btn.primary:active { filter: brightness(.9); }
.cartbar-label { display: inline-flex; align-items: center; gap: 10px; }

/* Catalogue */
#view { padding-top: 4px; padding-bottom: 24px; min-height: 60vh; }

/* Step indicator */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; list-style: none; margin: 0 0 14px; padding: 0; }
.step > * {
  display: flex; align-items: center; gap: 8px; height: 100%; min-height: 54px; padding: 6px 8px;
  border: 1px solid transparent; border-radius: var(--radius); background: #e9e9ee; color: var(--muted); text-decoration: none;
}
.step-n { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: #fff; font-size: .9rem; font-weight: 800; }
.step-text { display: grid; min-width: 0; line-height: 1.2; }
.step-label { font-size: .8rem; font-weight: 600; }
.step-value { font-size: .85rem; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step[aria-current] > * { background: var(--accent); color: #fff; }
.step[aria-current] .step-n { color: var(--accent); }
.step[data-done="true"] > * { background: var(--surface); border-color: var(--accent); color: var(--accent); }
.step[data-done="true"] .step-n { background: var(--accent); color: #fff; }
.step a:active { background: var(--accent-soft); }

h1 { font-size: 1.3rem; line-height: 1.25; margin-bottom: 12px; }
.back { display: inline-flex; align-items: center; min-height: 40px; margin-bottom: 2px; color: var(--muted); font-weight: 600; text-decoration: none; }
.empty { grid-column: 1 / -1; padding: 20px 4px; color: var(--muted); }

/* Step 1: characters */
.tabs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; background: #e9e9ee; border-radius: var(--radius); }
.tab { padding: 10px 6px; border-radius: 9px; text-align: center; text-decoration: none; font-weight: 700; color: var(--muted); }
.tab[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.searchbar { position: sticky; top: calc(var(--topbar) + env(safe-area-inset-top)); z-index: 5; padding: 10px 0 8px; background: var(--bg); }
.searchbar-inner { position: relative; max-width: 720px; margin: 0 auto; padding: 0 12px; }
.search::-webkit-search-cancel-button { display: none; }
.search-clear { position: absolute; top: 1px; right: 13px; width: 44px; height: 44px; border: 0; background: none; color: var(--muted); font-size: 1.5rem; line-height: 1; }
.section { margin: 18px 0 10px; font-size: 1.05rem; }
.card-doll { color: var(--muted); font-size: .85rem; line-height: 1.3; }
.search { width: 100%; height: 46px; padding: 0 46px 0 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
:is(.search, select, .field input, .field textarea):focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile {
  position: relative; display: grid; justify-items: center; align-content: start; gap: 6px;
  padding: 12px 4px 10px; text-align: center; text-decoration: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.tile:active, .rowlink:active, .card:active { border-color: var(--accent); background: var(--accent-soft); }
.avatar {
  width: 52px; height: 52px; border-radius: 50%; overflow: hidden; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-size: 1.3rem; font-weight: 800;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.tile-name { font-size: .88rem; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.tile .count { position: absolute; top: 6px; right: 6px; }
.count {
  flex: none; min-width: 24px; padding: 0 7px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: .8rem; font-weight: 700; line-height: 24px; text-align: center;
}

/* Step 2: series */
.rowlinks { display: grid; gap: 8px; }
.rowlink {
  display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 8px 14px; text-decoration: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.rowlink-name { flex: 1; min-width: 0; font-weight: 600; line-height: 1.25; }
.year { color: var(--muted); font-size: .9rem; }
.chev { color: var(--muted); font-size: 1.3rem; line-height: 1; }

/* Step 3: accessories */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.card {
  display: flex; flex-direction: column; padding: 0; overflow: hidden; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.card-photo { position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: 1; background: #eeeef2; color: #b4b4c0; }
.card-photo img { width: 100%; height: 100%; object-fit: cover; }
.card-photo svg { width: 30%; }
.card-photo .count { position: absolute; top: 8px; right: 8px; }
.card-info { display: grid; gap: 4px; padding: 10px; }
.card-title { font-weight: 700; line-height: 1.25; }
.price { font-weight: 700; }
.price small { font-weight: 500; font-size: .82em; color: var(--muted); white-space: nowrap; }
.sub { color: var(--muted); font-size: .88rem; font-weight: 400; }
.ig { color: var(--accent); font-size: .92rem; font-weight: 600; text-decoration: none; }

/* Bottom sheet */
.sheet { margin: auto 0 0; width: 100%; max-width: none; max-height: 92dvh; border-radius: 18px 18px 0 0; background: var(--surface); overflow: hidden; }
.sheet-inner { position: relative; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain; padding-bottom: env(safe-area-inset-bottom); }
.sheet-close { position: absolute; top: 10px; right: 10px; z-index: 1; }
.sheet h2 { font-size: 1.25rem; line-height: 1.25; }
.gallery { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; background: #eeeef2; }
.gallery .zoom { position: relative; flex: none; width: 100%; padding: 0; border: 0; background: none; scroll-snap-align: center; cursor: zoom-in; }
.gallery .zoom::after {
  content: "⤢"; position: absolute; right: 10px; bottom: 10px; width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(0, 0, 0, .55); color: #fff; font-size: 1.1rem;
}
.gallery img { display: block; width: 100%; max-height: 52dvh; aspect-ratio: 1; object-fit: contain; }

/* Full-screen photo viewer */
.viewer { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #000; }
.viewer::backdrop { background: #000; }
.viewer-track { display: flex; width: 100%; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.viewer-track::-webkit-scrollbar { display: none; }
.viewer-track img { flex: none; width: 100%; height: 100%; object-fit: contain; scroll-snap-align: center; }
.viewer-close, .viewer-nav {
  position: absolute; z-index: 1; width: 48px; height: 48px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .16); color: #fff; font-size: 1.8rem; line-height: 1;
}
.viewer-close { top: calc(12px + env(safe-area-inset-top)); right: 12px; }
.viewer-nav { top: 50%; transform: translateY(-50%); }
.viewer-nav.prev { left: 12px; }
.viewer-nav.next { right: 12px; }
.viewer-count {
  position: absolute; top: calc(22px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  color: #fff; font-weight: 600; text-shadow: 0 1px 3px #000;
}
/* phones swipe; the arrows are for a mouse */
@media (hover: none) { .viewer-nav { display: none; } }
.viewer.single .viewer-nav { display: none; }
.gallery.none { display: grid; place-items: center; height: 110px; color: #b4b4c0; }
.gallery.none svg { width: 44px; }
.sheet-body { display: grid; gap: 14px; padding: 16px; }
.options { display: grid; gap: 8px; }
.options.two { grid-template-columns: 1fr 1fr; }
.option {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 50px; padding: 8px 14px; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; font-weight: 600;
}
.option.variant { display: grid; justify-content: start; gap: 0; }
.option[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.qty-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 600; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--cartbar) + env(safe-area-inset-bottom) + 12px); z-index: 20;
  transform: translateX(-50%); padding: 10px 18px; border-radius: 999px;
  background: var(--dark); color: #fff; font-weight: 600; white-space: nowrap;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-weight: 600; text-decoration: none;
}
.btn:active { background: #eeeef2; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.small { min-height: 42px; min-width: 96px; border-color: var(--accent); color: var(--accent); }
.btn.block { width: 100%; }
.icon-btn { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); font-size: 1.4rem; line-height: 1; }
.link { background: none; border: 0; min-height: 44px; padding: 0; color: var(--muted); text-decoration: underline; justify-self: start; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); font-weight: 600; }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

.stepper { flex: none; display: inline-flex; align-items: center; border: 1px solid var(--accent); border-radius: 10px; overflow: hidden; background: var(--surface); }
.stepper button { width: 42px; height: 40px; border: 0; background: transparent; color: var(--accent); font-size: 1.3rem; font-weight: 700; }
.stepper button:active { background: var(--accent-soft); }
.stepper span { min-width: 26px; text-align: center; font-weight: 700; }

/* Custom request */
.custom {
  display: grid; gap: 12px; padding: 16px; margin: 0 12px 24px;
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: var(--radius);
}
.custom h2 { font-size: 1.1rem; }
.custom p { color: var(--muted); }
.custom-actions { display: grid; gap: 8px; }

.footer { padding-top: 16px; padding-bottom: 32px; border-top: 1px solid var(--border); color: var(--muted); font-size: .85rem; display: grid; gap: 8px; }
.footer a { color: var(--accent); font-weight: 600; text-decoration: none; }

/* Dialogs */
dialog { padding: 0; border: 0; color: var(--text); background: var(--bg); }
dialog::backdrop { background: rgba(10, 10, 14, .55); }
.panel { margin: 0 0 0 auto; width: 100%; height: 100dvh; max-width: none; max-height: none; }
.panel-inner { display: flex; flex-direction: column; height: 100%; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px 16px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.panel-head h2 { font-size: 1.2rem; }
.panel-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 12px 12px calc(20px + env(safe-area-inset-bottom)); display: grid; gap: 14px; align-content: start; }

.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.row { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.row-main { display: grid; min-width: 0; }
.row .price { text-align: right; }
.row-ctl { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; }

.field { display: grid; gap: 6px; }
.field > span { font-size: .9rem; font-weight: 600; }
.field input, .field textarea { width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); resize: vertical; }
.total { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 0 4px; font-size: 1.15rem; font-weight: 700; }
.hint { color: var(--muted); font-size: .9rem; }
.actions { display: grid; gap: 8px; }

.receipt { background: #fff; border: 1px solid var(--border); border-top: 4px solid var(--accent); border-radius: var(--radius); padding: 14px; display: grid; gap: 12px; }
.receipt-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 8px; }
.receipt-head strong { font-size: 1.15rem; }
.receipt-head span, .receipt dt { color: var(--muted); }
.receipt dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; font-size: .9rem; }
.receipt dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.receipt ol { margin: 0; padding: 0; list-style: none; counter-reset: item; }
.receipt li { counter-increment: item; display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--border); }
.receipt li strong::before { content: counter(item) ". "; }
.receipt li div { display: grid; }
.receipt .price { text-align: right; }
.receipt-total { display: flex; justify-content: space-between; gap: 12px; font-size: 1.1rem; font-weight: 800; padding-top: 10px; border-top: 2px solid var(--text); }
.receipt-note { font-size: .9rem; overflow-wrap: anywhere; }

/* Narrow phones: language and currency pickers shrink before the shop name does */
@media (max-width: 400px) {
  .topbar select { max-width: 76px; }
}

/* Tablet and desktop: cart moves to the header, the panel becomes a side drawer */
@media (min-width: 721px) {
  body { padding-bottom: 0; }
  .cartbar { display: none; }
  .cart-btn {
    display: inline-flex; align-items: center; gap: 8px; flex: none;
    height: 40px; padding: 0 14px; border: 0; border-radius: 8px;
    background: var(--accent); color: #fff; font-weight: 700;
  }
  .page, .topbar-inner { padding-inline: 16px; }
  h1 { font-size: 1.5rem; }
  .searchbar-inner { padding-inline: 16px; }
  .search-clear { right: 17px; }
  .tiles { grid-template-columns: repeat(5, 1fr); gap: 10px; }
  .rowlinks { grid-template-columns: 1fr 1fr; }
  :is(.tile, .rowlink):hover { border-color: var(--accent); }
  .grid { grid-template-columns: repeat(4, 1fr); gap: 12px; }
  .card:hover { border-color: var(--accent); }
  .sheet { margin: auto; width: 460px; border-radius: 18px; }
  .gallery img { max-height: 46dvh; }
  .btn:hover { border-color: var(--text); }
  .btn.primary:hover, .cart-btn:hover { filter: brightness(1.1); }
  .custom { grid-template-columns: 1fr auto; align-items: center; margin-inline: auto; padding: 18px 20px; }
  .custom-actions { grid-auto-flow: column; }
  .panel { width: 460px; }
}

/* Order: numbered steps to send the order */
.order-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; counter-reset: step; }
.order-steps li {
  display: grid; gap: 6px; padding: 12px 14px 14px;
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: var(--radius);
}
.order-steps strong { line-height: 1.3; }

/* Product photos: counter and arrows when there is more than one photo */
.gallery-wrap { position: relative; }
.gallery-count {
  position: absolute; top: 12px; left: 12px; padding: 3px 10px; border-radius: 999px;
  background: rgba(0, 0, 0, .6); color: #fff; font-size: .85rem; font-weight: 700; pointer-events: none;
}
.gallery-nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .92); color: var(--text); font-size: 1.8rem; line-height: 1; box-shadow: 0 1px 6px rgba(0, 0, 0, .25);
}
.gallery-nav.prev { left: 10px; }
.gallery-nav.next { right: 10px; }
