/* 4/4 APP — base page and components. Only tokens, nesting ≤ 3 levels. */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  /* no browser scrollbar anywhere: it only showed an empty strip. The page keeps its width on every page, so the nav
     never shifts. The capsules page draws its own (js/components/scrollbar.js). */
  scrollbar-width: none;
  /* nothing may widen the page: on phones a wide child would otherwise zoom the whole layout out */
  overflow-x: clip;
  color-scheme: light;
  -webkit-text-size-adjust: 100%;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar,
.ask__box::-webkit-scrollbar {
  display: none;
}

.ask__box {
  scrollbar-width: none;
}

body {
  margin: 0;
  min-height: 100dvh;
  overflow-x: hidden;
  background: var(--seg-bg);
  color: var(--text-body-color);
  font-family: var(--text-font-family);
  font-size: var(--text-body-size);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ---------- WebGL canvas ---------- */
.gl {
  position: fixed;
  inset: 0;
  z-index: -1;
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1.4s var(--ease-out);
}

.gl-ready .gl {
  opacity: 1;
}

.no-webgl .gl {
  display: none;
}

.no-webgl body {
  background:
    radial-gradient(60rem 40rem at 78% 40%, color-mix(in srgb, var(--seg-2) 35%, transparent), transparent 70%),
    radial-gradient(50rem 36rem at 10% 0%, color-mix(in srgb, var(--seg-4) 22%, transparent), transparent 70%),
    var(--seg-bg);
}

/* the orb is only for devices with no WebGL at all; otherwise the crystal fades in on its own */
.gl-failed .stage__orb {
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--seg-2), var(--seg-1) 60%, var(--seg-4));
  opacity: 0.85;
}

/* ---------- layout ---------- */
.page {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  min-height: 100dvh;
  padding-inline: var(--page-gutter);
}

.site-header,
.stage {
  width: 100%;
  max-width: var(--page-max-width);
  margin-inline: auto;
}

/* ---------- navigation: no frame, the items sit straight on the page background ---------- */
/* static only: no animation, no blur, no filters, and it scrolls away with the page (nothing to paint behind it) */
.site-header {
  position: relative;
  z-index: 50;
  padding-block: var(--size-3);
}

.nav {
  display: flex;
  gap: var(--size-4);
  align-items: center;
  min-height: 3.6rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--size-3);
  margin-right: auto;
  font-family: var(--text-display-family);
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* a small cut gem in the live segment colors */
.brand__mark {
  flex: none;
  width: 1.7rem;
  height: 1.9rem;
  background:
    linear-gradient(115deg, rgb(255 255 255 / 0.55) 0 22%, transparent 22% 100%),
    linear-gradient(135deg, var(--seg-1), var(--seg-3));
  clip-path: polygon(50% 0, 100% 38%, 50% 100%, 0 38%);
}

.nav__links,
.nav__end {
  display: flex;
  align-items: center;
}

.nav__links {
  gap: var(--size-1);
}

.nav__end {
  flex: none;
  gap: var(--size-2);
}

/* light / dark switch: a round button that shows the mode you would switch to */
.mode {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 1px solid var(--surface-glass-border);
  border-radius: 50%;
  background: var(--surface-field-bg);
  color: var(--text-title-color);
  cursor: pointer;
  transition:
    background var(--duration-1),
    transform var(--duration-2) var(--ease-out);

  &:hover {
    background: var(--surface-field-bg-hover);
    transform: translateY(-1px);
  }

  & .icon {
    grid-area: 1 / 1;
    width: 1.15rem;
    height: 1.15rem;
    transition:
      transform 0.5s var(--ease-out),
      opacity 0.3s;
  }
}

:root:not([data-theme="dark"]) .mode .icon:nth-child(2) {
  opacity: 0;
  transform: rotate(-70deg) scale(0.5);
}

:root[data-theme="dark"] .mode .icon:nth-child(1) {
  opacity: 0;
  transform: rotate(70deg) scale(0.5);
}

/* the sky page is always night: its switch sits on the dark sheet in either mode */
.night .mode {
  --surface-field-bg: rgb(255 255 255 / 0.1);
  --surface-field-bg-hover: rgb(255 255 255 / 0.18);
  --surface-glass-border: rgb(255 255 255 / 0.22);
}

/* ---------- switching light / dark ---------- */
/* browsers with View Transitions crossfade the whole page; this sets how long and how */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.5s;
  animation-timing-function: ease;
}

/* browsers without it: the colors fade through ordinary transitions for a moment */
.theme-fade,
.theme-fade *,
.theme-fade *::before,
.theme-fade *::after {
  transition:
    background-color 0.45s ease,
    color 0.45s ease,
    border-color 0.45s ease,
    fill 0.45s ease,
    stroke 0.45s ease,
    box-shadow 0.45s ease !important;
}

.nav__link,
.nav__ghost,
.nav__cta,
.menu__item {
  display: inline-flex;
  gap: var(--size-2);
  align-items: center;
  border: 0;
  font: inherit;
  font-size: var(--font-size-2);
  font-weight: 700;
  cursor: pointer;
  transition: background var(--duration-1), color var(--duration-1);
}

/* plain text links: the color changes on hover, the current page is underlined in the segment color */
.nav__link,
.nav__ghost {
  min-height: 2.75rem;
  padding: 0 var(--size-4);
  background: none;
  color: var(--text-muted-color);

  &:hover,
  &[aria-current="page"] {
    color: var(--text-title-color);
  }

  &[aria-current="page"] {
    text-decoration: 2px underline var(--seg-1);
    text-underline-offset: 0.5rem;
  }
}

.nav__ghost {
  color: var(--text-title-color);
}

/* the main action is a cut gem like the site's cards: faceted face, two cut corners, a bright edge.
   Static shapes only (clip-path + gradients): no filter, blur or animation, so it costs nothing to paint. */
.nav__gem {
  --cut: 0.7rem;
  display: inline-flex;
  padding: 1.5px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--seg-2) 60%, var(--white)), var(--seg-1) 55%, var(--seg-3));
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
}

.nav__cta {
  min-height: 2.6rem;
  padding: 0 var(--size-5) 0 0.45rem;
  background:
    linear-gradient(135deg, rgb(255 255 255 / 0.85) 0 18%, transparent 18%),
    linear-gradient(315deg, color-mix(in srgb, var(--seg-3) 35%, transparent) 0 14%, transparent 14%),
    color-mix(in srgb, var(--seg-2) 55%, var(--white));
  clip-path: polygon(calc(var(--cut) - 1.5px) 0, 100% 0, 100% calc(100% - var(--cut) + 1.5px), calc(100% - var(--cut) + 1.5px) 100%, 0 100%, 0 calc(var(--cut) - 1.5px));
  color: var(--ink-900);
  font-weight: 800;

  &:hover {
    background:
      linear-gradient(135deg, rgb(255 255 255 / 0.95) 0 18%, transparent 18%),
      linear-gradient(315deg, color-mix(in srgb, var(--seg-3) 45%, transparent) 0 14%, transparent 14%),
      color-mix(in srgb, var(--seg-2) 75%, var(--white));
  }
}

.nav__cta-gem {
  display: grid;
  flex: none;
  place-items: center;
  width: 1.7rem;
  height: 1.9rem;
  background:
    linear-gradient(115deg, rgb(255 255 255 / 0.6) 0 24%, transparent 24%),
    linear-gradient(135deg, var(--seg-1), var(--seg-3));
  color: var(--ink-900);
  clip-path: polygon(50% 0, 100% 38%, 50% 100%, 0 38%);

  & .icon {
    width: 0.8rem;
    height: 0.8rem;
    margin-top: -0.2rem;
  }
}

/* the profile: a small round picture (the photo, or the initial) that opens the account menu */
.avatar {
  position: relative;
}

.avatar__btn {
  display: grid;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;

  &:hover .avatar__pic {
    background: var(--surface-glass-bg-hover);
  }
}

.avatar .avatar__badge {
  position: absolute;
  right: -0.35rem;
  bottom: -0.35rem;
  margin: 0;
  pointer-events: none;
}

.avatar__pic {
  display: grid;
  flex: none;
  place-items: center;
  width: var(--pic, 2.3rem);
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--surface-glass-border);
  border-radius: 50%;
  background: var(--surface-glass-bg);
  color: var(--text-title-color);
  font-size: calc(var(--pic, 2.3rem) * 0.42);
  font-weight: 800;

  & img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}

/* ---------- profile card: facet cover, a large photo with a camera button, name, email, about ---------- */
.profile__face {
  display: grid;
  overflow: hidden;
  padding: 0;
}

.profile__cover {
  height: 6rem;
  background:
    linear-gradient(120deg, rgb(255 255 255 / 0.5) 0 18%, transparent 18%),
    linear-gradient(300deg, color-mix(in srgb, var(--seg-4) 40%, transparent) 0 22%, transparent 22%),
    linear-gradient(135deg, var(--seg-2), var(--seg-1) 70%, var(--seg-3));
}

.profile__body {
  display: grid;
  gap: var(--size-2);
  justify-items: center;
  padding: 0 var(--size-6) var(--size-6);
  text-align: center;
}

.profile__photo {
  position: relative;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  cursor: pointer;
  margin-top: -3.4rem;
  margin-bottom: var(--size-2);

  & .avatar__pic {
    --pic: 6.8rem;
    border: 4px solid var(--surface-solid);
    background: var(--surface-solid);
    box-shadow: 0 0 0 2px var(--seg-1);
  }
}

.profile__cam {
  position: absolute;
  right: 0.1rem;
  bottom: 0.1rem;
  display: grid;
  place-items: center;
  width: 2.3rem;
  height: 2.3rem;
  border: 3px solid var(--surface-solid);
  border-radius: 50%;
  background: var(--action-primary-bg);
  color: var(--action-primary-text);
  cursor: pointer;

  & .icon {
    width: 1rem;
    height: 1rem;
  }

}

.profile__photo:focus-visible .avatar__pic {
  box-shadow: 0 0 0 2px var(--seg-1), var(--focus-ring);
}

.profile__name {
  margin: 0;
  font-family: var(--text-display-family);
  font-size: clamp(1.6rem, 6vw, 2.1rem);
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.profile__email {
  margin: 0;
  color: var(--text-muted-color);
  overflow-wrap: anywhere;
}

.profile__bio {
  max-width: 32rem;
  margin: var(--size-2) 0 0;
  overflow-wrap: anywhere;
}

/* the page is one column, always the same width; the menu sits on top of it, My profile first */
.profile-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start; /* rows stay at the top instead of spreading over the free height */
  gap: var(--size-3);
  width: 100%;
  max-width: 40rem;
  margin-inline: auto;
  padding-block: var(--size-3) var(--size-6);
}

/* a plain row of tabs with a line under it; the open one is underlined (profile sections, capsule categories) */
.tabs {
  justify-self: center;
  max-width: 100%;
}

.tabs__row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 var(--size-2);
  border-bottom: 1px solid var(--surface-glass-border);
}

.tab {
  position: relative;
  display: flex;
  flex: none;
  gap: 0.45rem;
  align-items: center;
  min-width: 0;
  padding: 0.55rem 1rem;
  border: 0;
  background: none;
  color: var(--text-muted-color);
  font: 700 0.9rem var(--font-family-sans);
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--duration-1);

  & .icon {
    flex: none;
    width: 1.05rem;
    height: 1.05rem;
  }

  & .nav__badge {
    position: static;
    margin: 0 0 0 0.1rem;
  }

  & small {
    color: var(--text-muted-color);
    font-size: 0.75rem;
    font-weight: 500;
  }

  &::after {
    content: "";
    position: absolute;
    inset: auto 0.5rem -1px;
    height: 2px;
    background: var(--seg-1);
    transform: scaleX(0);
    transition: transform var(--duration-2) var(--ease-out);
  }

  &:hover {
    color: var(--text-title-color);
  }

  &[aria-selected="true"] {
    color: var(--text-title-color);

    &::after {
      transform: scaleX(1);
    }
  }

  &:focus-visible {
    outline: 2px solid var(--seg-1);
    outline-offset: -2px;
  }
}

.profile__main {
  display: grid;
  align-content: start;
  min-width: 0;
  gap: var(--size-5);
}

/* every page of the profile is the same width and at least the same height; it grows when it has more to show */
.profile__main > .gem {
  display: grid;
  min-height: 34rem;
}

