/* The book club's look: hot pink and sunset colors, chunky retro lettering,
   and everything drawn like a sticker (dark outline, hard little shadow).
   Built for iPhone. */

:root {
  --bg: #fff0f6;
  --paper: #fff;
  --ink: #2a0f2e;
  --ink-2: rgb(42 15 46 / 0.68);
  --ink-3: rgb(42 15 46 / 0.32);
  --pink: #ff4fa0;
  --pink-2: #ff8cc3;
  --blush: #ffd0e3;
  --coral: #ff8066;
  --butter: #ffe27a;
  --lilac: #d6bcff;
  --mint: #aeeed6;
  --sky: #b3e3ff;
  --peach: #ffc9a8;
  --red: #e5264b;
  --edge: 2px solid var(--ink);
  --pop: 4px 4px 0 var(--ink);
  --pop-sm: 2px 2px 0 var(--ink);
  --display: "Caprasimo", "Cooper Black", ui-rounded, Georgia, serif;
  --script: "Sacramento", "Snell Roundhand", "Brush Script MT", cursive;
  --round: ui-rounded, "SF Pro Rounded", -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  /* The theme is one bright look; it doesn't switch for dark mode. */
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
}

/* Keep the page still while a sheet or alert is up. */
html:has(dialog[open]) {
  overflow: hidden;
}

