/* void family: the canvas fills the viewport, one floating translucent card,
   ui fades on idle. density tight, radius 14, elevated glass. */

#stage {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: manipulation;
  cursor: pointer;
  background: var(--bg);
}

#stage:focus-visible {
  outline-offset: -4px;
}

.skip-link {
  position: fixed;
  top: -100px;
  left: 12px;
  z-index: 100;
  display: inline-flex;
  align-items: center;
  min-height: var(--target);
  background: var(--surface);
  color: var(--ink);
  padding: 0 16px;
  border-radius: var(--radius-sm);
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 12px;
}

/* identity: wordmark top-left in the type pair's display face, one line */
.wordmark {
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 5;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.18em;
  color: var(--ink);
  pointer-events: none;
}

.hud {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 6;
  display: flex;
  gap: var(--gap);
}

.icon-btn {
  width: var(--target);
  height: var(--target);
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.panel {
  position: fixed;
  top: 68px;
  right: 12px;
  z-index: 6;
  width: min(340px, calc(100vw - 24px));
  max-height: calc(100vh - 68px - 52px);
  max-height: calc(100dvh - 68px - 52px);
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: var(--radius);
  background: var(--glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: var(--pad);
}

.panel[hidden] {
  display: none;
}

.panel:focus {
  outline: none;
}

.panel h2 {
  margin: 0 0 var(--gap);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.group {
  padding-bottom: var(--pad);
  margin-bottom: var(--pad);
  border-bottom: 1px solid var(--border);
}

.group:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
  margin-bottom: var(--gap);
}

.btn {
  min-height: var(--target);
  min-width: var(--target);
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--field);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.field {
  display: block;
  margin-bottom: var(--gap);
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--gap);
  font-size: 13px;
  margin-bottom: 2px;
}

.label-row .value {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.text-input {
  width: 100%;
  min-height: var(--target);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--field);
  color: var(--ink);
  padding: 0 10px;
  font-size: 14px;
}

input[type="range"] {
  display: block;
  width: 100%;
  min-height: var(--target);
  margin: 0;
  background: transparent;
  accent-color: var(--accent);
}

.hint {
  display: block;
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

.status {
  margin: var(--gap) 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

.status:empty {
  display: none;
}

.field-error {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--danger);
}

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

/* a switch row: label and one line of explanation left, the switch right (Sora) */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--pad);
  margin-top: var(--gap);
}

.switch-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.switch-label {
  font-size: 13px;
  font-weight: 600;
}

.switch {
  position: relative;
  flex: none;
  width: 56px;
  min-height: var(--target);
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}

/* the track and thumb are drawn inside a full 44px target */
.switch::before {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  top: 50%;
  height: 26px;
  transform: translateY(-50%);
  border-radius: 13px;
  border: 1px solid var(--border);
  background: var(--field);
  transition: background 0.2s ease;
}

.switch::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 50%;
  width: 20px;
  height: 20px;
  transform: translateY(-50%);
  border-radius: 50%;
  background: var(--muted);
  transition: left 0.2s ease;
}

.switch[aria-checked="true"]::before {
  background: var(--accent);
  border-color: var(--accent);
}

.switch[aria-checked="true"]::after {
  left: 28px;
  background: var(--accent-ink);
}

/* round swatches, the chosen one ringed, its name as a caption (Revolut Business) */
.palette-caption {
  margin: 0 0 4px;
  font-size: 13px;
}

.swatches {
  display: flex;
  gap: var(--gap);
}

.swatch {
  position: relative;
  width: var(--target);
  height: var(--target);
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.swatch::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: var(--swatch);
  border: 1px solid var(--border);
}

.swatch[aria-checked="true"]::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  border: 2px solid var(--accent);
}

/* one input with its action beside it: grow from seed, copy seed */
.seed-row {
  display: flex;
  gap: var(--gap);
  min-width: 0;
}

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

.seed-text {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.04em;
}

.text-input[aria-invalid="true"] {
  border-color: var(--danger);
}

/* the inspector: the caught flake enlarged, its seed beside it (Higgsfield,
   Krea AI), close in the corner */
.inspector {
  width: min(360px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  padding: var(--pad);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.inspector::backdrop {
  background: var(--scrim);
}

.inspector-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  margin-bottom: var(--gap);
}

.inspector-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.export-row {
  margin: var(--pad) 0 0;
}

.inspect-canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  background: var(--bg);
  margin-bottom: var(--pad);
}

.notice {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
  text-align: center;
}

.notice[hidden] {
  display: none;
}

.notice-card {
  max-width: 420px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 24px;
}

.notice-card h1 {
  font-size: 18px;
  margin: 0 0 10px;
}

.notice-card p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
}

.notice-inline {
  margin: 0 0 var(--pad);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--field);
  font-size: 13px;
  line-height: 1.45;
}

.notice-inline[hidden] {
  display: none;
}

/* house footer: one link, muted, no hover styling */
footer.site-footer {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  font-size: 12px;
  white-space: nowrap;
}

footer.site-footer a {
  display: inline-flex;
  align-items: center;
  min-height: var(--target);
  padding: 0 8px;
  color: var(--muted);
  text-decoration: none;
}

/* idle mode: after 3 seconds without input the ui fades so the snow has the
   screen; any input, or focus inside the ui, brings it back (src/idle.js) */
.hud,
.panel,
.wordmark,
footer.site-footer {
  transition: opacity 0.6s ease;
}

body[data-idle="true"] .hud,
body[data-idle="true"] .panel,
body[data-idle="true"] .wordmark,
body[data-idle="true"] footer.site-footer {
  opacity: 0;
  pointer-events: none;
}

body[data-idle="true"] .hud:focus-within,
body[data-idle="true"] .panel:focus-within,
body[data-idle="true"] footer.site-footer:focus-within {
  opacity: 1;
  pointer-events: auto;
}

body[data-idle="true"] #stage {
  cursor: none;
}

/* mobile first: on a phone the card is a bottom sheet so the snowfall stays visible */
@media (max-width: 560px) {
  .panel {
    top: auto;
    left: 12px;
    right: 12px;
    bottom: 48px;
    width: auto;
    max-height: 46vh;
    max-height: 46dvh;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
