/* QuantumPay — base terminal theme */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #1c2333;
    --border: #21262d;
    --border-bright: #30363d;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-dim: #484f58;
    --green: #00ff88;
    --green-glow: rgba(0, 255, 136, 0.15);
    --green-bg: rgba(0, 255, 136, 0.08);
    --red: #ff4444;
    --red-glow: rgba(255, 68, 68, 0.15);
    --red-bg: rgba(255, 68, 68, 0.08);
    --cyan: #00d4ff;
    --font-mono: 'JetBrains Mono', 'Courier New', monospace;
    --font-display: 'Space Grotesk', sans-serif;
}

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

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 255, 136, 0.015) 2px,
        rgba(0, 255, 136, 0.015) 4px
    );
}

.header {
    padding: 28px 40px 0;
    border-bottom: 1px solid var(--border);
}

.header-top {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 6px;
}

.logo-icon {
    width: 36px;
    height: 36px;
    border: 2px solid var(--green);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 0 12px var(--green-glow);
    flex-shrink: 0;
}

.header h1 {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.header h1 span {
    color: var(--green);
}

.header .subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    letter-spacing: 1px;
    margin-left: 52px;
    margin-bottom: 20px;
}

.tabs {
    display: flex;
    gap: 0;
    margin-left: 52px;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 500;
    padding: 10px 20px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    position: relative;
    bottom: -1px;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--green);
    border-bottom-color: var(--green);
}

.main {
    padding: 32px 40px;
    max-width: 1200px;
    margin: 0 auto;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.btn-row {
    display: flex;
    gap: 12px;
}

.btn {
    padding: 12px 24px;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid;
    transition: all 0.2s ease;
}

.btn-quantum {
    background: rgba(0, 255, 136, 0.1);
    color: var(--green);
    border-color: rgba(0, 255, 136, 0.3);
}

.btn-quantum:hover {
    background: rgba(0, 255, 136, 0.2);
    box-shadow: 0 0 20px var(--green-glow);
}

.btn-classical {
    background: rgba(255, 68, 68, 0.1);
    color: var(--red);
    border-color: rgba(255, 68, 68, 0.3);
}

.btn-classical:hover {
    background: rgba(255, 68, 68, 0.2);
    box-shadow: 0 0 20px var(--red-glow);
}

.btn-primary {
    background: rgba(0, 212, 255, 0.1);
    color: var(--cyan);
    border-color: rgba(0, 212, 255, 0.3);
}

.btn-primary:hover {
    background: rgba(0, 212, 255, 0.2);
}

.mt-16 { margin-top: 16px; }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-dim { color: var(--text-dim); }

.qb-section h2 {
    font-family: var(--font-display);
    font-size: 22px;
    margin-bottom: 8px;
}

.qb-subtext {
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-size: 13px;
}

.qb-divider {
    border-top: 1px solid var(--border);
    margin: 24px 0;
}

.qb-input {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-bright);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 11px 12px;
    font-family: var(--font-mono);
}

.qb-terminal {
    margin-top: 14px;
    background: #0b0f14;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    min-height: 72px;
    line-height: 1.8;
}

.qb-label {
    margin-top: 14px;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 12px;
}

.qhf-heatmap {
    display: grid;
    grid-template-columns: repeat(8, 18px);
    gap: 6px;
}

.qhf-cell {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 1px solid #2b3240;
}

.qb-two-col {
    margin-top: 14px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.qb-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-secondary);
    padding: 12px;
}

.qb-card h3 {
    margin-bottom: 8px;
    font-size: 14px;
}

