/*
 * The theme drawer's contents (the app's src/components/events/theme-picker).
 *
 * One quiet surface: soft fills instead of nested borders, muted labels, and
 * colour kept for the theme previews. Each level shows one decision.
 */

.theme-drawer {
  --picker-fill: color-mix(in oklab, var(--foreground) 5%, transparent);
  --picker-fill-hover: color-mix(in oklab, var(--foreground) 9%, transparent);
  --picker-line: color-mix(in oklab, var(--foreground) 8%, transparent);
  background: color-mix(in oklab, var(--background) 90%, transparent);
  max-height: min(84vh, 40rem);
}
.theme-drawer .drawer-handle {
  margin-top: 0.5rem;
  width: 2.5rem;
  height: 0.25rem;
}
.theme-drawer .drawer-inner {
  max-width: 42rem;
}
.theme-drawer .drawer-body {
  max-height: min(66vh, 31rem);
  overflow-x: hidden;
  padding: 0.125rem 1rem calc(1.25rem + env(safe-area-inset-bottom));
}
.theme-drawer .drawer-body.is-resizing {
  overflow: hidden;
  transition: height 200ms cubic-bezier(0.32, 0.72, 0, 1);
}

.theme-drawer :is(.nav-row, .segment, .crumb, .picker-icon, .picker-back, .picker-action, .colour-chip, .effect-auto):focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: -2px;
}

/* The top bar: the title or breadcrumb, then actions. */
.picker-bar {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  min-height: 3.25rem;
  padding: 0.375rem 0.5rem 0.375rem 1rem;
}
.picker-bar:has(.picker-back) {
  padding-left: 0.5rem;
}
.picker-title {
  font-size: 1rem;
  line-height: 1.5rem;
  font-weight: 600;
}
.picker-actions {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.125rem;
  margin-left: auto;
}
.picker-icon {
  display: inline-flex;
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--muted-foreground);
  transition: background-color 150ms, color 150ms;
}
.picker-icon:hover {
  background: var(--picker-fill-hover);
  color: var(--foreground);
}
.picker-icon svg {
  width: 1.125rem;
  height: 1.125rem;
}
/* A level's first row: Randomize, then the level's tabs where it opens with them (wrapping below on a phone). */
.level-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

/* An action in a level (Randomize, Reset effects, Turn off floaties, Browse Google Fonts): a filled chip, as the
   colour chips are, so its edge shows before it's hovered rather than its text looking inset. */
.picker-action {
  display: inline-flex;
  height: 2rem;
  align-items: center;
  gap: 0.375rem;
  padding: 0 0.75rem;
  border-radius: 999px;
  background: var(--picker-fill);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted-foreground);
  transition: background-color 150ms, color 150ms;
}
.picker-action:hover {
  background: var(--picker-fill-hover);
  color: var(--foreground);
}
.picker-action svg {
  width: 1rem;
  height: 1rem;
}
/* Just an icon (a level's Randomize): a round chip. */
.picker-action-icon {
  width: 2.25rem;
  height: 2.25rem;
  justify-content: center;
  padding: 0;
}
.picker-action-icon svg {
  width: 1.125rem;
  height: 1.125rem;
}
.picker-reset {
  align-self: flex-start;
}

/* Back: a chevron on wider sheets; on a phone, "‹ Parent" in the accent, as iOS does. */
.picker-back {
  display: inline-flex;
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--muted-foreground);
  transition: background-color 150ms, color 150ms, opacity 150ms;
}
.picker-back:hover {
  background: var(--picker-fill-hover);
  color: var(--foreground);
}
.picker-back svg {
  width: 1.125rem;
  height: 1.125rem;
  flex: none;
}
.picker-back-label,
.picker-nav-title {
  display: none;
}

