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

:root {
    --bg-app: #1e1e1e;
    --bg-pane: #252526;
    --bg-header: #333333;
    --text-primary: #d4d4d4;
    --text-secondary: #808080;
    --border: #3c3c3c;
    --accent: #0e639c;
    --accent-hover: #1177bb;
    --success: #4ec9b0;
}

body {
    font-family: 'Consolas', 'Monaco', monospace;
    background: var(--bg-app);
    color: var(--text-primary);
    min-height: 100vh;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background: var(--bg-header);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 0.5rem;
}

.header h1 {
    font-size: 1rem;
    font-weight: 500;
}

.header-controls {
    display: flex;
    gap: 0.5rem;
}

.btn-primary, .btn-secondary, .btn-small {
    padding: 0.4rem 0.8rem;
    border: none;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

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

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

.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
    background: var(--bg-app);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-small:hover {
    background: var(--border);
    color: var(--text-primary);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    gap: 1rem;
    overflow: auto;
}

.upload-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.drop-zone {
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-pane);
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--accent);
    background: rgba(14, 99, 156, 0.1);
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.drop-icon {
    font-size: 2.5rem;
    color: var(--text-secondary);
    font-weight: 300;
}

.drop-zone p {
    color: var(--text-secondary);
}

.drop-zone .hint {
    font-size: 0.75rem;
}

.preview {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-pane);
    border-radius: 6px;
}

.preview.hidden {
    display: none;
}

.preview img {
    max-width: 120px;
    max-height: 120px;
    object-fit: contain;
    border-radius: 4px;
    background: repeating-conic-gradient(#333 0% 25%, #444 0% 50%) 50% / 16px 16px;
}

.file-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.85rem;
}

.file-info span:first-child {
    color: var(--text-primary);
    font-weight: 500;
}

.file-info span:not(:first-child) {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.file-info .warning {
    color: #f0ad4e;
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
    background: rgba(240, 173, 78, 0.15);
    border-radius: 4px;
    margin-top: 0.25rem;
}

.file-info .warning.hidden {
    display: none;
}

.output-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.output-section.hidden {
    display: none;
}

.output-box {
    background: var(--bg-pane);
    border-radius: 6px;
    overflow: hidden;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0.75rem;
    background: var(--bg-header);
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.length-info {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

textarea {
    width: 100%;
    padding: 0.75rem;
    background: transparent;
    border: none;
    color: var(--success);
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.8rem;
    resize: none;
    outline: none;
    line-height: 1.5;
    min-height: 80px;
}

.footer {
    padding: 0.4rem 1rem;
    background: var(--bg-header);
    border-top: 1px solid var(--border);
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.toast {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    background: var(--success);
    color: var(--bg-app);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.2s;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

@media (min-width: 768px) {
    .preview {
        flex-direction: row;
    }

    .preview img {
        max-width: 150px;
        max-height: 150px;
    }
}
