:root {
    --bg: #f2f5f9;
    --bg-soft: #e8eef6;
    --panel: rgba(255, 255, 255, 0.88);
    --panel-solid: #ffffff;
    --panel-raised: rgba(248, 250, 252, 0.94);
    --line: rgba(15, 23, 42, 0.10);
    --line-strong: rgba(15, 23, 42, 0.18);
    --text: #101c2a;
    --muted: #4d6072;
    --dim: #7e8d9c;
    --accent: #0d9488;
    --accent-deep: #0f766e;
    --accent-soft: rgba(13, 148, 136, 0.10);
    --blue: #0284c7;
    --gold: #b45309;
    --red: #e11d48;
    --green: #059669;
    --radius: 18px;
    --radius-sm: 12px;
    --mono: "JetBrains Mono", "SFMono-Regular", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
    --sans: "Inter", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    --shadow: 0 18px 44px -34px rgba(15, 23, 42, 0.38);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

button,
input,
select {
    font: inherit;
    color: inherit;
}

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

h1, h2, h3, p {
    margin: 0;
}

b, strong {
    font-weight: 600;
}

.ambient {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.ambient-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(15, 23, 42, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(15, 23, 42, 0.045) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: radial-gradient(ellipse 80% 55% at 50% 0%, #000 20%, transparent 80%);
}

.ambient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.32;
}

.orb-a {
    width: 640px;
    height: 640px;
    top: -280px;
    left: 8%;
    background: radial-gradient(circle, rgba(20, 184, 166, 0.18), transparent 65%);
}

.orb-b {
    width: 560px;
    height: 560px;
    top: 120px;
    right: -180px;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.12), transparent 65%);
}

/* ---------- 顶栏 ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px clamp(18px, 4vw, 48px);
    background: rgba(255, 255, 255, 0.82);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(18px) saturate(140%);
}

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

.brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    flex: none;
    border-radius: 13px;
    color: var(--accent);
    background: linear-gradient(145deg, rgba(94, 234, 212, 0.150), rgba(56, 189, 248, 0.06));
    border: 1px solid rgba(94, 234, 212, 0.24);
    box-shadow: inset 0 0 18px rgba(94, 234, 212, 0.06);
}

.brand-mark svg {
    width: 30px;
    height: 30px;
}

.brand-mark.small {
    width: 34px;
    height: 34px;
    border-radius: 10px;
}

.brand-mark.small svg {
    width: 24px;
    height: 24px;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
    min-width: 0;
}

.brand-text strong {
    font-size: 15px;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.brand-text small {
    color: var(--dim);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
}

.live-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 12px;
    color: var(--muted);
}

.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 10px;
    border-radius: 999px;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-soft);
    border: 1px solid rgba(94, 234, 212, 0.22);
    white-space: nowrap;
}

.live-badge.is-stale {
    color: var(--gold);
    background: rgba(251, 191, 36, 0.09);
    border-color: rgba(251, 191, 36, 0.24);
}

.live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 0 currentColor;
    animation: pulse 2.4s infinite;
}

.live-badge.is-stale .live-dot {
    animation: none;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(94, 234, 212, 0.45); }
    70% { box-shadow: 0 0 0 7px rgba(94, 234, 212, 0); }
    100% { box-shadow: 0 0 0 0 rgba(94, 234, 212, 0); }
}

.live-time {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.live-time b {
    color: var(--text);
    font-weight: 500;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: rgba(15, 23, 42, 0.04);
    color: var(--muted);
    cursor: pointer;
    transition: border-color .2s, color .2s, background .2s;
    white-space: nowrap;
}

.icon-btn svg {
    width: 15px;
    height: 15px;
}

.icon-btn:hover {
    color: var(--text);
    border-color: var(--line-strong);
    background: rgba(15, 23, 42, 0.07);
}

.icon-btn.is-loading svg {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---------- 页面骨架 ---------- */
.page {
    position: relative;
    z-index: 1;
    width: min(1440px, 100%);
    margin: 0 auto;
    padding: clamp(20px, 3vw, 34px) clamp(18px, 4vw, 48px) 40px;
}

.panel {
    position: relative;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background:
        linear-gradient(160deg, rgba(255, 255, 255, 0.025), transparent 45%),
        var(--panel);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

/* ---------- Hero ---------- */
.hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 18px;
    margin-bottom: 18px;
}

