:root {
  color-scheme: light;
  font-family: "Segoe UI Variable", "Segoe UI", sans-serif;
  --ink: #1d1d1f;
  --muted: #6b6762;
  --paper: #f7f3ec;
  --surface: #fffdf9;
  --line: #ded7cc;
  --accent: #d43b2f;
  --accent-dark: #a92620;
  --soft: #eee7dc;
  --success: #166534;
  --danger: #a4261d;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(212, 59, 47, 0.09), transparent 28rem),
    var(--paper);
}

button, input { font: inherit; }

.shell { width: min(1040px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 56px; }

.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.topbar h1 { margin: 0; font-size: 1.15rem; letter-spacing: -0.02em; }
.eyebrow, .step { margin: 0 0 3px; color: var(--accent-dark); font-size: 0.76rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; color: white; background: var(--accent); border-radius: 12px 12px 12px 4px; font-weight: 800; }
.privacy-pill { margin-left: auto; padding: 8px 12px; color: var(--success); background: #e9f5ea; border: 1px solid #c9e2cc; border-radius: 999px; font-size: 0.82rem; font-weight: 650; }

.workspace { padding: clamp(24px, 5vw, 54px); background: rgba(255, 253, 249, 0.96); border: 1px solid var(--line); border-radius: 28px; box-shadow: 0 22px 70px rgba(49, 40, 29, 0.10); }
.intro { max-width: 730px; }
.intro h2 { margin: 8px 0 14px; font-family: Georgia, serif; font-size: clamp(2rem, 5vw, 3.75rem); font-weight: 500; line-height: 1.03; letter-spacing: -0.04em; }
.intro > p:last-child { margin: 0; color: var(--muted); font-size: 1.05rem; line-height: 1.65; }

.card-form { margin-top: 34px; }
.card-form label { display: block; margin-bottom: 9px; font-size: 0.88rem; font-weight: 700; }
.input-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
input[type="url"] { width: 100%; min-width: 0; padding: 15px 16px; color: var(--ink); background: white; border: 1px solid #cfc7bb; border-radius: 12px; outline: none; }
input[type="url"]:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(212, 59, 47, 0.14); }
button { padding: 14px 20px; color: white; background: var(--ink); border: 0; border-radius: 12px; cursor: pointer; font-weight: 700; transition: transform 120ms ease, background 120ms ease; }
button:hover:not(:disabled) { transform: translateY(-1px); background: #343437; }
button:focus-visible { outline: 3px solid rgba(212, 59, 47, 0.38); outline-offset: 2px; }
button:disabled { cursor: wait; opacity: 0.58; }

.status { margin: 18px 0 0; padding: 13px 15px; color: var(--muted); background: var(--soft); border-radius: 10px; font-size: 0.9rem; }
.status.success { color: var(--success); background: #edf7ed; }
.status.warning { color: #854d0e; background: #fff7dd; }
.status.error { color: var(--danger); background: #fff0ee; }

.result { margin-top: 28px; padding-top: 28px; border-top: 1px solid var(--line); }
.result-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.result h3 { margin: 4px 0 6px; font-size: clamp(1.25rem, 3vw, 1.7rem); }
.muted { margin: 0; color: var(--muted); }
.download-button { flex: 0 0 auto; background: var(--accent); }
.download-button:hover:not(:disabled) { background: var(--accent-dark); }

.export-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 24px 0 0; padding: 20px; background: #faf6ef; border: 1px solid var(--line); border-radius: 16px; }
.export-options legend { padding: 0 8px; font-weight: 750; }
.options-help { grid-column: 1 / -1; margin: -2px 0 4px; color: var(--muted); font-size: 0.86rem; }
.option-row { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: center; padding: 11px 12px; background: white; border: 1px solid var(--line); border-radius: 11px; cursor: pointer; }
.option-row:has(input:checked) { border-color: rgba(212, 59, 47, 0.55); box-shadow: inset 0 0 0 1px rgba(212, 59, 47, 0.16); }
.option-row:has(input:disabled) { cursor: not-allowed; opacity: 0.48; }
.option-row input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.option-row span { font-weight: 650; }
.option-row small { grid-column: 2; color: var(--muted); }

.progress-wrap { margin: 24px 0 6px; }
.progress-label { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; color: var(--muted); font-size: 0.86rem; }
progress { width: 100%; height: 9px; overflow: hidden; border: 0; border-radius: 999px; }
progress::-webkit-progress-bar { background: var(--soft); }
progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; margin-top: 22px; }
.photo { position: relative; aspect-ratio: 3 / 4; overflow: hidden; background: var(--soft); border: 1px solid var(--line); border-radius: 14px; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo span { position: absolute; right: 8px; bottom: 8px; min-width: 28px; padding: 5px 7px; color: white; background: rgba(29, 29, 31, 0.75); border-radius: 8px; text-align: center; font-size: 0.75rem; font-weight: 700; }
.preview-note { margin: 12px 0 0; color: var(--muted); font-size: 0.86rem; }

.notice { display: grid; grid-template-columns: auto 1fr; gap: 12px; margin-top: 30px; padding: 16px 18px; color: #625b52; background: #f2ede5; border-left: 4px solid #c8b8a3; border-radius: 8px 12px 12px 8px; font-size: 0.88rem; line-height: 1.5; }
.lan-test-notice { margin-top: 12px; color: #854d0e; background: #fff7dd; border-left-color: #d69e2e; }

.download-dialog { width: min(520px, calc(100% - 32px)); padding: 0; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 24px 70px rgba(27, 27, 29, 0.28); }
.download-dialog::backdrop { background: rgba(27, 27, 29, 0.55); }
.download-dialog form { padding: 26px; }
.download-dialog h2 { margin: 6px 0 12px; font-size: 1.45rem; }
.download-dialog p:not(.step) { color: var(--muted); line-height: 1.55; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.secondary-button { color: var(--ink); background: #e9e3d9; }
.secondary-button:hover:not(:disabled) { background: #ddd4c6; }

@media (max-width: 680px) {
  .shell { width: min(100% - 20px, 1040px); padding-top: 12px; }
  .topbar { margin-bottom: 12px; }
  .privacy-pill { font-size: 0; padding: 8px; }
  .privacy-pill::after { content: "Без хранения"; font-size: 0.76rem; }
  .workspace { padding: 22px 16px; border-radius: 20px; }
  .input-row { grid-template-columns: 1fr; }
  .result-heading { align-items: stretch; flex-direction: column; }
  .download-button { width: 100%; }
  .export-options { grid-template-columns: 1fr; padding: 16px; }
  .gallery { grid-template-columns: repeat(3, 1fr); gap: 7px; }
  .notice { grid-template-columns: 1fr; }
  .dialog-actions { align-items: stretch; flex-direction: column-reverse; }
}

/* D-092: one-card selection workspace. Existing download/security flow is unchanged. */
[hidden] { display: none !important; }
html { scroll-padding-bottom: 260px; }
:root { --muted: #645f59; }
body { background: #f5f2ed; }
.shell { width: min(1120px, calc(100% - 48px)); padding-top: 24px; }
.topbar { margin-bottom: 24px; }
.topbar h1 { font-size: 1.3rem; }
.brand-caption { margin: 3px 0 0; color: var(--muted); font-size: .8rem; }
.market-label { margin-left: auto; padding: 8px 12px; border: 1px solid var(--line); border-radius: 24px; font-size: .8rem; }
.workspace { padding: clamp(20px, 4vw, 40px); border-radius: 22px; background: var(--surface); box-shadow: 0 8px 32px #31281d08; }
.intro h2 { font-family: inherit; font-size: clamp(1.65rem, 3vw, 2.5rem); font-weight: 750; line-height: 1.15; letter-spacing: -.035em; }
.intro > p:last-child { max-width: 640px; font-size: .95rem; line-height: 1.6; }
.result { margin-top: 24px; padding-top: 26px; padding-bottom: 240px; }
.result-heading > div { min-width: 0; }
.result #product-title { font-size: clamp(1.25rem, 2vw, 1.65rem); line-height: 1.35; overflow-wrap: anywhere; margin: 4px 0 8px; }
.result-heading > button { flex-shrink: 0; }
.export-options { padding: 18px; background: #f6f3ee; gap: 12px; margin-top: 28px; }
.option-row { min-height: 66px; padding: 13px; }
.option-row span { font-size: .93rem; overflow-wrap: anywhere; }
.option-row small { line-height: 1.4; }
.option-row:has(input:disabled) { opacity: .7; }
.option-row input, .photo input { width: 22px; height: 22px; accent-color: var(--accent-dark); }
.option-row:has(input:focus-visible), .photo:has(input:focus-visible) { outline: 3px solid var(--accent-dark); outline-offset: 3px; }
.gallery-heading { display: flex; justify-content: space-between; flex-wrap: wrap; align-items: baseline; gap: 8px; margin-top: 28px; }
.gallery-heading h3 { font-size: 1rem; margin: 0; }
.gallery-heading p { font-size: .85rem; }
.gallery { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; margin-top: 16px; }
.photo { aspect-ratio: 1; background: #fff; border: 2px solid var(--line); cursor: pointer; border-radius: 14px; }
.photo img { object-fit: contain; padding: 12px; }
.photo:has(input:checked) { border-color: var(--accent); }
.photo:has(input:disabled) { cursor: wait; }
.photo input { position: absolute; top: 10px; left: 10px; z-index: 1; margin: 0; cursor: inherit; }
.photo span { bottom: 8px; right: 8px; background: #fff; color: var(--ink); border: 1px solid var(--line); }
.photo-fallback { display: none; position: absolute; inset: 40% 8px auto; text-align: center; color: var(--muted); }
.photo.preview-failed .photo-fallback { display: block; }
.download-panel { position: fixed; inset: auto 0 0; z-index: 5; background: #fffdf9; border-top: 1px solid var(--line); box-shadow: 0 -8px 30px #31281d0b; }
.download-panel-inner { width: min(1040px, calc(100% - 48px)); margin: auto; padding: 14px 0 max(16px, env(safe-area-inset-bottom)); }
.download-actions { display: flex; gap: 16px; justify-content: space-between; align-items: center; }
.download-actions > div { min-width: 0; }
.download-actions strong { font-size: .95rem; }
.download-hint { margin: 4px 0 0; font-size: .78rem; color: var(--muted); }
.download-button { min-width: 180px; min-height: 48px; }
.download-status { padding: 0 0 10px; font-size: .87rem; line-height: 1.4; max-height: 72px; overflow-y: auto; overflow-wrap: anywhere; }
.download-status.error { color: var(--danger); }
.download-status.warning { color: #805006; }
.download-status.success { color: var(--success); }
.progress-wrap { margin: 0 0 12px; }
.progress-label { margin-bottom: 6px; color: var(--ink); font-size: .84rem; }
progress { display: block; height: 8px; }
progress:not([value]) { animation: breathe 1.5s ease-in-out infinite alternate; }
button { min-height: 44px; }
button:disabled { cursor: not-allowed; }
.download-panel[data-busy="true"] button { cursor: wait; }
.download-dialog { max-height: calc(100dvh - 32px); overflow-y: auto; }
.selection-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 28px; align-items: start; margin-top: 28px; }
.selection-layout .export-options { grid-template-columns: 1fr; margin-top: 0; }
.selection-layout .gallery-heading { margin-top: 0; }
.photos-section { min-width: 0; }
.task-entry .result { border-top: 0; margin-top: 0; padding-top: 0; }
@media (max-width: 900px) { .selection-layout { grid-template-columns: 1fr; } }
@keyframes breathe { from { opacity: .45; } to { opacity: 1; } }
@media (max-width: 680px) {
  .shell { width: calc(100% - 24px); padding-top: 16px; }
  .workspace { padding: 22px 16px; border-radius: 18px; }
  .market-label { padding: 7px 9px; font-size: .7rem; }
  .brand-caption { max-width: 155px; font-size: .73rem; }
  .brand-mark { flex-shrink: 0; width: 36px; height: 36px; }
  .topbar { gap: 8px; margin-bottom: 18px; }
  .result-heading { gap: 14px; }
  .result-heading > button { align-self: flex-start; padding: 10px 16px; }
  .export-options { padding: 14px; grid-template-columns: 1fr; }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .download-panel-inner { width: calc(100% - 32px); padding-top: 12px; }
  .download-actions { flex-direction: column; align-items: stretch; gap: 10px; }
  .download-hint { display: none; }
  .download-actions strong { font-size: .88rem; }
  .download-button { width: 100%; min-width: 0; padding: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
