:root {
    color-scheme: light;
    --bg: #f5f3ee;
    --surface: #ffffff;
    --surface-soft: #f9faf7;
    --ink: #20231f;
    --muted: #666e62;
    --line: #d9ded4;
    --accent: #216e57;
    --accent-strong: #185844;
    --accent-soft: #e6f2ec;
    --blue: #255f8f;
    --amber: #8a5a00;
    --red: #a03a2f;
    --shadow: 0 16px 40px rgba(30, 34, 28, 0.08);
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    min-width: 320px;
    margin: 0;
    color: var(--ink);
    background:
        linear-gradient(180deg, rgba(33, 110, 87, 0.08), rgba(33, 110, 87, 0) 260px),
        var(--bg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

button,
input,
textarea {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button {
    border: 0;
    cursor: pointer;
}

button:disabled {
    cursor: wait;
    opacity: 0.68;
}

a {
    color: var(--accent-strong);
}

.app-header,
.app-shell,
.app-footer {
    width: min(1180px, calc(100% - 32px));
    margin-inline: auto;
}

.app-header {
    display: grid;
    grid-template-columns: 1fr minmax(240px, 320px);
    gap: 24px;
    align-items: end;
    padding: 36px 0 20px;
}

.eyebrow,
.step-label {
    margin: 0 0 6px;
    color: var(--accent-strong);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0;
}

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

h1 {
    margin-bottom: 10px;
    font-size: clamp(32px, 4vw, 48px);
    line-height: 1.08;
    letter-spacing: 0;
}

h2 {
    margin-bottom: 0;
    font-size: 26px;
    line-height: 1.2;
    letter-spacing: 0;
}

h3 {
    margin-bottom: 6px;
    font-size: 19px;
    letter-spacing: 0;
}

.intro {
    max-width: 660px;
    margin-bottom: 0;
    color: var(--muted);
    font-size: 18px;
}

.trust-panel {
    display: grid;
    gap: 4px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.76);
}

.trust-panel span {
    color: var(--muted);
    font-size: 14px;
}

.task-switcher {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.task-card {
    display: grid;
    gap: 6px;
    min-height: 104px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    text-align: left;
    box-shadow: 0 8px 22px rgba(32, 35, 31, 0.05);
}

.task-card span {
    font-size: 21px;
    font-weight: 750;
}

.task-card small {
    color: var(--muted);
    font-size: 14px;
}

.task-card.active {
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: 0 0 0 2px rgba(33, 110, 87, 0.14);
}

.workspace {
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.section-heading,
.section-subbar {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
}

.mode-switch {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.mode-switch button {
    min-width: 76px;
    padding: 8px 12px;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    font-weight: 700;
}

.mode-switch button.active {
    background: var(--ink);
    color: #fff;
}

.form-grid,
.key-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.panel,
.result-panel {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.callout {
    display: flex;
    gap: 18px;
    align-items: center;
    justify-content: space-between;
    border-color: rgba(33, 110, 87, 0.28);
    background: var(--accent-soft);
}

.callout p {
    margin-bottom: 0;
    color: var(--muted);
}

.field-header {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

label {
    display: inline-block;
    margin-bottom: 10px;
    font-weight: 750;
}

.field-header label {
    margin-bottom: 0;
}

textarea {
    display: block;
    width: 100%;
    min-height: 112px;
    resize: vertical;
    padding: 12px;
    border: 1px solid #cbd3c6;
    border-radius: 6px;
    background: #fff;
    color: var(--ink);
    font-family: "Cascadia Mono", Consolas, "Courier New", monospace;
    font-size: 14px;
    line-height: 1.45;
}

textarea:focus,
.file-input:focus {
    border-color: var(--accent);
    outline: 3px solid rgba(33, 110, 87, 0.18);
}

.file-button,
.link-button,
.inline-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 7px 11px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--accent-strong);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.file-button {
    position: relative;
    overflow: hidden;
    margin-bottom: 0;
    cursor: pointer;
}

.file-button input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.file-input {
    display: block;
    width: 100%;
    padding: 16px;
    border: 1px dashed #aab7a5;
    border-radius: 8px;
    background: #fff;
}

.fingerprint {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 6px;
    background: #eef6fb;
    color: var(--blue);
    font-family: "Cascadia Mono", Consolas, "Courier New", monospace;
    font-size: 13px;
    overflow-wrap: anywhere;
}

.fingerprint.muted {
    background: #f1f2ef;
    color: var(--muted);
    font-family: inherit;
}

.fingerprint.warning {
    background: #fff6df;
    color: var(--amber);
    font-family: inherit;
}

.fingerprint.error {
    background: #fff0ed;
    color: var(--red);
    font-family: inherit;
}

.action-row {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-top: 18px;
}

.primary-action {
    min-height: 46px;
    padding: 12px 18px;
    border-radius: 6px;
    background: var(--accent);
    color: #fff;
    font-weight: 800;
}

.primary-action:hover {
    background: var(--accent-strong);
}

.status {
    min-height: 24px;
    color: var(--muted);
    font-weight: 700;
}

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

.status.error {
    color: var(--red);
}

.result-panel {
    margin-top: 18px;
    background: #fff;
}

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

.download-card {
    display: block;
    margin-top: 10px;
    padding: 16px;
    border: 1px solid rgba(33, 110, 87, 0.28);
    border-radius: 8px;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-weight: 800;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.section-subbar {
    margin-bottom: 16px;
}

.app-footer {
    display: grid;
    gap: 6px;
    padding: 18px 0 28px;
    color: var(--muted);
    font-size: 14px;
}

.footer-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
}

.app-footer a {
    color: var(--muted);
}

@media (max-width: 820px) {
    .app-header,
    .form-grid,
    .key-grid,
    .task-switcher {
        grid-template-columns: 1fr;
    }

    .app-header {
        align-items: stretch;
    }

    .workspace {
        padding: 18px;
    }

    .section-heading,
    .section-subbar,
    .callout,
    .action-row {
        align-items: stretch;
        flex-direction: column;
    }

    .mode-switch {
        width: 100%;
    }

    .mode-switch button {
        flex: 1 1 120px;
    }
}

@media (max-width: 520px) {
    .app-header,
    .app-shell,
    .app-footer {
        width: min(100% - 20px, 1180px);
    }

    .app-header {
        padding-top: 24px;
    }

    h1 {
        font-size: 32px;
    }

    h2 {
        font-size: 22px;
    }

    .task-card,
    .panel,
    .result-panel,
    .workspace {
        padding: 14px;
    }

    .field-header {
        align-items: stretch;
        flex-direction: column;
    }

    .file-button,
    .link-button,
    .inline-actions button {
        width: 100%;
    }

    .inline-actions {
        width: 100%;
    }
}
