:root {
    color-scheme: light;
    --ink: #161918;
    --muted: #68716d;
    --line: #dfe5e2;
    --paper: #ffffff;
    --canvas: #f3f5f4;
    --green: #07c160;
    --green-dark: #069f50;
    --coral: #ff655b;
    --cyan: #00d9e8;
    --danger: #d33d32;
    --shadow: 0 18px 50px rgba(27, 44, 36, 0.12);
    font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; color: var(--ink); background: var(--canvas); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.site-header {
    min-height: 64px;
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--ink);
    color: #fff;
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; }
.brand-mark { width: 30px; height: 30px; display: grid; place-items: center; background: var(--green); color: #07150d; border-radius: 6px; }
.admin-main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 48px 0 72px; }
.intro-band { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
.eyebrow { margin: 0 0 9px; color: var(--green-dark); font-size: 13px; font-weight: 800; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
.intro-band h1 { margin-bottom: 10px; font-size: clamp(30px, 5vw, 48px); line-height: 1.15; }
.lede { margin: 0; color: var(--muted); }
.count-block { min-width: 112px; border-left: 3px solid var(--coral); padding-left: 16px; }
.count-block strong, .count-block span { display: block; }
.count-block strong { font-size: 32px; }
.count-block span { color: var(--muted); font-size: 13px; }
.workspace-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(300px, .7fr); background: var(--paper); border: 1px solid var(--line); }
.tool-panel { padding: 34px; }
.tool-panel h2, .links-section h2 { margin-bottom: 24px; font-size: 20px; }
.stack-form { display: grid; gap: 12px; }
.stack-form label { font-size: 14px; font-weight: 700; }
.stack-form input, .stack-form textarea { width: 100%; border: 1px solid #cbd3cf; border-radius: 5px; padding: 12px 14px; color: var(--ink); background: #fff; outline: none; resize: vertical; }
.stack-form input:focus, .stack-form textarea:focus { border-color: var(--green-dark); box-shadow: 0 0 0 3px rgba(7, 193, 96, .12); }
.field-hint { margin: -4px 0 5px; color: var(--muted); font-size: 12px; }
code { color: #8a3029; background: #fff2ef; padding: 2px 5px; border-radius: 3px; }
.primary-button { min-height: 46px; border: 0; border-radius: 5px; padding: 0 18px; background: var(--ink); color: #fff; font-weight: 750; }
.primary-button:hover { background: #303534; }
.primary-button:disabled { cursor: wait; opacity: .7; }
.secondary-button { min-height: 46px; border: 1px solid #aebbb4; border-radius: 5px; padding: 0 18px; background: #fff; color: var(--ink); font-weight: 750; }
.secondary-button:hover { border-color: var(--green-dark); color: #087947; background: #f5fbf7; }
.secondary-button:disabled { cursor: wait; opacity: .7; }
.upload-zone { min-height: 190px; position: relative; display: grid; place-items: center; align-content: center; gap: 7px; overflow: hidden; border: 1px dashed #aebbb4; border-radius: 5px; background: #f8faf9; text-align: center; cursor: pointer; transition: border-color .2s ease, background .2s ease; }
.upload-zone:hover, .upload-zone.is-dragging { border-color: var(--green-dark); background: #f0faf5; }
.upload-zone.has-error { border-color: var(--danger); background: #fff7f6; }
.upload-zone.has-error .upload-icon { border-color: var(--danger); color: var(--danger); }
.upload-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.upload-zone strong, .upload-zone small, .upload-icon { position: relative; z-index: 2; }
.upload-zone small { color: var(--muted); }
.upload-icon { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid #b9c4be; border-radius: 50%; color: #087947; font-size: 22px; background: #fff; }
.upload-zone.has-image { color: #fff; background: #202422; border-style: solid; }
.upload-zone.has-image small { color: #d4dbd7; }
.upload-zone.has-image .upload-icon { display: none; }
.upload-zone img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .38; }
.preview-panel { min-height: 420px; display: grid; place-items: center; padding: 30px; background: #e8efeb; border-left: 1px solid var(--line); }
.phone-preview { width: 230px; height: 360px; overflow: hidden; background: #fff; box-shadow: var(--shadow); border: 6px solid #202422; border-radius: 28px; text-align: center; }
.mini-nav { height: 45px; padding: 0 10px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #edf0ee; font-size: 10px; }
.mini-nav span:first-child { font-size: 26px; }
.mini-secure { margin-top: 22px; color: #7b827e; font-size: 9px; }
.mini-secure i { display: inline-block; width: 10px; height: 10px; margin-right: 4px; border-radius: 3px; background: var(--green); vertical-align: -1px; }
.mini-flow { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 64px; }
.mini-app-icon { width: 43px; height: 43px; display: grid; place-items: center; border-radius: 10px; overflow: hidden; }
.mini-app-icon img { width: 100%; height: 100%; display: block; object-fit: cover; }
.tiktok-cyan { fill: #25f4ee; }
.tiktok-red { fill: #fe2c55; }
.tiktok-white { fill: #fff; }
.mini-source { background: #151515; }
.mini-flow span { color: #d9dedb; font-size: 8px; }
.mini-flow .wechat-mini { background: var(--green); }
.phone-preview p { margin: 24px 0 18px; color: #a3aaa6; font-size: 10px; }
.phone-preview button { width: 160px; height: 38px; border: 0; border-radius: 20px; background: var(--green); color: #fff; font-size: 11px; }
.links-section { margin-top: 28px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; }
.section-heading span { color: var(--muted); font-size: 13px; }
.link-table-wrap { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); }
.link-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.link-table th, .link-table td { padding: 16px 18px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.link-table th { color: var(--muted); font-size: 12px; font-weight: 700; background: #fafbfa; }
.link-table tr:last-child td { border-bottom: 0; }
.link-table td strong, .link-table td small { display: block; }
.link-table td small { max-width: 300px; margin-top: 4px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-table td a { color: #087947; }
.link-table td .source-image-link { display: inline-block; margin-top: 5px; font-size: 12px; }
.row-actions { display: flex; justify-content: flex-end; gap: 8px; }
.row-actions form { margin: 0; }
.icon-button { width: 34px; height: 34px; border: 1px solid #cdd4d0; border-radius: 5px; display: grid; place-items: center; background: transparent; color: inherit; }
.site-header .icon-button { border-color: #4b514e; }
.danger-button { color: var(--danger); }
.empty-state { min-height: 150px; display: grid; place-items: center; border: 1px dashed #c7cfcb; color: var(--muted); background: #fafbfa; }
.alert { margin-bottom: 20px; padding: 13px 16px; border-left: 4px solid; background: #fff; }
.alert-error { border-color: var(--danger); color: #942e27; }
.alert-success { border-color: var(--green); color: #07673b; }
.share-result { display: grid; gap: 14px; margin-bottom: 28px; padding: 20px 22px; border: 1px solid #b8e6ca; background: #f4fcf7; }
.share-result h2 { margin: 0 0 5px; font-size: 20px; }
.share-result-target { margin: 0; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.share-result-actions { display: flex; align-items: center; gap: 10px; min-width: 0; }
.share-result-link { min-width: 0; color: #087947; overflow-wrap: anywhere; }
.settings-section { display: grid; grid-template-columns: minmax(240px, .6fr) minmax(0, 1.4fr); gap: 24px; align-items: end; margin-top: 28px; padding: 24px 28px; background: #fff; border: 1px solid var(--line); }
.settings-section h2 { margin: 0 0 7px; font-size: 19px; }
.settings-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.settings-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.settings-actions .secondary-button { white-space: nowrap; }
.api-test-result { grid-column: 1 / -1; display: grid; gap: 5px; margin-top: 2px; padding: 12px 14px; border-left: 4px solid; font-size: 13px; overflow-wrap: anywhere; }
.api-test-result strong { font-size: 14px; }
.api-test-result a { color: #087947; }
.api-test-success { border-color: var(--green); background: #f1fbf5; color: #07673b; }
.api-test-error { border-color: var(--danger); background: #fff7f6; color: #942e27; }
.settings-form input { min-height: 46px; width: 100%; border: 1px solid #cbd3cf; border-radius: 5px; padding: 0 14px; color: var(--ink); background: #fff; outline: none; }
.settings-form input:focus { border-color: var(--green-dark); box-shadow: 0 0 0 3px rgba(7, 193, 96, .12); }
.login-panel { width: min(420px, 100%); margin: 8vh auto 0; padding: 34px; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); }
.login-panel h1 { margin-bottom: 24px; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 15px); padding: 10px 16px; border-radius: 4px; background: var(--ink); color: #fff; opacity: 0; pointer-events: none; transition: .2s ease; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.redirect-page { min-height: 100vh; background: #fff; }
.redirect-shell { position: relative; min-height: 100vh; max-width: 520px; margin: 0 auto; background: #fff; overflow: hidden; }
.redirect-nav { height: 64px; padding: max(8px, env(safe-area-inset-top)) 18px 0; display: grid; grid-template-columns: 36px 1fr 36px; align-items: center; border-bottom: 1px solid #f0f2f1; }
.redirect-nav button { width: 36px; height: 36px; border: 0; background: transparent; font-size: 38px; line-height: 1; }
.redirect-nav strong { text-align: center; font-size: 18px; }
.redirect-nav span { color: #333; font-weight: 800; font-size: 14px; }
.redirect-content { padding: 34px 26px 120px; text-align: center; }
.secure-line { display: inline-flex; align-items: center; gap: 8px; color: #777f7b; font-size: 14px; }
.secure-line span { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; background: var(--green); color: #fff; font-size: 12px; }
.app-flow { display: flex; align-items: center; justify-content: center; gap: 24px; margin: 120px auto 54px; }
.app-icon { width: 78px; height: 78px; position: relative; border-radius: 18px; }
.source-icon { display: grid; place-items: center; background: #111; overflow: hidden; }
.app-icon img { width: 100%; height: 100%; display: block; object-fit: cover; }
.wechat-icon svg, .wechat-mini svg { fill: #fff; }
.wechat-icon { background: var(--green); }
.flow-dots { display: flex; gap: 9px; }
.flow-dots i { width: 6px; height: 6px; border-radius: 50%; background: #e0e4e2; }
.jump-status { margin-bottom: 22px; color: #a4aaa7; font-size: 14px; }
.redirect-content h1 { margin: 0 auto 70px; font-size: 18px; font-weight: 500; }
.launch-button { width: min(100%, 330px); min-height: 56px; border: 0; border-radius: 28px; background: linear-gradient(90deg, #08c765, #18d670); color: #fff; font-size: 19px; font-weight: 750; box-shadow: 0 8px 24px rgba(7, 193, 96, .22); }
.launch-button:active { transform: translateY(1px); }
.redirect-footer { position: absolute; left: 20px; right: 20px; bottom: calc(28px + env(safe-area-inset-bottom)); margin: 0; text-align: center; color: #7c8480; font-size: 14px; }
.invalid-link { padding: 22vh 24px 0; text-align: center; }
.invalid-symbol { width: 58px; height: 58px; margin: 0 auto 24px; display: grid; place-items: center; border-radius: 50%; background: #fff1ef; color: var(--coral); font-size: 30px; font-weight: 800; }
.invalid-link h1 { font-size: 22px; }
.invalid-link p { color: var(--muted); }

@media (max-width: 760px) {
    .site-header { padding: 0 20px; }
    .admin-main { width: min(100% - 28px, 600px); padding-top: 28px; }
    .intro-band { align-items: start; }
    .intro-band h1 { font-size: 32px; }
    .count-block { display: none; }
    .workspace-grid { grid-template-columns: 1fr; }
    .tool-panel { padding: 24px 20px; }
    .settings-section { grid-template-columns: 1fr; padding: 20px; }
    .settings-form { grid-template-columns: 1fr; }
    .settings-actions { display: grid; grid-template-columns: 1fr 1fr; }
    .share-result-actions { align-items: stretch; flex-direction: column; }
    .preview-panel { display: none; }
    .link-table-wrap { overflow: visible; }
    .link-table, .link-table tbody { display: block; }
    .link-table thead { display: none; }
    .link-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 15px 12px; border-bottom: 1px solid var(--line); }
    .link-table tr:last-child { border-bottom: 0; }
    .link-table td { min-width: 0; padding: 0; border: 0; }
    .link-table td:first-child { grid-column: 1 / -1; }
    .link-table td:nth-child(2) { grid-column: 1; align-self: center; }
    .link-table td:nth-child(3) { display: none; }
    .link-table td:nth-child(4) { grid-column: 2; align-self: center; }
    .link-table td a { max-width: 100%; overflow-wrap: anywhere; white-space: normal; }
    .redirect-shell { max-width: none; }
    .app-flow { margin-top: 18vh; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
