/* Colours mirror the app's Toy / HomeToy tokens (Flexi/Sources/Theme/Toy.swift). */
:root {
  --room: #5F4FD6;
  --stage-start: #7A68F0;
  --stage-end: #5B4FD1;
  --ink: #2B1F63;
  --ink-soft: #6E63A8;
  --cream: #FFF6E9;
  --cream-shadow: #CFC5E4;
  --zest: #C8F04C;
  --zest-shadow: #94B92F;
  --nav-idle: #B9AEE8;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: radial-gradient(circle at 50% 26%, var(--stage-start), var(--stage-end) 70%) var(--room);
  color: var(--cream);
  font-family: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

main {
  min-height: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 32px 20px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* The render carries its own painted backdrop, so it is framed as a tile
   rather than left as a hard square on the stage. */
.flexi {
  width: min(64vw, 280px);
  height: auto;
  border-radius: 40px;
}

/* The live rig draws on a clear artboard: no tile, and a square box. */
canvas.flexi.live {
  aspect-ratio: 1;
  border-radius: 0;
  cursor: pointer;
}

[hidden] { display: none !important; }

h1 {
  margin: 24px 0 8px;
  font-size: clamp(34px, 9vw, 48px);
  font-weight: 900;
  line-height: 1.05;
  text-wrap: balance;
}

p {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--nav-idle);
  text-wrap: pretty;
}

.card {
  width: 100%;
  margin-top: 24px;
  padding: 20px;
  border-radius: 28px;
  background: var(--cream);
  box-shadow: 0 6px 0 var(--cream-shadow);
  color: var(--ink);
}

.card p { color: var(--ink-soft); font-size: 16px; }

.label {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.code {
  margin: 6px 0 10px;
  font-size: clamp(36px, 11vw, 48px);
  font-weight: 900;
  letter-spacing: 0.14em;
  /* the tracking pads the last glyph; pull it back so the code sits centred */
  margin-right: -0.14em;
  font-variant-numeric: tabular-nums;
}

.card > .button:first-child { margin-top: 0; }

.card .hint { margin-top: 14px; font-size: 15px; }

/* Under Get Flexi: the way in for a phone that already has the app. */
.fallback { margin-top: 20px; padding-top: 18px; border-top: 2px solid var(--cream-shadow); }
.fallback:first-child, [hidden] + [hidden] + .fallback { margin-top: 0; padding-top: 0; border-top: 0; }
.fallback p { margin-top: 6px; font-size: 15px; }

.code-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 12px;
  margin-top: 12px;
  padding: 10px 16px;
  border: 2px solid var(--cream-shadow);
  border-radius: 16px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 0.14em;
  cursor: pointer;
}

.code-chip-note {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}

.code-chip:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

.button {
  display: block;
  width: 100%;
  margin-top: 16px;
  text-align: center;
  text-decoration: none;
  padding: 16px 20px;
  border: 0;
  border-radius: 20px;
  background: var(--zest);
  box-shadow: 0 5px 0 var(--zest-shadow);
  color: var(--ink);
  font: inherit;
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
}

.button:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--zest-shadow); }
.button:focus-visible { outline: 3px solid var(--cream); outline-offset: 3px; }

@media (prefers-reduced-motion: no-preference) {
  .button { transition: transform 80ms, box-shadow 80ms; }
}
