/* List It — mobile-first. Light only, deliberately: the Vinted app is light,
   and letting iOS auto-invert a half-themed page looks worse than committing. */
:root {
  color-scheme: light;

  --teal:        #14717D;   /* from the favicon */
  --teal-dark:   #0E5A64;
  --teal-bright: #1794A3;   /* dotted dropzone border */
  --teal-wash:   #E7F1F2;
  --cream:       #F6F1E4;   /* favicon only — page is white */

  --ink:         #1E2A2E;
  --ink-soft:    #4A5A60;
  --grey-bg:     #F4F5F6;
  --grey-text:   #8A9199;
  --border:      #E4E7E9;
  /* Input borders. Teal-tinted rather than the neutral --border, so a field
     reads as part of the brand instead of as browser chrome. */
  --teal-line:   #C3D9DC;

  --amber:       #B7791F;   /* caution: check this, upload notices */
  --amber-wash:  #FDF6E7;

  /* Error, as distinct from caution. Hue 7deg — the exact complement of the
     brand teal's 187deg — so it belongs to the palette rather than being a
     generic alert red. 6.1:1 on white. */
  --red:         #B43322;
  --red-wash:    #FCEFEE;

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --tap: 48px;              /* min tap target */
}

* { box-sizing: border-box; }

/* The UA stylesheet's [hidden] { display: none } is a plain element rule, so
   any class that sets display (e.g. .email-row's flex) silently outranks it and
   the element stays visible. This puts the attribute back in charge. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: #fff;
  color: var(--ink);
  font: 400 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  /* iOS paints a translucent grey box over anything tapped, on top of our own
     :active styles. Safe to remove only because every button here has one —
     .btn, .copy, .email-btn and .account-link all restyle on :active. */
  -webkit-tap-highlight-color: transparent;
}

/* Safari and iOS substitute their own font, metrics and chrome on form
   controls, and a shorthand like `font: 600 .85rem inherit` is silently
   invalid, so the UA's defaults win. Setting it once here means each control
   below only has to say what differs. */
button, input, textarea, select {
  font: inherit;
  color: inherit;
  appearance: none;
  -webkit-appearance: none;
}
/* `font: inherit` also brings the body's 1.5 line-height, which is right for
   prose and too tall inside a control — it pushes every button and field a few
   pixels past the 48px tap target they were sized around. Stated explicitly
   rather than left as the UA's `normal`, which differs between browsers. */
button, input, select { line-height: 1.2; }

