@font-face {
  font-family: "Young Serif";
  src: url("assets/fonts/young-serif-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Figtree";
  src: url("assets/fonts/figtree-latin.woff2") format("woff2");
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #f6f4f1;
  --paper-2: #ebe7e1;
  --paper-3: #ffffff;
  --ink: #2a1810;
  --ink-2: #5b4638;
  --rojo: #c8202f;
  --rojo-deep: #9d1623;
  --terracota: #c4623a;
  --ocre: #e1a02a;
  --turquesa: #12727c;
  --verde: #2e6a4b;
  --on-rojo: #ffffff;
  --line: rgb(42 24 16 / 16%);
  --font-display: "Young Serif", Georgia, "Times New Roman", serif;
  --font-body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --gutter: clamp(18px, 5vw, 56px);
  --shadow-lift: 0 18px 50px rgb(42 24 16 / 24%), 0 2px 6px rgb(42 24 16 / 10%);
  --textile: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='24' viewBox='0 0 40 24'%3E%3Crect width='40' height='24' fill='%232a1810'/%3E%3Crect y='2' width='40' height='2' fill='%23e1a02a'/%3E%3Crect y='20' width='40' height='2' fill='%23e1a02a'/%3E%3Cpath d='M20 4 32 12 20 20 8 12Z' fill='%23c8202f'/%3E%3Cpath d='M20 8 27 12 20 16 13 12Z' fill='%23e1a02a'/%3E%3Cpath d='M20 10.5 23 12 20 13.5 17 12Z' fill='%2312727c'/%3E%3C/svg%3E");
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
html, body { margin: 0; min-height: 100%; }

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  caret-color: var(--rojo);
  scrollbar-color: var(--terracota) var(--paper-2);
}

body.is-playing { overflow: hidden; }

::selection { background: var(--ocre); color: var(--ink); }

h1, h2, h3, p, ol, ul, dl, dd, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
button, input { font: inherit; color: inherit; }

:focus-visible {
  outline: 3px solid var(--turquesa);
  outline-offset: 3px;
  border-radius: 6px;
}

svg { flex: none; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper-3);
  font-weight: 600;
  transform: translateY(-160%);
}
.skip-link:focus { transform: none; }

.noscript {
  margin: 0;
  padding: 16px var(--gutter);
  background: var(--ink);
  color: var(--paper-3);
  text-align: center;
}

.textile {
  height: 24px;
  background: var(--textile) repeat-x 0 0 / auto 24px;
}

/* ---------- Buttons ---------- */

.btn, .chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 160ms var(--ease-out), background-color 160ms ease, color 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}
.btn { min-height: 48px; padding: 0 24px; font-size: 1rem; }
.btn:active, .chip:active { transform: scale(.97); }
.btn:disabled, .chip:disabled { opacity: .42; cursor: not-allowed; transform: none; }
.btn svg, .chip svg, .icon-button svg, .privacy-chip svg, .footer-privacy svg, .search-field svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn-ink { background: var(--ink); color: var(--paper-3); }
.btn-primary { background: var(--rojo); color: #fff8ee; box-shadow: 0 6px 16px rgb(200 32 47 / 30%); }
.btn-quiet { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px rgb(42 24 16 / 28%); }
.btn-danger { background: transparent; color: var(--rojo-deep); box-shadow: inset 0 0 0 1.5px rgb(157 22 35 / 45%); }
#confirm-ok.btn-danger { background: var(--rojo-deep); color: #fff8ee; box-shadow: none; }

@media (hover: hover) {
  .btn-ink:hover { background: #422819; }
  .btn-primary:hover { background: var(--rojo-deep); }
  .btn-quiet:hover { background: rgb(42 24 16 / 7%); }
  .btn-danger:hover { background: rgb(157 22 35 / 10%); }
  #confirm-ok.btn-danger:hover { background: #7e0f1b; }
}

.link-button {
  padding: 8px 2px;
  border: 0;
  background: none;
  color: inherit;
  font-weight: 650;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
  cursor: pointer;
}

.icon-button {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background-color 160ms ease, transform 160ms var(--ease-out), color 160ms ease;
}
.icon-button:active { transform: scale(.94); }
.icon-button:disabled { opacity: .5; cursor: wait; transform: none; }
@media (hover: hover) {
  .icon-button:hover { background: rgb(42 24 16 / 9%); }
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  background: var(--rojo);
  color: var(--on-rojo);
  isolation: isolate;
  --chakana-hole: var(--rojo);
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--grain);
  mix-blend-mode: multiply;
  opacity: .22;
  pointer-events: none;
}

.hero-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: max(14px, env(safe-area-inset-top)) var(--gutter) 0;
}
.hero-bar .link-button { color: var(--on-rojo); }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  color: var(--on-rojo);
  font-family: var(--font-display);
  font-size: 1.2rem;
  text-decoration: none;
}
.brand-mark { width: 30px; height: 30px; color: var(--ocre); fill: none; }

