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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #1a1a2e;
    color: #eee;
    min-height: 100vh;
    line-height: 1.5;
    font-size: 16px;
    overflow-x: hidden;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 15px;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2em;
    margin-bottom: 8px;
}

.subtitle {
    color: #888;
    font-size: 0.9em;
}

.actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 48px;
    min-width: 120px;
    text-align: center;
}

.btn-primary {
    background: #4CAF50;
    color: white;
}

.btn-primary:hover {
    background: #45a049;
}

.btn-secondary {
    background: #2196F3;
    color: white;
}

.btn-secondary:hover {
    background: #1976D2;
}

.btn-warning {
    background: #FF9800;
    color: white;
}

.btn-warning:hover {
    background: #F57C00;
}

.btn-small {
    padding: 10px 16px;
    font-size: 14px;
    min-height: 40px;
    min-width: auto;
}

.btn-icon {
    font-size: 1.2em;
}

.sessions-section {
    margin-top: 25px;
}

.sessions-section h2 {
    margin-bottom: 12px;
    color: #aaa;
    font-size: 1.1em;
}

.sessions-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.session-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: #16213e;
    border-radius: 8px;
    gap: 12px;
    flex-wrap: wrap;
}

.session-main {
    flex: 1;
    min-width: 150px;
}

.session-name {
    font-weight: 600;
    display: block;
    font-size: 0.95em;
}

.session-meta {
    color: #888;
    font-size: 0.8em;
}

.session-timer-small {
    color: #FF9800;
    font-size: 0.85em;
}

.session-actions-inline {
    display: flex;
    gap: 8px;
}

.loading {
    text-align: center;
    color: #888;
    padding: 25px;
}

.empty-state {
    text-align: center;
    color: #666;
    padding: 25px;
    font-size: 0.9em;
}

.error-message {
    color: #f44336;
    padding: 10px;
    border-radius: 5px;
    background: rgba(244, 67, 54, 0.1);
    font-size: 0.9em;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 15px;
}

.modal-content {
    background: #16213e;
    padding: 20px;
    border-radius: 12px;
    max-width: 400px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
    color: #888;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #fff;
}

.modal h2 {
    margin-bottom: 15px;
    font-size: 1.2em;
    padding-right: 30px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #aaa;
    font-size: 0.9em;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #333;
    border-radius: 6px;
    background: #1a1a2e;
    color: #fff;
    font-size: 16px;
    min-height: 48px;
}

.form-group input:focus {
    outline: none;
    border-color: #4CAF50;
}

.modal-result {
    text-align: center;
    margin-bottom: 15px;
}

.modal-hint {
    color: #888;
    font-size: 0.85em;
    margin-top: 8px;
}

.password-display {
    background: #1a1a2e;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
}

.password-display big {
    font-size: 2.5em;
    font-weight: 700;
    color: #4CAF50;
    letter-spacing: 4px;
}

.session-code-small {
    color: #888;
    font-size: 0.85em;
}

footer {
    text-align: center;
    color: #666;
    margin-top: 40px;
    font-size: 0.85em;
}

.session-container {
    max-width: 900px;
    padding: 10px;
}

.session-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #16213e;
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.btn-back {
    background: #555;
    color: #fff;
    text-decoration: none;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 14px;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
}

.btn-back:hover {
    background: #666;
}

.session-info {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.session-code,
.session-password {
    font-size: 0.9em;
}

.session-code strong,
.session-password strong {
    color: #4CAF50;
}

.session-timer {
    font-size: 1.3em;
    font-weight: 700;
    color: #FF9800;
}

.session-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.upload-zone {
    border: 2px dashed #333;
    border-radius: 12px;
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 15px;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.upload-zone:hover {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.05);
}

.upload-zone.dragover {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.1);
}

.upload-icon {
    font-size: 2.5em;
    display: block;
    margin-bottom: 8px;
}

.upload-content p {
    margin: 5px 0;
}

.upload-hint {
    color: #666;
    font-size: 0.85em;
}

.upload-progress {
    margin-top: 15px;
}

.upload-item {
    background: #16213e;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 8px;
    font-size: 0.9em;
}

.upload-item-queued {
    background: #1a2a4a;
    border-left: 3px solid #666;
}

.upload-item-name {
    font-weight: 600;
    margin-bottom: 6px;
    word-break: break-all;
}

