/* Tuggle site. One stylesheet, no web fonts: the system rounded face (SF Pro Rounded on Apple devices). */
:root {
  color-scheme: light;
  --cream: #fff7ec;
  --lilac: #eee7ff;
  --ink: #2a1e3f;
  --ink-soft: #5e5275;
  --line: #d9cfee;
  --paper: #fffdf9;
  --coral: #ff6f61;
  --sun: #ffc53d;
  --mint: #34c98e;
  --sky: #4aa8ff;
  --grape: #8e5cf7;
  --focus: #8e5cf7;
  --radius-s: 12px;
  --radius-l: 28px;
  --font: ui-rounded, "SF Pro Rounded", "SF Pro Display", -apple-system, "Hiragino Maru Gothic ProN", "Nunito", "Arial Rounded MT", "Segoe UI", system-ui, sans-serif;
  --step--1: clamp(0.88rem, 0.85rem + 0.15vw, 0.95rem);
  --step-0: clamp(1.02rem, 0.98rem + 0.2vw, 1.12rem);
  --step-1: clamp(1.25rem, 1.15rem + 0.5vw, 1.5rem);
  --step-2: clamp(1.7rem, 1.4rem + 1.4vw, 2.5rem);
  --step-3: clamp(2.5rem, 1.8rem + 3.4vw, 4.6rem);
  --gutter: clamp(16px, 5vw, 56px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.55;
  color: var(--ink);
  background: var(--cream) linear-gradient(170deg, var(--cream) 0%, #fbf1f4 45%, var(--lilac) 100%) fixed;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
h1, h2, h3 { line-height: 1.08; margin: 0; font-weight: 800; letter-spacing: -0.02em; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }

.skip { position: absolute; left: -999px; top: 8px; padding: 8px 14px; background: var(--ink); color: var(--cream); border-radius: var(--radius-s); z-index: 10; }
.skip:focus { left: 8px; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  max-width: 1160px; margin: 0 auto; padding: 18px var(--gutter);
}
.wordmark {
  font-weight: 900; font-size: 1.45rem; letter-spacing: -0.03em; text-decoration: none;
  background: linear-gradient(90deg, var(--coral), var(--grape)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.topnav { display: flex; gap: 22px; font-size: var(--step--1); font-weight: 600; }
.topnav a { text-decoration: none; color: var(--ink-soft); }
.topnav a:hover { color: var(--ink); }
@media (max-width: 720px) { .topnav { display: none; } }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 24px; border-radius: 999px; border: 0;
  font: inherit; font-weight: 750; text-decoration: none; cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn-primary { background: var(--ink); color: var(--cream); box-shadow: 0 6px 0 #170f26; }
.btn-primary:active { box-shadow: 0 3px 0 #170f26; }
.btn-store { background: #000; color: #fff; box-shadow: 0 6px 0 #3a2f52; }
.btn-store::before {
  content: ""; width: 18px; height: 22px; flex: none;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 22'%3E%3Cpath d='M9 4c1.6 0 3-1.4 3-3.4V0c-1.7.1-3.2 1.6-3.2 3.5V4zm5.2 7.7c0-2.3 1.9-3.4 2-3.5-1.1-1.6-2.8-1.8-3.4-1.8-1.4-.1-2.8.9-3.5.9s-1.9-.9-3.1-.8C4.6 6.5 3.1 7.4 2.3 8.9.6 11.8 1.9 16.1 3.5 18.5c.8 1.2 1.8 2.5 3 2.4 1.2 0 1.7-.8 3.1-.8s1.9.8 3.1.8c1.3 0 2.1-1.2 2.9-2.4.9-1.3 1.3-2.6 1.3-2.7-.1 0-2.7-1-2.7-4.1z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 22'%3E%3Cpath d='M9 4c1.6 0 3-1.4 3-3.4V0c-1.7.1-3.2 1.6-3.2 3.5V4zm5.2 7.7c0-2.3 1.9-3.4 2-3.5-1.1-1.6-2.8-1.8-3.4-1.8-1.4-.1-2.8.9-3.5.9s-1.9-.9-3.1-.8C4.6 6.5 3.1 7.4 2.3 8.9.6 11.8 1.9 16.1 3.5 18.5c.8 1.2 1.8 2.5 3 2.4 1.2 0 1.7-.8 3.1-.8s1.9.8 3.1.8c1.3 0 2.1-1.2 2.9-2.4.9-1.3 1.3-2.6 1.3-2.7-.1 0-2.7-1-2.7-4.1z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.btn-store.is-soon { background: #fff; color: var(--ink); box-shadow: inset 0 0 0 2px var(--line); cursor: default; }
.btn-ghost { background: rgba(255, 255, 255, 0.7); color: var(--ink); box-shadow: inset 0 0 0 2px var(--line); }
.btn-ghost:hover { box-shadow: inset 0 0 0 2px var(--grape); }
.btn-small { min-height: 40px; padding: 0 16px; font-size: var(--step--1); }

/* ---------- hero ---------- */
main { display: block; }
.hero {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); align-items: center; gap: clamp(24px, 4vw, 64px);
  max-width: 1160px; margin: 0 auto; padding: clamp(12px, 3vw, 40px) var(--gutter) clamp(48px, 7vw, 96px);
}
.hero h1 { font-size: var(--step-3); letter-spacing: -0.035em; max-width: 11ch; }
.lede { margin-top: 22px; font-size: var(--step-1); line-height: 1.45; color: var(--ink-soft); max-width: 34ch; }
.cta { margin-top: 32px; display: grid; gap: 14px; justify-items: start; }
.cta-note { font-size: var(--step--1); color: var(--ink-soft); }
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .knot { order: -1; max-width: min(360px, 100%); width: 100%; margin: 0 auto; }
}

.knot { margin: 0; position: relative; }
.knot svg { width: 100%; height: auto; overflow: visible; }
.knot figcaption { display: flex; justify-content: center; min-height: 40px; margin-top: 4px; }
.rope use { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.rope .shadow { stroke: rgba(42, 30, 63, 0.14); stroke-width: 34px; transform: translate(0, 7px); }
.rope .edge { stroke-width: 32px; }
.rope .body { stroke-width: 24px; }
.rope .braid { stroke: rgba(255, 255, 255, 0.42); stroke-width: 6px; stroke-dasharray: 2 13; transform: translate(-2px, -4px); }
.rope-coral .edge { stroke: #d9483c; } .rope-coral .body { stroke: var(--coral); }
.rope-sun .edge { stroke: #e09a0c; } .rope-sun .body { stroke: var(--sun); }
.rope-mint .edge { stroke: #1f9a69; } .rope-mint .body { stroke: var(--mint); }
.rope-sky .edge { stroke: #237bd1; } .rope-sky .body { stroke: var(--sky); }
.rope-grape .edge { stroke: #6a37d6; } .rope-grape .body { stroke: var(--grape); }

/* ---------- sections ---------- */
.band, .feature { max-width: 1160px; margin: 0 auto; padding: clamp(48px, 7vw, 88px) var(--gutter); }
.band h2, .feature h2 { font-size: var(--step-2); }
.band > h2 { max-width: 18ch; }

.steps { list-style: none; counter-reset: step; margin: 36px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(16px, 3vw, 40px); }
.step { counter-increment: step; position: relative; padding-top: 26px; border-top: 3px solid var(--ink); }
.step h3 { font-size: var(--step-1); margin-bottom: 10px; }
.step h3::before { content: counter(step) ". "; color: var(--ink-soft); }
.step p { color: var(--ink-soft); max-width: 34ch; }
.step-swatch { position: absolute; top: -9px; left: 0; width: 64px; height: 15px; border-radius: 999px; }
.swatch-coral { background: var(--coral); } .swatch-sun { background: var(--sun); } .swatch-mint { background: var(--mint); }
@media (max-width: 760px) { .steps { grid-template-columns: 1fr; gap: 34px; } }

.feature { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: center; gap: clamp(28px, 5vw, 80px); }
.feature-copy p { margin-top: 16px; color: var(--ink-soft); max-width: 46ch; }
.feature-flip .feature-copy { order: 2; }
@media (max-width: 760px) { .feature { grid-template-columns: 1fr; } .feature-flip .feature-copy { order: 0; } }

/* Duel ticket: shared by the landing page and /d/:code. */
.ticket {
  position: relative; display: grid; justify-items: center; gap: 10px;
  padding: 28px 28px 26px; background: var(--paper); border-radius: var(--radius-l);
  box-shadow: inset 0 0 0 2px var(--line), 0 18px 40px -24px rgba(42, 30, 63, 0.45);
}
.ticket::before, .ticket::after { content: ""; position: absolute; top: 50%; width: 26px; height: 26px; margin-top: -13px; border-radius: 50%; background: var(--cream); box-shadow: inset 0 0 0 2px var(--line); }
.ticket::before { left: -13px; } .ticket::after { right: -13px; }
.ticket-label { font-size: var(--step--1); font-weight: 700; color: var(--ink-soft); }
.ticket-code { font-size: clamp(2.6rem, 2rem + 4vw, 4.2rem); font-weight: 900; letter-spacing: 0.08em; line-height: 1; font-variant-numeric: tabular-nums; color: var(--ink); }
.ticket-foot { font-size: var(--step--1); color: var(--ink-soft); }
.ticket-demo { transform: rotate(-3deg); max-width: 380px; width: 100%; justify-self: center; }

.calendar {
  justify-self: center; display: grid; justify-items: center; gap: 12px; width: min(300px, 100%);
  padding: 26px; background: var(--paper); border-radius: var(--radius-l); box-shadow: inset 0 0 0 2px var(--line);
  transform: rotate(2deg);
}
.calendar-top { width: 100%; text-align: center; padding: 8px; border-radius: var(--radius-s); background: var(--coral); color: #fff; font-weight: 800; }
.calendar-num { font-size: var(--step-2); font-weight: 900; }
.calendar-dots { display: flex; gap: 8px; }
.calendar-dots i { width: 14px; height: 14px; border-radius: 50%; }
.d1 { background: var(--coral); } .d2 { background: var(--sun); } .d3 { background: var(--mint); } .d4 { background: var(--sky); } .d5 { background: var(--grape); }

.band-quiet { border-top: 2px solid var(--line); }
.facts { list-style: none; margin: 28px 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 40px; }
.facts li { color: var(--ink-soft); max-width: 48ch; }
.facts b { color: var(--ink); }
@media (max-width: 760px) { .facts { grid-template-columns: 1fr; } }
.textlink { font-weight: 750; text-decoration-thickness: 2px; text-underline-offset: 4px; text-decoration-color: var(--grape); }

/* ---------- footer ---------- */
.footer {
  max-width: 1160px; margin: 0 auto; padding: 40px var(--gutter) 56px;
  display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 24px; font-size: var(--step--1); color: var(--ink-soft);
  border-top: 2px solid var(--line);
}
.footer-brand p { margin-top: 6px; }
.footer-links, .footer-langs { display: grid; gap: 6px; align-content: start; }
.footer a { color: var(--ink-soft); text-underline-offset: 3px; }
.footer a:hover { color: var(--ink); }
.footer-fine { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.footer-slim { display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; }
@media (max-width: 760px) { .footer { grid-template-columns: 1fr 1fr; } .footer-brand { grid-column: 1 / -1; } }

/* ---------- duel page ---------- */
.duel { max-width: 560px; margin: 0 auto; padding: clamp(16px, 4vw, 40px) var(--gutter) 56px; display: grid; gap: 22px; text-align: center; }
.duel-kicker { font-weight: 750; color: var(--grape); }
.duel-title { font-size: var(--step-2); }
.duel .ticket { margin: 6px 6px 0; }
.copy-status { min-height: 1.4em; font-size: var(--step--1); color: var(--ink-soft); }
.duel-actions { display: grid; gap: 14px; }
.duel-steps { text-align: left; margin: 8px 0 0; padding-left: 1.3em; color: var(--ink-soft); display: grid; gap: 8px; }
.duel-steps b { color: var(--ink); }
.fineprint { font-size: var(--step--1); color: var(--ink-soft); }

/* ---------- legal + 404 ---------- */
.doc { max-width: 760px; margin: 0 auto; padding: 8px var(--gutter) 64px; }
.doc-langs { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 28px; }
.doc-langs a, .doc-langs span { padding: 6px 14px; border-radius: 999px; font-size: var(--step--1); font-weight: 700; text-decoration: none; box-shadow: inset 0 0 0 2px var(--line); background: rgba(255, 255, 255, 0.6); }
.doc-langs [aria-current] { background: var(--ink); color: var(--cream); box-shadow: none; }
.prose { background: var(--paper); border-radius: var(--radius-l); padding: clamp(22px, 5vw, 52px); box-shadow: inset 0 0 0 2px var(--line); }
.prose h1 { font-size: var(--step-2); margin-bottom: 8px; }
.prose h2 { font-size: var(--step-1); margin: 36px 0 10px; }
.prose h3 { font-size: 1.08em; margin: 24px 0 8px; }
.prose p, .prose ul, .prose ol { margin: 12px 0; }
.prose li + li { margin-top: 6px; }
.prose a { overflow-wrap: anywhere; text-decoration-color: var(--grape); text-underline-offset: 3px; }
.prose code { font: inherit; font-weight: 700; }
.prose .table-wrap { overflow-x: auto; margin: 16px 0; }
.prose table { border-collapse: collapse; width: 100%; font-size: var(--step--1); }
.prose th, .prose td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.prose th { font-weight: 800; }
.doc-meta { margin-top: 6px; color: var(--ink-soft); font-size: var(--step--1); }
.doc-nav { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 28px; font-size: var(--step--1); }
.hub { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 12px; }
.hub a { display: block; padding: 18px 22px; border-radius: var(--radius-s); background: var(--paper); box-shadow: inset 0 0 0 2px var(--line); text-decoration: none; font-weight: 750; }
.hub a:hover { box-shadow: inset 0 0 0 2px var(--grape); }
.lost { max-width: 620px; margin: 0 auto; padding: 40px var(--gutter) 80px; display: grid; gap: 18px; justify-items: start; }
.lost h1 { font-size: var(--step-3); }
.lost p { color: var(--ink-soft); font-size: var(--step-1); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn { transition: none; }
}
