/* ============================================================
   FileShare — style.css
   Desktop perfect. Mobile fully fixed.
   ============================================================ */

/* === Reset & Base === */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --brand: #E8340A;
    --brand-hover: #c42908;
    --brand-light: #fff2ef;
    --brand-border: #fdd5cc;

    --accent: #0057FF;
    --accent-hover: #0044cc;
    --accent-light: #eef3ff;

    --success: #16a34a;
    --success-bg: #f0fdf4;
    --success-border: #bbf7d0;

    --warning: #d97706;
    --warning-bg: #fffbeb;
    --warning-border: #fde68a;

    --error: #dc2626;
    --error-bg: #fef2f2;
    --error-border: #fecaca;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-hint: #cbd5e1;

    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --bg-subtle: #f1f5f9;

    --border: #e2e8f0;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .06), 0 1px 2px rgba(0, 0, 0, .04);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, .08), 0 2px 6px rgba(0, 0, 0, .05);

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    --font-body: 'Plus Jakarta Sans', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'Courier New', monospace;

    --transition: 0.18s ease;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--bg-page);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    line-height: 1.6;
    /* Prevent horizontal overflow on mobile */
    overflow-x: hidden;
    width: 100%;
}

/* === Navbar === */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    height: 64px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
    width: 100%;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
}

.brand-icon {
    font-size: 22px;
    color: var(--brand);
    line-height: 1;
}

.brand-name {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.navbar-tagline {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* === Main Wrapper === */
.main-wrapper {
    flex: 1;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 48px 24px 64px;
    /* Prevent children from overflowing */
    min-width: 0;
}

/* === Alerts === */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    font-size: 0.92rem;
    font-weight: 500;
    margin-bottom: 24px;
    animation: slideDown 0.25s ease;
    word-break: break-word;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-error {
    background: var(--error-bg);
    border: 1px solid var(--error-border);
    color: var(--error);
}

.alert-success {
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    color: var(--success);
}

.alert-icon {
    font-size: 1rem;
    flex-shrink: 0;
    margin-top: 2px;
}

/* === Hero Section === */
.hero-section {
    text-align: center;
    margin-bottom: 48px;
    padding: 0 8px;
}

.hero-title {
    font-size: clamp(1.9rem, 5vw, 3.4rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -1.5px;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.hero-title .highlight {
    color: var(--brand);
}

.hero-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    max-width: 520px;
    margin: 0 auto;
    line-height: 1.7;
}

/* === Content Grid (Desktop: side by side) === */
.content-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: start;
    margin-bottom: 64px;
    /* No overflow, cards stretch properly */
    min-width: 0;
}

/* === Card === */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    padding: 32px;
    box-shadow: var(--shadow-md);
    /* Prevent card content from overflowing */
    min-width: 0;
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.card-icon {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: 700;
    flex-shrink: 0;
}

.send-icon {
    background: var(--brand-light);
    color: var(--brand);
    border: 1px solid var(--brand-border);
}

.receive-icon {
    background: var(--accent-light);
    color: var(--accent);
    border: 1px solid #c7d7ff;
}

.card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.card-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* === OR Divider Column === */
.divider-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 0 28px;
    margin-top: 80px;
    flex-shrink: 0;
}

.divider-line {
    width: 1px;
    height: 60px;
    background: var(--border);
}

.divider-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    background: var(--bg-page);
    padding: 6px 10px;
    border-radius: 20px;
    border: 1px solid var(--border);
    white-space: nowrap;
}

/* === Dropzone === */
.dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-subtle);
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    margin-bottom: 16px;
    /* Fixed height so layout doesn't shift */
    min-height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    overflow: hidden;
}

.dropzone:hover {
    border-color: var(--brand);
    background: var(--brand-light);
}

.dropzone.drag-over {
    border-color: var(--brand);
    background: var(--brand-light);
    box-shadow: 0 0 0 4px rgba(232, 52, 10, 0.08);
}

.dropzone.has-file {
    border-color: var(--success);
    border-style: solid;
    background: var(--success-bg);
}

.file-input {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
}

.dropzone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 24px 16px;
    text-align: center;
    width: 100%;
}

.dropzone-icon {
    font-size: 1.8rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    transition: var(--transition);
}

.dropzone:hover .dropzone-icon {
    color: var(--brand);
    transform: translateY(-2px);
}

.dropzone-primary {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-primary);
}

