/*
 * The Plonk website (website/README.md): one page that tells top to bottom what Plonk is, in a
 * split screen. On the left the story on paper; on the right, on the sky blue of the app's menu,
 * the stage with the stones and the screens of Plonk itself, which stays put while the story
 * scrolls past it. On a phone the two come one after the other.
 *
 * The house style is that of the app (DESIGN.md): the tokens below are copied from
 * frontend/packages/ui/src/styles/theme.css (as of 2026-10-30, commit d8478d2); keep them in step.
 * Motion has one verb, "landen": what falls into place drops and settles, like the peach stone in
 * the logo. Everything else stays still.
 */

/* ---------- Tokens (theme.css) ---------- */

:root {
  --paper: oklch(0.984 0.008 85);
  --paper-grid: oklch(0.955 0.012 85);
  --surface: oklch(0.997 0.003 85);
  --text: oklch(0.24 0.05 268);
  --ink: oklch(0.5 0.19 265);
  --ink-hover: oklch(0.44 0.18 265);
  --on-ink: oklch(0.985 0.006 85);
  --sky: oklch(0.815 0.087 257);
  --sky-soft: oklch(0.93 0.032 256);
  --sky-wash: oklch(0.968 0.014 256);
  --peach: oklch(0.831 0.106 54);
  --peach-soft: oklch(0.955 0.028 55);
  --pencil: oklch(0.5 0.025 262);
  --rule: oklch(0.905 0.01 80);
  --rule-strong: oklch(0.6 0.02 262);
  --ledger-red: oklch(0.52 0.17 28);
  --success: oklch(0.5 0.11 155);
  --elevation-float:
    0 6px 16px -4px oklch(0.24 0.05 268 / 0.14), 0 1px 3px oklch(0.24 0.05 268 / 0.08);
  --radius: 0.625rem;
  --radius-sm: calc(var(--radius) * 0.5);
  --radius-md: var(--radius);
  --radius-lg: calc(var(--radius) * 1.5);
  --font-body: 'Source Sans 3 Variable', ui-sans-serif, system-ui, sans-serif;
  --font-heading: 'Fraunces Variable', ui-serif, Georgia, serif;

  /* The page itself: the side margin, and where the story starts on a wide screen. */
  --gutter: 1rem;
  --edge: clamp(2rem, 7vw, 8rem);
}

@media (min-width: 40rem) {
  :root {
    --gutter: 2rem;
  }
}

/*
 * The two typefaces, self-hosted like in the app (Fontsource, OFL; licences in fonts/). Fraunces in
 * the "full" variant for its SOFT axis.
 */
