@font-face {
    font-family: "VT323";
    src: url("/fonts/vt323/VT323-Regular.ttf") format("truetype");
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

:root {
    --terminal-text: #e8e4d9;
    --terminal-text-dim: #8a8780;
    --terminal-text-glow: #fffff0;
    --terminal-bg: #0a0a0a;
    --terminal-bg-light: #121212;
    --accent-green: #22c55e;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; }

body {
    font-family: "VT323", "Courier New", monospace;
    background: var(--terminal-bg);
    color: var(--terminal-text);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* CRT scanlines */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.15),
        rgba(0, 0, 0, 0.15) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    z-index: 1000;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(232, 228, 217, 0.008);
    pointer-events: none;
    z-index: 999;
}

.vignette {
    position: fixed;
    inset: 0;
    background: radial-gradient(
        ellipse at center,
        transparent 0%,
        transparent 60%,
        rgba(0, 0, 0, 0.45) 100%
    );
    pointer-events: none;
    z-index: 998;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1.5rem 3rem;
    position: relative;
    z-index: 1;
}

/* Header */
.ascii-header {
    text-align: center;
    font-size: 0.55rem;
    line-height: 1.2;
    white-space: pre;
    color: var(--terminal-text);
    text-shadow:
        0 0 10px var(--terminal-text-glow),
        0 0 20px rgba(232, 228, 217, 0.3);
    animation: glow 3s ease-in-out infinite alternate;
    margin-bottom: 1rem;
    overflow-x: auto;
}

@keyframes glow {
    from { text-shadow: 0 0 8px var(--terminal-text-glow), 0 0 15px rgba(232, 228, 217, 0.15); }
    to { text-shadow: 0 0 12px var(--terminal-text-glow), 0 0 25px rgba(232, 228, 217, 0.25); }
}

.tagline {
    text-align: center;
    font-size: 1.2rem;
    letter-spacing: 0.2em;
    color: var(--terminal-text-dim);
    margin-bottom: 2.5rem;
}

.tagline::before { content: "──── "; }
.tagline::after { content: " ────"; }

.back-link {
    display: inline-block;
    margin-bottom: 1.5rem;
    color: var(--terminal-text-dim);
    text-decoration: none;
    font-size: 1rem;
    letter-spacing: 0.05em;
    transition: all 0.2s ease;
}

.back-link:hover {
    color: var(--terminal-text-glow);
    text-shadow: 0 0 8px var(--terminal-text-glow);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 0;
}

.tab {
    font-family: inherit;
    font-size: 1.1rem;
    letter-spacing: 0.1em;
    background: transparent;
    color: var(--terminal-text-dim);
    border: 1px solid var(--terminal-text-dim);
    border-bottom: none;
    padding: 0.7rem 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
}

.tab:first-child { border-right: none; }

.tab.active {
    background: var(--terminal-bg-light);
    color: var(--terminal-text);
    border-color: var(--terminal-text-dim);
}

.tab:not(.active):hover {
    color: var(--terminal-text);
    background: rgba(232, 228, 217, 0.03);
}

.tab-panel {
    display: none;
    background: var(--terminal-bg-light);
    border: 1px solid var(--terminal-text-dim);
    padding: 1.5rem;
}

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

/* Controls */
.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.control-label {
    color: var(--terminal-text-dim);
    font-size: 1rem;
    letter-spacing: 0.05em;
}

.control-label::before {
    content: "$ ";
    color: var(--terminal-text);
}

select, input[type="number"], input[type="text"] {
    font-family: inherit;
    font-size: 1rem;
    background: var(--terminal-bg);
    color: var(--terminal-text);
    border: 1px solid var(--terminal-text-dim);
    padding: 0.5rem 0.75rem;
    outline: none;
    transition: border-color 0.2s ease;
}

select:focus, input:focus {
    border-color: var(--terminal-text);
    box-shadow: 0 0 8px rgba(232, 228, 217, 0.1);
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: var(--terminal-text-dim);
    outline: none;
    border-radius: 0;
    margin: 0.5rem 0;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: var(--terminal-text);
    cursor: pointer;
    border: none;
}

input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: var(--terminal-text);
    cursor: pointer;
    border: none;
    border-radius: 0;
}