.profile__main > .gem > .auth__face {
  align-content: start;
  padding: var(--size-5);
}

/* the profile tab: a switch, the card as others see it, then the editing form below it */
.profile__stack {
  display: grid;
  align-content: start;
  gap: var(--size-3);
}

/* the form that replaces the card's text when you edit */
.profile__body > .profile__form {
  justify-self: stretch;
  width: 100%;
  margin-top: var(--size-3);
  text-align: left;
}

/* the profile card holds everything without scrolling: a short cover, a smaller photo, empty lines take no room */
.profile__main .profile__cover {
  height: 4rem;
}

.profile__main .profile__body {
  gap: var(--size-1);
  padding-bottom: var(--size-4);

  & > :empty {
    display: none;
  }
}

.profile__main .profile__photo {
  margin-top: -2.8rem;
  margin-bottom: var(--size-1);

  & .avatar__pic {
    --pic: 5.6rem;
  }
}

.profile__main .profile__fields,
.profile__main .profile__form {
  gap: var(--size-3);
}


.profile__form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--size-4);
}

.profile__fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--size-4);

  @media (max-width: 40rem) {
    grid-template-columns: minmax(0, 1fr);
  }
}

.profile__wide {
  grid-column: 1 / -1;
}

.profile__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--size-3);
  align-items: center;
  justify-content: center;
  margin-top: var(--size-3);
}

.menu {
  position: absolute;
  top: calc(100% + var(--size-3));
  right: 0;
  min-width: 14.5rem;
}

.menu__panel {
  display: grid;
  gap: var(--size-1);
  padding: var(--size-2);
  border: 1px solid var(--edge, var(--surface-glass-border));
  border-radius: 1.1rem;
  background: color-mix(in srgb, var(--surface-tint-base) 94%, var(--seg-2));
  box-shadow: 0 18px 36px -18px color-mix(in srgb, var(--seg-1) 60%, transparent);
}

.menu__who {
  display: grid;
  padding: var(--size-3) var(--size-4);
  border-bottom: 1px solid var(--surface-glass-border);
  font-size: var(--text-caption-size);

  & span {
    overflow: hidden;
    color: var(--text-muted-color);
    text-overflow: ellipsis;
  }
}

.menu__item {
  display: block;
  padding: var(--size-3) var(--size-4);
  border-radius: 0.7rem;
  background: none;
  color: var(--text-title-color);
  font-weight: 600;
  text-align: left;

  &:hover {
    background: color-mix(in srgb, var(--seg-2) 24%, transparent);
  }

  &[aria-current="page"] {
    background: color-mix(in srgb, var(--seg-1) 14%, transparent);
  }
}

.menu__item--mobile {
  display: none;
}

@media (max-width: 40rem) {
  .nav {
    gap: var(--size-2);
  }

  .brand__name,
  .nav__links,
  .nav__cta-label {
    display: none;
  }

  .nav__cta:has(.nav__cta-label) {
    padding-right: 0.5rem;
  }

  .menu__item--mobile {
    display: block;
  }
}

[hidden] {
  display: none !important;
}

.link-quiet {
  padding: var(--size-2) var(--size-4);
  border: 0;
  background: none;
  font: inherit;
  cursor: pointer;
  border-radius: var(--radius-pill);
  color: var(--text-muted-color);
  transition: color var(--duration-1), background var(--duration-1);

  &:hover {
    color: var(--text-title-color);
    background: var(--surface-glass-bg);
  }
}

.stage {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: var(--size-7);
  align-items: center;
  padding-block: var(--size-3);
}

/* the home page fits one screen: what is tall scales with the height of the window, so nothing scrolls */
.stage .gate__arch {
  height: clamp(6.5rem, 19dvh, 12rem);
  aspect-ratio: auto;
}

.stage .lede {
  margin-top: var(--size-4);
}

.stage .picker {
  margin-top: var(--size-5);
}

.stage .picker__legend {
  margin-bottom: var(--size-3);
}

.stage .ticket {
  min-height: 4rem;
  margin-top: var(--size-3);
  padding-block: var(--size-3);
}

.stage .actions {
  margin-top: var(--size-4);
}

.stage + .site-footer {
  padding-block: var(--size-3);
}

.stage__orb {
  justify-self: center;
  width: min(100%, 68dvh);
  aspect-ratio: 1;
}

.site-footer {
  padding-block: var(--size-5);
  color: var(--text-muted-color);
  font-size: var(--text-caption-size);
}

/* ---------- headline ---------- */
.title {
  margin: 0;
  color: var(--text-title-color);
  font-size: var(--text-title-size);
  font-family: var(--text-display-family);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.title__line {
  display: block;
}

.title__line--accent .char {
  color: color-mix(in oklab, var(--title-accent-from), var(--title-accent-to) calc(var(--t, 0) * 100%));
}

.word {
  display: inline-block;
  white-space: nowrap;
}

.char {
  display: inline-block;
  opacity: 0;
  animation: char-in 0.6s var(--ease-out) forwards;
  animation-delay: calc(var(--i, 0) * 14ms);
}

.lede {
  max-width: 34rem;
  margin: var(--size-5) 0 0;
  color: var(--text-muted-color);
  font-size: var(--text-lede-size);
}

/* ---------- segment gates ---------- */
.picker {
  min-width: 0;
  margin: var(--size-6) 0 0;
  padding: 0;
  border: 0;
}

.picker__legend {
  margin-bottom: var(--size-4);
  padding: 0;
  color: var(--text-muted-color);
  font-size: var(--text-caption-size);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.picker__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--size-4);
}

.gate {
  position: relative;
  display: grid;
  justify-items: center;
  gap: var(--size-2);
  text-align: center;
  cursor: pointer;
  transition: transform var(--duration-2) var(--ease-out);

  &:hover {
    transform: translateY(-5px);
  }

  &:hover .gate__light {
    opacity: 0.7;
  }

  &:has(.gate__input:checked) .gate__arch {
    box-shadow:
      inset 0 0 0 2px var(--gate-1),
      0 28px 50px -22px var(--gate-1);
  }

  &:has(.gate__input:checked) .gate__light {
    opacity: 1;
    transform: none;
  }

  &:has(.gate__input:checked) .gate__veil--l {
    transform: translateX(-102%);
  }

  &:has(.gate__input:checked) .gate__veil--r {
    transform: translateX(102%);
  }

  &:has(.gate__input:checked) .gate__title {
    color: var(--gate-4);
  }

  &:has(.gate__input:focus-visible) .gate__arch {
    box-shadow: var(--focus-ring);
  }
}

.gate[data-seg="parents"] {
  --gate-1: var(--theme-parents-1);
  --gate-2: var(--theme-parents-2);
  --gate-4: var(--theme-parents-4);
}

.gate[data-seg="couples"] {
  --gate-1: var(--theme-couples-1);
  --gate-2: var(--theme-couples-2);
  --gate-4: var(--theme-couples-4);
}

.gate[data-seg="friends"] {
  --gate-1: var(--theme-friends-1);
  --gate-2: var(--theme-friends-2);
  --gate-4: var(--theme-friends-4);
}

.gate[data-seg="self"] {
  --gate-1: var(--theme-self-1);
  --gate-2: var(--theme-self-2);
  --gate-4: var(--theme-self-4);
}

.gate__input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

/* an arched doorway: a glowing light behind two frosted panes that slide apart when picked */
.gate__arch {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 3 / 3.6;
  overflow: hidden;
  border-radius: 50% 50% 0.6rem 0.6rem / 36% 36% 0.6rem 0.6rem;
  background: linear-gradient(180deg, color-mix(in srgb, var(--gate-1) 8%, var(--surface-tint-base)), color-mix(in srgb, var(--gate-2) 55%, var(--surface-tint-base)));
  box-shadow:
    inset 0 0 0 1.5px color-mix(in srgb, var(--gate-1) 40%, transparent),
    0 18px 36px -24px var(--gate-1);
  transition: box-shadow var(--duration-2);
}

.gate__light {
  position: absolute;
  inset: 0;
  background: radial-gradient(130% 95% at 50% 105%, var(--gate-1), color-mix(in srgb, var(--gate-2) 70%, transparent) 55%, transparent 82%);
  opacity: 0.4;
  transform: translateY(16%);
  transition:
    opacity var(--duration-3) var(--ease-out),
    transform var(--duration-3) var(--ease-out);
}

.gate__veil {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  background: var(--surface-veil);
  transition: transform 0.8s var(--ease-out);
}

.gate__veil--l {
  left: 0;
  border-right: 1px solid var(--surface-veil-edge);
}

.gate__veil--r {
  right: 0;
  border-left: 1px solid var(--surface-veil-edge);
}

.gate__glyph,
.btn__arrow,
.icon,
.ticket__seal svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.gate__glyph {
  position: relative;
  z-index: 1;
  width: 34%;
  color: var(--text-title-color);
}

.gate__title {
  margin-top: var(--size-1);
  font-weight: 700;
  letter-spacing: -0.01em;
  transition: color var(--duration-2);
}

.gate__sub {
  margin-top: calc(var(--size-2) * -1);
  color: var(--text-muted-color);
  font-size: var(--text-caption-size);
}

/* ---------- glass surface (ticket, write sheet) ---------- */
.glass {
  border: 1px solid var(--surface-glass-border);
  border-radius: var(--surface-radius);
  background: var(--surface-glass-bg);
}

/* ---------- sample capsule ---------- */
.ticket {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--size-4);
  align-items: center;
  min-height: 4.6rem;
  margin-top: var(--size-4);
  padding: var(--size-4) var(--size-5);
  overflow: hidden;
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity var(--duration-2),
    transform var(--duration-2) var(--ease-out);

  &[data-state="ready"] {
    opacity: 1;
    transform: none;
  }

  &::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg, transparent 30%, rgb(255 255 255 / 0.7) 50%, transparent 70%);
    transform: translateX(-100%);
    animation: sweep 4.5s ease-in-out infinite;
    pointer-events: none;
  }
}

.ticket__seal {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  color: var(--ink-900);
  background: linear-gradient(135deg, var(--seg-1), var(--seg-3));
}

.ticket__seal svg {
  width: 1.2rem;
  height: 1.2rem;
}

.ticket__quote {
  margin: 0;
  font-weight: 600;
  line-height: 1.35;
}

.ticket__meta {
  margin: var(--size-1) 0 0;
  color: var(--text-muted-color);
  font-size: var(--text-caption-size);
}

.ticket.is-in .ticket__quote,
.ticket.is-in .ticket__meta {
  animation: fade-up var(--duration-3) var(--ease-out);
}

/* ---------- actions ---------- */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--size-5);
  align-items: center;
  margin-top: var(--size-5);
}

.btn {
  position: relative;
  border: 0;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--action-gap);
  min-height: var(--action-height);
  font-weight: 800;
  letter-spacing: -0.01em;
}

.btn__arrow {
  width: 1.2rem;
  height: 1.2rem;
}

/* ---------- write: atmosphere (the crystal's light, without the crystal) ---------- */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  /* its own GPU layer, painted once: hovering or scrolling the page never repaints the background */
  contain: strict;
  will-change: transform;
}

.halo.is-pending {
  opacity: 0;
}

.halo {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  transition: opacity 1.2s var(--ease-out);
}

.halo__ring {
  position: relative;
  grid-area: 1 / 1;
  width: var(--d);
  aspect-ratio: 1;
  animation: spin var(--spin) linear infinite;
  animation-direction: var(--dir);

  & > svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
  }
}

.halo__item {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  transform: rotate(var(--a)) translateX(calc(var(--d) / 2));
}

/* keepsakes in orbit: the sticker turns against its ring so it always stays upright */
.sticker {
  display: grid;
  place-items: center;
  width: 2.9rem;
  height: 2.9rem;
  margin: -1.45rem 0 0 -1.45rem;
  rotate: calc(var(--a) * -1);
  animation: spin var(--spin) linear infinite;
  animation-direction: var(--dir-inv);
}

.sticker__body {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border: 3px solid var(--surface-solid);
  border-radius: 50%;
  background: var(--surface-solid);
  color: var(--c);
  box-shadow:
    0 12px 24px -10px color-mix(in srgb, var(--seg-1) 70%, transparent),
    0 0 0 1px var(--surface-glass-border);
  animation: pop 0.9s var(--ease-out) both;

  & .icon {
    width: 1.4rem;
    height: 1.4rem;
  }
}

