/* s.iehong.fun — short link service
   One stylesheet, served from the binary. No build step. */

:root {
    --bg: #f7f8fc;
    --ink: #0f172a;
    --muted: #475569;
    --soft: #94a3b8;
    --primary: #4f46e5;
    --primary-2: #6366f1;
    --violet: #8b5cf6;
    --grad: linear-gradient(135deg, #4f46e5 0%, #6366f1 48%, #8b5cf6 100%);
    --card: rgba(255, 255, 255, 0.82);
    --border: rgba(15, 23, 42, 0.08);
    --radius-lg: 24px;
    --radius-md: 15px;
    --shadow-card: 0 26px 60px -30px rgba(79, 70, 229, 0.4), 0 2px 10px rgba(15, 23, 42, 0.04);
    --font: "PingFang SC", "PingFang-SC", -apple-system, BlinkMacSystemFont, "Segoe UI",
        "Noto Sans SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a {
    color: inherit;
}

::selection {
    background: rgba(99, 102, 241, 0.22);
}

/* ---------- ambient background ---------- */

.bg-blobs {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.blob {
    position: absolute;
    width: 46vmax;
    height: 46vmax;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.6;
}

.blob-a {
    top: -18vmax;
    left: -12vmax;
    background: radial-gradient(circle at 35% 35%, rgba(99, 102, 241, 0.55), transparent 66%);
    animation: drift 22s ease-in-out infinite;
}

.blob-b {
    right: -14vmax;
    bottom: -22vmax;
    background: radial-gradient(circle at 65% 65%, rgba(139, 92, 246, 0.5), transparent 66%);
    animation: drift 27s ease-in-out infinite reverse;
}

/* ---------- header ---------- */

.nav {
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: 22px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    text-decoration: none;
}

.brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 13px;
    display: grid;
    place-items: center;
    color: #fff;
    background: var(--grad);
    box-shadow: 0 10px 22px -10px rgba(79, 70, 229, 0.95);
}

.brand-text {
    font-size: 16px;
    font-weight: 650;
    letter-spacing: -0.01em;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 18px;
}

.nav-link {
    font-size: 13.5px;
    font-weight: 550;
    color: var(--muted);
    text-decoration: none;
    transition: color 0.18s ease;
}

.nav-link:hover {
    color: var(--primary);
}

.lang-switch {
    display: inline-flex;
    padding: 3px;
    gap: 2px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--border);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
    backdrop-filter: blur(10px);
}

.lang-item {
    padding: 6px 13px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
    transition: color 0.18s ease, background 0.18s ease;
}

.lang-item:hover {
    color: var(--ink);
}

.lang-item.is-active {
    color: #fff;
    background: var(--grad);
    box-shadow: 0 6px 14px -7px rgba(79, 70, 229, 0.9);
}

/* ---------- layout ---------- */

.main {
    flex: 1;
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    padding: 26px 24px 40px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.hero {
    text-align: center;
    padding: 18px 0 2px;
    animation: fade-up 0.65s ease both;
}

.hero h1 {
    margin: 0 0 14px;
    font-size: clamp(30px, 6.2vw, 46px);
    line-height: 1.14;
    font-weight: 700;
    letter-spacing: -0.035em;
    background: linear-gradient(118deg, #1e1b4b 4%, #4f46e5 52%, #8b5cf6 96%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero p {
    margin: 0 auto;
    max-width: 500px;
    font-size: clamp(14px, 2.6vw, 16.5px);
    line-height: 1.7;
    color: var(--muted);
}

/* ---------- card ---------- */

.card {
    padding: 26px;
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.74));
    border: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(18px);
    animation: fade-up 0.65s 0.06s ease both;
}

.field-label {
    display: block;
    margin-bottom: 8px;
    font-size: 12.5px;
    font-weight: 650;
    letter-spacing: 0.02em;
    color: var(--muted);
}

.url-field {
    position: relative;
}

.url-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #a5b4fc;
    pointer-events: none;
}

.text-input {
    width: 100%;
    height: 54px;
    padding: 0 16px;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--border);
    background: #fff;
    color: var(--ink);
    font-family: inherit;
    font-size: 15px;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.url-field .text-input {
    padding-left: 46px;
    font-family: var(--mono);
    font-size: 14px;
}

.text-input::placeholder {
    color: #b6c0d1;
    font-family: var(--font);
}

.text-input:focus {
    border-color: var(--primary-2);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.13);
}

.captcha-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.captcha-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 48px;
    padding: 0 14px;
    border-radius: 13px;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.08), rgba(139, 92, 246, 0.09));
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.captcha-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--primary);
}

.captcha-expr {
    font-family: var(--mono);
    font-size: 16px;
    font-weight: 600;
    color: #312e81;
    white-space: nowrap;
}

.captcha-input {
    width: 92px;
    height: 48px;
    padding: 0 12px;
    text-align: center;
    font-family: var(--mono);
    font-size: 15px;
    font-weight: 600;
}

