/*!
 * Copyright 2026 辉夜
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
:root {
    --bg: #f5f7fb;
    --bg-grad: radial-gradient(circle at 20% 0%, #eaf0ff 0%, transparent 50%),
               radial-gradient(circle at 80% 100%, #fef0f6 0%, transparent 50%),
               #f5f7fb;
    --card: #ffffff;
    --text: #1f2937;
    --text-light: #4b5563;
    --muted: #8b95a7;
    --primary: #4f7cf5;
    --primary-dark: #3a63d4;
    --primary-soft: #eaf0ff;
    --primary-softer: #f4f7ff;
    --accent: #ff6b9d;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --border: #e8ecf3;
    --border-hover: #d0d8e8;
    --shadow-sm: 0 1px 3px rgba(31, 41, 55, 0.04);
    --shadow: 0 4px 20px rgba(79, 124, 245, 0.08);
    --shadow-lg: 0 12px 40px rgba(79, 124, 245, 0.14);
    --shadow-hover: 0 16px 50px rgba(79, 124, 245, 0.18);
    --radius: 16px;
    --radius-sm: 10px;
    --radius-lg: 22px;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg-grad);
    background-attachment: fixed;
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ============ Header ============ */
.site-header {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
    font-weight: 700;
    font-size: 19px;
}
.brand-logo {
    font-size: 26px;
    filter: drop-shadow(0 2px 4px rgba(79, 124, 245, 0.25));
}
.top-nav {
    display: flex;
    align-items: center;
    gap: 6px;
}
.top-nav a {
    color: var(--text-light);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}
.top-nav a:hover {
    background: var(--primary-soft);
    color: var(--primary);
}
.btn-donate {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, var(--accent) 0%, #ff8eb3 100%);
    color: #fff !important;
    font-weight: 600 !important;
    padding: 8px 16px !important;
    border-radius: 20px !important;
    box-shadow: 0 4px 12px rgba(255, 107, 157, 0.3);
    transition: all 0.2s;
}
.btn-donate:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(255, 107, 157, 0.4);
    background: linear-gradient(135deg, #ff5a8f 0%, #ff79a8 100%) !important;
    color: #fff !important;
}

main { flex: 1; padding: 40px 20px 64px; }

/* ============ Homepage hero ============ */
.hero {
    text-align: center;
    margin-bottom: 44px;
    padding: 32px 20px 12px;
}
.hero .hero-badge {
    display: inline-block;
    background: rgba(79, 124, 245, 0.08);
    color: var(--primary);
    font-size: 13px;
    font-weight: 600;
    padding: 5px 14px;
    border-radius: 20px;
    margin-bottom: 18px;
    border: 1px solid rgba(79, 124, 245, 0.15);
}
.hero h1 {
    font-size: 36px;
    font-weight: 800;
    margin-bottom: 14px;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #1f2937 0%, #4f7cf5 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.hero p {
    color: var(--text-light);
    font-size: 16px;
    max-width: 580px;
    margin: 0 auto;
}
.hero-stats {
    display: flex;
    justify-content: center;
    gap: 36px;
    margin-top: 28px;
    flex-wrap: wrap;
}
.hero-stat .num {
    font-size: 26px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
}
.hero-stat .label {
    font-size: 13px;
    color: var(--muted);
    margin-top: 4px;
}

/* ============ Tool grid ============ */
.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.section-title h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}
.section-title .count {
    font-size: 13px;
    color: var(--muted);
    background: var(--card);
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
}
.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 18px;
}
.tool-card {
    position: relative;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-decoration: none;
    color: var(--text);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.tool-card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s;
}
.tool-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: var(--shadow-hover);
}
.tool-card:hover::before { transform: scaleX(1); }
.tool-card .icon {
    font-size: 34px;
    display: inline-flex;
    width: 56px;
    height: 56px;
    align-items: center;
    justify-content: center;
    background: var(--primary-softer);
    border-radius: 14px;
    margin-bottom: 14px;
    transition: transform 0.3s;
}
.tool-card:hover .icon {
    transform: scale(1.08) rotate(-3deg);
}
.tool-card .name {
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 5px;
    color: var(--text);
}
.tool-card .desc {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}
.tool-card .arrow {
    position: absolute;
    top: 24px;
    right: 20px;
    color: var(--muted);
    opacity: 0;
    transform: translateX(-4px);
    transition: all 0.2s;
}
.tool-card:hover .arrow {
    opacity: 1;
    transform: translateX(0);
    color: var(--primary);
}