.spark {
  position: absolute;
  width: calc(1.1rem * var(--s));
  height: calc(1.1rem * var(--s));
  background: color-mix(in srgb, var(--seg-1) 65%, var(--white));
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  animation: twinkle 3.6s ease-in-out infinite;
  animation-delay: var(--delay);
}

.burst {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
}

.burst__p {
  position: absolute;
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
}

/* ---------- unseal: the opening moment of a capsule (WebGL crystal, see gl/unseal-gl.js) ---------- */
.unseal {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--ink-900);
}

.unseal > * {
  grid-area: 1 / 1;
}

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

.unseal__time,
.unseal__cap {
  position: relative;
  display: grid;
  gap: var(--size-1);
  align-self: end;
  margin-bottom: 9dvh;
  color: var(--white);
  text-align: center;
  opacity: 0;
  pointer-events: none;
}

.unseal__num {
  font-family: var(--text-display-family);
  font-size: clamp(2.6rem, 9vmin, 4.6rem);
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.unseal__unit,
.unseal__cap span {
  color: color-mix(in srgb, var(--white) 70%, transparent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.unseal__cap strong {
  font-family: var(--text-display-family);
  font-size: clamp(1.4rem, 4.4vmin, 2.2rem);
  font-weight: 800;
}

/* ---------- write: layout ---------- */
.write {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--size-6);
  width: 100%;
  max-width: 46rem;
  margin-inline: auto;
  padding-block: var(--size-3) var(--size-7);
}

/* a page's main area dissolves when the capsule is sealed */
.view {
  transition:
    opacity 0.7s var(--ease-out) 0.1s,
    transform 0.7s var(--ease-out) 0.1s;
}

.is-sealing .view {
  opacity: 0;
  transform: translateY(-10px) scale(0.96);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--size-5);
  justify-items: center;
  text-align: center;
}

.hero > .picker {
  margin: 0;
}

.title--write {
  font-size: clamp(2rem, 1rem + 3vw, 3.4rem);
}

.write__desk {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--size-5);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.chips,
.prompts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--size-2);
  justify-content: center;
}

.chip {
  position: relative;
  padding: var(--size-2) var(--size-5);
  border: 1px solid var(--surface-glass-border);
  border-radius: var(--radius-pill);
  background: var(--surface-glass-bg-hover);
  font-weight: 600;
  cursor: pointer;
  transition:
    background var(--duration-1),
    box-shadow var(--duration-1);

  &:hover {
    background: var(--surface-field-bg-hover);
  }

  &:has(:checked),
  &[aria-selected="true"] {
    border-color: transparent;
    background: var(--action-primary-bg);
    color: var(--action-primary-text);
    box-shadow: 0 3px 0 0 var(--action-primary-accent);
  }

  &:has(:focus-visible) {
    box-shadow: var(--focus-ring);
  }
}

.chip__input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.prompt {
  padding: var(--size-2) var(--size-4);
  border: 1px dashed color-mix(in srgb, var(--seg-1) 60%, transparent);
  border-radius: var(--radius-pill);
  background: none;
  color: var(--text-muted-color);
  font: inherit;
  font-size: var(--text-caption-size);
  cursor: pointer;
  transition:
    color var(--duration-1),
    background var(--duration-1);

  &:hover {
    border-style: solid;
    background: var(--surface-glass-bg);
    color: var(--text-title-color);
  }
}

.prompt--more,
.prompt[aria-pressed="true"] {
  border-style: solid;
  color: var(--text-title-color);
}

.prompt[aria-pressed="true"] {
  background: color-mix(in srgb, var(--seg-1) 22%, transparent);
}

/* round color badge: dock buttons, memo headers, file chips */
.badge {
  display: grid;
  flex: none;
  place-items: center;
  width: 2.3rem;
  height: 2.3rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--seg-1), var(--seg-3));
  color: var(--white);
  box-shadow: 0 8px 16px -8px color-mix(in srgb, var(--seg-1) 90%, transparent);

  & .icon {
    width: 1.2rem;
    height: 1.2rem;
  }
}

.badge--lg {
  width: 3.6rem;
  height: 3.6rem;

  & .icon {
    width: 1.7rem;
    height: 1.7rem;
  }
}

/* ---------- gem: a cut-corner facet card with a light-catching edge ---------- */
.gem {
  --cut: 1.15rem;
  --gem-line: color-mix(in srgb, var(--seg-1) 55%, var(--white));
  position: relative;
}

.gem__face,
.btn {
  position: relative;
  clip-path: polygon(
    var(--cut) 0,
    100% 0,
    100% calc(100% - var(--cut)),
    calc(100% - var(--cut)) 100%,
    0 100%,
    0 var(--cut)
  );
  background:
    radial-gradient(18rem circle at var(--mx, 25%) var(--my, -10%), var(--surface-glow), transparent 65%),
    linear-gradient(135deg, color-mix(in srgb, var(--seg-2) var(--gem-facet-a), transparent) 0 20%, transparent 20%),
    linear-gradient(315deg, color-mix(in srgb, var(--seg-3) var(--gem-facet-b), transparent) 0 14%, transparent 14%),
    color-mix(in srgb, var(--surface-tint-base) 84%, var(--seg-2));

  /* hairline edge that glows where the pointer is */
  &::before {
    content: "";
    position: absolute;
    inset: 0;
    padding: 1.5px;
    background:
      radial-gradient(12rem circle at var(--mx, 25%) var(--my, -10%), var(--seg-1), transparent 70%),
      linear-gradient(
        135deg,
        color-mix(in srgb, var(--seg-2) 90%, var(--white)),
        color-mix(in srgb, var(--seg-3) 55%, var(--white)) 50%,
        color-mix(in srgb, var(--seg-1) 50%, var(--white))
      );
    -webkit-mask: linear-gradient(var(--ink-900) 0 0) content-box, linear-gradient(var(--ink-900) 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(var(--ink-900) 0 0) content-box exclude, linear-gradient(var(--ink-900) 0 0);
    pointer-events: none;
  }

  /* the two cut corners get their own edge line */
  &::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
      linear-gradient(135deg, transparent calc(50% + 0.5px), var(--gem-line) calc(50% + 0.5px) calc(50% + 2px), transparent calc(50% + 2px)) 0 0 / var(--cut) var(--cut) no-repeat,
      linear-gradient(135deg, transparent calc(50% - 2px), var(--gem-line) calc(50% - 2px) calc(50% - 0.5px), transparent calc(50% - 0.5px)) 100% 100% / var(--cut) var(--cut) no-repeat;
    pointer-events: none;
  }
}

/* ---------- buttons: cut gems, like the cards and the "New capsule" button ----------
   They share the gem face above (cut corners, facets, a bright edge). The main action is lit, with a small
   diamond that holds the arrow; the quiet one is the plain face. */
.btn {
  --cut: 0.9rem;
  --gem-line: color-mix(in srgb, var(--seg-1) 55%, var(--white));
  transition: transform var(--duration-2) var(--ease-out);

  /* the cut corners would clip an outer ring, so the focus ring is drawn inside */
  &:focus-visible {
    outline: 2px solid var(--seg-1);
    outline-offset: -5px;
  }
}

.btn--quiet {
  justify-content: center;
  padding: 0.5rem 1.8rem;
  color: var(--text-title-color);
  font-size: var(--font-size-2);
  text-decoration: none;

  &:hover {
    --gem-facet-a: 85%;
    --gem-facet-b: 40%;
  }
}

/* the same gem face in red, for actions that end something (log out) */
.btn--danger {
  --seg-1: #e5484d;
  --seg-2: #f87171;
  --seg-3: #dc2626;
  --gem-facet-a: 45%;
  --gem-facet-b: 30%;
  background:
    linear-gradient(135deg, rgb(255 255 255 / 0.3) 0 20%, transparent 20%),
    linear-gradient(315deg, color-mix(in srgb, var(--seg-3) 45%, transparent) 0 14%, transparent 14%),
    color-mix(in srgb, var(--seg-2) 26%, var(--surface-tint-base));
  color: color-mix(in srgb, #dc2626 75%, var(--text-title-color));
  font-weight: 700;

  &:hover {
    --gem-facet-a: 65%;
    --gem-facet-b: 45%;
    background:
      linear-gradient(135deg, rgb(255 255 255 / 0.4) 0 20%, transparent 20%),
      linear-gradient(315deg, color-mix(in srgb, var(--seg-3) 55%, transparent) 0 14%, transparent 14%),
      color-mix(in srgb, var(--seg-2) 40%, var(--surface-tint-base));
  }
}

.btn--primary {
  min-height: 3.6rem;
  padding: 0.4rem 0.6rem 0.4rem 2rem;
  background:
    linear-gradient(135deg, rgb(255 255 255 / 0.85) 0 16%, transparent 16%),
    linear-gradient(315deg, color-mix(in srgb, var(--seg-3) 35%, transparent) 0 12%, transparent 12%),
    color-mix(in srgb, var(--seg-2) 55%, var(--white));
  color: var(--ink-900);
  font-size: var(--action-primary-size);

  &:not(:has(.btn__chip)) {
    justify-content: center;
    padding-inline: 2.2rem;
  }

  &:hover {
    transform: translateY(-2px);
    background:
      linear-gradient(135deg, rgb(255 255 255 / 0.95) 0 16%, transparent 16%),
      linear-gradient(315deg, color-mix(in srgb, var(--seg-3) 45%, transparent) 0 12%, transparent 12%),
      color-mix(in srgb, var(--seg-2) 75%, var(--white));
  }

  &:active {
    transform: translateY(1px);
  }

  &:hover .btn__arrow {
    translate: 3px 0;
  }
}

/* the arrow sits in a small lit diamond, the same gem as in the "New capsule" button */
.btn__chip {
  display: grid;
  flex: none;
  place-items: center;
  width: 2.5rem;
  height: 2.8rem;
  background:
    linear-gradient(115deg, rgb(255 255 255 / 0.6) 0 24%, transparent 24%),
    linear-gradient(135deg, var(--seg-1), var(--seg-3));
  color: var(--ink-900);
  clip-path: polygon(50% 0, 100% 38%, 50% 100%, 0 38%);

  & .btn__arrow {
    margin-top: -0.35rem;
    transition: translate var(--duration-2) var(--ease-out);
  }
}

/* ---------- memo (a keepsake in the draft) ---------- */
.memos {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--size-5);
}

.memo {
  animation: fade-up var(--duration-3) var(--ease-out) both;
}

.memo__face {
  display: grid;
  gap: var(--size-4);
  padding: var(--size-5) var(--size-6) var(--size-5) var(--size-5);
}

.memo__head {
  display: flex;
  gap: var(--size-3);
  align-items: center;
}

.memo__titles {
  display: grid;
  flex: 1;
  min-width: 0;
  line-height: 1.25;
}