.hero-grid {
  display: grid;
  flex: 1;
  align-items: center;
  gap: clamp(24px, 5vw, 64px);
  width: 100%;
  max-width: 1240px;
  margin-inline: auto;
  padding: clamp(24px, 5vw, 56px) var(--gutter) clamp(36px, 6vw, 72px);
}

.nowrap { white-space: nowrap; }

.hero-copy { display: grid; justify-items: start; gap: 22px; }

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.9rem, 1rem + 5.6vw, 5.4rem);
  font-weight: 400;
  line-height: .98;
  letter-spacing: -.02em;
  text-wrap: balance;
  color: var(--paper-3);
}

.hero-lede {
  max-width: 34ch;
  font-size: clamp(1.1rem, 1rem + .5vw, 1.3rem);
  line-height: 1.45;
}

.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.hero-actions .btn { min-height: 56px; padding: 0 32px; font-size: 1.08rem; text-decoration: none; }
.hero-note { font-size: .95rem; font-weight: 600; }

.privacy-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 18px 0 14px;
  border: 1.5px solid rgb(255 255 255 / 55%);
  border-radius: 999px;
  background: rgb(42 24 16 / 22%);
  color: var(--on-rojo);
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 160ms ease, transform 160ms var(--ease-out);
}
.privacy-chip:active { transform: scale(.97); }
@media (hover: hover) {
  .privacy-chip:hover { background: rgb(42 24 16 / 36%); }
}
.hero :focus-visible { outline-color: var(--on-rojo); }

.stamp {
  justify-self: center;
  width: min(74vw, 340px);
  transform: rotate(-3deg);
  filter: drop-shadow(0 26px 24px rgb(70 8 14 / 38%)) drop-shadow(0 4px 6px rgb(70 8 14 / 24%));
}
.stamp-svg { display: block; width: 100%; height: auto; overflow: visible; }
.stamp-holes { stroke: var(--rojo); }
.stamp-title { font-family: var(--font-display); }
.stamp-small { font-family: var(--font-body); font-weight: 700; letter-spacing: .12em; }
.stamp-fill {
  transform-box: fill-box;
  transform-origin: center;
  animation: stamp-in 760ms var(--ease-out) both;
  animation-delay: calc(450ms + var(--i, 0) * 110ms);
}

@media (min-width: 860px) {
  .hero-grid { grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); }
  .stamp { width: min(34vw, 430px, calc((100svh - 190px) * .64)); }
}

.hero-copy > * { animation: rise 720ms var(--ease-out) both; }
.hero-copy > :nth-child(2) { animation-delay: 70ms; }
.hero-copy > :nth-child(3) { animation-delay: 140ms; }
.hero-copy > :nth-child(4) { animation-delay: 210ms; }

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}
@keyframes stamp-in {
  from { opacity: 0; transform: scale(.9); }
  to { opacity: 1; transform: none; }
}

/* ---------- How it works ---------- */