.crumbs {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  gap: 0.125rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
}
.crumb {
  flex-shrink: 0;
  padding: 0.125rem 0.25rem;
  border-radius: var(--radius-sm);
  color: var(--muted-foreground);
  transition: color 150ms;
}
.crumb:hover {
  color: var(--foreground);
}
.crumb-sep {
  display: inline-flex;
  flex-shrink: 0;
  color: color-mix(in oklab, var(--muted-foreground) 50%, transparent);
}
.crumb-sep svg {
  width: 0.75rem;
  height: 0.75rem;
}
.crumb-current {
  min-width: 0;
  padding: 0.125rem 0.25rem;
  font-size: 0.875rem;
  font-weight: 600;
}
/* On a phone: an iOS navigation bar. Back carries the parent's name, the title sits in the middle. */
@media (max-width: 639px) {
  .picker-bar:has(.picker-back) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  }
  .picker-bar .crumbs {
    display: none;
  }
  .picker-back {
    width: auto;
    max-width: 100%;
    justify-self: start;
    gap: 0.125rem;
    padding-right: 0.5rem;
    color: var(--primary);
    font-size: 1rem;
  }
  .picker-back:hover {
    background: none;
    color: var(--primary);
    opacity: 0.7;
  }
  .picker-back svg {
    width: 1.375rem;
    height: 1.375rem;
  }
  .picker-back-label {
    display: block;
    min-width: 0;
  }
  .picker-nav-title {
    display: block;
    max-width: 12rem;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
  }
}

/* One level's content, sliding in the direction you moved. */
.picker-view {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}
.picker-view[data-dir='in'] {
  animation: picker-in 200ms cubic-bezier(0.32, 0.72, 0, 1);
}
.picker-view[data-dir='out'] {
  animation: picker-out 200ms cubic-bezier(0.32, 0.72, 0, 1);
}
@keyframes picker-in {
  from {
    opacity: 0;
    transform: translateX(0.875rem);
  }
}
@keyframes picker-out {
  from {
    opacity: 0;
    transform: translateX(-0.875rem);
  }
}
@media (prefers-reduced-motion: reduce) {
  .picker-view[data-dir] {
    animation: none;
  }
}
.picker-note {
  font-size: 0.75rem;
  line-height: 1rem;
  color: var(--muted-foreground);
}

/* The theme library, gradients, patterns and images: one sideways row that runs to the sheet's edges. */
.theme-row,
.gradient-grid,
.pattern-grid,
.image-grid {
  display: flex;
  gap: 0.375rem;
  margin-inline: -1rem;
  overflow-x: auto;
  padding: 0.25rem 1rem;
  scroll-padding-inline: 1rem;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 0.75rem, #000 calc(100% - 0.75rem), transparent);
  mask-image: linear-gradient(to right, transparent, #000 0.75rem, #000 calc(100% - 0.75rem), transparent);
}
.theme-row:hover,
.gradient-grid:hover,
.pattern-grid:hover,
.image-grid:hover {
  scrollbar-color: var(--picker-line) transparent;
}
.theme-row .opt-tile,
.gradient-grid .opt-tile {
  width: 5.75rem;
  flex: none;
}
.opt-preview.shuffle-preview {
  background-color: var(--picker-fill);
  color: var(--muted-foreground);
  transition: box-shadow 150ms, color 150ms;
}
.opt-tile:hover .shuffle-preview {
  color: var(--foreground);
}
.shuffle-preview svg {
  width: 1.375rem;
  height: 1.375rem;
}

.nav-row:has(.nav-thumb) {
  padding-block: 0.375rem;
}
.nav-thumb {
  display: flex;
  width: 2.25rem;
  height: 2.25rem;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: var(--radius-md);
  box-shadow: inset 0 0 0 1px var(--picker-line);
  background-color: var(--background);
}
.nav-thumb-font {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--foreground);
}
.colour-dot {
  width: 0.875rem;
  height: 0.875rem;
  border-radius: 999px;
  background: var(--primary);
}
.style-sample {
  display: flex;
  width: 62%;
  height: 50%;
  align-items: flex-end;
  padding: 0 0 0.1875rem 0.1875rem;
  border-radius: var(--radius-sm);
  border: var(--surface-border-width) solid var(--surface-border, var(--border));
  background: var(--panel);
  box-shadow: var(--surface-shadow);
}
/* A button in the accent, its corners following the theme's controls. */
.style-sample-button {
  width: 55%;
  height: 0.25rem;
  border-radius: min(var(--control-radius, var(--radius-md)), 2px);
  background: var(--primary);
}