.hero-main {
    padding: clamp(22px, 3vw, 34px);
    overflow: hidden;
}

.hero-main::after {
    content: "";
    position: absolute;
    width: 460px;
    height: 460px;
    right: -160px;
    top: -210px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(94, 234, 212, 0.11), transparent 62%);
    pointer-events: none;
}

.hero-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.eyebrow-line {
    width: 22px;
    height: 1px;
    background: linear-gradient(90deg, var(--accent), transparent);
}

.hero-price-tags {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.tag {
    padding: 5px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-size: 11.5px;
    background: rgba(255, 255, 255, 0.025);
    white-space: nowrap;
}

.tag b {
    color: var(--text);
    font-family: var(--mono);
    font-weight: 500;
}

.tag-change.is-up {
    color: var(--green);
    border-color: rgba(52, 211, 153, 0.25);
    background: rgba(52, 211, 153, 0.08);
}

.tag-change.is-down {
    color: var(--red);
    border-color: rgba(251, 113, 133, 0.25);
    background: rgba(251, 113, 133, 0.08);
}

.hero-number {
    display: flex;
    align-items: baseline;
    gap: 4px;
    margin: 22px 0 4px;
    font-family: var(--mono);
    line-height: 1;
    letter-spacing: -0.045em;
    transition: color .25s;
}

.hero-currency {
    font-size: clamp(24px, 3vw, 34px);
    color: var(--accent);
    transform: translateY(-0.28em);
}

.hero-number strong {
    font-size: clamp(50px, 7.4vw, 92px);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    background: linear-gradient(180deg, #0f172a 10%, #0f766e 95%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero-number .hero-unit {
    font-size: 13px;
    color: var(--dim);
    letter-spacing: 0;
    margin-left: 8px;
}

.hero-number.is-negative strong {
    background: linear-gradient(180deg, #7f1d1d 10%, #e11d48 100%);
    -webkit-background-clip: text;
    background-clip: text;
}

.hero-number.is-negative .hero-currency {
    color: var(--red);
}

.hero-sub {
    color: var(--muted);
    font-size: 13px;
    margin-top: 8px;
}

.hero-chips {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-top: 24px;
}

.chip {
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #ffffff;
}

.chip span {
    display: block;
    color: var(--dim);
    font-size: 11px;
    margin-bottom: 4px;
    white-space: nowrap;
}

.chip b {
    display: block;
    font-family: var(--mono);
    font-size: 14px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hero-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 18px;
    color: var(--dim);
    font-size: 11.5px;
    flex-wrap: wrap;
}

.dot-sep {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--dim);
}

.hero-side {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.mini-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 6px;
    min-height: 104px;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background:
        linear-gradient(150deg, rgba(13, 148, 136, 0.06), transparent 60%),
        var(--panel);
    box-shadow: var(--shadow);
}

.mini-label {
    color: var(--dim);
    font-size: 11px;
    letter-spacing: 0.04em;
}

.mini-value {
    font-family: var(--mono);
    font-size: 21px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
    word-break: break-all;
}

.mini-value em {
    font-style: normal;
    font-family: var(--sans);
    font-size: 10px;
    color: var(--dim);
    margin-left: 4px;
    letter-spacing: 0.04em;
}

.mini-foot {
    color: var(--dim);
    font-size: 10.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- 工作区 ---------- */
.workspace {
    display: grid;
    grid-template-columns: 386px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.config-panel {
    position: sticky;
    top: 82px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    padding: 20px;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 178, 204, 0.2) transparent;
}

.config-panel::-webkit-scrollbar {
    width: 6px;
}

.config-panel::-webkit-scrollbar-thumb {
    background: rgba(148, 178, 204, 0.18);
    border-radius: 99px;
}

.panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}

.panel-head h2 {
    font-size: 15px;
    letter-spacing: 0.01em;
}

.panel-head p {
    color: var(--dim);
    font-size: 11.5px;
    margin-top: 3px;
}

.panel-note {
    color: var(--dim);
    font-size: 11px;
    white-space: nowrap;
    padding-top: 3px;
}

#gpu-rank-note {
    white-space: normal;
}

.gpu-rank-table {
    min-width: 720px;
}

.gpu-rank-table .gross-head {
    color: var(--accent-deep);
}

.gpu-rank-table .gross-cell {
    color: var(--accent-deep);
    font-weight: 700;
    font-size: 13.5px;
    background: var(--accent-soft);
    white-space: nowrap;
}

.gpu-add-btn {
    font-size: 10.5px;
}

.ghost-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    border-radius: 9px;
    border: 1px solid rgba(94, 234, 212, 0.22);
    color: var(--accent);
    background: var(--accent-soft);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s, border-color .2s;
    white-space: nowrap;
}

