:root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --surface-alt: #f0f2f5;
    --text: #1a1d23;
    --text-muted: #5b6470;
    --border: #e3e7ec;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-contrast: #ffffff;
    --accent: #10b981;
    --danger: #ef4444;
    --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 12px rgba(15, 23, 42, 0.06);
    --radius: 12px;
    --radius-sm: 8px;
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
    --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0c0e12;
        --surface: #14171c;
        --surface-alt: #1c2026;
        --text: #e6e9ee;
        --text-muted: #8a93a0;
        --border: #262b33;
        --primary: #3b82f6;
        --primary-hover: #60a5fa;
        --primary-contrast: #0c0e12;
        --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
    }
}

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 880px;
    margin: 0 auto;
    padding: 48px 20px 64px;
}

.hero {
    text-align: center;
    margin-bottom: 32px;
}

.hero h1 {
    font-size: clamp(1.75rem, 1.2rem + 2.5vw, 2.5rem);
    margin: 0 0 12px;
    letter-spacing: -0.02em;
    font-weight: 700;
}

.hero .lead {
    color: var(--text-muted);
    max-width: 620px;
    margin: 0 auto;
    font-size: 1.05rem;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.info-box {
    background: color-mix(in srgb, var(--primary) 6%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--primary) 25%, var(--border));
    border-radius: var(--radius);
    margin-bottom: 20px;
    overflow: hidden;
}

.info-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 16px 20px;
    background: transparent;
    border: 0;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.98rem;
    font-weight: 600;
    color: var(--text);
    text-align: left;
}

.info-toggle:hover {
    background: color-mix(in srgb, var(--primary) 4%, transparent);
}

.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--primary-contrast);
    font-style: italic;
    font-weight: 700;
    font-family: Georgia, serif;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.info-title {
    flex: 1;
}

.info-chevron {
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.info-toggle[aria-expanded="false"] .info-chevron {
    transform: rotate(-90deg);
}

.info-body {
    padding: 0 20px 20px;
    border-top: 1px solid color-mix(in srgb, var(--primary) 18%, var(--border));
}

.info-toggle[aria-expanded="false"] + .info-body {
    display: none;
}

.info-section {
    margin-top: 18px;
}

.info-section h3 {
    font-size: 0.92rem;
    font-weight: 600;
    margin: 0 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary);
}

.info-section ul {
    margin: 0;
    padding-left: 20px;
    font-size: 0.92rem;
    color: var(--text);
}

.info-section li {
    margin-bottom: 4px;
    line-height: 1.5;
}

.info-section li strong {
    color: var(--text);
}

.info-check {
    list-style: none;
    padding-left: 0 !important;
}

.info-check li {
    position: relative;
    padding-left: 22px;
}

.info-check li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--accent);
    font-weight: 700;
}

.info-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    margin-top: 4px;
}

.info-table th,
.info-table td {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.info-table th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.info-table tbody tr:last-child td {
    border-bottom: 0;
}

.info-table code {
    font-family: var(--mono);
    font-size: 0.82rem;
    background: var(--surface);
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid var(--border);
    white-space: nowrap;
}

.card h2 {
    font-size: 1.15rem;
    margin: 0 0 6px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.hint {
    color: var(--text-muted);
    font-size: 0.92rem;
    margin: 0 0 18px;
}

.hint code {
    font-family: var(--mono);
    background: var(--surface-alt);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.85rem;
}

.hidden {
    display: none !important;
}

.drop-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 200px;
    padding: 32px 20px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    background: var(--surface-alt);
    cursor: pointer;
    text-align: center;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
    color: var(--text);
}

.drop-zone:hover,
.drop-zone:focus-visible {
    border-color: var(--primary);
    outline: none;
}

.drop-zone.is-dragging {
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary) 8%, var(--surface-alt));
    transform: scale(1.005);
}

.drop-zone strong {
    font-size: 1.05rem;
}

.drop-zone span {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.drop-zone small {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 6px;
}

.drop-icon {
    width: 40px;
    height: 40px;
    color: var(--primary);
    margin-bottom: 6px;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px;
    margin-bottom: 14px;
}

.option-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.option-row:hover {
    border-color: var(--primary);
}

.option-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
    margin: 0;
}

.option-row .opt-name {
    font-family: var(--mono);
    font-size: 0.82rem;
    color: var(--text);
}

.option-row .opt-meta {
    margin-left: auto;
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

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

.btn-ghost-inline {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 6px 12px;
    font-size: 0.82rem;
    border-radius: var(--radius-sm);
}

.btn-ghost-inline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 14px;
}

.preview-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 12px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-align: center;
}

.preview-item .checker {
    background-image:
        linear-gradient(45deg, var(--border) 25%, transparent 25%),
        linear-gradient(-45deg, var(--border) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, var(--border) 75%),
        linear-gradient(-45deg, transparent 75%, var(--border) 75%);
    background-size: 12px 12px;
    background-position: 0 0, 0 6px, 6px -6px, -6px 0;
    border-radius: 6px;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 96px;
    height: 96px;
}

.preview-item img {
    max-width: 100%;
    max-height: 100%;
    image-rendering: pixelated;
}

.preview-item .label {
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--text-muted);
    word-break: break-all;
}

.preview-item .dim {
    font-size: 0.75rem;
    color: var(--text);
    font-weight: 600;
}

.snippet-wrapper {
    position: relative;
}

.snippet {
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px 18px;
    font-family: var(--mono);
    font-size: 0.85rem;
    overflow-x: auto;
    margin: 0;
    white-space: pre;
    color: var(--text);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 10px 18px;
    font-size: 0.95rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.05s ease;
    text-decoration: none;
}

.btn:active {
    transform: translateY(1px);
}

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

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

.btn-primary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn-ghost {
    background: transparent;
    color: var(--text);
    border-color: var(--border);
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 6px 12px;
    font-size: 0.82rem;
}

.btn-ghost:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.actions {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.status {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.status.success { color: var(--accent); }
.status.error { color: var(--danger); }

.footer {
    margin-top: 36px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

code {
    font-family: var(--mono);
}
