:root {
    --bg: #0b1020;
    --grid: rgba(132, 150, 255, 0.16);
    --ink: #111827;
    --ink-soft: #334155;
    --paper: #f8fafc;
    --paper-2: #eef2ff;
    --line: #1e293b;
    --accent: #7c3aed;
    --accent-2: #06b6d4;
    --danger: #dc2626;
    --success: #15803d;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ink);
    font-family: "Inter", "Avenir Next", "Segoe UI", sans-serif;
    background:
        linear-gradient(transparent 31px, var(--grid) 32px),
        linear-gradient(90deg, transparent 31px, var(--grid) 32px),
        var(--bg);
    background-size: 32px 32px;
}

.app-shell {
    max-width: 1240px;
    margin: 0 auto;
    padding: 1rem 1rem 2rem;
}

.hero {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1rem;
    padding: clamp(1rem, 3vw, 1.8rem);
    border: 3px solid var(--line);
    border-radius: 28px 8px 28px 8px;
    background: linear-gradient(135deg, #ffffff 0%, #dbeafe 50%, #ede9fe 100%);
    box-shadow: 10px 10px 0 rgba(15, 23, 42, 0.86);
}

.eyebrow {
    margin: 0 0 0.3rem;
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border: 2px solid #4338ca;
    border-radius: 999px;
    background: #e0e7ff;
    color: #3730a3;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 800;
}

.hero h1 {
    margin: 0;
    font-family: "Space Grotesk", "Inter", sans-serif;
    font-size: clamp(1.9rem, 4.5vw, 3.2rem);
    line-height: 0.95;
    letter-spacing: -0.03em;
    text-transform: uppercase;
}

.lead {
    margin: 0.65rem 0 0;
    max-width: 55ch;
    color: #1f2937;
    line-height: 1.5;
    font-size: 1rem;
}

.hero-note {
    flex-shrink: 0;
    border: 3px solid var(--line);
    border-radius: 16px;
    background: #fef3c7;
    box-shadow: 5px 5px 0 rgba(15, 23, 42, 0.86);
    overflow: hidden;
}

.hero-note p {
    margin: 0;
    min-width: 124px;
    padding: 0.5rem 0.7rem;
    text-align: center;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.hero-note p:nth-child(2) {
    border-top: 2px solid var(--line);
    border-bottom: 2px solid var(--line);
}

.workspace {
    display: grid;
    gap: 1rem;
}

.controls,
.results {
    border: 3px solid var(--line);
    border-radius: 24px 8px 24px 8px;
    background: var(--paper);
    box-shadow: 9px 9px 0 rgba(15, 23, 42, 0.86);
}

.controls {
    padding: 1rem;
}

.input-grid {
    display: grid;
    gap: 0.8rem;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.input-card {
    padding: 0.75rem;
    border: 2px solid var(--line);
    border-radius: 14px;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.14);
}

.input-card:nth-child(1) {
    background: #ecfeff;
}

.input-card:nth-child(2) {
    background: #fef9c3;
}

.input-card:nth-child(3) {
    background: #f3e8ff;
}

.input-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.4rem;
}

.label-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
}

.list-name {
    min-width: 0;
    max-width: 170px;
    padding: 0.2rem 0.45rem;
    border: 2px solid transparent;
    border-radius: 8px;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
    font-weight: 900;
    letter-spacing: 0.01em;
}

.list-name:hover {
    border-color: #64748b;
}

.list-name:focus {
    outline: none;
    border-color: #7c3aed;
    background: #ffffff;
}

.edit-hint {
    opacity: 0;
    color: #475569;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    transition: opacity 0.15s ease;
}

.label-wrapper:hover .edit-hint {
    opacity: 1;
}

.optional-tag {
    padding: 0.08rem 0.32rem;
    border: 1px solid #64748b;
    border-radius: 999px;
    color: #475569;
    font-size: 0.72rem;
    font-weight: 700;
}

.clear-btn {
    padding: 0.28rem 0.55rem;
    border: 2px solid #475569;
    border-radius: 8px;
    background: #f8fafc;
    color: #334155;
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    cursor: pointer;
}

.clear-btn:hover {
    background: #334155;
    color: #f8fafc;
}

textarea {
    width: 100%;
    min-height: 225px;
    resize: vertical;
    border: 2px solid var(--line);
    border-radius: 10px;
    padding: 0.72rem;
    font-size: 0.9rem;
    line-height: 1.45;
    color: #0f172a;
    background: #ffffff;
    font-family: "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
}

textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.24);
}

textarea::placeholder {
    color: #94a3b8;
}

.count {
    display: inline-block;
    margin-top: 0.4rem;
    color: #475569;
    font-size: 0.82rem;
    font-weight: 700;
}

.count.has-items {
    color: #166534;
}