/* Lists: rows that open a level, and rows that hold a control. */
.nav-list,
.setting-list {
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--picker-fill);
}
/* A row's focus ring follows the list's rounded corners rather than being cut by them. */
.nav-list > :first-child {
  border-top-left-radius: inherit;
  border-top-right-radius: inherit;
}
.nav-list > :last-child {
  border-bottom-left-radius: inherit;
  border-bottom-right-radius: inherit;
}
/* The sheet takes focus after a click (so no stray ring): it shows none itself. */
.theme-drawer:focus {
  outline: none;
}
.nav-row {
  display: flex;
  width: 100%;
  min-height: 2.75rem;
  align-items: center;
  gap: 0.625rem;
  padding: 0.25rem 0.625rem 0.25rem 0.75rem;
  text-align: left;
  transition: background-color 150ms;
}
.nav-row:hover {
  background: var(--picker-fill);
}
.nav-row + .nav-row,
.setting-row + .setting-row,
.setting-row + .nav-row,
.nav-row + .setting-row {
  border-top: 1px solid var(--picker-line);
}
.nav-row-label {
  flex-shrink: 0;
  font-size: 0.875rem;
  font-weight: 500;
}
.nav-row-value {
  min-width: 0;
  margin-left: auto;
  font-size: 0.875rem;
  color: var(--muted-foreground);
}
.nav-row > svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  color: var(--muted-foreground);
}
.nav-dot {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--foreground) 18%, transparent);
}
/* The page's colour with the pattern's on it (Pattern's Colour row). */
.nav-dot-pair {
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-dot-pair > span {
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 999px;
}
.setting-row {
  display: flex;
  min-height: 2.75rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 0.75rem;
  padding: 0.375rem 0.375rem 0.375rem 0.75rem;
}
.setting-label {
  font-size: 0.875rem;
  font-weight: 500;
}
.setting-hint {
  flex-basis: 100%;
  padding-right: 0.375rem;
  font-size: 0.75rem;
  line-height: 1rem;
  color: var(--muted-foreground);
}

/* Segmented control: one choice from a few. */
.segmented {
  display: inline-flex;
  max-width: 100%;
  gap: 0.125rem;
  padding: 0.125rem;
  border-radius: var(--control-radius, var(--radius-md));
  background: color-mix(in oklab, var(--foreground) 7%, transparent);
}
.picker-view > .segmented {
  align-self: flex-start;
}
@media (max-width: 479px) {
  .picker-view > .segmented {
    display: flex;
    width: 100%;
  }
  .picker-view > .segmented .segment {
    flex: 1;
    padding-inline: 0.25rem;
  }
  /* Font's five tabs vary in length: each takes its own width, then shares the rest. */
  .picker-view > .segmented:has([data-font-category]) {
    overflow-x: auto;
    scrollbar-width: none;
  }
  .picker-view > .segmented [data-font-category] {
    flex: 1 1 auto;
    padding-inline: 0.1875rem;
  }
}
.segment {
  height: 1.75rem;
  padding: 0 0.625rem;
  border-radius: calc(var(--control-radius, var(--radius-md)) - 0.125rem);
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
  color: var(--muted-foreground);
  transition: background-color 150ms, color 150ms;
}
.segment:hover {
  color: var(--foreground);
}
.segment[aria-pressed='true'] {
  background: var(--background);
  color: var(--foreground);
  box-shadow: 0 1px 2px color-mix(in oklab, var(--foreground) 22%, transparent);
}
[data-appearance='dark'] .segment[aria-pressed='true'] {
  background: color-mix(in oklab, var(--foreground) 18%, var(--background));
  box-shadow: none;
}

/* OptionTile: a preview box with a caption. */
.opt-tile {
  display: flex;
  width: 100%;
  min-width: 0;
  flex-direction: column;
  align-items: stretch;
  gap: 0.375rem;
  padding: 0.25rem;
  border-radius: var(--radius-md);
}
.opt-tile:focus-visible {
  outline: none;
}
.opt-tile:focus-visible .opt-preview {
  box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring);
}
.opt-preview {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  background-color: var(--background);
  color: var(--foreground);
  box-shadow: 0 0 0 1px var(--picker-line, var(--border));
  transition: box-shadow 150ms;
}
.opt-tile:hover .opt-preview {
  box-shadow: 0 0 0 2px var(--background), 0 0 0 4px color-mix(in oklab, var(--ring) 50%, transparent);
}
.opt-tile[aria-pressed='true'] .opt-preview {
  box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring);
}
.opt-caption {
  overflow: hidden;
  font-size: 0.75rem;
  line-height: 1rem;
  color: var(--muted-foreground);
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.opt-tile[aria-pressed='true'] .opt-caption {
  font-weight: 500;
  color: var(--foreground);
}
.h-16 {
  height: 4rem;
}
.h-20 {
  height: 5rem;
}
.font-tile {
  font-size: 1.375rem;
  font-weight: 600;
}

/* Background: four bases (one at a time), a plus, then Floaties, which goes over any base. */
.kind-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto minmax(0, 1fr);
  gap: 0.25rem;
}
.kind-bases {
  display: grid;
  grid-column: 1 / 5;
  grid-template-columns: subgrid;
}
/* As tall as a tile's preview plus its padding, so the plus sits mid-preview. */
.kind-plus {
  display: flex;
  height: 5.5rem;
  align-items: center;
  color: var(--muted-foreground);
}
.kind-plus svg {
  width: 0.875rem;
  height: 0.875rem;
}
.floaties-preview {
  position: relative;
  overflow: hidden;
}
.floaties-emoji {
  position: absolute;
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
  line-height: 1;
  transition: translate 300ms cubic-bezier(0.32, 0.72, 0, 1);
}
.floaties-emoji:nth-child(1) {
  top: 14%;
  left: 12%;
  font-size: 1.25rem;
  rotate: -12deg;
}
.floaties-emoji:nth-child(2) {
  top: 36%;
  right: 10%;
  font-size: 1rem;
  rotate: 10deg;
}
.floaties-emoji:nth-child(3) {
  bottom: 10%;
  left: 30%;
  font-size: 1.5rem;
  rotate: 4deg;
}
@media (prefers-reduced-motion: no-preference) {
  .opt-tile:hover .floaties-emoji {
    translate: 0 -0.1875rem;
  }
  .opt-tile:hover .floaties-emoji:nth-child(2) {
    translate: 0 -0.3125rem;
  }
}
.font-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.25rem;
}
@media (min-width: 640px) {
  .font-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

/*
 * On a phone, fonts and emoji become one sideways row that runs to the
 * sheet's edges, like the theme library, so the page stays in view while you
 * pick (the heading, for a font). Wider sheets keep their grids.
 */
@media (max-width: 639px) {
  .picker-view > .phone-strip {
    display: flex;
    gap: 0.375rem;
    margin-inline: -1rem;
    overflow-x: auto;
    padding: 0.25rem 1rem;
    scroll-padding-inline: 1rem;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(to right, transparent, #000 0.75rem, #000 calc(100% - 0.75rem), transparent);
    mask-image: linear-gradient(to right, transparent, #000 0.75rem, #000 calc(100% - 0.75rem), transparent);
  }
  .picker-view > .phone-strip > * {
    flex: none;
  }
  .picker-view > .phone-strip > .opt-tile {
    width: 5.75rem;
  }
  .picker-view > .phone-strip > .emoji-option {
    width: 2.75rem;
  }
}

/* Colour chips: Auto and the eyedropper in the colour picker, Photos' topics, Patterns' groups. */
.colour-chip {
  display: inline-flex;
  height: 2rem;
  align-items: center;
  gap: 0.375rem;
  padding: 0 0.75rem 0 0.375rem;
  border-radius: 999px;
  background: var(--picker-fill);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted-foreground);
  transition: background-color 150ms, box-shadow 150ms, color 150ms;
}
.colour-chip:hover {
  background: var(--picker-fill-hover);
  color: var(--foreground);
}
.colour-chip[aria-pressed='true'] {
  color: var(--foreground);
  box-shadow: inset 0 0 0 2px var(--ring);
}
.colour-chip-dot {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--foreground) 18%, transparent);
}
.swatch {
  display: flex;
  width: 100%;
  aspect-ratio: 1;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--foreground) 16%, transparent);
  transition: box-shadow 150ms, transform 150ms;
}
.swatch:hover {
  transform: scale(1.08);
}
.swatch:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}
.swatch[aria-pressed='true'] {
  box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring);
}
.swatch svg {
  width: 45%;
  height: 45%;
}
.hex-input {
  width: 6.5rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
}

