/* Vendo on the web: VendoTheme (the Android app's colours), one screen tall, no page scroll, 48 px targets. */

@font-face { font-family: VendoLatin; src: url(/fonts/noto_sans_regular.ttf?v=f3961a9cde) format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: VendoLatin; src: url(/fonts/noto_sans_bold.ttf?v=87cb2d8447) format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: VendoGeorgian; src: url(/fonts/noto_sans_georgian_regular.ttf?v=f4b229b126) format("truetype"); font-weight: 400; font-display: swap; unicode-range: U+10A0-10FF, U+2D00-2D2F, U+1C90-1CBF; }
@font-face { font-family: VendoGeorgian; src: url(/fonts/noto_sans_georgian_bold.ttf?v=517722454b) format("truetype"); font-weight: 700; font-display: swap; unicode-range: U+10A0-10FF, U+2D00-2D2F, U+1C90-1CBF; }
@font-face { font-family: VendoDevanagari; src: url(/fonts/noto_sans_devanagari_regular.ttf?v=9c7d935139) format("truetype"); font-weight: 400; font-display: swap; unicode-range: U+0900-097F, U+A8E0-A8FF; }
@font-face { font-family: VendoDevanagari; src: url(/fonts/noto_sans_devanagari_bold.ttf?v=ff2f76a23a) format("truetype"); font-weight: 700; font-display: swap; unicode-range: U+0900-097F, U+A8E0-A8FF; }
@font-face { font-family: VendoArabic; src: url(/fonts/noto_sans_arabic_regular.ttf?v=bd86ca02f0) format("truetype"); font-weight: 400; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFE; }
@font-face { font-family: VendoArabic; src: url(/fonts/noto_sans_arabic_bold.ttf?v=f4cb79f842) format("truetype"); font-weight: 700; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFE; }

:root {
  --primary: #2D5A78;
  --on-primary: #FFFFFF;
  --primary-container: #D4E5F1;
  --on-primary-container: #0C2638;
  --surface: #F7F8FA;
  --surface-container: #EEF1F4;
  --on-surface: #181C20;
  --on-surface-variant: #46505A;
  --outline: #4F5963;
  --outline-variant: #C4CAD0;
  --error: #B3261E;
  --tap: max(48px, 2.75rem);
  --gap: .75rem;
  --radius: 14px;
  /* the counting strip (tools/site-tracking): our colours, and we make our own room for it (no spacer) */
  --nxm-bg: #FFFFFF;
  --nxm-ink: #181C20;
  --nxm-line: #C4CAD0;
  --nxm-pad: none;
  color-scheme: light;
  font-family: VendoLatin, VendoGeorgian, VendoDevanagari, VendoArabic, system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; touch-action: manipulation; }
body {
  margin: 0;
  background: var(--surface);
  color: var(--on-surface);
  font-size: 1rem;
  line-height: 1.4;
  overflow: hidden;
}
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
button, input, select, label, a { touch-action: manipulation; }
a { color: var(--primary); }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }

/* ---- the shell: header, one screen, footer; the counting strip's room at the bottom ---- */
.shell {
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding-bottom: var(--nxm-h, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  max-width: 1200px;
  margin: 0 auto;
}
.bar {
  display: flex; align-items: center; gap: .5rem;
  padding-block: .25rem;
  padding-inline: 1rem .5rem;
  min-height: calc(var(--tap) + .5rem);
}
.logo { width: 2rem; height: 2rem; border-radius: 8px; flex: none; }
.brand { margin: 0; font-size: 1.25rem; font-weight: 700; flex: 1; color: var(--primary); }
.icon-btn {
  min-width: var(--tap); min-height: var(--tap);
  display: inline-grid; place-items: center;
  border: 0; border-radius: 50%; background: transparent; color: var(--on-surface-variant); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-container); }
.screen { overflow: auto; padding: .5rem 1rem 1rem; min-height: 0; }
.foot {
  display: flex; flex-wrap: wrap; gap: .25rem 1rem; justify-content: center; align-items: center;
  padding: .25rem 1rem; font-size: .8125rem; color: var(--on-surface-variant);
}
.foot a { display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 .25rem; }
/* short screens: the links stay in Settings, the poster gets the room */
@media (max-height: 700px) { .foot.in-maker { display: none; } }

/* ---- buttons and fields ---- */
.btn {
  min-height: var(--tap); max-width: 100%; padding: .5rem 1rem;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; text-align: center;
  border-radius: 999px; border: 1px solid transparent; cursor: pointer; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere;
}
.btn.filled { background: var(--primary); color: var(--on-primary); }
.btn.tonal { background: var(--primary-container); color: var(--on-primary-container); }
.btn.text { background: transparent; color: var(--primary); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.file { position: relative; overflow: hidden; }
.btn.file input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 0; }
.btn.file:focus-within { outline: 3px solid var(--primary); outline-offset: 2px; }
.row-btns { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; margin-top: 1rem; }
.field { display: flex; flex-direction: column; gap: .25rem; margin: .5rem 0; font-size: .875rem; color: var(--on-surface-variant); min-width: 0; }
.field input, .field select {
  min-height: var(--tap); padding: .5rem .75rem; width: 100%; min-width: 0;
  border: 1px solid var(--outline); border-radius: 10px; background: #FFFFFF; color: var(--on-surface); font-size: 1rem;
}
.pair { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; }
.pair .grow { flex: 1 1 8rem; }
.pair .field:not(.grow) { flex: 0 1 9rem; }
.switch { display: flex; align-items: center; gap: .75rem; min-height: var(--tap); cursor: pointer; margin: .25rem 0; }
.switch input { width: 1.5rem; height: 1.5rem; flex: none; accent-color: var(--primary); margin: 0; }
.hint { margin: .25rem 0; font-size: .875rem; color: var(--on-surface-variant); }
.err { margin: .25rem 0; font-size: .875rem; color: var(--error); font-weight: 700; }
.err:empty, .note:empty { display: none; }
.sub { margin: .75rem 0 .25rem; font-size: .9375rem; }
.q { margin: .75rem 0 .5rem; font-size: 1.125rem; }
.lead { margin: .25rem 0; color: var(--on-surface-variant); }
.small { font-size: .8125rem; color: var(--on-surface-variant); }