.range-value {
    color: var(--terminal-text);
    font-size: 0.95rem;
    text-align: right;
}

/* Toggle switch */
.toggle-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
}

.toggle {
    position: relative;
    width: 40px;
    height: 20px;
    cursor: pointer;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-track {
    position: absolute;
    inset: 0;
    background: var(--terminal-bg);
    border: 1px solid var(--terminal-text-dim);
    transition: all 0.2s ease;
}

.toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background: var(--terminal-text-dim);
    transition: all 0.2s ease;
}

.toggle input:checked + .toggle-track {
    border-color: var(--accent-green);
}

.toggle input:checked + .toggle-track .toggle-thumb {
    left: 22px;
    background: var(--accent-green);
}

/* Drop zone */
.drop-zone {
    border: 2px dashed var(--terminal-text-dim);
    padding: 2.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 1.5rem;
    position: relative;
}

.drop-zone:hover, .drop-zone.drag-over {
    border-color: var(--terminal-text);
    background: rgba(232, 228, 217, 0.03);
    box-shadow: 0 0 20px rgba(232, 228, 217, 0.05);
}

.drop-zone-text {
    color: var(--terminal-text-dim);
    font-size: 1.1rem;
    line-height: 1.6;
}

.drop-zone-text strong {
    color: var(--terminal-text);
}

.drop-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.image-preview {
    display: none;
    margin-bottom: 1rem;
    text-align: center;
}

.image-preview img {
    max-width: 200px;
    max-height: 150px;
    border: 1px solid var(--terminal-text-dim);
    opacity: 0.8;
}

.image-preview .image-info {
    color: var(--terminal-text-dim);
    font-size: 0.95rem;
    margin-top: 0.4rem;
}

/* Buttons */
.btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.btn {
    font-family: inherit;
    font-size: 1rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: transparent;
    color: var(--terminal-text);
    border: 1px solid var(--terminal-text-dim);
    padding: 0.6rem 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn:hover, .btn:focus-visible {
    border-color: var(--terminal-text);
    color: var(--terminal-text-glow);
    box-shadow: 0 0 12px rgba(232, 228, 217, 0.15);
    outline: none;
}

.btn.primary {
    border-color: var(--accent-green);
    color: var(--accent-green);
}

.btn.primary:hover {
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.2);
    color: #4ade80;
    border-color: #4ade80;
}

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

.btn:disabled:hover {
    box-shadow: none;
    color: var(--terminal-text);
    border-color: var(--terminal-text-dim);
}

/* Output */
.output-wrapper {
    position: relative;
}

.output-label {
    color: var(--terminal-text-dim);
    font-size: 1rem;
    margin-bottom: 0.5rem;
    letter-spacing: 0.05em;
}

.output-label::before {
    content: "> ";
    color: var(--terminal-text);
    animation: blink 1s step-end infinite;
}

@keyframes blink { 50% { opacity: 0; } }

.ascii-output {
    background: var(--terminal-bg);
    border: 1px solid var(--terminal-text-dim);
    padding: 1rem;
    overflow: auto;
    max-height: 70vh;
    min-height: 200px;
    font-family: "Courier New", "Liberation Mono", monospace;
    font-size: 6px;
    line-height: 1.1;
    white-space: pre;
    color: var(--terminal-text);
    tab-size: 4;
}

.ascii-output.banner-output {
    font-size: 10px;
    line-height: 1.15;
}

.ascii-output .placeholder {
    color: var(--terminal-text-dim);
    font-family: "VT323", monospace;
    font-size: 1rem;
}

