:root {
  color-scheme: light;
  --bg-0: #edf2f8;
  --bg-1: #e6edf8;
  --bg-2: #dce6f5;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-strong: rgba(255, 255, 255, 0.94);
  --surface-soft: rgba(242, 247, 255, 0.9);
  --line: rgba(80, 107, 150, 0.2);
  --line-strong: rgba(66, 95, 142, 0.3);
  --text: #132341;
  --muted: #5c6f8f;
  --muted-soft: #7284a1;
  --accent: #2154d2;
  --accent-deep: #173ea3;
  --accent-soft: #deebff;
  --highlight: #46d3e8;
  --highlight-deep: #17adc7;
  --warm: #f0af62;
  --canvas-0: #031224;
  --canvas-1: #071c34;
  --shadow-lg: 0 20px 46px rgba(23, 51, 95, 0.18);
  --shadow-md: 0 14px 32px rgba(25, 53, 95, 0.12);
  --font-size-xs: 0.8rem;
  --font-size-sm: 0.86rem;
  --font-size-md: 0.9rem;
  --font-size-title-sm: 1.14rem;
  --ink-heading: #153365;
  --ink-body: #2a4f7e;
  --ink-muted: #597096;
  --ink-link: #1f4ab7;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg-0: #0e141d;
  --bg-1: #121b28;
  --bg-2: #182436;
  --surface: rgba(24, 32, 47, 0.9);
  --surface-strong: rgba(29, 38, 55, 0.95);
  --surface-soft: rgba(32, 43, 62, 0.92);
  --line: rgba(170, 185, 214, 0.2);
  --line-strong: rgba(196, 209, 233, 0.34);
  --text: #e9eef8;
  --muted: #b1bfd6;
  --muted-soft: #98abc7;
  --accent: #93b3f5;
  --accent-deep: #6e8ecc;
  --accent-soft: #24364f;
  --highlight: #73c4cf;
  --highlight-deep: #4fa6b4;
  --warm: #cfac84;
  --canvas-0: #0b1420;
  --canvas-1: #102033;
  --shadow-lg: 0 20px 46px rgba(3, 8, 17, 0.5);
  --shadow-md: 0 12px 28px rgba(3, 8, 17, 0.4);
}

* {
  box-sizing: border-box;
}

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

a {
  color: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--text);
  font-family: "Manrope", "Avenir Next", "Segoe UI", sans-serif;
  background:
    radial-gradient(1100px 560px at 90% -5%, rgba(33, 84, 210, 0.18), transparent 58%),
    radial-gradient(840px 440px at -8% 18%, rgba(70, 211, 232, 0.14), transparent 54%),
    linear-gradient(145deg, var(--bg-0), var(--bg-1) 56%, var(--bg-2));
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.22) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.18) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: 0.22;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.58), rgba(0, 0, 0, 0));
}

html[data-theme="dark"] body {
  background:
    radial-gradient(980px 510px at 94% -8%, rgba(132, 160, 216, 0.12), transparent 58%),
    radial-gradient(780px 440px at -10% 15%, rgba(104, 171, 188, 0.08), transparent 54%),
    linear-gradient(158deg, var(--bg-0), var(--bg-1) 52%, var(--bg-2));
}

html[data-theme="dark"] body::before {
  background:
    linear-gradient(rgba(152, 170, 201, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(152, 170, 201, 0.07) 1px, transparent 1px);
  opacity: 0.08;
}

.app {
  width: min(1260px, 100%);
  margin: 0 auto;
  padding: clamp(10px, 1.4vw, 18px);
}

.hero {
  padding: clamp(10px, 1.4vw, 16px);
  border-radius: 24px;
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at 96% 22%, rgba(70, 211, 232, 0.18), transparent 36%),
    linear-gradient(130deg, rgba(255, 255, 255, 0.92), rgba(244, 249, 255, 0.88));
  box-shadow: var(--shadow-lg);
  display: grid;
  grid-template-columns: 1fr minmax(230px, 280px);
  gap: 12px;
  align-items: stretch;
}

.hero-copy-wrap {
  display: grid;
  gap: 6px;
  align-content: center;
}

.hero-title-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
}

.hero-title-row h1 {
  flex: 0 1 auto;
  min-width: 0;
}

.hero h1 {
  margin: 0;
  line-height: 1;
  letter-spacing: -0.035em;
  font-family: "Sora", "Manrope", sans-serif;
  font-size: clamp(1.9rem, 3.4vw, 3rem);
  font-weight: 800;
  color: #0f2040;
  display: inline-flex;
  align-items: baseline;
  gap: 0.28em;
}

.hero-title-accent {
  color: #2d56bd;
}

.theme-toggle-btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #275093;
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  flex: 0 0 44px;
  cursor: pointer;
  transition:
    color 220ms ease,
    transform 220ms ease,
    opacity 220ms ease;
}

.theme-toggle-btn:hover {
  color: #1b4aa0;
  transform: translateY(-1px);
  opacity: 0.92;
}

.theme-toggle-btn:active {
  transform: translateY(0) scale(0.95);
}

.theme-toggle-btn:focus-visible {
  outline: 2px solid rgba(33, 84, 210, 0.34);
  outline-offset: 3px;
}

.theme-toggle-icon {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  position: relative;
  flex: 0 0 auto;
}

