/* =====================================================
   BEAM — DESIGN TOKENS

   Two accent hues, one shared spectrum: teal marks
   File Transfer, violet marks Quick Share. Both read
   as "signal" colors against the near-black base, and
   the same pulsing-dot motif (brand icon, connection
   status, device chips) is reused everywhere a device
   is "alive" on the network — that repetition is the
   whole visual identity.
===================================================== */

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --bg: #090c11;
    --surface: #12161d;
    --surface-2: #171d26;
    --surface-hover: #1d242f;

    --border: rgba(255, 255, 255, 0.08);
    --border-bright: rgba(255, 255, 255, 0.18);

    --text: #f3f6f9;
    --muted: #8b96a5;
    --muted-dim: #5c6674;

    --teal: #5eead4;
    --teal-soft: rgba(94, 234, 212, 0.14);
    --teal-line: rgba(94, 234, 212, 0.28);

    --violet: #b39dfb;
    --violet-soft: rgba(179, 157, 251, 0.16);
    --violet-line: rgba(179, 157, 251, 0.3);

    --danger: #fb7185;
    --danger-soft: rgba(251, 113, 133, 0.14);
    --danger-line: rgba(251, 113, 133, 0.3);

    --radius-lg: 26px;
    --radius-md: 17px;
    --radius-sm: 11px;

    --shadow: 0 25px 70px rgba(0, 0, 0, 0.55);
    --shadow-sm: 0 10px 28px rgba(0, 0, 0, 0.25);

    /* A near-opaque version of --surface, for floating
       elements (toasts) that need to stay readable over
       whatever is behind them. */
    --surface-solid: rgba(23, 29, 38, 0.96);

    --font-display: "Space Grotesk", "Inter", ui-sans-serif, sans-serif;
    --font-body: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono: "JetBrains Mono", "SF Mono", Consolas, "Courier New", monospace;

    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* =====================================================
   LIGHT THEME OVERRIDES

   Same token names, different values - everything built on
   var(--bg)/var(--surface)/var(--text)/var(--border)/
   var(--shadow) picks this up automatically. Accent hues
   (teal/violet/danger) stay put since they already have
   enough contrast on a light surface.
===================================================== */

:root[data-theme="light"] {
    --bg: #f3f5f8;
    --surface: #ffffff;
    --surface-2: #edf0f4;
    --surface-hover: #e3e8ee;

    --border: rgba(15, 23, 32, 0.10);
    --border-bright: rgba(15, 23, 32, 0.22);

    --text: #12161d;
    --muted: #59636e;
    --muted-dim: #838d97;

    --shadow: 0 25px 70px rgba(15, 23, 32, 0.10);
    --shadow-sm: 0 10px 28px rgba(15, 23, 32, 0.07);
    --surface-solid: rgba(255, 255, 255, 0.97);
}

html {
    min-height: 100%;
    background: var(--bg);

    scrollbar-width: thin;
    scrollbar-color: var(--teal) var(--surface);
}

html::-webkit-scrollbar {
    width: 10px;
}

html::-webkit-scrollbar-track {
    background: var(--surface);
}

html::-webkit-scrollbar-thumb {
    background: var(--teal);
    border-radius: 10px;
    border: 2px solid var(--surface);
}

html::-webkit-scrollbar-thumb:hover {
    background: var(--teal-line);
}

body {
    margin: 0;
    min-height: 100vh;
    padding: 32px 20px;

    background:
        radial-gradient(circle at 15% -10%, rgba(94, 234, 212, 0.07), transparent 40%),
        radial-gradient(circle at 100% 10%, rgba(179, 157, 251, 0.06), transparent 38%),
        var(--bg);

    color: var(--text);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    overflow-x: hidden;
}

h1, h2 {
    font-family: var(--font-display);
}

button {
    font-family: inherit;
}

::selection {
    background: var(--teal-soft);
    color: var(--text);
}


/* =====================================================
   MAIN CARD
===================================================== */

.container {
    width: min(920px, 94vw);
    min-height: 520px;
    padding: 54px 60px 60px;
    border-radius: var(--radius-lg);

    background:
        linear-gradient(150deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015)),
        var(--surface);

    border: 1px solid var(--border);
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.045);

    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;

    position: relative;
    overflow: hidden;
}