.button-row {
    margin-top: 0.85rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

button.primary,
button.secondary,
.copy-btn,
.tabs button {
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

button.primary {
    padding: 0.58rem 0.95rem;
    border: 2px solid #1e1b4b;
    border-radius: 10px;
    color: #ffffff;
    background: linear-gradient(120deg, #7c3aed 0%, #0ea5e9 100%);
    text-transform: uppercase;
    font-size: 0.8rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    box-shadow: 4px 4px 0 #1e1b4b;
}

button.primary:hover {
    transform: translate(-1px, -1px);
    box-shadow: 6px 6px 0 #1e1b4b;
}

button.secondary {
    padding: 0.58rem 0.95rem;
    border: 2px solid #334155;
    border-radius: 10px;
    color: #0f172a;
    background: #ffffff;
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    box-shadow: 3px 3px 0 #334155;
}

button.secondary:hover {
    transform: translate(-1px, -1px);
    box-shadow: 5px 5px 0 #334155;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.settings-card {
    margin-top: 0.9rem;
    padding: 0.85rem;
    border: 2px solid var(--line);
    border-radius: 12px;
    background: var(--paper-2);
}

.settings-card h2 {
    margin: 0 0 0.55rem;
    font-size: 0.86rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 900;
    color: #312e81;
}

.settings-grid {
    display: grid;
    gap: 0.5rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.setting-option {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: #1e293b;
    font-size: 0.86rem;
    font-weight: 600;
}

.setting-option input {
    margin: 0;
    accent-color: var(--accent);
}

.hint {
    margin: 0.65rem 0 0;
    color: #475569;
    font-size: 0.8rem;
}

.hint kbd {
    display: inline-block;
    padding: 0.07rem 0.3rem;
    border: 1px solid #64748b;
    border-radius: 4px;
    background: #f8fafc;
    font-size: 0.76rem;
    font-family: "JetBrains Mono", "SFMono-Regular", Menlo, monospace;
}

.validation-msg {
    margin-top: 0.85rem;
    border: 2px solid #991b1b;
    border-radius: 10px;
    background: #fee2e2;
    color: #991b1b;
    padding: 0.6rem 0.7rem;
    font-size: 0.87rem;
    font-weight: 700;
}

.results {
    padding: 1rem;
    animation: reveal 0.2s ease;
}

.results-head {
    margin-bottom: 0.8rem;
}

.results-head h2 {
    margin: 0;
    font-size: 1.2rem;
    font-family: "Space Grotesk", "Inter", sans-serif;
    text-transform: uppercase;
}

.results-head p {
    margin: 0.3rem 0 0;
    color: #475569;
    font-size: 0.9rem;
}

@keyframes reveal {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 0.75rem;
}

.tabs button {
    padding: 0.45rem 0.85rem;
    border: 2px solid #334155;
    border-radius: 9px;
    background: #e2e8f0;
    color: #0f172a;
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    box-shadow: 3px 3px 0 #334155;
}

.tabs button:hover {
    transform: translate(-1px, -1px);
    box-shadow: 5px 5px 0 #334155;
}

.tabs button.active {
    border-color: #0c4a6e;
    background: linear-gradient(120deg, #7dd3fc 0%, #c4b5fd 100%);
    color: #0f172a;
}

.tab-content {
    padding: 0.25rem 0.05rem 0;
    white-space: pre-wrap;
}

.summary-grid {
    display: grid;
    gap: 0.65rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    white-space: normal;
    font-family: "Inter", "Segoe UI", sans-serif;
}

.summary-card {
    padding: 0.75rem;
    border: 2px solid var(--line);
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 4px 4px 0 rgba(15, 23, 42, 0.6);
}

.summary-card h3 {
    margin: 0 0 0.45rem;
    font-size: 0.92rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.summary-card ul {
    margin: 0;
    padding-left: 1rem;
}

.summary-card li {
    margin-bottom: 0.3rem;
}

.summary-card li:last-child {
    margin-bottom: 0;
}

.diff-block {
    margin-bottom: 0.68rem;
    border: 2px solid var(--line);
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 4px 4px 0 rgba(15, 23, 42, 0.6);
    padding: 0.6rem;
}

.diff-block:last-child {
    margin-bottom: 0;
}

.diff-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
}

.diff-title {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.48rem;
    font-size: 0.86rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #1f2937;
}

.copy-btn {
    padding: 0.33rem 0.56rem;
    border: 2px solid #334155;
    border-radius: 8px;
    background: #f8fafc;
    color: #334155;
    font-size: 0.74rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    box-shadow: 2px 2px 0 #334155;
}

.copy-btn:hover {
    transform: translate(-1px, -1px);
    box-shadow: 4px 4px 0 #334155;
}

.copy-btn.copied {
    border-color: #166534;
    color: #f0fdf4;
    background: #166534;
    box-shadow: 2px 2px 0 #14532d;
}

.diff-list {
    padding: 0.55rem 0.62rem;
    border-radius: 8px;
    border: 2px dashed #64748b;
    background: #f8fafc;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.88rem;
    line-height: 1.45;
    font-family: "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
}

.diff-missing {
    border-left: 6px solid var(--danger);
}

.diff-only {
    border-left: 6px solid #0369a1;
}

.diff-common {
    border-left: 6px solid var(--success);
}

.empty {
    color: #64748b;
    font-style: italic;
}

.diff-count {
    min-width: 2rem;
    height: 1.45rem;
    padding: 0 0.45rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 900;
}

.count-red {
    background: #fecaca;
    color: #7f1d1d;
}

.count-blue {
    background: #bae6fd;
    color: #0c4a6e;
}

.count-green {
    background: #bbf7d0;
    color: #14532d;
}

.count-zero {
    background: #e2e8f0;
    color: #334155;
}

footer {
    margin-top: 0.95rem;
    text-align: center;
    color: #cbd5e1;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.hidden {
    display: none;
}

@media (max-width: 900px) {
    .hero {
        flex-direction: column;
    }

    .hero-note {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .hero-note p {
        min-width: 0;
    }

    .hero-note p:nth-child(2) {
        border-top: none;
        border-bottom: none;
        border-left: 2px solid var(--line);
        border-right: 2px solid var(--line);
    }
}

@media (max-width: 640px) {
    .app-shell {
        padding-inline: 0.68rem;
    }

    .controls,
    .results {
        border-radius: 14px;
        padding: 0.75rem;
    }

    .button-row {
        display: grid;
        grid-template-columns: 1fr;
    }

    button.primary,
    button.secondary {
        width: 100%;
    }

    .tabs {
        display: grid;
        grid-template-columns: 1fr;
    }
}
