:root {
  --ink: #f6f1ea;
  --ink-dim: rgba(246, 241, 234, 0.64);
  --accent: #ff7a1a;
  --bg: #0b0812;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Barlow", ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------- intro / outro (tight rhythm — no forced viewport heights) ---------- */

.intro {
  padding: max(96px, 13vh) max(24px, 6vw) 40px;
  max-width: 880px;
}

.intro__eyebrow, .outro__eyebrow {
  margin: 0 0 10px;
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
}

.intro__title {
  margin: 0 0 20px;
  font-family: "Barlow Condensed", "Barlow", sans-serif;
  font-weight: 800;
  font-size: clamp(52px, 9vw, 112px);
  line-height: 0.92;
}

.intro__lede {
  margin: 0 0 14px;
  max-width: 54ch;
  font-size: clamp(15px, 1.8vw, 18px);
  font-weight: 500;
  line-height: 1.55;
}

.intro__what {
  margin: 0 0 18px;
  max-width: 60ch;
  font-size: clamp(13.5px, 1.5vw, 15.5px);
  line-height: 1.6;
  color: var(--ink-dim);
}

.intro__uses {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.intro__uses li {
  padding: 7px 14px;
  border: 1px solid rgba(246, 241, 234, 0.2);
  border-radius: 999px;
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.outro {
  padding: 72px max(24px, 6vw) 140px;
  max-width: 880px;
}

.outro__title {
  margin: 0 0 16px;
  font-family: "Barlow Condensed", "Barlow", sans-serif;
  font-weight: 800;
  font-size: clamp(40px, 6.5vw, 76px);
  line-height: 0.95;
}

.outro__body {
  margin: 0 0 12px;
  max-width: 56ch;
  font-size: clamp(14px, 1.6vw, 16.5px);
  line-height: 1.6;
}

.outro__body--dim { color: var(--ink-dim); }

.outro__cta {
  display: inline-block;
  width: fit-content;
  margin-top: 18px;
  padding: 14px 26px;
  border-radius: 999px;
  background: var(--accent);
  color: #140b03;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  transition: transform 160ms var(--ease-out), box-shadow 200ms ease;
  box-shadow: 0 8px 30px rgba(255, 122, 26, 0.25);
}

.outro__cta:hover { transform: translateY(-1px); box-shadow: 0 12px 40px rgba(255, 122, 26, 0.35); }
.outro__cta:active { transform: scale(0.97); }

.fallback { padding: 20vh 24px; text-align: center; color: var(--ink-dim); }

/* ---------- playground layout ---------- */

.playground {
  display: grid;
  grid-template-columns: minmax(260px, 340px) auto;
  justify-content: center;
  align-items: center;
  gap: clamp(28px, 5vw, 84px);
  padding: 24px max(24px, 4vw) 48px;
}

.rail__title {
  margin: 0 0 14px;
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

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

.rail__list li {
  position: relative;
  padding-left: 24px;
  transition: opacity 300ms ease;
  opacity: 0.5;
}

.rail__list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid rgba(246, 241, 234, 0.35);
  transition: background 250ms ease, border-color 250ms ease, transform 250ms var(--ease-out);
}

.rail__list li.is-felt { opacity: 1; }

.rail__list li.is-felt::before {
  background: var(--accent);
  border-color: var(--accent);
  transform: scale(1.25);
}

.rail__list b {
  display: block;
  font-family: "Barlow Condensed", "Barlow", sans-serif;
  font-weight: 700;
  font-size: 19px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.rail__list span {
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-dim);
}

.rail__done {
  margin: 18px 0 0;
  padding-left: 24px;
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
}

/* ---------- the phone ---------- */

.device { display: grid; justify-items: center; }

.phone {
  --app-bg: #f6f1ea;
  --app-ink: #17120c;
  --app-dim: rgba(23, 18, 12, 0.55);
  --app-card: #ffffff;
  --app-line: rgba(23, 18, 12, 0.1);
  --app-well: rgba(23, 18, 12, 0.06);
  position: relative;
  width: min(390px, calc(100vw - 32px));
  height: min(760px, max(560px, 86vh));
  border-radius: 44px;
  background: var(--app-bg);
  color: var(--app-ink);
  border: 1px solid rgba(246, 241, 234, 0.14);
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.55), 0 0 0 8px rgba(255, 255, 255, 0.03);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: background-color 450ms ease, color 450ms ease;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.phone[data-theme="dark"] {
  --app-bg: #141020;
  --app-ink: #f6f1ea;
  --app-dim: rgba(246, 241, 234, 0.55);
  --app-card: #1e1930;
  --app-line: rgba(246, 241, 234, 0.1);
  --app-well: rgba(246, 241, 234, 0.07);
}

/* coach chip */
.coach {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translate(-50%, 0);
  z-index: 40;
  max-width: 86%;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(15, 11, 22, 0.86);
  color: #f6f1ea;
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: opacity 250ms ease, transform 350ms var(--ease-out);
}

.coach.is-out { opacity: 0; transform: translate(-50%, -8px); }

/* app bar */
.app-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 54px 20px 10px;
}

.app-brand {
  margin: 0;
  font-family: "Barlow Condensed", "Barlow", sans-serif;
  font-weight: 800;
  font-size: 24px;
  letter-spacing: 0.06em;
}

.app-bar__side { display: flex; align-items: center; gap: 12px; }

/* theme switch */
.theme {
  border: 0;
  padding: 4px;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.theme__track {
  display: block;
  width: 46px;
  height: 27px;
  border-radius: 999px;
  background: var(--app-well);
  border: 1px solid var(--app-line);
  position: relative;
  transition: background-color 450ms ease;
}

.phone[data-theme="dark"] .theme__track { background: var(--accent); border-color: transparent; }

.theme__knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: var(--app-card);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  will-change: transform;
}

/* bag button */
.bag {
  position: relative;
  border: 0;
  margin: 0;
  padding: 6px;
  background: none;
  color: var(--app-ink);
  cursor: pointer;
  transition: transform 140ms var(--ease-out), color 450ms ease;
  -webkit-tap-highlight-color: transparent;
}

.bag:active { transform: scale(0.92); }
.bag svg { width: 26px; height: 26px; display: block; }

.bag__badge {
  position: absolute;
  top: 0;
  right: -2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #140b03;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  will-change: transform;
}

/* tabs — clipped color slide */
.tabs {
  position: relative;
  margin: 8px 20px 4px;
  border-radius: 999px;
  background: var(--app-well);
  transition: background-color 450ms ease;
}

.tabs__base, .tabs__active {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.tabs__base button, .tabs__active span {
  padding: 9px 0;
  text-align: center;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.tabs__base button {
  border: 0;
  background: none;
  color: var(--app-dim);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 450ms ease;
}

.tabs__active {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--app-ink);
  color: var(--app-bg);
  pointer-events: none;
  will-change: clip-path;
  clip-path: inset(0 50% 0 0 round 999px);
  transition: background-color 450ms ease, color 450ms ease;
}

/* panels */
.panels { position: relative; flex: 1; min-height: 0; }

.panel {
  position: absolute;
  inset: 0;
  padding: 10px 20px 20px;
  overflow: hidden auto;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateX(8px);
  pointer-events: none;
  transition: opacity 220ms ease, transform 260ms var(--ease-out);
}

.panel.is-on { display: flex; }

.panel__foot {
  margin: auto 0 0;
  padding-top: 18px;
  text-align: center;
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--app-dim);
}

.panel.is-on { opacity: 1; transform: none; pointer-events: auto; }

.panel__empty {
  margin: 48px 0 0;
  text-align: center;
  font-size: 14px;
  line-height: 1.6;
  color: var(--app-dim);
}

/* product / bag rows */
.row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  margin-bottom: 10px;
  border-radius: 18px;
  background: var(--app-card);
  border: 1px solid var(--app-line);
  overflow: hidden;
  will-change: transform;
  transition: background-color 450ms ease, border-color 450ms ease;
}

.row__tile {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  font-size: 24px;
  border-radius: 12px;
  background: var(--app-well);
  transition: background-color 450ms ease;
}

.row__info { flex: 1; min-width: 0; }

.row__name { margin: 0; font-size: 14.5px; font-weight: 600; line-height: 1.25; }
.row__price { margin: 1px 0 0; font-size: 12.5px; color: var(--app-dim); }

/* heart */
.heart {
  border: 0;
  background: none;
  padding: 6px;
  cursor: pointer;
  color: var(--app-dim);
  -webkit-tap-highlight-color: transparent;
}

.heart svg { width: 20px; height: 20px; display: block; will-change: transform; }
.heart.is-on { color: #ff3b6b; }
.heart.is-on svg path { fill: currentColor; }

/* add button */
.add {
  position: relative;
  border: 0;
  margin: 0;
  padding: 9px 14px;
  min-width: 74px;
  border-radius: 999px;
  background: var(--app-ink);
  color: var(--app-bg);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  will-change: transform;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 450ms ease, color 450ms ease;
}

.add__label { display: inline-block; transition: opacity 180ms ease, filter 180ms ease; }
.add.is-added { background: var(--accent); color: #140b03; }
.add.is-swapping .add__label { opacity: 0.3; filter: blur(3px); }

/* scrim behind sheet */
.scrim {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: rgba(10, 7, 16, 0.5);
  opacity: 0;
  pointer-events: none;
}

.scrim.is-active { pointer-events: auto; }

/* bottom sheet */
.sheet {
  position: absolute;
  z-index: 30;
  left: 0;
  right: 0;
  bottom: 0;
  height: 78%;
  border-radius: 26px 26px 0 0;
  background: var(--app-card);
  border: 1px solid var(--app-line);
  border-bottom: 0;
  box-shadow: 0 -18px 50px rgba(0, 0, 0, 0.22);
  transform: translateY(105%);
  will-change: transform;
  display: flex;
  flex-direction: column;
  touch-action: none;
  transition: background-color 450ms ease, border-color 450ms ease;
}

.sheet__grab {
  padding: 10px 0 6px;
  display: grid;
  place-items: center;
  cursor: grab;
  touch-action: none;
}

.sheet__grab span {
  width: 42px;
  height: 5px;
  border-radius: 3px;
  background: var(--app-line);
}

.sheet__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 20px 8px;
}

.sheet__head h2 {
  margin: 0;
  font-family: "Barlow Condensed", "Barlow", sans-serif;
  font-weight: 800;
  font-size: 24px;
  letter-spacing: 0.02em;
}

.sheet__hint { margin: 0; font-size: 11.5px; color: var(--app-dim); }
.sheet__hint b { color: var(--app-ink); }

.sheet__items { padding: 4px 16px 0; overflow: hidden; }

.sheet__empty {
  margin: 26px 0;
  text-align: center;
  font-size: 13.5px;
  color: var(--app-dim);
}

/* bag row extras: hold-to-delete pad */
.zap {
  position: relative;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: var(--app-well);
  color: var(--app-dim);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  transition: transform 140ms var(--ease-out), background-color 450ms ease;
}

.zap:active { transform: scale(0.92); }

.zap__fill {
  position: absolute;
  inset: 0;
  background: #e5484d;
  clip-path: inset(0 100% 0 0);
  will-change: clip-path;
}

.zap__x { position: relative; z-index: 1; }
.zap.is-arming .zap__x { color: #fff; }

.row.is-arming { border-color: rgba(229, 72, 77, 0.5); }

/* sheet foot: total + field + order */
.sheet__foot { padding: 8px 20px 20px; margin-top: auto; }

.sheet__total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 2px 12px;
  border-top: 1px solid var(--app-line);
  font-size: 14px;
}

.sheet__total b { font-size: 18px; }

.field { display: block; margin-bottom: 12px; }

.field > span {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--app-dim);
}

.field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1.5px solid var(--app-line);
  background: var(--app-bg);
  color: var(--app-ink);
  font: inherit;
  font-size: 15px;
  outline: none;
  transition: border-color 200ms ease, background-color 450ms ease;
  will-change: transform;
}