.container::before {
    content: "";
    position: absolute;
    width: 480px;
    height: 200px;
    top: -140px;
    left: 50%;
    transform: translateX(-50%);

    background: linear-gradient(90deg, var(--teal), var(--violet));
    opacity: 0.08;
    filter: blur(80px);
    pointer-events: none;

    animation: driftGlow 10s ease-in-out infinite;
}

@keyframes driftGlow {
    0%, 100% { transform: translateX(-50%) translateY(0); opacity: 0.07; }
    50%      { transform: translateX(-45%) translateY(16px); opacity: 0.11; }
}


/* =====================================================
   HOME
===================================================== */

#home {
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.brand-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 6px;
}

.brand-mark {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    border-radius: 20px;

    background: linear-gradient(150deg, rgba(94, 234, 212, 0.2), rgba(179, 157, 251, 0.08));
    border: 1px solid var(--teal-line);

    display: flex;
    align-items: center;
    justify-content: center;

    animation: iconPulse 3.4s ease-in-out infinite;
}

.brand-mark span {
    color: var(--teal);
    font-size: 28px;
    font-weight: 700;
    text-shadow: 0 0 25px rgba(94, 234, 212, 0.3);
}

@keyframes iconPulse {
    0%, 100% { box-shadow: 0 15px 40px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.08), 0 0 0 0 rgba(94,234,212,0.25); }
    50%      { box-shadow: 0 15px 40px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.08), 0 0 22px 4px rgba(94,234,212,0.16); }
}

.brand {
    text-align: left;
}

.brand h1 {
    margin: 0;
    font-size: clamp(30px, 5vw, 40px);
    font-weight: 700;
    letter-spacing: -1.4px;
    line-height: 1;
}

.brand > span {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 13px;
    letter-spacing: 0.2px;
}

.subtitle {
    max-width: 440px;
    margin: 18px 0 34px;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.6;
}

.section-subtitle {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13.5px;
    line-height: 1.5;
}


/* =====================================================
   HOME ACTIONS
===================================================== */

.home-actions {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.primary-action,
.secondary-action {
    width: 100%;
    min-height: 82px;
    padding: 15px 18px;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;

    display: flex;
    align-items: center;
    text-align: left;
    position: relative;
    overflow: hidden;

    transition: transform 0.35s var(--ease), background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.primary-action:active,
.secondary-action:active {
    transform: scale(0.97);
}

.primary-action {
    color: var(--text);
    background: linear-gradient(135deg, rgba(94, 234, 212, 0.16), rgba(94, 234, 212, 0.05));
    border: 1px solid var(--teal-line);
    box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.primary-action:hover {
    background: linear-gradient(135deg, rgba(94, 234, 212, 0.22), rgba(94, 234, 212, 0.08));
    border-color: rgba(94, 234, 212, 0.4);
    box-shadow: 0 16px 38px rgba(0, 0, 0, 0.28), 0 0 30px rgba(94, 234, 212, 0.08);
}

.secondary-action {
    color: var(--text);
    background: linear-gradient(135deg, rgba(179, 157, 251, 0.14), rgba(179, 157, 251, 0.04));
    border: 1px solid var(--violet-line);
}

.secondary-action:hover {
    background: linear-gradient(135deg, rgba(179, 157, 251, 0.2), rgba(179, 157, 251, 0.07));
    border-color: rgba(179, 157, 251, 0.42);
    box-shadow: 0 16px 38px rgba(0, 0, 0, 0.28), 0 0 30px rgba(179, 157, 251, 0.07);
}

.button-icon {
    width: 46px;
    height: 46px;
    margin-right: 15px;
    flex-shrink: 0;
    border-radius: 13px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: rgba(255, 255, 255, 0.05);
    font-size: 20px;
}

.primary-action .button-icon {
    background: rgba(94, 234, 212, 0.12);
}

.secondary-action .button-icon {
    background: rgba(179, 157, 251, 0.14);
}

.button-content {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.button-content strong {
    font-size: 15px;
    font-weight: 650;
}

.button-content small {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}

.button-arrow {
    margin-left: auto;
    padding-left: 10px;
    color: var(--muted);
    font-size: 19px;
    transition: transform 0.3s ease, color 0.3s ease;
}

.primary-action:hover .button-arrow { color: var(--teal); transform: translateX(4px); }
.secondary-action:hover .button-arrow { color: var(--violet); transform: translateX(4px); }


/* =====================================================
   HOME NETWORK PANEL (live devices)
===================================================== */

.network-panel {
    width: 100%;
    margin-top: 26px;
    padding: 16px 18px;
    border-radius: var(--radius-md);

    background: rgba(255, 255, 255, 0.025);
    border: 1px solid var(--border);
}

.network-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.network-panel-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.network-panel-title {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--muted-dim);
    flex-shrink: 0;
}

.pulse-dot.live {
    background: var(--teal);
    box-shadow: 0 0 0 4px rgba(94, 234, 212, 0.1), 0 0 14px rgba(94, 234, 212, 0.4);
    animation: dotBreathe 2.4s ease-in-out infinite;
}

.pulse-dot.offline {
    background: var(--danger);
    box-shadow: 0 0 0 4px rgba(251, 113, 133, 0.1);
}

@keyframes dotBreathe {
    0%, 100% { box-shadow: 0 0 0 4px rgba(94, 234, 212, 0.1), 0 0 14px rgba(94, 234, 212, 0.4); }
    50%      { box-shadow: 0 0 0 7px rgba(94, 234, 212, 0.05), 0 0 18px rgba(94, 234, 212, 0.55); }
}

.ghost-button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.25s ease, border-color 0.25s ease, background 0.25s ease;
}

.ghost-button:hover {
    color: var(--text);
    border-color: var(--border-bright);
    background: rgba(255, 255, 255, 0.06);
}

.ghost-button.danger:hover {
    color: var(--danger);
    border-color: var(--danger-line);
    background: var(--danger-soft);
}

.icon-only-button {
    padding: 7px 9px;
    opacity: 0.45;
}

.icon-only-button:hover {
    opacity: 1;
}

.edit-pencil {
    opacity: 0.6;
    font-size: 11px;
}

.device-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.device-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px 6px 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    animation: chipIn 0.3s var(--ease);
}

@keyframes chipIn {
    from { opacity: 0; transform: translateY(4px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.device-chip-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--teal), var(--violet));
    color: #060809;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.device-chip-label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
}

.device-chip-empty {
    color: var(--muted-dim);
    font-size: 12.5px;
    padding: 4px 2px;
}


/* =====================================================
   BACK BUTTON
===================================================== */

.back-button,
#backButton {
    padding: 9px 14px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.018));
    color: var(--muted);
    border: 1px solid var(--border);
    font-size: 13px;
    font-weight: 550;
    cursor: pointer;
    display: block;
    margin-right: auto;
    transition: transform 0.35s var(--ease), color 0.25s ease, background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.back-button:hover,