/* ---- onboarding ---- */
#onb { max-width: 36rem; width: 100%; justify-self: center; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: .5rem; }
.choice, .chip {
  min-height: var(--tap); max-width: 100%; padding: .5rem .875rem; border-radius: 12px; cursor: pointer; text-align: center; line-height: 1.2;
  border: 1px solid var(--outline-variant); background: #FFFFFF; color: var(--on-surface); overflow-wrap: anywhere;
}
.choice[aria-checked="true"], .chip[aria-checked="true"] {
  background: var(--primary-container); color: var(--on-primary-container); border-color: var(--primary); font-weight: 700;
}

/* ---- the maker: the poster above, the controls below; side by side on wide screens ---- */
.maker {
  display: grid; min-height: 0; min-width: 0;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(6rem, 1fr) minmax(0, auto);
  gap: .25rem;
}
.stage {
  min-height: 0; min-width: 0; overflow: hidden;
  display: grid; grid-template-rows: minmax(0, 1fr) auto;
  justify-items: center; align-items: center; gap: .25rem;
  padding: .25rem 1rem;
}
.stage-fit {
  width: 100%; height: 100%; min-height: 0; min-width: 0;
  container-type: size;
  display: grid; place-items: center; overflow: hidden;
}
#preview {
  --ar: calc(9 / 16);
  display: block;
  width: min(100cqw, calc(100cqh * var(--ar)));
  height: min(100cqh, calc(100cqw / var(--ar)));
  max-width: 100%; max-height: 100%;
  border-radius: 8px; background: var(--surface-container);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .18), 0 4px 12px rgba(0, 0, 0, .08);
  cursor: crosshair; touch-action: manipulation;
}
#preview[data-size="SQUARE"] { --ar: 1; }
.note { margin: 0; font-size: .875rem; color: var(--on-surface-variant); text-align: center; flex: none; max-width: 100%; }
.panel {
  min-height: 0; min-width: 0;
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto;
  padding: 0 1rem .5rem;
  max-height: 52dvh;
}
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--outline-variant); }
.tab {
  flex: 1 1 0; min-width: 0; min-height: var(--tap); padding: .25rem .5rem;
  border: 0; border-bottom: 3px solid transparent; background: transparent; cursor: pointer;
  color: var(--on-surface-variant); font-weight: 700; font-size: .875rem; line-height: 1.15; overflow-wrap: anywhere;
}
.tab[aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); }
.panes { min-height: 0; overflow: auto; padding: .25rem 0; overscroll-behavior: contain; }
.pane { min-height: 0; }
.photo-btns { justify-content: stretch; margin-top: .5rem; }
.photo-btns .btn { flex: 1 1 8rem; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.actions { display: flex; gap: .5rem; padding-top: .5rem; }
.actions .btn { flex: 1 1 0; min-width: 0; }
.panel > .note { padding-top: .25rem; }

@media (min-width: 900px) {
  .maker { grid-template-columns: minmax(0, 1fr) minmax(22rem, 28rem); grid-template-rows: minmax(0, 1fr); }
  .panel { max-height: none; padding-top: .5rem; }
}

/* ---- settings ---- */
.settings { max-width: 36rem; width: 100%; justify-self: center; }
.settings > .btn { margin: .5rem 0; }
.settings #close-settings { display: flex; margin-block: 1rem 0; margin-inline-start: auto; }
.links { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; margin: .5rem 0; }
.links a { display: inline-flex; align-items: center; min-height: var(--tap); }
.noscript { padding: 1rem; }
html[dir="rtl"] .nxm, html[dir="rtl"] .nxm-set { text-align: right; }
.nxm-b, .nxm-btns + .nxm-a { min-height: var(--tap); }

/* ---- motion: a short fade when a screen opens; nothing moves (Reduce Motion gets the same fade) ---- */
.screen:not([hidden]), .maker:not([hidden]) { animation: vendo-fade .18s ease-out; }
@keyframes vendo-fade { from { opacity: 0; } to { opacity: 1; } }
.btn, .chip, .choice, .tab { transition: background-color .15s ease, color .15s ease, border-color .15s ease; }
@media (prefers-reduced-motion: reduce) {
  .btn, .chip, .choice, .tab { transition: none; }
}

/* Start failure (review P2-300): at the top of the page, above everything, never over content. */
.start-error { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; padding: 16px; margin: 16px; border: 1.5px solid var(--outline); border-radius: 12px; background: var(--surface); color: var(--on-surface); }
.start-error p { margin: 0; }
