:root {
    --bg: #0b1120;
    --bg-2: #0f172a;
    --panel: rgba(30, 41, 59, 0.6);
    --panel-solid: #1e293b;
    --border: rgba(148, 163, 184, 0.18);
    --text: #e2e8f0;
    --text-dim: #94a3b8;
    --primary: #6366f1;
    --primary-2: #8b5cf6;
    --accent: #22d3ee;
    --send: #f59e0b;
    --recv: #10b981;
    --danger: #ef4444;
    --radius: 18px;
    --shadow: 0 20px 50px -15px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    font-family: 'Vazirmatn', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.7;
    overflow-x: hidden;
}

body {
    background: radial-gradient(1200px 600px at 80% -10%, rgba(99,102,241,0.18), transparent 60%),
                radial-gradient(900px 500px at 10% 110%, rgba(34,211,238,0.12), transparent 55%),
                var(--bg);
}

/* ===== Background orbs ===== */
.bg-orbs { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.orb { position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.5; animation: float 18s ease-in-out infinite; }
.orb-1 { width: 420px; height: 420px; background: #6366f1; top: -80px; left: -60px; }
.orb-2 { width: 360px; height: 360px; background: #22d3ee; bottom: -100px; right: -40px; animation-delay: -6s; }
.orb-3 { width: 300px; height: 300px; background: #8b5cf6; top: 40%; right: 30%; animation-delay: -12s; }
@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(40px, -30px) scale(1.1); }
}

/* ===== Header ===== */
.site-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px clamp(16px, 4vw, 48px);
    max-width: 1100px; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-icon {
    width: 48px; height: 48px; border-radius: 14px;
    display: grid; place-items: center; font-size: 1.4rem; color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    box-shadow: 0 8px 24px -6px rgba(99,102,241,0.6);
}
.brand-text h1 { font-size: 1.4rem; font-weight: 800; letter-spacing: -0.5px; }
.brand-text p { font-size: 0.78rem; color: var(--text-dim); }

.ghost-btn {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--panel); border: 1px solid var(--border);
    color: var(--text); padding: 10px 16px; border-radius: 12px;
    cursor: pointer; font-family: inherit; font-size: 0.9rem;
    transition: all 0.2s; backdrop-filter: blur(10px);
}
.ghost-btn:hover { border-color: var(--primary); transform: translateY(-1px); }
.ghost-btn.small { padding: 7px 12px; font-size: 0.82rem; }

/* ===== Layout ===== */
.container { max-width: 720px; margin: 0 auto; padding: 12px clamp(16px, 4vw, 32px) 60px; }

.screen { display: none; animation: fadeUp 0.4s ease; }
.screen.active { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

/* ===== Hero ===== */
.hero { text-align: center; padding-top: 20px; }
.hero-title { font-size: clamp(1.7rem, 5vw, 2.6rem); font-weight: 800; line-height: 1.3; letter-spacing: -0.5px; }
.grad { background: linear-gradient(120deg, var(--accent), var(--primary-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-sub { color: var(--text-dim); max-width: 540px; margin: 18px auto 36px; font-size: 1rem; }

.role-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 36px; }
.role-card {
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    padding: 30px 18px; border-radius: var(--radius); cursor: pointer;
    background: var(--panel); border: 1px solid var(--border);
    color: var(--text); font-family: inherit; transition: all 0.25s;
    backdrop-filter: blur(12px);
}
.role-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.role-card .role-emoji { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 1.6rem; color: #fff; }
.role-card.sender { border-color: rgba(245,158,11,0.3); }
.role-card.sender:hover { border-color: var(--send); }
.role-card.sender .role-emoji { background: linear-gradient(135deg, #f59e0b, #f97316); }
.role-card.receiver { border-color: rgba(16,185,129,0.3); }
.role-card.receiver:hover { border-color: var(--recv); }
.role-card.receiver .role-emoji { background: linear-gradient(135deg, #10b981, #06b6d4); }
.role-title { font-weight: 700; font-size: 1.15rem; }
.role-desc { font-size: 0.85rem; color: var(--text-dim); }

.feature-pills { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.feature-pills li {
    font-size: 0.82rem; color: var(--text-dim);
    background: var(--panel); border: 1px solid var(--border);
    padding: 8px 14px; border-radius: 100px; display: inline-flex; gap: 7px; align-items: center;
}
.feature-pills i { color: var(--accent); }

/* ===== Panel ===== */
.panel {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: var(--radius); padding: clamp(18px, 4vw, 30px);
    backdrop-filter: blur(14px); box-shadow: var(--shadow);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.back-btn {
    background: none; border: none; color: var(--text-dim); cursor: pointer;
    font-family: inherit; font-size: 0.9rem; display: inline-flex; align-items: center; gap: 6px;
    transition: color 0.2s;
}
.back-btn:hover { color: var(--text); }
.role-badge { font-size: 0.82rem; padding: 6px 14px; border-radius: 100px; font-weight: 600; }
.sender-badge { background: rgba(245,158,11,0.15); color: var(--send); }
.receiver-badge { background: rgba(16,185,129,0.15); color: var(--recv); }

.step-title { font-size: 1.1rem; margin-bottom: 16px; display: flex; align-items: center; gap: 12px; }
.step-num { width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 0.85rem; font-weight: 700; flex-shrink: 0; }
.sub-step { font-size: 0.95rem; margin-bottom: 14px; color: var(--text); }
.hint { font-size: 0.85rem; color: var(--text-dim); margin-bottom: 16px; }
.hidden { display: none !important; }

/* ===== Dropzone ===== */
.dropzone {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    border: 2px dashed var(--border); border-radius: var(--radius);
    padding: 40px 20px; cursor: pointer; transition: all 0.25s; text-align: center;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--primary); background: rgba(99,102,241,0.08); }
.dropzone-icon { font-size: 2.4rem; color: var(--primary); }
.dropzone-title { font-weight: 600; }
.dropzone-sub { font-size: 0.85rem; color: var(--text-dim); }

.file-list { list-style: none; margin: 18px 0; display: flex; flex-direction: column; gap: 8px; }
.file-list li {
    display: flex; align-items: center; gap: 12px;
    background: rgba(15,23,42,0.5); border: 1px solid var(--border);
    padding: 10px 14px; border-radius: 12px;
}
.file-list .fi-icon { color: var(--accent); font-size: 1.1rem; }
.file-list .fi-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.9rem; }
.file-list .fi-size { font-size: 0.78rem; color: var(--text-dim); }
.file-list .fi-remove { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 0.95rem; }
.file-list .fi-remove:hover { color: var(--danger); }

/* ===== Buttons ===== */
.primary-btn {
    width: 100%; padding: 14px; border: none; border-radius: 14px; cursor: pointer;
    font-family: inherit; font-size: 1rem; font-weight: 700; color: #fff;
    background: linear-gradient(120deg, var(--primary), var(--primary-2));
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    transition: all 0.2s; box-shadow: 0 10px 28px -10px rgba(99,102,241,0.7);
}
.primary-btn:hover:not(:disabled) { transform: translateY(-2px); }
.primary-btn:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }

/* ===== QR ===== */
.qr-box { display: grid; place-items: center; background: #fff; padding: 18px; border-radius: var(--radius); margin: 0 auto 18px; width: fit-content; }
.qr-box canvas { display: block; max-width: 100%; }

.code-details { margin-bottom: 18px; }
.code-details summary { cursor: pointer; font-size: 0.85rem; color: var(--text-dim); padding: 8px 0; }
.code-details summary:hover { color: var(--text); }
textarea {
    width: 100%; background: rgba(15,23,42,0.6); border: 1px solid var(--border);
    border-radius: 12px; color: var(--text); padding: 12px; font-family: monospace;
    font-size: 0.78rem; resize: vertical; margin: 8px 0; word-break: break-all;
}
textarea:focus { outline: none; border-color: var(--primary); }

.sep { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
.answer-input-group { display: flex; flex-direction: column; gap: 12px; }
.or-divider { text-align: center; color: var(--text-dim); font-size: 0.8rem; position: relative; }
.waiting { margin-top: 18px; text-align: center; color: var(--text-dim); font-size: 0.9rem; }

/* ===== Connection status ===== */
.conn-status { font-size: 0.88rem; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
.conn-status i { font-size: 0.55rem; color: var(--send); }
.conn-status.connected i { color: var(--recv); animation: none; }
.conn-status.connecting i { color: var(--send); animation: pulse 1s infinite; }
.conn-status.failed i { color: var(--danger); }
@keyframes pulse { 50% { opacity: 0.3; } }

/* ===== Transfer list ===== */
.transfer-list { display: flex; flex-direction: column; gap: 14px; }
.transfer-empty { text-align: center; padding: 40px 20px; color: var(--text-dim); }
.transfer-empty i { font-size: 2.4rem; color: var(--accent); margin-bottom: 12px; display: block; }

.transfer-item {
    background: rgba(15,23,42,0.5); border: 1px solid var(--border);
    border-radius: 14px; padding: 16px; animation: fadeUp 0.3s ease;
}
.ti-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.ti-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-size: 1.1rem; flex-shrink: 0; }
.ti-icon.up { background: rgba(245,158,11,0.15); color: var(--send); }
.ti-icon.down { background: rgba(16,185,129,0.15); color: var(--recv); }
.ti-meta { flex: 1; min-width: 0; }
.ti-name { font-size: 0.92rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ti-sub { font-size: 0.78rem; color: var(--text-dim); }
.ti-action a { color: var(--accent); text-decoration: none; font-size: 0.85rem; display: inline-flex; align-items: center; gap: 6px; }
.ti-action a:hover { text-decoration: underline; }

.progress-track { height: 8px; background: rgba(148,163,184,0.15); border-radius: 100px; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; border-radius: 100px; background: linear-gradient(90deg, var(--accent), var(--primary)); transition: width 0.15s; }
.progress-fill.done { background: linear-gradient(90deg, var(--recv), #06b6d4); }
.ti-pct { font-size: 0.78rem; color: var(--text-dim); margin-top: 6px; display: flex; justify-content: space-between; }

/* ===== Modal ===== */
.modal { position: fixed; inset: 0; background: rgba(2,6,23,0.8); backdrop-filter: blur(6px); display: none; place-items: center; z-index: 100; padding: 20px; }
.modal.active { display: grid; }
.modal-content { background: var(--panel-solid); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; max-width: 460px; width: 100%; position: relative; animation: fadeUp 0.3s ease; }
.modal-content h3 { margin-bottom: 16px; font-size: 1.15rem; }
.modal-close { position: absolute; top: 14px; left: 14px; background: none; border: none; color: var(--text-dim); font-size: 1.2rem; cursor: pointer; }
.modal-close:hover { color: var(--text); }
.scanner-content { text-align: center; }
#scanner-video { width: 100%; border-radius: 14px; margin: 14px 0; background: #000; max-height: 60vh; }
.scanner-hint { font-size: 0.85rem; color: var(--text-dim); }

.help-list { padding-right: 20px; display: flex; flex-direction: column; gap: 10px; font-size: 0.92rem; }
.help-note { margin-top: 18px; background: rgba(34,211,238,0.08); border: 1px solid rgba(34,211,238,0.2); border-radius: 12px; padding: 14px; font-size: 0.85rem; color: var(--text-dim); }
.help-note i { color: var(--accent); margin-left: 6px; }

/* ===== Toast ===== */
.toast-container { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 10px; z-index: 200; width: calc(100% - 40px); max-width: 400px; }
.toast { background: var(--panel-solid); border: 1px solid var(--border); border-radius: 12px; padding: 14px 18px; font-size: 0.88rem; display: flex; align-items: center; gap: 10px; box-shadow: var(--shadow); animation: toastIn 0.3s ease; }
.toast.success { border-color: var(--recv); } .toast.success i { color: var(--recv); }
.toast.error { border-color: var(--danger); } .toast.error i { color: var(--danger); }
.toast.info i { color: var(--accent); }
@keyframes toastIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* ===== Footer ===== */
.site-footer { text-align: center; padding: 30px 20px; color: var(--text-dim); font-size: 0.82rem; }

/* ===== Responsive ===== */
@media (max-width: 520px) {
    .role-cards { grid-template-columns: 1fr; }
    .brand-text p { display: none; }
    .ghost-btn span { display: none; }
}