@font-face {
  font-family: 'Fraunces Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('fonts/fraunces-latin-full-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Source Sans 3 Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 200 900;
  src: url('fonts/source-sans-3-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Base: the browser's parts in the house style (base.css of the app) ---------- */

*,
::before,
::after {
  box-sizing: border-box;
  border-color: var(--rule);
}

html {
  color-scheme: light;
  background-color: var(--paper);
  color: var(--text);
  font-family: var(--font-body);
  scrollbar-color: var(--rule-strong) transparent;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background-color: color-mix(in oklch, var(--ink) 20%, var(--paper));
  color: var(--text);
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

h1,
h2 {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 600;
  font-variation-settings: 'SOFT' 100;
  letter-spacing: -0.02em;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

p {
  margin: 0;
  text-wrap: pretty;
}

a {
  color: var(--ink);
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Icons from Lucide, at the stroke of the app. */
.i {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.skip {
  position: absolute;
  z-index: 10;
  left: var(--gutter);
  top: 0.75rem;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-md);
  background: var(--surface);
  font-weight: 600;
  transform: translateY(-200%);
}

.skip:focus-visible {
  transform: none;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0 1.1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  transition: background-color 120ms ease-out;
}

.btn-primary {
  background: var(--ink);
  color: var(--on-ink);
}

.btn-primary:hover {
  background: var(--ink-hover);
}

.btn-secondary {
  border-color: var(--rule-strong);
  background: var(--surface);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--sky-wash);
}

.btn-big {
  min-height: 3rem;
  padding: 0 1.4rem;
  font-size: 1.0625rem;
}

/* ---------- Header and footer ---------- */

.site-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem var(--gutter);
}

.brand {
  display: inline-flex;
  padding: 0.5rem 0;
  border-radius: var(--radius-sm);
}

.wordmark {
  display: block;
  height: 1.625rem;
  width: auto;
  aspect-ratio: 452.9 / 210.3;
}

.head-nav {
  display: flex;
  gap: 0.5rem;
}

.head-signup {
  display: none;
}

@media (min-width: 40rem) {
  .head-signup {
    display: inline-flex;
  }
}

.site-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding: 1.75rem var(--gutter) 2.25rem;
  border-top: 1px solid var(--rule);
}

.foot-note {
  color: var(--pencil);
  font-size: 0.9375rem;
}

/* ---------- The story and the stage, one row per chapter ---------- */

.row {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  padding: 3.5rem var(--gutter);
}

/* On a phone the stones come first, above the title that they open and close. */
.row-hero,
.row-end {
  gap: 2.25rem;
}

.row-hero {
  padding-top: 0.5rem;
}

.row-hero .stage-col,
.row-end .stage-col {
  order: -1;
}

.text {
  max-width: 36rem;
}

.text > * + * {
  margin-top: 1rem;
}

.text > h1 + *,
.text > h2 + * {
  margin-top: 1.5rem;
}

h1 {
  font-size: clamp(2.625rem, 1.5rem + 4.6vw, 5.25rem);
  line-height: 1.03;
}

h2 {
  font-size: clamp(2.125rem, 1.45rem + 2.7vw, 3.375rem);
  line-height: 1.07;
}

.lead {
  font-size: 1.1875rem;
  line-height: 1.55;
}

.text > .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

.stage {
  position: relative;
  container: stage / inline-size;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin: 0;
  padding: 1.75rem 1rem 1rem;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--sky-wash);
}

.stage > figcaption {
  order: 2;
}

.stage-note {
  display: block;
  color: var(--pencil);
  font-size: 0.8125rem;
}

.stage-logo {
  padding: 3rem 1rem 2rem;
}

.stones-full {
  display: block;
  width: min(13rem, 62%);
  height: auto;
  overflow: visible;
}

@media (min-width: 40rem) {
  .row {
    padding-block: 4.5rem;
  }

  .stage {
    padding: 2.5rem 2rem 1.25rem;
  }
}

/*
 * The split screen, from 64rem: the story on the left scrolls, the stage on the right stays put
 * for as long as its chapter lasts, and hands over to the next one as that scrolls in.
 */
@media (min-width: 64rem) {
  body {
    font-size: 1.125rem;
  }

  .lead {
    font-size: 1.3125rem;
  }

  .site-head {
    position: absolute;
    z-index: 2;
    inset: 0 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 1.25rem 0 0;
  }

  .site-head .brand {
    justify-self: start;
    margin-left: var(--edge);
  }

  .head-nav {
    justify-self: end;
    margin-right: 2rem;
  }

  .row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    min-height: 150vh;
    min-height: 150svh;
    padding: 0;
  }

  .row-hero,
  .row-end {
    min-height: 100vh;
    min-height: 100svh;
  }

  .row-hero .stage-col,
  .row-end .stage-col {
    order: 0;
  }

  .text {
    align-self: center;
    width: min(34rem, 100% - var(--edge) - 3rem);
    margin-left: var(--edge);
    padding-block: 7rem;
  }

  .stage-col {
    background: var(--sky-wash);
  }

  .stage {
    position: sticky;
    top: 0;
    justify-content: center;
    height: 100vh;
    height: 100svh;
    padding: 4.5rem clamp(2rem, 4vw, 4rem);
    border-radius: 0;
    background: none;
  }

  .stage > figcaption {
    position: absolute;
    bottom: 1.5rem;
    left: clamp(2rem, 4vw, 4rem);
  }

  .stones-full {
    width: min(27rem, 66%);
  }

  .site-foot {
    padding-inline: var(--edge);
  }
}

