:root {
    --paper: #f3f6f3;
    --surface: #ffffff;
    --ink: #16231d;
    --muted: #66736c;
    --line: #dce4df;
    --line-strong: #c8d4cd;
    --blue: #175cd3;
    --blue-dark: #1049a9;
    --green: #17855f;
    --green-soft: #e9f6f0;
    --red: #c5413d;
    --red-soft: #fff0ef;
    --shadow: 0 24px 70px rgba(24, 43, 34, 0.09);
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--paper);
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.72) 0, rgba(243, 246, 243, 0) 330px),
        var(--paper);
    font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
    font-size: 16px;
    letter-spacing: 0;
}

button,
input {
    font: inherit;
    letter-spacing: 0;
}

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

button {
    border: 0;
}

.site-grid {
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.34;
    background-image:
        linear-gradient(rgba(22, 35, 29, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(22, 35, 29, 0.045) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: linear-gradient(to bottom, #000 0, transparent 620px);
}

.topbar {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: min(1120px, calc(100% - 48px));
    height: 82px;
    margin: 0 auto;
    border-bottom: 1px solid rgba(200, 212, 205, 0.72);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--ink);
    text-decoration: none;
}

.brand-mark {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    color: #fff;
    background: var(--ink);
    border-radius: 8px;
}

.brand-mark svg {
    width: 20px;
    height: 20px;
}

.brand strong,
.brand small {
    display: block;
}

.brand strong {
    font-size: 16px;
    line-height: 1.1;
}

.brand small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
}

.admin-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 0 13px;
    color: #435149;
    border: 1px solid var(--line-strong);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.62);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.admin-link:hover {
    color: var(--ink);
    border-color: #aebdb4;
    background: #fff;
}

.admin-link svg {
    width: 16px;
    height: 16px;
}

.page {
    position: relative;
    z-index: 1;
    width: min(1040px, calc(100% - 48px));
    margin: 0 auto;
    padding: 80px 0 56px;
}

.converter {
    display: grid;
    grid-template-columns: minmax(260px, 0.78fr) minmax(460px, 1.5fr);
    gap: 64px;
    align-items: center;
}

.intro {
    align-self: start;
    padding-top: 20px;
}

.title-line {
    display: flex;
    align-items: center;
    gap: 13px;
    margin-bottom: 27px;
}

.eyebrow {
    color: var(--green);
    font-family: "Consolas", "SFMono-Regular", monospace;
    font-size: 11px;
    font-weight: 700;
}

.live-dot {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 11px;
}

.live-dot i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 0 4px var(--green-soft);
}

h1 {
    margin: 0;
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    font-size: 52px;
    font-weight: 800;
    line-height: 1.14;
}

h1 span {
    color: var(--blue);
}

.intro > p {
    max-width: 340px;
    margin: 24px 0 0;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.8;
}

.tool {
    position: relative;
    padding: 34px;
    background: var(--surface);
    border: 1px solid rgba(200, 212, 205, 0.88);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.tool::before {
    position: absolute;
    top: 0;
    left: 34px;
    right: 34px;
    height: 3px;
    content: "";
    background: linear-gradient(90deg, var(--blue) 0 42%, var(--green) 42% 100%);
    border-radius: 0 0 3px 3px;
}

.field-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 11px;
}

.field-head label {
    color: #26342d;
    font-size: 14px;
    font-weight: 700;
}

.field-head span {
    color: #859089;
    font-family: "Consolas", "SFMono-Regular", monospace;
    font-size: 10px;
}

.input-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 144px;
    gap: 10px;
}

.url-field {
    position: relative;
    min-width: 0;
}

.url-field > svg {
    position: absolute;
    top: 50%;
    left: 16px;
    width: 18px;
    height: 18px;
    color: #7d8982;
    pointer-events: none;
    transform: translateY(-50%);
}

.url-field input {
    width: 100%;
    height: 54px;
    padding: 0 16px 0 46px;
    color: var(--ink);
    outline: none;
    background: #f8faf8;
    border: 1px solid var(--line-strong);
    border-radius: 7px;
    font-size: 14px;
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.url-field input::placeholder {
    color: #a3aca7;
}

.url-field input:focus {
    background: #fff;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(23, 92, 211, 0.11);
}

.convert-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 54px;
    padding: 0 20px;
    overflow: hidden;
    color: #fff;
    background: var(--blue);
    border-radius: 7px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    transition: background 160ms ease, transform 160ms ease;
}

.convert-button:hover {
    background: var(--blue-dark);
}

.convert-button:active {
    transform: translateY(1px);
}

.convert-button:focus-visible,
.copy-button:focus-visible,
.open-button:focus-visible,
.refresh-button:focus-visible,
.admin-link:focus-visible {
    outline: 3px solid rgba(23, 92, 211, 0.22);
    outline-offset: 2px;
}

.convert-button svg {
    width: 17px;
    height: 17px;
}

.button-loader {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.42);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 650ms linear infinite;
}

.convert-button.is-loading .button-loader {
    display: inline-block;
}

.convert-button.is-loading svg {
    display: none;
}

.convert-button:disabled {
    cursor: wait;
    opacity: 0.86;
}

.form-message {
    min-height: 20px;
    margin: 10px 0 -10px;
    color: var(--red);
    font-size: 12px;
    line-height: 1.55;
}

.form-message.is-success {
    color: var(--green);
}

.result-panel {
    margin-top: 32px;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    box-shadow: 0 18px 50px rgba(24, 43, 34, 0.07);
    animation: panel-in 260ms ease both;
}