.ghost-btn svg {
    width: 14px;
    height: 14px;
}

.ghost-btn:hover {
    background: rgba(94, 234, 212, 0.18);
    border-color: rgba(94, 234, 212, 0.4);
}

/* GPU 行 */
.gpu-list {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.gpu-row {
    padding: 11px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: rgba(15, 23, 42, 0.025);
    transition: border-color .2s;
}

.gpu-row:focus-within {
    border-color: rgba(13, 148, 136, 0.30);
}

.gpu-row-head {
    display: flex;
    gap: 8px;
    align-items: center;
}

.gpu-select {
    flex: 1;
    min-width: 0;
    padding: 8px 30px 8px 10px;
    border-radius: 9px;
    border: 1px solid var(--line);
    background: var(--panel-solid);
    color: var(--text);
    font-size: 12.5px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='m6 9 6 6 6-6' stroke='%2390a1b6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    cursor: pointer;
}

.gpu-select option {
    background: #ffffff;
}

.row-remove {
    flex: none;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--dim);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: color .2s, background .2s;
}

.row-remove:hover {
    color: var(--red);
    background: rgba(251, 113, 133, 0.08);
}

.gpu-fields {
    display: grid;
    grid-template-columns: 62px 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
}

.mini-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.mini-field span {
    color: var(--dim);
    font-size: 9.5px;
    letter-spacing: 0.03em;
    padding-left: 2px;
}

.mini-field input {
    width: 100%;
    padding: 7px 8px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #ffffff;
    font-family: var(--mono);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}

.totals-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    margin: 12px 0 16px;
    padding: 10px;
    border-radius: 12px;
    background: rgba(94, 234, 212, 0.045);
    border: 1px dashed rgba(94, 234, 212, 0.18);
}

.totals-strip div {
    min-width: 0;
    text-align: center;
}

.totals-strip span {
    display: block;
    color: var(--dim);
    font-size: 9.5px;
    margin-bottom: 2px;
    white-space: nowrap;
}

.totals-strip b {
    display: block;
    font-family: var(--mono);
    font-size: 11.5px;
    font-weight: 500;
    color: var(--accent);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 表单 */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.field > span {
    color: var(--muted);
    font-size: 11.5px;
}

.field > span em {
    color: var(--dim);
    font-style: normal;
    font-size: 10px;
}

.field input,
.field select {
    width: 100%;
    padding: 9px 10px;
    border-radius: 9px;
    border: 1px solid var(--line);
    background: #ffffff;
    font-family: var(--mono);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}

.field select {
    font-family: var(--sans);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='m6 9 6 6 6-6' stroke='%2390a1b6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
    cursor: pointer;
}

.field select option {
    background: #ffffff;
}

.field input:focus,
.field select:focus,
.mini-field input:focus,
.gpu-select:focus {
    border-color: rgba(13, 148, 136, 0.45);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}

.field input::placeholder {
    color: #98a6b5;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

input:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* 收益基准 */
.basis-block {
    margin-top: 16px;
    padding-top: 15px;
    border-top: 1px solid var(--line);
}

.field-title {
    display: block;
    color: var(--muted);
    font-size: 11.5px;
    margin-bottom: 7px;
}

.segmented {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.06);
    border: 1px solid var(--line);
}

.segmented button {
    padding: 7px 8px;
    border: 1px solid transparent;
    border-radius: 7px;
    background: transparent;
    color: var(--dim);
    font-size: 11.5px;
    font-weight: 500;
    cursor: pointer;
    transition: color .2s, background .2s, border-color .2s;
    white-space: nowrap;
}

.segmented button:hover {
    color: var(--text);
}

.segmented button.is-active {
    color: var(--accent);
    background: rgba(94, 234, 212, 0.1);
    border-color: rgba(94, 234, 212, 0.2);
}

.segmented.small {
    display: inline-flex;
    padding: 3px;
    border-radius: 9px;
}

.segmented.small button {
    padding: 5px 10px;
    font-size: 11px;
}

.field-hint {
    color: var(--dim);
    font-size: 10.5px;
    line-height: 1.55;
    margin-top: 7px;
}

.pool-picker {
    margin-top: 12px;
    padding: 12px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.035);
    border: 1px solid var(--line);
}

