:root {
  color-scheme: light;
  --background: #f2f2f7;
  --surface: #ffffff;
  --secondary-surface: #f8f8fa;
  --text: #000000;
  --secondary-text: #8e8e93;
  --separator: rgba(60, 60, 67, .18);
  --accent: #007aff;
  --danger: #ff3b30;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; background: var(--background); }
body { min-width: 320px; min-height: 100dvh; margin: 0; padding-bottom: calc(96px + env(safe-area-inset-bottom)); color: var(--text); background: var(--background); }
button, input, textarea { font: inherit; }
button { color: inherit; -webkit-tap-highlight-color: transparent; }
button:active:not(:disabled) { transform: scale(.97); }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent); outline-offset: 2px; }
[hidden] { display: none !important; }

.topbar { width: min(100%, 720px); margin: 0 auto; padding: calc(20px + env(safe-area-inset-top)) 20px 18px; display: flex; align-items: center; justify-content: space-between; }
.topbar-title h1 { margin: 0; font-size: 34px; font-weight: 700; line-height: 1.1; }
.topbar-title span { display: block; margin-top: 5px; color: var(--secondary-text); font-size: 14px; }
.topbar-actions { display: flex; align-items: center; gap: 4px; }
.topbar-link { min-height: 44px; padding: 0 8px; border: 0; color: var(--accent); background: transparent; font-size: 14px; font-weight: 600; cursor: pointer; }
.topbar-link span { min-width: 22px; height: 22px; margin-left: 3px; padding: 0 5px; display: inline-grid; place-items: center; border-radius: 11px; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); font-size: 12px; }
.icon-button { width: 44px; height: 44px; flex: 0 0 44px; display: inline-grid; place-items: center; border: 0; border-radius: 50%; color: var(--accent); background: transparent; cursor: pointer; transition: transform .15s ease-out, background .15s ease-out; }
.icon-button:hover { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.icon-button svg { width: 23px; height: 23px; }

main { width: min(100% - 32px, 680px); margin: 0 auto; }
.stepper { min-height: 42px; margin: 5px 0 22px; padding: 3px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; border-radius: 10px; background: #e3e3e8; }
.step-tab { min-height: 36px; padding: 0 8px; border: 0; border-radius: 8px; color: #636366; background: transparent; font-size: 14px; font-weight: 600; cursor: pointer; transition: background .2s ease-out, color .2s ease-out; }
.step-tab.is-active { color: var(--text); background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.step-panel { min-height: 250px; animation: step-in .25s ease-out; }
@keyframes step-in { from { opacity: .7; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.section-heading { min-height: 57px; margin: 0 4px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-heading h2 { margin: 3px 0 0; font-size: 22px; font-weight: 700; }
.eyebrow { margin: 0; color: var(--secondary-text); font-size: 11px; font-weight: 700; }
.subtle { color: var(--secondary-text); font-size: 14px; }
.photo-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.photo-item { min-width: 0; overflow: hidden; border-radius: 14px; background: var(--surface); }
.photo-frame { position: relative; aspect-ratio: 4 / 5; overflow: hidden; background: var(--secondary-surface); }
.photo-frame img { width: 100%; height: 100%; display: block; object-fit: cover; }
.photo-delete { position: absolute; top: 8px; right: 8px; width: 44px; height: 44px; border: 0; border-radius: 50%; color: white; background: rgba(0, 0, 0, .58); font-size: 24px; cursor: pointer; }
.photo-state { position: absolute; right: 8px; bottom: 8px; left: 8px; padding: 7px 8px; border-radius: 8px; color: white; background: rgba(0, 0, 0, .65); font-size: 12px; text-align: center; }
.photo-tools { min-height: 48px; padding: 3px 6px; display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.photo-tools button { min-width: 44px; min-height: 44px; padding: 0 8px; border: 0; border-radius: 8px; color: var(--accent); background: transparent; font-size: 13px; font-weight: 600; cursor: pointer; }
.photo-tools button:disabled { color: var(--secondary-text); }
.photo-empty { min-height: 190px; margin: 0 0 12px; padding: 28px 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; border-radius: 14px; background: var(--surface); text-align: center; }
.photo-empty svg { width: 43px; height: 43px; margin-bottom: 3px; color: var(--accent); }
.photo-empty strong { font-size: 17px; }
.photo-empty span { max-width: 310px; color: var(--secondary-text); font-size: 14px; line-height: 1.45; }
.action-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.button { min-height: 50px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; border: 0; border-radius: 14px; font-size: 16px; font-weight: 650; cursor: pointer; transition: transform .15s ease-out, background .15s ease-out, opacity .15s ease-out; }
.button svg { width: 21px; height: 21px; flex: 0 0 21px; }
.button-primary { color: white; background: var(--accent); }
.button-primary:disabled { opacity: .42; cursor: default; }
.button-secondary { color: var(--accent); background: var(--surface); }
.inline-status { min-height: 20px; margin: 10px 4px 0; color: var(--secondary-text); font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.update-banner { width: min(100% - 32px, 680px); min-height: 48px; margin: 0 auto 12px; padding: 10px 14px; display: block; border: 1px solid color-mix(in srgb, var(--accent) 24%, transparent); border-radius: 10px; color: var(--accent); background: color-mix(in srgb, var(--accent) 11%, var(--surface)); font-size: 14px; font-weight: 650; line-height: 1.4; text-align: left; cursor: pointer; }

.quick-entry { width: 100%; min-height: 150px; padding: 17px; border: 0; border-radius: 14px; color: var(--text); background: var(--surface); font-size: 18px; line-height: 1.5; resize: vertical; }
.quick-entry::placeholder, input::placeholder, textarea::placeholder { color: #a1a1a6; }
.hint, .privacy-warning { margin: 12px 5px; color: var(--secondary-text); font-size: 14px; line-height: 1.5; }
.privacy-warning { padding-top: 13px; border-top: .5px solid var(--separator); }
.result-photos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 8px; }
.demo-badge { width: fit-content; min-height: 28px; margin: 0 0 10px 4px; padding: 5px 10px; display: inline-flex; align-items: center; border-radius: 14px; color: #8a5b00; background: #fff1c2; font-size: 12px; font-weight: 650; }
.result-photo { position: relative; aspect-ratio: 4 / 5; overflow: hidden; border-radius: 10px; background: var(--secondary-surface); }
.result-photo img { width: 100%; height: 100%; display: block; object-fit: cover; }
.result-photo button { position: absolute; right: 4px; bottom: 4px; min-width: 44px; min-height: 44px; border: 0; border-radius: 9px; color: white; background: rgba(0, 0, 0, .62); font-size: 12px; cursor: pointer; }
.field-label { min-height: 37px; margin: 14px 4px 0; display: flex; align-items: center; justify-content: space-between; color: var(--secondary-text); font-size: 13px; }
.field-label span { font-variant-numeric: tabular-nums; }
.editable-row { min-height: 58px; padding: 3px 6px 3px 15px; display: flex; align-items: center; gap: 4px; border-radius: 14px; background: var(--surface); }
.editable-row input, .editable-row textarea { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 16px; }
.editable-row textarea { min-height: 250px; padding: 13px 0; line-height: 1.55; resize: vertical; }
.editable-row:focus-within { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); }
.editable-description { align-items: flex-start; }
.copy-one { margin: 3px; }
.save-all { width: 100%; margin-top: 14px; }
.save-all:disabled { opacity: .42; }
.share-vinted, .copy-hashtags { width: 100%; margin-top: 10px; }
.draft-empty { padding: 22px 8px; color: var(--secondary-text); text-align: center; }
.draft-item { padding: 14px 0; border-bottom: .5px solid var(--separator); }
.draft-item:first-child { padding-top: 4px; }
.draft-item h3 { margin: 0; font-size: 16px; line-height: 1.4; overflow-wrap: anywhere; }
.draft-date { margin: 5px 0 11px; color: var(--secondary-text); font-size: 12px; }
.draft-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.draft-actions .button { min-height: 44px; padding: 0 9px; font-size: 13px; }
.draft-actions .draft-copy-button { min-height: 44px; border: 0; border-radius: 10px; color: var(--accent); background: var(--secondary-surface); font-size: 12px; font-weight: 600; cursor: pointer; }
.draft-actions .draft-link-button { min-height: 44px; grid-column: 1 / -1; border: 0; color: var(--accent); background: transparent; font-size: 14px; font-weight: 600; cursor: pointer; }
.drafts-sheet { z-index: 13; }
.cloud-status { margin-top: 2px; }
.cloud-refresh { width: 100%; margin: 0 0 12px; }

.bottom-bar { position: fixed; z-index: 5; right: 0; bottom: 0; left: 0; min-height: calc(76px + env(safe-area-inset-bottom)); padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); display: flex; gap: 10px; background: color-mix(in srgb, var(--background) 82%, transparent); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.bottom-bar .button { width: 100%; }
.bottom-bar .new-article { width: 42%; }
.bottom-bar .next-button { flex: 1; }

.sheet-backdrop { position: fixed; z-index: 10; inset: 0; background: rgba(0, 0, 0, .32); }
.settings-sheet { position: fixed; z-index: 11; right: 0; bottom: 0; left: 0; max-height: min(88dvh, 820px); padding: 8px 20px calc(20px + env(safe-area-inset-bottom)); overflow-y: auto; border-radius: 22px 22px 0 0; background: var(--background); transform: translateY(105%); transition: transform .25s ease-out; }
.settings-sheet.is-open { transform: translateY(0); }
.sheet-grab { width: 36px; height: 5px; margin: 0 auto 12px; border-radius: 4px; background: var(--secondary-text); opacity: .45; }
.sheet-heading { min-height: 48px; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; }
.sheet-heading h2 { margin: 0; font-size: 22px; }
.settings-input, .prompt-input { width: 100%; min-height: 50px; padding: 12px; border: 0; border-radius: 12px; color: var(--text); background: var(--surface); font-size: 16px; }
.settings-key-row { display: grid; gap: 8px; }
.settings-key-row .button { width: 100%; min-height: 50px; padding: 0 12px; font-size: 14px; }
.sync-qr-panel { margin-top: 12px; padding: 16px; border-radius: 12px; background: var(--surface); text-align: center; }
.sync-qr-panel svg { width: min(100%, 260px); height: auto; display: block; margin: 0 auto; image-rendering: pixelated; }
.sync-qr-panel .security-note { margin: 10px 0 0; }
.sync-qr-toggle { width: 100%; margin-top: 10px; }
.security-note { margin: 9px 4px 18px; color: var(--secondary-text); font-size: 13px; line-height: 1.45; }
.security-note code { color: var(--text); }
.biometric-settings { margin-top: 20px; padding-top: 16px; border-top: .5px solid var(--separator); }
.biometric-settings h3 { margin: 0 4px; font-size: 16px; }
.biometric-settings .button { width: 100%; margin-top: 8px; }
.biometric-lock { position: fixed; z-index: 20; inset: 0; padding: 24px; display: grid; place-items: center; background: var(--background); text-align: center; }
.biometric-lock > div { width: min(100%, 360px); }
.biometric-lock h2 { margin: 0 0 10px; font-size: 24px; }
.biometric-lock p { color: var(--secondary-text); line-height: 1.5; }
.biometric-lock .button { width: 100%; margin-top: 12px; }
body.is-locked { overflow: hidden; }
.prompt-label { margin-top: 6px; }
.prompt-input { min-height: 185px; line-height: 1.45; resize: vertical; }
.reset-prompt { width: 100%; margin-top: 10px; }
.settings-save { width: 100%; margin-top: 18px; }

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

@media (min-width: 700px) {
  .topbar { padding-top: 28px; }
  .stepper { margin-top: 10px; }
  .photo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (prefers-color-scheme: dark) {
  :root { color-scheme: dark; --background: #000000; --surface: #1c1c1e; --secondary-surface: #2c2c2e; --text: #ffffff; --secondary-text: #8e8e93; --separator: rgba(84, 84, 88, .65); --accent: #0a84ff; }
  .stepper { background: #2c2c2e; }
  .step-tab { color: #c7c7cc; }
  .step-tab.is-active { color: white; }
  .photo-tools button:disabled { color: #8e8e93; }
  .settings-sheet { background: #1c1c1e; }
}

@media (max-width: 380px) {
  .topbar { padding-right: 12px; padding-left: 16px; }
  .topbar-title h1 { font-size: 30px; }
  .topbar-title span { font-size: 12px; }
  .topbar-actions { gap: 0; }
  .topbar-link { padding: 0 4px; font-size: 13px; }
}