/* ---------- The stones: the peach stone falls into place ---------- */

.stones-full .st-peach,
.stones-full .st-spark {
  transform-box: fill-box;
}

/* The hero plays on load, without the script; the last chapter when it comes into view. */
.stones-hero .st-peach,
.stage.is-on .st-peach {
  animation: plonk 1050ms 350ms both;
}

.stones-hero .st-spark,
.stage.is-on .st-spark {
  animation: appear 220ms 1000ms both;
}

.stage.is-primed:not(.is-on) .st-peach,
.stage.is-primed:not(.is-on) .st-spark {
  opacity: 0;
}

/* Only a drop and a settle: the stones are never squashed, turned or scaled (DESIGN.md, Logo). */
@keyframes plonk {
  0% {
    opacity: 0;
    transform: translateY(-150%);
    animation-timing-function: cubic-bezier(0.55, 0, 0.9, 0.4);
  }
  14% {
    opacity: 1;
  }
  60% {
    transform: translateY(0);
    animation-timing-function: cubic-bezier(0.2, 0.7, 0.4, 1);
  }
  75% {
    transform: translateY(-5%);
    animation-timing-function: cubic-bezier(0.55, 0, 0.9, 0.4);
  }
  87% {
    transform: translateY(0);
    animation-timing-function: cubic-bezier(0.2, 0.7, 0.4, 1);
  }
  94% {
    transform: translateY(-1.2%);
    animation-timing-function: ease-in;
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* The same verb, small: a line, an item or a confirmation that lands where it belongs. */
@keyframes land {
  0% {
    opacity: 0;
    transform: translateY(-0.75em);
    animation-timing-function: cubic-bezier(0.55, 0, 0.9, 0.4);
  }
  60% {
    opacity: 1;
    transform: translateY(0);
    animation-timing-function: cubic-bezier(0.2, 0.7, 0.4, 1);
  }
  80% {
    transform: translateY(-0.12em);
    animation-timing-function: ease-in;
  }
  100% {
    opacity: 1;
    transform: none;
  }
}

@keyframes appear {
  from {
    opacity: 0;
  }
}

/* A value that changed because another one did: its ground lights up once. */
@keyframes changed {
  from {
    background-color: var(--sky-soft);
  }
  to {
    background-color: transparent;
  }
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

@keyframes spin {
  to {
    transform: rotate(1turn);
  }
}

/* ---------- The screens on the stage (synthetic data, labelled) ---------- */

/*
 * A scene scales with its stage: every size inside it is in em, and the em follows the width of
 * the stage, so a screen looks the same on a phone and on a wide screen, only smaller.
 */
.scene {
  width: 100%;
  max-width: 46em;
  font-size: clamp(11.5px, 2.35cqi, 15.5px);
  line-height: 1.4;
  text-align: left;
  color: var(--text);
}

.m-later:not(.is-in) {
  display: none;
}

.m-later.is-in {
  animation: land 460ms both;
}

.m-h {
  font-weight: 600;
}

.m-muted {
  color: var(--pencil);
}

.m-title {
  margin-bottom: 0.55em;
  font-family: var(--font-heading);
  font-size: 2em;
  font-weight: 600;
  font-variation-settings: 'SOFT' 100;
  line-height: 1.15;
  letter-spacing: -0.015em;
}

.m-title-sm {
  font-size: 1.6em;
}

.m-card {
  border: 1px solid var(--rule);
  border-radius: 0.8em;
  background: var(--surface);
}

.m-stones {
  width: 3em;
  height: 2.375em;
  flex-shrink: 0;
}

.m-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45em;
  min-height: 2.6em;
  padding: 0 1em;
  border: 1px solid transparent;
  border-radius: 0.65em;
  font-size: 0.95em;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color 150ms ease-out;
}

.m-btn .i {
  font-size: 1.15em;
}

.m-btn-primary {
  background: var(--ink);
  color: var(--on-ink);
}

.m-btn-secondary {
  border-color: var(--rule-strong);
  background: var(--surface);
}

.m-btn-sm {
  min-height: 2.3em;
  padding: 0 0.8em;
}

/* A tap, as the app shows a pressed control: its focus ring, and a deeper tone. */
.scene .is-pressed {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.m-btn-primary.is-pressed {
  background: var(--ink-hover);
}

.is-typing::after {
  content: '';
  display: inline-block;
  width: 1.5px;
  height: 1.05em;
  margin-left: 1px;
  vertical-align: -0.15em;
  background: var(--text);
  animation: blink 1s steps(1) infinite;
}

.is-changed {
  border-radius: 0.25em;
  animation: changed 1100ms ease-out;
}

/* The app window: the bar with the business, the menu from a wide stage, and the page. */
.m-win {
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: 1.1em;
  background: var(--paper);
  box-shadow: var(--elevation-float);
}

.m-top {
  display: flex;
  align-items: center;
  gap: 0.9em;
  height: 3.4em;
  padding: 0 1.1em;
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}

.m-wm {
  display: block;
  height: 1.25em;
  width: auto;
  aspect-ratio: 452.9 / 210.3;
  flex-shrink: 0;
}

.m-biz {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  min-width: 0;
  overflow: hidden;
  font-size: 0.95em;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.m-biz .i {
  font-size: 1.15em;
  color: var(--pencil);
}

.m-side {
  display: none;
}

.m-main {
  min-width: 0;
  padding: 1.4em 1.5em 1.6em;
}

@container stage (min-width: 30rem) {
  .m-body {
    display: grid;
    grid-template-columns: 11.5em minmax(0, 1fr);
  }

  .m-side {
    display: flex;
    flex-direction: column;
    gap: 0.15em;
    padding: 0.9em 0.7em;
    border-right: 1px solid var(--rule);
    background: var(--sky-wash);
  }
}

.m-nav {
  display: flex;
  align-items: center;
  gap: 0.65em;
  padding: 0.55em 0.7em;
  border-radius: 0.65em;
  font-size: 0.95em;
  font-weight: 500;
}

.m-nav .i {
  font-size: 1.15em;
}

.m-nav.is-current {
  background: var(--sky-soft);
  color: var(--ink);
  font-weight: 600;
}

.m-nav-group {
  margin-top: 1.1em;
  padding: 0 0.75em 0.3em;
  color: var(--pencil);
  font-size: 0.8em;
  font-weight: 600;
}

/* Vandaag: setting up a business, three steps that each get their tick. */
.m-setup-head {
  display: flex;
  align-items: center;
  gap: 1em;
  padding: 1.1em 1.1em 1em;
}

.m-setup-head .m-muted {
  margin-top: 0.15em;
  font-size: 0.92em;
}

.m-rows {
  margin: 0;
  padding: 0;
  list-style: none;
}

.m-row {
  display: flex;
  align-items: center;
  gap: 0.85em;
  min-height: 4em;
  padding: 0.7em 1.1em;
  border-top: 1px solid var(--rule);
}

.m-row-ico {
  display: grid;
  place-items: center;
  width: 1.8em;
  height: 1.8em;
  flex-shrink: 0;
}

.m-row-ico .i {
  grid-area: 1 / 1;
  font-size: 1.3em;
}

.m-tick {
  color: var(--success);
  opacity: 0;
}

.m-row-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.m-row-text .m-muted {
  font-size: 0.9em;
}

.m-done {
  display: none;
}

.m-chev {
  font-size: 1.2em;
  color: var(--pencil);
}

.m-row.is-done .m-todo,
.m-row.is-done .m-row-ico .i:first-child {
  display: none;
}

.m-row.is-done .m-done {
  display: block;
}

.m-row.is-done .m-tick {
  opacity: 1;
  animation: land 460ms both;
}

/* The Modulewinkel: one module, bought, and its page in the menu. */
.m-intro {
  max-width: 34em;
  margin: -0.15em 0 1.1em;
  font-size: 0.95em;
}

.m-main-store {
  min-height: 18em;
}

.m-module {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 0.9em 1em;
  padding: 1.1em;
}

.m-module-text {
  display: flex;
  flex-direction: column;
  gap: 0.2em;
}

.m-module-text .m-muted {
  font-size: 0.92em;
}

.m-module-end {
  grid-column: 2;
}

@container stage (min-width: 34rem) {
  .m-module {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
  }

  .m-module-end {
    grid-column: auto;
  }
}

.m-tile {
  display: grid;
  place-items: center;
  width: 2.8em;
  height: 2.8em;
  border-radius: 46% 54% 50% 50% / 54% 46% 54% 46%;
  background: var(--sky-soft);
}

.m-tile .i {
  font-size: 1.3em;
}

.m-module.is-bought .m-buy {
  display: none;
}

.m-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  min-height: 2.6em;
  font-size: 0.95em;
  font-weight: 600;
}

.m-status .i {
  color: var(--success);
}

.m-confirm {
  display: flex;
  align-items: flex-start;
  gap: 0.6em;
  margin-top: 1em;
  padding: 0.65em 0.85em;
  border: 1px solid var(--peach);
  border-radius: 0.65em;
  background: var(--peach-soft);
  font-size: 0.92em;
}

.m-confirm .m-stones {
  width: 1.25em;
  height: 1em;
  margin-top: 0.2em;
}

/* Ink and pencil: the price that was typed, and the price per litre that follows it. */
.sc-ink,
.sc-rules {
  display: grid;
  gap: 1em;
  max-width: 31em;
}

.m-form {
  padding: 1.3em 1.4em 1.4em;
}

.m-form .m-title {
  margin-bottom: 0.35em;
}

.m-label {
  margin-top: 0.9em;
  font-size: 0.9em;
  font-weight: 500;
}

.m-field {
  display: flex;
  align-items: center;
  gap: 0.45em;
  min-height: 2.75em;
  margin-top: 0.35em;
  padding: 0 0.85em;
  border: 1px solid var(--rule-strong);
  border-radius: 0.65em;
  background: var(--paper);
  color: var(--ink);
}

.m-field.is-focus {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.m-cur {
  color: var(--pencil);
}

.m-price-value,
.m-amount,
.m-li-end {
  font-variant-numeric: tabular-nums;
}

.m-hint {
  margin-top: 0.4em;
  color: var(--pencil);
  font-size: 0.88em;
}

.m-derived {
  margin-top: 0.25em;
  color: var(--pencil);
}

.m-amount {
  white-space: nowrap;
}

.m-list {
  padding: 0.3em 0 0.2em;
}

.m-list-head {
  padding: 0.55em 1.2em 0.6em;
  font-weight: 600;
}

.m-li {
  display: flex;
  justify-content: space-between;
  gap: 1em;
  padding: 0.7em 1.2em;
  border-top: 1px solid var(--rule);
}

.m-li > span:first-child {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.m-li .m-muted {
  font-size: 0.9em;
}

.m-li-end {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  white-space: nowrap;
}

.m-ink {
  color: var(--ink);
  font-weight: 600;
}

.m-pencil {
  color: var(--pencil);
  font-size: 0.9em;
}

/* Two roles: the shared tablet and the owner's phone. */
.sc-roles {
  position: relative;
}

.m-device {
  overflow: hidden;
  border: 1px solid var(--rule);
  background: var(--paper);
  box-shadow: var(--elevation-float);
}

.m-tablet {
  min-height: 22.5em;
  border-radius: 1.3em;
}

.m-phone {
  display: none;
  border-radius: 1.6em;
}

@container stage (min-width: 30rem) {
  .sc-roles {
    padding-bottom: 2.5em;
  }

  .m-tablet {
    width: 72%;
  }

  .m-phone {
    position: absolute;
    right: 0;
    bottom: 0;
    display: block;
    width: 33%;
  }
}

.m-top-end {
  display: none;
  align-items: center;
  gap: 0.7em;
  margin-left: auto;
  font-size: 0.95em;
}

.m-view {
  display: none;
  padding: 1.2em 1.3em 1.4em;
}

.m-tablet[data-view='names'] .m-view-names,
.m-tablet[data-view='pin'] .m-view-pin,
.m-tablet[data-view='home'] .m-view-home {
  display: block;
}

.m-tablet[data-view='home'] .m-top-end {
  display: flex;
}

.m-tablet[data-view='home'] .m-biz {
  display: none;
}

.m-names {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6em;
}

.m-name {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 3.2em;
  padding: 0 0.6em;
  border: 1px solid var(--rule-strong);
  border-radius: 0.8em;
  background: var(--surface);
  font-weight: 600;
  text-align: center;
}

.m-name.is-pressed {
  background: var(--sky-wash);
}

.m-view-pin {
  text-align: center;
}

.m-view-pin .m-title {
  margin-bottom: 0.2em;
}

.m-dots {
  display: flex;
  justify-content: center;
  gap: 0.75em;
  margin: 0.9em 0 1em;
}

.m-dots i {
  width: 0.85em;
  height: 0.85em;
  border: 1.5px solid var(--rule-strong);
  border-radius: 50%;
}

.m-dots i.is-on {
  border-color: var(--ink);
  background: var(--ink);
}

.m-keys {
  display: inline-grid;
  grid-template-columns: repeat(3, 3.6em);
  gap: 0.45em;
}

.m-keys i {
  display: grid;
  place-items: center;
  height: 2.5em;
  border: 1px solid var(--rule-strong);
  border-radius: 0.7em;
  background: var(--surface);
  font-style: normal;
  font-weight: 600;
}

.m-keys i.is-pressed {
  background: var(--sky-soft);
}

.m-keys .m-key-blank {
  visibility: hidden;
}

.m-notice {
  display: flex;
  align-items: flex-start;
  gap: 0.6em;
  margin-bottom: 0.8em;
  padding: 0.65em 0.85em;
  border: 1px solid var(--rule);
  border-radius: 0.65em;
  background: var(--surface);
  font-size: 0.92em;
}

.m-notice .i {
  margin-top: 0.15em;
  font-size: 1.15em;
}

.m-empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3em;
  padding: 1.4em 1.3em;
}

.m-empty .m-stones {
  margin-bottom: 0.6em;
}

.m-phone .m-top {
  justify-content: center;
}

.m-phone-body {
  padding: 1em 1.1em 1.3em;
}

.m-people {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.95em;
}

.m-people li {
  padding: 0.55em 0;
  border-top: 1px solid var(--rule);
}

/* The rules: the owner chooses the rate, and the source is one tap away. */
.m-select-wrap {
  position: relative;
}

.m-select .i {
  margin-left: auto;
  color: var(--pencil);
}

.m-placeholder {
  color: var(--pencil);
}

.m-chosen {
  display: none;
}

.m-select-wrap.is-chosen .m-placeholder {
  display: none;
}

.m-select-wrap.is-chosen .m-chosen {
  display: inline;
}

.m-options {
  position: absolute;
  z-index: 1;
  top: calc(100% + 0.4em);
  right: 0;
  left: 0;
  display: none;
  margin: 0;
  padding: 0.35em;
  border: 1px solid var(--rule);
  border-radius: 0.75em;
  background: var(--surface);
  box-shadow: var(--elevation-float);
  list-style: none;
}

.m-select-wrap.is-open .m-options {
  display: block;
  animation: appear 140ms ease-out both;
}

.m-options li {
  padding: 0.55em 0.7em;
  border-radius: 0.5em;
}

.m-options li.is-hover {
  background: var(--sky-soft);
}

.m-link {
  border-radius: 0.2em;
  color: var(--ink);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

.m-source {
  display: flex;
  align-items: center;
  gap: 0.8em;
  justify-self: end;
  padding: 0.9em 1.2em;
  box-shadow: var(--elevation-float);
}

.m-source .i {
  font-size: 1.4em;
  color: var(--pencil);
}

.m-source > span {
  display: flex;
  flex-direction: column;
}

.m-source .m-muted {
  font-size: 0.85em;
}

/* Your data: one file, downloaded. */
.m-main-data {
  min-height: 20em;
}

.m-export {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.6em;
  padding: 1.2em 1.3em 1.3em;
}

.m-export .m-muted {
  max-width: 32em;
  font-size: 0.92em;
}

.m-download {
  margin-top: 0.3em;
}

.m-busy {
  display: flex;
  align-items: center;
  gap: 0.5em;
  color: var(--pencil);
  font-size: 0.92em;
}

.m-spin {
  animation: spin 900ms linear infinite;
}

.m-export .m-confirm {
  margin-top: 0.2em;
}

/* The patchwork: loose sheets, and a name typed into each of them. */
.sc-patch {
  position: relative;
  height: 25.5em;
  max-width: 42em;
}

.m-sheet {
  position: absolute;
  width: 52%;
  padding: 0.8em 0.95em 1em;
  border: 1px solid var(--rule);
  border-radius: 0.5em;
  background: var(--surface);
  box-shadow: var(--elevation-float);
  font-size: 0.9em;
}

.m-sheet-name {
  display: flex;
  align-items: center;
  gap: 0.4em;
  margin-bottom: 0.6em;
  color: var(--pencil);
  font-size: 0.85em;
  font-weight: 600;
}

.m-sheet-a {
  top: 0;
  left: 0;
  width: 56%;
  transform: rotate(-2.5deg);
}

.m-sheet-b {
  top: 2.2em;
  right: 0;
  width: 44%;
  transform: rotate(2deg);
}

/* The mail with the typo lies on top, so the mistake stays in sight. */
.m-sheet-c {
  z-index: 1;
  bottom: 0.6em;
  left: 2%;
  width: 57%;
  transform: rotate(1.5deg);
}

.m-sheet-d {
  right: 2%;
  bottom: 3.6em;
  width: 45%;
  background: var(--paper);
  transform: rotate(-3deg);
}

.m-grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92em;
  font-variant-numeric: tabular-nums;
}

.m-grid th,
.m-grid td {
  padding: 0.25em 0.4em;
  border: 1px solid var(--rule);
  text-align: left;
  white-space: nowrap;
}

.m-grid th {
  background: var(--paper-grid);
  color: var(--pencil);
  font-weight: 600;
}

.m-lines {
  margin: 0;
  padding: 0;
  list-style: none;
}

.m-lines li {
  display: flex;
  justify-content: space-between;
  gap: 0.8em;
  padding: 0.3em 0;
  border-bottom: 1px solid var(--rule);
}

.m-num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.m-mail-row {
  padding: 0.3em 0;
  border-bottom: 1px solid var(--rule);
}

.m-mail-row .m-muted {
  display: inline-block;
  min-width: 5.5em;
}

.m-mail-body {
  margin-top: 0.6em;
}

/* The retyped name, on the tint of a selection; the typo gets the mark of a discrepancy. */
.m-typed {
  margin: 0 -0.15em;
  padding: 0 0.15em;
  border-radius: 0.2em;
  background: var(--sky-soft);
}

.m-typo.is-wrong {
  text-decoration: underline wavy var(--ledger-red);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.2em;
}

@container stage (max-width: 30rem) {
  .sc-patch {
    height: 31em;
  }

  .m-sheet {
    width: 64%;
  }

  .m-sheet-b {
    width: 52%;
  }

  .m-sheet-c {
    width: 66%;
  }

  .m-sheet-d {
    width: 56%;
    bottom: 5em;
  }
}

/* ---------- Less motion: every scene shows its end state at once ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  ::before,
  ::after {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}