/* 高级参数 */
.advanced {
    margin-top: 16px;
    border-top: 1px solid var(--line);
    padding-top: 13px;
}

.advanced summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--muted);
    font-size: 11.5px;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.advanced summary::-webkit-details-marker {
    display: none;
}

.advanced summary svg {
    width: 14px;
    height: 14px;
    transition: transform .2s;
    flex: none;
}

.advanced[open] summary svg {
    transform: rotate(180deg);
}

.advanced-body {
    padding-top: 12px;
}

.text-btn {
    margin-top: 10px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--accent);
    font-size: 11px;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: rgba(94, 234, 212, 0.35);
}

/* ---------- 结果区 ---------- */
.results {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
}

.kpi {
    padding: 16px;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 4px;
    overflow: hidden;
}

.kpi::after {
    content: "";
    position: absolute;
    width: 90px;
    height: 90px;
    right: -40px;
    bottom: -55px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(94, 234, 212, 0.13), transparent 70%);
    pointer-events: none;
}

.kpi-label {
    color: var(--dim);
    font-size: 11px;
    letter-spacing: 0.03em;
}

.kpi-value {
    font-family: var(--mono);
    font-size: 20px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kpi-value.is-positive {
    color: var(--accent);
}

.kpi-value.is-negative {
    color: var(--red);
}

.kpi-foot {
    color: var(--dim);
    font-size: 10.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.results > .panel,
.kpi-grid {
    animation: rise .45s ease both;
}

.results > .panel:nth-child(2) { animation-delay: .04s; }
.results > .panel:nth-child(3) { animation-delay: .08s; }
.results > .panel:nth-child(4) { animation-delay: .12s; }
.results > .panel:nth-child(5) { animation-delay: .16s; }
.results > .panel:nth-child(6) { animation-delay: .2s; }

@keyframes rise {
    from { opacity: 0; transform: translateY(7px); }
    to { opacity: 1; transform: none; }
}

.results > .panel {
    padding: 20px;
}

/* 图表 */
.chart-panel .panel-head {
    align-items: center;
}

.chart-wrap {
    position: relative;
    height: 280px;
    margin-top: 4px;
}

#profit-chart {
    display: block;
    width: 100%;
    height: 100%;
}

.chart-empty {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: var(--dim);
    font-size: 12px;
}

.chart-legend {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
    color: var(--dim);
    font-size: 10.5px;
    flex-wrap: wrap;
}

.chart-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.chart-legend i {
    display: inline-block;
    width: 16px;
    height: 2px;
    border-radius: 2px;
    background: var(--accent);
}

.chart-legend i.legend-zero {
    height: 1px;
    background: repeating-linear-gradient(90deg, var(--dim) 0 3px, transparent 3px 6px);
}

.chart-note {
    margin-left: auto;
}

/* 表格 */
.table-wrap {
    width: 100%;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 178, 204, 0.2) transparent;
}

.table-wrap::-webkit-scrollbar {
    height: 6px;
}

.table-wrap::-webkit-scrollbar-thumb {
    background: rgba(148, 178, 204, 0.18);
    border-radius: 99px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}

.data-table th {
    padding: 8px 10px;
    text-align: left;
    color: var(--dim);
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--line-strong);
    white-space: nowrap;
}

.data-table td {
    padding: 10px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
    vertical-align: middle;
}

.data-table tbody tr:last-child td {
    border-bottom: 0;
}

.data-table tbody tr {
    transition: background .15s;
}

.data-table tbody tr:hover {
    background: rgba(15, 23, 42, 0.025);
}

.data-table .num {
    text-align: right;
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
}