#backButton:hover {
    color: var(--text);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.025));
    border-color: var(--border-bright);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.2);
}

.back-button:active,
#backButton:active {
    transform: scale(0.96);
}


/* =====================================================
   FILE TRANSFER SECTION
===================================================== */

#fileTransferSection {
    width: 100%;
    text-align: center;
}

#fileTransferSection h1 {
    margin: 16px 0 0;
    font-size: clamp(24px, 4vw, 30px);
    letter-spacing: -0.8px;
}

#transferModes {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin: 22px auto 14px;
    padding: 5px;
    max-width: 380px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid var(--border);
}

#uploadModeButton,
#downloadModeButton {
    flex: 1;
    min-width: 0;
    padding: 10px 14px;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    border: 1px solid transparent;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.35s var(--ease), color 0.25s ease, background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

#uploadModeButton:hover,
#downloadModeButton:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.055);
    border-color: var(--border);
}

#uploadModeButton:active,
#downloadModeButton:active {
    transform: scale(0.96);
}

/* NOTE: script.js toggles "active-mode" (not "active") on
   these buttons — matching that exact class name here so the
   selected tab actually gets styled. */
#uploadModeButton.active-mode,
#downloadModeButton.active-mode {
    color: var(--teal);
    background: linear-gradient(135deg, rgba(94, 234, 212, 0.16), rgba(94, 234, 212, 0.06));
    border-color: rgba(94, 234, 212, 0.3);
    box-shadow: 0 5px 18px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

#uploadSection,
#downloadSection {
    width: 100%;
    margin-top: 12px;
}

#downloadSection { display: none; }

#uploadSection {
    display: flex;
    flex-direction: column;
    align-items: center;
}

input[type="file"] { display: none; }

#dropzone {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 26px 16px;
    border-radius: var(--radius-md);
    border: 1.5px dashed var(--border-bright);
    background: var(--surface-2);
    transition: border-color 0.25s ease, background 0.25s ease, transform 0.2s ease;
}