.memo__kind {
  color: var(--text-muted-color);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.memo__prompt,
.memo__title {
  font-family: var(--text-display-family);
  font-size: var(--text-body-size);
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* the letter's title: it looks like plain text until you point at it */
.memo__title {
  width: 100%;
  min-width: 0;
  padding: 0.1rem 0;
  border: 0;
  border-bottom: 1px dashed transparent;
  background: none;
  color: var(--text-title-color);
  transition: border-color var(--duration-1);

  &:hover,
  &:focus-visible {
    border-bottom-color: color-mix(in srgb, var(--seg-1) 60%, transparent);
    outline: 0;
  }

  &::placeholder {
    color: var(--text-muted-color);
    font-weight: 500;
  }
}

.memo__remove {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--text-muted-color);
  cursor: pointer;
  transition:
    background var(--duration-1),
    color var(--duration-1);

  &:hover {
    background: var(--surface-glass-bg-hover);
    color: var(--text-title-color);
  }

  & .icon {
    width: 1.1rem;
    height: 1.1rem;
  }
}

.memo__body {
  display: grid;
  gap: var(--size-3);
}

.memo__text,
.memo__caption {
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  caret-color: var(--seg-1);

  &:focus-visible {
    outline: none;
    box-shadow: none;
  }

  &::placeholder {
    color: var(--text-muted-color);
    opacity: 0.75;
  }
}

.memo__text {
  min-height: 7.5rem;
  font-size: 1.08rem;
  line-height: 1.75;
  resize: none;
  overflow: hidden;
}

.memo__caption {
  padding-bottom: var(--size-2);
  border-bottom: 1px solid var(--surface-glass-border);
  transition: border-color var(--duration-1);

  &:focus-visible {
    border-color: var(--seg-1);
  }
}

.memo__photo,
.memo__video {
  display: block;
  width: 100%;
  max-height: 26rem;
  border-radius: var(--radius-2);
}

.memo__photo {
  object-fit: cover;
}

.memo__video {
  background: var(--ink-900);
  object-fit: contain;
}

.memo audio {
  width: 100%;
}

.memo__missing {
  margin: 0;
  color: var(--text-muted-color);
}

.filechip {
  display: flex;
  gap: var(--size-3);
  align-items: center;
  padding: var(--size-3) var(--size-4);
  border-radius: var(--radius-2);
  background: color-mix(in srgb, var(--seg-2) 32%, var(--surface-tint-base));
  transition: background var(--duration-1);

  &:hover {
    background: color-mix(in srgb, var(--seg-2) 55%, var(--surface-tint-base));
  }
}

.filechip__text {
  display: grid;
  min-width: 0;
  line-height: 1.3;
}

.filechip__name {
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filechip__size {
  color: var(--text-muted-color);
  font-size: var(--text-caption-size);
}

/* voice recorder */
.rec {
  display: flex;
  gap: var(--size-4);
  align-items: center;
}

.rec__btn {
  display: grid;
  flex: none;
  place-items: center;
  width: 3.6rem;
  height: 3.6rem;
  border: 0;
  border-radius: 50%;
  background: var(--action-primary-bg);
  color: var(--action-primary-text);
  box-shadow: 0 4px 0 0 var(--action-primary-accent);
  cursor: pointer;
  transition:
    transform var(--duration-1),
    box-shadow var(--duration-1);

  &:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 0 var(--action-primary-accent);
  }

  & .icon {
    width: 1.5rem;
    height: 1.5rem;
  }
}

.rec.is-live .rec__btn {
  background: var(--seg-1);
}

.rec__time {
  min-width: 2.6rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.rec__bars {
  display: flex;
  gap: 3px;
  align-items: center;
  height: 2rem;

  & span {
    width: 4px;
    height: 24%;
    border-radius: 2px;
    background: linear-gradient(var(--seg-1), var(--seg-3));
    opacity: 0.4;
  }
}

.rec.is-live .rec__bars span {
  opacity: 1;
  animation: bar 0.9s ease-in-out infinite;
  animation-delay: calc(var(--i) * -70ms);
}

.rec__hint {
  color: var(--text-muted-color);
  font-size: var(--text-caption-size);
}

/* ---------- dock: where everything is added ---------- */
.dock.is-over {
  --gem-line: var(--seg-1);
}

.dock__face {
  display: grid;
  gap: var(--size-3);
  justify-items: center;
  padding: var(--size-7) var(--size-5);
  outline: 1.5px dashed color-mix(in srgb, var(--seg-1) 45%, transparent);
  outline-offset: -0.9rem;
  text-align: center;
}

.dock__title {
  margin: 0;
  font-family: var(--text-display-family);
  font-size: var(--font-size-3);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.dock__hint {
  margin: 0;
  color: var(--text-muted-color);
  font-size: var(--text-caption-size);
}

.dock__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--size-3);
  justify-content: center;
  margin-top: var(--size-2);
}

.tool {
  display: inline-flex;
  gap: var(--size-3);
  align-items: center;
  padding: var(--size-2) var(--size-5) var(--size-2) var(--size-2);
  border: 1px solid var(--surface-glass-border);
  border-radius: var(--radius-pill);
  background: var(--surface-field-bg);
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform var(--duration-2) var(--ease-out),
    background var(--duration-1);

  &:hover {
    transform: translateY(-2px);
    background: var(--surface-field-bg-hover);
  }

  &:active {
    transform: translateY(1px);
  }
}

.dropveil {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  gap: var(--size-3);
  place-content: center;
  justify-items: center;
  background: color-mix(in srgb, var(--seg-bg) 88%, transparent);
  font-family: var(--text-display-family);
  font-size: var(--font-size-3);
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-2);

  & p {
    margin: 0;
  }
}

.is-dragging .dropveil {
  opacity: 1;
}

/* ---------- foot ---------- */
.desk__foot {
  display: flex;
  flex-wrap: wrap;
  gap: var(--size-5);
  align-items: center;
  justify-content: space-between;

  /* the date button and the seal button are the same size */
  & > .btn--primary {
    flex: 1 1 16rem;
    justify-content: space-between;
  }
}

/* the date button sits next to "Seal this capsule", the same size; the small window opens above it */
.when {
  position: relative;
  display: block;
  flex: 1 1 16rem;
  min-width: 0;
}

.when__btn {
  justify-content: space-between;
  width: 100%;
  min-height: 3.6rem;
  padding: 0.4rem 0.6rem 0.4rem 1.6rem;
  text-align: left;

  & .btn__label {
    display: grid;
    min-width: 0;
    gap: 0.05rem;
  }

  & .btn__chip .icon {
    width: 1.15rem;
    height: 1.15rem;
    margin-top: -0.35rem;
  }
}

.when__short {
  overflow: hidden;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.when.is-past .when__short {
  color: var(--status-error-color);
}

.when__pop {
  position: absolute;
  bottom: calc(100% + 0.9rem);
  left: 0;
  z-index: 6;
  width: min(36rem, calc(100vw - 2rem));
  max-height: calc(100vh - 6rem);
  overflow: hidden auto;
  scrollbar-width: none;
  filter: drop-shadow(0 1.2rem 1.6rem rgb(20 16 43 / 0.28));
  animation: fade-up var(--duration-3) var(--ease-out) both;
}

.when__face {
  display: grid;
  min-width: 0;
  gap: var(--size-3);
  padding: var(--size-4) var(--size-5);
}

.when__label,
.field__label {
  color: var(--text-muted-color);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* the chosen moment, in words, and how far away it is */
.when__value {
  margin-top: -0.4rem;
  font: 700 1.1rem var(--font-family-sans);
  line-height: 1.25;

  &.is-empty {
    color: var(--text-muted-color);
  }
}

.when__presets {
  display: flex;
  flex-wrap: wrap;
  gap: var(--size-2);
}

/* the calendar on the left, the clock on the right */
.when__body {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: var(--size-5);
  align-items: start;
}

/* the calendar: the month and the year step on their own, the chosen day is a lit hexagon */
.when__nav {
  display: flex;
  gap: var(--size-3);
  justify-content: space-between;
}

.when__navgroup {
  display: flex;
  gap: 0.3rem;
  align-items: center;
}

.when__name {
  min-width: 0;
  font-weight: 800;
  text-align: center;
}

.when__year {
  width: 3.8rem;
  padding: 0.1rem 0;
  border: 0;
  border-bottom: 1px dashed color-mix(in srgb, var(--seg-1) 60%, transparent);
  background: none;
  color: var(--text-title-color);
  font: inherit;
  font-weight: 800;
  text-align: center;
  appearance: textfield;

  &::-webkit-inner-spin-button,
  &::-webkit-outer-spin-button {
    appearance: none;
  }

  &:focus-visible {
    border-bottom-style: solid;
    outline: 0;
  }
}

.when__step {
  display: grid;
  flex: none;
  place-items: center;
  width: 1.8rem;
  height: 1.8rem;
  padding: 0;
  border: 1px solid var(--surface-glass-border);
  border-radius: 50%;
  background: var(--surface-glass-bg);
  color: var(--text-title-color);
  cursor: pointer;

  & .icon {
    width: 1rem;
    height: 1rem;
  }

  &:hover:not(:disabled) {
    background: var(--surface-glass-bg-hover);
  }

  &:disabled {
    opacity: 0.3;
    cursor: default;
  }
}

.when__grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.1rem;
  margin-top: var(--size-2);
  text-align: center;
}

.when__wd {
  color: var(--text-muted-color);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.6;
}

.when__day {
  height: 2rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-title-color);
  font: 700 0.85rem var(--font-family-sans);
  cursor: pointer;
  transition: background var(--duration-1);

  &:hover:not(:disabled) {
    background: color-mix(in srgb, var(--seg-1) 16%, transparent);
  }

  &:disabled {
    opacity: 0.25;
    cursor: default;
  }

  &[data-today]:not([aria-pressed="true"]) {
    box-shadow: inset 0 0 0 1.5px var(--seg-1);
  }

  &[aria-pressed="true"] {
    background: linear-gradient(135deg, var(--seg-1), var(--seg-3));
    color: #fff;
    clip-path: polygon(25% 3%, 75% 3%, 100% 50%, 75% 97%, 25% 97%, 0 50%);
  }

  &:focus-visible {
    outline: 2px solid var(--seg-1);
    outline-offset: -2px;
  }
}

/* the clock: hours first, then minutes; AM and PM beside the time */
.when__readout {
  display: flex;
  flex-wrap: wrap;
  gap: var(--size-1);
  align-items: center;
  justify-content: center;
}

.when__digit {
  padding: 0.1rem 0.45rem;
  border: 0;
  border-radius: var(--radius-2);
  background: var(--surface-glass-bg);
  color: var(--text-title-color);
  font: 700 1.4rem var(--font-family-display);
  font-variant-numeric: tabular-nums;
  cursor: pointer;

  &[aria-pressed="true"] {
    background: color-mix(in srgb, var(--seg-1) 24%, transparent);
    color: var(--seg-4);
  }
}

.when__colon {
  font: 700 1.6rem var(--font-family-display);
}

.when__meridiem {
  display: grid;
  gap: 0.2rem;
  margin-left: var(--size-2);
}

.when__ampm {
  padding: 0.15rem 0.7rem;
  border: 1px solid var(--surface-glass-border);
  border-radius: var(--radius-2);
  background: none;
  color: var(--text-muted-color);
  font: 800 0.75rem var(--font-family-sans);
  cursor: pointer;

  &[aria-pressed="true"] {
    border-color: transparent;
    background: linear-gradient(135deg, var(--seg-1), var(--seg-3));
    color: #fff;
  }
}

.when__dial {
  display: block;
  width: 100%;
  max-width: 12.5rem;
  margin: var(--size-2) auto 0;
  touch-action: none;
  cursor: pointer;
  user-select: none;

  & .when__plate {
    fill: color-mix(in srgb, var(--seg-2) 22%, var(--surface-solid));
    stroke: color-mix(in srgb, var(--seg-1) 45%, transparent);
    stroke-width: 1.5;
  }

  & .when__ticks circle {
    fill: color-mix(in srgb, var(--seg-1) 70%, transparent);
  }

  & .when__hand {
    stroke: var(--seg-1);
    stroke-linecap: round;
    stroke-width: 2.5;
  }

  & .when__pin,
  & .when__knob {
    fill: var(--seg-1);
  }

  & .when__knob {
    stroke: #fff;
    stroke-width: 2;
  }

  & .when__nums text {
    fill: var(--text-title-color);
    font: 700 13px var(--font-family-sans);
    text-anchor: middle;
    pointer-events: none;

    &.is-set {
      fill: #fff;
    }
  }

  &:focus-visible {
    outline: 2px solid var(--seg-1);
    outline-offset: 2px;
    border-radius: 50%;
  }
}

@media (max-width: 600px) {
  .when__body {
    grid-template-columns: minmax(0, 1fr);
  }
}

.when__done {
  min-height: 3rem;
  margin-top: var(--size-2);
}

.when.is-past .when__hint {
  color: var(--status-error-color);
  font-weight: 700;
}

.when__hint,
.status {
  color: var(--text-muted-color);
  font-size: var(--text-caption-size);
}

.status {
  min-height: 1.4em;
  margin: 0;
  text-align: center;

  &[data-state="error"] {
    color: var(--status-error-color);
    font-weight: 700;
  }
}

/* ---------- auth (signup / login) ---------- */
.auth {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--size-5);
  width: 100%;
  max-width: 28rem;
  margin-inline: auto;
  padding-block: var(--size-3) var(--size-7);
}

.tile__face {
  display: flex;
  gap: var(--size-4);
  align-items: center;
  padding: var(--size-4) var(--size-6) var(--size-4) var(--size-4);
}

.tile__title,
.tile__meta {
  margin: 0;
}

.tile__title {
  font-weight: 700;
}