.theme-toggle-icon .icon-glyph {
  width: 18px;
  height: 18px;
  position: absolute;
  inset: 0;
  transform-origin: 50% 50%;
  transition:
    opacity 420ms cubic-bezier(0.22, 0.7, 0.2, 1),
    transform 680ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.theme-toggle-icon .icon-sun {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

.theme-toggle-icon .icon-moon {
  opacity: 0;
  transform: scale(0.4) rotate(-96deg);
}

.theme-toggle-btn.is-dark .theme-toggle-icon .icon-sun {
  opacity: 0;
  transform: scale(0.4) rotate(96deg);
}

.theme-toggle-btn.is-dark .theme-toggle-icon .icon-moon {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

.hero-title-icon {
  font-size: 0.68em;
  line-height: 1;
}

.hero-copy {
  margin: 0;
  max-width: 100%;
  color: var(--muted);
  font-size: clamp(0.92rem, 1.04vw, 1.02rem);
  line-height: 1.38;
}

.hero-copy-accent {
  color: #2d56bd;
  font-weight: 700;
}

.hero-hints {
  margin: 0;
  border-radius: 18px;
  border: 1px solid rgba(33, 84, 210, 0.2);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(238, 246, 255, 0.86));
  padding: 10px 11px;
  display: grid;
  gap: 7px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.hero-hints h2 {
  margin: 0;
  font-size: 1rem;
  font-family: "Sora", "Manrope", sans-serif;
  color: #17396c;
}

.hero-hints p {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: var(--font-size-md);
  color: var(--muted);
}

kbd {
  border-radius: 8px;
  border: 1px solid rgba(33, 84, 210, 0.32);
  background: rgba(255, 255, 255, 0.9);
  color: #1f4ab1;
  font-family: "IBM Plex Mono", "Consolas", monospace;
  font-size: var(--font-size-xs);
  font-weight: 600;
  padding: 2px 8px;
  transition:
    color 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

kbd.is-shortcut-active {
  border-color: rgba(36, 135, 91, 0.65);
  background: rgba(211, 245, 229, 0.96);
  color: #17684a;
  animation: shortcut-press 560ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.workspace {
  margin-top: 10px;
  display: grid;
  grid-template-columns: minmax(310px, 350px) 1fr;
  gap: 10px;
}

.panel,
.canvas-shell {
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: blur(6px);
  box-shadow: var(--shadow-md);
  transition: border-color 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.panel {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.panel-heading h2 {
  margin: 0;
  font-size: var(--font-size-title-sm);
  line-height: 1.08;
  font-family: "Sora", "Manrope", sans-serif;
  color: var(--ink-heading);
  letter-spacing: -0.012em;
}

.panel-heading {
  grid-area: heading;
  margin: -10px -10px 0;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.94), rgba(239, 246, 255, 0.9));
  border-radius: 20px 20px 0 0;
}

.panel-heading p {
  margin: 2px 0 0;
  font-size: var(--font-size-md);
  color: var(--muted);
  line-height: 1.3;
}

.inline-emphasis {
  color: #2c56bd;
  font-weight: 700;
}

.actions {
  grid-area: actions;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.btn {
  appearance: none;
  border-radius: 12px;
  border: 1px solid rgba(33, 84, 210, 0.18);
  padding: 7px 9px;
  color: #26436b;
  cursor: pointer;
  font-size: var(--font-size-sm);
  font-weight: 700;
  letter-spacing: 0.015em;
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.92), rgba(244, 249, 255, 0.86));
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    background-color 0.18s ease,
    box-shadow 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: rgba(33, 84, 210, 0.34);
}

.btn:active {
  transform: translateY(0) scale(0.985);
}

.btn.primary {
  grid-column: span 2;
  color: #04243f;
  border-color: rgba(23, 173, 199, 0.5);
  background: linear-gradient(120deg, #57d8e9, #4ec8f2 54%, #7fd5ff);
  box-shadow: 0 5px 13px rgba(29, 126, 191, 0.22);
}

.btn.ghost {
  grid-column: span 2;
  color: #42506d;
  border-color: rgba(240, 175, 98, 0.48);
  background: linear-gradient(125deg, rgba(255, 244, 232, 0.9), rgba(247, 236, 225, 0.86));
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid rgba(33, 84, 210, 0.5);
  outline-offset: 2px;
}

button:not(.btn):not(.text-btn):not(.theme-toggle-btn),
.p5Button {
  appearance: none;
  border-radius: 10px;
  border: 1px solid rgba(33, 84, 210, 0.28);
  padding: 6px 10px;
  color: #29486f;
  background: rgba(255, 255, 255, 0.86);
  cursor: pointer;
}

select:not(#palette-input),
.p5Select {
  appearance: none;
  border-radius: 10px;
  border: 1px solid rgba(33, 84, 210, 0.3);
  padding: 6px 10px;
  color: #29486f;
  background: rgba(255, 255, 255, 0.88);
}

.preset-block {
  grid-area: presets;
  border: 0;
  background: transparent;
  padding: 2px 0 0;
}

.preset-block h3,
.stats h3 {
  margin: 0 0 6px;
  font-size: var(--font-size-sm);
  color: #1e4b8f;
  letter-spacing: 0.015em;
  text-transform: uppercase;
}

.preset-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-height: 48px;
  width: 100%;
}

.preset-dots {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 2px;
}

.preset-dots::before {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  top: 50%;
  height: 2px;
  border-radius: 999px;
  background: rgba(33, 84, 210, 0.3);
  transform: translateY(-50%);
  z-index: 0;
}

.preset-current-label {
  position: relative;
  display: block;
  width: 100%;
  max-width: 170px;
  min-height: 1.05em;
  overflow: hidden;
  text-align: center;
  font-family: "IBM Plex Mono", "Consolas", monospace;
  font-size: var(--font-size-sm);
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #2a4f86;
  line-height: 1.1;
}

.preset-current-label-item {
  display: block;
  white-space: nowrap;
  transition:
    transform 250ms cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 250ms ease;
}

.preset-current-label-item.is-exit,
.preset-current-label-item.is-next {
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
}

.preset-current-label-item.is-next {
  transform: translateX(100%);
  opacity: 0.92;
}

.preset-current-label.is-sliding .preset-current-label-item.is-exit {
  transform: translateX(-100%);
  opacity: 0;
}

.preset-current-label.is-sliding .preset-current-label-item.is-next {
  transform: translateX(0);
  opacity: 1;
}

.preset-btn {
  appearance: none;
  width: 28px;
  min-width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 2px solid rgba(33, 84, 210, 0.44);
  outline: 6px solid rgba(33, 84, 210, 0.18);
  outline-offset: -6px;
  padding: 0;
  color: transparent;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.96);
  position: relative;
  z-index: 1;
  box-shadow:
    0 0 0 0 rgba(33, 84, 210, 0.34),
    0 0 0 0 rgba(33, 84, 210, 0.12);
  transition:
    background-color 0.18s ease,
    border-color 0.18s ease,
    transform 0.18s ease;
}

.preset-btn:focus-visible {
  outline-color: rgba(33, 84, 210, 0.44);
  outline-width: 7px;
}

.preset-btn:hover {
  border-color: rgba(33, 84, 210, 0.62);
  transform: scale(1.08);
}

.preset-btn:active {
  transform: scale(1);
}

.preset-btn.is-active {
  border-color: rgba(31, 80, 199, 0.95);
  background: linear-gradient(145deg, #2a63da, #1f50c7);
  outline-color: rgba(31, 80, 199, 0.32);
  animation: preset-check 420ms linear;
}

.controls {
  grid-area: controls;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 10px;
}

.control-group {
  border: 0;
  background: transparent;
  padding: 0 1px 8px;
  position: relative;
}

.control-group::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: rgba(79, 106, 150, 0.24);
}

.control-group:last-child {
  grid-column: span 2;
}

.control-group label {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 8px;
  color: var(--muted);
  font-size: var(--font-size-sm);
  font-weight: 700;
}

.control-label {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

output {
  justify-self: end;
  white-space: nowrap;
  color: #234776;
  font-family: "IBM Plex Mono", "Consolas", monospace;
  font-size: var(--font-size-sm);
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  width: 100%;
  margin: 5px 0 0;
  appearance: none;
  background: transparent;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(33, 84, 210, 0.48), rgba(70, 211, 232, 0.4));
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -4px;
  border-radius: 50%;
  border: 1px solid rgba(28, 54, 101, 0.9);
  background: #f9fdff;
  box-shadow: 0 2px 6px rgba(26, 50, 95, 0.28);
}

input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(33, 84, 210, 0.48), rgba(70, 211, 232, 0.4));
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 1px solid rgba(28, 54, 101, 0.9);
  border-radius: 50%;
  background: #f9fdff;
  box-shadow: 0 2px 6px rgba(26, 50, 95, 0.28);
}

.palette-native-select {
  display: none;
}

.palette-select {
  position: relative;
  margin-top: 6px;
}

.palette-trigger {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(33, 84, 210, 0.32);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink-body);
  font-family: "IBM Plex Mono", "Consolas", monospace;
  font-size: var(--font-size-sm);
  padding: 7px 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.palette-caret {
  font-size: var(--font-size-sm);
  color: var(--muted);
  transition: transform 150ms ease;
}

.palette-select.is-open .palette-caret {
  transform: rotate(180deg);
}

.palette-listbox {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 30;
  display: none;
  gap: 0;
  padding: 4px 0;
  border-radius: 10px;
  border: 1px solid rgba(33, 84, 210, 0.3);
  background: rgba(247, 251, 255, 0.98);
  box-shadow: 0 12px 20px rgba(24, 48, 89, 0.16);
}

.palette-select.is-open .palette-listbox {
  display: grid;
}

#palette-listbox .palette-option {
  appearance: none;
  width: 100%;
  text-align: left;
  border-radius: 0;
  border: 0;
  background: transparent;
  color: var(--ink-body);
  font-family: "IBM Plex Mono", "Consolas", monospace;
  font-size: var(--font-size-sm);
  padding: 8px 11px;
  box-shadow: none;
}

#palette-listbox .palette-option + .palette-option {
  border-top: 1px solid rgba(33, 84, 210, 0.12);
}