/* ============ Tool page layout ============ */
.tool-page { max-width: 760px; margin: 0 auto; }
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 20px;
    transition: color 0.2s;
}
.back-link:hover { color: var(--primary); }
.tool-title {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 6px;
}
.tool-title .icon {
    font-size: 30px;
    width: 56px;
    height: 56px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-softer);
    border-radius: 14px;
}
.tool-title h1 { font-size: 24px; font-weight: 800; }
.tool-subtitle { color: var(--muted); margin-bottom: 28px; font-size: 14px; }

/* ============ Cards / forms ============ */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
}
.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }
label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 7px;
    color: var(--text);
}
input[type="text"], input[type="number"], input[type="date"],
input[type="password"], input[type="range"], select, textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-family: inherit;
    background: #fff;
    color: var(--text);
    transition: all 0.2s;
}
input[type="range"] { padding: 0; }
input:hover, select:hover, textarea:hover { border-color: var(--border-hover); }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}
textarea { resize: vertical; min-height: 130px; }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row .field { flex: 1; min-width: 140px; }
label input[type="checkbox"] { width: auto; margin-right: 6px; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 11px 24px;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    text-decoration: none;
}
.btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(79, 124, 245, 0.3);
}
.btn:active { transform: translateY(0); }
.btn.secondary {
    background: var(--primary-soft);
    color: var(--primary);
}
.btn.secondary:hover {
    background: #dde7ff;
    box-shadow: none;
}
.btn-group { display: flex; gap: 10px; flex-wrap: wrap; }

/* ============ Result box ============ */
.result {
    margin-top: 24px;
    background: linear-gradient(135deg, var(--primary-softer) 0%, #fff8fb 100%);
    border: 1px solid #d6e2ff;
    border-radius: var(--radius);
    padding: 22px;
    animation: fadeUp 0.3s ease-out;
}
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.result h3 { font-size: 16px; margin-bottom: 10px; }
.result .big {
    font-size: 36px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.2;
}
.result table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.result th, .result td {
    text-align: left;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    font-size: 14px;
}
.result th { color: var(--muted); font-weight: 600; }
.note { font-size: 12px; color: var(--muted); margin-top: 10px; }
.tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

/* ============ Donate modal ============ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(31, 41, 55, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}
.modal-overlay.show {
    display: flex;
    animation: fadeIn 0.2s ease-out;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
    background: #fff;
    border-radius: var(--radius-lg);
    max-width: 440px;
    width: 100%;
    padding: 32px 28px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    animation: popIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-height: 90vh;
    overflow-y: auto;
}
@keyframes popIn {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}
.modal-close {
    position: absolute;
    top: 14px; right: 14px;
    width: 32px; height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-soft);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    color: var(--text-light);
    transition: all 0.2s;
}
.modal-close:hover { background: var(--primary); color: #fff; }
.modal h2 {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 6px;
    color: var(--text);
}
.modal .modal-sub {
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 22px;
}
.qr-tabs {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 18px;
}
.qr-tab {
    padding: 8px 18px;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-light);
    transition: all 0.2s;
    font-family: inherit;
}
.qr-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.qr-box {
    width: 220px;
    height: 220px;
    margin: 0 auto 16px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
}
.qr-box img { width: 100%; height: 100%; object-fit: contain; }
.qr-placeholder {
    color: var(--muted);
    font-size: 13px;
    text-align: center;
    padding: 20px;
}
.qr-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text);
    margin-bottom: 4px;
}
.modal-tip {
    font-size: 12px;
    color: var(--muted);
    margin-top: 12px;
    padding-top: 14px;
    border-top: 1px dashed var(--border);
}

/* ============ Footer ============ */
.site-footer {
    border-top: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.6);
    padding: 28px 0 24px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}
.site-footer .footer-links {
    margin-bottom: 10px;
}
.site-footer .footer-links a {
    color: var(--text-light);
    text-decoration: none;
    margin: 0 10px;
    transition: color 0.2s;
}
.site-footer .footer-links a:hover { color: var(--primary); }
.site-footer .copyright { color: var(--muted); }

/* ============ 404 page ============ */
.notfound-box {
    text-align: center;
    padding: 56px 24px;
}
.notfound-box .code {
    font-size: 64px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

@media (max-width: 600px) {
    .hero h1 { font-size: 26px; }
    .hero-stats { gap: 22px; }
    .tool-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .tool-card { padding: 18px; }
    .tool-card .icon { width: 48px; height: 48px; font-size: 28px; }
    .row { flex-direction: column; }
    .brand-name { display: none; }
    .top-nav a:not(.btn-donate) { display: none; }
}