.dropzone-secondary {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.dropzone-link {
    color: var(--brand);
    font-weight: 600;
    cursor: pointer;
}

.dropzone-formats {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 4px;
    font-family: var(--font-mono);
    letter-spacing: 0.02em;
    /* Prevent overflow on small screens */
    word-break: break-word;
    text-align: center;
}

/* === File Preview (inside dropzone) === */
.dropzone-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    width: 100%;
    /* Prevent overflow */
    min-width: 0;
}

.file-preview-icon {
    font-size: 2.2rem;
    flex-shrink: 0;
}

.file-preview-info {
    flex: 1;
    min-width: 0;
}

.file-preview-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-preview-size {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    margin-top: 2px;
}

.file-remove-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.78rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--transition);
}

.file-remove-btn:hover {
    background: var(--error-bg);
    border-color: var(--error-border);
    color: var(--error);
}

/* === Upload Progress === */
.upload-progress {
    margin-bottom: 14px;
}

.progress-bar {
    height: 6px;
    background: var(--bg-subtle);
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--brand), #ff6b47);
    border-radius: 99px;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* === Field Error === */
.field-error {
    font-size: 0.82rem;
    color: var(--error);
    margin-top: -8px;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: var(--error-bg);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--error);
    word-break: break-word;
}

/* === Key Input (Receive side) === */
.code-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    gap: 8px;
}

.field-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.code-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.key-input-group {
    position: relative;
    margin-bottom: 16px;
    /* Fixed height — prevents layout shift */
    height: 72px;
}

.key-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: text;
    z-index: 2;
    font-size: 16px;
    /* 16px prevents iOS zoom */
}

.key-digits-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 72px;
    background: var(--bg-subtle);
    border-radius: var(--radius-md);
    border: 2px solid var(--border);
    cursor: text;
    transition: all var(--transition);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1;
}

.key-input:focus+.key-digits-display {
    border-color: var(--accent);
    background: var(--accent-light);
    box-shadow: 0 0 0 3px rgba(0, 87, 255, 0.08);
}

.key-digits-display span {
    /* Fluid digit boxes that fit any screen */
    width: clamp(28px, 10vw, 38px);
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    font-size: clamp(1.1rem, 4vw, 1.5rem);
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
    transition: all var(--transition);
    flex-shrink: 0;
}

.key-digits-display span.filled {
    border-color: var(--accent);
    background: var(--accent-light);
    color: var(--accent);
}

.key-digits-display .key-sep {
    width: auto;
    height: auto;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 400;
    flex-shrink: 0;
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 20px;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all var(--transition);
    letter-spacing: -0.01em;
    white-space: nowrap;
    /* Prevent button text from overflowing */
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn:disabled {
    opacity: 0.42;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-full {
    width: 100%;
    margin-top: 6px;
}

.btn-primary {
    background: var(--brand);
    color: #fff;
    box-shadow: 0 4px 14px rgba(232, 52, 10, 0.28);
}

.btn-primary:hover:not(:disabled) {
    background: var(--brand-hover);
    box-shadow: 0 6px 18px rgba(232, 52, 10, 0.36);
    transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 14px rgba(0, 87, 255, 0.25);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--accent-hover);
    box-shadow: 0 6px 18px rgba(0, 87, 255, 0.32);
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1.5px solid var(--border);
}

.btn-ghost:hover {
    background: var(--bg-subtle);
    color: var(--text-primary);
}

.btn-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

/* === Mini Divider (inside receive card) === */
.divider-mini {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 20px 0;
    color: var(--text-muted);
    font-size: 0.78rem;
    white-space: nowrap;
}

.divider-mini::before,
.divider-mini::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* === Info Cards === */
.info-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.info-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    background: var(--bg-subtle);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.info-card-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    margin-top: 1px;
}

.info-card p {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

/* === How It Works === */
.how-it-works {
    text-align: center;
    padding-top: 8px;
}

.section-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 24px;
}

.steps-row {
    display: flex;
    align-items: stretch;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}

.step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    text-align: left;
    flex: 1 1 160px;
    max-width: 220px;
    padding: 18px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.step-num {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--brand);
    flex-shrink: 0;
    line-height: 1;
    padding-top: 2px;
}

