:root {
  --bg: #0e0f12; --panel: #181a1f; --panel-2: #22252c; --line: #2a2e36;
  --fg: #ececec; --muted: #8b8f99; --accent: #4dffc1; --accent-2: #ffc14d;
  --danger: #ff5d6c; --ok: #4dffc1;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.4 -apple-system, system-ui, sans-serif; }
header { display: flex; align-items: baseline; justify-content: space-between; padding: 18px 24px; border-bottom: 1px solid var(--line); }
header h1 { margin: 0; font-size: 18px; letter-spacing: 0.3px; }
.muted { color: var(--muted); font-size: 12px; }

/* ---------- shared top nav ---------- */
.topnav { display: flex; align-items: center; gap: 20px; padding: 14px 24px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: rgba(14,15,18,0.92); backdrop-filter: blur(8px); z-index: 60; }
.topnav .brand { font-weight: 700; font-size: 15px; color: var(--fg); text-decoration: none; letter-spacing: 0.3px; }
.topnav .brand:hover { color: var(--accent); }
.topnav-links { display: flex; gap: 4px; flex: 1; }
.topnav-links a { color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 500; padding: 6px 12px; border-radius: 6px; }
.topnav-links a:hover { color: var(--fg); background: var(--panel-2); }
.topnav-links a.active { color: var(--accent); background: var(--panel-2); }

/* ---------- landing ---------- */
.home { max-width: 980px; margin: 0 auto; padding: 48px 24px 64px; }
.home-hero { text-align: center; margin-bottom: 44px; }
.home-hero h1 { font-size: 32px; margin: 0 0 12px; letter-spacing: 0.5px; }
.home-hero p { color: var(--muted); font-size: 15px; max-width: 640px; margin: 0 auto; line-height: 1.6; }
.home-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.home-card { display: flex; flex-direction: column; gap: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 22px; text-decoration: none; color: var(--fg); transition: border-color 0.12s, transform 0.12s; }
.home-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.home-card-ico { font-size: 24px; color: var(--accent); }
.home-card h2 { margin: 0; font-size: 17px; }
.home-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; flex: 1; }
.home-card-go { color: var(--accent); font-size: 13px; font-weight: 600; margin-top: 4px; }

