:root {
    color-scheme: light;
    --ink: #18212f;
    --muted: #667085;
    --line: #d9e2ea;
    --panel: rgba(255, 255, 255, 0.92);
    --blue: #1769e0;
    --green: #147d55;
    --red: #c0362c;
    --amber: #9a6700;
    --shadow: 0 20px 60px rgba(20, 35, 55, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
    color: var(--ink);
    background:
        linear-gradient(135deg, rgba(23, 105, 224, 0.10), transparent 35%),
        linear-gradient(315deg, rgba(20, 125, 85, 0.12), transparent 36%),
        #f5f8fb;
}

a {
    color: inherit;
}

.shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 34px 0 54px;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 28px;
    align-items: end;
    padding: 28px 0 24px;
}

.hero h1,
.panel h2,
.catalog h2 {
    margin: 0;
    letter-spacing: 0;
}

.hero h1 {
    font-size: clamp(34px, 6vw, 64px);
    line-height: 1.04;
}

.summary {
    max-width: 720px;
    margin: 16px 0 0;
    color: var(--muted);
    font-size: 17px;
    line-height: 1.8;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--blue);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.format-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.format-strip span {
    display: grid;
    place-items: center;
    min-width: 62px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.72);
    font-weight: 800;
}

.workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 20px;
    align-items: start;
}

.panel {
    border: 1px solid rgba(217, 226, 234, 0.9);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.converter,
.sidebar-catalog {
    padding: 22px;
}

.panel-head {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.panel-head h2,
.catalog h2 {
    font-size: 24px;
}

.panel-head.compact {
    margin-bottom: 12px;
}

select {
    min-width: 132px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 12px;
    background: #fff;
    color: var(--ink);
    font: inherit;
}

.alert {
    display: grid;
    gap: 3px;
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: 8px;
    line-height: 1.55;
}

.alert.success {
    border: 1px solid rgba(20, 125, 85, 0.18);
    background: rgba(20, 125, 85, 0.08);
}

.alert.error {
    border: 1px solid rgba(192, 54, 44, 0.18);
    background: rgba(192, 54, 44, 0.08);
}

.download-card {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 14px;
    padding: 14px;
    border: 1px solid rgba(23, 105, 224, 0.2);
    border-radius: 8px;
    background: rgba(23, 105, 224, 0.08);
    text-decoration: none;
}

.download-card small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
}

.download-icon,
.drop-icon {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--blue);
    color: #fff;
    font-size: 24px;
    font-weight: 700;
}

.dropzone {
    display: grid;
    gap: 8px;
    place-items: center;
    min-height: 176px;
    margin-bottom: 18px;
    padding: 24px;
    border: 1.5px dashed #9db3c7;
    border-radius: 8px;
    background: #f8fbff;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

.dropzone:hover,
.dropzone.dragging {
    border-color: var(--blue);
    background: #eef6ff;
    transform: translateY(-1px);
}

.dropzone input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.dropzone small {
    color: var(--muted);
}

.password-field {
    display: grid;
    gap: 7px;
    margin: -4px 0 18px;
    padding: 14px;
    border: 1px solid rgba(23, 105, 224, 0.18);
    border-radius: 8px;
    background: #f8fbff;
}

.password-field[hidden] {
    display: none;
}

.password-field span {
    font-weight: 800;
}

.password-field input {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 12px;
    font: inherit;
}

.password-field small {
    color: var(--muted);
}

.tool-note {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
    padding: 16px;
    border: 1px solid rgba(23, 105, 224, 0.18);
    border-radius: 8px;
    background: #fff;
}

.tool-route {
    display: inline-flex;
    width: fit-content;
    padding: 5px 9px;
    border-radius: 8px;
    background: #eef6ff;
    color: var(--blue);
    font-size: 12px;
    font-weight: 900;
}

.tool-note p {
    margin: 0;
    color: var(--muted);
    line-height: 1.7;
}

.related-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 2px;
}

.related-tools[hidden] {
    display: none;
}

.related-tools button {
    min-height: 34px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 10px;
    background: #f8fbff;
    color: var(--ink);
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}

.related-tools button:hover {
    border-color: rgba(23, 105, 224, 0.36);
    color: var(--blue);
}

.custom-settings {
    display: grid;
    gap: 12px;
    margin-bottom: 18px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfe;
}

.custom-settings[hidden],
.pdf-warning[hidden] {
    display: none;
}

.settings-title {
    font-size: 16px;
    font-weight: 900;
}

.pdf-warning {
    padding: 10px 12px;
    border: 1px solid rgba(154, 103, 0, 0.2);
    border-radius: 8px;
    background: #fff8e6;
    color: var(--amber);
    line-height: 1.6;
}