#palette-listbox .palette-option:hover {
  background: rgba(225, 238, 255, 0.9);
  color: #1f4788;
}

#palette-listbox .palette-option:focus-visible {
  outline: 2px solid rgba(33, 84, 210, 0.45);
  outline-offset: 1px;
}

#palette-listbox .palette-option.is-active {
  color: #1a3f83;
  background: rgba(213, 230, 255, 0.84);
  font-weight: 700;
  position: relative;
}

#palette-listbox .palette-option.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 999px;
  background: rgba(33, 84, 210, 0.72);
}

.stats {
  grid-area: stats;
  border: 0;
  background: transparent;
  padding: 2px 0 0;
}

.stat-grid {
  display: grid;
  gap: 4px;
}

.stats p {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted-soft);
  font-size: var(--font-size-sm);
  padding: 2px 2px;
}

.stats strong {
  color: #234776;
  font-family: "IBM Plex Mono", "Consolas", monospace;
  font-variant-numeric: tabular-nums;
}

.preview-fact-row {
  margin: 0;
  color: #4f6488;
  font-size: var(--font-size-sm);
  line-height: 1.3;
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

button.fact-icon-btn:not(.btn):not(.text-btn) {
  appearance: none;
  width: 36px;
  height: 36px;
  min-width: 36px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #1f4b8f;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease;
}

button.fact-icon-btn:not(.btn):not(.text-btn):hover {
  background: rgba(33, 84, 210, 0.12);
}

button.fact-icon-btn:not(.btn):not(.text-btn):focus-visible {
  outline: 2px solid rgba(33, 84, 210, 0.4);
  outline-offset: 2px;
  background: rgba(33, 84, 210, 0.14);
}

button.fact-icon-btn:not(.btn):not(.text-btn).is-feedback {
  background: rgba(214, 244, 232, 0.98);
  color: #0f6d4d;
}

.preview-fact-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  color: inherit;
  stroke-width: 2.1;
}