.tile__meta {
  color: var(--text-muted-color);
  font-size: var(--text-caption-size);
}

.auth__face {
  display: grid;
  gap: var(--size-4);
  padding: var(--size-6);

  & .btn--primary {
    justify-content: space-between;
    width: 100%;
  }
}

.field {
  position: relative;
  display: grid;
  gap: var(--size-2);
}

.field__input {
  width: 100%;
  padding: var(--size-4) var(--size-5);
  border: 1px solid var(--surface-glass-border);
  border-radius: var(--radius-2);
  background: var(--surface-field-bg);
  color: var(--text-body-color);
  font: inherit;
  transition: box-shadow var(--duration-1);

  &:focus-visible {
    box-shadow: var(--focus-ring);
  }
}

/* the hint inside an empty input: the muted text color of the current theme (the browser default is nearly invisible at night) */
input::placeholder,
textarea::placeholder {
  color: var(--text-muted-color);
  opacity: 1;
}

.field__peek {
  position: absolute;
  right: var(--size-2);
  bottom: var(--size-2);
  min-height: 2.75rem;
  padding: 0 var(--size-3);
  border: 0;
  background: none;
  color: var(--text-muted-color);
  font: inherit;
  font-size: var(--text-caption-size);
  font-weight: 700;
  cursor: pointer;
}

.auth__alt {
  margin: 0;
  color: var(--text-muted-color);
  font-size: var(--text-caption-size);
  text-align: center;

  & a {
    color: var(--text-title-color);
    font-weight: 700;
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, var(--seg-1) 70%, transparent);
    text-underline-offset: 3px;
  }
}

@media (max-width: 560px) {
  .halo__ring,
  .spark {
    opacity: 0.55;
  }

  .memo__face {
    padding: var(--size-4) var(--size-5) var(--size-4) var(--size-4);
  }

  .desk__foot,
  .desk__foot .btn--primary {
    width: 100%;
  }

  .when {
    width: 100%;
  }
}

/* ---------- motion ---------- */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.2);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes twinkle {
  0%,
  100% {
    opacity: 0.15;
    transform: scale(0.5) rotate(0deg);
  }

  50% {
    opacity: 0.95;
    transform: scale(1) rotate(45deg);
  }
}

@keyframes bar {
  0%,
  100% {
    height: 24%;
  }

  50% {
    height: 100%;
  }
}

