* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #667eea;
    --primary-hover: #5568d3;
    --success: #10b981;
    --bg: #f5f7fa;
    --card-bg: #ffffff;
    --text: #1f2937;
    --text-secondary: #6b7280;
    --border: #e5e7eb;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 600px;
    margin: 0 auto;
}

.header {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 30px 20px;
    text-align: center;
    margin-bottom: 20px;
    box-shadow: var(--shadow-lg);
}

.header h1 {
    color: var(--text);
    font-size: 32px;
    margin-bottom: 8px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

.mode-selector {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.mode-btn {
    flex: 1;
    padding: 16px 24px;
    border: none;
    background: var(--card-bg);
    border-radius: 16px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: var(--shadow);
}

.mode-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.mode-btn.active {
    background: var(--primary);
    color: white;
}

.mode-btn .icon {
    font-size: 24px;
}

.info-box {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.info-box p {
    color: #856404;
    font-size: 14px;
    margin-bottom: 8px;
}

.info-box ol {
    color: #856404;
    font-size: 13px;
    padding-left: 20px;
    line-height: 1.6;
}

.panel {
    display: block;
}

.step {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.step-number {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
}

.step-content h3 {
    color: var(--text);
    font-size: 18px;
    margin-bottom: 8px;
}

.step-content .desc {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 16px;
}

.upload-area {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: var(--bg);
}

.upload-area:hover {
    border-color: var(--primary);
    background: #f0f4ff;
}

.upload-area.dragover {
    border-color: var(--primary);
    background: #e0e7ff;
}

#file-input {
    display: none;
}

.upload-label {
    cursor: pointer;
}

.upload-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
}

.upload-label p {
    color: var(--text-secondary);
    font-size: 14px;
}

.file-list {
    margin-top: 16px;
}

.file-item {
    background: var(--bg);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.file-info {
    flex: 1;
    overflow: hidden;
}

.file-name {
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    color: var(--text-secondary);
    font-size: 12px;
    margin-top: 4px;
}

.file-remove {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    padding: 8px;
    font-size: 18px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.file-remove:hover {
    opacity: 1;
}

.code-box {
    display: flex;
    gap: 8px;
}

.code-box input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    letter-spacing: 2px;
    background: var(--bg);
}

.code-box input:focus {
    outline: none;
    border-color: var(--primary);
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn.primary {
    background: linear-gradient(135deg, #3973ff 0%, #7cb0fd 100%);
    color: white;
}

.btn.primary:hover {
    background: linear-gradient(135deg, #2d62e8 0%, #6ba4f7 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(57, 115, 255, 0.3);
}

.btn.primary:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    opacity: 0.7;
    transform: none;
    box-shadow: none;
}

.btn.primary:disabled:hover {
    background: #9ca3af;
    transform: none;
    box-shadow: none;
}

.btn.secondary {
    background: var(--bg);
    color: var(--text);
}

.btn.secondary:hover {
    background: #e5e7eb;
}

.status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: var(--bg);
    border-radius: 8px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-secondary);
    animation: pulse 2s infinite;
}

.status-dot.connected {
    background: var(--success);
}

.status-dot.sending,
.status-dot.receiving {
    background: #f59e0b;
}

.status-dot.completed {
    background: var(--success);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-text {
    color: var(--text);
    font-size: 14px;
}

.progress-container {
    margin-top: 16px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s;
    border-radius: 4px;
}

.progress-text {
    text-align: center;
    margin-top: 8px;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
}

.received-files {
    margin-top: 16px;
}

.received-file {
    background: var(--bg);
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.received-file-icon {
    font-size: 36px;
    flex-shrink: 0;
}

.received-file-info {
    flex: 1;
    overflow: hidden;
}

.received-file-name {
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.received-file-size {
    color: var(--text-secondary);
    font-size: 12px;
    margin-top: 4px;
}

.download-btn {
    padding: 8px 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    flex-shrink: 0;
}

.download-btn:hover {
    background: var(--primary-hover);
}

.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
}

/* 移动端适配 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        max-width: 100%;
    }

    .header h1 {
        font-size: 24px;
    }

    .mode-btn {
        padding: 12px 16px;
        font-size: 14px;
    }

    .step {
        padding: 16px;
        gap: 12px;
    }

    .step-number {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .step-content h3 {
        font-size: 16px;
    }

    .upload-area {
        padding: 30px 16px;
    }

    .upload-icon {
        font-size: 36px;
    }

    .code-box {
        flex-direction: column;
    }

    .code-box input {
        padding: 10px;
        font-size: 14px;
    }

    .btn {
        padding: 10px 20px;
        font-size: 13px;
    }

    /* 文件列表适配 */
    .file-item {
        padding: 10px;
        flex-direction: row;
        align-items: center;
    }

    .file-info {
        flex: 1;
        min-width: 0;
    }

    .file-name {
        font-size: 13px;
    }

    .file-size {
        font-size: 11px;
    }

    .file-remove {
        padding: 6px;
        font-size: 20px;
    }

    /* 接收的文件列表适配 */
    .received-file {
        padding: 12px;
        flex-wrap: nowrap;
    }

    .received-file-icon {
        font-size: 32px;
    }

    .received-file-name {
        font-size: 13px;
    }

    .received-file-size {
        font-size: 11px;
    }

    .download-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .mode-selector {
        flex-direction: column;
    }

    .mode-btn {
        width: 100%;
    }

    .step {
        padding: 12px;
    }

    .step-number {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    .step-content h3 {
        font-size: 15px;
    }

    .upload-area {
        padding: 24px 12px;
    }

    .upload-icon {
        font-size: 32px;
    }

    .upload-label p {
        font-size: 13px;
    }

    /* 更小的文件列表样式 */
    .file-item {
        padding: 8px;
    }

    .file-name {
        font-size: 12px;
    }

    .file-size {
        font-size: 10px;
    }

    .file-remove {
        font-size: 18px;
    }

    /* 连接码输入框适配 */
    #receive-code {
        font-size: 12px !important;
        padding: 10px !important;
    }

    /* 接收文件列表 */
    .received-file {
        padding: 10px;
    }

    .received-file-name {
        font-size: 12px;
    }

    .download-btn {
        padding: 6px 10px;
        font-size: 11px;
    }
}

/* 超小屏幕适配 */
@media (max-width: 360px) {
    .header h1 {
        font-size: 20px;
    }

    .step-number {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }

    .upload-icon {
        font-size: 28px;
    }
}