#dropzone.drag-over {
    border-color: var(--teal);
    background: var(--teal-soft);
    transform: scale(1.01);
}

label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 6px;
    padding: 12px 22px;
    border-radius: 12px;
    background: var(--surface-2);
    border: 1px dashed var(--border-bright);
    color: var(--teal);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s var(--ease), background 0.25s ease, border-color 0.25s ease;
}

label:hover {
    background: var(--surface-hover);
    border-color: var(--teal-line);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.22);
}

label:active { transform: scale(0.97); }

/* Inside the dashed dropzone, the button itself reads better
   as a solid pill rather than a second dashed box. */
#dropzone label {
    border-style: solid;
    background: var(--surface);
}

.dropzone-hint {
    margin: 10px 0 0;
    color: var(--muted-dim);
    font-size: 12.5px;
}

#fileCount {
    min-height: 20px;
    margin: 9px 0 0;
    color: var(--muted);
    font-size: 13px;
}

#sendButton {
    margin-top: 18px;
    padding: 11px 22px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, rgba(94, 234, 212, 0.18), rgba(94, 234, 212, 0.07));
    color: var(--teal);
    border: 1px solid var(--teal-line);
    font-size: 13px;
    font-weight: 650;
    cursor: pointer;
    transition: transform 0.35s var(--ease), background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

#sendButton:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(94, 234, 212, 0.25), rgba(94, 234, 212, 0.1));
    border-color: rgba(94, 234, 212, 0.4);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22), 0 0 25px rgba(94, 234, 212, 0.08);
}

#sendButton:active:not(:disabled) { transform: scale(0.96); }

button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

#downloadStatus {
    color: var(--muted);
    font-size: 13.5px;
    margin: 4px 0 14px;
}

#selectAllArea {
    display: flex;
    justify-content: flex-end;
    width: 100%;
}

#selectAllButton {
    padding: 7px 13px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.35s var(--ease), color 0.25s ease, border-color 0.25s ease;
}

#selectAllButton:hover {
    color: var(--text);
    border-color: var(--border-bright);
}

#selectAllButton:active { transform: scale(0.96); }

#selectedFileStatus {
    text-align: left;
    margin: 10px 2px 0;
    color: var(--muted);
    font-size: 12.5px;
}


/* =====================================================
   FILE LISTS + SCROLLBARS
===================================================== */

#fileList,
#downloadFileList {
    max-height: 400px;
    overflow-y: auto;
    width: 100%;
    margin-top: 12px;
    padding-right: 6px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

#fileList::-webkit-scrollbar,
#downloadFileList::-webkit-scrollbar { width: 6px; }

#fileList::-webkit-scrollbar-track,
#downloadFileList::-webkit-scrollbar-track { background: transparent; }

#fileList::-webkit-scrollbar-thumb,
#downloadFileList::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.14);
    border-radius: 10px;
}

#fileList::-webkit-scrollbar-thumb:hover,
#downloadFileList::-webkit-scrollbar-thumb:hover {
    background: rgba(94, 234, 212, 0.3);
}


/* =====================================================
   FILE / DOWNLOAD CARDS
===================================================== */

.file-card,
.download-card {
    width: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.018));
    color: var(--text);
    padding: 13px;
    margin-top: 9px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-size: 14px;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 7px 22px rgba(0, 0, 0, 0.15);
    transition: background 0.25s ease, border-color 0.25s ease;
}

.file-card:hover,
.download-card:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.025));
    border-color: var(--border-bright);
}

.file-card { flex-wrap: wrap; }

.file-info,
.download-info {
    flex: 1;
    min-width: 0;
}

.file-name,
.download-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size,
.download-size {
    color: var(--muted);
    font-size: 12px;
}

.download-sender {
    color: var(--muted-dim);
    font-size: 11.5px;
    margin-top: 2px;
}

.file-icon,
.download-icon {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    font-size: 17px;
}

.file-card small { color: var(--muted); font-size: 12px; }


/* =====================================================
   UPLOAD PROGRESS
===================================================== */

.file-progress-track {
    width: 100%;
    height: 6px;
    margin-top: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.file-progress-fill {
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--teal), #34d9c4);
    transition: width 0.2s ease;
}

.file-status {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 11px;
}

