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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #0d1117;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    color: #e6edf3;
}

.container {
    background: #161b22;
    border-radius: 16px;
    padding: 48px;
    max-width: 700px;
    width: 100%;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    border: 1px solid #30363d;
}

h1 {
    color: #e6edf3;
    margin-bottom: 8px;
    text-align: center;
    font-size: 32px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.subtitle {
    color: #8b949e;
    text-align: center;
    margin-bottom: 40px;
    font-size: 15px;
    font-weight: 400;
}

.upload-area {
    border: 2px dashed #30363d;
    border-radius: 12px;
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 20px;
    background: #0d1117;
}

.upload-area:hover {
    border-color: #58a6ff;
    background: #161b22;
}

.upload-area:focus-within {
    outline: 2px solid #58a6ff;
    outline-offset: 2px;
}

.upload-area.dragover {
    border-color: #58a6ff;
    background: #1c2128;
}

#fileInput {
    display: none;
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 12px;
    color: #58a6ff;
    font-weight: 300;
}

.upload-area p {
    color: #e6edf3;
    font-size: 15px;
}

.upload-area p:first-of-type strong {
    font-weight: 600;
}

.upload-area p:last-of-type {
    color: #8b949e;
    font-size: 13px;
    margin-top: 8px;
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 24px 0;
    color: #8b949e;
    font-size: 13px;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #30363d;
}

.divider span {
    padding: 0 16px;
}

.username-section {
    margin-bottom: 32px;
}

.username-input-group {
    display: flex;
    gap: 12px;
    align-items: stretch;
}

.username-input-group input[type="text"] {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #30363d;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.2s;
    background: #0d1117;
    color: #e6edf3;
    min-height: 48px;
}

.username-input-group input[type="text"]:focus {
    outline: 2px solid #58a6ff;
    outline-offset: 0;
    border-color: #58a6ff;
}

.username-input-group input[type="text"]:hover {
    border-color: #58a6ff;
}

.username-input-group input[type="text"]::placeholder {
    color: #6e7681;
}

.fetch-btn {
    padding: 12px 24px;
    background: #21262d;
    color: #e6edf3;
    border: 1px solid #30363d;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    min-height: 48px;
}

.fetch-btn:hover {
    background: #30363d;
    border-color: #58a6ff;
}

.fetch-btn:focus {
    outline: 2px solid #58a6ff;
    outline-offset: 2px;
}

.fetch-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.preview-section {
    margin: 32px 0;
    display: none;
}

.preview-section.active {
    display: block;
}

.preview-section h3 {
    color: #e6edf3;
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 12px;
}

#preview {
    max-width: 100%;
    border: 1px solid #30363d;
    border-radius: 8px;
    image-rendering: pixelated;
    display: block;
    margin: 0 auto;
    background: #0d1117;
}

.options {
    margin: 32px 0;
}

.option-group {
    margin-bottom: 24px;
}

.option-group > label {
    display: block;
    margin-bottom: 12px;
    color: #e6edf3;
    font-weight: 600;
    font-size: 15px;
}

input[type="number"] {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #30363d;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.2s;
    background: #0d1117;
    color: #e6edf3;
}

input[type="number"]:focus {
    outline: 2px solid #58a6ff;
    outline-offset: 0;
    border-color: #58a6ff;
}

input[type="number"]:hover {
    border-color: #58a6ff;
}

.checkbox-group {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 12px;
}

.block-selector {
    margin-top: 12px;
}

.selected-blocks {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    min-height: 40px;
    padding: 8px;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 8px;
}

.block-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #21262d;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #e6edf3;
    font-size: 13px;
    transition: all 0.2s;
}

.block-chip:hover {
    background: #30363d;
}

.block-chip button {
    background: none;
    border: none;
    color: #8b949e;
    cursor: pointer;
    padding: 0;
    font-size: 16px;
    line-height: 1;
    transition: color 0.2s;
}

.block-chip button:hover {
    color: #ff7b72;
}

.block-dropdown {
    position: relative;
}

.dropdown-trigger {
    width: 100%;
    padding: 12px 16px;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 8px;
    color: #e6edf3;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
    min-height: 48px;
}

.dropdown-trigger:hover {
    border-color: #58a6ff;
    background: #161b22;
}

.dropdown-trigger:focus {
    outline: 2px solid #58a6ff;
    outline-offset: 0;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.dropdown-content.show {
    display: block;
}

.block-search {
    position: sticky;
    top: 0;
    background: #161b22;
    padding: 12px;
    border-bottom: 1px solid #30363d;
}

.block-search input {
    width: 100%;
    padding: 8px 12px;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #e6edf3;
    font-size: 13px;
}

.block-search input:focus {
    outline: 2px solid #58a6ff;
    outline-offset: 0;
    border-color: #58a6ff;
}

.block-list {
    padding: 8px;
}

.block-option {
    padding: 10px 12px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #e6edf3;
}

.block-option:hover {
    background: #21262d;
}

.block-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #58a6ff;
}

.block-category {
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 600;
    color: #8b949e;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 48px;
}

.checkbox-item:hover {
    background: #161b22;
    border-color: #58a6ff;
}

.checkbox-item:focus-within {
    outline: 2px solid #58a6ff;
    outline-offset: 2px;
}

.checkbox-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    cursor: pointer;
    accent-color: #58a6ff;
    flex-shrink: 0;
}

.checkbox-item input[type="checkbox"]:focus {
    outline: 2px solid #58a6ff;
    outline-offset: 2px;
}

.checkbox-item label {
    margin: 0;
    font-weight: 400;
    cursor: pointer;
    flex: 1;
    font-size: 14px;
    color: #e6edf3;
}

.convert-btn {
    width: 100%;
    padding: 16px;
    background: #238636;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 48px;
}

.convert-btn:hover {
    background: #2ea043;
}

.convert-btn:focus {
    outline: 2px solid #58a6ff;
    outline-offset: 2px;
}

.convert-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #30363d;
}

.status {
    margin-top: 24px;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
    display: none;
    font-size: 14px;
    font-weight: 500;
}

.status.success {
    background: #0d1117;
    color: #7ee787;
    border: 2px solid #238636;
}

.status.success::before {
    content: "✓ ";
    font-weight: bold;
}

.status.error {
    background: #0d1117;
    color: #ff7b72;
    border: 2px solid #da3633;
}

.status.error::before {
    content: "✕ ";
    font-weight: bold;
}

.info-box {
    background: #0d1117;
    border-left: 3px solid #58a6ff;
    padding: 16px 20px;
    margin-top: 32px;
    border-radius: 8px;
    font-size: 13px;
    color: #8b949e;
    line-height: 1.6;
    border: 1px solid #30363d;
    border-left: 3px solid #58a6ff;
}

.info-box strong {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    font-size: 14px;
    color: #e6edf3;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .container {
        border: 2px solid #58a6ff;
    }
    
    .checkbox-item,
    .upload-area,
    input[type="number"] {
        border-width: 2px;
    }
}

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 2px solid #58a6ff;
    outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
