:root {
    --bg: #050505;
    --panel: #0b0b0b;
    --panel-soft: #100707;
    --red: #ff3030;
    --red-dim: #7c1515;
    --orange: #ff7a1a;
    --green: #00ff73;
    --cyan: #00ccff;
    --white: #f4f4f4;
    --line: rgba(255, 48, 48, 0.46);
    --line-soft: rgba(255, 48, 48, 0.18);
    --font-main: "Courier New", Courier, monospace;
}

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

html,
body {
    min-height: 100%;
    background: var(--bg);
}

body {
    color: var(--red);
    font-family: var(--font-main);
    padding: 26px 18px 40px;
}

.terminal {
    width: min(1040px, 96vw);
    margin: 0 auto;
}

.command-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line-soft);
}

.ascii-logo {
    color: var(--red);
    font-size: clamp(0.45rem, 1.25vw, 0.88rem);
    line-height: 1.03;
    white-space: pre;
    text-shadow: 0 0 10px rgba(255, 48, 48, 0.36);
}

.how-it-works-container {
    flex: 0 0 auto;
}

.ascii-btn {
    border: 0;
    background: transparent;
    color: var(--red);
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    letter-spacing: 1px;
}

.ascii-btn:hover {
    color: var(--white);
}

.box-title {
    margin-bottom: 12px;
    color: var(--orange);
    font-size: 0.78rem;
    font-weight: bold;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.box-title::before {
    content: "> ";
    color: var(--red);
}

.label {
    display: block;
    margin-bottom: 7px;
    color: var(--red-dim);
    font-size: 0.7rem;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.contract-rail {
    margin-bottom: 16px;
}

.contract-rail .box-border,
.reactor-core .box-border,
.flow-lanes,
.burn-target,
.sacrifice-strip .box-border,
.history-streams .box-border {
    background: var(--panel);
    border: 1px solid var(--line-soft);
    border-left: 2px solid var(--line);
}

.contract-rail .box-border {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 16px;
    padding: 13px 15px;
}

.address-row {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.address {
    min-width: 0;
    color: var(--white);
    font-size: 0.9rem;
    overflow-wrap: anywhere;
}

.burn-deck {
    display: grid;
    grid-template-columns: 230px minmax(280px, 1fr) minmax(280px, 0.95fr);
    gap: 14px;
    margin-bottom: 14px;
}

.reactor-core .box-border,
.flow-lanes,
.burn-target {
    min-height: 250px;
    padding: 16px;
}

.reactor-core .box-border {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.countdown-container {
    text-align: left;
}

.timer {
    display: block;
    color: var(--white);
    font-size: clamp(2.6rem, 5vw, 4.2rem);
    font-weight: bold;
    line-height: 1;
    letter-spacing: 2px;
}

.progress-bar {
    width: 100%;
    height: 5px;
    background: #210707;
    overflow: hidden;
}

.progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--red), var(--orange));
    transition: width 0.1s linear;
}

.flow-lanes {
    display: grid;
    grid-template-rows: 1fr 1fr;
    gap: 12px;
    background: transparent;
    border: 0;
    padding: 0;
}

.lane {
    padding: 18px;
    background: var(--panel);
    border: 1px solid var(--line-soft);
    border-left: 2px solid var(--line);
}

.lane-wallet {
    border-left-color: rgba(255, 122, 26, 0.7);
}

.balance-mini-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    color: var(--white);
    font-size: clamp(1.25rem, 2vw, 1.7rem);
    font-weight: bold;
    line-height: 1.32;
}

.balance-mini-row small,
.coin-name-label,
.balance-value-mini small {
    color: var(--red);
    font-size: 0.74rem;
    font-weight: bold;
}

.burn-target {
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: var(--panel-soft);
}

.main-balance-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}

.balance-value {
    color: var(--white);
    font-size: clamp(2.4rem, 4.5vw, 4.2rem);
    font-weight: bold;
    line-height: 1.05;
    overflow-wrap: anywhere;
}

.balance-value-weth {
    color: var(--red);
    font-size: clamp(1.9rem, 3.4vw, 3rem);
    font-weight: bold;
    line-height: 1.05;
    overflow-wrap: anywhere;
}

.coin-name-label {
    font-size: clamp(0.9rem, 1.4vw, 1.25rem);
    color: var(--orange);
}

.weth-row {
    margin-top: 7px;
}

.usd-breakdown {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 18px 0 8px;
}

.usd-small,
.usd-value {
    display: inline-flex;
    width: max-content;
    padding: 4px 8px;
    background: #060606;
    color: var(--white);
    border-left: 2px solid var(--line);
    font-size: 0.8rem;
}