.file-resume-btn {
    flex-shrink: 0;
    padding: 6px 12px;
    border-radius: 10px;
    border: 1px solid var(--teal-line);
    background: var(--teal-soft);
    color: var(--teal);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.file-pause-btn,
.download-pause-btn {
    flex-shrink: 0;
    padding: 6px 10px;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--muted);
    font-size: 12px;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.file-pause-btn:hover,
.download-pause-btn:hover {
    color: var(--text);
    border-color: var(--border-bright);
    background: rgba(255, 255, 255, 0.07);
}

.file-cancel-btn,
.download-cancel-btn {
    flex-shrink: 0;
    padding: 6px 10px;
    border-radius: 9px;
    border: 1px solid var(--danger-line);
    background: var(--danger-soft);
    color: var(--danger);
    font-size: 12px;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.file-cancel-btn:hover,
.download-cancel-btn:hover { opacity: 0.85; }

.file-cancel-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.file-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    margin-left: auto;
}

.download-button,
.delete-button {
    padding: 9px 13px;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s var(--ease), background 0.2s ease, border-color 0.2s ease;
}

.download-button {
    border: 1px solid var(--teal-line);
    background: var(--teal-soft);
    color: var(--teal);
}

.download-button:hover {
    background: rgba(94, 234, 212, 0.22);
    border-color: rgba(94, 234, 212, 0.4);
}

.delete-button {
    border: 1px solid var(--danger-line);
    background: var(--danger-soft);
    color: var(--danger);
}

.delete-button:hover {
    background: rgba(251, 113, 133, 0.22);
    border-color: rgba(251, 113, 133, 0.4);
}

.download-button:active,
.delete-button:active { transform: scale(0.95); }

.file-check {
    width: 19px;
    height: 19px;
    flex-shrink: 0;
    appearance: none;
    border-radius: 6px;
    border: 1.5px solid var(--border-bright);
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    position: relative;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.file-check:hover { border-color: var(--teal-line); }

.file-check:checked {
    background: var(--teal);
    border-color: var(--teal);
}

.file-check:checked::after {
    content: "✓";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    color: #06110d;
}

#downloadActions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
    width: 100%;
}

#downloadSelectedButton,
#deleteSelectedButton {
    flex: 1;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 650;
    cursor: pointer;
    transition: transform 0.3s var(--ease), opacity 0.2s ease;
}

#downloadSelectedButton {
    border: 1px solid var(--teal-line);
    background: linear-gradient(135deg, rgba(94, 234, 212, 0.2), rgba(94, 234, 212, 0.08));
    color: var(--teal);
}

#deleteSelectedButton {
    border: 1px solid var(--danger-line);
    background: linear-gradient(135deg, rgba(251, 113, 133, 0.16), rgba(251, 113, 133, 0.05));
    color: var(--danger);
}

#downloadSelectedButton:active:not(:disabled),
#deleteSelectedButton:active:not(:disabled) { transform: scale(0.97); }


/* =====================================================
   QUICK SHARE (BEAM TEXT)
   Same tokens as the rest of the app; violet stands in
   for the accent here instead of teal to signal "you're
   in a different tool" without changing the whole theme.
===================================================== */

#quickShareSection {
    display: none;
    width: 100%;
    padding: 26px 28px 30px;
    border-radius: var(--radius-lg);

    background: linear-gradient(150deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015)), var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

#quickShareSection .container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    gap: 18px;
    text-align: left;
}

#quickShareSection .top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
    flex-wrap: wrap;
}

.top-heading { max-width: 460px; }

#quickShareSection h1 {
    margin: 0;
    font-size: clamp(24px, 4vw, 28px);
    font-weight: 700;
    letter-spacing: -1px;
}

#topActions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

#deviceBar {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

#deviceInfo {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#deviceName {
    color: var(--text);
    font-size: 15px;
    font-weight: 650;
}

#connection {
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

#connection::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

#connection.connected { color: var(--violet); }
#connection.connected::before {
    background: var(--violet);
    box-shadow: 0 0 0 4px rgba(179, 157, 251, 0.1), 0 0 14px rgba(179, 157, 251, 0.4);
}

#connection.disconnected { color: var(--danger); }
#connection.disconnected::before { background: var(--danger); box-shadow: 0 0 0 4px rgba(251, 113, 133, 0.1); }

#deviceCount {
    color: var(--muted);
    font-size: 13px;
}