.preview-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

#fact-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}

.canvas-shell {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.canvas-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.94), rgba(239, 246, 255, 0.9));
}

.canvas-intro {
  flex: 1 1 auto;
  min-width: 0;
}

.canvas-header h2 {
  margin: 0;
  font-size: var(--font-size-title-sm);
  font-family: "Sora", "Manrope", sans-serif;
  color: var(--ink-heading);
  flex: 0 0 auto;
  letter-spacing: -0.012em;
}

.canvas-header p {
  margin: 0;
  color: var(--muted);
  font-size: var(--font-size-sm);
  line-height: 1.25;
}

.canvas-tools {
  display: flex;
  align-items: center;
  justify-content: end;
  gap: 6px;
  flex: 0 0 auto;
  min-width: max-content;
}

.seed-input-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 10px;
  border: 1px solid rgba(33, 84, 210, 0.28);
  background: rgba(255, 255, 255, 0.88);
  padding: 4px 8px;
  font-size: var(--font-size-sm);
  color: var(--ink-muted);
  font-family: "IBM Plex Mono", "Consolas", monospace;
  flex: 0 0 auto;
}

.seed-input-wrap:focus-within {
  border-color: rgba(33, 84, 210, 0.5);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 0 0 2px rgba(33, 84, 210, 0.18);
}

#seed-input {
  width: 84px;
  border: 0;
  padding: 0;
  color: #234776;
  background: transparent;
  font-family: inherit;
  font-size: var(--font-size-sm);
  font-variant-numeric: tabular-nums;
}

.text-btn {
  appearance: none;
  border-radius: 10px;
  border: 1px solid rgba(33, 84, 210, 0.26);
  padding: 6px 9px;
  color: var(--ink-body);
  cursor: pointer;
  background: rgba(255, 255, 255, 0.86);
  font-size: var(--font-size-sm);
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: background-color 0.2s ease, transform 0.18s ease, border-color 0.2s ease;
}

.text-btn:hover {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(33, 84, 210, 0.4);
  transform: translateY(-1px);
}

.text-btn:active {
  transform: translateY(0) scale(0.985);
}

.text-btn.compact {
  font-family: "IBM Plex Mono", "Consolas", monospace;
}

#apply-seed-btn {
  position: relative;
  min-width: 44px;
  height: 26px;
  padding: 1px 7px;
  font-size: var(--font-size-xs);
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex: 0 0 auto;
}

#apply-seed-btn .apply-label {
  transition: opacity 180ms ease, transform 180ms ease;
}

#apply-seed-btn .apply-check-icon {
  position: absolute;
  opacity: 0;
  transform: scale(0.72);
  transition: opacity 180ms ease, transform 180ms ease;
  width: 13px;
  height: 13px;
  stroke-width: 2.35;
}

#apply-seed-btn.is-success {
  border-color: rgba(24, 131, 88, 0.34);
  background: linear-gradient(135deg, rgba(207, 246, 233, 0.96), rgba(227, 251, 242, 0.96));
  color: #0e6a4b;
}

#apply-seed-btn.is-success .apply-label {
  opacity: 0;
  transform: translateY(-5px);
}

#apply-seed-btn.is-success .apply-check-icon {
  opacity: 1;
  transform: scale(1);
  animation: apply-check-pop 820ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.icon-btn {
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  line-height: 1;
}

.icon-glyph {
  width: 16px;
  height: 16px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.15;
}

#copy-seed-btn {
  color: #143f91;
}

#copy-seed-btn.bare-icon {
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  border-color: transparent;
  background: transparent;
  position: relative;
  overflow: visible;
}

#copy-seed-btn .icon-copy {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

#redraw-btn.icon-btn {
  color: #1b498f;
}

#redraw-btn.bare-icon {
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  border-color: transparent;
  background: transparent;
}

#redraw-btn .icon-rotate {
  width: 17.5px;
  height: 17.5px;
  stroke-width: 2.35;
}

#redraw-btn.is-spinning {
  color: #0f6d4d;
  background: rgba(214, 244, 232, 0.96);
}

#redraw-btn.is-spinning .icon-rotate {
  animation: rotate-cw 420ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.icon-btn.is-feedback {
  border-color: rgba(24, 131, 88, 0.36);
  background: rgba(224, 248, 238, 0.96);
  color: #0f6d4d;
}

.bare-icon.icon-btn:hover {
  border-color: transparent;
  background: rgba(223, 237, 255, 0.78);
}

.bare-icon.icon-btn:focus-visible {
  outline: 2px solid rgba(33, 84, 210, 0.4);
  outline-offset: 1px;
  background: rgba(223, 237, 255, 0.82);
}