.upload-item-progress {
    display: flex;
    align-items: center;
    gap: 10px;
}

.progress-bar {
    flex: 1;
    height: 10px;
    background: #333;
    border-radius: 4px;
    overflow: hidden;
    min-width: 80px;
}

.progress-fill {
    height: 100%;
    background: #4CAF50;
    transition: width 0.3s;
}

.progress-text {
    min-width: 40px;
    text-align: right;
    color: #888;
    font-size: 0.85em;
}

.upload-item-speed {
    color: #666;
    font-size: 0.8em;
    margin-top: 4px;
    word-break: break-all;
}

.files-section {
    margin-top: 15px;
}

.files-section h2 {
    margin-bottom: 12px;
    color: #aaa;
    font-size: 1.1em;
}

.files-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.file-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: #16213e;
    border-radius: 8px;
    gap: 12px;
    flex-wrap: nowrap;
}

.file-icon {
    font-size: 1.3em;
    flex-shrink: 0;
}

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

.file-name {
    font-weight: 600;
    font-size: 0.9em;
    word-break: break-all;
}

.file-meta {
    color: #888;
    font-size: 0.8em;
}

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

.file-actions .btn {
    padding: 8px 12px;
    font-size: 0.85em;
    min-height: 36px;
    min-width: auto;
}

.session-stats {
    margin-top: 15px;
    text-align: center;
    color: #888;
    font-size: 0.9em;
}

.pending-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.pending-item {
    background: #1a1a2e;
    padding: 12px;
    border-radius: 8px;
}

.pending-name {
    font-weight: 600;
    margin-bottom: 5px;
}

.pending-meta {
    color: #888;
    font-size: 0.85em;
    margin-bottom: 8px;
}

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

@media (max-width: 600px) {
    .container {
        padding: 10px;
    }

    header h1 {
        font-size: 1.8em;
    }

    .subtitle {
        font-size: 0.85em;
    }

    .actions {
        flex-direction: column;
        gap: 10px;
    }

    .btn {
        width: 100%;
        padding: 14px 20px;
    }

    .session-header {
        flex-direction: column;
        gap: 10px;
        padding: 10px 12px;
    }

    .btn-back {
        width: 100%;
        justify-content: center;
    }

    .session-info {
        flex-direction: column;
        gap: 8px;
        text-align: center;
        width: 100%;
    }

    .session-code,
    .session-password {
        font-size: 1em;
    }

    .session-timer {
        font-size: 1.2em;
    }

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

    .session-actions .btn {
        width: 100%;
    }

    .upload-zone {
        padding: 25px 15px;
    }

    .upload-icon {
        font-size: 2em;
    }

    .upload-item {
        padding: 10px;
    }

    .upload-item-progress {
        flex-direction: column;
        gap: 5px;
        align-items: stretch;
    }

    .progress-bar {
        min-width: auto;
    }

    .progress-text {
        text-align: left;
    }

    .upload-item-speed {
        font-size: 0.75em;
    }

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

    .file-info {
        width: 100%;
    }

    .file-name {
        font-size: 0.85em;
    }

    .file-meta {
        font-size: 0.75em;
    }

    .file-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .file-actions .btn {
        flex: 1;
    }

    .modal-content {
        padding: 15px;
        max-height: 95vh;
    }

    .modal h2 {
        font-size: 1.1em;
    }

    .password-display big {
        font-size: 2em;
    }

    .form-group input {
        font-size: 16px;
    }
}

@media (max-width: 400px) {
    body {
        font-size: 14px;
    }

    header h1 {
        font-size: 1.5em;
    }

    .btn {
        font-size: 14px;
        padding: 12px 16px;
    }

    .session-code strong,
    .session-password strong {
        font-size: 1.1em;
    }

    .file-item {
        padding: 10px;
    }
}

@media (hover: none) and (pointer: coarse) {
    .btn:hover {
        background: inherit;
    }

    .btn:active {
        transform: scale(0.98);
    }

    .upload-zone:active {
        border-color: #4CAF50;
        background: rgba(76, 175, 80, 0.1);
    }

    .session-item:active,
    .file-item:active {
        background: #1a2a4a;
    }
}

* {
    -webkit-tap-highlight-color: transparent;
}

input[type="password"] {
    -webkit-text-security: disc;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #1a1a2e;
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}