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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #8b5cf6;
    --success: #10b981;
    --danger: #ef4444;
    --text-dark: #1f2937;
    --text-light: #6b7280;
    --bg-light: #f9fafb;
    --border: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

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;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: float 20s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(-20px, 20px) rotate(5deg); }
}

.container {
    background: white;
    border-radius: 24px;
    box-shadow: var(--shadow-xl), 0 0 0 1px rgba(0, 0, 0, 0.05);
    max-width: 680px;
    width: 100%;
    overflow: hidden;
    position: relative;
    z-index: 1;
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

header {
    text-align: center;
    padding: 40px 40px 32px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    position: relative;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-container a {
    display: block;
    cursor: pointer;
}

.logo {
    width: 360px;
    max-width: 100%;
    height: auto;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.2));
    transition: transform 0.2s ease;
}

.logo:hover {
    transform: scale(1.02);
}

main {
    padding: 32px;
}

.intro {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.08));
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 16px;
    padding: 20px 24px;
    margin-bottom: 24px;
    line-height: 1.6;
}

.intro h3 {
    color: var(--primary);
    font-size: 1.1rem;
    margin-bottom: 12px;
    font-weight: 700;
}

.intro p {
    color: var(--text-dark);
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.intro strong {
    color: var(--primary);
    font-weight: 600;
}

.intro-note {
    background: rgba(99, 102, 241, 0.06);
    border-left: 3px solid var(--primary);
    padding: 12px 16px;
    border-radius: 0 8px 8px 0;
    margin-top: 12px !important;
    margin-bottom: 0 !important;
    font-size: 0.88rem;
}

.tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    background: var(--bg-light);
    padding: 6px;
    border-radius: 12px;
}

.tab {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-light);
    transition: all 0.2s ease;
}

.tab:hover {
    color: var(--text-dark);
    background: rgba(99, 102, 241, 0.05);
}

.tab.active {
    background: white;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.panel {
    display: none;
    animation: fadeIn 0.3s ease;
}

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

.panel.active {
    display: block;
}

.online-notice {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(5, 150, 105, 0.1));
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.online-notice::before {
    content: '💡';
    font-size: 1.1rem;
    flex-shrink: 0;
}

.online-notice p {
    color: var(--text-dark);
    font-size: 0.88rem;
    line-height: 1.5;
    margin: 0;
}

.upload-area {
    border: 2px dashed var(--border);
    border-radius: 16px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--bg-light);
    position: relative;
}

.upload-area::before {
    content: '📁';
    font-size: 4rem;
    display: block;
    margin-bottom: 16px;
    opacity: 0.5;
    transition: all 0.3s ease;
}

.upload-area:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.02);
    transform: translateY(-2px);
}

.upload-area:hover::before {
    opacity: 1;
    transform: scale(1.1);
}

.upload-area.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
    border-style: solid;
}

.upload-prompt p {
    font-size: 1.1rem;
    color: var(--text-dark);
    margin-bottom: 20px;
    font-weight: 500;
}

.upload-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

button {
    padding: 12px 28px;
    border: none;
    border-radius: 10px;
    background: var(--primary);
    color: white;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

button:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

button:active {
    transform: translateY(0);
}

button.secondary {
    background: white;
    color: var(--primary);
    border: 2px solid var(--primary);
}

button.secondary:hover {
    background: var(--primary);
    color: white;
}

.file-list {
    background: var(--bg-light);
    border-radius: 12px;
    padding: 20px;
    margin: 24px 0;
    border: 1px solid var(--border);
}

.file-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
}

