:root {
    color-scheme: light;
    --background: #f4f7fb;
    --surface: #ffffff;
    --text: #172033;
    --text-muted: #667085;
    --primary: #3157d5;
    --primary-soft: #eef2ff;
    --border: #dfe5ef;
    --shadow: 0 18px 50px rgba(23, 32, 51, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at top, rgba(49, 87, 213, 0.09), transparent 34rem),
        var(--background);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.page-container {
    display: flex;
    flex-direction: column;
    width: min(100% - 2rem, 68rem);
    min-height: 100vh;
    margin-inline: auto;
    padding: clamp(3rem, 8vw, 6rem) 0;
}

.hero {
    order: 1;
    width: 100%;
    max-width: 46rem;
    margin: 0 auto 3rem;
    text-align: center;
}

.eyebrow {
    display: inline-block;
    margin-bottom: 1rem;
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 1rem;
    font-size: clamp(2.4rem, 7vw, 4.5rem);
    letter-spacing: -0.055em;
    line-height: 1;
}

.subtitle {
    margin-bottom: 0.8rem;
    font-size: clamp(1.1rem, 2.5vw, 1.35rem);
    line-height: 1.5;
}

.description {
    max-width: 39rem;
    margin: 0 auto;
    color: var(--text-muted);
    line-height: 1.7;
}

.feedback {
    order: 3;
    width: 100%;
    margin: 0 auto 1.5rem;
    padding: 1.25rem 1.5rem;
    border: 1px solid;
    border-radius: 1rem;
    background: var(--surface);
}

.feedback strong {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 1.05rem;
}

.feedback p {
    margin-bottom: 0;
    line-height: 1.55;
}

.feedback--error {
    border-color: #f1b8b8;
    background: #fff5f5;
    color: #9f2828;
}

.feedback--success {
    border-color: #a9dccf;
    background: #f0faf7;
    color: #176b59;
}

.reading-results {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.reading-summary {
    min-width: 0;
    padding: 1.25rem;
    border: 1px solid rgba(23, 107, 89, 0.18);
    border-radius: 0.85rem;
    background: rgba(255, 255, 255, 0.76);
}

.reading-label {
    margin-bottom: 0.35rem;
    color: #176b59;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.reading-summary h2 {
    margin-bottom: 1rem;
    color: var(--text);
    overflow-wrap: anywhere;
}

.document-hash {
    margin-bottom: 1rem;
    padding: 0.7rem;
    border-radius: 0.55rem;
    background: #f3f6f9;
}

.document-hash span {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
}

.document-hash code {
    display: block;
    color: var(--text);
    font-size: 0.72rem;
    overflow-wrap: anywhere;
}

.document-hash--text {
    background: #eef2ff;
}

.reading-counts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
    margin: 0 0 1rem;
}

.reading-counts div {
    padding: 0.65rem;
    border-radius: 0.6rem;
    background: #e9f7f3;
    text-align: center;
}

.reading-counts dt {
    color: var(--text-muted);
    font-size: 0.72rem;
}

.reading-counts dd {
    margin: 0.2rem 0 0;
    color: var(--text);
    font-size: 1.3rem;
    font-weight: 700;
}

.document-preview h3 {
    margin: 0 0 0.65rem;
    color: var(--text);
    font-size: 0.9rem;
}

.document-preview p {
    margin-bottom: 0.55rem;
    padding-left: 0.75rem;
    border-left: 2px solid #a9dccf;
    color: var(--text-muted);
    font-size: 0.86rem;
    overflow-wrap: anywhere;
}

.next-step {
    text-align: center;
}

.binary-result {
    margin: 1rem 0;
    padding: 1rem 1.25rem;
    border: 1px solid;
    border-radius: 0.75rem;
    text-align: center;
}

.binary-result strong {
    margin-bottom: 0.35rem;
}

.result-label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.binary-result--identical {
    border-color: #8dd0bf;
    background: #e5f7f2;
    color: #176b59;
}

.binary-result--different {
    border-color: #e8cb8c;
    background: #fff8e8;
    color: #875d0b;
}

.comparison-interpretation {
    padding: 0.85rem 1rem;
    border-radius: 0.65rem;
    background: #f3f6f9;
    color: var(--text-muted);
    line-height: 1.55;
    text-align: center;
}

.structural-comparison {
    order: 3;
    margin-bottom: 1.5rem;
    padding: clamp(1.5rem, 4vw, 2rem);
    border: 1px solid var(--border);
    border-radius: 1.25rem;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.section-heading {
    margin-bottom: 1.25rem;
    text-align: center;
}

.section-heading > span {
    color: var(--primary);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.section-heading h2 {
    margin: 0.35rem 0;
    font-size: 1.5rem;
}

.section-heading p,
.structural-notice {
    margin-bottom: 0;
    color: var(--text-muted);
    line-height: 1.55;
}

.paragraph-diff-summary {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.paragraph-diff-summary > h3 {
    margin: 0 0 0.35rem;
    font-size: 1rem;
}

.paragraph-diff-summary > p {
    margin-bottom: 0.9rem;
    color: var(--text-muted);
}

.paragraph-diff-list {
    display: grid;
    gap: 0.7rem;
}

.paragraph-diff-list article {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem;
    border: 1px solid var(--border);
    border-radius: 0.65rem;
    background: #f8f9fc;
}

.paragraph-diff-list article > div span {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.paragraph-diff-list dl {
    display: grid;
    grid-template-columns: repeat(4, auto);
    gap: 0.5rem;
    margin: 0;
}

.paragraph-diff-list dl div {
    min-width: 3.5rem;
    text-align: center;
}

.paragraph-diff-list dt {
    color: var(--text-muted);
    font-size: 0.65rem;
}

.paragraph-diff-list dd {
    margin: 0.15rem 0 0;
    color: var(--text);
    font-weight: 700;
}

.structural-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.structural-summary {
    padding: 1.1rem;
    border: 1px solid var(--border);
    border-radius: 0.85rem;
    background: #f8f9fc;
}

.structural-summary h3 {
    margin: 0 0 0.8rem;
    font-size: 1rem;
}

.structural-summary dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
    margin: 0;
}

.structural-summary dl div {
    padding: 0.65rem;
    border-radius: 0.55rem;
    background: var(--surface);
}

.structural-summary dt {
    color: var(--text-muted);
    font-size: 0.7rem;
}

.structural-summary dd {
    margin: 0.2rem 0 0;
    color: var(--text);
    font-size: 1.2rem;
    font-weight: 700;
}

.structural-notice {
    margin-top: 1rem;
    text-align: center;
}

.received-files {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin: 1rem 0;
}

.received-files div {
    padding: 0.85rem 1rem;
    border: 1px solid rgba(23, 107, 89, 0.18);
    border-radius: 0.7rem;
    background: rgba(255, 255, 255, 0.7);
}

.received-files dt {
    margin-bottom: 0.3rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.received-files dd {
    margin: 0;
    color: var(--text);
    overflow-wrap: anywhere;
}

.received-files dd span {
    display: inline-block;
    margin-left: 0.35rem;
    padding: 0.15rem 0.4rem;
    border-radius: 0.35rem;
    background: #d9f1eb;
    color: #176b59;
    font-size: 0.7rem;
    font-weight: 700;
}

.upload-form {
    order: 2;
    margin: 0 0 1.5rem;
}

.document-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
}

.document-card {
    display: flex;
    gap: 1.25rem;
    min-height: 13rem;
    padding: clamp(1.5rem, 4vw, 2rem);
    border: 1px solid var(--border);
    border-radius: 1.25rem;
    background: var(--surface);
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.document-card:hover,
.document-card:focus-within {
    border-color: #aebce8;
    box-shadow: 0 20px 55px rgba(23, 32, 51, 0.12);
    transform: translateY(-2px);
}

.document-icon {
    position: relative;
    flex: 0 0 3.25rem;
    width: 3.25rem;
    height: 4rem;
    border: 2px solid var(--primary);
    border-radius: 0.55rem;
    background: var(--primary-soft);
}

.document-icon::before,
.document-icon::after,
.document-icon span {
    position: absolute;
    left: 0.7rem;
    width: 1.65rem;
    height: 2px;
    border-radius: 1rem;
    background: var(--primary);
    content: "";
}

.document-icon::before {
    top: 1.15rem;
}

.document-icon span {
    top: 1.75rem;
}

.document-icon::after {
    top: 2.35rem;
    width: 1.1rem;
}

.document-icon--revised {
    border-color: #14866d;
    background: #eaf8f4;
}

.document-icon--revised::before,
.document-icon--revised::after,
.document-icon--revised span {
    background: #14866d;
}

.card-label {
    display: block;
    margin-bottom: 0.45rem;
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.document-card:nth-child(2) .card-label {
    color: #14866d;
}

.card-title {
    display: block;
    margin-bottom: 0.65rem;
    font-size: 1.25rem;
    font-weight: 700;
}

.card-content {
    min-width: 0;
}

.card-description {
    display: block;
    color: var(--text-muted);
    line-height: 1.6;
}

.file-action {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.55rem 0.8rem;
    border-radius: 0.55rem;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 700;
}

.file-action--revised {
    background: #eaf8f4;
    color: #14866d;
}

input[type="file"] {
    display: block;
    width: 100%;
    margin-top: 0.75rem;
    color: var(--text-muted);
    font: inherit;
    font-size: 0.8rem;
}

input[type="file"]::file-selector-button {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    border: 0;
    clip: rect(0, 0, 0, 0);
    overflow: hidden;
    white-space: nowrap;
}

.action-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 2.5rem;
}

button {
    min-width: 14rem;
    padding: 0.9rem 1.4rem;
    border: 0;
    border-radius: 0.7rem;
    background: var(--primary);
    color: #ffffff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: background 160ms ease, transform 160ms ease;
}

button:hover {
    background: #2849b7;
    transform: translateY(-1px);
}

button:focus-visible,
input[type="file"]:focus-visible {
    outline: 3px solid rgba(49, 87, 213, 0.28);
    outline-offset: 3px;
}

.notice {
    margin: 0.85rem 0 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    text-align: center;
}

@media (max-width: 700px) {
    .document-grid,
    .received-files,
    .reading-results,
    .structural-summary-grid {
        grid-template-columns: 1fr;
    }

    .document-card {
        min-height: auto;
    }
}

@media (max-width: 420px) {
    .document-card {
        flex-direction: column;
    }

    .paragraph-diff-list article {
        align-items: stretch;
        flex-direction: column;
    }

    .paragraph-diff-list dl {
        grid-template-columns: repeat(2, 1fr);
    }
}