.how { padding: clamp(28px, 5vw, 48px) var(--gutter); background: var(--paper-3); }
.how ol {
  display: grid;
  gap: 20px 40px;
  max-width: 1100px;
  margin-inline: auto;
}
.how li { display: flex; align-items: flex-start; gap: 16px; }
.how-n {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  font-family: var(--font-display);
  font-size: 1.3rem;
  line-height: 1;
  color: var(--rojo);
}
.how p { max-width: 30ch; padding-top: 9px; font-size: 1.02rem; font-weight: 500; }
@media (min-width: 760px) {
  .how ol { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Studio ---------- */

.studio {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--paper);
  scroll-margin-top: 0;
}
.studio:focus { outline: none; }
.studio.is-playing { position: fixed; z-index: 30; inset: 0; }
.studio.is-playing .toolbar, .studio.is-playing .stage-hint { display: none; }

.toolbar {
  position: sticky;
  top: 0;
  z-index: 6;
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto auto;
  grid-template-areas: "progress chips share";
  align-items: center;
  gap: 10px 20px;
  padding: max(10px, env(safe-area-inset-top)) var(--gutter) 10px;
  background: var(--paper-3);
}
.toolbar::after {
  content: "";
  position: absolute;
  top: 100%;
  right: 0;
  left: 0;
  height: 12px;
  background: var(--textile) repeat-x 0 0 / auto 12px;
  pointer-events: none;
}
.progress { grid-area: progress; display: grid; gap: 7px; min-width: 0; }
.progress-label { font-size: .9rem; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.progress-label strong { font-family: var(--font-display); font-size: 1.5rem; font-weight: 400; color: var(--rojo); font-variant-numeric: normal; }
.progress-bar { height: 10px; border-radius: 999px; background: rgb(42 24 16 / 11%); overflow: hidden; }
#progress-fill {
  display: block;
  width: 100%;
  height: 100%;
  clip-path: inset(0 100% 0 0 round 999px);
  background: repeating-linear-gradient(90deg, var(--rojo) 0 16px, var(--ocre) 16px 24px, var(--turquesa) 24px 34px, var(--ink) 34px 38px);
  transition: clip-path 420ms var(--ease-out);
}

.chips { grid-area: chips; display: flex; gap: 8px; }
.chip {
  min-height: 44px;
  padding: 0 16px;
  background: var(--paper);
  color: var(--ink);
  font-size: .92rem;
  box-shadow: inset 0 0 0 1.5px rgb(42 24 16 / 22%);
}
.chip[aria-expanded="true"] { background: var(--ink); color: var(--paper-3); box-shadow: none; }
@media (hover: hover) {
  .chip:not(:disabled):not([aria-expanded="true"]):hover { background: var(--paper-2); }
}
#share { grid-area: share; min-height: 48px; }

@media (max-width: 760px) {
  .toolbar {
    grid-template-columns: 1fr auto;
    grid-template-areas: "progress share" "chips chips";
  }
  .chips { flex-wrap: wrap; }
  .chip { padding: 0 13px; font-size: .86rem; }
  #share { padding: 0 20px; }
}

.stage {
  position: relative;
  display: grid;
  flex: 1;
  place-items: center;
  min-height: 520px;
  padding: 20px 0 28px;
  overflow: hidden;
}
.stage-frame {
  position: absolute;
  inset: 0;
  background: none no-repeat center / 100% 100%;
  pointer-events: none;
}

.map {
  position: relative;
  display: block;
  width: min(88vw, calc((100vh - 170px) * .714));
  width: min(88vw, calc((100dvh - 170px) * .714));
  min-width: 270px;
  height: auto;
  overflow: visible;
  filter: drop-shadow(0 16px 20px rgb(60 36 22 / 20%)) drop-shadow(0 2px 4px rgb(60 36 22 / 12%));
  transform-origin: center center;
}
.studio.is-playing .map { width: min(94vw, calc((100dvh - 48px) * .714)); }

.stage-hint {
  position: absolute;
  bottom: 18px;
  left: 50%;
  max-width: calc(100% - 32px);
  padding: 11px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper-3);
  font-size: .92rem;
  font-weight: 600;
  text-align: center;
  pointer-events: none;
  transform: translateX(-50%);
  animation: hint-in 600ms 600ms var(--ease-out) both;
}
.stage-hint[hidden] { display: none; }
@keyframes hint-in {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.region-photo { pointer-events: none; }
.region-hit { cursor: pointer; stroke-linejoin: round; touch-action: manipulation; }
.region-hit:focus { outline: none; }
.region:has(.region-hit:focus-visible) .region-outline { stroke: var(--turquesa); stroke-width: 3; }
.region.is-editing .region-hit, .map.is-editing .region-hit { touch-action: none; }
.region-marker circle, .region-marker path {
  stroke: var(--ink);
  stroke-opacity: .34;
  stroke-width: 1.5;
  stroke-linecap: round;
  transition: stroke-opacity 160ms ease, stroke 160ms ease;
}
.region.has-photo .region-marker { display: none; }
@media (hover: hover) {
  .region:not(.has-photo):hover .region-base { fill: #f6e3b4; }
  .region:not(.has-photo):hover .region-marker circle,
  .region:not(.has-photo):hover .region-marker path { stroke: var(--rojo); stroke-opacity: .95; }
}

.region.just-saved .region-photo,
.region.play-reveal .region-photo {
  transform-box: fill-box;
  transform-origin: center;
  animation: photo-drop 440ms var(--ease-out) both;
}
.region.play-pending .region-photo { opacity: 0; }
@keyframes photo-drop {
  from { opacity: 0; transform: scale(1.07); }
  to { opacity: 1; transform: none; }
}

.tooltip {
  position: fixed;
  z-index: 25;
  padding: 9px 14px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper-3);
  font-size: .85rem;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 8px 22px rgb(42 24 16 / 28%);
}
.tooltip[hidden], .editor[hidden], .drawer[hidden], .play-bar[hidden], .toast[hidden],
[data-panel-body][hidden], #gradient-settings[hidden], #solid-settings[hidden], .custom-background[hidden],
.export-loading[hidden], .export-inapp[hidden], .export-actions [hidden], .region-list [hidden], .drawer-empty[hidden] { display: none; }

/* ---------- Drawer ---------- */

.drawer {
  position: fixed;
  z-index: 20;
  top: 96px;
  right: max(16px, env(safe-area-inset-right));
  display: flex;
  flex-direction: column;
  width: min(372px, calc(100vw - 24px));
  max-height: calc(100dvh - 112px);
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--paper-3);
  box-shadow: var(--shadow-lift);
  animation: drawer-in 240ms var(--ease-out) both;
  transform-origin: top right;
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 10px 6px 20px; }
.drawer-head h3 { font-family: var(--font-display); font-size: 1.3rem; font-weight: 400; }
.drawer-body { padding: 8px 20px 20px; overflow-y: auto; overscroll-behavior: contain; }