/*
 * The colour picker: cover colours, then sliders that fine-tune the pick. Each track is painted from the colour (drawer.js sliderPaint).
 */
.cp {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.cp-suggest {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.cp-suggest > .swatch {
  width: 1.75rem;
  flex: none;
}
.cp-caption {
  margin-left: 0.25rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}
.cp-sliders {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}
.cp-slider-row,
.cp-hex {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.cp-slider-label {
  width: 4.5rem;
  flex: none;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}
.cp-slider {
  width: 100%;
  min-width: 0;
  height: 1.75rem;
  flex: 1;
  margin: 0;
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.cp-slider::-webkit-slider-runnable-track {
  height: 0.75rem;
  border-radius: 999px;
  background: var(--track);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--foreground) 14%, transparent);
}
.cp-slider::-moz-range-track {
  height: 0.75rem;
  border-radius: 999px;
  background: var(--track);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--foreground) 14%, transparent);
}
.cp-slider::-webkit-slider-thumb {
  width: 1.375rem;
  height: 1.375rem;
  margin-top: -0.3125rem;
  border: 3px solid rgb(255 255 255);
  border-radius: 999px;
  background: var(--thumb);
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.2), 0 1px 4px rgb(0 0 0 / 0.3);
  -webkit-appearance: none;
  appearance: none;
}
.cp-slider::-moz-range-thumb {
  width: 1rem;
  height: 1rem;
  border: 3px solid rgb(255 255 255);
  border-radius: 999px;
  background: var(--thumb);
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.2), 0 1px 4px rgb(0 0 0 / 0.3);
}
.cp-slider:focus-visible {
  outline: none;
}
.cp-slider:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.2), 0 0 0 4px var(--ring);
}
.cp-slider:focus-visible::-moz-range-thumb {
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.2), 0 0 0 4px var(--ring);
}
.cp-dropper {
  padding-left: 0.625rem;
}
.cp-dropper svg {
  width: 1rem;
  height: 1rem;
}
/* Pattern → Colour: each target shows its colour. */
.cp-target-dot {
  display: inline-block;
  width: 0.75rem;
  height: 0.75rem;
  margin-right: 0.375rem;
  vertical-align: -0.0625rem;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--foreground) 20%, transparent);
}