#composer {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#editor {
    width: 100%;
    min-height: 150px;
    resize: vertical;
    border: 1px solid var(--border);
    outline: none;
    border-radius: 12px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.25);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.5;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

#editor::placeholder { color: var(--muted-dim); }

#editor:focus {
    border-color: var(--violet-line);
    box-shadow: 0 0 0 3px rgba(179, 157, 251, 0.14);
}

.composer-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.composer-hint {
    color: var(--muted-dim);
    font-size: 11.5px;
    font-family: var(--font-mono);
}

#shareButton {
    padding: 11px 20px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, rgba(179, 157, 251, 0.22), rgba(179, 157, 251, 0.08));
    color: var(--violet);
    border: 1px solid var(--violet-line);
    font-size: 13px;
    font-weight: 650;
    cursor: pointer;
    min-width: 120px;
    transition: transform 0.3s var(--ease), background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

#shareButton:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(179, 157, 251, 0.3), rgba(179, 157, 251, 0.12));
    border-color: rgba(179, 157, 251, 0.45);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22), 0 0 25px rgba(179, 157, 251, 0.08);
}

#shareButton:active:not(:disabled) { transform: scale(0.96); }

#itemsHeader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}

#itemsTitle {
    font-size: 16px;
    font-weight: 650;
}

#itemsCount {
    font-size: 13px;
    color: var(--muted);
}

#items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#quickShareSection .empty {
    background: rgba(255, 255, 255, 0.025);
    border: 1px dashed var(--border);
    border-radius: 14px;
    padding: 35px 20px;
    text-align: center;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

#quickShareSection .item {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.018));
    border: 1px solid var(--border);
    border-left: 3px solid var(--violet);
    border-radius: 15px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 7px 22px rgba(0, 0, 0, 0.15);
    transition: background 0.25s ease;
    animation: chipIn 0.3s var(--ease);
}

#quickShareSection .item:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.025));
}

.itemTop {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.itemSender {
    color: var(--violet);
    font-size: 13px;
    font-weight: 650;
}

.itemTime {
    color: var(--muted);
    font-size: 12px;
}

.itemText {
    white-space: pre-wrap;
    word-break: break-word;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 10px;
    padding: 13px;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.5;
    max-height: 300px;
    overflow-y: auto;
}

.itemActions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.copyItemButton,
.deleteButton {
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 650;
    cursor: pointer;
    border: 1px solid transparent;
    transition: transform 0.3s var(--ease), background 0.2s ease, border-color 0.2s ease;
}

.copyItemButton {
    color: var(--violet);
    background: var(--violet-soft);
    border-color: var(--violet-line);
}

.copyItemButton:hover {
    background: rgba(179, 157, 251, 0.24);
    border-color: rgba(179, 157, 251, 0.45);
}

.deleteButton {
    color: var(--danger);
    background: var(--danger-soft);
    border-color: var(--danger-line);
}

.deleteButton:hover {
    background: rgba(251, 113, 133, 0.22);
    border-color: rgba(251, 113, 133, 0.4);
}

.copyItemButton:active,
.deleteButton:active { transform: scale(0.95); }


/* =====================================================
   ACCESS GATE
===================================================== */

#accessGateModeRow {
    display: flex;
    gap: 10px;
    margin-bottom: 6px;
}

.gate-mode-button {
    flex: 1;
    padding: 12px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
    cursor: pointer;
    transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

.gate-mode-button:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
}

.gate-mode-button.active-gate-mode {
    color: var(--teal);
    background: var(--teal-soft);
    border-color: var(--teal-line);
}

#accessGatePasswordArea {
    margin-top: 14px;
}

#accessGatePasswordInput {
    width: 100%;
    padding: 13px 14px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 14.5px;
    outline: none;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

#accessGatePasswordInput::placeholder { color: var(--muted-dim); }

#accessGatePasswordInput:focus {
    border-color: var(--teal-line);
    box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.14);
}

.gate-hint {
    margin: 10px 0 0 !important;
    font-size: 12px !important;
    color: var(--muted-dim) !important;
}

.gate-disclaimer {
    color: var(--danger) !important;
    opacity: 0.85;
}

.room-status-note {
    margin: 10px 0 0;
    font-size: 12px;
    line-height: 1.5;
    color: var(--muted);
}

.room-status-note.room-note-password {
    color: var(--danger);
    opacity: 0.85;
}