@keyframes char-in {
  from {
    opacity: 0;
    transform: translateY(0.45em) rotate(4deg);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes sweep {
  0%,
  55% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(100%);
  }
}

/* ---------- responsive ---------- */
@media (max-width: 560px) {
  .picker__grid {
    gap: var(--size-3);
  }

  .gate__title {
    font-size: 0.8rem;
  }

  .gate__sub {
    font-size: 0.68rem;
  }

  .actions,
  .btn--primary {
    width: 100%;
  }

  .btn--primary {
    justify-content: space-between;
  }
}

@media (max-width: 900px) {
  .stage {
    grid-template-columns: 1fr;
    gap: var(--size-6);
  }

  .stage__orb {
    order: -1;
    width: min(66vw, 30dvh);
  }
}

@media (max-height: 760px) {
  .gate__arch {
    aspect-ratio: 3 / 2.8;
  }

  .ticket {
    min-height: 3.8rem;
  }

  .btn {
    min-height: 3.8rem;
  }

  .btn__chip {
    width: 2.3rem;
    height: 2.6rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .memo,
  .halo__ring,
  .sticker,
  .sticker__body,
  .spark,
  .rec__bars span {
    animation: none;
  }

  .char {
    opacity: 1;
    animation: none;
  }

  .ticket::after {
    display: none;
  }

  .chip,
  .tool,
  .halo,
  .view,
  .gate,
  .gate__light,
  .gate__veil,
  .btn--primary,
  .btn__chip,
  .gl {
    transition: none;
  }
}

/* ---------- capsules (signed-in home) ---------- */
.capsules {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--size-5);
  width: 100%;
  max-width: 40rem;
  margin-inline: auto;
  padding-block: var(--size-3) var(--size-7);
}

.capsules__list {
  display: grid;
  gap: var(--size-4);
}

/* the list is split into groups (Waiting, Drafts, Opened); each shows its first few and can open up */
.capsules__groups {
  display: grid;
  gap: var(--size-6);
}

.capsules__group {
  display: grid;
  gap: var(--size-3);

  & > .btn {
    justify-self: center;
  }
}

.capsules__new {
  justify-self: center;
}

.capsule[data-occasion="parents"] { --seg-1: var(--theme-parents-1); --seg-2: var(--theme-parents-2); --seg-3: var(--theme-parents-3); --seg-4: var(--theme-parents-4); }
.capsule[data-occasion="couples"] { --seg-1: var(--theme-couples-1); --seg-2: var(--theme-couples-2); --seg-3: var(--theme-couples-3); --seg-4: var(--theme-couples-4); }
.capsule[data-occasion="friends"] { --seg-1: var(--theme-friends-1); --seg-2: var(--theme-friends-2); --seg-3: var(--theme-friends-3); --seg-4: var(--theme-friends-4); }
.capsule[data-occasion="self"] { --seg-1: var(--theme-self-1); --seg-2: var(--theme-self-2); --seg-3: var(--theme-self-3); --seg-4: var(--theme-self-4); }

.capsule__body {
  display: grid;
  flex: 1;
  gap: var(--size-1);
  min-width: 0;
}

.capsule__top {
  display: flex;
  gap: var(--size-3);
  align-items: center;
  justify-content: space-between;
}

.capsule__title {
  margin: 0;
  color: var(--text-title-color);
  overflow: hidden;
  font-size: var(--font-size-3);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.capsule__meta {
  display: block;
  margin: 0;
  color: var(--text-muted-color);
  font-size: var(--text-caption-size);
}

/* a capsule in the list: a gem card with a hexagon medallion — the cut crystal with the time left on its table, the
   ring around it the wait (dotted still to go, solid gone, a bead where it is now), a small gem per keepsake. */
a.capsule.gem {
  display: block;
  text-decoration: none;
  transition: transform var(--duration-2) var(--ease-out);

  &:hover {
    transform: translateY(-2px);
  }
}

.capsule__face {
  display: flex;
  gap: var(--size-5);
  align-items: center;
  padding: var(--size-4) var(--size-6) var(--size-4) var(--size-4);
}

.capsule__art {
  display: block;
  flex: none;
}

.capsule .capsule__title {
  font-weight: 800;
}

.capsule__kind {
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
  min-width: 0;
  color: var(--text-muted-color);
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.06em;
  text-transform: uppercase;

  & .icon {
    flex: none;
    width: 0.95rem;
    height: 0.95rem;
    color: var(--seg-1);
  }
}

.capsule__meta span {
  display: block;
}

.medal {
  display: block;
  flex: none;
  width: 7.4rem;
  height: 7.4rem;
  overflow: visible;

  & .medal__f0 { fill: color-mix(in srgb, var(--seg-2) 45%, #fff); }
  & .medal__f1 { fill: color-mix(in srgb, var(--seg-2) 85%, #fff); }
  & .medal__f2 { fill: color-mix(in srgb, var(--seg-2) 55%, var(--seg-1)); }
  & .medal__f3 { fill: color-mix(in srgb, var(--seg-2) 20%, var(--seg-1)); }

  & [class^="medal__f"] {
    stroke: rgb(255 255 255 / 0.78);
    stroke-width: 1.1;
    stroke-linejoin: round;
  }

  & .medal__lit,
  & .medal__dark {
    fill: none;
    stroke-linecap: round;
  }

  & .medal__lit {
    stroke: #fff;
    stroke-width: 3;
  }

  & .medal__dark {
    stroke: var(--seg-4);
    stroke-opacity: 0.45;
    stroke-width: 2.4;
  }

  /* the table is always white, with dark ink, in light and dark themes alike */
  & .medal__table {
    fill: #fff;
    fill-opacity: 0.96;
    stroke: var(--seg-1);
    stroke-opacity: 0.35;
  }

  & .medal__n,
  & .medal__u,
  & .medal__word {
    text-anchor: middle;
  }

  & .medal__n {
    fill: rgb(28 22 64);
    font: 700 28px var(--font-family-display);

    &.is-long {
      font-size: 23px;
    }
  }

  & .medal__u {
    fill: rgb(28 22 64 / 0.62);
    font: 800 12.5px var(--font-family-sans);
    letter-spacing: 0.8px;
  }

  & .medal__word {
    fill: var(--text-muted-color);
    font: 800 10px var(--font-family-sans);
    letter-spacing: 2px;
  }

  & .medal__dots,
  & .medal__arc,
  & .medal__ring {
    fill: none;
    stroke: var(--seg-1);
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  & .medal__dots {
    stroke-opacity: 0.5;
    stroke-width: 3;
    stroke-dasharray: 0.1 8;
  }

  & .medal__arc {
    stroke-width: 4.5;
  }

  & .medal__ring {
    stroke-width: 4.5;

    &.is-draft {
      stroke-opacity: 0.5;
      stroke-width: 3;
      stroke-dasharray: 3 7;
    }
  }

  & .medal__shell,
  & .medal__spoke {
    fill: none;
    stroke: var(--seg-1);
    stroke-opacity: 0.45;
    stroke-width: 1.6;
    stroke-dasharray: 4 4;
  }

  & .medal__shell {
    fill: rgb(255 255 255 / 0.3);
  }

  & .medal__bead {
    fill: var(--seg-3);
    stroke: #fff;
    stroke-width: 2.4;
    paint-order: stroke;
  }

  & .medal__pip {
    fill: none;
    stroke: var(--seg-1);
    stroke-opacity: 0.6;
    stroke-width: 1.6;

    &.is-on {
      fill: var(--seg-1);
      stroke: #fff;
      stroke-opacity: 1;
      stroke-width: 1.8;
    }
  }

  & .medal__g0 { stop-color: var(--seg-2); stop-opacity: 0.9; }
  & .medal__g1 { stop-color: var(--seg-2); stop-opacity: 0; }

  & .medal__spark { fill: #fff; }

  /* a slow glint across the cut, now and then; the small star twinkles */
  & .medal__shine {
    fill: #fff;
    opacity: 0;
    animation: medal-shine 7s ease-in-out infinite;
  }

  & .medal__spark {
    transform-box: fill-box;
    transform-origin: center;
    animation: medal-twinkle 3.6s ease-in-out infinite;
  }

  & .medal__bead {
    animation: medal-bead 2.8s ease-in-out infinite;
  }
  & .medal__burst { fill: var(--seg-1); }
  & .medal__star { fill: var(--seg-3); }
}

.tag {
  flex: none;
  padding: 0.15em 0.8em;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--seg-1) 16%, transparent);
  color: var(--text-title-color);
  font-size: var(--text-caption-size);
  font-weight: 700;

  &[data-status="draft"] {
    background: var(--surface-glass-bg);
    color: var(--text-muted-color);
  }
}

.sealing__face {
  display: grid;
  gap: var(--size-4);
  justify-items: center;
  padding: var(--size-6);
}

.bar {
  --p: 0;
  width: 100%;
  height: 0.5rem;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: var(--surface-glass-border);
}

.bar__fill {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--seg-1), var(--seg-3));
  transform: scaleX(var(--p));
  transform-origin: left;
  transition: transform 0.3s var(--ease-out);
}

/* ---------- capsule page: countdown, opened keepsakes ---------- */
a.capsule {
  display: block;
  color: inherit;
  text-decoration: none;
}

.keepsakes {
  display: grid;
  gap: var(--size-4);
  justify-items: center;

  & > .capsules__list {
    width: 100%;
  }
}

.count {
  display: flex;
  gap: var(--size-4);
  justify-content: center;
}

.count__unit {
  display: grid;
  justify-items: center;
  min-width: 3.6rem;
}

.count__num {
  font-family: var(--font-family-display);
  font-size: clamp(1.8rem, 1rem + 3vw, 2.8rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-title-color);
}

.count__label {
  color: var(--text-muted-color);
  font-size: var(--text-caption-size);
}

.keepsake {
  animation: fade-up var(--duration-3) var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 90ms);
}

.keepsake__face {
  display: grid;
  gap: var(--size-3);
  padding: var(--size-5);
}

.keepsake__head {
  display: flex;
  gap: var(--size-3);
  align-items: center;
}

.keepsake__by {
  display: grid;
  color: var(--text-muted-color);
  font-size: var(--text-caption-size);

  & strong {
    color: var(--text-title-color);
  }
}

.keepsake__prompt {
  margin: 0;
  color: var(--text-muted-color);
  font-size: var(--text-caption-size);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.keepsake__letter,
.keepsake__caption {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.keepsake__letter {
  font-size: var(--font-size-3);
  line-height: 1.6;
}

.keepsake__caption {
  color: var(--text-muted-color);
}

.keepsake__media {
  display: block;
  width: 100%;
  max-height: 32rem;
  border-radius: var(--radius-2);
  background: var(--surface-media-bg);
  object-fit: contain;
}

.keepsake__audio {
  width: 100%;
}

.keepsake__file {
  display: flex;
  gap: var(--size-3);
  align-items: center;
  justify-content: space-between;
  padding: var(--size-3) var(--size-4);
  border: 1px solid var(--surface-glass-border);
  border-radius: var(--radius-2);
  background: var(--surface-field-bg);
  color: inherit;
  font-weight: 700;
  text-decoration: none;
}

.keepsake__file-size {
  color: var(--text-muted-color);
  font-size: var(--text-caption-size);
  font-weight: 500;
}

/* ---------- people, compose, invite ---------- */
.people__title {
  margin: 0;
  font-size: var(--font-size-3);
}

.people__list {
  display: grid;
  gap: var(--size-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.people__row {
  display: flex;
  gap: var(--size-3);
  align-items: center;
}

.people__email {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.people__form,
.people__link,
.compose__row,
.invite__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--size-3);
  align-items: center;
}

.people__form > input,
.people__link > input {
  flex: 1;
  min-width: 10rem;
  width: auto;
}

.people__form > select {
  width: auto;
}

.compose__row {
  justify-content: space-between;
}

textarea.field__input {
  resize: vertical;
}

.keepsake__remove {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  margin-left: auto;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--text-muted-color);
  cursor: pointer;

  &:hover {
    background: var(--surface-glass-bg);
    color: var(--text-title-color);
  }

  & .icon {
    width: 1.1rem;
    height: 1.1rem;
  }
}

.field__value {
  margin: 0;
  padding: var(--size-4) var(--size-5);
  overflow-wrap: anywhere;
  color: var(--text-muted-color);
}

/* ---------- sky: the night sky of every sealed capsule (WebGL, see gl/sky-gl.js) ---------- */
body.night {
  background: #04030a;
  overscroll-behavior: none;
}

/* zooming, dragging and double-clicking the sky must not highlight the page text on top of it */
body.night,
body.world-page {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

body.night :is(input, textarea),
body.world-page :is(input, textarea) {
  -webkit-user-select: text;
  user-select: text;
}

.night .page {
  touch-action: none;
}

.night .site-header {
  --text-title-color: var(--white);
  --text-muted-color: rgb(255 255 255 / 0.72);
  color: var(--white);
}

/* the account menu keeps its light panel (in the dark theme it is already dark) */
:root:not([data-theme="dark"]) .night .menu {
  --text-title-color: var(--ink-900);
  --text-muted-color: var(--ink-900-64);
  color: var(--ink-900);
}

.night .site-footer {
  color: rgb(255 255 255 / 0.45);
}

.sky {
  position: relative;
  display: grid;
  align-content: end;
  justify-items: center;
  padding-bottom: var(--size-5);
  pointer-events: none;
}

.sky__canvas {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
}

.sky__hud {
  display: grid;
  gap: var(--size-2);
  justify-items: center;
  text-align: center;
}

/* the small boxes under the sky are always dark gems, whatever the theme */
.sky__toast,
.sky__counter {
  --cut: 0.7rem;
}

.sky__toast:has(.sky__line:empty) {
  display: none;
}

.sky__line {
  margin: 0;
  padding: 0.5rem 1.3rem;
  font-weight: 600;
}

.sky__count {
  margin: 0;
  padding: 0.45rem 1.2rem;
  color: rgb(255 255 255 / 0.85);
  font-size: var(--text-caption-size);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* the opening time beside one of your stars: a thin line from the star, the numbers hanging in the dark at its end */
.sky__tip {
  --dy: 0px;

  position: fixed;
  top: 0;
  left: 0;
  z-index: 2;
  width: 0;
  height: 0;
  pointer-events: none;

  & .sky__tipLine {
    position: absolute;
    top: 0;
    left: 1.7rem;
    width: 1.6rem;
    height: 1px;
    background: linear-gradient(90deg, var(--c), rgb(255 255 255 / 0.55));
    box-shadow: 0 0 0.5rem var(--c);
  }

  & .sky__tipBody {
    position: absolute;
    top: 0;
    left: 3.5rem;
    display: grid;
    gap: 0.3rem;
    min-width: max-content;
    translate: 0 calc(-50% + var(--dy));
    animation: fade-up var(--duration-3) var(--ease-out) both;
    isolation: isolate;
  }

  /* a soft dark patch of sky behind the text, so stars twinkling underneath never make it hard to read */
  & .sky__tipBody::before {
    content: "";
    position: absolute;
    inset: -0.9rem -1.5rem;
    z-index: -1;
    border-radius: 1.4rem;
    background: rgb(6 6 20 / 0.88);
    filter: blur(10px);
  }

  & .sky__tipTitle {
    max-width: 14rem;
    overflow: hidden;
    color: var(--c);
    font-size: var(--text-caption-size);
    font-weight: 700;
    letter-spacing: 0.14em;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
  }

  & .sky__tipTime {
    display: flex;
    gap: 0.15rem;
    align-items: baseline;
    white-space: nowrap;
    color: #fff;
    font-family: var(--font-family-display);
    font-size: 1.2rem;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 1rem var(--c), 0 0 0.3rem rgb(255 255 255 / 0.35);

    & b {
      font-weight: 500;
    }

    & i {
      margin-right: 0.4rem;
      color: rgb(255 255 255 / 0.55);
      font-size: 0.7rem;
      font-style: normal;
      text-shadow: none;
    }

    & i:last-child {
      margin-right: 0;
    }
  }

  & .sky__tipDate {
    color: rgb(255 255 255 / 0.62);
    font-size: var(--text-caption-size);
    font-weight: 600;
    letter-spacing: 0.08em;
  }

  /* near the right edge it hangs on the other side of the star */
  &.is-left {
    & .sky__tipLine {
      right: 1.7rem;
      left: auto;
      background: linear-gradient(270deg, var(--c), rgb(255 255 255 / 0.55));
    }

    & .sky__tipBody {
      right: 3.5rem;
      left: auto;
      justify-items: end;
      text-align: right;
    }
  }
}

/* the four star colors: which kind of capsule each star holds */
/* the legend is the world page's round feeling buttons: press a kind to see only its stars */
.sky__legend {
  --surface-glass-bg: rgb(255 255 255 / 0.06);
  --surface-glass-bg-hover: rgb(255 255 255 / 0.12);
  --surface-glass-border: rgb(255 255 255 / 0.22);
  --text-body-color: #fff;
  --text-title-color: #fff;

  display: flex;
  flex-wrap: wrap;
  gap: var(--size-2);
  justify-content: center;
  margin: 0;
  padding: 0;
  list-style: none;
  pointer-events: auto;

  & .mood__opt {
    font-size: var(--text-caption-size);
  }
}

/* ---------- your capsules in the sky (features/sky/sky.js, components/capsule-card.js) ----------
   On the right edge of the screen sits a small gem box with the number of your capsules. Press it and the tray slides
   out beside it, one capsule per row: the same capsule as on the capsules page. Press the box again to put it away. */

.vault {
  --w: min(26rem, calc(100vw - 7rem));
  --glass: rgb(22 18 50 / 0.5);
  --glass-line: rgb(255 255 255 / 0.2);

  position: fixed;
  top: 50%;
  right: 0.75rem;
  z-index: 3;
  display: flex;
  gap: 0.6rem;
  align-items: center;
  translate: 0 -50%;
  pointer-events: none;
}

.vault__panel {
  width: var(--w);
  translate: calc(100% + 6rem) 0;
  visibility: hidden;
  transition: translate 0.6s cubic-bezier(0.2, 0.9, 0.25, 1.04), visibility 0s 0.6s;
}

.vault__panelFace {
  display: grid;
  gap: 0.4rem;
  padding: 0.7rem 0.7rem 0.8rem;
}

/* only the list scrolls, so the gem's own edge lines stay where they are */
.vault__body {
  display: grid;
  gap: 0.6rem;
  max-height: calc(100vh - 12rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.vault__panel::-webkit-scrollbar {
  display: none;
}

.vault.is-open .vault__panel {
  translate: 0 0;
  visibility: visible;
  pointer-events: auto;
  transition: translate 0.6s cubic-bezier(0.2, 0.9, 0.25, 1.04);
}

.vault__head {
  display: flex;
  align-items: center;
  height: 2.2rem;
  padding-left: 0.8rem;
  color: #fff;
}

.vault__title {
  color: rgb(255 255 255 / 0.75);
  font-size: var(--text-caption-size);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* the box: a small gem that holds the capsules */
.vault__box {
  position: relative;
  z-index: 1;
  flex: none;
  padding: 0;
  border: 0;
  background: none;
  color: #fff;
  cursor: pointer;
  pointer-events: auto;
  transition: transform var(--duration-2) var(--ease-out);

  &:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
  }
}

.vault__boxFace {
  display: grid;
  gap: 0.3rem;
  place-items: center;
  width: 4.6rem;
  padding: 0.9rem 0 0.8rem;
}

/* a crystal gear: it turns like a key in a lock when the tray comes out, and back when it goes away */
.vault__glyph {
  width: 2.9rem;
  height: 2.9rem;
  overflow: visible;
  transition: rotate 0.7s cubic-bezier(0.34, 1.45, 0.64, 1);

  & .vault__glyphOuter {
    fill: color-mix(in srgb, var(--seg-2) 55%, #fff);
    stroke: #fff;
    stroke-linejoin: round;
    stroke-width: 1.3;
  }

  & .vault__glyphFacets polygon {
    stroke: #fff;
    stroke-linejoin: round;
    stroke-opacity: 0.55;
    stroke-width: 0.7;

    &.is-light {
      fill: #fff;
    }

    &.is-dark {
      fill: var(--seg-1);
    }
  }

  & .vault__glyphTable polygon {
    fill: var(--seg-1);
    stroke: none;
  }

  & .vault__glyphGlint {
    fill: #fff;
    opacity: 0.95;
    transform-box: fill-box;
    transform-origin: center;
    animation: vault-glint 3.4s ease-in-out infinite;
  }

  & .vault__glyphInner {
    fill: color-mix(in srgb, var(--seg-3, var(--seg-2)) 18%, #fff);
    stroke: #fff;
    stroke-linejoin: round;
    stroke-opacity: 0.9;
    stroke-width: 0.9;
  }
}

@keyframes vault-glint {
  0%,
  60%,
  100% {
    opacity: 0.35;
    scale: 0.7;
  }

  75% {
    opacity: 1;
    scale: 1.15;
  }
}

.vault.is-open .vault__glyph {
  rotate: 180deg;
}

.vault__count {
  font: 700 1rem var(--font-family-display);
  font-variant-numeric: tabular-nums;
}

.vault__label {
  color: rgb(255 255 255 / 0.75);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.vault.is-landed .vault__box {
  animation: vault-box-land 1s var(--ease-out);
}

.vault__list {
  display: grid;
  gap: 0.4rem;
}

.vault__empty {
  display: grid;
  gap: var(--size-3);
  justify-items: center;
  padding: var(--size-3) 0 var(--size-1);

  & p {
    margin: 0;
    color: rgb(255 255 255 / 0.75);
  }
}

/* --- one capsule: the capsule card, a little smaller; always in the dark colors, whatever the theme --- */
.vault .gem,
.sky__hud .gem {
  --surface-tint-base: var(--night-paper);
  --surface-glow: rgb(255 255 255 / 0.12);
  --gem-facet-a: 20%;
  --gem-facet-b: 14%;
  --surface-solid: var(--night-paper);
  --text-title-color: #fff;
  --text-body-color: #fff;
  --text-muted-color: rgb(255 255 255 / 0.72);
  color: #fff;
}

.vault .gem {

  & .capsule__face {
    gap: var(--size-4);
    padding: var(--size-3) var(--size-5) var(--size-3) var(--size-3);
  }

  & .medal {
    width: 6.4rem;
    height: 6.4rem;
  }

  /* the medallion already says kind and status: the card keeps just the title and the dates */
  & .capsule__top {
    display: none;
  }

  &:hover {
    transform: translateX(-3px);
  }
}

.vault .vault__box:hover {
  transform: translateY(-2px);
}

.vault .vault__panel:hover {
  transform: none;
}

.vault.is-pulling .capsule {
  animation: vault-in 0.5s var(--ease-out) backwards;
  animation-delay: calc(var(--i, 0) * 45ms + 220ms);
}

/* the capsule that just arrived: its medallion flashes once */
.capsule.is-new .medal {
  animation: vault-pop 1.4s var(--ease-out) 0.3s both;
}

@keyframes medal-shine {
  0%, 62% { opacity: 0; translate: -50px 0; }
  70% { opacity: 0.55; }
  86%, 100% { opacity: 0; translate: 230px 0; }
}

@keyframes medal-twinkle {
  0%, 100% { opacity: 1; scale: 1; }
  50% { opacity: 0.45; scale: 0.6; }
}

@keyframes medal-bead {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

@keyframes vault-in {
  from {
    opacity: 0;
    transform: translateX(1.4rem);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes vault-pop {
  0% { filter: drop-shadow(0 0 0 var(--seg-1)); scale: 1; }
  25% { filter: drop-shadow(0 0 0.9rem var(--seg-1)); scale: 1.12; }
  100% { filter: drop-shadow(0 0 0 transparent); scale: 1; }
}

@keyframes vault-box-land {
  35% { filter: drop-shadow(0 0 1.2rem rgb(255 255 255 / 0.8)); }
}

@media (prefers-reduced-motion: reduce) {
  .vault,
  .vault__panel,
  .vault__box,
  .medal *,
  .vault .capsule,
  .vault .capsule * {
    animation: none !important;
    transition: none !important;
  }
}

/* ---------- world: how the world feels, on a turning Earth (WebGL, see gl/world-gl.js) ---------- */
body.world-page {
  overflow: hidden;
  background: var(--surface-solid);
  overscroll-behavior: none;
}

.world-page .page {
  touch-action: none;
}

.world {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding-bottom: var(--size-5);
  pointer-events: none;
}

.world__canvas {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.world__intro {
  padding-top: var(--size-4);
}

.world__hud {
  position: relative;
  display: grid;
  grid-row: 3;
  gap: var(--size-3);
  justify-items: center;
  text-align: center;
}

.world__counter {
  --cut: 0.7rem;
  pointer-events: auto;

  &:has(.world__count:empty) {
    display: none;
  }
}

.world__count {
  margin: 0;
  padding: 0.45rem 1.2rem;
  color: var(--text-title-color);
  font-size: var(--text-caption-size);
  font-weight: 600;
}

.world__legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--size-2);
  justify-content: center;
  margin: 0;
  padding: 0;
  list-style: none;
  pointer-events: auto;
}

.world__legend .mood__opt {
  font-size: var(--text-caption-size);
}

/* the card for the chosen country: left of the globe on a wide screen, above the legend on a phone */
.world__panel {
  width: min(22rem, calc(100vw - 2rem));
  pointer-events: auto;
  animation: fade-up var(--duration-3) var(--ease-out) both;

  & .sealing__face {
    gap: var(--size-3);
    padding: var(--size-4) var(--size-5);
  }
}

@media (min-width: 900px) {
  .world__panel {
    position: absolute;
    bottom: calc(100% + var(--size-3));
    left: 0;
    width: min(30rem, 100%);
  }

  .world__bars {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: var(--size-5);
  }

  .world__hud {
    justify-items: start;
    text-align: left;
  }

  .world__legend {
    justify-content: flex-start;
    max-width: 48rem;
  }
}

.world__panel .sealing__face {
  position: relative;
}

.world__name {
  margin: 0;
  padding-inline: 2rem;
  font-family: var(--text-display-family);
  font-size: 1.4rem;
  line-height: 1.2;
  text-align: center;
}

.world__close {
  position: absolute;
  top: 0.7rem;
  right: 0.9rem;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--text-muted-color);
  cursor: pointer;
  transition: background var(--duration-1), color var(--duration-1);

  & .icon {
    width: 1rem;
    height: 1rem;
  }

  &:hover {
    background: var(--surface-glass-bg);
    color: var(--text-title-color);
  }
}

.world__top {
  margin: 0;
  color: var(--text-muted-color);
  font-size: var(--text-caption-size);
  text-align: center;
}

.world__bars {
  display: grid;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  list-style: none;

  & li {
    display: grid;
    grid-template-columns: 4.8rem 1fr 2.4rem;
    gap: 0.5rem;
    align-items: center;
    font-size: var(--text-caption-size);
  }
}

.world__bar-name {
  color: var(--text-body-color);
  font-weight: 600;
  text-align: left;
}

.world__bar {
  height: 0.5rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-media-bg);
}

.world__bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  transition: width var(--duration-3) var(--ease-out);
}

.world__bar-val {
  color: var(--text-muted-color);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.world__tip {
  --cut: 0.5rem;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 5;
  margin: 0;
  padding: 0.4rem 0.9rem;
  background:
    linear-gradient(135deg, rgb(255 255 255 / 0.22) 0 18%, transparent 18%),
    color-mix(in srgb, var(--surface-tint-base) 92%, var(--seg-2));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--seg-1) 45%, transparent);
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
  color: var(--text-body-color);
  font-size: var(--text-caption-size);
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .world__legend .mood__opt,
  .world__bar-fill {
    transition: none;
  }
}

/* ---------- mood status + friends ---------- */
.profile__handle {
  margin: 0;
  color: var(--text-muted-color);
  font-weight: 700;
}

.profile__mood {
  margin-top: var(--size-2);
}

.mood-badge {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.55rem;
  align-items: center;
  max-width: 100%;
  padding: 0.35rem 0.9rem 0.35rem 0.75rem;
  border: 1px solid color-mix(in srgb, var(--c, var(--text-muted-color)) 55%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--c, var(--text-muted-color)) 14%, transparent);
  color: var(--text-body-color);
  font-size: var(--text-caption-size);
  overflow-wrap: anywhere;

  &::before {
    content: "";
    flex: none;
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 50%;
    background: var(--c, var(--text-muted-color));
    box-shadow: 0 0 0.7rem 0.1rem var(--c, transparent);
  }

  &[data-empty] {
    border-style: dashed;
    border-color: var(--surface-glass-border);
    background: none;
    color: var(--text-muted-color);

    &::before {
      opacity: 0.4;
      box-shadow: none;
    }
  }

  & strong {
    font-weight: 800;
  }

  & small {
    color: var(--text-muted-color);
    font-size: inherit;
  }
}

.mood-badge__note {
  flex-basis: 100%;
  color: var(--text-muted-color);
  font-style: italic;
}

.mood {
  gap: var(--size-3);
}

.mood__q {
  margin: 0;
  font-family: var(--text-display-family);
  font-size: clamp(1.2rem, 4vw, 1.45rem);
}

.mood__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--size-2);

  @media (max-width: 40rem) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.mood__opt {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.5rem;
  border: 1px solid var(--surface-glass-border);
  border-radius: var(--radius-2);
  background: var(--surface-glass-bg-hover);
  color: var(--text-body-color);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--duration-1), border-color var(--duration-1), transform var(--duration-1);

  &::before {
    content: "";
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    background: var(--c);
    box-shadow: 0 0 0.6rem 0.1rem var(--c);
  }

  &:hover {
    background: var(--surface-field-bg-hover);
  }

  &[aria-checked="true"],
  &[aria-pressed="true"] {
    border-color: var(--c);
    background: color-mix(in srgb, var(--c) 22%, var(--surface-glass-bg));
    transform: translateY(-1px);
  }

  &:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
  }
}

.mood__actions {
  display: flex;
  gap: var(--size-3);
  align-items: center;

  & .btn--primary {
    flex: 1;
    width: auto;
  }
}

.mood__fine,
.person__fine {
  margin: 0;
  color: var(--text-muted-color);
  font-size: var(--text-caption-size);
}

.field__label small {
  color: var(--text-muted-color);
  font-weight: 500;
}

.check {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  font-size: var(--text-caption-size);
  line-height: 1.4;
  cursor: pointer;

  & strong {
    display: block;
    font-weight: 700;
  }

  & small {
    display: block;
    color: var(--text-muted-color);
    font-size: inherit;
  }
}

/* a checkbox drawn in the site's gem language: cut corners, lit when on, a white tick */
.check__box {
  --cut: 0.4rem;
  appearance: none;
  flex: none;
  display: grid;
  place-items: center;
  width: 1.4rem;
  height: 1.4rem;
  margin: 0;
  background: var(--surface-glass-bg);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--seg-1) 55%, var(--surface-glass-border));
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
  cursor: pointer;
  transition: background var(--duration-1), box-shadow var(--duration-1);

  &::after {
    content: "";
    width: 0.85rem;
    height: 0.85rem;
    background: var(--white);
    clip-path: polygon(14% 50%, 0 64%, 38% 100%, 100% 22%, 86% 8%, 38% 70%);
    transform: scale(0);
    transition: transform var(--duration-2) var(--ease-out);
  }

  &:hover {
    background: var(--surface-glass-bg-hover);
  }

  &:checked {
    background:
      linear-gradient(135deg, rgb(255 255 255 / 0.4) 0 24%, transparent 24%),
      linear-gradient(315deg, color-mix(in srgb, var(--seg-3) 55%, transparent) 0 20%, transparent 20%),
      var(--seg-1);
    box-shadow: inset 0 0 0 1.5px var(--seg-1);

    &::after {
      transform: scale(1);
    }
  }

  &:focus-visible {
    outline: none;
    box-shadow: inset 0 0 0 2px var(--seg-1), inset 0 0 0 4px var(--surface-solid);
  }
}

.person {
  display: grid;
  width: 100%;
  max-width: 30rem;
  margin-inline: auto;
  padding-block: var(--size-3) var(--size-6);
}

.person__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--size-3);
  justify-content: center;
  margin-top: var(--size-3);
}

.friends__row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--size-3);

  & .field__input {
    flex: 1 1 12rem;
    width: auto;
  }
}

