:root {
    --bg: #eef1f7;
    --bg-2: #e4e9f4;
    --surface: #ffffff;
    --ink: #161924;
    --muted: #667085;
    --line: #e4e8f1;
    --indigo: #4f46e5;
    --indigo-d: #4338ca;
    --teal: #0f9d8a;
    --teal-d: #0b7c6e;
    --amber: #d97706;
    --amber-d: #b45309;
    --rose: #e11d48;
    --rose-d: #be123c;
    --sky: #0284c7;
    --sky-d: #0369a1;
    --shadow: 0 18px 40px rgba(22, 25, 36, 0.08);
    --shadow-sm: 0 8px 20px rgba(22, 25, 36, 0.06);
    --radius: 20px;
    --font: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    --mono: "Cascadia Code", "Consolas", "SF Mono", "Microsoft YaHei", monospace;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: var(--font);
    color: var(--ink);
    background: var(--bg);
    line-height: 1.55;
}

.app-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(900px 420px at 8% -10%, rgba(79, 70, 229, 0.18), transparent 60%),
        radial-gradient(700px 380px at 100% 0%, rgba(15, 157, 138, 0.16), transparent 55%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}

a { color: inherit; text-decoration: none; }

.wrap {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
    padding: 28px 0 72px;
}

.page-tool .wrap {
    width: min(1320px, calc(100% - 32px));
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    backdrop-filter: blur(16px);
    background: rgba(238, 241, 247, 0.78);
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
}

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