.data-table td.num {
    font-size: 12px;
}

.data-table .is-positive { color: var(--accent); }
.data-table .is-negative { color: var(--red); }
.data-table .is-gold { color: var(--gold); }

.period-label {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    color: var(--text);
    font-weight: 600;
}

.period-label small {
    color: var(--dim);
    font-weight: 400;
    font-size: 10.5px;
}

.data-table.compact td,
.data-table.compact th {
    padding: 8px 9px;
}

.placeholder-row {
    text-align: center !important;
    color: var(--dim);
    padding: 22px 10px !important;
    font-size: 11.5px;
}

.pool-btn {
    padding: 5px 10px;
    border-radius: 7px;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--muted);
    font-size: 10.5px;
    cursor: pointer;
    transition: all .2s;
    white-space: nowrap;
}

.pool-btn:hover {
    color: var(--accent);
    border-color: rgba(94, 234, 212, 0.35);
    background: var(--accent-soft);
}

.pool-btn.is-active {
    color: var(--accent);
    border-color: rgba(94, 234, 212, 0.35);
    background: var(--accent-soft);
}

/* 指标 */
.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
    gap: 10px;
}

.metric {
    padding: 13px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(15, 23, 42, 0.025);
    min-width: 0;
}

.metric-label {
    display: block;
    color: var(--dim);
    font-size: 10.5px;
    margin-bottom: 5px;
    white-space: nowrap;
}