/* Image level: pick an image; how it's used is one level down. */
/* Image level and Pattern's Uploads: square tiles in the sideways row. */
.image-grid > * {
  width: 5rem;
  flex: none;
}
.image-tile {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--picker-fill);
  box-shadow: 0 0 0 1px var(--picker-line);
  transition: box-shadow 150ms;
}
.image-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.image-tile-alpha img {
  object-fit: contain;
  padding: 0.375rem;
}
.image-tile:hover {
  box-shadow: 0 0 0 2px var(--background), 0 0 0 4px color-mix(in oklab, var(--ring) 50%, transparent);
}
.image-tile:focus-visible,
.image-upload:focus-within {
  outline: none;
  box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring);
}
.image-tile[aria-pressed='true'] {
  box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring);
}
.image-upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  background: transparent;
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--foreground) 22%, transparent);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted-foreground);
  cursor: pointer;
}
.image-upload:hover {
  background: var(--picker-fill);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--foreground) 35%, transparent);
  color: var(--foreground);
}
.image-upload svg {
  width: 1.125rem;
  height: 1.125rem;
}
.image-upload input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  opacity: 0;
}
.image-upload.is-busy {
  pointer-events: none;
  opacity: 0.6;
}

/* Image → Photos: Pexels search (js/theme/stock.js). */
.stock-search {
  position: relative;
  display: block;
}
.stock-search > svg {
  position: absolute;
  top: 50%;
  left: 0.625rem;
  width: 1rem;
  height: 1rem;
  transform: translateY(-50%);
  color: var(--muted-foreground);
  pointer-events: none;
}
.stock-search .input {
  width: 100%;
  padding-left: 2rem;
}
.stock-results {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
/* Topic chips: one sideways row that runs to the sheet's edges. */
.stock-topics {
  display: flex;
  gap: 0.375rem;
  margin: -0.25rem -1rem;
  overflow-x: auto;
  padding: 0.25rem 1rem;
  scrollbar-width: none;
}
.stock-topic {
  flex-shrink: 0;
  padding: 0 0.75rem;
}
.stock-topic svg {
  width: 0.875rem;
  height: 0.875rem;
  margin-left: -0.125rem;
}
/* Pattern → Patterns: search and group chips like Photos, then one sideways row. Each tile is the page with the pattern on it. */
.pattern-grid > .pattern-tile {
  width: 5rem;
  flex: none;
}
.pattern-tile-art {
  position: absolute;
  inset: 0;
  background-color: var(--background);
}
.pattern-tile.is-loading .pattern-tile-art {
  animation: stock-pulse 1.2s ease-in-out infinite alternate;
}
/*
 * The group's Randomize, first in the row: the dice, as on the Theme level's
 * tile. Its slot sticks at the row's padding edge and covers the padding
 * above and below, the gap after it and (its shadow) the row's edge before
 * it, so tiles slide under it cleanly; the negative margins keep the row's
 * spacing as it was.
 */
.pattern-random-slot {
  position: sticky;
  left: 0;
  z-index: 1;
  flex: none;
  display: flex;
  margin: -0.25rem -0.375rem -0.25rem 0;
  padding: 0.25rem 0.375rem 0.25rem 0;
  background: var(--background);
  box-shadow: -1rem 0 0 var(--background);
}
.pattern-random {
  width: 5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted-foreground);
}
.pattern-random:hover {
  color: var(--foreground);
}
.pattern-random svg {
  width: 1.375rem;
  height: 1.375rem;
}
/* A photo's tile is its average colour (inline) until the photo loads. */
.stock-tile.is-busy {
  pointer-events: none;
}
.stock-tile-busy {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgb(0 0 0 / 0.35);
  color: rgb(255 255 255);
}
.stock-tile-busy svg {
  width: 1.25rem;
  height: 1.25rem;
  animation: stock-spin 800ms linear infinite;
}
@keyframes stock-spin {
  to {
    transform: rotate(360deg);
  }
}
.stock-placeholder {
  box-shadow: none;
  animation: stock-pulse 1.2s ease-in-out infinite alternate;
}
@keyframes stock-pulse {
  to {
    opacity: 0.5;
  }
}
@media (prefers-reduced-motion: reduce) {
  .stock-tile-busy svg,
  .stock-placeholder {
    animation: none;
  }
}
.stock-attribution {
  align-self: flex-start;
  font-size: 0.75rem;
  line-height: 1rem;
  font-weight: 500;
  color: var(--muted-foreground);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.stock-attribution:hover {
  color: var(--foreground);
}

/* Effects and Strength: one slider each, colour swatches when on. */
.effect-list {
  display: grid;
  gap: 0.125rem;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-lg);
  background: var(--picker-fill);
}
.effect-row {
  display: grid;
  grid-template-columns: 5rem minmax(0, 1fr) 2.5rem;
  align-items: center;
  gap: 0.25rem 0.625rem;
  min-height: 2.25rem;
}
/* A list with longer labels (Pattern → Adjust's spacing): a wider label column, so none wraps. */
.effect-list-wide .effect-row {
  grid-template-columns: 8rem minmax(0, 1fr) 2.5rem;
}
.effect-label {
  font-size: 0.875rem;
  font-weight: 500;
}
/* A slider's label with an `i` beside it. */
.effect-label-group {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  min-width: 0;
}
.effect-slider {
  width: 100%;
  accent-color: var(--primary);
  cursor: pointer;
}
.effect-value {
  /* One line, a longer value ("12.5 px") reaching into the gap before it. */
  justify-self: end;
  white-space: nowrap;
  font-size: 0.75rem;
  line-height: 1rem;
  color: var(--muted-foreground);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.effect-colors {
  grid-column: 2 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem 1rem;
  padding-bottom: 0.375rem;
}
.effect-color {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}
.effect-swatch {
  position: relative;
  width: 1.5rem;
  height: 1.5rem;
  flex-shrink: 0;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--foreground) 18%, transparent);
  cursor: pointer;
}
.effect-swatch:focus-within {
  box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring);
}
.effect-swatch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
/* Style → Cards: the note under the opacity slider, and Auto beside it. */
.card-opacity-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0 0 0.375rem;
}
.picker-warning {
  color: var(--destructive);
}
.effect-auto {
  border-radius: var(--radius-sm);
  color: var(--muted-foreground);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.effect-auto:hover {
  color: var(--foreground);
}

/* Floaties level: up to three chosen emoji, then suggestions. The top
   padding keeps each slot's remove badge inside the drawer body, which clips. */
.emoji-head {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding-top: 0.25rem;
}
.emoji-slots {
  display: flex;
  flex-shrink: 0;
  gap: 0.375rem;
}
.emoji-slot,
.emoji-option {
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
}
.emoji-slot {
  position: relative;
  display: flex;
  width: 2.5rem;
  height: 2.5rem;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: var(--picker-fill);
  font-size: 1.375rem;
  line-height: 1;
}
.emoji-slot:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 1px;
}
.emoji-slot-empty {
  background: transparent;
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--foreground) 18%, transparent);
}
.emoji-slot-x {
  position: absolute;
  top: -0.25rem;
  right: -0.25rem;
  display: flex;
  width: 1rem;
  height: 1rem;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--foreground);
  color: var(--background);
  opacity: 0;
  transition: opacity 150ms;
}
.emoji-slot:hover .emoji-slot-x,
.emoji-slot:focus-visible .emoji-slot-x {
  opacity: 1;
}
@media (hover: none) {
  .emoji-slot-x {
    opacity: 1;
  }
}
.emoji-slot-x svg {
  width: 0.625rem;
  height: 0.625rem;
}
.emoji-input {
  min-width: 0;
  flex: 1;
}
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.25rem;
}
@media (min-width: 640px) {
  .emoji-grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }
}
.emoji-option {
  display: flex;
  aspect-ratio: 1;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  font-size: 1.375rem;
  line-height: 1;
  transition: background-color 150ms, box-shadow 150ms, transform 150ms;
}
.emoji-option:hover {
  background: var(--picker-fill-hover);
  transform: scale(1.08);
}
.emoji-option:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: -2px;
}
.emoji-option[aria-pressed='true'] {
  background: var(--picker-fill-hover);
  box-shadow: inset 0 0 0 2px var(--ring);
}

