:root {
  --accent: #1f5fd6; --ink: #16181d; --muted: #666c78; --line: #e3e5ea; --soft: #f5f6f8; --bg: #fff;
  --ok: #17794a; --bad: #b3261e; --radius: 10px; color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; min-height: 100%; }
body {
  font: 16px/1.5 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; color: var(--ink); background: var(--bg);
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--accent); }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 20px 0 12px; }
h2 { font-size: 1.15rem; margin: 26px 0 10px; }
h3 { font-size: 1rem; margin: 20px 0 4px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
code { background: var(--soft); padding: 2px 5px; border-radius: 4px; font-size: .86em; word-break: break-all; }
small, .small { font-size: .84rem; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* controls are never text to select */
button, select, .btn, [role='button'], input[type='range'], .chips a, .tabs a, .slot, .day, .choice {
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); }
main.wrap { padding-bottom: 56px; }
.narrow { max-width: 580px; margin: 0 auto; }

.top { position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
.bar { display: flex; align-items: center; gap: 12px; min-height: 54px; }
.brand { font-weight: 700; font-size: 1.1rem; color: var(--ink); text-decoration: none; min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { display: flex; gap: 4px; flex: none; }
.nav a { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 10px; border-radius: 8px; color: var(--ink); text-decoration: none; font-size: .95rem; white-space: nowrap; }
.nav a:hover { background: var(--soft); }
.count { background: var(--accent); color: #fff; border-radius: 99px; min-width: 20px; height: 20px; padding: 0 6px; font-size: .75rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }

.tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.tabs a { text-align: center; padding: 11px 2px; color: var(--muted); text-decoration: none; font-size: .93rem; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--ink); border-color: var(--accent); font-weight: 600; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); color: var(--ink);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--soft); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(.93); }
.btn.danger { color: var(--bad); }
.btn.link { border: 0; background: none; color: var(--accent); font-weight: 500; }
.btn.small { min-height: 36px; padding: 0 12px; margin-top: 6px; font-size: .9rem; }
.btn.wide { width: 100%; }
.btn.grow { flex: 1; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.social svg { width: 20px; height: 20px; }
.btn.social.apple { background: #000; border-color: #000; color: #fff; }

.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.row.between { justify-content: space-between; }
.row.actions { margin-top: 6px; flex-wrap: wrap; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
form + form { margin-top: 14px; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-weight: 600; font-size: .92rem; }
.field small { color: var(--muted); }
input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=color]), select, textarea {
  width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid #c9cdd5; border-radius: var(--radius);
  font: inherit; background: #fff; color: var(--ink);
}
textarea { resize: vertical; }
input[type=color] { width: 100%; height: 44px; padding: 3px; border: 1px solid #c9cdd5; border-radius: var(--radius); background: #fff; }
input[type=file] { font: inherit; max-width: 100%; }
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input:disabled, textarea:disabled { background: var(--soft); }
.check { display: flex; gap: 10px; align-items: flex-start; min-height: 40px; padding: 6px 0; cursor: pointer; }
.check input, .choice input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }

.choices { display: grid; gap: 10px; }
.choice { display: flex; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.choice:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.choice small { display: block; color: var(--muted); }
.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.day { position: relative; }
.day input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.day span { display: flex; align-items: center; justify-content: center; min-height: 42px; border: 1px solid var(--line); border-radius: 8px; font-size: .85rem; }
.day input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.day input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.steps { display: flex; gap: 6px; margin: 24px 0 6px; }
.steps span { flex: 1; height: 4px; border-radius: 4px; background: var(--line); }
.steps .past { background: color-mix(in srgb, var(--accent) 45%, white); }
.steps .on { background: var(--accent); }
.checklist { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 8px; color: var(--muted); }
.checklist .done { color: var(--ink); }

.tagline { color: var(--muted); margin: 18px 0 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; }
.chips a { min-height: 38px; display: inline-flex; align-items: center; padding: 0 14px; border: 1px solid var(--line); border-radius: 99px; color: var(--ink); text-decoration: none; font-size: .92rem; }
.chips a.on { background: var(--ink); border-color: var(--ink); color: #fff; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 18px; margin-top: 18px; }
.card { color: inherit; text-decoration: none; display: flex; flex-direction: column; min-width: 0; }
.thumb, .hero, .mini { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius); background: var(--soft); }
.blank { display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 3rem; color: color-mix(in srgb, var(--accent) 55%, white); background: color-mix(in srgb, var(--accent) 9%, white); }
.mini { width: 48px; flex: none; border-radius: 8px; }
.mini.blank { font-size: 1.2rem; }
.card-body { padding: 9px 2px 0; }
.card-name { font-weight: 600; overflow-wrap: anywhere; }
.card-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.price { color: var(--muted); }
.price.big { font-size: 1.3rem; color: var(--ink); margin: 2px 0 16px; }
.tag { display: inline-block; font-size: .76rem; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--soft); color: var(--muted); white-space: nowrap; }
.tag.on { background: color-mix(in srgb, var(--ok) 13%, white); color: var(--ok); }
.tag.off { background: color-mix(in srgb, var(--bad) 11%, white); color: var(--bad); }

.product { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 36px; margin-top: 24px; align-items: start; }
.product h1 { margin: 8px 0 4px; }
.product form { display: flex; flex-direction: column; gap: 14px; }
.desc { margin-top: 22px; overflow-wrap: anywhere; }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.slot { min-height: 42px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font: inherit; cursor: pointer; }
.slot[aria-pressed=true] { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

.lines { list-style: none; margin: 10px 0; padding: 0; border-top: 1px solid var(--line); }
.line { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.line-main { flex: 1; min-width: 0; color: inherit; text-decoration: none; }
.line-name { font-weight: 600; overflow-wrap: anywhere; }
.line-total { font-weight: 600; white-space: nowrap; }
.line .bad { color: var(--bad); font-size: .9rem; }
.qty { display: inline-flex; align-items: center; gap: 2px; margin-top: 6px; }
.qty button, .remove { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font: inherit; font-size: 1.1rem; cursor: pointer; color: var(--ink); }
.qty output { min-width: 34px; text-align: center; font-weight: 600; }
.remove { border: 0; color: var(--muted); font-size: 1.3rem; flex: none; }
.totals { margin: 12px 0; }
.totals div { display: flex; justify-content: space-between; padding: 3px 0; }
.totals dd { margin: 0; }
.totals .grand { font-weight: 700; font-size: 1.1rem; padding-top: 8px; }

.cart { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 36px; align-items: start; }
.cart > p, .cart > .empty { grid-column: 1 / -1; }
.pay { display: flex; flex-direction: column; gap: 10px; background: var(--soft); border-radius: var(--radius); padding: 18px; }
.pay .totals { margin: 0 0 6px; }
.pay small { color: var(--muted); text-align: center; }
#paypal-buttons { min-height: 0; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .88rem; margin: 18px 0; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
.stat { background: var(--soft); border-radius: var(--radius); padding: 14px; color: inherit; text-decoration: none; min-width: 0; }
.stat b { display: block; font-size: 1.3rem; overflow: hidden; text-overflow: ellipsis; }
.stat span { color: var(--muted); font-size: .86rem; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-top: 18px; scroll-margin-top: 70px; }
.panel h2 { margin-top: 0; }
.panel .btn.primary { align-self: flex-start; }
.empty { text-align: center; padding: 56px 0; color: var(--muted); }
.empty h1, .empty h2 { color: var(--ink); }

.toast {
  position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 99px; font-size: .94rem; z-index: 20;
  max-width: calc(100vw - 32px); text-align: center; box-shadow: 0 6px 24px rgb(0 0 0 / .22); transition: opacity .3s;
}
.toast.fade { opacity: 0; }

@media (max-width: 720px) {
  h1 { font-size: 1.4rem; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .product, .cart { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .product { margin-top: 14px; }
  .nav a { padding: 0 8px; }
  .panel { padding: 14px; }
  .blank { font-size: 2.2rem; }
}
@media (pointer: coarse) {
  :root input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]), :root select, :root textarea { font-size: 16px; }
}

p, li, small { overflow-wrap: anywhere; }
input[type=file]::file-selector-button {
  min-height: 40px; padding: 0 14px; margin-right: 10px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; font: inherit; font-weight: 600; color: var(--ink); cursor: pointer;
}
@media (max-width: 720px) { .hero { aspect-ratio: 4 / 3; } }
