:root {
    --bg-primary: #0a0e27;
    --bg-secondary: #151b3d;
    --bg-card: #1a2142;
    --accent: #00d9ff;
    --accent-glow: rgba(0, 217, 255, 0.3);
    --text-primary: #e8edf5;
    --text-secondary: #8b95b8;
    --success: #00ff88;
    --error: #ff4757;
    --border: rgba(255, 255, 255, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
}

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

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

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--accent), #00ff88);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

.status-bar {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.status-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.status-item .label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-item .value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
}

.upload-section {
    margin-bottom: 40px;
}

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

.upload-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, var(--accent-glow), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.upload-area:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.upload-area:hover::before {
    opacity: 1;
}

.upload-area.dragover {
    border-color: var(--accent);
    background: rgba(0, 217, 255, 0.05);
}

.upload-area.dragover::before {
    opacity: 1;
}

.preview-area {
    background: var(--bg-card);
    border: 2px solid var(--accent);
    border-radius: 16px;
    padding: 20px;
    position: relative;
    margin-top: 20px;
}

.preview-area img {
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: contain;
    border-radius: 8px;
}

.btn-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-primary);
    border: 2px solid var(--accent);
    color: var(--accent);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close:hover {
    background: var(--accent);
    color: var(--bg-primary);
    transform: rotate(90deg);
}

.queue-status {
    background: var(--bg-card);
    border: 2px solid var(--accent);
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
}

.queue-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    gap: 20px;
}

.queue-position,
.queue-state {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.queue-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.queue-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
    font-family: 'Courier New', monospace;
}

.queue-state-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.queue-state-text.processing {
    color: var(--accent);
    animation: pulse 1.5s ease-in-out infinite;
}

.queue-state-text.completed {
    color: var(--success);
}

.queue-state-text.failed {
    color: var(--error);
}

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

.queue-progress {
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    overflow: hidden;
}

.queue-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--success));
    width: 0%;
    transition: width 0.3s ease;
}

.upload-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    color: var(--accent);
    position: relative;
    z-index: 1;
}

.upload-text {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
}

.upload-hint {
    color: var(--text-secondary);
    font-size: 0.9rem;
    position: relative;
    z-index: 1;
}

.progress-bar {
    margin-top: 20px;
    height: 4px;
    background: var(--bg-secondary);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--success));
    width: 0%;
    transition: width 0.3s ease;
    animation: progress-animation 1.5s ease-in-out infinite;
}

@keyframes progress-animation {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

.message {
    margin-top: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    font-size: 0.95rem;
    display: none;
}

.message.success {
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid var(--success);
    color: var(--success);
    display: block;
}

.message.error {
    background: rgba(255, 71, 87, 0.1);
    border: 1px solid var(--error);
    color: var(--error);
    display: block;
}

.text-section {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 30px;
    border: 1px solid var(--border);
    margin-bottom: 30px;
}

.text-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.text-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.text-display {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 20px;
    min-height: 150px;
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 20px;
    border: 1px solid var(--border);
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    line-height: 1.8;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.text-display .placeholder {
    color: var(--text-secondary);
    font-style: italic;
    text-align: center;
    padding: 40px 20px;
}

.text-display::-webkit-scrollbar {
    width: 8px;
}

.text-display::-webkit-scrollbar-track {
    background: var(--bg-card);
    border-radius: 4px;
}

.text-display::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 4px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
}

.btn svg {
    width: 20px;
    height: 20px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #00ff88);
    color: var(--bg-primary);
    width: 100%;
    justify-content: center;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--accent-glow);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
}

footer {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

footer code {
    background: var(--bg-card);
    padding: 4px 8px;
    border-radius: 4px;
    color: var(--accent);
    font-family: 'Courier New', monospace;
}

@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }

    .status-bar {
        flex-direction: column;
        gap: 15px;
    }

    .upload-area {
        padding: 40px 20px;
    }

    .text-section {
        padding: 20px;
    }
}