.setting-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid var(--line);
}

.setting-row > span {
    flex: 0 0 116px;
    font-weight: 900;
}

.setting-row label {
    display: inline-flex;
    gap: 5px;
    align-items: center;
    color: var(--muted);
}

.setting-row input[type="text"],
.setting-row select {
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 10px;
    font: inherit;
}

.pages-input {
    width: 150px;
}

.format-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
}

.operation-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.operation-bank {
    display: none;
}

.operation-card {
    min-height: 102px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.operation-card input {
    position: absolute;
    opacity: 0;
}

.operation-card:has(input:checked) {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(23, 105, 224, 0.12);
}

.operation-card:hover {
    transform: translateY(-1px);
}

.operation-card.unavailable {
    cursor: not-allowed;
    opacity: 0.56;
    background: #f7f8fa;
}

.operation-card.unavailable:hover {
    transform: none;
}

.operation-card small {
    display: block;
    margin-top: 8px;
    color: var(--amber);
    line-height: 1.45;
}

.operation-card[hidden] {
    display: none;
}

.route {
    display: inline-flex;
    margin-bottom: 12px;
    color: var(--blue);
    font-size: 12px;
    font-weight: 800;
}

.operation-card strong {
    display: block;
    font-size: 16px;
    line-height: 1.35;
}

.primary-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 50px;
    margin-top: 18px;
    border: 0;
    border-radius: 8px;
    background: var(--blue);
    color: #fff;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.ok {
    color: var(--green);
}

.bad {
    color: var(--red);
}

.warn {
    color: var(--amber);
}

.catalog {
    padding: 22px;
    border: 1px solid rgba(217, 226, 234, 0.9);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.sidebar-catalog {
    position: sticky;
    top: 18px;
    margin: 0;
}

.convert-groups {
    display: grid;
    gap: 14px;
    margin-top: 16px;
}

.convert-groups section {
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.convert-groups section:first-child {
    padding-top: 0;
    border-top: 0;
}

.convert-groups .group-title {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 34px;
    margin: 0 0 8px;
    padding: 8px 12px 8px 34px;
    border: 1px solid rgba(23, 105, 224, 0.18);
    border-radius: 8px;
    background: #eef6ff;
    color: var(--blue);
    font-size: 16px;
    font-weight: 900;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.65);
}

.convert-groups .group-title::before {
    content: "";
    position: absolute;
    left: 12px;
    top: 50%;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--blue);
    transform: translateY(-50%);
}

.convert-groups .group-title::after {
    content: "";
    position: absolute;
    left: 16px;
    top: 50%;
    width: 1px;
    height: 18px;
    background: rgba(23, 105, 224, 0.22);
    transform: translateY(-50%);
}

.convert-groups a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    text-decoration: none;
    transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

.convert-groups a:hover {
    border-color: rgba(23, 105, 224, 0.36);
    background: #f3f8ff;
    transform: translateX(2px);
}

.convert-groups a.active {
    border-color: rgba(23, 105, 224, 0.45);
    background: #eef6ff;
}

.convert-groups a.active span {
    color: var(--blue);
}

.convert-groups span {
    color: var(--ink);
    font-weight: 800;
}

.convert-groups small {
    flex: 0 0 auto;
    max-width: 96px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
    text-align: right;
}

.seo-panel {
    margin-top: 22px;
    padding: 22px;
    border: 1px solid rgba(217, 226, 234, 0.9);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.75);
    line-height: 1.8;
}

.seo-panel h2 {
    margin: 0 0 10px;
    font-size: 24px;
}

.seo-panel p {
    margin: 0;
    color: var(--muted);
}

.faq-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 18px;
}

.faq-grid article {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.faq-grid h3 {
    margin: 0 0 8px;
    font-size: 17px;
}

@media (max-width: 980px) {
    .hero,
    .workspace {
        grid-template-columns: 1fr;
    }

    .format-strip {
        justify-content: flex-start;
    }

    .operation-grid,
    .faq-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sidebar-catalog {
        position: static;
    }
}

@media (max-width: 640px) {
    .shell {
        width: min(100% - 20px, 1180px);
        padding-top: 18px;
    }

    .hero {
        gap: 18px;
    }

    .converter,
    .sidebar-catalog,
    .seo-panel {
        padding: 16px;
    }

    .panel-head {
        align-items: stretch;
        flex-direction: column;
    }

    select {
        width: 100%;
    }

    .operation-grid,
    .faq-grid {
        grid-template-columns: 1fr;
    }

    .convert-groups a {
        align-items: flex-start;
        flex-direction: column;
    }

    .convert-groups small {
        max-width: none;
        text-align: left;
    }
}
