/* ===== Dark Mode ===== */[data-theme="dark"] body { background:#1a1a1a;color:#e5e5e5 }[data-theme="dark"] .rank-block,[data-theme="dark"] .card,[data-theme="dark"] .modal,[data-theme="dark"] .header { background:#1f1f1f;border-color:#333 }[data-theme="dark"] input,[data-theme="dark"] .home-search-box,[data-theme="dark"] .search-wrap { background:#2a2a2a;color:#e5e5e5;border-color:#333 }[data-theme="dark"] .rank-block-title,[data-theme="dark"] .card-title,[data-theme="dark"] .rank-name,[data-theme="dark"] .modal-hdr { color:#e5e5e5 }[data-theme="dark"] .card-meta,[data-theme="dark"] .rank-cnt,[data-theme="dark"] .info-bar { color:#999 }[data-theme="dark"] .rank-tab,[data-theme="dark"] .tab { background:#333;color:#999 }[data-theme="dark"] .rank-tab.active,[data-theme="dark"] .tab.active { background:#409eff;color:#fff }[data-theme="dark"] .site-footer { background:#1a1a1a;border-color:#333;color:#999 }[data-theme="dark"] .rank-block-ftr { border-color:#333;color:#666 }[data-theme="dark"] .rank-idx { background:#333;color:#999 }[data-theme="dark"] .theme-btn { position:fixed;bottom:20px;right:20px;z-index:99;width:40px;height:40px;border-radius:50%;border:1px solid #555;background:#1f1f1f;font-size:18px;cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:0 2px 8px rgba(0,0,0,.3) }
    /* ===== Reset & Base ===== */
    *,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
    html{font-size:16px;-webkit-text-size-adjust:100%}
    body{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif;background:#f5f5f5;color:#303133;min-height:100vh;overflow-x:hidden}
    :root{--primary:#409eff;--primary-dark:#337ecc;--primary-light:rgba(64,158,255,0.08);--text:#303133;--text2:#909399;--border:#ebeef5;--bg:#f5f5f5;--white:#fff;--radius:10px;--shadow:0 1px 4px rgba(0,0,0,0.04);--safe-bottom:env(safe-area-inset-bottom,0px)}
    a{color:var(--primary);text-decoration:none}
    img{display:block;max-width:100%}

    /* ===== Home Page ===== */
    .home-page{padding-bottom:calc(30px + var(--safe-bottom))}
    .home-hero{display:flex;flex-direction:column;align-items:center;padding:36px 16px 20px}
    .home-logo{font-size:32px;font-weight:700;color:var(--primary);margin-bottom:20px;text-align:center}
    .home-logo-img{max-width:360px;max-height:80px;width:auto;height:auto;object-fit:contain}
    .home-search-box{display:flex;width:100%;max-width:500px;border:1px solid var(--border);border-radius:20px;overflow:hidden;background:var(--bg);transition:border-color .2s}
    .home-search-box:focus-within{border-color:var(--primary);background:var(--white);box-shadow:0 0 0 3px rgba(64,158,255,.1)}
    .home-search-box input{flex:1;height:40px;border:none;padding:0 14px;font-size:14px;outline:none;background:transparent}
    .home-search-box button{flex-shrink:0;height:32px;margin:4px;padding:0 22px;border:none;border-radius:999px;background:var(--primary);color:var(--white);font-size:13px;font-weight:600;cursor:pointer}
    .home-search-box button:active{background:var(--primary-dark)}
    .home-quote{margin-top:12px;font-size:12px;color:#b0b8c4;font-style:italic;text-align:center;max-width:500px;line-height:1.5}
    .home-quote-author{font-size:11px;color:#c0c4cc;display:inline-block;margin-top:2px}

    /* ===== Home Rankings ===== */
    .home-rankings{padding:8px 12px;display:flex;flex-direction:column;gap:10px}
    .rank-block{background:var(--white);border-radius:var(--radius);padding:12px;border:1px solid var(--border);box-shadow:var(--shadow)}
    .rank-block-hdr{display:flex;align-items:center;justify-content:space-between;padding-bottom:8px;border-bottom:2px solid #f0f0f0;margin-bottom:4px}
    .rank-block-title{font-size:14px;font-weight:700;color:var(--text);white-space:nowrap}
    .rank-block-tabs{display:flex;gap:2px;background:#f0f2f5;border-radius:5px;padding:2px}
    .rank-tab{font-size:11px;padding:2px 9px;border-radius:4px;cursor:pointer;color:#909399;font-weight:500;transition:all .2s;user-select:none}
    .rank-tab.active{background:var(--white);color:var(--primary);font-weight:600;box-shadow:0 1px 2px rgba(0,0,0,.06)}
    .rank-item{display:flex;align-items:center;gap:7px;padding:5px 6px;border-radius:6px;cursor:pointer;transition:background .15s}
    .rank-item:active{background:#f0f5ff}
    .rank-idx{width:20px;height:20px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:11px;font-weight:700;color:#909399;background:#f0f0f0;flex-shrink:0}
    .rank-idx.top3{background:var(--primary);color:var(--white);font-size:12px}
    .rank-name{flex:1;min-width:0;font-size:13px;font-weight:500;color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
    .rank-cnt{font-size:11px;color:#c0c4cc;white-space:nowrap;flex-shrink:0}
    .rank-expand{text-align:center;padding:5px;margin-top:2px;font-size:12px;color:var(--primary);cursor:pointer;border-radius:5px;user-select:none}
    .rank-expand:active{background:#ecf5ff}
    .rank-block-ftr{margin-top:6px;padding-top:6px;border-top:1px solid #f0f0f0;display:flex;align-items:center;justify-content:space-between;font-size:10px;color:#c0c4cc}
    .ftr-time{font-family:monospace;font-size:9px}

    /* ===== Layout ===== */
    .app{max-width:100%;margin:0 auto;padding-bottom:calc(20px + var(--safe-bottom))}
    .header{position:sticky;top:0;z-index:50;background:var(--white);border-bottom:1px solid var(--border);padding:8px 12px}
    .header-row{display:flex;align-items:center;gap:10px}
    .header-title{font-size:18px;font-weight:700;color:var(--primary);flex-shrink:0}
    .header-title-link{text-decoration:none;flex-shrink:0;display:flex;align-items:center}
    .header-logo-img{max-width:120px;max-height:28px;width:auto;height:auto;object-fit:contain;display:block}
    .header-actions{margin-left:auto;display:flex;gap:6px;align-items:center}

    /* ===== Search Bar ===== */
    .search-wrap{flex:1;display:flex;border:1px solid var(--border);border-radius:18px;overflow:hidden;background:var(--bg);transition:border-color .2s}
    .search-wrap:focus-within{border-color:var(--primary);background:var(--white)}
    .search-wrap input{flex:1;height:36px;border:none;padding:0 14px;font-size:14px;outline:none;background:transparent}
    .search-wrap button{flex-shrink:0;height:28px;margin:4px;padding:0 18px;border:none;border-radius:999px;background:var(--primary);color:var(--white);font-size:13px;font-weight:600;cursor:pointer;transition:background .2s}
    .search-wrap button:active{background:var(--primary-dark)}
    .search-wrap button:disabled{opacity:.5}

    /* ===== Footer ===== */
    .site-footer{margin-top:30px;padding:16px 12px 24px;background:#f9fafb;border-top:1px solid var(--border)}
    .footer-inner{max-width:500px;margin:0 auto;font-size:11px;line-height:1.8;color:#909399;text-align:center;white-space:pre-line}
    .footer-actions{display:flex;justify-content:center;gap:10px;margin-top:12px;flex-wrap:wrap}
    .footer-btn{padding:8px 20px;border:1px solid var(--border);border-radius:8px;background:var(--white);color:var(--text);font-size:13px;cursor:pointer;transition:all .2s}
    .footer-btn:active{background:var(--primary-light);border-color:var(--primary);color:var(--primary)}

    /* ===== Info Bar ===== */
    .info-bar{display:flex;align-items:center;gap:8px;padding:10px 12px 0;font-size:12px;color:var(--text2);flex-wrap:wrap}
    .info-bar .count{font-weight:600;color:var(--text)}
    .info-bar .time{font-family:monospace;background:#f4f4f5;padding:1px 6px;border-radius:4px}
    .info-bar .badge-err{background:#fef0f0;color:#f56c6c;padding:1px 6px;border-radius:4px}

    /* ===== Loading ===== */
    .loading{padding:24px 12px;text-align:center;font-size:13px;color:var(--text2)}
    .loading-bar{width:100%;height:3px;background:#e8e8e8;border-radius:2px;overflow:hidden;margin-top:8px}
    .loading-bar-inner{height:100%;background:linear-gradient(90deg,var(--primary),#67c23a);border-radius:2px;transition:width .3s ease;width:0%}

    /* ===== Tabs ===== */
    .tabs{display:flex;gap:4px;padding:8px 12px;overflow-x:auto;-webkit-overflow-scrolling:touch;scrollbar-width:none}
    .tabs::-webkit-scrollbar{display:none}
    .tab{flex-shrink:0;padding:5px 12px;border-radius:16px;font-size:12px;color:#606266;background:#f0f2f5;cursor:pointer;white-space:nowrap;transition:all .2s;user-select:none}
    .tab:active{transform:scale(.95)}
    .tab.active{background:var(--primary-light);color:var(--primary);font-weight:600}

    /* ===== Results ===== */
    .results{display:flex;flex-direction:column;gap:10px;padding:8px 12px}
    .empty{padding:40px 12px;text-align:center;color:var(--text2);font-size:14px}

    /* ===== Card ===== */
    .card{display:flex;gap:10px;background:var(--white);border-radius:var(--radius);padding:10px;border:1px solid var(--border);transition:border-color .2s}
    .card:active{border-color:#c0c4cc}
    .card-cover{flex-shrink:0;width:90px;height:120px;border-radius:8px;overflow:hidden;background:var(--bg);position:relative}
    .card-cover img{width:100%;height:100%;object-fit:cover}
    .card-cover .placeholder{width:100%;height:100%;display:flex;align-items:center;justify-content:center;font-size:28px;background:linear-gradient(135deg,#667eea,#764ba2);color:rgba(255,255,255,.6)}
    .card-cover .tag{position:absolute;bottom:3px;left:3px;padding:1px 5px;border-radius:3px;color:#fff;font-size:10px;font-weight:600;backdrop-filter:blur(2px)}
    .card-body{flex:1;min-width:0;display:flex;flex-direction:column;gap:4px}
    .card-title{font-size:14px;font-weight:700;color:var(--text);line-height:1.3;display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;overflow:hidden}
    .card-meta{font-size:11px;color:var(--text2);display:flex;align-items:center;gap:8px}
    .card-meta .size{color:#67c23a}
    .card-tags{display:flex;flex-wrap:wrap;gap:4px;margin-top:2px}
    .card-tags span{font-size:10px;padding:1px 6px;border-radius:4px;background:#ecf5ff;color:#409eff;white-space:nowrap}
    .card-tags .quality{background:#fef0f0;color:#e74c3c}
    .card-actions{margin-top:auto;display:flex;align-items:center;justify-content:space-between;gap:6px}
    .card-source{font-size:10px;color:var(--text2);background:#f4f4f5;padding:1px 6px;border-radius:4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:120px}
    .card-btn{padding:4px 10px;border:none;border-radius:6px;background:var(--primary);color:var(--white);font-size:12px;font-weight:600;cursor:pointer;white-space:nowrap;transition:background .2s}
    .card-btn:active{background:var(--primary-dark)}
    .card-btn:disabled{opacity:.5}

    /* ===== Toast ===== */
    .toast{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);background:rgba(0,0,0,.75);color:#fff;padding:10px 20px;border-radius:8px;font-size:14px;z-index:200;pointer-events:none;opacity:0;transition:opacity .3s}
    .toast.show{opacity:1}
    .toast.error{background:rgba(245,108,108,.9)}

    /* ===== Overlay / Modal ===== */
    .overlay{position:fixed;inset:0;z-index:100;background:rgba(0,0,0,.5);display:flex;align-items:center;justify-content:center;padding:16px;animation:fadeIn .2s}
    .modal{background:var(--white);border-radius:14px;width:100%;max-width:420px;max-height:90vh;overflow-y:auto;padding:0;animation:slideUp .25s}
    .modal-hdr{padding:14px 16px;border-bottom:1px solid var(--border);font-size:15px;font-weight:700;color:var(--text)}
    .modal-body{padding:14px 16px}
    .modal-ftr{padding:10px 16px;border-top:1px solid var(--border);display:flex;gap:8px;justify-content:flex-end}
    .modal-ftr button{height:36px;padding:0 16px;border:none;border-radius:8px;font-size:13px;font-weight:600;cursor:pointer}
    .modal-ftr .btn-close{background:#f4f4f5;color:#606266}
    .modal-ftr .btn-disclaimer{background:#fdf6ec;color:#d46b08;margin-right:auto}
    .modal-ftr .btn-primary{background:var(--primary);color:var(--white)}
    .modal-ftr .btn-primary:active{background:var(--primary-dark)}
    @keyframes fadeIn{from{opacity:0}to{opacity:1}}
    @keyframes slideUp{from{transform:translateY(40px);opacity:0}to{transform:translateY(0);opacity:1}}

    /* ===== Share Modal ===== */
    .share-section{display:flex;flex-direction:column;gap:10px}
    .share-row{display:flex;gap:8px}
    .share-row input{flex:1;height:36px;border:1px solid var(--border);border-radius:6px;padding:0 10px;font-size:13px;outline:none;background:var(--bg);color:var(--text)}
    .share-row input:focus{border-color:var(--primary)}
    .share-row .copy-btn{height:36px;padding:0 12px;border:none;border-radius:6px;background:var(--primary);color:var(--white);font-size:12px;font-weight:600;cursor:pointer;white-space:nowrap}
    .share-pwd{display:flex;align-items:center;gap:6px;font-size:13px}
    .share-pwd .pwd-tag{padding:2px 8px;background:#fdf6ec;color:#e6a23c;border-radius:4px;font-weight:700}
    .share-pwd .pwd-hint{font-size:11px;color:var(--text2)}
    .share-tip{padding:8px 10px;background:#fdf6ec;border-radius:6px;font-size:12px;line-height:1.5;color:#d46b08;display:flex;gap:6px;align-items:flex-start}
    .share-tip .warn-icon{font-size:18px;line-height:1.5;flex-shrink:0}
    .share-tip .tip-text{flex:1;min-width:0}
    .share-tip strong{font-weight:700}
    .warning-box{background:#fff2f0;border:1px solid #ffccc7;border-radius:8px;padding:8px 10px;overflow-x:auto;-webkit-overflow-scrolling:touch}
    .warning-item{margin:0;font-size:12px;line-height:1.8;font-weight:700;white-space:nowrap}
    .warning-item:nth-child(odd){color:#cf1322}
    .warning-item:nth-child(even){color:#d46b08}
    .warning-item:last-child{color:#b71c1c;font-size:13px}
    .share-qr{display:flex;flex-direction:column;align-items:center;gap:4px;padding:8px}
    .share-qr canvas{border-radius:8px}
    .share-qr .qr-label{font-size:12px;font-weight:600;color:var(--primary)}
    .share-qr .qr-sub{font-size:11px;color:var(--text2)}
    .share-disclaimer{display:flex;align-items:center;justify-content:center;gap:8px;margin-top:10px;padding:8px 10px;background:#fdf6ec;border-radius:6px;font-size:12px;color:#d46b08;flex-wrap:wrap}

    /* ===== Login Modal ===== */
    .login-form{display:flex;flex-direction:column;gap:12px}
    .login-form input{height:40px;border:1px solid var(--border);border-radius:8px;padding:0 12px;font-size:14px;outline:none}
    .login-form input:focus{border-color:var(--primary)}
    .login-form .login-btn{height:40px;border:none;border-radius:8px;background:var(--primary);color:var(--white);font-size:14px;font-weight:600;cursor:pointer;transition:background .2s}
    .login-form .login-btn:active{background:var(--primary-dark)}
    .login-form .login-btn:disabled{opacity:.5}
    .login-form .login-err{font-size:12px;color:#f56c6c;text-align:center}

    /* ===== Progress Steps ===== */
    .steps{display:flex;flex-direction:column;gap:10px;padding:8px 0}
    .step{display:flex;align-items:flex-start;gap:10px;opacity:.4;transition:opacity .3s}
    .step.active{opacity:1}
    .step.done{opacity:.7}
    .step-dot{flex-shrink:0;width:26px;height:26px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:700;background:#e4e7ed;color:#909399}
    .step.active .step-dot{background:var(--primary);color:#fff;box-shadow:0 0 0 3px rgba(64,158,255,.2)}
    .step.done .step-dot{background:#67c23a;color:#fff}
    .step-body{flex:1;padding-top:3px;display:flex;align-items:center;gap:8px}
    .step-title{font-size:13px;color:var(--text);font-weight:500}
    .step-status{font-size:11px;padding:1px 7px;border-radius:10px;white-space:nowrap}
    .step-status.doing{background:#ecf5ff;color:var(--primary)}
    .step-status.done{background:#f0f9eb;color:#67c23a}
    .step-status.wait{background:#f4f4f5;color:#c0c4cc}
    .error-alert{padding:12px 16px;background:#fef0f0;border:1px solid #fde2e2;border-radius:8px;display:flex;align-items:center;gap:8px;font-size:14px;color:#f56c6c}

    /* ===== User Badge ===== */
    .user-badge{font-size:12px;color:var(--primary);font-weight:600;white-space:nowrap}
    .login-btn-small{height:30px;padding:0 10px;border:none;border-radius:6px;background:var(--primary-light);color:var(--primary);font-size:12px;font-weight:600;cursor:pointer}
    .logout-btn-small{height:30px;padding:0 8px;border:none;border-radius:6px;background:transparent;color:var(--text2);font-size:12px;cursor:pointer}
