:root { 
    --bg: #fcfcfc; --card: #ffffff; --text: #1a1a1a; --primary: #00a8ff; 
    --border: #eeeeee; --shadow: rgba(0,0,0,0.05); --input-bg: #f9f9f9; 
    --overlay: rgba(0,0,0,0.85);
}
[data-theme="dark"] { 
    --bg: #0f1011; --card: #17181a; --text: #e0e0e0; 
    --border: #2a2c2e; --shadow: rgba(0,0,0,0.3); --input-bg: #1e2022; 
}

body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); transition: 0.3s; margin: 0; display: flex; flex-direction: column; min-height: 100vh; align-items: center; }
.container { width: 95%; max-width: 420px; padding: 20px; flex: 1; }

/* 1. ปุ่มธีม: ลอยๆ ไร้กรอบ */
.header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; width: 100%; }
.theme-toggle { background: transparent; border: none; font-size: 26px; cursor: pointer; outline: none; padding: 0; }

.main-card { background: var(--card); padding: 25px; border-radius: 28px; box-shadow: 0 15px 35px var(--shadow); border: 1px solid var(--border); margin-bottom: 20px; position: relative; width: 100%; box-sizing: border-box; }

/* 9. Expiry Select */
.expiry-select { width: 100%; padding: 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--input-bg); color: var(--text); margin-bottom: 15px; font-weight: 600; outline: none; }

/* 2. & 5. Drag & Drop + Ellipsis */
.drop-area-wrapper { position: relative; margin: 15px 0; }
.drop-area { border: 2px dashed var(--border); padding: 40px 15px; border-radius: 20px; cursor: pointer; text-align: center; transition: 0.2s; }
.drop-area.dragover { border-color: var(--primary); background: rgba(0, 168, 255, 0.05); }
#fileName { display: block; max-width: 250px; margin: 0 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; font-weight: 600; }

/* 7. ปุ่ม X สีแดง มุมขวาบน */
.remove-file-btn { 
    display: none; position: absolute; top: 10px; right: 10px; background: #ff4757; color: white; 
    border: none; width: 24px; height: 24px; border-radius: 50%; cursor: pointer; 
    align-items: center; justify-content: center; z-index: 10; font-size: 12px; font-weight: bold;
}

/* 13. Progress Bar */
.progress-container { display: none; margin-top: 15px; }
.progress-bg { width: 100%; height: 8px; background: var(--input-bg); border-radius: 10px; overflow: hidden; }
.progress-bar { width: 0%; height: 100%; background: var(--primary); transition: width 0.1s; }
.progress-text { font-size: 12px; font-weight: 700; color: var(--primary); text-align: center; margin-top: 5px; }

/* 4. Placeholder */
#codeIn { width: 100%; padding: 15px; border-radius: 14px; border: 1px solid var(--border); background: var(--input-bg); color: var(--text); font-size: 22px; font-weight: 800; text-align: center; outline: none; margin-bottom: 15px; box-sizing: border-box; }
#codeIn::placeholder { color: #999; font-weight: 400; font-size: 18px; }

.primary-btn { background: var(--primary); color: white; border: none; width: 100%; padding: 16px; border-radius: 16px; font-weight: 700; cursor: pointer; font-size: 16px; }

/* 10. & 12. Lightbox (Modal) */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: var(--overlay); z-index: 1000; align-items: center; justify-content: center; backdrop-filter: blur(8px); }
.modal-content { background: var(--card); width: 90%; max-width: 380px; padding: 25px; border-radius: 30px; text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,0.5); }
.preview-container { width: 100%; border-radius: 15px; overflow: hidden; background: #000; margin-bottom: 15px; display: none; }
.preview-container img, .preview-container video { width: 100%; display: block; max-height: 250px; object-fit: contain; }

.btn-group { display: flex; gap: 10px; margin-top: 15px; }
.download-btn { background: #2ecc71; color: white; border: none; flex: 2; padding: 15px; border-radius: 15px; font-weight: 700; cursor: pointer; }
.cancel-btn { background: #95a5a6; color: white; border: none; flex: 1; padding: 15px; border-radius: 15px; font-weight: 700; cursor: pointer; }

/* 8. Crypto ด้านล่าง */
.wallet-list { display: none; margin-top: 15px; text-align: left; }
.wallet-item { background: var(--card); padding: 12px; border-radius: 18px; margin-bottom: 8px; border: 1px solid var(--border); }
.wallet-info { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 13px; }
.wallet-info img { width: 22px; height: 22px; }
.qr-box { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.qr-img { width: 45px; height: 45px; background: white; padding: 2px; border-radius: 5px; border: 1px solid #eee; }
.wallet-address { font-size: 10px; opacity: 0.5; font-family: monospace; flex: 1; word-break: break-all; }
.mini-copy { background: var(--primary); color: white; border: none; padding: 5px 10px; border-radius: 8px; cursor: pointer; font-size: 11px; }

/* 6. & 11. Footer */
footer { padding: 30px; text-align: center; font-size: 13px; opacity: 0.7; width: 100%; }
footer a { color: inherit; text-decoration: underline; font-weight: 600; }