/* =====================================================
   DEVICE NAME MODAL
===================================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(4, 6, 9, 0.72);
    backdrop-filter: blur(6px);

    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-card {
    width: min(420px, 100%);
    padding: 28px 26px 24px;
    border-radius: var(--radius-lg);

    background: linear-gradient(150deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.02)), var(--surface);
    border: 1px solid var(--border-bright);
    box-shadow: var(--shadow);

    animation: modalIn 0.28s var(--ease);
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(10px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-card h2 {
    margin: 0 0 8px;
    font-size: 19px;
    font-weight: 650;
    letter-spacing: -0.3px;
}

.modal-card p {
    margin: 0 0 18px;
    color: var(--muted);
    font-size: 13.5px;
    line-height: 1.5;
}

#deviceNameInput {
    width: 100%;
    padding: 13px 14px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 14.5px;
    outline: none;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

#deviceNameInput::placeholder { color: var(--muted-dim); }

#deviceNameInput:focus {
    border-color: var(--teal-line);
    box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.14);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}


/* =====================================================
   SHARE LINK / QR CODE MODAL
===================================================== */

#shareLinkQrWrap {
    display: flex;
    justify-content: center;
    margin: 4px 0 18px;
}

#shareLinkQrImage {
    width: 200px;
    height: 200px;
    border-radius: 12px;
    background: #ffffff;
    padding: 10px;
}

#shareLinkRow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border);
}

#shareLinkText {
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--text);
    word-break: break-all;
}

#copyShareLinkButton {
    flex-shrink: 0;
}

.primary-button {
    padding: 11px 20px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, rgba(94, 234, 212, 0.22), rgba(94, 234, 212, 0.08));
    color: var(--teal);
    border: 1px solid var(--teal-line);
    font-size: 13px;
    font-weight: 650;
    cursor: pointer;
    transition: transform 0.3s var(--ease), background 0.25s ease;
}

.primary-button:hover {
    background: linear-gradient(135deg, rgba(94, 234, 212, 0.3), rgba(94, 234, 212, 0.12));
}

.primary-button:active { transform: scale(0.96); }


/* =====================================================
   SUCCESS TOAST
===================================================== */

#successMessage {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(120%);
    z-index: 60;

    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px 14px 20px;
    border-radius: 999px;

    background: linear-gradient(135deg, rgba(94, 234, 212, 0.18), var(--surface-solid));
    border: 1px solid var(--teal-line);
    box-shadow: var(--shadow);
    color: var(--text);
    font-size: 13.5px;
    font-weight: 600;

    max-width: min(420px, 92vw);
    opacity: 0;
    transition: transform 0.4s var(--ease), opacity 0.3s ease;
    pointer-events: none;
}

#successMessage.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

#closeSuccess {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

#closeSuccess:hover { background: rgba(255, 255, 255, 0.14); }


/* =====================================================
   RESPONSIVE
===================================================== */

@media (max-width: 700px) {

    body { padding: 18px 12px; }

    .container {
        width: 100%;
        min-height: calc(100vh - 36px);
        padding: 36px 18px 34px;
        border-radius: 22px;
    }

    .brand-mark { width: 54px; height: 54px; border-radius: 17px; }
    .brand-mark span { font-size: 22px; }
    .brand h1 { font-size: 30px; }

    .subtitle { margin-bottom: 26px; font-size: 14px; }

    .network-panel-header { align-items: flex-start; }

    #transferModes { max-width: 100%; }

    .file-actions { gap: 6px; }

    .download-button, .delete-button { padding: 8px 10px; font-size: 12px; }

    #downloadActions { flex-direction: column; }

    #quickShareSection { padding: 18px 16px 22px; border-radius: 18px; }

    #quickShareSection .top { flex-direction: column; align-items: stretch; }

    #topActions { width: 100%; }

    #topActions button { flex: 1; }

    #deviceBar { align-items: flex-start; }

    #composer { padding: 12px; }

    #editor { min-height: 130px; font-size: 14px; }

    .composer-footer { flex-direction: column; align-items: stretch; gap: 10px; }

    #shareButton { width: 100%; }

    .itemActions button { flex: 1; }
}


