/* =========================================================
   短链接生成器 · 前台样式
   ========================================================= */
:root {
    --primary: #6c5ce7;
    --primary-2: #8b5cf6;
    --primary-dark: #5a49d6;
    --ink: #16142b;
    --ink-2: #3d3a57;
    --muted: #7f7d95;
    --muted-2: #a3a1b4;
    --line: #eceaf4;
    --line-2: #f4f2fb;
    --soft: #fbfaff;
    --maxw: 1120px;
    --shadow: 0 18px 40px rgba(40, 26, 110, .07);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: #fff;
    color: var(--ink);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
button, input { font-family: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ---------------- 顶部导航 ---------------- */
.nav {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 255, 255, .84);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid rgba(236, 234, 244, .85);
}

.nav-inner { height: 68px; display: flex; align-items: center; justify-content: space-between; }

.brand { display: inline-flex; align-items: center; gap: 10px; }

.brand-mark {
    width: 34px; height: 34px; border-radius: 10px;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: #fff; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 6px 16px rgba(108, 92, 231, .28);
}
.brand-mark svg { width: 18px; height: 18px; }
.brand-name { font-size: 15.5px; font-weight: 700; letter-spacing: -.2px; }

.nav-links { display: flex; align-items: center; gap: 26px; }
.nav-links > a:not(.btn) { font-size: 13.5px; color: var(--muted); transition: color .15s; }
.nav-links > a:not(.btn):hover { color: var(--ink); }

/* ---------------- 按钮 ---------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    height: 42px; padding: 0 20px; border: 0; border-radius: 10px;
    font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
    transition: transform .15s, box-shadow .2s, background .2s, border-color .2s, color .2s;
    text-decoration: none;
}
.btn:focus-visible { outline: 2px solid #b9aaf7; outline-offset: 2px; }
.btn:disabled { opacity: .62; cursor: not-allowed; transform: none !important; }

.btn-primary {
    background: linear-gradient(135deg, #7c5cff, #5b4bd6);
    color: #fff;
    box-shadow: 0 10px 24px rgba(108, 92, 231, .28);
}
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 14px 28px rgba(108, 92, 231, .34); }

.btn-outline { background: #fff; border: 1px solid var(--line); color: var(--ink-2); }
.btn-outline:hover { border-color: #cfc7f0; color: var(--primary); }

.btn-dark { background: #1b1833; color: #fff; }
.btn-dark:hover { background: #2a2550; }

.btn-sm { height: 38px; padding: 0 16px; font-size: 13.5px; border-radius: 9px; }
.btn-sm.btn-dark { height: 34px; padding: 0 16px; font-size: 13px; }

.text-btn {
    display: inline-flex; align-items: center; gap: 4px;
    background: none; border: 0; padding: 0; cursor: pointer;
    font-size: 13px; color: var(--primary); font-weight: 500;
}
.text-btn:hover { color: var(--primary-dark); }
.text-btn.muted { color: var(--muted-2); font-weight: 400; }
.text-btn.muted:hover { color: #c02b3f; }

/* ---------------- Hero ---------------- */
.hero { position: relative; padding: 60px 0 44px; overflow: hidden; }

.hero-glow {
    position: absolute; inset: 0; pointer-events: none;
    background:
        radial-gradient(640px 320px at 50% -6%, rgba(139, 92, 246, .17), transparent 68%),
        radial-gradient(420px 260px at 6% 24%, rgba(167, 139, 250, .13), transparent 70%),
        radial-gradient(440px 280px at 96% 12%, rgba(99, 102, 241, .11), transparent 70%);
}

.hero-inner { position: relative; text-align: center; }

.pill {
    display: inline-flex; align-items: center; gap: 6px;
    height: 30px; padding: 0 14px; border-radius: 999px;
    background: #fff; border: 1px solid #ece8fa;
    color: #6b5bd6; font-size: 12.5px; font-weight: 500;
    box-shadow: 0 2px 10px rgba(108, 92, 231, .07);
}

.hero h1 {
    font-size: 46px; line-height: 1.18; font-weight: 800;
    letter-spacing: -1.4px; margin: 20px 0 16px;
}
.grad {
    background: linear-gradient(100deg, #a78bfa 0%, #7c5cff 45%, #5b4bd6 100%);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}

.hero-sub { color: var(--muted); font-size: 15px; max-width: 540px; margin: 0 auto 30px; }

/* 输入区 */
.shorten { max-width: 660px; margin: 0 auto; text-align: left; }

.input-shell {
    display: flex; align-items: center; gap: 10px;
    background: #fff; border: 1px solid #e7e4f3; border-radius: 14px;
    padding: 7px 7px 7px 16px;
    box-shadow: 0 14px 34px rgba(60, 40, 140, .08);
    transition: border-color .2s, box-shadow .2s;
}
.input-shell:focus-within {
    border-color: #b9aaf7;
    box-shadow: 0 16px 36px rgba(108, 92, 231, .13), 0 0 0 4px rgba(139, 92, 246, .08);
}
.input-icon { display: flex; color: #a8a5bd; flex: none; }
.input-icon svg { width: 18px; height: 18px; }
.input-shell input {
    flex: 1; min-width: 0; height: 44px; border: 0; outline: 0;
    font-size: 14.5px; color: var(--ink); background: transparent;
}
.input-shell input::placeholder { color: #adaabd; }
.input-shell .btn { height: 46px; padding: 0 24px; flex: none; }

.shorten-extra {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 12px; padding: 0 4px;
}
.shorten-hint { font-size: 12.5px; color: var(--muted-2); }

.custom-row {
    display: flex; align-items: center; gap: 2px;
    margin-top: 10px; padding: 6px 14px;
    background: #fff; border: 1px dashed #ddd7f3; border-radius: 12px;
}
.custom-prefix { font-size: 13.5px; color: #9a97ad; white-space: nowrap; }
.custom-row input {
    flex: 1; min-width: 0; height: 36px; border: 0; outline: 0;
    font-size: 14px; color: var(--ink); background: transparent;
}

/* 错误提示 */
.alert-box {
    margin: 16px auto 0; max-width: 660px;
    background: #fff4f5; border: 1px solid #ffdadd; color: #c02b3f;
    font-size: 13.5px; padding: 11px 14px; border-radius: 10px;
    text-align: left; display: flex; align-items: center; gap: 8px;
}

/* 生成结果 */
.result-card {
    position: relative; max-width: 660px; margin: 22px auto 0;
    background: #fff; border: 1px solid #eae6f7; border-radius: 16px;
    box-shadow: 0 22px 48px rgba(50, 32, 120, .1);
    padding: 22px; text-align: left;
    animation: rise .32s ease both;
}

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.result-close {
    position: absolute; top: 12px; right: 12px;
    width: 26px; height: 26px; border: 0; border-radius: 8px;
    background: #f6f4fc; color: #9b98ae;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
    transition: background .15s, color .15s;
}
.result-close:hover { background: #ece8fa; color: var(--ink-2); }

.result-body { display: flex; align-items: center; gap: 24px; }
.result-main { flex: 1; min-width: 0; }

.result-head {
    display: inline-flex; align-items: center; gap: 7px;
    color: #12a05c; font-size: 13px; font-weight: 600;
}
.check-badge {
    width: 18px; height: 18px; border-radius: 50%;
    background: #e8f8f0; color: #12a05c;
    display: inline-flex; align-items: center; justify-content: center;
}

.result-url {
    display: block; margin: 9px 0 14px;
    font-size: 19px; font-weight: 700; letter-spacing: -.2px;
    color: #5b4bd6; word-break: break-all;
}
.result-url:hover { text-decoration: underline; text-underline-offset: 3px; }

.result-actions { display: flex; align-items: center; gap: 10px; }

.result-meta {
    margin-top: 14px; font-size: 12.5px; color: #9a97ad;
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.result-meta b { color: #5b5877; font-weight: 600; }

.dot { width: 3px; height: 3px; border-radius: 50%; background: #d3d0e2; display: inline-block; flex: none; }

.result-qr { flex: none; text-align: center; }
.result-qr img {
    width: 116px; height: 116px; display: block;
    border: 1px solid #eeebf7; border-radius: 10px; padding: 6px; background: #fff;
}
.qr-download { display: inline-block; margin-top: 6px; font-size: 12px; color: #8a879e; }
.qr-download:hover { color: var(--primary); }

.hero-stats {
    margin-top: 28px; display: flex; align-items: center; justify-content: center;
    gap: 10px; font-size: 12.5px; color: #a5a2b6;
}
.hero-stats b { color: #6b6880; font-weight: 600; }

/* ---------------- 通用区块 ---------------- */
.section { padding: 44px 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 18px; gap: 16px; }
.section-head h2 { font-size: 25px; letter-spacing: -.7px; font-weight: 750; }
.section-head p { color: var(--muted); font-size: 13.5px; margin-top: 5px; }
.section-head.center { display: block; text-align: center; margin-bottom: 34px; }

/* ---------------- 历史记录 ---------------- */
.history-card {
    background: #fff; border: 1px solid var(--line); border-radius: 16px;
    box-shadow: 0 12px 30px rgba(40, 26, 110, .04); overflow: hidden;
}

.search-bar {
    display: flex; align-items: center; gap: 9px;
    padding: 14px 18px; border-bottom: 1px solid var(--line-2);
    color: #aaa7bd;
}
.search-bar svg { width: 16px; height: 16px; flex: none; }
.search-bar input { flex: 1; min-width: 0; height: 24px; border: 0; outline: 0; background: transparent; font-size: 13.5px; color: var(--ink); }
.search-bar input::placeholder { color: #b3b0c2; }

.history-list { max-height: 430px; overflow-y: auto; }

.history-item {
    display: flex; align-items: center; gap: 14px;
    padding: 15px 18px; border-bottom: 1px solid #f6f4fb;
    transition: background .15s;
}
.history-item:last-child { border-bottom: 0; }
.history-item:hover { background: #fcfbff; }

.fav {
    width: 34px; height: 34px; border-radius: 9px; flex: none;
    background: #f3f0ff; color: #7c6cf0;
    display: flex; align-items: center; justify-content: center;
    font-size: 13.5px; font-weight: 700; text-transform: uppercase;
}

.history-info { flex: 1; min-width: 0; }
.history-long {
    font-size: 13px; color: #6f6c85;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.history-sub { margin-top: 4px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.history-short { font-size: 13px; font-weight: 600; color: #5b4bd6; }
.history-meta { font-size: 12px; color: #a5a2b6; display: flex; align-items: center; gap: 6px; }

.history-actions { display: flex; gap: 2px; flex: none; }
.icon-btn {
    width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent;
    color: #8d8aa2; display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: background .15s, color .15s;
}
.icon-btn:hover { background: #f4f2fb; color: #5b4bd6; }
.icon-btn.danger:hover { background: #fff2f3; color: #c02b3f; }
.icon-btn svg { width: 15px; height: 15px; }

.empty-state { padding: 46px 20px; text-align: center; color: #a5a2b6; font-size: 13.5px; }
.empty-icon {
    width: 46px; height: 46px; border-radius: 14px; margin: 0 auto 12px;
    background: #f5f2ff; color: #a79cf0;
    display: flex; align-items: center; justify-content: center;
}
.empty-icon svg { width: 22px; height: 22px; }

/* ---------------- 功能特色 ---------------- */
.features { background: linear-gradient(180deg, #fbfaff, #fff); border-top: 1px solid #f4f1fb; }

.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }

.feature-card {
    background: #fff; border: 1px solid var(--line); border-radius: 16px;
    padding: 26px 24px; box-shadow: 0 8px 22px rgba(40, 26, 110, .035);
    transition: transform .2s, box-shadow .2s, border-color .2s;
}
.feature-card:hover { transform: translateY(-3px); box-shadow: 0 16px 34px rgba(40, 26, 110, .08); border-color: #e3def7; }

.feature-icon {
    width: 44px; height: 44px; border-radius: 13px; margin-bottom: 16px;
    display: flex; align-items: center; justify-content: center;
}
.feature-icon svg { width: 21px; height: 21px; }
.feature-icon.purple { background: #f1edff; color: #7c5cf5; }
.feature-icon.blue { background: #e9f2ff; color: #4a86e8; }
.feature-icon.green { background: #e8f8f0; color: #12a05c; }

.feature-card h3 { font-size: 15.5px; font-weight: 650; margin-bottom: 6px; }
.feature-card p { font-size: 13px; color: var(--muted); line-height: 1.75; }

/* ---------------- 页脚 ---------------- */
.footer { border-top: 1px solid var(--line); padding: 22px 0; font-size: 12.5px; color: #a3a1b4; }
.footer-inner { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.footer-right { margin-left: auto; }
.footer-right a:hover { color: var(--primary); }

/* ---------------- 弹窗 ---------------- */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-mask { position: absolute; inset: 0; background: rgba(20, 16, 45, .45); backdrop-filter: blur(4px); }
.modal-card {
    position: relative; width: 330px; max-width: 100%;
    background: #fff; border-radius: 18px; padding: 24px;
    text-align: center; box-shadow: 0 30px 70px rgba(20, 14, 60, .3);
    animation: rise .22s ease both;
}
.modal-close {
    position: absolute; top: 12px; right: 12px; width: 28px; height: 28px;
    border: 0; border-radius: 8px; background: #f6f4fc; color: #9b98ae;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.modal-card h3 { font-size: 16px; font-weight: 650; }
.modal-sub { font-size: 12.5px; color: #8b88a0; margin: 6px 0 16px; word-break: break-all; }
.modal-qr img { width: 200px; height: 200px; border: 1px solid #eeeaf8; border-radius: 12px; padding: 8px; background: #fff; }
.modal-actions { display: flex; justify-content: center; gap: 10px; margin-top: 16px; }

/* ---------------- 轻提示 ---------------- */
.toast {
    position: fixed; left: 50%; bottom: 40px; z-index: 200;
    transform: translate(-50%, 16px);
    background: rgba(26, 22, 50, .93); color: #fff;
    font-size: 13px; padding: 10px 18px; border-radius: 10px;
    opacity: 0; pointer-events: none;
    transition: opacity .22s, transform .22s;
    max-width: 80vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- 响应式 ---------------- */
@media (max-width: 860px) {
    .hero { padding: 48px 0 56px; }
    .hero h1 { font-size: 36px; letter-spacing: -1px; }
    .hero-sub { font-size: 14px; }
    .feature-grid { grid-template-columns: 1fr; }
    .section { padding: 44px 0; }
    .result-body { gap: 16px; }
    .result-qr img { width: 100px; height: 100px; }
}

@media (max-width: 640px) {
    .wrap { padding: 0 16px; }
    .nav-inner { height: 60px; }
    .nav-links { gap: 14px; }
    .nav-links > a:not(.btn) { display: none; }
    .hero { padding: 38px 0 48px; }
    .hero h1 { font-size: 30px; letter-spacing: -.8px; margin: 16px 0 12px; }
    .hero-sub { margin-bottom: 22px; }
    .input-shell { flex-wrap: wrap; padding: 10px; gap: 8px; }
    .input-icon { margin-left: 4px; }
    .input-shell input { height: 38px; font-size: 14px; }
    .input-shell .btn { width: 100%; height: 44px; }
    .shorten-extra { flex-direction: column; align-items: flex-start; gap: 2px; }
    .shorten-hint { display: none; }
    .result-card { padding: 18px; }
    .result-body { flex-direction: column; align-items: stretch; }
    .result-qr { display: flex; flex-direction: column; align-items: center; margin-top: 4px; }
    .result-url { font-size: 17px; }
    .section-head { flex-direction: column; align-items: flex-start; gap: 6px; }
    .history-item { gap: 10px; padding: 13px 14px; }
    .fav { display: none; }
    .history-actions { gap: 0; }
    .hero-stats { font-size: 12px; }
    .footer-inner { justify-content: center; }
    .footer-right { margin-left: 0; }
}