.bare-icon.icon-btn::after {
  content: attr(data-feedback);
  position: absolute;
  top: 50%;
  right: calc(100% + 12px);
  left: auto;
  transform: translate(-4px, -50%) scale(0.97);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  border-radius: 999px;
  border: 1px solid rgba(24, 131, 88, 0.34);
  background: linear-gradient(140deg, rgba(232, 251, 243, 0.98), rgba(216, 246, 234, 0.98));
  color: #0f6d4d;
  font-family: "IBM Plex Mono", "Consolas", monospace;
  font-size: var(--font-size-xs);
  font-weight: 700;
  line-height: 1;
  padding: 6px 10px;
  box-shadow: 0 10px 20px rgba(12, 80, 57, 0.18);
  z-index: 8;
  will-change: opacity, transform;
}

.bare-icon.icon-btn.is-feedback::after {
  animation: icon-toast 1400ms ease forwards;
}

.bare-icon.icon-btn.is-feedback {
  border-color: transparent;
  background: rgba(214, 244, 232, 0.98);
  color: #0f6d4d;
}

.bare-icon.icon-btn {
  border: 0;
  border-color: transparent;
  background: transparent;
}

@keyframes icon-toast {
  0% {
    opacity: 0;
    transform: translate(-4px, -50%) scale(0.97);
  }

  12% {
    opacity: 1;
    transform: translate(0, -50%) scale(1);
  }

  80% {
    opacity: 1;
    transform: translate(-1px, -50%) scale(1);
  }

  100% {
    opacity: 0;
    transform: translate(-8px, -50%) scale(0.98);
  }
}

@keyframes rotate-cw {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@keyframes apply-check-pop {
  0% {
    transform: scale(0.64);
    opacity: 0;
  }

  28% {
    transform: scale(1.08);
    opacity: 1;
  }

  65% {
    transform: scale(1);
    opacity: 1;
  }

  100% {
    transform: scale(0.98);
    opacity: 1;
  }
}

#canvas-host {
  flex: 1;
  min-height: 0;
  padding: 8px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 14% 0%, rgba(70, 211, 232, 0.18), transparent 36%),
    radial-gradient(circle at 92% 8%, rgba(37, 89, 214, 0.16), transparent 42%),
    linear-gradient(160deg, var(--canvas-0), var(--canvas-1));
}

#canvas-host canvas {
  max-width: 100%;
  max-height: 100%;
  display: block;
  border-radius: 14px;
  border: 1px solid rgba(180, 203, 237, 0.3);
  box-shadow: 0 15px 32px rgba(5, 11, 24, 0.48);
  animation: canvas-pop 300ms ease;
}

.footer {
  margin-top: 8px;
  color: rgba(60, 79, 110, 0.88);
  font-size: var(--font-size-sm);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.footer a {
  color: var(--ink-link);
  font-weight: 700;
}

.privacy-note {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(33, 84, 210, 0.24);
  border-radius: 999px;
  min-height: 30px;
  padding: 5px 10px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--ink-muted);
  font-size: var(--font-size-xs);
  font-weight: 700;
  letter-spacing: 0.01em;
}

.privacy-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.privacy-link-btn {
  appearance: none;
  border-radius: 999px;
  border: 1px solid rgba(33, 84, 210, 0.24);
  background: rgba(255, 255, 255, 0.84);
  color: var(--ink-muted);
  min-height: 30px;
  padding: 5px 10px;
  font-size: var(--font-size-xs);
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.privacy-link-btn:hover {
  border-color: rgba(33, 84, 210, 0.44);
  background: rgba(255, 255, 255, 0.98);
  color: var(--ink-link);
  transform: translateY(-1px);
}

.privacy-arrow {
  width: 14px;
  height: 14px;
  color: #60749b;
  stroke-width: 2.3;
}

.privacy-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  padding: clamp(12px, 2vw, 24px);
  display: grid;
  place-items: center;
  background: rgba(13, 28, 56, 0.32);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.privacy-modal[hidden] {
  display: none;
}

.privacy-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.privacy-dialog {
  width: min(760px, 100%);
  max-height: min(88vh, 920px);
  border-radius: 22px;
  border: 1px solid rgba(53, 89, 145, 0.34);
  background: linear-gradient(160deg, rgba(248, 252, 255, 0.98), rgba(236, 244, 255, 0.96));
  box-shadow: 0 26px 48px rgba(14, 34, 71, 0.28);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(7px) scale(0.99);
  transition: transform 180ms ease;
}

.privacy-modal.is-open .privacy-dialog {
  transform: translateY(0) scale(1);
}

.privacy-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(61, 95, 146, 0.2);
}

.privacy-head h2 {
  margin: 0;
  font-size: clamp(1.2rem, 2vw, 1.6rem);
  font-family: "Sora", "Manrope", sans-serif;
  color: var(--ink-heading);
}

.privacy-close-btn {
  border-radius: 999px;
  border: 1px solid rgba(33, 84, 210, 0.28);
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink-link);
  padding: 7px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 180ms ease, background-color 180ms ease;
}

.privacy-close-btn:hover {
  border-color: rgba(33, 84, 210, 0.46);
  background: rgba(255, 255, 255, 0.98);
}

.privacy-body {
  padding: 14px 18px 18px;
  overflow-y: auto;
  display: grid;
  gap: 10px;
}

.privacy-intro {
  margin: 0;
  color: var(--muted);
  font-size: 0.97rem;
  line-height: 1.4;
}

.privacy-item {
  border-radius: 14px;
  border: 1px solid rgba(58, 97, 158, 0.2);
  background: rgba(255, 255, 255, 0.84);
  padding: 12px 13px;
  display: grid;
  gap: 5px;
}

.privacy-item h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--ink-link);
}

.privacy-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.privacy-item a {
  color: var(--ink-link);
  font-weight: 700;
}