.result-main {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 18px;
    padding: 28px 30px 26px;
}

.section-icon {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    color: #fff;
    background: var(--green);
    border-radius: 50%;
}

.section-icon svg {
    width: 21px;
    height: 21px;
}

.result-copy {
    min-width: 0;
}

.result-kicker {
    margin: 0 0 6px;
    color: var(--green);
    font-family: "Consolas", "SFMono-Regular", monospace;
    font-size: 10px;
    font-weight: 700;
}

.result-copy h2 {
    margin: 0 0 15px;
    font-size: 18px;
    line-height: 1.3;
}

.generated-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 42px;
    gap: 8px;
}

.generated-row input {
    min-width: 0;
    height: 42px;
    padding: 0 13px;
    color: #334239;
    outline: none;
    background: #f7f9f7;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-family: "Consolas", "SFMono-Regular", monospace;
    font-size: 12px;
}

.copy-button,
.open-button,
.refresh-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--blue);
    background: #eef4ff;
    border: 1px solid #d5e2fa;
    border-radius: 6px;
    cursor: pointer;
    transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.copy-button {
    gap: 7px;
    height: 42px;
    padding: 0 14px;
    font-size: 12px;
    font-weight: 700;
}

.copy-button svg,
.open-button svg,
.refresh-button svg {
    width: 16px;
    height: 16px;
}

.copy-button:hover,
.open-button:hover,
.refresh-button:hover {
    color: #fff;
    background: var(--blue);
    border-color: var(--blue);
}

.copy-button.is-copied {
    color: #fff;
    background: var(--green);
    border-color: var(--green);
}

.open-button {
    width: 42px;
    height: 42px;
    text-decoration: none;
}

.code-strip {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 42px;
    gap: 24px;
    align-items: center;
    min-height: 92px;
    padding: 17px 30px;
    background: #f7faf7;
    border-top: 1px solid var(--line);
    border-radius: 0 0 var(--radius) var(--radius);
}

.code-label {
    margin: 0 0 4px;
    color: var(--muted);
    font-size: 11px;
}

.code-value {
    min-height: 36px;
    color: var(--ink);
    font-family: "Consolas", "SFMono-Regular", monospace;
    font-size: 30px;
    font-weight: 700;
    line-height: 1.15;
}

.code-state {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 11px;
    white-space: nowrap;
}

.pulse {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 0 4px var(--green-soft);
}

.code-state.is-error .pulse {
    background: var(--red);
    box-shadow: 0 0 0 4px var(--red-soft);
}

.refresh-button {
    width: 42px;
    height: 42px;
}

.refresh-button.is-spinning svg {
    animation: spin 650ms linear infinite;
}

.footer {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: min(1120px, calc(100% - 48px));
    min-height: 68px;
    margin: 0 auto;
    color: #849088;
    border-top: 1px solid rgba(200, 212, 205, 0.65);
    font-size: 10px;
    font-family: "Consolas", "SFMono-Regular", monospace;
}

.footer-separator {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: #a9b4ad;
}

.toast {
    position: fixed;
    z-index: 20;
    right: 24px;
    bottom: 24px;
    max-width: min(360px, calc(100% - 48px));
    padding: 11px 15px;
    color: #fff;
    background: #1d2b24;
    border-radius: 7px;
    box-shadow: 0 12px 36px rgba(16, 32, 23, 0.2);
    font-size: 12px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

[hidden] {
    display: none !important;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes panel-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 860px) {
    .page {
        padding-top: 56px;
    }

    .converter {
        grid-template-columns: 1fr;
        gap: 34px;
    }

    .intro {
        padding-top: 0;
    }

    h1 {
        font-size: 44px;
    }

    .intro > p {
        max-width: 520px;
    }
}

@media (max-width: 620px) {
    .topbar,
    .page,
    .footer {
        width: min(100% - 28px, 1040px);
    }

    .topbar {
        height: 72px;
    }

    .brand small {
        display: none;
    }

    .admin-link {
        width: 38px;
        padding: 0;
        justify-content: center;
    }

    .admin-link span {
        display: none;
    }

    .page {
        padding: 42px 0 36px;
    }

    .intro {
        padding: 0 4px;
    }

    .title-line {
        margin-bottom: 20px;
    }

    h1 {
        font-size: 38px;
    }

    .intro > p {
        margin-top: 17px;
        font-size: 14px;
    }

    .tool {
        padding: 24px 18px 20px;
    }

    .tool::before {
        left: 18px;
        right: 18px;
    }

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

    .convert-button {
        width: 100%;
    }

    .result-main {
        grid-template-columns: 1fr;
        gap: 13px;
        padding: 23px 18px 20px;
    }

    .section-icon {
        width: 36px;
        height: 36px;
    }

    .generated-row {
        grid-template-columns: minmax(0, 1fr) 42px;
    }

    .generated-row input {
        grid-column: 1 / -1;
    }

    .copy-button {
        width: 100%;
        grid-column: 1;
    }

    .open-button {
        grid-column: 2;
    }

    .code-strip {
        grid-template-columns: minmax(0, 1fr) 42px;
        gap: 14px;
        padding: 17px 18px;
    }

    .code-state {
        grid-row: 2;
        grid-column: 1;
    }

    .refresh-button {
        grid-row: 1 / 3;
        grid-column: 2;
    }

    .footer {
        flex-wrap: wrap;
        min-height: 62px;
        padding: 14px 0;
        text-align: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
