.download-spinner-text-wrap {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

#downloadSpinnerText {
    overflow-x: auto;
    white-space: nowrap;
    display: block;
    min-width: 0;
    flex: 1;
    scrollbar-width: none; /* Firefox */
}
#downloadSpinnerText::-webkit-scrollbar {
    display: none; /* Chrome, Safari */
}

#downloadSpinnerSpeed {
    flex-shrink: 0;
    margin-left: 12px;
    color: #32ffcf;
}
/* Spinner styles */
.spinner {
    width: 32px;
    height: 32px;
    border: 4px solid #163951;
    border-top: 4px solid #32ffcf;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 15px;
    display: inline-block;
    vertical-align: middle;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
/* Custom styled select to match button look */
.custom-select {
    background: linear-gradient(45deg, #32ffcf, #5cbeff);
    color: #111f28;
    border: none;
    padding: 14px 26px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
    margin: 5px;
    min-height: 48px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    box-shadow: 0 5px 15px rgba(50, 255, 207, 0.08);
}

.custom-select:focus {
    outline: none;
    box-shadow: 0 0 0 2px #32ffcf;
}

.custom-select option {
    background: #143144;
    color: #32ffcf;
    font-weight: 600;
    font-size: 16px;
}
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background: linear-gradient(135deg, #111f28 0%, #0B1519 100%);
    min-height: 100dvh;
    min-height: -webkit-fill-available;
    color: #fbfbfb;
}

.container {
    background: #143144;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    border: 1px solid #335e77;
}

/* Improved responsive layout */
@media (max-width: 768px) {
    body {
        padding: 12px;
    }

    .container {
        padding: 15px;
        border-radius: 12px;
    }
}

.unsupported-splash {
    text-align: center;
    padding: 30px 15px;
    background: #122430;
    border-radius: 15px;
    border: 2px solid #fa3a5d;
}

.unsupported-splash h2 {
    color: #fa3a5d;
    font-size: 1.8em;
    margin-bottom: 15px;
}

.unsupported-splash p {
    font-size: 1em;
    line-height: 1.5;
    margin-bottom: 12px;
    color: #bed0d6;
}

.browser-link {
    display: inline-block;
    background: linear-gradient(45deg, #32ffcf, #5cbeff);
    color: #111f28;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    margin-top: 15px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.browser-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(50, 255, 207, 0.4);
}

h1 {
    text-align: center;
    margin-bottom: 25px;
    background: linear-gradient(45deg, #32ffcf, #69ff8f);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 2.2em;
}

@media (max-width: 768px) {
    h1 {
        font-size: 1.8em;
        margin-bottom: 20px;
    }

    .unsupported-splash {
        padding: 20px 12px;
    }

    .unsupported-splash h2 {
        font-size: 1.5em;
    }
}

.section {
    margin-bottom: 20px;
    padding: 15px;
    border-radius: 10px;
    background: #122430;
    border-left: 4px solid #32ffcf;
}

@media (max-width: 768px) {
    .section {
        padding: 12px;
        margin-bottom: 15px;
    }
}

button {
    background: linear-gradient(45deg, #32ffcf, #5cbeff);
    color: #111f28;
    border: none;
    padding: 14px 26px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
    margin: 5px;
    min-height: 48px; /* Better touch target for mobile */
}

@media (max-width: 768px) {
    button {
        width: 100%;
        margin: 8px 0;
        padding: 16px;
    }
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(50, 255, 207, 0.4);
}

button:disabled {
    background: #335e77;
    color: #bed0d6;
    cursor: not-allowed;
    transform: none;
}

.status {
    padding: 10px;
    border-radius: 5px;
    margin: 10px 0;
    font-size: 0.95em;
}

.status.success {
    background-color: rgba(105, 255, 143, 0.2);
    color: #69ff8f;
    border: 1px solid #69ff8f;
}

.status.error {
    background-color: rgba(250, 58, 93, 0.2);
    color: #fa3a5d;
    border: 1px solid #fa3a5d;
}

.status.info {
    background-color: rgba(92, 190, 255, 0.2);
    color: #5cbeff;
    border: 1px solid #5cbeff;
}

.device-info {
    background: #0B1519;
    padding: 12px;
    border-radius: 8px;
    margin: 10px 0;
    border: 1px solid #163951;
    color: #bed0d6;
    font-size: 0.95em;
    overflow-wrap: break-word;
}

.transfer-text {
    color: #32ffcf;
    font-weight: 600;
}

.log {
    background: #071013;
    color: #bed0d6;
    padding: 12px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    max-height: 200px;
    overflow-y: auto;
    margin-top: 12px;
    border: 1px solid #163951;
    white-space: pre-wrap;
    font-size: 0.9em;
}

h3 {
    color: #32ffcf;
    margin-top: 0;
    font-size: 1.3em;
}

@media (max-width: 768px) {
    h3 {
        font-size: 1.2em;
    }
}

.log-controls {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
    flex-wrap: wrap;
}

.log-btn {
    background: #163951;
    color: #bed0d6;
    padding: 8px 12px;
    font-size: 14px;
    margin: 4px;
    min-height: 36px;
}

.file-queue {
    margin-top: 15px;
    background: #0B1519;
    border-radius: 8px;
    padding: 12px;
    border: 1px solid #163951;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #163951;
    flex-wrap: wrap;
}

.file-item:last-child {
    border-bottom: none;
}

.file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    margin-right: 8px;
}

.file-size {
    color: #bed0d6;
    margin: 0 8px;
    font-size: 0.9em;
    white-space: nowrap;
}

.file-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.queue-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.queue-title {
    font-weight: 600;
    color: #32ffcf;
    margin-right: 10px;
}

.queue-count {
    background: #163951;
    color: #bed0d6;
    padding: 4px 10px;
    border-radius: 10px;
    font-size: 0.9em;
}

.btn-remove {
    background: #ff3232;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 13px;
    min-height: 32px;
}

.file-controls {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .file-controls {
        flex-direction: column;
    }

    .file-controls button {
        width: 100%;
    }
}

.btn-add {
    background: linear-gradient(45deg, #69ff8f, #32ffcf);
}

.btn-clear {
    background: linear-gradient(45deg, #ff3232, #ff5c5c);
}

.device-list {
    background: #0B1519;
    border-radius: 8px;
    padding: 12px;
    margin: 10px 0;
    border: 1px solid #163951;
}

.device-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #163951;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.device-list-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.device-name {
    flex: 1;
    color: #bed0d6;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 8px;
}

.device-id {
    color: #5cbeff;
    font-size: 0.85em;
    margin-right: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 40%;
}

.hidden {
    display: none;
}

.connection-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(45deg, #32ffcf, #69ff8f);
    color: #111f28;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(50, 255, 207, 0.3);
    font-weight: 600;
    font-size: 14px;
    z-index: 1000;
    transform: translateX(400px);
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
    opacity: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 2px solid rgba(50, 255, 207, 0.5);
    max-width: 350px;
}

@media (max-width: 768px) {
    .connection-toast {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
        padding: 12px 16px;
    }
}

.connection-toast.show {
    transform: translateX(0);
    opacity: 1;
}

.connection-toast.disconnect {
    background: linear-gradient(45deg, #ff3232, #ff5c5c);
    color: white;
    box-shadow: 0 10px 30px rgba(255, 50, 50, 0.3);
    border: 2px solid rgba(255, 50, 50, 0.5);
}

.connection-toast.info {
    background: linear-gradient(45deg, #5cbeff, #32ffcf);
    color: #111f28;
    box-shadow: 0 10px 30px rgba(92, 190, 255, 0.3);
    border: 2px solid rgba(92, 190, 255, 0.5);
}

.connection-toast.success {
    background: linear-gradient(45deg, #69ff8f, #32ffcf);
    color: #111f28;
    box-shadow: 0 10px 30px rgba(105, 255, 143, 0.3);
    border: 2px solid rgba(105, 255, 143, 0.5);
}

.connection-toast.error {
    background: linear-gradient(45deg, #ff3232, #ff5c5c);
    color: white;
    box-shadow: 0 10px 30px rgba(255, 50, 50, 0.3);
    border: 2px solid rgba(255, 50, 50, 0.5);
}

.toast-icon {
    font-size: 18px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.toast-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    margin: 0;
    margin-left: 10px;
    opacity: 0.7;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.toast-close:hover {
    opacity: 1;
}

.progress-bar-container {
    margin: 10px 0;
}

.progress-bar {
    height: 8px;
    background: #163951;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 4px;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #32ffcf, #5cbeff);
    transition: width 0.3s ease;
}

.time-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    font-size: 0.85em;
    margin-top: 8px;
}

.time-info div {
    display: flex;
    justify-content: space-between;
}

/* Orientation-specific adjustments */
@media (max-width: 768px) and (orientation: portrait) {
    .device-list-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .device-id {
        margin: 5px 0;
        max-width: 100%;
    }

    .file-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .file-actions {
        margin-top: 8px;
        width: 100%;
        justify-content: flex-end;
    }
}

@media (max-width: 768px) and (orientation: landscape) {
    body {
        padding: 10px;
    }

    .container {
        padding: 12px;
    }

    h1 {
        font-size: 1.6em;
    }

    .section {
        padding: 10px;
    }
}