/* Text input for banner */
.banner-input {
    font-family: inherit;
    font-size: 1.2rem;
    background: var(--terminal-bg);
    color: var(--terminal-text);
    border: 1px solid var(--terminal-text-dim);
    padding: 0.75rem 1rem;
    width: 100%;
    outline: none;
    margin-bottom: 1rem;
    transition: border-color 0.2s ease;
}

.banner-input:focus {
    border-color: var(--terminal-text);
    box-shadow: 0 0 8px rgba(232, 228, 217, 0.1);
}

.banner-input::placeholder {
    color: var(--terminal-text-dim);
}

/* Export section */
.export-section {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--terminal-text-dim);
}

.export-label {
    color: var(--terminal-text-dim);
    font-size: 1rem;
    margin-bottom: 0.75rem;
    letter-spacing: 0.05em;
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--terminal-bg-light);
    border: 1px solid var(--accent-green);
    color: var(--accent-green);
    padding: 0.6rem 1.5rem;
    font-family: inherit;
    font-size: 1rem;
    letter-spacing: 0.08em;
    z-index: 3000;
    transition: transform 0.3s ease;
    pointer-events: none;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px dashed var(--terminal-text-dim);
    color: var(--terminal-text-dim);
    font-size: 1rem;
}

.footer a {
    color: var(--terminal-text);
    text-decoration: none;
    border-bottom: 1px dashed var(--terminal-text-dim);
    transition: all 0.2s ease;
}

.footer a:hover {
    color: var(--terminal-text-glow);
    border-bottom-color: var(--terminal-text);
    text-shadow: 0 0 8px var(--terminal-text-glow);
}

.footer-note {
    margin-top: 1.5rem;
    opacity: 0.5;
}

.prompt { color: var(--terminal-text-dim); }
.prompt-symbol { color: var(--terminal-text); }

/* Donations */
.donations {
    margin: 2rem 0;
    padding: 1.5rem;
    border: 1px solid rgba(0, 255, 65, 0.15);
    background: rgba(0, 0, 0, 0.3);
}

.status-header {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px dashed var(--terminal-text-dim);
}

.about-text {
    color: var(--terminal-text-dim);
    line-height: 1.5;
    font-size: 1.05rem;
}

.donate-address {
    margin: 1rem 0;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(0, 255, 65, 0.1);
    font-family: monospace;
    word-break: break-all;
    line-height: 1.8;
}

.btc-address {
    color: #ff9500;
    font-size: 0.85rem;
    letter-spacing: 0.02em;
    user-select: all;
}

.copy-btn {
    background: none;
    border: 1px solid rgba(0, 255, 65, 0.3);
    color: #00ff41;
    font-family: monospace;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0.15rem 0.4rem;
    margin-left: 0.5rem;
    transition: all 0.2s ease;
}

.copy-btn:hover {
    background: rgba(0, 255, 65, 0.1);
    border-color: rgba(0, 255, 65, 0.6);
}

/* Hidden canvas for export */
#export-canvas { display: none; }

/* Responsive */
@media (max-width: 600px) {
    .ascii-header { font-size: 0.35rem; }
    .tagline { font-size: 1rem; letter-spacing: 0.1em; }
    .tagline::before { content: "── "; }
    .tagline::after { content: " ──"; }
    .container { padding: 1rem; }
    .controls-grid { grid-template-columns: 1fr; }
    .tabs { flex-direction: column; }
    .tab { border-right: 1px solid var(--terminal-text-dim) !important; }
    .tab:first-child { border-bottom: none; }
    .btn-row { flex-direction: column; }
    .btn { width: 100%; text-align: center; }
}

::selection {
    background: var(--terminal-text);
    color: var(--terminal-bg);
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--terminal-bg); }
::-webkit-scrollbar-thumb { background: var(--terminal-text-dim); }
::-webkit-scrollbar-thumb:hover { background: var(--terminal-text); }