@keyframes drawer-in {
  from { opacity: 0; transform: translateY(-8px) scale(.97); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 760px) {
  .drawer {
    inset: auto 0 0 0;
    width: 100%;
    max-height: 74dvh;
    border-radius: 24px 24px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
    animation-name: sheet-in;
    transform-origin: bottom center;
  }
}
@keyframes sheet-in {
  from { opacity: .4; transform: translateY(28px); }
  to { opacity: 1; transform: none; }
}

.search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 14px;
  border-radius: 14px;
  background: var(--paper);
  box-shadow: inset 0 0 0 1.5px rgb(42 24 16 / 18%);
  color: var(--ink-2);
}
.search-field:focus-within { box-shadow: inset 0 0 0 2px var(--turquesa); }
.search-field input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; }
.search-field input::placeholder { color: var(--ink-2); opacity: .8; }

.region-list { display: grid; margin-top: 10px; }
.region-item {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 6px 4px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.region-thumb {
  width: 38px;
  height: 38px;
  border: 2px dashed rgb(42 24 16 / 30%);
  border-radius: 50%;
  background: center / cover no-repeat;
}
.region-thumb.has-photo { border: 2px solid var(--turquesa); }
.region-name { font-weight: 600; }
.region-status { font-size: .82rem; font-weight: 600; color: var(--ink-2); }
.region-item.is-done .region-status { color: var(--turquesa); }
@media (hover: hover) {
  .region-item:hover .region-name { text-decoration: underline; text-underline-offset: 4px; }
}
.drawer-empty { padding: 20px 0 6px; color: var(--ink-2); }

.theme-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.theme-card {
  display: grid;
  gap: 7px;
  padding: 6px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  text-align: center;
  cursor: pointer;
  transition: transform 160ms var(--ease-out), box-shadow 160ms ease;
}
.theme-card:active { transform: scale(.97); }
.theme-swatch {
  display: block;
  aspect-ratio: 4 / 5;
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px rgb(42 24 16 / 16%);
  background: conic-gradient(from 20deg, #c8202f, #e1a02a, #12727c, #2e6a4b, #c8202f);
}
.theme-name { font-size: .82rem; font-weight: 650; }
.theme-card.is-selected { box-shadow: 0 0 0 2.5px var(--rojo); }

.custom-background { display: grid; gap: 16px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 3px; border-radius: 14px; background: rgb(42 24 16 / 9%); }
.segmented button {
  min-height: 38px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--ink-2);
  font-size: .9rem;
  font-weight: 650;
  cursor: pointer;
}
.segmented button[aria-pressed="true"] { background: var(--paper-3); color: var(--ink); box-shadow: 0 2px 6px rgb(42 24 16 / 14%); }

.preset-row { display: flex; align-items: center; gap: 6px; margin-bottom: 14px; }
.gradient-presets { display: grid; grid-template-columns: repeat(7, 1fr); flex: 1; gap: 6px; }
.gradient-presets button {
  min-width: 0;
  height: 32px;
  padding: 0;
  border: 2px solid var(--paper-3);
  border-radius: 9px;
  box-shadow: 0 0 0 1px rgb(42 24 16 / 18%);
  cursor: pointer;
}
.gradient-presets button.is-selected { box-shadow: 0 0 0 2.5px var(--rojo); }

.color-pickers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.color-pickers label, .solid-picker { color: var(--ink-2); font-size: .8rem; font-weight: 650; }
.color-pickers input, .solid-picker input {
  display: block;
  width: 100%;
  height: 38px;
  margin-top: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.solid-picker input { height: 48px; }
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: 1px solid rgb(42 24 16 / 22%); border-radius: 10px; }
input[type="color"]::-moz-color-swatch { border: 1px solid rgb(42 24 16 / 22%); border-radius: 10px; }

.range-field {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 6px 8px;
  margin-bottom: 20px;
  color: var(--ink-2);
  font-size: .88rem;
  font-weight: 650;
}
.range-field output { color: var(--ink); font-variant-numeric: tabular-nums; }
.range-field input { grid-column: 1 / -1; width: 100%; height: 28px; margin: 0; accent-color: var(--rojo); cursor: pointer; }

.advanced { margin-bottom: 20px; padding-top: 4px; border-top: 1px solid var(--line); }
.advanced summary { padding: 12px 0; font-size: .88rem; font-weight: 650; color: var(--ink-2); cursor: pointer; }
.advanced .range-field { margin-bottom: 4px; }

.drawer-actions { display: grid; gap: 10px; padding-top: 4px; }
.drawer-actions .btn { width: 100%; }

/* ---------- Editor bar ---------- */

.editor {
  position: fixed;
  z-index: 22;
  right: 50%;
  bottom: max(22px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 5px;
  width: max-content;
  max-width: calc(100vw - 20px);
  padding: 7px;
  border-radius: 999px;
  background: var(--paper-3);
  box-shadow: var(--shadow-lift);
  transform: translateX(50%);
  animation: editor-in 300ms var(--ease-out) both;
}
@keyframes editor-in {
  from { opacity: 0; transform: translate(50%, 14px); }
  to { opacity: 1; transform: translateX(50%); }
}
.zoom-control { display: flex; align-items: center; gap: 5px; min-width: 120px; color: var(--ink-2); }
.zoom-control svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.zoom-control input { min-width: 62px; width: 92px; height: 20px; margin: 0; accent-color: var(--rojo); cursor: pointer; }
.editor-divider { width: 1px; height: 24px; margin: 0 2px; background: var(--line); }
.save-button { background: var(--rojo); color: #fff8ee; }
@media (hover: hover) {
  .save-button:hover { background: var(--rojo-deep); }
}
@media (max-width: 390px) {
  .editor { gap: 2px; padding: 5px; }
  .editor .icon-button { width: 38px; height: 40px; }
  .zoom-control { min-width: 97px; gap: 2px; }
  .zoom-control input { width: 70px; height: 32px; }
  .zoom-control svg { width: 14px; height: 14px; }
}

.play-bar {
  position: fixed;
  z-index: 31;
  bottom: max(28px, env(safe-area-inset-bottom));
  left: 50%;
  display: flex;
  gap: 10px;
  transform: translateX(-50%);
  animation: rise 420ms var(--ease-out) both;
}
.play-bar .btn-quiet { background: var(--paper-3); }

/* ---------- Dialogs ---------- */

.dialog {
  width: min(520px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 24px;
  border: 0;
  border-radius: 24px;
  background: var(--paper-3);
  color: var(--ink);
  box-shadow: var(--shadow-lift);
  overflow-y: auto;
}
.dialog[open] { animation: dialog-in 260ms var(--ease-out) both; }
.dialog::backdrop { background: rgb(42 24 16 / 55%); animation: fade-in 200ms ease both; }
.dialog-wide { width: min(900px, calc(100vw - 24px)); }
.dialog-small { width: min(420px, calc(100vw - 24px)); }
@keyframes dialog-in {
  from { opacity: 0; transform: translateY(14px) scale(.97); }
  to { opacity: 1; transform: none; }
}
@keyframes fade-in { from { opacity: 0; } }

.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.dialog h2 { font-family: var(--font-display); font-size: 1.55rem; font-weight: 400; line-height: 1.15; text-wrap: balance; }
.dialog-small h2 { margin-bottom: 10px; }
.dialog-small p { color: var(--ink-2); }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 22px; }

.privacy-list { display: grid; gap: 16px; }
.privacy-list dt { font-weight: 700; }
.privacy-list dd { margin-top: 2px; color: var(--ink-2); max-width: 60ch; }

.export-grid { display: grid; gap: 22px; }
@media (min-width: 760px) {
  .export-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
}
.export-preview {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 260px;
  padding: 12px;
  border-radius: 18px;
  background: rgb(42 24 16 / 7%);
}
.export-slot { display: grid; place-items: center; width: 100%; transition: opacity 200ms ease; }
.export-slot.is-loading { opacity: .3; }
.export-image { display: block; max-width: 100%; max-height: min(58dvh, 620px); border-radius: 8px; box-shadow: 0 10px 30px rgb(42 24 16 / 25%); }
.export-loading { position: absolute; font-weight: 650; color: var(--ink-2); }
.export-controls { display: grid; gap: 16px; }

.format-list { display: grid; gap: 8px; margin: 0; padding: 0; border: 0; min-width: 0; }
.format-list legend { margin-bottom: 8px; padding: 0; font-size: .85rem; font-weight: 700; color: var(--ink-2); }
.format-list label {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 8px 14px;
  border-radius: 14px;
  box-shadow: inset 0 0 0 1.5px rgb(42 24 16 / 20%);
  cursor: pointer;
}
.format-list label:has(input:checked) { background: rgb(200 32 47 / 8%); box-shadow: inset 0 0 0 2px var(--rojo); }
.format-list input { width: 20px; height: 20px; margin: 0; accent-color: var(--rojo); }
.format-list span { display: grid; line-height: 1.25; }
.format-list small { color: var(--ink-2); font-size: .82rem; }

.text-field { display: grid; gap: 6px; font-size: .85rem; font-weight: 700; color: var(--ink-2); }
.text-field input {
  min-height: 48px;
  padding: 0 14px;
  border: 0;
  border-radius: 14px;
  background: var(--paper);
  box-shadow: inset 0 0 0 1.5px rgb(42 24 16 / 22%);
  color: var(--ink);
  font-size: 1rem;
  font-weight: 500;
}
.text-field input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--turquesa); }
.check-field { display: flex; align-items: center; gap: 12px; min-height: 44px; font-weight: 500; cursor: pointer; }
.check-field input { width: 22px; height: 22px; margin: 0; accent-color: var(--rojo); }

.export-inapp { padding: 12px 14px; border-radius: 14px; background: rgb(225 160 42 / 22%); font-size: .9rem; }
.export-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.export-actions .btn { flex: 1 1 150px; padding: 0 18px; }

/* ---------- Toast and confetti ---------- */

.toast {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: max(92px, calc(env(safe-area-inset-bottom) + 84px));
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: min(92vw, 480px);
  padding: 14px 18px;
  border-radius: 18px;
  background: var(--ink);
  color: var(--paper-3);
  font-weight: 600;
  line-height: 1.35;
  box-shadow: var(--shadow-lift);
  opacity: 0;
  transform: translate(-50%, 14px);
  transition: opacity 220ms ease, transform 260ms var(--ease-out);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast-action {
  flex: none;
  min-height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: var(--ocre);
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}

.confetti { position: fixed; z-index: 70; inset: 0; width: 100%; height: 100%; display: none; pointer-events: none; }
.confetti.is-active { display: block; }

/* ---------- Footer ---------- */

.footer { background: var(--ink); color: rgb(255 255 255 / 88%); }
.footer-inner { display: grid; gap: 14px; max-width: 1100px; margin-inline: auto; padding: 36px var(--gutter) max(40px, env(safe-area-inset-bottom)); }
.footer-privacy { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-weight: 600; color: var(--paper-3); }
.footer-privacy svg { color: var(--ocre); }
.footer .link-button { color: var(--ocre); }
.footer :focus-visible { outline-color: var(--ocre); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-delay: 0ms !important;
    transition-duration: .01ms !important;
  }
}