.friends__mine {
  margin: 0;
  color: var(--text-muted-color);
  font-size: var(--text-caption-size);

  & strong {
    color: var(--text-title-color);
  }
}

.friends__block {
  display: grid;
  gap: var(--size-3);
}

.friends__h {
  margin: 0;
  font-size: var(--font-size-3);
}

.friends__list {
  display: grid;
  gap: var(--size-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.friend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--size-3) var(--size-4);
  align-items: center;
  justify-content: space-between;
  padding: var(--size-3) var(--size-4);
  border: 1px solid var(--surface-glass-border);
  border-radius: var(--radius-2);
  background: var(--surface-glass-bg);
  backdrop-filter: blur(var(--surface-glass-blur));
}

.friend__who {
  display: flex;
  gap: var(--size-3);
  align-items: center;
  min-width: 0;
  color: inherit;
  text-decoration: none;

  &:hover strong {
    text-decoration: underline;
  }
}

.friend__text {
  display: grid;
  min-width: 0;

  & strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  & small {
    color: var(--text-muted-color);
  }
}

.friend__actions {
  display: flex;
  gap: var(--size-2);
}

.nav__badge {
  display: inline-grid;
  place-items: center;
  min-width: 1.15rem;
  height: 1.15rem;
  margin-left: 0.35rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: #e5484d;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1;
}

.world__cta {
  justify-self: start;
  pointer-events: auto;
}

/* ---------- mood chip (top-right corner of a profile card) ---------- */
.profile__chip {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  z-index: 1;
}

/* a small round icon button in the card's bottom-right corner */
.profile__edit {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  padding: 0;
  border: 1px solid var(--surface-glass-border);
  border-radius: 50%;
  background: var(--surface-glass-bg);
  color: var(--text-muted-color);
  cursor: pointer;
  transition: background var(--duration-1), color var(--duration-1);

  & .icon {
    width: 1.1rem;
    height: 1.1rem;
  }

  &:hover {
    background: var(--surface-glass-bg-hover);
    color: var(--text-title-color);
  }

  &:focus-visible {
    outline: 2px solid var(--seg-1);
    outline-offset: 1px;
  }
}