/* ---------- drops library ---------- */
.drop-section { margin-bottom: 28px; }
.drop-section h3 { font-size: 14px; color: var(--accent-2); text-transform: uppercase; letter-spacing: 0.5px; margin: 0 0 12px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.drop-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.drop-tile { margin: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.drop-tile img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: var(--panel-2); }
.drop-tile.logo img { object-fit: contain; padding: 18px; background: #1d2026; }
.drop-tile figcaption { padding: 8px 10px; font-size: 12px; color: var(--muted); text-align: center; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 20px; margin: 24px auto; max-width: 480px; }
.card h2 { margin: 0 0 12px; font-size: 16px; }
label { display: block; margin: 12px 0; }
label input { display: block; width: 100%; margin-top: 4px; padding: 8px 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; color: var(--fg); font: inherit; }
button { background: var(--panel-2); color: var(--fg); border: 1px solid var(--line); border-radius: 6px; padding: 8px 14px; cursor: pointer; font: inherit; }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: #001b14; border-color: var(--accent); font-weight: 600; }
button:disabled { opacity: 0.4; cursor: not-allowed; }
.msg { margin-top: 10px; font-size: 12px; }
.msg.error { color: var(--danger); }
.msg.ok { color: var(--ok); }

main { padding: 0 24px 40px; }
.steps { display: flex; gap: 8px; padding: 16px 0; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.steps button { background: transparent; border: 1px solid var(--line); }
.steps button.active { background: var(--panel-2); border-color: var(--accent); color: var(--accent); }

.step { display: none; }
.step.active { display: block; }

.bar { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; }
.bar input { flex: 1; padding: 8px 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; color: var(--fg); font: inherit; }
.bar select { padding: 8px 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; color: var(--fg); font: inherit; }
.product-card .badge.price { background: #1f3a2e; color: var(--accent); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.catalog-group { grid-column: 1 / -1; padding: 20px 4px 6px; font-size: 13px; font-weight: 600; color: var(--accent-2); text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--line); }
/* sticky selected-products tray */
#sel-tray { position: fixed; left: 50%; transform: translateX(-50%); bottom: 20px; z-index: 50; display: flex; align-items: center; gap: 14px; background: var(--panel-2); border: 1px solid var(--accent); border-radius: 999px; padding: 8px 8px 8px 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.55); }
#sel-tray #sel-tray-text { font-size: 13px; font-weight: 600; }
#sel-tray #sel-clear { background: transparent; border: none; color: var(--muted); font-size: 12px; padding: 6px 8px; }
#sel-tray #sel-clear:hover { color: var(--danger); }
#sel-tray #sel-next { background: var(--accent); color: #001b14; border: none; padding: 10px 18px; border-radius: 999px; font-weight: 700; }

.product-card { position: relative; background: var(--panel); border: 2px solid var(--line); border-radius: 8px; overflow: hidden; cursor: pointer; transition: all 0.12s; }
.product-card:hover { border-color: var(--accent-2); }
.product-card.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.product-card .sel-check { position: absolute; top: 8px; right: 8px; z-index: 2; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #001b14; font-size: 15px; font-weight: 800; display: none; align-items: center; justify-content: center; box-shadow: 0 2px 6px rgba(0,0,0,0.4); }
.product-card.selected .sel-check { display: flex; }
.product-card.selected img { opacity: 0.92; }
.product-card:not(.selected):hover .sel-check { display: flex; background: var(--panel); color: var(--muted); }
.product-card img { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--panel-2); display: block; }
.product-card .meta { padding: 8px 10px; }
.product-card .title { font-size: 12px; font-weight: 600; line-height: 1.3; }
.product-card .brand { font-size: 11px; color: var(--muted); margin-top: 2px; }
.product-card .badge { display: inline-block; margin-top: 4px; padding: 1px 6px; font-size: 10px; border-radius: 3px; background: var(--panel-2); color: var(--muted); }
.product-card .badge.wrap { background: #3a2a1a; color: var(--accent-2); }

.patterns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.pattern-slot { background: var(--panel); border: 2px dashed var(--line); border-radius: 8px; padding: 14px; text-align: center; min-height: 200px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.pattern-slot.filled { border-style: solid; border-color: var(--accent); }
.pattern-slot img { max-width: 100%; max-height: 140px; border-radius: 4px; }
.pattern-slot input[type=text] { margin-top: 8px; padding: 4px 8px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px; color: var(--fg); font: inherit; width: 100%; }
.pattern-slot button { margin-top: 6px; font-size: 11px; padding: 4px 8px; }
.pattern-slot .hint { color: var(--muted); font-size: 12px; }

.design-slot { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.design-slot.filled { border-color: var(--accent); }
.design-slot .label-row { margin-bottom: 12px; }
.design-slot .label-row input { width: 100%; padding: 8px 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 5px; color: var(--fg); font: inherit; font-weight: 600; }
.design-slot .upload-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.design-slot .upload-cell { background: var(--panel-2); border: 2px dashed var(--line); border-radius: 8px; padding: 12px; text-align: center; min-height: 160px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.design-slot .upload-cell.filled { border-style: solid; border-color: var(--accent); }
.design-slot .upload-cell img { max-width: 100%; max-height: 120px; border-radius: 4px; }
.design-slot .upload-cell .label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.design-slot .upload-cell .dim { font-size: 11px; color: var(--muted); margin-top: 4px; }
.design-slot .upload-cell .dim.warn { color: var(--accent-2); }
.design-slot .upload-cell .dim.bad { color: var(--danger); }
.design-slot .remove-design { margin-top: 12px; font-size: 11px; }

.design-instructions { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.design-instructions .instr-row { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.design-instructions label { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.design-instructions input, .design-instructions select, .design-instructions textarea {
  width: 100%; margin-top: 4px; padding: 8px 10px; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 5px; color: var(--fg); font: inherit; box-sizing: border-box;
}
.design-instructions textarea { resize: vertical; text-transform: none; }
.design-instructions .instr-hint { margin-top: 6px; font-size: 11px; }
@media (max-width: 560px) { .design-instructions .instr-row { grid-template-columns: 1fr; } }

.step-title { margin: 0 0 4px; font-size: 16px; }
.step-help { margin: 0 0 16px; color: var(--muted); font-size: 13px; }
.step-actions { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.step-actions .primary { font-size: 15px; padding: 12px 22px; }

.review-block { margin-bottom: 22px; }
.review-block h3 { margin: 0 0 10px; font-size: 13px; color: var(--accent-2); text-transform: uppercase; letter-spacing: 0.5px; }
.review-block h3.fail { color: var(--danger); }
.design-strip { display: flex; flex-wrap: wrap; gap: 12px; }
.design-chip { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px; width: 150px; }
.design-chip-imgs { position: relative; }
.design-chip-imgs img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 5px; background: var(--panel-2); display: block; }
/* logo overlays the pattern, object-fit:contain so it is NEVER distorted */
.design-chip-imgs img.logo { position: absolute; right: 6px; bottom: 6px; width: 46px; height: 46px; aspect-ratio: auto; object-fit: contain; background: rgba(0,0,0,0.35); border: 1px solid var(--line); border-radius: 5px; padding: 2px; }
.design-chip-label { margin-top: 8px; font-size: 12px; font-weight: 600; text-align: center; }
.review-total { background: var(--panel); border: 1px solid var(--accent); border-radius: 8px; padding: 14px 16px; font-size: 15px; }

.run-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 4px; }
.run-head.done { color: var(--ok); }
.run-head .fail { color: var(--danger); }
.run-timer { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--muted); }
.run-current { font-size: 12px; margin: 6px 0; }
.run-log { margin-top: 8px; }
.spinner { width: 13px; height: 13px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; display: inline-block; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

#wrap-prompts .wrap-prompt { background: var(--panel); border: 1px solid var(--accent-2); border-radius: 8px; padding: 12px 16px; margin: 8px 0; }
#wrap-prompts h4 { margin: 0 0 6px; font-size: 13px; color: var(--accent-2); }
#wrap-prompts .opts { display: flex; gap: 8px; margin-top: 8px; }

#progress { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin-bottom: 16px; }
.progress-bar { height: 6px; background: var(--panel-2); border-radius: 3px; overflow: hidden; margin: 8px 0; }
.progress-bar > div { height: 100%; background: var(--accent); transition: width 0.3s; }
.log-line { font-family: ui-monospace, monospace; font-size: 11px; padding: 2px 0; color: var(--muted); }
.log-line.ok { color: var(--ok); }
.log-line.fail { color: var(--danger); }

.drop-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.75); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px; }
.drop-modal-inner { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; width: 100%; max-width: 900px; max-height: 90vh; display: flex; flex-direction: column; overflow: hidden; }
.drop-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.drop-modal-head h2 { margin: 0; font-size: 16px; }
.drop-close { background: transparent; border: none; color: var(--muted); font-size: 24px; cursor: pointer; padding: 0 6px; line-height: 1; }
.drop-modal-body { overflow-y: auto; padding: 16px 20px 24px; }
.drop-group { margin-bottom: 24px; }
.drop-group h3 { margin: 0 0 10px; font-size: 13px; color: var(--accent-2); text-transform: uppercase; letter-spacing: 0.5px; }
.drop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.drop-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px; cursor: pointer; position: relative; transition: border-color 0.12s; }
.drop-card:hover { border-color: var(--accent); }
.drop-card img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 4px; background: #000; }
.drop-card.logo-card img { object-fit: contain; padding: 14px; background: #1d2026; }
.drop-card .drop-label { margin-top: 6px; font-size: 12px; }
.drop-card .lowres { display: inline-block; margin-left: 4px; padding: 1px 5px; font-size: 9px; border-radius: 3px; background: #3a2a1a; color: var(--accent-2); vertical-align: middle; }
.drop-card.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.drop-card .drop-check { position: absolute; top: 6px; right: 6px; z-index: 2; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #001b14; font-size: 13px; font-weight: 800; display: none; align-items: center; justify-content: center; box-shadow: 0 2px 6px rgba(0,0,0,0.4); }
.drop-card.selected .drop-check { display: flex; }
.drop-modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--line); }
.drop-modal-foot .primary { background: var(--accent); color: #001b14; border-color: var(--accent); font-weight: 700; }
.drop-card.loading { opacity: 0.6; pointer-events: none; }
.drop-card .loading-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.6); border-radius: 8px; font-size: 12px; color: var(--accent); }