.usd-value {
    color: var(--green);
    border-left-color: var(--green);
}

.sacrifice-strip {
    margin-bottom: 14px;
}

.sacrifice-strip .box-border,
.history-streams .box-border {
    padding: 16px;
}

.stats-content {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.stat-item {
    padding: 14px;
    background: #070707;
    border-top: 1px solid var(--line-soft);
}

.balance-value-mini {
    color: var(--white);
    font-size: clamp(1.1rem, 2vw, 1.6rem);
    font-weight: bold;
    overflow-wrap: anywhere;
}

.green-text {
    color: var(--green) !important;
}

.dual-history-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.history-col {
    min-width: 0;
}

.log-container {
    height: 132px;
    overflow-y: auto;
    padding: 12px;
    background: #060606;
    border-left: 2px solid var(--line);
    text-align: left;
}

.small-log {
    font-size: 0.75rem;
}

.log-entry {
    margin-bottom: 7px;
    padding-left: 8px;
    border-left: 2px solid rgba(255, 48, 48, 0.36);
    color: var(--white);
    font-size: 0.72rem;
    line-height: 1.45;
}

.log-time {
    color: var(--red-dim);
    margin-right: 5px;
    font-weight: bold;
}

.log-action {
    color: var(--white);
    font-weight: bold;
    text-transform: uppercase;
}

.log-link,
.log-link-weth {
    color: var(--red);
    text-decoration: none;
}

.log-link-weth {
    color: var(--cyan);
}

.log-link:hover,
.log-link-weth:hover {
    color: var(--white);
    text-decoration: underline;
}

.dim {
    opacity: 0.55;
}

.copy-address-btn {
    position: relative;
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    border: 0;
    background: transparent;
    color: var(--red);
    cursor: pointer;
}

.copy-address-btn:hover {
    color: var(--white);
}

.copy-icon::before,
.copy-icon::after {
    content: "";
    position: absolute;
    width: 7px;
    height: 9px;
    border: 1px solid currentColor;
}

.copy-icon::before {
    top: 5px;
    left: 7px;
}

.copy-icon::after {
    top: 3px;
    left: 5px;
    background: var(--bg);
}

.copy-success {
    display: none;
    color: var(--green);
}

.copy-success::before {
    content: "";
    position: absolute;
    left: 5px;
    top: 2px;
    width: 6px;
    height: 11px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
}

.copy-address-btn.copied {
    color: var(--green);
}

.copy-address-btn.copied .copy-icon {
    display: none;
}

.copy-address-btn.copied .copy-success {
    display: block;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    inset: 0;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.76);
}

.modal-content {
    width: min(560px, 94vw);
    max-height: 88vh;
    overflow-y: auto;
    padding: 22px;
    color: var(--white);
    background: #000;
    border: 1px solid var(--line);
}

.modal-header {
    margin-bottom: 18px;
    color: var(--green);
    font-size: 12px;
    text-align: center;
}

.modal-body {
    line-height: 1.6;
}

.highlight {
    margin-bottom: 20px;
    color: var(--green);
    font-size: 14px;
}

.mechanic-step {
    margin-bottom: 15px;
    padding-left: 15px;
    border-left: 2px solid var(--line-soft);
}

.step-title {
    display: block;
    margin-bottom: 5px;
    color: var(--orange);
    font-weight: bold;
}

.specs-section {
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px dashed var(--line-soft);
}

.spec-line {
    margin: 5px 0;
    font-size: 13px;
}

.spec-line .label {
    display: inline;
    margin-right: 10px;
    color: var(--green);
}

.terminal-footer {
    margin-top: 30px;
    color: var(--red);
    font-weight: bold;
    letter-spacing: 2px;
    text-align: center;
}

#close-modal {
    display: block;
    margin: 20px auto 0;
}

@media (max-width: 980px) {
    .command-head,
    .contract-rail .box-border,
    .burn-deck,
    .stats-content,
    .dual-history-grid {
        grid-template-columns: 1fr;
    }

    .command-head {
        display: grid;
    }

    .address-row {
        justify-content: flex-start;
    }

    .reactor-core .box-border,
    .flow-lanes,
    .burn-target {
        min-height: auto;
    }
}

@media (max-width: 620px) {
    body {
        padding: 18px 10px 30px;
    }

    .terminal {
        width: 100%;
    }

    .ascii-logo {
        font-size: 0.46rem;
    }

    .modal-header {
        font-size: 9px;
    }
}