.privacy-updated {
  margin: 4px 0 2px;
  text-align: center;
  color: var(--muted);
  font-size: var(--font-size-xs);
  letter-spacing: 0.01em;
}

body.is-modal-open {
  overflow: hidden;
}

html[data-theme="dark"] .hero {
  border-color: rgba(154, 172, 204, 0.26);
  background:
    radial-gradient(circle at 96% 22%, rgba(115, 196, 207, 0.1), transparent 38%),
    linear-gradient(130deg, rgba(20, 29, 43, 0.94), rgba(28, 39, 56, 0.9));
}

html[data-theme="dark"] .hero h1 {
  color: #f0f5ff;
}

html[data-theme="dark"] .hero-title-accent {
  color: #b5c9ee;
}

html[data-theme="dark"] .hero-copy {
  color: var(--muted);
}

html[data-theme="dark"] .hero-copy-accent {
  color: #d6e2f8;
}

html[data-theme="dark"] .inline-emphasis {
  color: #c4d4ef;
}

html[data-theme="dark"] .theme-toggle-btn {
  color: #c5d4ec;
}

html[data-theme="dark"] .theme-toggle-btn:hover {
  color: #e6eefc;
}

html[data-theme="dark"] .theme-toggle-btn:focus-visible {
  outline-color: rgba(165, 189, 229, 0.52);
}

html[data-theme="dark"] .hero-hints {
  border-color: rgba(150, 169, 202, 0.28);
  background: linear-gradient(145deg, rgba(24, 34, 50, 0.92), rgba(31, 43, 62, 0.88));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

html[data-theme="dark"] .hero-hints h2 {
  color: #e1e8f7;
}

html[data-theme="dark"] .hero-hints p {
  color: #adc0db;
}

html[data-theme="dark"] kbd {
  border-color: rgba(150, 169, 202, 0.52);
  background: rgba(22, 33, 49, 0.94);
  color: #c6d6ee;
}

html[data-theme="dark"] kbd.is-shortcut-active {
  border-color: rgba(109, 208, 164, 0.74);
  background: rgba(20, 74, 55, 0.92);
  color: #d9ffef;
}

html[data-theme="dark"] .panel,
html[data-theme="dark"] .canvas-shell {
  border-color: var(--line);
  background: var(--surface);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

html[data-theme="dark"] .panel-heading,
html[data-theme="dark"] .canvas-header {
  border-bottom-color: rgba(152, 171, 203, 0.24);
  background: linear-gradient(145deg, rgba(25, 35, 51, 0.95), rgba(32, 44, 63, 0.9));
}

html[data-theme="dark"] .panel-heading h2,
html[data-theme="dark"] .canvas-header h2 {
  color: #e2eaf8;
}

html[data-theme="dark"] .panel-heading p,
html[data-theme="dark"] .canvas-header p {
  color: var(--muted);
}

html[data-theme="dark"] .btn {
  border-color: rgba(151, 171, 203, 0.32);
  color: #d5e1f5;
  background: linear-gradient(140deg, rgba(31, 42, 60, 0.95), rgba(24, 35, 52, 0.92));
}

html[data-theme="dark"] .btn:hover {
  border-color: rgba(189, 205, 231, 0.44);
  background: linear-gradient(140deg, rgba(37, 49, 70, 0.97), rgba(30, 43, 63, 0.95));
}

html[data-theme="dark"] .btn.primary {
  color: #edf4ff;
  border-color: rgba(129, 160, 220, 0.56);
  background: linear-gradient(120deg, #4f78c4, #5c84d0 60%, #6a93d7);
  box-shadow: 0 6px 14px rgba(28, 45, 74, 0.36);
}

html[data-theme="dark"] .btn.ghost {
  color: #eadbc9;
  border-color: rgba(178, 149, 116, 0.48);
  background: linear-gradient(125deg, rgba(70, 55, 41, 0.88), rgba(56, 44, 34, 0.86));
}

html[data-theme="dark"] button:focus-visible,
html[data-theme="dark"] input:focus-visible,
html[data-theme="dark"] select:focus-visible {
  outline-color: rgba(145, 170, 216, 0.65);
}

html[data-theme="dark"] button:not(.btn):not(.text-btn):not(.theme-toggle-btn),
html[data-theme="dark"] .p5Button,
html[data-theme="dark"] select:not(#palette-input),
html[data-theme="dark"] .p5Select {
  border-color: rgba(149, 170, 203, 0.38);
  color: #cedcf2;
  background: rgba(31, 43, 62, 0.92);
}

html[data-theme="dark"] .preset-block,
html[data-theme="dark"] .stats {
  border-color: transparent;
  background: transparent;
}

html[data-theme="dark"] .preset-block h3,
html[data-theme="dark"] .stats h3 {
  color: #9bbcf3;
}

html[data-theme="dark"] .preset-btn {
  border-color: rgba(160, 182, 219, 0.58);
  outline-color: rgba(149, 170, 203, 0.3);
  background: rgba(31, 43, 62, 0.96);
  box-shadow:
    0 0 0 0 rgba(141, 175, 233, 0.36),
    0 0 0 0 rgba(141, 175, 233, 0.12);
}

html[data-theme="dark"] .preset-btn:hover {
  border-color: rgba(196, 214, 241, 0.72);
}

html[data-theme="dark"] .preset-actions {
  background: transparent;
}

html[data-theme="dark"] .preset-dots::before {
  background: rgba(149, 170, 203, 0.38);
}

html[data-theme="dark"] .preset-current-label {
  color: #d3e0f3;
}

html[data-theme="dark"] .preset-btn.is-active {
  border-color: rgba(170, 196, 242, 0.95);
  background: linear-gradient(140deg, #5c83cb, #496db4);
  outline-color: rgba(170, 196, 242, 0.4);
}

@keyframes preset-check {
  50% {
    box-shadow:
      0 0 0 9px rgba(33, 84, 210, 0.3),
      0 0 0 17px rgba(33, 84, 210, 0.12);
  }

  100% {
    box-shadow:
      0 0 0 0 rgba(33, 84, 210, 0.3),
      0 0 0 0 rgba(33, 84, 210, 0.1);
  }
}

html[data-theme="dark"] .preset-btn.is-active {
  animation: preset-check-dark 420ms linear;
}

@keyframes preset-check-dark {
  50% {
    box-shadow:
      0 0 0 9px rgba(141, 175, 233, 0.34),
      0 0 0 17px rgba(141, 175, 233, 0.14);
  }

  100% {
    box-shadow:
      0 0 0 0 rgba(141, 175, 233, 0.3),
      0 0 0 0 rgba(141, 175, 233, 0.12);
  }
}

@keyframes shortcut-press {
  0% {
    transform: translateY(0) scale(1);
    box-shadow: 0 0 0 0 rgba(48, 163, 113, 0.4);
  }

  40% {
    transform: translateY(-1px) scale(1.04);
    box-shadow: 0 0 0 8px rgba(48, 163, 113, 0.22);
  }

  100% {
    transform: translateY(0) scale(1);
    box-shadow: 0 0 0 0 rgba(48, 163, 113, 0);
  }
}

html[data-theme="dark"] .control-group {
  border-color: transparent;
  background: transparent;
}

html[data-theme="dark"] .control-group::after {
  background: rgba(161, 180, 214, 0.22);
}

html[data-theme="dark"] .control-group label {
  color: #b8c7de;
}

html[data-theme="dark"] output {
  color: #d9e5f6;
}

html[data-theme="dark"] input[type="range"]::-webkit-slider-runnable-track,
html[data-theme="dark"] input[type="range"]::-moz-range-track {
  background: linear-gradient(90deg, rgba(131, 152, 189, 0.62), rgba(108, 166, 180, 0.52));
}

html[data-theme="dark"] input[type="range"]::-webkit-slider-thumb,
html[data-theme="dark"] input[type="range"]::-moz-range-thumb {
  border-color: rgba(214, 225, 243, 0.82);
  background: #f3f7ff;
  box-shadow: 0 2px 6px rgba(2, 7, 15, 0.42);
}

html[data-theme="dark"] .palette-trigger {
  border-color: rgba(149, 170, 203, 0.5);
  background: rgba(29, 41, 60, 0.92);
  color: #d0def3;
}

html[data-theme="dark"] .palette-caret {
  color: #baccea;
}

html[data-theme="dark"] .palette-listbox {
  border-color: rgba(149, 170, 203, 0.52);
  background: rgba(27, 39, 57, 0.98);
  box-shadow: 0 12px 24px rgba(2, 9, 17, 0.42);
}

html[data-theme="dark"] #palette-listbox .palette-option {
  color: #c8d8ef;
}

html[data-theme="dark"] #palette-listbox .palette-option + .palette-option {
  border-top-color: rgba(149, 170, 203, 0.22);
}

html[data-theme="dark"] #palette-listbox .palette-option:hover {
  background: rgba(43, 58, 82, 0.95);
  color: #edf4ff;
}

html[data-theme="dark"] #palette-listbox .palette-option:focus-visible {
  outline-color: rgba(147, 169, 205, 0.72);
}

html[data-theme="dark"] #palette-listbox .palette-option.is-active {
  color: #edf4ff;
  background: rgba(89, 118, 170, 0.44);
}