.step-body h4 {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.step-body p {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.step-arrow {
    font-size: 1.1rem;
    color: var(--text-hint);
    padding: 0 2px;
    align-self: center;
    flex-shrink: 0;
}

/* ================================================================
   WAITING PAGE
   ================================================================ */

/* Desktop: left (code/timer) | right (QR + status) */
.waiting-wrapper {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 24px;
    align-items: start;
}

.waiting-card {
    padding: 36px;
}

/* Status Badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 99px;
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 20px;
    border: 1.5px solid var(--border);
    background: var(--bg-subtle);
    color: var(--text-secondary);
    transition: all 0.4s ease;
}

.status-badge[data-status="waiting"] {
    background: var(--warning-bg);
    border-color: var(--warning-border);
    color: var(--warning);
}

.status-badge[data-status="downloading"] {
    background: var(--accent-light);
    border-color: #c7d7ff;
    color: var(--accent);
}

.status-badge[data-status="completed"] {
    background: var(--success-bg);
    border-color: var(--success-border);
    color: var(--success);
}

.status-badge[data-status="expired"] {
    background: var(--error-bg);
    border-color: var(--error-border);
    color: var(--error);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.status-badge[data-status="waiting"] .status-dot {
    animation: pulse-dot 1.5s ease-in-out infinite;
}

@keyframes pulse-dot {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.4;
        transform: scale(0.7);
    }
}

.waiting-header {
    margin-bottom: 20px;
}

.waiting-title {
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.7px;
    margin-bottom: 4px;
}

.waiting-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* File Banner */
.file-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-subtle);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    margin-bottom: 24px;
    min-width: 0;
    overflow: hidden;
}

.file-banner-icon {
    font-size: 1.8rem;
    flex-shrink: 0;
}

.file-banner-info {
    min-width: 0;
    flex: 1;
}

.file-banner-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    margin-bottom: 2px;
}

.file-banner-size {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* Code Display */
.code-section {
    margin-bottom: 20px;
}

.code-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.code-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 12px;
    /* Prevent overflow */
    flex-wrap: nowrap;
    width: 100%;
}

.code-digit {
    /* Fluid sizing — fits all screens */
    width: clamp(36px, 10vw, 52px);
    height: clamp(50px, 12vw, 66px);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-family: var(--font-mono);
    font-size: clamp(1.3rem, 4.5vw, 2rem);
    font-weight: 700;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
    animation: digitReveal 0.4s ease backwards;
    flex-shrink: 0;
}

.code-digit:nth-child(1) {
    animation-delay: 0.05s;
}

.code-digit:nth-child(2) {
    animation-delay: 0.10s;
}

.code-digit:nth-child(3) {
    animation-delay: 0.15s;
}

.code-digit:nth-child(5) {
    animation-delay: 0.20s;
}

.code-digit:nth-child(6) {
    animation-delay: 0.25s;
}

.code-digit:nth-child(7) {
    animation-delay: 0.30s;
}

