:root {
  --bg: #f5f3ef; --card: #ffffff; --ink: #14181f; --muted: #646c78; --accent: #ff6a2a; --accent-ink: #fff; --line: #e3e0da; --night: #0f1b2d;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.5 var(--sans); }
a { color: var(--accent); }
.hidden { display: none !important; }
.small { font-size: 14px; color: var(--muted); }
.center { text-align: center; }

.top { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 16px; max-width: 1120px; margin: 0 auto; }
.brand { font-weight: 800; font-size: 22px; color: var(--ink); text-decoration: none; letter-spacing: -.5px; }
.brand span { color: var(--accent); }
.top-right { display: flex; gap: 8px; align-items: center; }
.top select { font: inherit; font-size: 14px; padding: 4px 6px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); }
.price-pill { font-size: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 99px; padding: 4px 12px; white-space: nowrap; }
@media (max-width: 480px) { .price-pill { display: none; } }

main { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.hero { display: grid; grid-template-columns: 1.2fr 1fr; gap: 32px; align-items: center; padding: 36px 0 40px; }
@media (max-width: 820px) { .hero { grid-template-columns: 1fr; text-align: center; } .hero-img { max-width: 260px; margin: 0 auto; } }
.hero h1 { font-size: clamp(34px, 6vw, 60px); line-height: 1.05; letter-spacing: -1.5px; margin: 0 0 16px; }
.hero h1 em { color: var(--accent); font-style: normal; }
.lead { font-size: 19px; color: var(--muted); margin: 0 0 24px; }
.cta { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
@media (max-width: 820px) { .cta { justify-content: center; } }
.hero-img { width: 100%; height: auto; border-radius: 6px; box-shadow: 0 24px 60px rgba(15,27,45,.35); transform: rotate(2deg); }

.btn { display: inline-block; border: 0; border-radius: 12px; background: var(--accent); color: var(--accent-ink); font: 600 16px var(--sans); padding: 12px 18px; cursor: pointer; text-decoration: none; text-align: center; }
.btn:disabled { opacity: .6; cursor: wait; }
.btn-big { font-size: 18px; padding: 15px 24px; box-shadow: 0 6px 18px rgba(255,106,42,.3); }
.btn-ghost { background: var(--card); color: var(--ink); border: 1px solid var(--line); box-shadow: none; }

.editor { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; padding: 10px 0 40px; }
@media (max-width: 820px) { .editor { grid-template-columns: 1fr; } }
.preview-wrap { position: sticky; top: 12px; }
@media (max-width: 820px) { .preview-wrap { position: static; } }
.preview { aspect-ratio: 210 / 297; background: var(--night); border-radius: 6px; overflow: hidden; display: grid; place-items: center; box-shadow: 0 16px 40px rgba(0,0,0,.18); transition: opacity .2s; }
.preview.loading { opacity: .6; }
.preview img { width: 100%; height: 100%; object-fit: contain; display: block; }
.spinner { width: 36px; height: 36px; border: 4px solid rgba(255,255,255,.2); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 4px; margin-bottom: 14px; }
.tabs input { position: absolute; opacity: 0; }
.tabs span { display: block; text-align: center; padding: 10px; border-radius: 9px; cursor: pointer; font-weight: 600; }
.tabs input:checked + span { background: var(--ink); color: #fff; }

.controls fieldset { border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 14px 16px 16px; margin: 0 0 14px; }
.controls legend { font-weight: 700; padding: 0 6px; }
.controls label { display: block; margin: 8px 0; font-size: 15px; }
.controls input:not([type=radio]):not([type=checkbox]), .controls select, .controls textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; margin-top: 4px; }
.controls textarea { font-family: ui-monospace, Menlo, monospace; font-size: 14px; }
.row { display: flex; gap: 10px; }
.row label { flex: 1; }
.row .narrow { flex: 0 0 34%; }
.sub { margin: 12px 0 4px; font-size: 15px; font-weight: 600; }
.choices { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.choices label { margin: 0; }
.choices input { position: absolute; opacity: 0; }
.choices span { display: inline-flex; gap: 6px; align-items: center; padding: 8px 13px; border: 1px solid var(--line); border-radius: 99px; cursor: pointer; background: #fff; font-size: 15px; }
.choices b { font-weight: 500; }
.choices input:checked + span { background: var(--ink); color: #fff; border-color: var(--ink); }
.choices input:disabled + span { opacity: .4; cursor: not-allowed; }
.choices input:focus-visible + span { outline: 2px solid var(--accent); }
.swatches i { width: 16px; height: 16px; border-radius: 50%; border: 3px solid; display: inline-block; }
.check { display: flex !important; gap: 10px; align-items: flex-start; }
.check input { margin-top: 3px; width: 20px; height: 20px; flex: none; accent-color: var(--accent); }
.formats { display: grid; gap: 8px; margin: 4px 0 12px; }
.formats input { position: absolute; opacity: 0; }
.formats span { display: block; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-weight: 600; }
.formats input:checked + span { border: 2px solid var(--accent); background: #fff6f1; }
.formats .small { margin: 0; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 6px 0; }
@media (max-width: 380px) { .facts { grid-template-columns: 1fr; } }
.facts label { margin: 0 !important; }
.facts input { position: absolute; opacity: 0; }
.facts span { display: grid; grid-template-columns: 26px 1fr; grid-template-rows: auto auto; column-gap: 6px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; height: 100%; box-sizing: border-box; }
.facts i { grid-row: 1 / 3; font-style: normal; font-size: 20px; }
.facts b { font-size: 13px; font-weight: 600; line-height: 1.2; }
.facts em { font-style: normal; font-size: 13px; color: var(--muted); }
.facts input:checked + span { border: 2px solid var(--accent); background: #fff6f1; }
.facts input:disabled + span { opacity: .45; cursor: not-allowed; }
.facts input:focus-visible + span { outline: 2px solid var(--accent); }
.choices .emoji { font-size: 22px; padding: 4px 10px; }
.custom { margin-top: 10px; }
.custom summary { font-weight: 600; font-size: 15px; cursor: pointer; }
#bg-photo { margin-top: 6px; }
#bg-photo .btn { margin-top: 4px; }
.logo-box { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.logo-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
#logo-thumb { height: 52px; max-width: 140px; object-fit: contain; padding: 4px; border: 1px solid var(--line); border-radius: 8px;
  background: repeating-conic-gradient(#eee 0 25%, #fff 0 50%) 0 0 / 12px 12px; }
#logo-opts { margin-top: 8px; }
#logo-opts input[type=range] { width: 100%; accent-color: var(--accent); }
#logo-size-out { font-weight: 600; }
.count { font-weight: 700; font-size: 18px; margin: 6px 0; }
.buy .btn-big { width: 100%; margin-top: 8px; }
.error { color: #b00020; font-weight: 600; min-height: 1em; }

.audiences { padding: 30px 0 10px; }
.audiences h2, .faq h2 { letter-spacing: -.5px; }
.cards, .steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 760px) { .cards, .steps { grid-template-columns: 1fr; } }
.cards div, .steps div { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.cards h3, .steps h3 { margin: 6px 0 4px; }
.cards p, .steps p { margin: 0; color: var(--muted); }
.cards div:nth-child(3) { background: var(--night); color: #f3efe6; border-color: var(--night); }
.cards div:nth-child(3) p { color: #b9c6d8; }
.steps { padding: 30px 0; }
.steps b { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff; }
.faq { max-width: 760px; margin: 0 auto; padding: 10px 0 40px; }
.faq details { border-bottom: 1px solid var(--line); padding: 10px 0; }
.faq summary { font-weight: 600; cursor: pointer; }
.foot { text-align: center; padding: 30px 16px; font-size: 14px; color: var(--muted); border-top: 1px solid var(--line); }

.page { max-width: 760px; margin: 0 auto; padding: 20px 16px 60px; }
.done { text-align: center; padding: 60px 16px; }
.done .links { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 20px 0; }

/* Duathlon / triathlon: one GPX per leg */
.legs { margin: 10px 0; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 12px; }
#leg-slots { display: flex; flex-wrap: wrap; gap: 8px; }
.legs .leg { display: inline-flex; align-items: center; gap: 8px; margin: 0; padding: 7px 12px; border: 1px solid var(--line); border-radius: 99px; background: #fff; cursor: pointer; font-size: 15px; }
.legs .leg .dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.legs .leg b { font-weight: 600; }
.legs .leg .pick { color: var(--accent); font-weight: 700; font-size: 13px; }
.legs .leg.done .pick { color: #2f7d4f; }

/* Download in progress */
.btn.busy { opacity: .75; pointer-events: none; }
.btn.busy::before { content: ''; display: inline-block; width: 16px; height: 16px; margin-right: 10px; vertical-align: -2px; border-radius: 50%; border: 3px solid rgba(0,0,0,.2); border-top-color: currentColor; animation: dlspin 0.9s linear infinite; }
@keyframes dlspin { to { transform: rotate(360deg); } }

/* Printed orders: copies + "do we deliver to you?" */
#ship { margin: 8px 0 4px; }
.ship-row { display: flex; gap: 10px; flex-wrap: wrap; }
.ship-row label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; margin: 0; }
.ship-row select { padding: 7px 8px; border-radius: 8px; border: 1px solid #ccc; font: inherit; background: #fff; color: #222; }
.ship-msg { margin: 8px 0 4px; }
.ship-no { color: #b00; }
.ship-contact a, .ship-msg a { color: inherit; }