html[data-theme="dark"] #palette-listbox .palette-option.is-active::before {
  background: rgba(141, 175, 233, 0.9);
}

html[data-theme="dark"] .stats p {
  color: #aec1dc;
}

html[data-theme="dark"] .stats strong {
  color: #e5edfb;
}

html[data-theme="dark"] .preview-fact-row {
  color: #b8c7de;
}

html[data-theme="dark"] #fact-text {
  color: #d6e1f2;
}

html[data-theme="dark"] button.fact-icon-btn:not(.btn):not(.text-btn) {
  color: #9ebef3;
}

html[data-theme="dark"] button.fact-icon-btn:not(.btn):not(.text-btn):hover {
  background: rgba(146, 170, 207, 0.2);
}

html[data-theme="dark"] .seed-input-wrap {
  border-color: rgba(149, 170, 203, 0.46);
  background: rgba(29, 41, 60, 0.92);
  color: #b2c3de;
}

html[data-theme="dark"] .seed-input-wrap:focus-within {
  border-color: rgba(176, 197, 235, 0.62);
  background: rgba(35, 49, 71, 0.96);
  box-shadow: 0 0 0 2px rgba(135, 164, 216, 0.22);
}

html[data-theme="dark"] #seed-input {
  color: #e0e9f8;
}

html[data-theme="dark"] .text-btn {
  border-color: rgba(149, 170, 203, 0.44);
  color: #d1ddf1;
  background: rgba(30, 43, 62, 0.92);
}

html[data-theme="dark"] .text-btn:hover {
  border-color: rgba(187, 205, 230, 0.56);
  background: rgba(38, 52, 73, 0.96);
}

@media (hover: hover) and (pointer: fine) {
  .panel:hover,
  .canvas-shell:hover {
    border-color: var(--line-strong);
  }
}

html[data-theme="dark"] #copy-seed-btn {
  color: #a4c3f5;
}

html[data-theme="dark"] #redraw-btn.icon-btn {
  color: #a4c3f5;
}