.ghost-btn {
    height: 48px;
    padding: 0 14px;
    border-radius: 13px;
    border: 1px dashed rgba(79, 70, 229, 0.32);
    background: rgba(255, 255, 255, 0.65);
    color: var(--primary);
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 650;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.ghost-btn:hover {
    background: rgba(79, 70, 229, 0.07);
    border-color: rgba(79, 70, 229, 0.5);
    transform: translateY(-1px);
}

.primary-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: 100%;
    height: 52px;
    margin-top: 16px;
    padding: 0 20px;
    border: 0;
    border-radius: var(--radius-md);
    background: var(--grad);
    color: #fff;
    font-family: inherit;
    font-size: 15.5px;
    font-weight: 650;
    letter-spacing: 0.01em;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 16px 32px -16px rgba(79, 70, 229, 0.95);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.primary-btn:hover {
    transform: translateY(-1.5px);
    box-shadow: 0 20px 38px -16px rgba(79, 70, 229, 1);
}

.primary-btn:active {
    transform: translateY(0) scale(0.996);
}

.primary-btn:disabled {
    cursor: progress;
    opacity: 0.82;
    transform: none;
}

.primary-btn:focus-visible,
.ghost-btn:focus-visible,
.copy-btn:focus-visible,
.lang-item:focus-visible,
.text-input:focus-visible {
    outline: 2px solid var(--primary-2);
    outline-offset: 2px;
}

.spinner {
    display: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    animation: spin 0.7s linear infinite;
}

.is-loading .spinner {
    display: block;
}

.form-error {
    margin: 14px 0 0;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(220, 38, 38, 0.07);
    border: 1px solid rgba(220, 38, 38, 0.16);
    color: #dc2626;
    font-size: 13px;
}

/* ---------- result ---------- */

.result-card {
    margin-top: 18px;
    padding: 18px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.06), rgba(139, 92, 246, 0.08));
    border: 1px solid rgba(99, 102, 241, 0.2);
    animation: pop 0.32s ease both;
}

.result-label {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.11em;
    text-transform: uppercase;
    color: var(--primary);
}

.result-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 9px;
    flex-wrap: wrap;
}

.result-url {
    flex: 1 1 220px;
    font-family: var(--mono);
    font-size: 16px;
    font-weight: 600;
    color: #312e81;
    text-decoration: none;
    word-break: break-all;
}

.result-url:hover {
    text-decoration: underline;
}

.copy-btn {
    height: 40px;
    padding: 0 16px;
    border-radius: 11px;
    border: 1px solid rgba(79, 70, 229, 0.25);
    background: #fff;
    color: var(--primary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 650;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.copy-btn:hover {
    background: rgba(79, 70, 229, 0.07);
}

.copy-btn.is-copied {
    background: #16a34a;
    border-color: #16a34a;
    color: #fff;
}

.result-actions {
    margin-top: 10px;
    display: flex;
    gap: 16px;
    font-size: 13px;
}

.ghost-link {
    color: var(--muted);
    text-decoration: none;
    border-bottom: 1px dashed rgba(71, 85, 105, 0.35);
}

.ghost-link:hover {
    color: var(--primary);
    border-bottom-color: rgba(79, 70, 229, 0.5);
}

/* ---------- api ---------- */

.api-card {
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.62);
    backdrop-filter: blur(12px);
    overflow: hidden;
    animation: fade-up 0.65s 0.12s ease both;
}

.api-card summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 18px;
    cursor: pointer;
    list-style: none;
    font-size: 13.5px;
    font-weight: 650;
    color: var(--muted);
}

.api-card summary::-webkit-details-marker {
    display: none;
}

.api-card summary:hover {
    color: var(--primary);
}

.api-chevron {
    color: var(--primary);
    font-size: 16px;
    transition: transform 0.2s ease;
}

.api-card[open] .api-chevron {
    transform: rotate(45deg);
}

.api-body {
    padding: 0 18px 18px;
}

.api-desc {
    margin: 0 0 12px;
    font-size: 12.5px;
    color: var(--soft);
    line-height: 1.6;
}

.api-step {
    margin: 12px 0 6px;
    font-size: 12px;
    font-weight: 650;
    color: var(--muted);
}

.api-card pre {
    margin: 0;
    padding: 13px 15px;
    border-radius: 12px;
    background: #0f172a;
    color: #e0e7ff;
    font-family: var(--mono);
    font-size: 12px;
    line-height: 1.65;
    overflow-x: auto;
    white-space: pre;
}

/* ---------- features / footer ---------- */

.features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    animation: fade-up 0.65s 0.18s ease both;
}

.feature {
    padding: 15px 12px;
    text-align: center;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.55);
}

.feature h3 {
    margin: 0 0 4px;
    font-size: 13px;
    font-weight: 650;
}

.feature p {
    margin: 0;
    font-size: 11.5px;
    line-height: 1.5;
    color: var(--soft);
}