body {
  margin: 0;
  /* Blush paper with faint pink polka dots. */
  background: var(--bg) radial-gradient(rgb(255 79 160 / 0.14) 1.5px, transparent 1.7px) 0 0 / 22px 22px;
  color: var(--ink);
  font: 17px/22px -apple-system, system-ui, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
p,
ol,
ul {
  margin: 0;
}

ol,
ul {
  padding: 0;
  list-style: none;
}

h1,
h2 {
  font-weight: 400; /* the display face has one weight */
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button,
a {
  touch-action: manipulation;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

:focus-visible {
  outline: 3px solid var(--pink);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.icon {
  display: inline-flex;
  flex: none;
  width: 1em;
  height: 1em;
}

.icon svg {
  width: 100%;
  height: 100%;
}

/* ---------- stickers ---------- */

.sticker {
  display: inline-block;
  flex: none;
  width: var(--size, 40px);
  height: var(--size, 40px);
  pointer-events: none;
}

.sticker svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.twinkle {
  animation: twinkle 2.6s ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}

@keyframes twinkle {
  50% {
    transform: scale(0.7) rotate(20deg);
    opacity: 0.75;
  }
}

/* A book cover, cut out like a sticker: white border, dark outline, hard shadow. */
.cover {
  flex: none;
  display: block;
  width: 96px;
  aspect-ratio: 2 / 3;
  border: 4px solid #fff;
  border-radius: 10px;
  object-fit: cover;
  background: #fff;
  box-shadow: 0 0 0 2px var(--ink), 3px 4px 0 2px var(--ink);
}

.cover-blank {
  display: flex;
  align-items: flex-end;
  padding: 7px;
  background: var(--pink);
  color: #fff;
  overflow: hidden;
}

.cover-blank span {
  font: 400 0.76em/1.12 var(--display);
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rating .icon {
  width: 0.9em;
  height: 0.9em;
  margin-right: 3px;
  color: var(--pink);
  vertical-align: -1px;
}

/* ---------- page ---------- */

.page {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 18px calc(124px + env(safe-area-inset-bottom));
}

.nav {
  position: sticky;
  top: 0;
  z-index: 5;
  pointer-events: none;
}

/* Content fades out under the buttons instead of sliding behind a bar. */
.nav::before {
  content: "";
  position: absolute;
  inset: 0 0 -20px;
  background: linear-gradient(var(--bg) 30%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  -webkit-mask-image: linear-gradient(#000 55%, transparent);
  mask-image: linear-gradient(#000 55%, transparent);
  opacity: 0;
  transition: opacity 0.2s;
}

.nav.is-scrolled::before {
  opacity: 1;
}

.nav-inner {
  position: relative;
  display: grid;
  /* Equal side columns keep the title centered however many buttons sit on the right. */
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  max-width: 560px;
  margin: 0 auto;
  padding: calc(8px + env(safe-area-inset-top)) 14px 8px;
}

.nav-inner > * {
  pointer-events: auto;
}

.nav-inner > .round-button {
  justify-self: start;
}

.nav-actions {
  justify-self: end;
  display: flex;
  gap: 8px;
}

.nav-title {
  max-width: 44vw;
  font: 400 19px/24px var(--display);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transition: opacity 0.2s;
}

.nav.is-scrolled .nav-title {
  opacity: 1;
}

.round-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: var(--edge);
  border-radius: 50%;
  background: var(--paper);
  box-shadow: var(--pop-sm);
  transition: transform 0.1s, box-shadow 0.1s;
}

.round-button .icon {
  width: 20px;
  height: 20px;
}

.round-button:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

.head {
  position: relative;
  padding: 8px 2px 0;
}

.head h1 {
  /* Leave room for the sticker in the corner. */
  padding-right: 64px;
  font: 400 40px/42px var(--display);
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.head > .sticker {
  position: absolute;
  top: 2px;
  right: 2px;
  --size: 56px;
  rotate: 12deg;
}

.tag {
  display: inline-block;
  margin-top: 12px;
  padding: 5px 13px;
  border: var(--edge);
  border-radius: 999px;
  background: var(--butter);
  box-shadow: var(--pop-sm);
  font: 800 14px/18px var(--round);
}

/* Who is in the vote: colored once they've ranked, white with a dashed edge until then. */
.people {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  font: 700 15px/20px var(--round);
  color: var(--ink-2);
}

.avatars {
  display: flex;
  padding-left: 6px;
}

.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-left: -6px;
  border: 2px dashed var(--ink-3);
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink-3);
  font: 800 12px/1 var(--round);
}

.avatar.is-on {
  border: var(--edge);
  background: var(--tone, var(--blush));
  color: var(--ink);
}

.actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}

.footnote {
  margin: 30px 0 0;
  font: 700 13px/18px var(--round);
  color: var(--ink-2);
  text-align: center;
}

.footnote:empty {
  display: none;
}

.footnote.is-error {
  margin: 12px 4px 0;
  color: var(--red);
  text-align: left;
}

.section {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 36px 2px 14px;
  font: 400 28px/32px var(--display);
}

.section span {
  font: 800 14px/18px var(--round);
  color: var(--ink-2);
}

/* ---------- lists ---------- */

.group {
  border: var(--edge);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: var(--pop);
  overflow: hidden;
}

.row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 54px;
  padding: 12px 18px;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
}

.row + .row::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 2px;
  background: var(--blush);
}

.row.link:active,
.row.action:active {
  background: var(--bg);
}

.row-text {
  flex: 1;
  min-width: 0;
}

.row-title,
.row-sub {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-title {
  font-weight: 800;
}

.row-sub {
  font: 600 15px/20px var(--round);
  color: var(--ink-2);
}

.row > .icon {
  width: 14px;
  height: 14px;
}

.row.is-danger {
  color: var(--red);
}

.row.action {
  justify-content: center;
  font: 800 17px/22px var(--round);
}

/* Form rows: label on the left, field on the right. */
.field span {
  flex: none;
  width: 100px;
  font: 800 16px/22px var(--round);
}

.field input {
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  outline: none;
}

input::placeholder {
  color: var(--ink-3);
}

/* ---------- buttons ---------- */

.button {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 54px;
  padding: 0 22px;
  border: var(--edge);
  border-radius: 999px;
  background: var(--pink);
  box-shadow: var(--pop);
  color: var(--ink);
  font: 800 17px/22px var(--round);
  transition: transform 0.1s, box-shadow 0.1s;
}

.button.white {
  background: var(--paper);
}

.button.butter {
  background: var(--butter);
}

.button:active {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 var(--ink);
}

.button[disabled] {
  opacity: 0.5;
}

.text-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--pink);
  font: 800 15px/20px var(--round);
  text-decoration: underline;
  text-underline-offset: 3px;
}

form > .button {
  margin-top: 16px;
}

/* ---------- home ---------- */

.page.home {
  padding-top: calc(14px + env(safe-area-inset-top));
}

/* An Orange County sunset: butter sky, coral sun, pink waves, and the books standing in the surf. */
.home-hero {
  position: relative;
  isolation: isolate;
  height: 252px;
  border: var(--edge);
  border-radius: 30px;
  background: linear-gradient(#ffe27a, #ffc9a8 58%, #ffb3cf);
  box-shadow: 5px 5px 0 var(--ink);
  overflow: hidden;
}

.scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.scene-back {
  z-index: 0;
}

.scene-front {
  z-index: 2;
}

.home-hero > .sticker {
  position: absolute;
  z-index: 3;
}

/* Butter sparkles would vanish against the butter sky. */
.home-hero .sticker-sparkle path {
  fill: #fff;
}

/* Five books fanned out. Each sits a little lower and more tilted toward the edges, and bobs gently. */
.fan {
  position: absolute;
  right: 0;
  bottom: 30px;
  left: 0;
  z-index: 1;
  height: 150px;
}

.fan-book {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: var(--w);
  aspect-ratio: 2 / 3;
  border: 3px solid #fff;
  border-radius: 8px;
  object-fit: cover;
  background: var(--tone, var(--pink));
  box-shadow: 0 0 0 2px var(--ink), 3px 4px 0 2px var(--ink);
  transform: translate(calc(-50% + var(--x)), var(--y)) rotate(var(--r));
  animation: bob 5.5s ease-in-out infinite;
  animation-delay: calc(var(--i) * -1.1s);
}

.fan-book:nth-child(1) {
  --x: -116px;
  --y: -2px;
  --r: -15deg;
  --w: 68px;
  z-index: 1;
}

.fan-book:nth-child(2) {
  --x: -60px;
  --y: -10px;
  --r: -7deg;
  --w: 78px;
  z-index: 2;
}

.fan-book:nth-child(3) {
  --x: 0px;
  --y: -14px;
  --r: 0deg;
  --w: 92px;
  z-index: 3;
}

.fan-book:nth-child(4) {
  --x: 60px;
  --y: -10px;
  --r: 7deg;
  --w: 78px;
  z-index: 2;
}

.fan-book:nth-child(5) {
  --x: 116px;
  --y: -2px;
  --r: 15deg;
  --w: 68px;
  z-index: 1;
}

@keyframes bob {
  50% {
    transform: translate(calc(-50% + var(--x)), calc(var(--y) - 7px)) rotate(calc(var(--r) + 1.5deg));
  }
}

/* A stand-in book for spots with no real cover yet: a colored block with two title lines. */
.fan-blank::after {
  content: "";
  position: absolute;
  top: 20%;
  right: 18%;
  left: 14%;
  height: 7%;
  border-radius: 3px;
  background: var(--ink);
  box-shadow: 0 11px 0 -1px var(--ink);
  opacity: 0.85;
}

/* The club's name: a script scribble sitting on top of big chunky letters. */
.brand {
  position: relative;
  margin: 22px 2px 20px;
}

.brand-script {
  position: relative;
  z-index: 1;
  display: block;
  width: max-content;
  margin: 0 0 -16px 8px;
  color: var(--pink);
  font: 400 50px/1 var(--script);
  text-shadow: 2px 2px 0 #fff, -2px -2px 0 #fff, 2px -2px 0 #fff, -2px 2px 0 #fff;
  rotate: -5deg;
}

.brand h1 {
  font: 400 56px/56px var(--display);
  letter-spacing: -0.015em;
}

.brand .sticker {
  position: absolute;
  top: -22px;
  right: 6px;
  --size: 62px;
  rotate: 12deg;
}

/* Past votes: pastel sticker cards with the book's cover. */
.vote-cards {
  display: grid;
  /* minmax(0, …) lets long names shorten with an ellipsis instead of widening the card. */
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

.vote-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 18px 12px 16px;
  border: var(--edge);
  border-radius: 24px;
  background: var(--tone, var(--blush));
  box-shadow: var(--pop);
  transition: transform 0.1s, box-shadow 0.1s;
}

.vote-card:active {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 var(--ink);
}

.vote-card .cover {
  width: 48px;
  border-width: 3px;
  border-radius: 7px;
  box-shadow: 0 0 0 2px var(--ink), 2px 3px 0 2px var(--ink);
}

.vote-card:nth-child(odd) .cover {
  rotate: -4deg;
}

.vote-card:nth-child(even) .cover {
  rotate: 3deg;
}

.vote-card .cover-blank {
  padding: 0;
}

.vote-card .cover-blank span {
  display: none;
}

.vote-card .row-title {
  font: 400 21px/26px var(--display);
}

.vote-card > .icon {
  width: 14px;
  height: 14px;
}

/* ---------- adding a book ---------- */

.add {
  margin-top: 18px;
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 52px;
  padding: 0 18px;
  border: var(--edge);
  border-radius: 26px;
  background: var(--paper);
  box-shadow: var(--pop-sm);
}

.search .icon {
  width: 18px;
  height: 18px;
}

.search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.search input::-webkit-search-decoration {
  display: none;
}

.search-results:not(:empty) {
  margin-top: 12px;
}

.search-note {
  padding: 4px 16px;
  font: 700 15px/20px var(--round);
  color: var(--ink-2);
}

.search-note.is-error {
  color: var(--red);
}

.search-note + .group {
  margin-top: 8px;
}

.hit {
  padding: 9px 16px;
}

.hit:active {
  background: var(--bg);
}

.hit img,
.hit-blank {
  flex: none;
  width: 38px;
  height: 57px;
  border: 2px solid var(--ink);
  border-radius: 5px;
  object-fit: cover;
  background: var(--blush);
}

.hit > .icon {
  width: 22px;
  height: 22px;
  color: var(--pink);
}

/* ---------- book cards ---------- */

.cards {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  margin-top: 22px;
}

.card {
  display: grid;
  gap: 16px;
  padding: 18px 16px 16px;
  border: var(--edge);
  border-radius: 28px;
  background: var(--tone, var(--blush));
  box-shadow: var(--pop);
}

.card.is-new {
  animation: arrive 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}

@keyframes arrive {
  from {
    transform: scale(0.9) rotate(-2deg);
    opacity: 0;
  }
}

.card-main {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 18px;
  align-items: start;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
}

/* Covers lean one way, then the other, down the list. */
.card:nth-child(odd) .cover {
  rotate: -3deg;
}

.card:nth-child(even) .cover {
  rotate: 2.5deg;
}

.card-text {
  min-width: 0;
  display: block;
}

.card-title {
  font: 400 22px/25px var(--display);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-author {
  display: block;
  margin-top: 3px;
  font: 700 15px/20px var(--round);
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meta {
  display: block;
  margin-top: 6px;
  font: 800 13px/18px var(--round);
  font-variant-numeric: tabular-nums;
}

.card-desc {
  margin-top: 6px;
  font-size: 13px;
  line-height: 18px;
  color: var(--ink-2);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* The rank control looks like a button; the phone's own number menu sits invisibly on top of it. */
.rank {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 50px;
  padding: 0;
  border: var(--edge);
  border-radius: 25px;
  background: var(--paper);
  box-shadow: var(--pop-sm);
  font: 800 17px/22px var(--round);
  transition: transform 0.1s, box-shadow 0.1s;
}

.rank .icon {
  width: 14px;
  height: 14px;
}

/* Once ranked it turns hot pink and shows the number in the big lettering. */
.rank.is-on {
  background: var(--pink);
}

.rank.is-on span:first-child {
  font: 400 24px/1 var(--display);
}

.rank select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  font-size: 16px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.rank:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

.empty {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 44px 24px 20px;
  font: 400 24px/28px var(--display);
  color: var(--ink-2);
  text-align: center;
}

.empty .sticker {
  --size: 72px;
  rotate: -8deg;
}

/* ---------- winner ---------- */

/* Hot pink with slowly turning sunburst rays. */
.hero {
  position: relative;
  isolation: isolate;
  display: grid;
  justify-items: center;
  margin-top: 20px;
  padding: 26px 20px 22px;
  border: var(--edge);
  border-radius: 30px;
  background: var(--pink);
  box-shadow: 5px 5px 0 var(--ink);
  color: #fff;
  text-align: center;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: -75%;
  z-index: -1;
  background: repeating-conic-gradient(#ff4fa0 0 10deg, #ff76b6 10deg 20deg);
  animation: spin 70s linear infinite;
}

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

.hero > .sticker {
  position: absolute;
}

.hero-script {
  font: 400 46px/1 var(--script);
  text-shadow: 2px 2px 0 var(--ink);
  rotate: -5deg;
}

.hero-cover {
  position: relative;
  margin-top: 14px;
  padding: 0;
  border: 0;
  background: none;
}

.hero .cover {
  width: 168px;
  border-width: 5px;
  border-radius: 12px;
  box-shadow: 0 0 0 2px var(--ink), 5px 6px 0 2px var(--ink);
  rotate: -3deg;
}

.hero .cover-blank {
  padding: 14px;
  font-size: 24px;
}

.hero-cover .sticker {
  position: absolute;
  top: -22px;
  left: -26px;
  z-index: 1;
  --size: 64px;
  rotate: -18deg;
}

.hero h2 {
  margin-top: 24px;
  font: 400 32px/34px var(--display);
  text-shadow: 2px 3px 0 var(--ink);
  overflow-wrap: anywhere;
}

.hero-author {
  margin-top: 6px;
  font: 800 17px/22px var(--round);
}

.hero .tag {
  color: var(--ink);
}

.hero-actions {
  display: flex;
  gap: 10px;
  width: 100%;
  margin-top: 24px;
}

/* ---------- results ---------- */

.result {
  padding: 12px 16px;
}

/* 1, 2, 3 in little colored circles. */
.place {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: var(--edge);
  border-radius: 50%;
  background: var(--paper);
  font: 400 18px/1 var(--display);
}

.result:nth-child(1) .place {
  background: var(--butter);
}

.result:nth-child(2) .place {
  background: var(--lilac);
}

.result:nth-child(3) .place {
  background: var(--peach);
}

.result .cover {
  width: 40px;
  border-width: 0;
  border-radius: 5px;
  box-shadow: 0 0 0 2px var(--ink);
}

.result .cover-blank {
  padding: 0;
}

.result .cover-blank span {
  display: none;
}

.result-title {
  flex: 1;
  min-width: 0;
  font: 800 17px/22px var(--round);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- floating counter ---------- */

.pill {
  position: fixed;
  bottom: calc(14px + env(safe-area-inset-bottom));
  left: 50%;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100vw - 32px);
  padding: 11px 18px 11px 14px;
  border: var(--edge);
  border-radius: 999px;
  background: var(--butter);
  box-shadow: var(--pop);
  font: 800 15px/20px var(--round);
  white-space: nowrap;
  transform: translateX(-50%);
}

.pill:empty {
  display: none;
}

.pill .sticker {
  --size: 22px;
}

/* A butter sparkle would vanish on the butter pill. */
.pill .sticker-sparkle path {
  fill: #fff;
}

/* ---------- sheets ---------- */

dialog {
  padding: 0;
  border: 0;
  color: var(--ink);
}

/* Opening a sheet or alert moves focus to it, not onto one of its buttons. */
dialog:focus,
dialog:focus-visible {
  outline: none;
}

dialog::backdrop {
  background: rgb(42 15 46 / 0.5);
  animation: fade 0.25s;
}

.sheet {
  inset: auto 0 calc(10px + env(safe-area-inset-bottom)) 0;
  width: calc(100% - 20px);
  max-width: 540px;
  max-height: calc(100dvh - 70px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  margin: 0 auto;
  border: var(--edge);
  border-radius: 30px;
  background: var(--paper);
  box-shadow: 5px 5px 0 var(--ink);
  overflow: hidden;
  animation: sheet-up 0.42s cubic-bezier(0.32, 0.72, 0, 1);
}

.sheet-scroll {
  max-height: inherit;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sheet-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: var(--edge);
  border-radius: 50%;
  background: var(--paper);
  box-shadow: var(--pop-sm);
}

.sheet-close .icon {
  width: 16px;
  height: 16px;
}

.sheet-top {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 20px;
  align-items: end;
  padding: 32px 22px 24px;
  border-bottom: var(--edge);
  background: var(--tone, var(--blush));
}

.sheet-top .cover {
  width: 112px;
  rotate: -3deg;
}

.sheet-top h2 {
  font: 400 26px/28px var(--display);
  overflow-wrap: anywhere;
}

.sheet-top p {
  margin-top: 4px;
  font: 700 16px/21px var(--round);
  color: var(--ink-2);
}

.sheet-body {
  display: grid;
  /* Rows keep their full height; the sheet scrolls instead of squashing them. */
  grid-auto-rows: max-content;
  gap: 18px;
  padding: 20px 20px 24px;
}

.sheet-body .footnote {
  margin: -4px 0 0;
}

.sheet-body .group {
  box-shadow: var(--pop-sm);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chips li {
  padding: 4px 12px;
  border: var(--edge);
  border-radius: 999px;
  background: var(--lilac);
  font: 800 13px/18px var(--round);
}

.chips li:nth-child(3n + 2) {
  background: var(--mint);
}

.chips li:nth-child(3n) {
  background: var(--peach);
}

.detail-desc {
  white-space: pre-line;
  overflow-wrap: anywhere;
  -webkit-user-select: text;
  user-select: text;
}

/* A short menu of choices. */
.sheet.menu {
  border: 0;
  background: none;
  box-shadow: none;
  border-radius: 0;
  overflow: visible;
}

.sheet.menu .group + .group {
  margin-top: 12px;
}

.sheet.menu .row {
  min-height: 58px;
}

/* ---------- alerts ---------- */

.alert {
  width: min(330px, calc(100vw - 44px));
  padding: 24px 20px 20px;
  border: var(--edge);
  border-radius: 28px;
  background: var(--paper);
  box-shadow: 6px 6px 0 var(--ink);
  animation: alert-in 0.24s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}

.alert h2 {
  font: 400 26px/29px var(--display);
  overflow-wrap: anywhere;
}

.alert p {
  margin-top: 8px;
  font: 600 15px/20px var(--round);
  color: var(--ink-2);
}

.alert-input {
  display: block;
  width: 100%;
  height: 50px;
  margin-top: 16px;
  padding: 0 18px;
  border: var(--edge);
  border-radius: 25px;
  background: var(--paper);
  outline: none;
}

.alert-input:focus {
  box-shadow: 0 0 0 3px var(--blush);
}

.alert-input + .alert-input {
  margin-top: 10px;
}

.alert .alert-error {
  color: var(--red);
}

.alert-error:empty {
  display: none;
}

.alert-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.alert-button {
  flex: 1;
  height: 50px;
  padding: 0 12px;
  border: var(--edge);
  border-radius: 25px;
  background: var(--paper);
  font: 800 17px/22px var(--round);
  transition: transform 0.1s, box-shadow 0.1s;
}

.alert-button.is-default {
  background: var(--pink);
  box-shadow: var(--pop-sm);
}

.alert-button.is-danger {
  background: var(--red);
  box-shadow: var(--pop-sm);
  color: #fff;
}

.alert-button:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

.alert-button[disabled] {
  opacity: 0.5;
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  inset: auto auto calc(80px + env(safe-area-inset-bottom)) 50%;
  z-index: 20;
  width: max-content;
  max-width: calc(100vw - 32px);
  margin: 0;
  padding: 11px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font: 800 15px/20px var(--round);
  text-align: center;
  transform: translateX(-50%);
  pointer-events: none;
  animation: toast-in 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}

.confetti {
  position: fixed;
  inset: 0;
  z-index: 30;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.center-message {
  display: grid;
  gap: 18px;
  justify-items: center;
  padding: 110px 24px;
  text-align: center;
}

.center-message h1 {
  font: 400 30px/34px var(--display);
}

.center-message .button {
  width: auto;
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

@keyframes sheet-up {
  from {
    transform: translateY(110%);
  }
}

@keyframes alert-in {
  from {
    opacity: 0;
    transform: scale(0.86) rotate(-2deg);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 12px);
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