.file-list-header h3 {
    color: var(--text-dark);
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

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

.file-list-actions button {
    padding: 8px 16px;
    font-size: 0.85rem;
}

.file-items {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 12px;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: white;
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.file-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.file-item-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.file-item-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.file-item-details {
    flex: 1;
    min-width: 0;
}

.file-item-name {
    font-weight: 500;
    color: var(--text-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-item-size {
    font-size: 0.85rem;
    color: var(--text-light);
}

.file-item-remove {
    padding: 6px 12px;
    font-size: 0.85rem;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.file-item-remove:hover {
    background: #dc2626;
    transform: scale(1.05);
}

.file-list-summary {
    padding-top: 12px;
    border-top: 1px solid var(--border);
    color: var(--text-dark);
    font-weight: 500;
    text-align: center;
}

.file-list-summary .separator {
    margin: 0 8px;
    color: var(--text-light);
}

.room-code {
    text-align: center;
    margin: 32px 0;
    padding: 28px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(139, 92, 246, 0.05));
    border-radius: 16px;
    border: 1px solid rgba(99, 102, 241, 0.1);
}

.room-code h3 {
    color: var(--text-dark);
    margin-bottom: 20px;
    font-size: 1.1rem;
    font-weight: 600;
}

.code-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.code-display span {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 4px;
    font-family: 'Courier New', monospace;
    background: white;
    padding: 12px 24px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 2px solid var(--primary-light);
}

.qrcode-sticker {
    position: fixed;
    right: calc(50% - 500px);
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    border: 3px solid var(--primary-light);
    z-index: 10;
}

.qrcode-sticker img {
    border-radius: 8px;
}

.qrcode-label {
    font-size: 0.8rem;
    color: var(--text-dark);
    font-weight: 600;
    margin-top: 8px;
    white-space: nowrap;
}

.hint {
    color: var(--text-light);
    font-size: 0.9rem;
    line-height: 1.5;
}

.status {
    text-align: center;
    padding: 20px;
    background: var(--bg-light);
    border-radius: 12px;
    margin: 24px 0;
    border: 1px solid var(--border);
}

.status p {
    color: var(--text-dark);
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.status p::before {
    content: '●';
    color: var(--success);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.progress {
    margin: 24px 0;
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: var(--bg-light);
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 12px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 20px;
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress p {
    text-align: center;
    color: var(--text-dark);
    font-weight: 600;
    font-size: 0.95rem;
}

.code-input {
    text-align: center;
}

.code-input label {
    display: block;
    margin-bottom: 16px;
    color: var(--text-dark);
    font-weight: 600;
    font-size: 1.05rem;
}

.code-input-boxes {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}

.code-box {
    width: 48px;
    height: 56px;
    font-size: 1.8rem;
    text-align: center;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-weight: 700;
    color: var(--primary);
    transition: all 0.2s ease;
    background: var(--bg-light);
}

.code-box:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.code-separator {
    font-size: 1.8rem;
    color: var(--text-light);
    font-weight: 700;
    margin: 0 4px;
}

footer {
    text-align: center;
    padding: 24px 40px;
    background: var(--bg-light);
    border-top: 1px solid var(--border);
}

footer p {
    color: var(--text-light);
    font-size: 0.85rem;
    line-height: 1.6;
    margin-bottom: 12px;
}

footer p::before {
    content: '🔐';
    margin-right: 6px;
}

.footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s ease;
    font-size: 0.85rem;
}

.footer-links a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.footer-links span {
    color: var(--border);
}

.footer-links select {
    background: var(--bg-light);
    border: 1px solid var(--border);
    color: var(--text-dark);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.footer-links select:hover {
    border-color: var(--primary);
}

.footer-links select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.footer-links select option {
    background: white;
    color: var(--text-dark);
}

.hidden {
    display: none !important;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.3s ease;
    position: relative;
}

.modal-content h2 {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: 24px 40px;
    margin: 0;
    border-radius: 16px 16px 0 0;
    font-size: 1.5rem;
}

.modal-body {
    padding: 32px 40px;
}

.modal-body h3 {
    color: var(--primary);
    font-size: 1.1rem;
    margin: 24px 0 12px;
}

.modal-body h3:first-child {
    margin-top: 0;
}

.modal-body p {
    color: var(--text-dark);
    line-height: 1.8;
    margin-bottom: 16px;
}

.modal-body ul {
    margin: 12px 0 16px 20px;
    color: var(--text-dark);
}

.modal-body li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    color: white;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Toast */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--success);
    z-index: 1000;
    animation: slideInRight 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 400px;
}

.toast.error {
    border-left-color: var(--danger);
}

.toast::before {
    content: '✓';
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--success);
    color: white;
    border-radius: 50%;
    font-weight: bold;
}

.toast.error::before {
    content: '✕';
    background: var(--danger);
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 640px) {
    .container {
        border-radius: 16px;
    }

    header {
        padding: 32px 24px 24px;
    }

    .logo {
        width: 260px;
    }

    main {
        padding: 24px;
    }

    .intro {
        padding: 16px 20px;
    }

    .tabs {
        flex-direction: column;
        gap: 8px;
    }

    .code-display {
        flex-direction: column;
    }

    .code-display span {
        font-size: 1.8rem;
        letter-spacing: 3px;
    }

    .qrcode-container img {
        width: 100px !important;
        height: 100px !important;
    }

    .qrcode-container::after {
        font-size: 0.7rem;
    }

    .qrcode-sticker {
        display: none;
    }

    .code-input-boxes {
        gap: 3px;
        flex-wrap: nowrap;
        max-width: 100%;
    }

    .code-box {
        width: 32px;
        height: 42px;
        font-size: 1.2rem;
        padding: 0;
    }

    .code-separator {
        font-size: 1.2rem;
        margin: 0 1px;
    }
}
