* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; font-family: -apple-system, "PingFang SC", "Helvetica Neue", sans-serif; background: #f5f5f5; }

.screen { position: fixed; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; }
.screen.active { display: flex; }

/* Swipe screen layout */
#screenSwipe { padding-bottom: 116px; }
.swipe-header { text-align: center; margin-bottom: 10px; padding: 8px 20px; }
.swipe-instruction { font-size: 14px; color: #333; background: linear-gradient(135deg, #f0fdf4, #ecfdf5); border: 1px solid #bbf7d0; border-radius: 20px; padding: 8px 16px; display: inline-block; font-weight: 500; }

.card-stack { position: relative; width: 88vw; height: 58vh; max-width: 380px; }
.card { position: absolute; inset: 0; border-radius: 16px; overflow: hidden; background: #fff; box-shadow: 0 4px 20px rgba(0,0,0,.12); transition: transform 0.3s ease, opacity 0.3s ease; will-change: transform; touch-action: none; }
.card img { width: 100%; height: 100%; object-fit: cover; image-orientation: from-image; }
.card .card-label { position: absolute; bottom: 0; left: 0; right: 0; padding: 10px 14px; background: linear-gradient(transparent, rgba(0,0,0,.6)); color: #fff; font-size: 12px; }
.card .card-brand { position: absolute; top: 10px; right: 10px; background: rgba(255,255,255,.75); color: #333; font-size: 10px; padding: 3px 8px; border-radius: 4px; backdrop-filter: blur(2px); }
.card.swiping-left { transform: translateX(-120%) rotate(-15deg); opacity: 0; }
.card.swiping-right { transform: translateX(120%) rotate(15deg); opacity: 0; }
.card .stamp { position: absolute; top: 40px; padding: 8px 16px; border: 3px solid; border-radius: 8px; font-size: 22px; font-weight: bold; opacity: 0; transition: opacity 0.2s; }
.card .stamp-like { right: 20px; color: #07c160; border-color: #07c160; transform: rotate(15deg); }
.card .stamp-nope { left: 20px; color: #ff4d4f; border-color: #ff4d4f; transform: rotate(-15deg); }

/* Swipe effects */
.swipe-flash { position: fixed; inset: 0; pointer-events: none; z-index: 999; animation: flash 0.4s ease-out forwards; }
.swipe-flash.like { background: radial-gradient(circle at center, rgba(7,193,96,.25), transparent 70%); }
.swipe-flash.nope { background: radial-gradient(circle at center, rgba(255,77,79,.15), transparent 70%); }
@keyframes flash { 0% { opacity: 1; } 100% { opacity: 0; } }

.confetti { position: fixed; width: 8px; height: 8px; border-radius: 50%; pointer-events: none; z-index: 998; animation: confettiFall 0.8s ease-out forwards; }
@keyframes confettiFall { 0% { opacity: 1; transform: translateY(0) scale(1); } 100% { opacity: 0; transform: translateY(60px) scale(0.3); } }

.progress-bar { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.progress-dots { display: flex; gap: 4px; }
.progress-dots .dot { width: 6px; height: 6px; border-radius: 50%; background: #ddd; }
.progress-dots .dot.liked { background: #07c160; }
.progress-dots .dot.disliked { background: #ff4d4f; }
.skip-link { font-size: 12px; color: #07c160; cursor: pointer; white-space: nowrap; }

/* Fixed bottom QR bar - large centered QR + right text */
.fixed-qr-bar { position: fixed; bottom: 0; left: 0; right: 0; height: 110px; background: #fff; border-top: 1px solid #eee; display: flex; align-items: center; padding: 10px 16px; gap: 14px; z-index: 100; box-shadow: 0 -2px 10px rgba(0,0,0,.05); }
.qr-mini { width: 88px; height: 88px; flex-shrink: 0; }
.qr-mini img { width: 100%; height: 100%; object-fit: contain; border-radius: 4px; }
.qr-bar-text { display: flex; flex-direction: column; }
.qr-bar-main { font-size: 16px; font-weight: bold; color: #333; }
.qr-bar-sub { font-size: 12px; color: #666; margin-top: 4px; line-height: 1.4; }

/* Result page */
#screenResult { background: #fff; padding: 0; overflow-y: auto; }
.result-content { max-width: 100%; width: 100%; }
.result-loading { padding: 60px 0; text-align: center; }
.spinner { width: 36px; height: 36px; border: 3px solid #eee; border-top-color: #333; border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

.result-hero { position: relative; width: 100%; height: 50vh; overflow: hidden; }
.result-hero-img { width: 100%; height: 100%; object-fit: cover; }
.result-hero-overlay { position: absolute; bottom: 0; left: 0; right: 0; padding: 36px 20px 14px; background: linear-gradient(transparent, rgba(0,0,0,.75)); }
.result-title { font-size: 24px; color: #fff; margin-bottom: 3px; }
.result-subtitle { font-size: 12px; color: rgba(255,255,255,.8); }

.result-info { padding: 16px 20px 0; }
.result-desc { font-size: 14px; line-height: 1.6; color: #444; margin-bottom: 10px; }
.result-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.result-tags span { background: #f0f0f0; padding: 4px 10px; border-radius: 14px; font-size: 11px; color: #555; }

.result-price { margin: 0 20px; padding: 10px 14px; background: #fff; border-radius: 8px; border-left: 3px solid #e8740e; }
.price-main { font-size: 13px; color: #333; }
.price-main strong { color: #e8740e; font-size: 15px; }
.price-sub { font-size: 11px; color: #999; margin-top: 2px; }

.result-dual { display: flex; gap: 10px; margin: 16px 20px 0; }
.dual-left { flex: 1; background: #f9f9f9; border-radius: 12px; padding: 14px; text-align: center; }
.qr-label { font-size: 12px; font-weight: bold; color: #333; margin-bottom: 8px; }
.qr-img { width: 110px; height: 110px; border-radius: 6px; }
.dual-right { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.btn-upload-big { background: linear-gradient(135deg, #667eea, #764ba2); color: #fff; border: none; border-radius: 12px; padding: 18px 14px; font-size: 14px; line-height: 1.5; cursor: pointer; width: 100%; box-shadow: 0 4px 12px rgba(102,126,234,.3); animation: pulse 2s infinite; text-align: center; }
.btn-upload-big span { font-size: 13px; }
@keyframes pulse { 0%,100% { box-shadow: 0 4px 12px rgba(102,126,234,.3); } 50% { box-shadow: 0 4px 20px rgba(102,126,234,.6); } }

.result-hook { margin: 14px 20px; padding: 14px 16px; background: linear-gradient(135deg, #fff7ed, #fffbeb); border-radius: 10px; border: 2px solid #f59e0b; }
.hook-title { font-size: 15px; font-weight: bold; color: #d97706; margin-bottom: 8px; }
.hook-list { list-style: none; padding: 0; }
.hook-list li { font-size: 13px; color: #444; padding: 4px 0; font-weight: 500; padding-left: 20px; position: relative; }
.hook-list li::before { content: "\2714"; position: absolute; left: 0; color: #f59e0b; font-weight: bold; }

.result-share { padding: 12px 20px 24px; text-align: center; }
.btn-share { background: none; border: 1px solid #ddd; border-radius: 20px; padding: 10px 20px; font-size: 13px; color: #666; cursor: pointer; }

/* Render page */
#screenRender { background: #fff; padding: 40px 24px; overflow-y: auto; }
.render-content { max-width: 400px; width: 100%; text-align: center; }
.upload-area { border: 2px dashed #ddd; border-radius: 16px; padding: 36px 20px; }
.upload-sub { font-size: 12px; color: #999; margin-top: 6px; }
.btn-upload { display: inline-block; margin-top: 14px; background: #333; color: #fff; border: none; border-radius: 20px; padding: 11px 22px; font-size: 14px; cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.render-label { font-size: 13px; color: #666; margin-bottom: 10px; }
.render-img { width: 100%; border-radius: 12px; margin-bottom: 16px; }
.render-tip { font-size: 12px; color: #999; margin-top: 10px; }
.render-qr { margin-top: 16px; text-align: center; }
.render-qr .qr-img { width: 120px; height: 120px; border-radius: 6px; margin-top: 8px; }