.qb-card p {
    margin-bottom: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.qb-large-result {
    margin-top: 14px;
    font-size: 22px;
    font-weight: 700;
    font-family: var(--font-display);
}

.qb-progress-track {
    margin-top: 10px;
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: #242b33;
    overflow: hidden;
}

.qb-progress-fill {
    height: 100%;
    width: 0;
    background: var(--green);
    transition: width 0.08s linear;
}

.qb-progress-fill.bad {
    background: var(--red);
}

.qb-status-text {
    margin-top: 10px;
    font-size: 13px;
    color: var(--text-secondary);
}

.qb-interpret {
    margin-top: 12px;
    color: var(--text-secondary);
    font-size: 13px;
}

.qb-chain {
    margin-top: 8px;
}

.qb-block {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    background: var(--bg-secondary);
}

.qb-block.valid {
    border-color: rgba(0, 255, 136, 0.35);
}

.qb-block.tampered {
    border-color: rgba(255, 68, 68, 0.5);
}

.qb-block-top {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 12px;
}

.qb-block-data {
    margin-bottom: 8px;
}

.qb-link {
    text-align: center;
    padding: 8px 0;
    color: var(--green);
}

.qb-banner {
    margin-top: 14px;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.qb-banner.ok {
    color: var(--green);
    border-color: rgba(0, 255, 136, 0.35);
    background: var(--green-bg);
}

.qb-banner.bad {
    color: var(--red);
    border-color: rgba(255, 68, 68, 0.35);
    background: var(--red-bg);
}

.qb-mono {
    font-family: var(--font-mono);
    word-break: break-all;
}

/* ── Global error ── */
.global-error {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    background: var(--red-bg);
    color: var(--red);
    border-bottom: 1px solid rgba(255, 68, 68, 0.4);
    padding: 10px 16px;
    text-align: center;
    font-weight: 600;
}

.backend-hint {
    font-size: 11px;
    font-weight: 400;
    color: var(--text-dim);
}

/* ── Send Payment tab ── */
.send-card {
    max-width: 600px;
    margin: 0 auto;
}

.send-card h2 {
    font-family: var(--font-display);
    font-size: 22px;
    margin-bottom: 8px;
}

.field-group {
    margin-bottom: 12px;
}

.field-group label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.send-flow {
    margin-top: 20px;
    min-height: 20px;
}

.send-flow .small-note {
    font-size: 11px;
    margin-top: 4px;
}

.pay-id-big {
    font-size: 28px;
    font-weight: 700;
    color: var(--green);
    font-family: var(--font-mono);
    letter-spacing: 1px;
    margin: 8px 0;
}

.success-banner {
    margin-top: 12px;
    padding: 16px;
    border-radius: 8px;
    background: rgba(0, 255, 136, 0.12);
    border: 1px solid rgba(0, 255, 136, 0.35);
    line-height: 1.7;
}

.success-footnote {
    margin-top: 12px;
    font-size: 12px;
    color: var(--text-dim);
    font-style: italic;
}

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

.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--text-dim);
    border-top-color: var(--green);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
    margin-left: 6px;
}

.mt-32 { margin-top: 32px; }

/* ── Ledger tab ── */
.ledger-heading {
    font-family: var(--font-display);
    font-size: 22px;
    margin-bottom: 16px;
}

.ledger-chain {
    margin-bottom: 8px;
}

.pay-block-card {
    border: 1px solid rgba(0, 255, 136, 0.35);
    border-radius: 8px;
    padding: 14px;
    background: var(--bg-secondary);
    margin-bottom: 0;
}

.pay-block-card.tampered {
    border-color: rgba(255, 68, 68, 0.55);
}

.pay-block-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
    font-size: 13px;
}

.pay-block-top-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pay-badge-tampered {
    font-size: 11px;
    color: var(--red);
    font-weight: 700;
}

.pay-row-main {
    font-size: 14px;
    margin-bottom: 6px;
}

.pay-amount {
    font-size: 22px;
    font-weight: 700;
    color: var(--green);
    margin-bottom: 4px;
}

.pay-note {
    font-size: 12px;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 10px;
}

.pay-tampered-text {
    color: var(--red) !important;
}

.pay-hash-box {
    background: #0b0f14;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px;
    font-size: 12px;
    line-height: 1.8;
}

.pay-pid {
    font-family: var(--font-mono);
    color: var(--cyan);
}

.pay-chain-link {
    text-align: center;
    color: var(--text-dim);
    font-size: 12px;
    padding: 10px 0;
}