.mood-chip {
  display: inline-flex;
  gap: 0.45rem;
  align-items: center;
  padding: 0.3rem 0.8rem 0.3rem 0.65rem;
  border: 1px solid color-mix(in srgb, var(--c, var(--text-muted-color)) 60%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--c, var(--surface-solid)) 20%, var(--surface-solid));
  color: var(--text-body-color);
  font-size: var(--text-caption-size);
  font-weight: 800;
  white-space: nowrap;

  &::before {
    content: "";
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 50%;
    background: var(--c, var(--text-muted-color));
    box-shadow: 0 0 0.6rem 0.1rem var(--c, transparent);
  }

  &[data-empty] {
    border-style: dashed;
    border-color: var(--surface-glass-border);
    background: color-mix(in srgb, var(--surface-solid) 75%, transparent);
    color: var(--text-muted-color);
    font-weight: 600;

    &::before {
      opacity: 0.35;
      box-shadow: none;
    }
  }
}

.profile__note {
  max-width: 100%;
  margin: 0;
  color: var(--text-muted-color);
  font-style: italic;
  overflow-wrap: anywhere;
}

/* ---------- the daily "how are you feeling?" ask ---------- */
.ask {
  width: min(30rem, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  margin: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-body-color);
  overflow: visible;

  &::backdrop {
    background: color-mix(in srgb, var(--ink-900) 50%, transparent);
    backdrop-filter: blur(4px);
  }

  @media (prefers-reduced-motion: no-preference) {
    &[open] {
      animation: ask-in 0.28s var(--ease-out, ease-out);
    }
  }
}

@keyframes ask-in {
  from {
    opacity: 0;
    transform: translateY(0.8rem) scale(0.98);
  }
}

.ask__box {
  display: grid;
  gap: var(--size-3);
  max-height: calc(100dvh - 2rem);
  padding: var(--size-5);
  overflow: auto;
  border: 1px solid var(--surface-glass-border);
  border-radius: var(--radius-2);
  background: var(--surface-solid);
  box-shadow: 0 1.5rem 4rem rgb(0 0 0 / 0.3);

  & .mood__grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));

    @media (max-width: 30rem) {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
  }
}

.friends__count {
  margin-left: 0.3rem;
  color: var(--text-muted-color);
  font-size: var(--text-caption-size);
  font-weight: 700;
}

.pals {
  display: grid;
  gap: var(--size-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.pal {
  display: flex;
  gap: var(--size-3);
  align-items: center;
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--surface-glass-border);
  border-radius: var(--radius-2);
  background: var(--surface-glass-bg);
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--duration-1), border-color var(--duration-1), transform var(--duration-1);

  & .avatar__pic {
    --pic: 2.6rem;
    flex: none;
  }

  & .mood-chip {
    flex: none;
    margin-left: auto;
  }

  &:hover {
    background: var(--surface-glass-bg-hover);
  }

  &[aria-current="true"] {
    border-color: var(--seg-1);
    background: color-mix(in srgb, var(--seg-1) 14%, var(--surface-glass-bg));
    box-shadow: 0 0 0 1px var(--seg-1);
  }

  &:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
  }
}

.pal__text {
  display: grid;
  min-width: 0;

  & strong,
  & small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  & small {
    color: var(--text-muted-color);
  }
}

/* with friends: no big hero, the add form shrinks to one slim bar above the list */
/* ---------- moving between pages: a shooting star (js/core/page-transition.js) ---------- */
:root {
  --warp-bg:
    radial-gradient(1.5px 1.5px at 12% 24%, rgb(79 99 255 / 0.55), transparent),
    radial-gradient(1px 1px at 31% 68%, rgb(79 99 255 / 0.45), transparent),
    radial-gradient(1.5px 1.5px at 47% 16%, rgb(79 99 255 / 0.4), transparent),
    radial-gradient(1px 1px at 63% 78%, rgb(79 99 255 / 0.5), transparent),
    radial-gradient(1.5px 1.5px at 78% 32%, rgb(79 99 255 / 0.45), transparent),
    radial-gradient(1px 1px at 90% 62%, rgb(79 99 255 / 0.4), transparent),
    linear-gradient(160deg, #cfd7ff, #e8ecff 55%, #c6d0ff);
  --warp-star: #4f63ff;
  --warp-glow: rgb(79 99 255 / 0.6);
}

:root[data-theme="dark"] {
  --warp-bg:
    radial-gradient(1.5px 1.5px at 12% 24%, rgb(255 255 255 / 0.8), transparent),
    radial-gradient(1px 1px at 31% 68%, rgb(255 255 255 / 0.6), transparent),
    radial-gradient(1.5px 1.5px at 47% 16%, rgb(255 255 255 / 0.55), transparent),
    radial-gradient(1px 1px at 63% 78%, rgb(255 255 255 / 0.7), transparent),
    radial-gradient(1.5px 1.5px at 78% 32%, rgb(255 255 255 / 0.6), transparent),
    radial-gradient(1px 1px at 90% 62%, rgb(255 255 255 / 0.5), transparent),
    linear-gradient(160deg, #070a26, #141a5c 55%, #0b0e33);
  --warp-star: #fff;
  --warp-glow: rgb(160 175 255 / 0.85);
}

/* the new page is covered before its first paint, so it never shows half-built; page-transition.js lifts it */
html.warping::after,
.warp {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: var(--warp-bg);
}

.warp {
  /* while it moves it also stops clicks reaching the old page */
  pointer-events: auto;
}

.warp__star {
  position: fixed;
  top: 45%;
  left: 0;
  z-index: 9999;
  width: 0;
  height: 0;
  pointer-events: none;

  /* the head */
  &::before {
    content: "";
    position: absolute;
    top: -0.35rem;
    left: -0.35rem;
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 50%;
    background: var(--warp-star);
    box-shadow:
      0 0 0.9rem 0.25rem var(--warp-glow),
      0 0 2.8rem 0.9rem var(--warp-glow);
  }

  /* the thin bright tail, tapering to nothing behind it */
  &::after {
    content: "";
    position: absolute;
    top: -0.12rem;
    right: 0;
    width: min(52vw, 46rem);
    height: 0.24rem;
    background: linear-gradient(90deg, transparent, var(--warp-glow) 65%, var(--warp-star));
    clip-path: polygon(0 50%, 100% 0, 100% 100%);
  }
}

/* the soft wide glow around the tail */
.warp__glow {
  position: absolute;
  top: -0.9rem;
  right: 0;
  width: min(40vw, 36rem);
  height: 1.8rem;
  background: linear-gradient(90deg, transparent, var(--warp-glow));
  clip-path: polygon(0 50%, 100% 0, 100% 100%);
  filter: blur(0.6rem);
  opacity: 0.55;
}

/* ---------- our own scrollbar (capsules page): a slim glowing thumb that floats on the right edge ---------- */
.vscroll {
  position: fixed;
  top: 0.9rem;
  right: 0;
  bottom: 0.9rem;
  z-index: 60;
  width: 1.2rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;

  &[data-on="1"] {
    pointer-events: auto;
  }

  &[data-live="1"],
  &[data-drag="1"] {
    opacity: 1;
  }

  /* a faint hairline for the thumb to travel along */
  &::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0.42rem;
    bottom: 0;
    width: 2px;
    border-radius: 2px;
    background: color-mix(in srgb, var(--seg-1) 18%, transparent);
  }
}

.vscroll__thumb {
  position: absolute;
  top: 0;
  right: 0.3rem;
  width: 0.45rem;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--seg-2), var(--seg-1) 55%, var(--seg-3));
  box-shadow: 0 0 0.7rem color-mix(in srgb, var(--seg-1) 55%, transparent);
  cursor: grab;
  transition:
    width 0.18s ease,
    right 0.18s ease;

  .vscroll:hover &,
  .vscroll[data-drag="1"] & {
    right: 0.22rem;
    width: 0.65rem;
  }

  .vscroll[data-drag="1"] & {
    cursor: grabbing;
  }
}

/* ---------- today's mood pinned to the top-right of the header picture ---------- */
.avatar__mood {
  position: absolute;
  top: -0.15rem;
  right: -0.2rem;
  z-index: 1;
  width: 0.95rem;
  height: 0.95rem;
  border: 2px solid var(--surface-solid);
  border-radius: 50%;
  background: var(--c, transparent);
  box-shadow: 0 0 0.55rem 0.05rem var(--c, transparent);
  pointer-events: none;

  /* no mood yet: a quiet dashed ring that invites one */
  &:not([data-set]) {
    border: 1.5px dashed var(--text-muted-color);
    background: var(--surface-solid);
    box-shadow: none;
    opacity: 0.7;
  }
}

.menu__mood {
  display: flex;
  gap: var(--size-3);
  align-items: center;
  justify-content: space-between;

  & .mood-chip {
    max-width: 70%;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

.menu__mood-act {
  color: var(--text-muted-color);
  font-size: var(--text-caption-size);
  font-weight: 700;
}

/* ---------- profile photo: upload and crop, or pick a default gem ---------- */
.pick {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgb(8 6 24 / 0.6);
}

.pick__box {
  width: min(24rem, 100%);
}

.pick__face {
  display: grid;
  gap: var(--size-3);
  justify-items: center;
  padding: var(--size-5);
  text-align: center;
}

.pick__h {
  margin: 0;
  font-family: var(--text-display-family);
  font-size: 1.3rem;
}

.pay__price {
  margin: 0;
  font-family: var(--text-display-family);
  font-size: 2.2rem;
  font-weight: 700;
}

.pay__why {
  margin: 0;
  color: var(--text-muted-color);
  font-size: var(--text-caption-size);
}

.pay__qr {
  width: min(15rem, 70vw);
  height: auto;
  border-radius: 0.5rem;
  background: #fff;
  padding: 0.5rem;
}

.pay__banks {
  display: flex;
  flex-wrap: wrap;
  gap: var(--size-2);
  justify-content: center;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pay__lines {
  display: grid;
  gap: var(--size-1);
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--text-caption-size);
  text-align: left;

  & li {
    display: flex;
    gap: var(--size-3);
    justify-content: space-between;
    padding: var(--size-1) 0;
  }

  & li > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  & small {
    color: var(--text-muted-color);
  }

  & .is-free b {
    color: var(--seg-3, currentColor);
  }

  & .is-muted {
    color: var(--text-muted-color);
  }

  & .is-total {
    margin-top: var(--size-1);
    padding-top: var(--size-2);
    border-top: 1px solid color-mix(in srgb, currentColor 22%, transparent);
    font-size: 1rem;
    font-weight: 700;
  }
}

.pay__receipt {
  width: 100%;

  & summary {
    display: flex;
    gap: var(--size-3);
    align-items: center;
    justify-content: space-between;
    list-style: none;
    cursor: pointer;
  }

  & summary::-webkit-details-marker {
    display: none;
  }

  & .pay__lines {
    margin-top: var(--size-2);
  }
}

.pick__sub {
  margin: var(--size-1) 0 0;
  color: var(--text-muted-color);
  font-size: var(--text-caption-size);
  font-weight: 700;
}

.pick__defs {
  display: grid;
  grid-template-columns: repeat(4, 3.6rem);
  gap: var(--size-3);
}

.pick__def {
  width: 3.6rem;
  height: 3.6rem;
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  transition: transform var(--duration-1), border-color var(--duration-1);

  & canvas {
    display: block;
    width: 100%;
    height: 100%;
  }

  &:hover {
    border-color: var(--seg-1);
    transform: scale(1.08);
  }

  &:focus-visible {
    outline: 2px solid var(--seg-1);
    outline-offset: 2px;
  }
}

.pick__stage {
  position: relative;
  width: 18rem;
  height: 18rem;
  overflow: hidden;
  background: var(--ink-900);
  cursor: grab;
  touch-action: none;

  &:active {
    cursor: grabbing;
  }

  & canvas {
    display: block;
    width: 100%;
    height: 100%;
  }
}

/* the picture is shown round, like it will be everywhere */
.pick__ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 100vmax rgb(8 6 24 / 0.6), inset 0 0 0 2px rgb(255 255 255 / 0.8);
  pointer-events: none;
}

.pick__zoom {
  width: 18rem;
  accent-color: var(--seg-1);
}

.pick__actions {
  display: flex;
  gap: var(--size-3);
}