/* ---------- header ---------- */
.topbar {
  background: #fff;
  color: var(--teal);
  padding: calc(env(safe-area-inset-top) + 22px) 20px 20px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.wordmark {
  font-family: "Baloo 2", "Trebuchet MS", system-ui, sans-serif;
  font-weight: 800;
  font-size: 2.5rem;
  line-height: 1;
  letter-spacing: -0.01em;
}
.wordmark-it { margin-left: .12em; }
.tagline { margin: 8px 0 0; font-size: .95rem; color: var(--ink-soft); }

/* ---------- account strip ---------- */
/* Sits above the wordmark rather than beside it: at 320px there isn't room for
   both an email address and a centred wordmark on one line. */
.account {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  min-height: 24px;                    /* reserved, so revealing it can't shift
                                          the wordmark down a few pixels */
  margin: -8px 0 6px;
  font-size: .82rem;
}
.account-info { display: flex; align-items: center; gap: 8px; min-width: 0; }
.account-email {
  color: var(--ink-soft);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* A text button, not a .btn — a 48px tap target here would dominate a header
   whose job is the wordmark. Padded out to stay comfortably tappable. */
.account-link {
  padding: 6px 2px;
  background: none; border: 0;
  color: var(--teal);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.account-link:active { color: var(--teal-dark); }
.allowance {
  margin: 8px 0 0;
  font-size: .82rem;
  color: var(--ink-soft);
}
.allowance.is-low { color: var(--amber); font-weight: 600; }

/* ---------- sign in ---------- */
.login-card { padding: 8px 0 24px; }
.login-card h2 { margin: 0 0 8px; font-size: 1.25rem; }
.login-lede { margin: 0 0 18px; color: var(--ink-soft); }
.login-note {
  margin: 18px 0 22px;
  color: var(--ink-soft);
  font-size: .86rem;
}
/* Quieter than .email-msg on purpose: this is a fallback for the minority who
   don't find the email, and styling it as loudly as the confirmation would
   make every successful sign-in look like it had a problem. */
.login-junk {
  margin: 8px 2px 0;
  font-size: .82rem; line-height: 1.45;
  color: var(--grey-text);
  word-break: break-word;
}

/* ---------- layout ---------- */
.wrap { max-width: 560px; margin: 0 auto; padding: 20px 16px 8px; }
.view { display: none; }
.view.is-active { display: block; }

/* ---------- dropzone ---------- */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 210px;
  padding: 28px 20px;
  background: var(--grey-bg);
  border: 2.5px dashed var(--teal-bright);
  border-radius: var(--r-lg);
  color: var(--grey-text);
  text-align: center;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s;
}
.dropzone:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; }
.dropzone.is-dragover {
  background: var(--teal-wash);
  border-color: var(--teal);
  transform: scale(1.01);
}
.dz-icon { width: 40px; height: 40px; color: var(--teal-bright); margin-bottom: 6px; }
.dz-title { font-size: 1.1rem; font-weight: 600; color: #6F767D; }
.dz-sub   { font-size: .92rem; }
.dz-hint  { font-size: .8rem; opacity: .8; margin-top: 6px; }

/* ---------- thumbnails ---------- */
.thumbs {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
}
.thumbs:empty { margin: 0; }
.thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--grey-bg);
  border: 1px solid var(--border);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-fallback {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%;
  font-size: .62rem; color: var(--grey-text);
  padding: 4px; text-align: center; word-break: break-all;
}
.thumb-x {
  position: absolute; top: 3px; right: 3px;
  width: 26px; height: 26px;
  border: none; border-radius: 50%;
  background: rgba(0,0,0,.6); color: #fff;
  font-size: 15px; line-height: 1;
  cursor: pointer;
}

/* ---------- buttons ---------- */
.btn {
  display: block; width: 100%;
  min-height: var(--tap);
  margin-top: 16px;
  padding: 14px 18px;
  border: none; border-radius: var(--r-md);
  font-size: 1.05rem; font-weight: 600;
  cursor: pointer;
  transition: background .15s, opacity .15s;
}
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:active { background: var(--teal-dark); }
.btn-primary:disabled { background: #C3CBCE; color: #F2F4F5; cursor: default; }
.btn-secondary {
  background: transparent; color: var(--teal);
  border: 2px solid var(--teal);
}
.btn-secondary:active { background: var(--teal-wash); }

.msg {
  margin: 12px 0 0; padding: 10px 12px;
  background: var(--amber-wash); color: var(--amber);
  border-radius: var(--r-sm); font-size: .9rem;
}
/* Amber is the caution colour — signing in or out is neither a warning nor a
   problem, so it gets the teal wash the other confirmations use. */
.msg.is-good { background: var(--teal-wash); color: var(--teal-dark); }

/* ---------- loading ---------- */
.loader-card { text-align: center; padding: 44px 20px; }
.loader-ring {
  width: 52px; height: 52px; margin: 0 auto 20px;
  border: 5px solid var(--teal-wash);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loader-title { margin: 0; font-size: 1.15rem; font-weight: 600; }
.loader-step  { margin: 6px 0 18px; color: var(--ink-soft); font-size: .95rem; min-height: 1.4em; }
.progress {
  height: 7px; background: var(--border);
  border-radius: 99px; overflow: hidden; max-width: 260px; margin: 0 auto;
}
.progress-bar {
  height: 100%; width: 0%;
  background: var(--teal);
  border-radius: 99px;
  transition: width .4s ease-out;
}
.loader-note { margin: 16px 0 0; font-size: .82rem; color: var(--grey-text); }

@media (prefers-reduced-motion: reduce) {
  .loader-ring { animation-duration: 2.4s; }
  .progress-bar, .dropzone { transition: none; }
}

/* ---------- results ---------- */
.results-head h2 { margin: 0 0 6px; font-size: 1.3rem; }
.results-head p  { margin: 0 0 18px; color: var(--ink-soft); font-size: .92rem; }

.photo-strip {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0;
  margin: 0 0 16px;
  padding: 4px 4px 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.photo-strip:empty { display: none; }
.shot {
  flex: 0 0 auto;
  width: 74px;
  height: 74px;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--grey-bg);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.18);
  transform: rotate(-1.2deg);
}
.shot + .shot { margin-left: -9px; }          /* the overlap */
.shot:nth-child(even) { transform: rotate(1.4deg); }
.shot img { width: 100%; height: 100%; object-fit: cover; display: block; }

.field {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px;
  margin-bottom: 10px;
}
.field-top {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 6px;
}
.field-label {
  font-size: .72rem; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
  color: var(--grey-text);
}
.flag {
  font-size: .64rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .03em;
  background: var(--amber-wash); color: var(--amber);
  padding: 2px 7px; border-radius: 99px;
  white-space: nowrap;
}
.flag-info { background: var(--teal-wash); color: var(--teal); }
.field-body { display: flex; align-items: flex-start; gap: 10px; }
.field-value {
  flex: 1; min-width: 0;
  font-size: 1rem; line-height: 1.45;
  white-space: pre-wrap; word-wrap: break-word;
}
.field-value.is-empty { color: var(--grey-text); font-style: italic; }
.field-value.is-price { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.crumb { color: var(--ink-soft); }
.crumb-sep { color: var(--grey-text); margin: 0 4px; }

.copy {
  flex: none;
  min-width: 74px; min-height: 40px;
  border: 1.5px solid var(--teal);
  border-radius: var(--r-sm);
  background: #fff; color: var(--teal);
  /* Not `font: 600 .85rem inherit` — `inherit` is only valid as a whole value,
     never as a component of a shorthand, so that form is dropped entirely and
     the button falls back to the UA's 13.3px/400. */
  font-size: .85rem; font-weight: 600;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.copy:active { background: var(--teal-wash); }
.copy.is-done { background: var(--teal); color: #fff; border-color: var(--teal); }
.copy:disabled { border-color: var(--border); color: var(--grey-text); cursor: default; }

/* ---------- limit screens / error ---------- */
.beaver-card { text-align: center; padding: 28px 20px 36px; }
.brandmark {
  width: 80px; height: 80px;
  margin: 0 auto 18px; display: block;
  border-radius: 18px;                 /* matches the rx in logo.svg */
  box-shadow: 0 8px 20px rgba(20, 113, 125, .20);
}
.beaver-card h2 {
  margin: 0 0 10px;
  font-size: 1.3rem; line-height: 1.25;
  text-wrap: balance;                  /* stops a lone word on the last line */
}
.beaver-card p  { margin: 0 auto; max-width: 34ch; color: var(--ink-soft); }
.error-emoji { font-size: 3rem; margin: 0 0 4px; }

/* ---------- footer ---------- */
.foot {
  max-width: 560px;
  margin: 24px auto 0;
  padding: 18px 20px calc(env(safe-area-inset-bottom) + 22px);
  text-align: center;
  color: var(--ink-soft);
  font-size: .82rem;
  border-top: 1px solid rgba(0,0,0,.07);
}
.foot p { margin: 0 0 4px; }
.foot-small { font-size: .76rem; color: var(--grey-text); }

@media (min-width: 600px) {
  .wordmark { font-size: 3rem; }
  .wrap { padding-top: 28px; }
}

/* Visually distinct per the two meanings: a personal limit is a good outcome
   (they used the whole allowance), a global cap is not (they got nothing). */
#limit-card.is-global h2 { color: var(--ink); }

/* ---------- email capture ---------- */

.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;
}

.email-capture {
  margin: 22px auto 0;
  max-width: 34ch;
  text-align: center;
}

.email-row { display: flex; gap: 8px; align-items: stretch; }

.email-input {
  flex: 1 1 auto; min-width: 0;
  min-height: var(--tap);
  padding: 12px 14px;
  /* font comes from the reset at the top; only the size differs, and it must
     not go below 16px or iOS zooms the page when the field takes focus. */
  font-size: 1rem;
  color: var(--ink);
  background: #fff;
  border: 2px solid var(--teal-line);
  border-radius: var(--r-md);
  text-align: left;
  /* Both shadows are named, because every state below has to repaint the ones
     it isn't changing — box-shadow replaces, it never adds. */
  --well: inset 0 1px 2px rgba(20, 113, 125, .07);
  --ring: 0 0 0 3px var(--teal-wash);
  /* A shallow well, echoing the dropzone above it. A flat white field on a
     white card reads as a gap rather than as something to type into. */
  box-shadow: var(--well);
  transition: border-color .15s, box-shadow .15s;
}
.email-input::placeholder { color: var(--grey-text); }
.email-input:focus {
  outline: none;
  border-color: var(--teal-bright);
  box-shadow: var(--well), var(--ring);
}
.email-input.is-invalid { border-color: var(--red); }

/* Autofill. Safari and Chrome paint their own background on a filled field and
   ignore `background` outright — an inset shadow the size of the box is the
   only thing that covers it.
 *
 * Three things here are easy to get wrong:
 *
 * - :hover and :active need saying too. With only the base state the field
 *   flips back to the browser's blue or yellow the instant a pointer touches
 *   it, which reads as the styling randomly failing.
 * - -webkit-box-shadow IS box-shadow, so this rule REPLACES the focus ring set
 *   above rather than adding to it — and being the more specific selector, it
 *   wins. The ring has to be repeated in the shadow list or an autofilled
 *   field quietly loses its focus state.
 * - the prefixed and unprefixed pseudo-classes are kept in separate rules on
 *   purpose. One selector list containing a pseudo-class the browser doesn't
 *   recognise is invalid *in its entirety*, so combining them would mean
 *   Firefox dropping the -webkit rules and older Safari dropping both. */
.email-input:-webkit-autofill,
.email-input:-webkit-autofill:hover,
.email-input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 100px #fff inset;
  -webkit-text-fill-color: var(--ink);
  caret-color: var(--ink);
}
.email-input:-webkit-autofill:focus {
  /* The 100px inset has to cover --well as well as the browser's own fill,
     so it replaces it rather than stacking with it. */
  -webkit-box-shadow: 0 0 0 100px #fff inset, var(--ring);
  -webkit-text-fill-color: var(--ink);
  caret-color: var(--ink);
}
/* Guarded rather than written bare. A selector a browser doesn't recognise is
   supposed to invalidate only its own rule, but that puts the rest of this
   file at the mercy of one parser's error recovery for no reason — @supports
   makes browsers without :autofill skip the block outright. */
@supports selector(:autofill) {
  .email-input:autofill,
  .email-input:autofill:hover,
  .email-input:autofill:active {
    box-shadow: 0 0 0 100px #fff inset;
    -webkit-text-fill-color: var(--ink);
    caret-color: var(--ink);
  }
  .email-input:autofill:focus {
    box-shadow: 0 0 0 100px #fff inset, var(--ring);
    -webkit-text-fill-color: var(--ink);
    caret-color: var(--ink);
  }
}

.email-btn {
  width: auto; flex: 0 0 auto;
  margin-top: 0;
  padding: 12px 16px;
  background: var(--teal); color: #fff;
  font-size: .98rem;
  white-space: nowrap;
}
.email-btn:active { background: var(--teal-dark); }
.email-btn:disabled { background: #C3CBCE; color: #F2F4F5; cursor: default; }

.email-note {
  margin: 8px 2px 0;
  font-size: .78rem; line-height: 1.45;
  color: var(--grey-text);
}

.email-msg {
  margin: 10px 0 0; padding: 10px 12px;
  border-radius: var(--r-sm);
  font-size: .88rem;
  background: var(--teal-wash); color: var(--teal-dark);
}
.email-msg.is-error { background: var(--red-wash); color: var(--red); }

/* On the success screen this must not compete with the copy buttons. */
.email-capture-quiet {
  text-align: left;
  margin-top: 28px;
  padding: 16px;
  background: var(--grey-bg);
  border-radius: var(--r-md);
  max-width: none;
}
.email-quiet-title {
  margin: 0 0 10px;
  font-weight: 600; font-size: .95rem; color: var(--ink);
}

@media (max-width: 360px) {
  /* Side-by-side leaves the input too narrow to read the address back. */
  .email-row { flex-wrap: wrap; }
  .email-btn { width: 100%; }
}

@media (max-height: 700px) {
  /* Short viewports (older phones, or Safari with its toolbars showing): trim
     the mark so the input and its purpose line stay above the fold. */
  .brandmark { width: 62px; height: 62px; margin-bottom: 12px; }
  .beaver-card { padding: 18px 20px 28px; }
}
