:root {
    --bg-color: #f4f8ff;
    --card-bg: #ffffff;
    --card-bg-soft: #eef5ff;
    --text-main: #1f2937;
    --text-muted: #64748b;
    --accent: #2563eb;
    --success: #10b981;
    --warning: #f59e0b;
    --border: #d6e4ff;
}

body {
    min-height: 100vh;
    background:
        radial-gradient(circle at 20% 0%, rgba(191, 219, 254, 0.35), transparent 42%),
        radial-gradient(circle at 80% 20%, rgba(224, 242, 254, 0.42), transparent 36%),
        var(--bg-color);
    color: var(--text-main);
    font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
    margin: 0;
    padding: 2rem;
    line-height: 1.6;
}

.container {
    max-width: 1120px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 1.4rem;
}

h1 {
    color: var(--accent);
    margin-bottom: 0.5rem;
    font-size: 2rem;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.status-box {
    text-align: center;
    padding: 1rem;
    border-radius: 8px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    margin-bottom: 1rem;
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    margin: 0.85rem 0 1.25rem;
}

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

/* ─── 状态徽章 ─── */
.access-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    border: 1px solid;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.access-badge.realtime {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border-color: #10b981;
    color: #059669;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}

.access-badge.cache {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    border-color: #f59e0b;
    color: #b45309;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.12);
}

.refresh-btn {
    border: 1px solid #93c5fd;
    background: linear-gradient(135deg, #dbeafe, #eff6ff);
    color: #1d4ed8;
    border-radius: 10px;
    padding: 0.45rem 0.9rem;
    cursor: pointer;
    font-weight: 600;
}

.home-btn {
    border: 1px solid #bfdbfe;
    background: linear-gradient(135deg, #f1f5f9, #f8fafc);
    color: #0f172a;
    border-radius: 10px;
    padding: 0.45rem 0.9rem;
    cursor: pointer;
    font-weight: 600;
}

@media (hover: hover) {
    .home-btn:hover {
        transform: translateY(-1px);
        border-color: #93c5fd;
        box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
    }

    .refresh-btn:hover {
        transform: translateY(-1px);
        border-color: #60a5fa;
        box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
    }
}

.refresh-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.error { color: #ef4444; border-color: #ef4444; }

.grid-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
}

.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.overview-item {
    background-color: var(--card-bg-soft);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 3px 12px rgba(148, 163, 184, 0.14);
}

.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.75rem;
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.05),
        0 10px 15px -3px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

@media (hover: hover) {
    .card:hover {
        transform: translateY(-3px);
        box-shadow:
            0 10px 15px -3px rgba(0, 0, 0, 0.08),
            0 20px 25px -5px rgba(37, 99, 235, 0.12);
        border-color: var(--accent);
    }

    .wallet-link-btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
    }
}

.wallet-address {
    font-family: monospace;
    font-size: 0.95rem;
    color: var(--text-main);
    word-break: break-all;
    background: #f0f7ff;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    border: 1px dashed var(--border);
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
    flex: 1;
    min-width: 0;
}

.wallet-address:hover {
    background: #e0edff;
    border-color: var(--accent);
}

.wallet-address-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.wallet-link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.2rem;
    height: 2.2rem;
    background: linear-gradient(135deg, #dbeafe, #eff6ff);
    border: 1px solid #93c5fd;
    border-radius: 8px;
    font-size: 1rem;
    text-decoration: none;
    color: #1d4ed8;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    flex-shrink: 0;
}

.miner-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.6rem;
}

.miner-name {
    font-size: 1.08rem;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.miner-tag {
    font-size: 0.72rem;
    color: #2563eb;
    border: 1px solid rgba(37, 99, 235, 0.35);
    border-radius: 999px;
    padding: 0.15rem 0.5rem;
}

.data-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

@media (max-width: 640px) {
    .data-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 400px) {
    .data-grid {
        grid-template-columns: 1fr;
    }
}

.data-item {
    background: linear-gradient(135deg, #f8fbff, #f0f7ff);
    padding: 0.85rem;
    border-radius: 10px;
    text-align: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

@media (hover: hover) {
    .data-item:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
    }
}

.data-label {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 0.3rem;
    letter-spacing: 0.03em;
}

.data-value-sub {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.data-value {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.4;
}

.data-value.nowrap {
    white-space: nowrap;
    font-size: 0.95rem;
}

.progress-wrap {
    margin-top: 0.9rem;
}

.progress-meta {
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
    font-size: 0.78rem;
    margin-bottom: 0.4rem;
}

.progress-bar {
    width: 100%;
    height: 14px;
    border-radius: 999px;
    background: linear-gradient(90deg, #dbeafe, #e0e7ff);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, #3b82f6 0%, #8b5cf6 100%);
    transition: width 0.45s ease;
}

.highlight { color: var(--success); }
.hit-count-zero { color: var(--text-muted); }
.block-found { color: var(--warning); text-shadow: 0 0 8px rgba(245, 158, 11, 0.5); }

/* ─── 难度对比区块 ─── */
.diff-blocks {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 2px dashed var(--border);
    display: flex;
    justify-content: center;
}

.bestshare-block {
    background: linear-gradient(135deg, #f5f3ff, #ede9fe);
    border: 1px solid #ddd6fe;
    padding: 1.25rem 2rem;
    border-radius: 12px;
    text-align: center;
    min-width: 280px;
    max-width: 400px;
    width: 100%;
}

.bestshare-t,
.network-diff-t {
    display: block;
    font-size: 1.55rem;
    font-weight: 800;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.02em;
    line-height: 1.3;
}

.bestshare-raw,
.network-diff-raw {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

@media (max-width: 500px) {
    .diff-blocks {
        justify-content: stretch;
    }
    .bestshare-block {
        min-width: unset;
        max-width: unset;
    }
}

footer {
    margin-top: 3rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

@media (max-width: 600px) {
    body { padding: 1rem; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .toolbar-actions { width: 100%; }
    .home-btn, .refresh-btn { width: 100%; }
    .grid-layout { grid-template-columns: 1fr; }
    .card { padding: 1.25rem; }
}

/* ─── 调试面板 ─── */
.debug-panel {
    background: #1a1a2e;
    color: #e0e0e0;
    border: 1px solid #3a3a5c;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    font-family: 'Courier New', monospace;
    font-size: 0.78rem;
    line-height: 1.7;
    margin-bottom: 1.5rem;
}
.debug-title {
    font-size: 0.9rem;
    font-weight: bold;
    color: #fbbf24;
    margin-bottom: 0.6rem;
}
.debug-section-title {
    color: #94a3b8;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.6rem;
    margin-bottom: 0.2rem;
}
.debug-row {
    padding: 0.2rem 0;
    border-radius: 4px;
}
.debug-row.debug-ok .debug-url { color: #86efac; }
.debug-row.debug-ok .debug-status { color: #4ade80; }
.debug-row.debug-ok .debug-raw { color: #6ee7b7; }
.debug-row.debug-fail .debug-url { color: #fca5a5; }
.debug-row.debug-fail .debug-status { color: #f87171; }
.debug-row.debug-fail .debug-raw { color: #fca5a5; }
.debug-url { color: #93c5fd; display: block; word-break: break-all; }
.debug-status { font-weight: bold; }
.debug-raw { color: #86efac; display: block; font-size: 0.72rem; opacity: 0.8; word-break: break-all; }
.debug-used { background: #fbbf24; color: #1a1a2e; padding: 0 4px; border-radius: 3px; font-size: 0.7rem; }