@keyframes digitReveal {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.code-sep {
    font-size: 1.2rem;
    color: var(--text-hint);
    font-weight: 300;
    flex-shrink: 0;
}

.btn-copy {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 10px;
    background: var(--bg-subtle);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.btn-copy:hover {
    background: var(--bg-page);
    border-color: var(--text-hint);
    color: var(--text-primary);
}

.btn-copy.copied {
    background: var(--success-bg);
    border-color: var(--success-border);
    color: var(--success);
}

/* Link Box */
.link-section {
    margin-bottom: 20px;
}

.link-box {
    display: flex;
    align-items: center;
    background: var(--bg-subtle);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    min-width: 0;
}

.link-text {
    flex: 1;
    min-width: 0;
    padding: 10px 14px;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.link-copy-btn {
    flex-shrink: 0;
    width: 40px;
    min-height: 40px;
    background: var(--bg-card);
    border: none;
    border-left: 1.5px solid var(--border);
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-secondary);
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.link-copy-btn:hover {
    background: var(--accent-light);
    color: var(--accent);
}

/* Timer */
.timer-section {
    margin-top: 4px;
}

.timer-bar-wrap {
    height: 6px;
    background: var(--bg-subtle);
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 8px;
    border: 1px solid var(--border);
}

.timer-bar {
    height: 100%;
    background: linear-gradient(90deg, #16a34a, #4ade80);
    border-radius: 99px;
    width: 100%;
    transition: width 1s linear, background 1s;
}

.timer-bar.timer-urgent {
    background: linear-gradient(90deg, var(--error), #f87171);
    animation: urgentPulse 0.8s ease-in-out infinite;
}

@keyframes urgentPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

.timer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.timer-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.timer-countdown {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.04em;
}

/* === QR Card === */
.qr-card {
    text-align: center;
    padding: 24px;
    margin-bottom: 16px;
}

.qr-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.qr-frame {
    display: inline-flex;
    padding: 14px;
    background: #fff;
    border-radius: var(--radius-lg);
    border: 2px solid var(--border);
    box-shadow: var(--shadow-sm);
    margin-bottom: 12px;
    /* Prevent QR from overflowing */
    max-width: 100%;
}

.qr-frame svg,
.qr-frame img {
    display: block;
    width: 160px;
    height: 160px;
    max-width: 100%;
}

.qr-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.qr-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-bottom: 10px;
}

.qr-divider::before,
.qr-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.qr-url code {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-secondary);
    background: var(--bg-subtle);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    display: block;
    word-break: break-all;
    text-align: left;
    border: 1px solid var(--border);
}

/* === Status Card === */
.status-card {
    text-align: center;
    padding: 20px;
    margin-bottom: 16px;
}

.status-animation {
    position: relative;
    width: 60px;
    height: 60px;
    margin: 0 auto 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pulse-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid var(--brand);
    animation: ringPulse 2s ease-out infinite;
}

@keyframes ringPulse {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }

    100% {
        transform: scale(1.6);
        opacity: 0;
    }
}

.pulse-ring.pulse-active {
    border-color: var(--accent);
}

.pulse-core {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--brand-light);
    border: 2px solid var(--brand-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--brand);
    font-weight: 700;
    position: relative;
    z-index: 1;
}

.pulse-core.pulse-core-active {
    background: var(--accent-light);
    border-color: #c7d7ff;
    color: var(--accent);
}

.pulse-core.pulse-done {
    background: var(--success-bg);
    border-color: var(--success-border);
    color: var(--success);
    font-size: 1.2rem;
    animation: doneBounce 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes doneBounce {

    0%,
    100% {
        transform: scale(1);
    }

    40% {
        transform: scale(1.25);
    }

    70% {
        transform: scale(0.92);
    }
}

.status-card-text {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.status-card-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* === Footer === */
.footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    text-align: center;
    padding: 18px 24px;
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.7;
}

.footer strong {
    color: var(--text-secondary);
    font-weight: 600;
}

.footer-copy {
    font-size: 0.72rem;
    color: var(--text-hint);
    margin-top: 2px;
}

/* ================================================================
   RESPONSIVE — TABLET (≤900px)
   ================================================================ */
@media (max-width: 900px) {

    /* Home page: stack cards vertically */
    .content-grid {
        grid-template-columns: 1fr;
        margin-bottom: 48px;
    }

    /* OR divider becomes horizontal */
    .divider-col {
        flex-direction: row;
        margin-top: 0;
        padding: 12px 0;
    }

    .divider-line {
        width: 100%;
        height: 1px;
    }

    /* Steps wrap nicely */
    .steps-row {
        gap: 8px;
    }

    .step-arrow {
        display: none;
    }

    .step {
        max-width: 100%;
    }

    /* Waiting page: stack vertically, QR first on top */
    .waiting-wrapper {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    /* On tablet/mobile: QR card goes to TOP (above code card) */
    .waiting-right {
        order: -1;
    }

    .waiting-left {
        order: 1;
    }

    /* QR card horizontal on tablet */
    .qr-card {
        display: flex;
        align-items: center;
        gap: 20px;
        text-align: left;
        padding: 20px;
    }

    .qr-frame {
        flex-shrink: 0;
    }

    .qr-label {
        margin-bottom: 10px;
    }

    .qr-hint {
        margin-bottom: 10px;
    }
}

/* ================================================================
   RESPONSIVE — MOBILE (≤600px)
   ================================================================ */
@media (max-width: 600px) {

    /* Navbar */
    .navbar {
        padding: 0 16px;
    }

    .navbar-tagline {
        display: none;
    }

    /* Main padding */
    .main-wrapper {
        padding: 20px 12px 40px;
    }

    /* Hero */
    .hero-section {
        margin-bottom: 28px;
    }

    .hero-title {
        font-size: 1.75rem;
        letter-spacing: -0.8px;
    }

    .hero-subtitle {
        font-size: 0.88rem;
    }

    /* Cards */
    .card {
        padding: 18px 14px;
        border-radius: var(--radius-lg);
    }

    .waiting-card {
        padding: 18px 14px;
    }

    .card-header {
        margin-bottom: 18px;
        padding-bottom: 16px;
        gap: 12px;
    }

    .card-title {
        font-size: 1rem;
    }

    .card-icon {
        width: 38px;
        height: 38px;
        font-size: 1.1rem;
    }

    /* Dropzone smaller on mobile */
    .dropzone {
        min-height: 130px;
    }

    .dropzone-content {
        padding: 18px 12px;
    }

    .dropzone-icon {
        font-size: 1.5rem;
    }

    .dropzone-primary {
        font-size: 0.85rem;
    }

    .dropzone-formats {
        font-size: 0.68rem;
    }

    /* File preview in dropzone */
    .dropzone-preview {
        padding: 12px;
        gap: 10px;
    }

    .file-preview-icon {
        font-size: 1.8rem;
    }

    .file-preview-name {
        font-size: 0.82rem;
    }

    /* Key digits */
    .key-input-group {
        height: 60px;
    }

    .key-digits-display {
        height: 60px;
        gap: 4px;
    }

    .key-digits-display span {
        width: clamp(24px, 9vw, 34px);
        height: 42px;
        font-size: clamp(0.95rem, 3.5vw, 1.3rem);
        border-radius: 6px;
    }

    .key-digits-display .key-sep {
        font-size: 0.85rem;
    }

    /* Info cards: single column */
    .info-cards {
        grid-template-columns: 1fr;
    }

    /* Steps: 2 per row on mobile */
    .steps-row {
        gap: 6px;
    }

    .step {
        flex: 1 1 calc(50% - 6px);
        max-width: none;
        padding: 12px;
    }

    .step-num {
        font-size: 0.9rem;
    }

    .step-body h4 {
        font-size: 0.8rem;
    }

    .step-body p {
        font-size: 0.72rem;
    }

    /* Waiting page */
    .waiting-wrapper {
        gap: 12px;
    }

    .waiting-title {
        font-size: 1.3rem;
        letter-spacing: -0.4px;
    }

    .waiting-subtitle {
        font-size: 0.82rem;
    }

    .file-banner {
        padding: 10px 12px;
        gap: 10px;
    }

    .file-banner-icon {
        font-size: 1.5rem;
    }

    .file-banner-name {
        font-size: 0.82rem;
    }

    /* Code digits — fluid, never overflow */
    .code-display {
        gap: 4px;
    }

    .code-digit {
        width: clamp(32px, 11vw, 44px);
        height: clamp(44px, 13vw, 58px);
        font-size: clamp(1.1rem, 5vw, 1.6rem);
        border-radius: 10px;
    }

    .code-sep {
        font-size: 0.9rem;
    }

    /* QR card on mobile: vertical, compact */
    .qr-card {
        flex-direction: column;
        text-align: center;
        padding: 16px;
        gap: 12px;
    }

    .qr-frame svg,
    .qr-frame img {
        width: 130px;
        height: 130px;
    }

    .qr-frame {
        padding: 10px;
    }

    /* Status card compact */
    .status-card {
        padding: 16px;
    }

    /* Back button full width */
    .btn-ghost.btn-full {
        font-size: 0.88rem;
        padding: 11px 16px;
    }

    /* Link box text smaller */
    .link-text {
        font-size: 0.68rem;
        padding: 9px 10px;
    }

    /* Timer */
    .timer-countdown {
        font-size: 1rem;
    }

    /* Footer */
    .footer {
        padding: 14px 16px;
        font-size: 0.75rem;
    }
}

/* ================================================================
   RESPONSIVE — VERY SMALL (≤380px)
   ================================================================ */
@media (max-width: 380px) {

    .main-wrapper {
        padding: 16px 10px 32px;
    }

    .hero-title {
        font-size: 1.5rem;
    }

    .card {
        padding: 14px 12px;
    }

    /* Code digits even smaller */
    .code-digit {
        width: clamp(28px, 12vw, 36px);
        height: clamp(38px, 14vw, 50px);
        font-size: clamp(1rem, 5.5vw, 1.3rem);
        border-radius: 8px;
    }

    /* Steps: single column */
    .step {
        flex: 1 1 100%;
    }

    .waiting-title {
        font-size: 1.15rem;
    }

    .qr-frame svg,
    .qr-frame img {
        width: 110px;
        height: 110px;
    }
}