.brand-mark {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: linear-gradient(145deg, #6366f1, #4f46e5 55%, #0f9d8a);
    color: #fff;
    font-weight: 800;
    box-shadow: 0 10px 22px rgba(79, 70, 229, 0.28);
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.brand-text strong { font-size: 16px; }
.brand-text small { color: var(--muted); font-size: 12px; }

.top-nav a {
    font-size: 14px;
    color: var(--muted);
    padding: 8px 12px;
    border-radius: 10px;
}

.top-nav a:hover {
    background: rgba(255, 255, 255, 0.7);
    color: var(--ink);
}

.hero {
    padding: 18px 4px 28px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--indigo);
    font-weight: 700;
    letter-spacing: 0.08em;
    font-size: 12px;
    text-transform: uppercase;
}

.hero h1 {
    margin: 0;
    font-size: clamp(28px, 4vw, 40px);
    letter-spacing: -0.03em;
    max-width: 16ch;
}

.hero-desc {
    margin: 14px 0 0;
    max-width: 46em;
    color: var(--muted);
    font-size: 16px;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.tool-card {
    display: flex;
    flex-direction: column;
    min-height: 248px;
    padding: 22px;
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tool-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 24px 48px rgba(22, 25, 36, 0.12);
}

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

.card-icon {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    color: #fff;
}

.card-icon svg { width: 26px; height: 26px; }

.accent-indigo .card-icon { background: linear-gradient(145deg, #818cf8, #4f46e5); }
.accent-teal .card-icon { background: linear-gradient(145deg, #2dd4bf, #0f9d8a); }
.accent-amber .card-icon { background: linear-gradient(145deg, #fbbf24, #d97706); }
.accent-rose .card-icon { background: linear-gradient(145deg, #fb7185, #e11d48); }
.accent-sky .card-icon { background: linear-gradient(145deg, #38bdf8, #0284c7); }

.card-tag {
    font-size: 12px;
    color: var(--muted);
    background: #f3f5fb;
    padding: 4px 10px;
    border-radius: 999px;
}

.tool-card h2 {
    margin: 0 0 8px;
    font-size: 22px;
    letter-spacing: -0.02em;
}

.tool-card p {
    margin: 0;
    color: var(--muted);
    flex: 1;
}

.card-go {
    margin-top: 20px;
    color: var(--indigo);
    font-weight: 700;
    font-size: 14px;
}

.accent-teal .card-go { color: var(--teal); }
.accent-amber .card-go { color: var(--amber); }
.accent-rose .card-go { color: var(--rose); }
.accent-sky .card-go { color: var(--sky); }

.card-go i {
    display: inline-block;
    transition: transform 0.2s ease;
}

.tool-card:hover .card-go i { transform: translateX(4px); }

.tool-hero {
    padding: 4px 0 18px;
}

.back-link {
    display: inline-block;
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 13px;
}

.back-link:hover { color: var(--ink); }

.tool-hero h1 {
    margin: 0;
    font-size: 30px;
    letter-spacing: -0.03em;
}

.tool-hero p {
    margin: 8px 0 0;
    color: var(--muted);
    max-width: 52em;
}

.panel-stack,
.panel-row {
    display: grid;
    gap: 16px;
}

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

.panel-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
}

.panel {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-radius: 18px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--line);
    min-height: 280px;
    overflow: hidden;
}

.page-unique .panel,
.page-extract .panel,
.page-phone .panel,
.page-bot .panel { min-height: 240px; }
.page-compare .panel { min-height: calc(100vh - 290px); }

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    background: #fafbfe;
}

.panel-head h2 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
}

.panel-note {
    margin-left: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
}

.line-count {
    font-size: 12px;
    color: var(--muted);
    background: #eef1f8;
    padding: 3px 8px;
    border-radius: 999px;
}

textarea {
    flex: 1;
    width: 100%;
    min-height: 220px;
    border: 0;
    resize: vertical;
    padding: 14px 16px 16px;
    font: 13px/1.55 var(--mono);
    color: var(--ink);
    background: transparent;
    outline: none;
}

.page-compare textarea {
    resize: none;
    min-height: 0;
}

textarea:focus {
    background: #fcfcff;
}

textarea[readonly] {
    background: #f8fafc;
    color: #1f2937;
}

.tool-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 16px;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
}

.stats {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.stats strong {
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

.actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.btn {
    appearance: none;
    border: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font: 600 14px/1 var(--font);
    padding: 11px 16px;
    border-radius: 12px;
    transition: transform 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
    text-decoration: none;
    color: inherit;
    box-sizing: border-box;
}

.btn:active { transform: translateY(1px); }

.btn-ghost {
    background: #f3f5fb;
    color: var(--ink);
}

.btn-ghost:hover { background: #e8ecf6; }

.btn-primary {
    background: linear-gradient(180deg, #6366f1, var(--indigo));
    color: #fff;
    box-shadow: 0 8px 16px rgba(79, 70, 229, 0.25);
}

.btn-primary:hover { background: var(--indigo-d); }

.page-compare .btn-primary {
    background: linear-gradient(180deg, #14b8a6, var(--teal));
    box-shadow: 0 8px 16px rgba(15, 157, 138, 0.25);
}

.page-compare .btn-primary:hover { background: var(--teal-d); }

.page-extract .btn-primary {
    background: linear-gradient(180deg, #f59e0b, var(--amber));
    box-shadow: 0 8px 16px rgba(217, 119, 6, 0.25);
}

.page-extract .btn-primary:hover { background: var(--amber-d); }

.page-bot .btn-primary {
    background: linear-gradient(180deg, #fb7185, var(--rose));
    box-shadow: 0 8px 16px rgba(225, 29, 72, 0.25);
}

.page-bot .btn-primary:hover { background: var(--rose-d); }

.page-phone .btn-primary {
    background: linear-gradient(180deg, #0ea5e9, var(--sky));
    box-shadow: 0 8px 16px rgba(2, 132, 199, 0.25);
}

.page-phone .btn-primary:hover { background: var(--sky-d); }

.mode-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 16px;
}

.mode-option {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    user-select: none;
}

.mode-option:has(input:checked) {
    border-color: #fda4af;
    background: #fff1f2;
    color: var(--rose-d);
}

.mode-option input {
    width: 16px;
    height: 16px;
    accent-color: var(--rose);
    margin: 0;
}

.stats-tip {
    display: inline;
    color: var(--rose-d);
    font-weight: 700;
}

.tool-hero code {
    font-family: var(--mono);
    font-size: 0.92em;
    background: #eef1f8;
    padding: 1px 6px;
    border-radius: 6px;
}

.site-footer {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto 28px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 12px;
}

.site-footer code {
    font-family: var(--mono);
    background: rgba(255, 255, 255, 0.7);
    padding: 1px 6px;
    border-radius: 6px;
}

.flash {
    margin: 0 0 16px;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
}

.flash-ok {
    background: #e8f8f4;
    color: #0b7c6e;
    border: 1px solid #b7e6db;
}

.flash-error {
    background: #fff1f1;
    color: #b42318;
    border: 1px solid #f3c6c2;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translate(-50%, 16px);
    opacity: 0;
    pointer-events: none;
    background: #161924;
    color: #fff;
    padding: 10px 16px;
    border-radius: 999px;
    font-size: 13px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 50;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

@media (max-width: 980px) {
    .panel-row { grid-template-columns: 1fr; }
    .page-compare .panel { min-height: 260px; }
    .page-compare textarea { min-height: 220px; resize: vertical; }
    .tool-bar { flex-direction: column; align-items: stretch; }
    .hero h1 { max-width: none; }
}

@media (max-width: 640px) {
    .wrap, .site-footer { width: calc(100% - 24px); }
    .site-footer { flex-direction: column; }
    .topbar { padding: 12px 14px; }
}