@media (max-width: 480px) {

    .container { padding-left: 14px; padding-right: 14px; }

    .brand-row { gap: 12px; }
    .brand h1 { font-size: 26px; letter-spacing: -1px; }
    .brand > span { font-size: 11px; }

    .primary-action, .secondary-action { min-height: 74px; }

    .button-icon { width: 42px; height: 42px; margin-right: 12px; }

    .button-content strong { font-size: 14px; }
    .button-content small { font-size: 11px; }

    .file-card, .download-card { padding: 11px; }

    .file-actions { flex-direction: column; align-items: stretch; }

    .device-chip-label { max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
}


/* Larger screens: give the card a touch more breathing room */
@media (min-width: 1000px) {
    .container { padding: 60px 72px 68px; }
}


/* =====================================================
   REDUCED MOTION
===================================================== */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}


/* =====================================================
   HOME SCREEN UPLOAD TOAST
===================================================== */

.upload-toast {
    width: 100%;
    margin-top: 14px;
    padding: 12px 16px;
    border-radius: var(--radius-md);

    display: flex;
    align-items: center;
    gap: 12px;

    background: linear-gradient(135deg, rgba(94, 234, 212, 0.14), var(--surface-solid));
    border: 1px solid var(--teal-line);
    box-shadow: var(--shadow-sm);

    animation: uploadToastIn 0.3s var(--ease);
}

@keyframes uploadToastIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.upload-toast-icon {
    flex-shrink: 0;
    font-size: 18px;
}

.upload-toast-body {
    flex: 1;
    min-width: 0;
}

#homeUploadToastText {
    display: block;
    color: var(--text);
    font-size: 12.5px;
    font-weight: 650;
    margin-bottom: 6px;
}

.upload-toast-track {
    width: 100%;
    height: 5px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

[data-theme="light"] .upload-toast-track {
    background: rgba(15, 23, 32, 0.1);
}

.upload-toast-fill {
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--teal), #34d9c4);
    transition: width 0.25s ease;
}


/* =====================================================
   THEME TOGGLE BUTTON
===================================================== */

#themeToggleButton {
    padding: 7px 10px;
    font-size: 14px;
}


/* =====================================================
   LIGHT THEME: CARD / PANEL TINT FIXES

   A handful of components lean on an "add a wash of white"
   overlay for their card look against the dark base - which
   is invisible once the base itself turns light. These
   swap in a matching "add a hint of shadow" version instead,
   scoped to data-theme="light" only so the original dark
   values above are untouched.
===================================================== */

[data-theme="light"] .network-panel {
    background: rgba(15, 23, 32, 0.035);
}

[data-theme="light"] .ghost-button {
    background: rgba(15, 23, 32, 0.04);
}

[data-theme="light"] .ghost-button:hover {
    background: rgba(15, 23, 32, 0.07);
}

[data-theme="light"] .file-card,
[data-theme="light"] .download-card {
    background: linear-gradient(135deg, rgba(15, 23, 32, 0.05), rgba(15, 23, 32, 0.02));
}

[data-theme="light"] .file-card:hover,
[data-theme="light"] .download-card:hover {
    background: linear-gradient(135deg, rgba(15, 23, 32, 0.07), rgba(15, 23, 32, 0.03));
}

[data-theme="light"] .file-icon,
[data-theme="light"] .download-icon {
    background: rgba(15, 23, 32, 0.05);
}

[data-theme="light"] #selectAllButton {
    background: rgba(15, 23, 32, 0.045);
}

[data-theme="light"] .gate-mode-button {
    background: rgba(15, 23, 32, 0.035);
}

[data-theme="light"] .gate-mode-button:hover {
    background: rgba(15, 23, 32, 0.06);
}

[data-theme="light"] #backButton {
    background: linear-gradient(135deg, rgba(15, 23, 32, 0.045), rgba(15, 23, 32, 0.018));
}

[data-theme="light"] #backButton:hover {
    background: linear-gradient(135deg, rgba(15, 23, 32, 0.07), rgba(15, 23, 32, 0.025));
}

[data-theme="light"] #fileList::-webkit-scrollbar-thumb,
[data-theme="light"] #downloadFileList::-webkit-scrollbar-thumb {
    background: rgba(15, 23, 32, 0.16);
}

[data-theme="light"] #closeSuccess {
    background: rgba(15, 23, 32, 0.08);
}

[data-theme="light"] #closeSuccess:hover {
    background: rgba(15, 23, 32, 0.14);
}

[data-theme="light"] #dropzone {
    background: var(--surface-2);
}

[data-theme="light"] #dropzone label {
    background: var(--surface);
    box-shadow: 0 2px 8px rgba(15, 23, 32, 0.06);
}