.footer {
    margin: 4px 0 0;
    text-align: center;
    font-size: 11.5px;
    color: #a9b3c4;
}

/* ---------- interstitial ---------- */

.redirect-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 24px 56px;
}

.redirect-card {
    width: 100%;
    max-width: 470px;
    padding: 30px 26px 26px;
    text-align: center;
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.78));
    border: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(18px);
    animation: fade-up 0.5s ease both;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 13px;
    border-radius: 999px;
    background: rgba(79, 70, 229, 0.09);
    color: var(--primary);
    font-size: 11.5px;
    font-weight: 650;
    letter-spacing: 0.01em;
}

.badge .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.5);
    animation: pulse 1.8s infinite;
}

.redirect-card h1 {
    margin: 14px 0 6px;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.redirect-host {
    margin: 0;
    font-family: var(--mono);
    font-size: 12.5px;
    color: var(--soft);
    word-break: break-all;
}

.ring {
    position: relative;
    width: 132px;
    height: 132px;
    margin: 18px auto 10px;
}

.ring svg {
    transform: rotate(-90deg);
    display: block;
}

.ring-track {
    fill: none;
    stroke: rgba(79, 70, 229, 0.12);
    stroke-width: 8;
}

.ring-bar {
    fill: none;
    stroke: url(#ringGrad);
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.1s linear;
}

.count {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 40px;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: #312e81;
    font-variant-numeric: tabular-nums;
}

.redirect-desc {
    margin: 0 0 20px;
    font-size: 13px;
    color: var(--muted);
}

.redirect-desc strong {
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}

/* 广告位：投放时替换 .ad-placeholder 内部内容即可 */
.ad-slot {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    margin: 0 0 18px;
    padding: 30px 16px 22px;
    border-radius: 18px;
    border: 1.5px dashed rgba(99, 102, 241, 0.32);
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.045), rgba(139, 92, 246, 0.055));
}

.ad-tag {
    position: absolute;
    top: 10px;
    left: 13px;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: rgba(71, 85, 105, 0.62);
}

.ad-placeholder {
    margin: 4px 0 0;
    font-size: 12.5px;
    color: #a9b3c4;
}

.redirect-card .primary-btn {
    margin-top: 0;
}

.redirect-hint {
    margin: 10px 0 0;
    font-size: 12px;
    color: var(--soft);
}

.target-display {
    margin: 18px 0 0;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    font-family: var(--mono);
    font-size: 11.5px;
    color: #a9b3c4;
    word-break: break-all;
}

.safety {
    margin: 8px 0 0;
    font-size: 11px;
    color: #b6c0d1;
}

/* ---------- 404 ---------- */

.notfound {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px 72px;
    text-align: center;
}

.notfound-code {
    font-size: clamp(76px, 19vw, 116px);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.05em;
    background: linear-gradient(120deg, #4f46e5, #8b5cf6);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.notfound h1 {
    margin: 10px 0 8px;
    font-size: 21px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.notfound p {
    margin: 0 0 22px;
    max-width: 420px;
    font-size: 13.5px;
    line-height: 1.7;
    color: var(--muted);
}

.notfound .primary-btn {
    width: auto;
    min-width: 190px;
    margin-top: 0;
    padding: 0 26px;
    display: inline-flex;
}

/* ---------- motion ---------- */

@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pop {
    from {
        opacity: 0;
        transform: scale(0.985) translateY(6px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes drift {
    0%,
    100% {
        transform: translate3d(0, 0, 0) scale(1);
    }
    50% {
        transform: translate3d(4vmax, 3vmax, 0) scale(1.08);
    }
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.45);
    }
    70% {
        box-shadow: 0 0 0 7px rgba(79, 70, 229, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(79, 70, 229, 0);
    }
}

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

/* ---------- responsive ---------- */

@media (max-width: 560px) {
    .nav {
        padding: 16px 16px 12px;
    }

    .brand-text {
        font-size: 15px;
    }

    .nav-right {
        gap: 12px;
    }

    .main {
        padding: 18px 16px 32px;
        gap: 20px;
    }

    .card {
        padding: 20px 18px;
        border-radius: 20px;
    }

    .hero {
        padding-top: 8px;
    }

    .captcha-chip {
        flex: 1 1 100%;
        justify-content: center;
    }

    .captcha-input {
        flex: 1 1 0;
        width: auto;
        min-width: 0;
    }

    .ghost-btn {
        flex: 0 0 auto;
    }

    .features {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .feature {
        display: flex;
        align-items: baseline;
        gap: 10px;
        text-align: left;
        padding: 12px 14px;
    }

    .feature h3 {
        margin: 0;
        flex: 0 0 auto;
    }

    .redirect-main {
        padding: 12px 16px 40px;
    }

    .redirect-card {
        padding: 24px 18px 22px;
    }

    .count {
        font-size: 36px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001s !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001s !important;
    }
}