.metric-value {
    display: block;
    font-family: var(--mono);
    font-size: 15px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.metric-value.is-accent { color: var(--accent); }
.metric-value.is-gold { color: var(--gold); }
.metric-value.is-red { color: var(--red); }

.metric-sub {
    display: block;
    color: var(--dim);
    font-size: 9.5px;
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 全网数据 */
.network-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.network-item {
    padding: 12px 13px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(15, 23, 42, 0.025);
    min-width: 0;
}

.network-item span {
    display: block;
    color: var(--dim);
    font-size: 10.5px;
    margin-bottom: 4px;
    white-space: nowrap;
}

.network-item b {
    display: block;
    font-family: var(--mono);
    font-size: 14px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 提示 */
.warnings {
    padding: 14px 16px;
    border-radius: 13px;
    border: 1px solid rgba(251, 191, 36, 0.24);
    background: rgba(251, 191, 36, 0.055);
    color: #92400e;
    font-size: 11.5px;
}

.warnings ul {
    margin: 0;
    padding-left: 16px;
}

.warnings li + li {
    margin-top: 4px;
}

/* 免责声明 */
.disclaimer {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-top: 22px;
    padding: 16px 18px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: rgba(15, 23, 42, 0.02);
    color: var(--dim);
    font-size: 11px;
    line-height: 1.7;
}

.disclaimer-mark {
    flex: none;
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid var(--line-strong);
    color: var(--muted);
    font-family: var(--mono);
    font-size: 11px;
    margin-top: 1px;
}

/* 页脚 */
.footer {
    position: relative;
    z-index: 1;
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(12px);
}

.footer-inner {
    width: min(1440px, 100%);
    margin: 0 auto;
    padding: 22px clamp(18px, 4vw, 48px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    flex-wrap: wrap;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.3;
}

.footer-brand small {
    color: var(--dim);
    font-size: 9.5px;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    font-size: 10.5px;
    color: var(--dim);
}

.footer-links span {
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.footer-links a {
    color: var(--muted);
    transition: color .2s;
}

.footer-links a:hover {
    color: var(--accent);
}

.footer-meta {
    display: flex;
    gap: 14px;
    color: var(--dim);
    font-size: 10px;
    font-family: var(--mono);
}

.noscript {
    position: fixed;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%);
    z-index: 100;
    padding: 12px 18px;
    border-radius: 10px;
    background: #fffbeb;
    border: 1px solid rgba(251, 191, 36, 0.4);
    color: var(--gold);
    font-size: 12px;
}

/* ---------- 响应式 ---------- */
@media (max-width: 1180px) {
    .workspace {
        grid-template-columns: 350px minmax(0, 1fr);
    }

    .hero {
        grid-template-columns: minmax(0, 1fr) 300px;
    }

    .kpi-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .network-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

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

    .hero-side {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .mini-card {
        min-height: 92px;
    }

    .workspace {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    /* 单列布局：显卡收益排行置顶，矿机配置（计算器）紧随其后，其余结果区再往下 */
    .results {
        display: contents;
    }

    .results > * {
        order: 3;
        min-width: 0;
    }

    .config-panel {
        order: 2;
        position: static;
        max-height: none;
        overflow: visible;
    }

    .gpu-rank-panel {
        order: 1;
    }

    .gpu-list {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .totals-strip {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 760px) {
    .topbar {
        flex-wrap: wrap;
        gap: 10px;
        padding: 12px 16px;
    }

    .live-bar {
        width: 100%;
        justify-content: space-between;
        gap: 8px;
    }

    .live-time {
        font-size: 10.5px;
    }

    .page {
        padding: 16px 14px 30px;
    }

    .hero-main {
        padding: 18px 16px;
    }

    .hero-number {
        margin: 16px 0 2px;
    }

    .hero-number strong {
        font-size: clamp(44px, 12vw, 56px);
    }

    .hero-sub {
        font-size: 12px;
    }

    .hero-chips {
        grid-template-columns: 1fr 1fr;
    }

    .hero-side {
        grid-template-columns: 1fr 1fr;
    }

    .mini-card {
        min-height: 84px;
        padding: 12px;
    }

    .kpi-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .kpi {
        min-height: 84px;
        padding: 13px;
    }

    .kpi-value {
        font-size: 17px;
    }

    .config-panel {
        padding: 16px;
    }

    .results > .panel {
        padding: 16px;
    }

    /* 手机端隐藏次要列，避免表格横向溢出 */
    .data-table .col-usd {
        display: none;
    }

    .table-wrap {
        -webkit-overflow-scrolling: touch;
    }

    .gpu-list {
        grid-template-columns: 1fr;
    }

    .network-grid {
        grid-template-columns: 1fr 1fr;
    }

    .chart-wrap {
        height: 230px;
    }

    .chart-panel .panel-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .panel-head {
        gap: 8px;
    }

    .data-table {
        font-size: 11.5px;
    }

    .data-table th,
    .data-table td {
        padding: 8px;
    }

    /* 显卡收益排行：手机端紧凑展示 型号 / 算力 / 日毛收益 / 功耗 */
    .gpu-rank-panel {
        padding: 14px 12px;
    }

    .gpu-rank-panel .panel-head {
        gap: 10px;
    }

    .gpu-rank-panel .panel-head p {
        font-size: 11.5px;
    }

    #gpu-sort {
        width: 100%;
        gap: 2px;
        padding: 3px;
    }

    #gpu-sort button {
        flex: 1 1 0;
        padding: 6px 4px;
        font-size: 11px;
        white-space: nowrap;
    }

    .gpu-rank-table {
        min-width: 0;
        width: 100%;
        table-layout: auto;
    }

    .gpu-rank-table th,
    .gpu-rank-table td {
        padding: 9px 5px;
        font-size: 11.5px;
        white-space: nowrap;
    }

    .gpu-rank-table th {
        font-size: 10.5px;
    }

    .gpu-rank-table td:first-child {
        white-space: normal;
        word-break: break-word;
        line-height: 1.3;
    }

    .gpu-rank-table .col-prl,
    .gpu-rank-table .col-elec {
        display: none;
    }

    .gpu-rank-table .gross-cell {
        font-size: 13px;
    }

    .gpu-add-btn {
        padding: 4px 8px;
        font-size: 10px;
    }

    .footer-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
    }
}

@media (max-width: 480px) {
    .brand-text small {
        display: none;
    }

    .page {
        padding-left: 12px;
        padding-right: 12px;
    }

    .results > .panel,
    .config-panel {
        padding: 14px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .totals-strip {
        grid-template-columns: 1fr 1fr;
    }

    .network-grid {
        grid-template-columns: 1fr;
    }

    .metric-grid {
        grid-template-columns: 1fr 1fr;
    }

    .data-table th,
    .data-table td {
        padding: 7px 2px;
        font-size: 11px;
    }

    .data-table th {
        font-size: 10px;
        letter-spacing: 0;
    }

    .unit-hide {
        display: none;
    }

    .live-time {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