.verify-btns {
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.btn-attack {
    background: rgba(255, 140, 0, 0.12);
    color: #ffaa44;
    border-color: rgba(255, 170, 68, 0.4);
}

.btn-attack:hover {
    background: rgba(255, 140, 0, 0.22);
}

.attack-status {
    margin-bottom: 12px;
    font-size: 13px;
    line-height: 1.7;
}

.verify-output {
    margin-top: 8px;
}

.verify-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.verify-list li {
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.verify-list li.ok {
    color: var(--green);
}

.verify-list li.bad {
    color: var(--red);
}

.verify-detail {
    font-family: var(--font-mono);
    font-size: 12px;
    white-space: pre-wrap;
}

.verify-summary {
    margin-top: 12px;
    font-weight: 600;
    font-size: 14px;
}

.verify-summary.ok {
    color: var(--green);
}

.verify-summary.bad {
    color: var(--red);
}

.attack-banner-red {
    margin-top: 12px;
    padding: 16px;
    border-radius: 8px;
    background: var(--red-bg);
    border: 1px solid rgba(255, 68, 68, 0.4);
    color: var(--text-primary);
}

.attack-banner-red h3 {
    color: var(--red);
    margin-bottom: 8px;
}

.attack-footnote {
    margin-top: 12px;
    font-size: 11px;
    color: var(--text-dim);
}

/* ── How it works ── */
.how-section h2 {
    font-family: var(--font-display);
    font-size: 20px;
    margin-bottom: 16px;
}

.how-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.how-col h3 {
    font-size: 14px;
    margin-bottom: 10px;
    color: var(--cyan);
}

.how-col p {
    margin-bottom: 10px;
    color: var(--text-secondary);
    line-height: 1.7;
}

.flow-row {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 20px;
}

.flow-box {
    flex: 1 1 140px;
    min-width: 120px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    background: var(--bg-secondary);
    font-size: 11px;
}

.flow-box strong {
    display: block;
    color: var(--green);
    margin-bottom: 8px;
    font-size: 12px;
}

.flow-arrow {
    align-self: center;
    color: var(--text-dim);
    font-size: 18px;
}

.how-para {
    color: var(--text-secondary);
    line-height: 1.8;
    font-size: 13px;
}

.research-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 18px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.8;
}

.research-box a {
    color: var(--cyan);
}

.research-cite {
    margin: 12px 0;
}
/* ── QHF Explorer styles ── */
.qb-section { padding: 24px 0; }
.qb-subtext { color: var(--dim); font-size: 0.85rem; margin-bottom: 16px; }
.qb-input { width: 100%; background: #161b22; border: 1px solid #30363d;
    color: var(--fg); padding: 10px 14px; border-radius: 6px;
    font-family: monospace; font-size: 0.95rem; box-sizing: border-box; }
.qb-terminal { background: #0d1117; border: 1px solid #30363d;
    border-radius: 6px; padding: 14px 16px; margin-top: 16px;
    font-family: monospace; font-size: 0.9rem; min-height: 48px; }
.qb-label { color: var(--dim); font-size: 0.8rem;
    margin-top: 20px; margin-bottom: 8px; }
.qhf-heatmap { display: grid; grid-template-columns: repeat(8, 1fr);
    gap: 3px; max-width: 320px; }
.qhf-cell { width: 100%; aspect-ratio: 1; border-radius: 3px;
    cursor: default; transition: transform 0.1s; }
.qhf-cell:hover { transform: scale(1.3); }
.qb-divider { border-top: 1px solid #21262d; margin: 8px 0; }
.qb-two-col { display: grid; grid-template-columns: 1fr 1fr;
    gap: 16px; margin-top: 16px; }
.qb-card { background: #161b22; border: 1px solid #30363d;
    border-radius: 8px; padding: 16px; }
.qb-card h3 { margin: 0 0 12px; font-size: 1rem; }
.qb-card p { margin: 4px 0; font-size: 0.88rem; }
.qb-mono { font-family: monospace; font-size: 0.85rem; }
.qb-large-result { font-size: 1.2rem; font-weight: bold;
    margin-top: 16px; font-family: monospace; }
.qb-progress-track { background: #21262d; border-radius: 4px;
    height: 12px; margin-top: 10px; overflow: hidden; }
.qb-progress-fill { height: 100%; width: 0%;
    background: var(--green); border-radius: 4px;
    transition: none; }
.qb-progress-fill.bad { background: var(--red); }
.qb-status-text { margin-top: 10px; font-size: 0.9rem; }
.qb-interpret { margin-top: 16px; padding: 12px 16px;
    background: #161b22; border: 1px solid #30363d;
    border-radius: 6px; font-size: 0.88rem;
    color: var(--dim); font-style: italic; }
.mt-16 { margin-top: 16px; }

/* ── Receiver verification process panel ── */
.receiver-process-panel {
    margin-top: 18px;
    padding: 14px;
    background: #121820;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.receiver-process-panel h3 {
    font-family: var(--font-display);
    font-size: 18px;
    margin-bottom: 12px;
}

.process-card {
    background: #161b22;
    border: 1px solid #2a323a;
    border-radius: 8px;
    margin-bottom: 10px;
}

.process-toggle {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    text-align: left;
    padding: 10px 12px;
    font-family: var(--font-mono);
    font-size: 12px;
    cursor: pointer;
}

.process-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding: 0 12px;
}

.process-title {
    margin-top: 6px;
    font-weight: 700;
}

.process-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 0 10px;
}

.process-step {
    display: grid;
    grid-template-columns: 70px 1fr;
    gap: 10px;
    border-left: 3px solid var(--green);
    padding: 8px 8px 8px 10px;
    margin-bottom: 8px;
    background: #11161d;
    border-radius: 4px;
}

.process-step.failed {
    border-left-color: var(--red);
}

.process-step-num {
    font-family: var(--font-mono);
    color: var(--text-dim);
    font-size: 12px;
}

.process-step-body {
    font-size: 12px;
    line-height: 1.6;
}

.process-step-head {
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.process-hash {
    font-family: var(--font-mono);
    color: var(--cyan);
}

.process-ok {
    color: var(--green);
}

.process-warn {
    color: var(--red);
}

.process-verdict {
    margin-top: 6px;
    font-size: 16px;
    font-weight: 800;
    font-family: var(--font-display);
}

.process-verdict.ok {
    color: var(--green);
}

.process-verdict.bad {
    color: var(--red);
}

.process-subline {
    font-size: 12px;
    color: var(--text-secondary);
}

.receiver-citation {
    margin-top: 10px;
    font-size: 11px;
    color: var(--text-dim);
    font-style: italic;
}