:root {
    color-scheme: light;
    --bg: #f4f6f8;
    --panel: #ffffff;
    --text: #1d2430;
    --muted: #5e6878;
    --line: #d8dde5;
    --accent: #146c94;
    --accent-strong: #0e4f6d;
    --danger: #a83f39;
    --ok: #276749;
    --field: #fbfcfe;
    --shadow: 0 16px 40px rgba(29, 36, 48, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
    line-height: 1.5;
}

button,
input,
select,
textarea {
    font: inherit;
}

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

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

h1,
h2,
p {
    margin: 0;
}

h1 {
    font-size: clamp(26px, 4vw, 40px);
    font-weight: 700;
    letter-spacing: 0;
}

h2 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0;
}

.subtitle,
.muted,
.statusText {
    color: var(--muted);
}

.panel,
.resultBox {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.panel {
    padding: 24px;
}

.resultBox {
    margin-top: 22px;
    padding: 18px;
}

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

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

.modeButton {
    color: var(--accent-strong);
    background: #f7fafc;
    border-color: var(--line);
}

.modeButton.is-active {
    color: #ffffff;
    background: var(--accent);
    border-color: var(--accent);
}

.statusPill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 3px 10px;
    border: 1px solid rgba(20, 108, 148, 0.25);
    border-radius: 999px;
    color: var(--accent-strong);
    background: #edf7fb;
    white-space: nowrap;
    font-size: 13px;
}

.statusPill.danger {
    color: var(--danger);
    border-color: rgba(168, 63, 57, 0.25);
    background: #fff1ef;
}

.field,
.miniField {
    display: grid;
    gap: 7px;
}

.field {
    margin-top: 16px;
}

.field span,
.miniField span {
    color: var(--muted);
    font-size: 13px;
}

textarea,
input,
select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--field);
    color: var(--text);
    outline: none;
}

textarea {
    min-height: 92px;
    resize: vertical;
    padding: 12px;
    font-family: Consolas, "Microsoft YaHei", monospace;
}

#secretInput {
    min-height: 42px;
    height: 42px;
    resize: none;
    overflow: hidden;
}

#tokenListInput {
    overflow: hidden;
}

input,
select {
    min-height: 42px;
    padding: 8px 10px;
}

textarea:focus,
input:focus,
select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(20, 108, 148, 0.16);
}

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

.toolbar,
.actions {
    display: flex;
    align-items: end;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.miniField {
    width: 132px;
}

button,
.toplink {
    min-height: 40px;
    border-radius: 6px;
    border: 1px solid transparent;
    padding: 8px 14px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.62;
}

.primary {
    color: #ffffff;
    background: var(--accent);
}

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

.secondary,
.toplink {
    color: var(--accent-strong);
    background: #edf7fb;
    border-color: rgba(20, 108, 148, 0.22);
}

.ghost {
    color: var(--muted);
    background: transparent;
    border-color: var(--line);
}

.statusText {
    min-height: 24px;
}

.linksList {
    display: grid;
    gap: 10px;
}

.linkRow {
    display: grid;
    grid-template-columns: 92px 1fr auto;
    align-items: center;
    gap: 10px;
}

.linkRow input {
    font-family: Consolas, monospace;
}

.linkLabel {
    color: var(--muted);
    font-size: 13px;
}

.is-hidden {
    display: none !important;
}

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

.errorText {
    color: var(--danger);
}

.footer {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 28px;
    justify-content: center;
    margin-top: 34px;
    color: var(--muted);
    font-size: 15px;
}

.footer a {
    color: var(--accent-strong);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

@media (max-width: 720px) {
    .shell {
        width: min(100% - 20px, 980px);
        padding: 18px 0;
    }

    .topbar,
    .sectionHead {
        align-items: stretch;
        flex-direction: column;
    }

    .modeSwitch {
        grid-template-columns: 1fr;
    }

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

    .panel {
        padding: 18px;
    }

    .linkRow {
        grid-template-columns: 1fr;
    }
}