/* Any Google Font: suggestions, each name drawn in its own face. */
.font-suggestion-name {
  min-width: 0;
  flex-shrink: 1;
  overflow: hidden;
  font-size: 1.0625rem;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.font-suggestion .nav-row-value {
  flex-shrink: 0;
}
.font-suggestion-spacer {
  width: 1rem;
  flex-shrink: 0;
}
.font-suggestion[aria-pressed='true'] > svg {
  color: var(--foreground);
}

/* Developer level (testbed only). */
.dev-grid {
  display: grid;
  gap: 1rem;
}
@media (min-width: 640px) {
  .dev-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.dev-col {
  min-width: 0;
}
.dev-col > * + * {
  margin-top: 0.5rem;
}
.dev-json {
  width: 100%;
  min-height: 12rem;
  resize: vertical;
  border-radius: var(--radius-md);
  border: 1px solid var(--input);
  padding: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.4;
}
.dev-actions {
  display: flex;
  gap: 0.5rem;
}
.dev-key {
  display: flex;
  min-width: 0;
  flex: 1 1 16rem;
  gap: 0.5rem;
}
.dev-key .input {
  min-width: 0;
  flex: 1;
}
.token-list {
  max-height: 14rem;
  overflow-y: auto;
}
.token-row {
  display: grid;
  grid-template-columns: 1rem 9rem minmax(0, 1fr);
  align-items: center;
  gap: 0.5rem;
  padding: 0.125rem 0;
  font-size: 0.75rem;
}
.token-row code {
  font-family: var(--font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.token-swatch {
  width: 1rem;
  height: 1rem;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--foreground) 25%, transparent);
}
.check-list > * + * {
  margin-top: 0.25rem;
}
.check-row {
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.5rem;
}
.check-status {
  border-radius: 999px;
  padding: 0.0625rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: 500;
  text-align: center;
  background: var(--muted);
  color: var(--muted-foreground);
}
.check-fixed {
  background: color-mix(in oklab, var(--primary) 18%, transparent);
  color: var(--foreground);
}
.check-fail {
  background: color-mix(in oklab, var(--destructive) 20%, transparent);
  color: var(--foreground);
}