html[data-theme="dark"] .bare-icon.icon-btn:hover {
  background: rgba(149, 170, 203, 0.2);
}

html[data-theme="dark"] #canvas-host {
  background:
    radial-gradient(circle at 14% 0%, rgba(115, 196, 207, 0.14), transparent 38%),
    radial-gradient(circle at 92% 8%, rgba(136, 164, 214, 0.14), transparent 44%),
    linear-gradient(160deg, var(--canvas-0), var(--canvas-1));
}

html[data-theme="dark"] #canvas-host canvas {
  border-color: rgba(171, 191, 223, 0.34);
  box-shadow: 0 14px 30px rgba(2, 8, 16, 0.52);
}

html[data-theme="dark"] .footer {
  color: rgba(181, 196, 222, 0.92);
}

html[data-theme="dark"] .footer a {
  color: #a6c2f6;
}

html[data-theme="dark"] .privacy-note,
html[data-theme="dark"] .privacy-link-btn {
  border-color: rgba(147, 168, 202, 0.36);
  background: rgba(29, 42, 61, 0.92);
  color: #bdcee7;
}

html[data-theme="dark"] .privacy-link-btn:hover {
  border-color: rgba(184, 203, 230, 0.54);
  background: rgba(37, 52, 74, 0.98);
  color: #e1eaf8;
}

html[data-theme="dark"] .privacy-arrow {
  color: #a6bad7;
}

html[data-theme="dark"] .privacy-modal {
  background: rgba(8, 13, 22, 0.62);
}

html[data-theme="dark"] .privacy-dialog {
  border-color: rgba(149, 169, 203, 0.36);
  background: linear-gradient(160deg, rgba(23, 34, 50, 0.98), rgba(31, 43, 61, 0.96));
  box-shadow: 0 24px 50px rgba(1, 6, 13, 0.58);
}

html[data-theme="dark"] .privacy-head {
  border-bottom-color: rgba(149, 169, 203, 0.26);
}

html[data-theme="dark"] .privacy-head h2 {
  color: #e6edf9;
}

html[data-theme="dark"] .privacy-close-btn {
  border-color: rgba(148, 169, 203, 0.44);
  background: rgba(30, 43, 62, 0.92);
  color: #d3e0f2;
}

html[data-theme="dark"] .privacy-close-btn:hover {
  border-color: rgba(187, 205, 230, 0.56);
  background: rgba(38, 52, 73, 0.96);
}

html[data-theme="dark"] .privacy-intro {
  color: #b8c9e1;
}

html[data-theme="dark"] .privacy-item {
  border-color: rgba(149, 169, 203, 0.3);
  background: rgba(28, 40, 58, 0.88);
}

html[data-theme="dark"] .privacy-item h3 {
  color: #e1e9f7;
}

html[data-theme="dark"] .privacy-item p {
  color: #b4c6de;
}

html[data-theme="dark"] .privacy-item a {
  color: #a7c3f6;
}

html[data-theme="dark"] .privacy-updated {
  color: #9eb2d0;
}

.reveal {
  opacity: 0;
  transform: translateY(10px);
  animation: reveal 500ms ease forwards;
}

.reveal-delay-1 {
  animation-delay: 80ms;
}

.reveal-delay-2 {
  animation-delay: 150ms;
}

@keyframes reveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes canvas-pop {
  from {
    opacity: 0.5;
    transform: scale(0.987);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

  .reveal {
    opacity: 1;
    transform: none;
    animation: none;
  }

  #canvas-host canvas {
    animation: none;
  }

  #redraw-btn.is-spinning .icon-rotate,
  #apply-seed-btn.is-success .apply-check-icon,
  .bare-icon.icon-btn.is-feedback::after,
  kbd.is-shortcut-active {
    animation: none;
  }
}

@media (min-width: 1081px) {
  .app {
    height: 100vh;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 8px;
    padding: 8px 12px;
  }

  .workspace {
    margin-top: 0;
    min-height: 0;
  }

  .panel,
  .canvas-shell {
    min-height: 0;
  }

  .panel {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "heading heading"
      "actions actions"
      "stats presets"
      "controls controls";
    column-gap: 7px;
    row-gap: 7px;
    align-content: start;
    overflow: visible;
  }

  .footer {
    margin-top: 0;
  }
}

@supports (height: 100dvh) {
  @media (min-width: 1081px) {
    .app {
      height: 100dvh;
    }
  }
}

@media (max-width: 1080px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .canvas-shell {
    min-height: 500px;
  }

  #canvas-host {
    min-height: 430px;
  }
}

@media (max-width: 760px) {
  .app {
    padding: 12px;
  }

  .hero {
    border-radius: 18px;
  }

  .theme-toggle-btn {
    width: 40px;
    min-width: 40px;
    height: 40px;
    flex-basis: 40px;
  }

  .hero-hints {
    display: none;
  }

  .panel,
  .canvas-shell {
    border-radius: 16px;
  }

  .panel-heading {
    border-radius: 16px 16px 0 0;
  }

  .actions,
  .controls {
    grid-template-columns: 1fr;
  }

  .control-group:last-child,
  .btn.primary,
  .btn.ghost {
    grid-column: span 1;
  }

  .canvas-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .canvas-tools {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .seed-input-wrap,
  .text-btn:not(.icon-btn) {
    width: 100%;
  }

  .icon-btn {
    justify-self: end;
  }

  .privacy-dialog {
    border-radius: 16px;
  }

  .privacy-head {
    padding: 12px 14px;
  }

  .privacy-body {
    padding: 11px 12px 13px;
  }

  .privacy-item {
    padding: 10px 11px;
  }
}