.field input:focus { border-color: var(--app-ink); }
.field.is-err input { border-color: #e5484d; }

.field__err {
  display: block;
  height: 0;
  overflow: hidden;
  margin: 0;
  font-size: 12px;
  font-style: normal;
  color: #e5484d;
  opacity: 0;
  transition: opacity 200ms ease, height 200ms ease, margin 200ms ease;
}

.field.is-err .field__err { height: 16px; margin-top: 6px; opacity: 1; }

.order {
  width: 100%;
  border: 0;
  padding: 15px 0;
  border-radius: 16px;
  background: var(--accent);
  color: #140b03;
  font: inherit;
  font-size: 15.5px;
  font-weight: 700;
  cursor: pointer;
  will-change: transform;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

.order__label { display: inline-block; transition: opacity 160ms ease, filter 160ms ease; }
.order.is-busy .order__label { opacity: 0; filter: blur(4px); }

.order__spin {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.order__spin::after {
  content: "";
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2.5px solid rgba(20, 11, 3, 0.25);
  border-top-color: #140b03;
  animation: spin 450ms linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* confirmation */
.sheet__confirm {
  padding: 34px 20px;
  text-align: center;
}

.sheet__confirm-mark {
  display: inline-grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--accent);
  color: #140b03;
  font-size: 26px;
  font-weight: 700;
  will-change: transform;
}

.sheet__confirm h3 {
  margin: 14px 0 4px;
  font-family: "Barlow Condensed", "Barlow", sans-serif;
  font-weight: 800;
  font-size: 30px;
}

.sheet__confirm p { margin: 0; font-size: 14px; color: var(--app-dim); }

/* toast */
.toast {
  position: absolute;
  z-index: 50;
  left: 16px;
  right: 16px;
  bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  border-radius: 16px;
  background: rgba(15, 11, 22, 0.92);
  color: #f6f1ea;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
  will-change: transform, opacity;
  touch-action: none;
  cursor: grab;
}

.toast[hidden] { display: none; }

.toast p { margin: 0; font-size: 13.5px; font-weight: 500; }

.toast button {
  border: 0;
  background: none;
  padding: 4px 6px;
  color: var(--accent);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* shake (gated by reduced motion) */
.shake { animation: shake 340ms cubic-bezier(0.36, 0.07, 0.19, 0.97); }

@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}

/* heart pop ring */
.heart__ring {
  position: absolute;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid #ff3b6b;
  pointer-events: none;
  opacity: 0;
}

.heart__ring.is-live { animation: ring 420ms var(--ease-out) forwards; }

@keyframes ring {
  0% { opacity: 0.8; transform: scale(0.4); }
  100% { opacity: 0; transform: scale(1.25); }
}

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .playground {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 26px;
    padding-bottom: 40px;
  }

  .rail { width: 100%; max-width: 560px; }

  .rail__list {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px 14px;
  }

  .rail__list span { display: none; }

  .rail__list b { font-size: 16px; }

  .phone { height: min(700px, 82vh); }
}

/* ---------- reduced motion: everything works, nothing lurches ---------- */

@media (prefers-reduced-motion: reduce) {
  .shake { animation: none; }
  .heart__ring.is-live { animation: none; }
  .order__spin::after { animation-duration: 1.2s; }
  .panel { transition: opacity 180ms ease; transform: none; }
  .coach { transition: opacity 180ms ease; }
}
