:root {
    --bg: #0a0a0a;
    --paper: #f5f0e6;
    --paper-dark: #e8e0d0;
    --ink: #1a1a1a;
    --ink-light: #4a4a4a;
    --accent: #d63838;
    --accent-dim: #a82828;
    --mono: 'JetBrains Mono', 'Courier New', monospace;
    --serif: 'Instrument Serif', Georgia, serif;
    --receipt-width: 460px;
}

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

html { scroll-behavior: smooth; }

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

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(214, 56, 56, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(214, 56, 56, 0.04) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

#app {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px 80px;
}

/* ===== Landing ===== */
.hero {
    text-align: center;
    padding: 40px 0 30px;
}

.hero-tag {
    font-size: 11px;
    letter-spacing: 3px;
    color: var(--ink-light);
    opacity: 0.6;
    margin-bottom: 24px;
}

.hero h1 {
    font-family: var(--serif);
    font-size: clamp(38px, 7vw, 64px);
    font-weight: 400;
    line-height: 1.05;
    color: var(--paper);
    margin-bottom: 20px;
    letter-spacing: -1px;
}

.hero h1 br + * {
    color: var(--accent);
    font-style: italic;
}

.hero p {
    font-size: 15px;
    color: #999;
    max-width: 520px;
    margin: 0 auto 36px;
    line-height: 1.7;
}

.input-area {
    max-width: 600px;
    margin: 0 auto 24px;
}

#readme-input {
    width: 100%;
    background: #111;
    border: 1px solid #333;
    color: var(--paper);
    font-family: var(--mono);
    font-size: 13px;
    line-height: 1.6;
    padding: 16px;
    border-radius: 4px;
    resize: vertical;
    min-height: 160px;
    transition: border-color 0.2s;
}

#readme-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(214, 56, 56, 0.15);
}

#readme-input::placeholder {
    color: #555;
}

.input-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
    justify-content: center;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    border: none;
    font-family: var(--mono);
    font-size: 14px;
    font-weight: 700;
    padding: 14px 28px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.5px;
}

.btn-primary:hover {
    background: var(--accent-dim);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: transparent;
    color: var(--paper);
    border: 1px solid #333;
    font-family: var(--mono);
    font-size: 13px;
    padding: 14px 20px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.lang-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    margin-top: 12px;
    font-size: 13px;
}

.lang-btn {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-family: var(--mono);
    font-size: 13px;
    padding: 4px 8px;
    transition: color 0.2s;
}

.lang-btn.active {
    color: var(--accent);
    font-weight: 700;
}

.lang-btn:hover {
    color: var(--paper);
}

.lang-switch span {
    color: #444;
}

/* ===== How it works ===== */
.how-it-works {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 60px;
    flex-wrap: wrap;
}

.step {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: #777;
}

.step-num {
    color: var(--accent);
    font-weight: 700;
    font-size: 14px;
}

.step-arrow {
    color: #333;
    font-size: 16px;
}

/* ===== Loading ===== */
.loading-receipt {
    max-width: var(--receipt-width);
    margin: 80px auto;
    text-align: center;
}

.receipt-header {
    font-size: 14px;
    letter-spacing: 2px;
    color: var(--accent);
    margin-bottom: 30px;
}

.loading-dots {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 24px;
}

.loading-dots span {
    width: 10px;
    height: 10px;
    background: var(--accent);
    border-radius: 50%;
    animation: pulse 1.4s infinite ease-in-out;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes pulse {
    0%, 80%, 100% { opacity: 0.2; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1); }
}

.loading-text {
    font-size: 14px;
    color: var(--paper);
    margin-bottom: 8px;
}

.loading-text-sub {
    font-size: 12px;
    color: #666;
}

/* ===== Result / Receipt ===== */
.result-container {
    max-width: var(--receipt-width);
    margin: 0 auto;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.btn-back {
    background: none;
    border: none;
    color: var(--accent);
    font-family: var(--mono);
    font-size: 13px;
    cursor: pointer;
    padding: 0;
}

.btn-back:hover {
    text-decoration: underline;
}

.receipt-meta {
    font-size: 11px;
    color: #555;
    display: flex;
    gap: 12px;
}

/* Receipt card */
.receipt {
    background: var(--paper);
    color: var(--ink);
    padding: 32px 24px;
    font-family: var(--mono);
    font-size: 13px;
    line-height: 1.7;
    position: relative;
    box-shadow: 
        0 4px 30px rgba(0,0,0,0.5),
        0 0 0 1px rgba(0,0,0,0.1);
    border-radius: 2px;
}

/* Zigzag edges top/bottom */
.receipt::before,
.receipt::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 8px;
    background-size: 16px 16px;
    background-repeat: repeat-x;
    background-position: 0 0;
}

.receipt::before {
    top: -8px;
    background-image: linear-gradient(45deg, var(--bg) 50%, transparent 50%),
                      linear-gradient(-45deg, var(--bg) 50%, transparent 50%);
    background-position: 0 0, 8px 0;
}

.receipt::after {
    bottom: -8px;
    background-image: linear-gradient(45deg, transparent 50%, var(--bg) 50%),
                      linear-gradient(-45deg, transparent 50%, var(--bg) 50%);
    background-position: 0 0, 8px 0;
}

.receipt-top {
    text-align: center;
    margin-bottom: 8px;
}

.receipt-title {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 2px;
}

.receipt-store {
    font-size: 10px;
    letter-spacing: 1px;
    color: var(--ink-light);
    margin-top: 4px;
}

.receipt-divider {
    text-align: center;
    font-size: 10px;
    color: var(--ink-light);
    letter-spacing: 2px;
    margin: 16px 0;
    opacity: 0.5;
}

.receipt-divider-dashed {
    letter-spacing: 1px;
}

/* Archetype */
.archetype-section {
    text-align: center;
    padding: 8px 0;
}

.archetype-label {
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--ink-light);
    margin-bottom: 8px;
}

.archetype-value {
    font-family: var(--serif);
    font-size: 28px;
    font-style: italic;
    color: var(--accent);
    line-height: 1.2;
}

/* Metrics */
.metrics-section {
    padding: 8px 0;
}

.metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.metric-label {
    font-size: 10px;
    letter-spacing: 1px;
    color: var(--ink-light);
}

.metric-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--ink);
}

.metric-bar {
    height: 6px;
    background: rgba(0,0,0,0.08);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 12px;
}

.metric-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.8s ease-out;
    width: 0%;
}

.metric-fill.debt { background: var(--accent); }
.metric-fill.buzz { background: #c97a2a; }
.metric-fill.excuse { background: #b8b800; }
.metric-fill.effort { background: #2a8a2a; }

/* Roast lines */
.roast-lines {
    padding: 8px 0;
}

.section-label {
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--ink-light);
    margin-bottom: 10px;
}

.roast-line {
    font-size: 13px;
    line-height: 1.7;
    color: var(--ink);
    margin-bottom: 10px;
    padding-left: 16px;
    position: relative;
}

.roast-line::before {
    content: '>';
    position: absolute;
    left: 0;
    color: var(--accent);
    font-weight: 700;
}

/* Worst section */
.worst-section {
    padding: 8px 0;
}

.worst-section #worst-text {
    font-size: 14px;
    font-style: italic;
    color: var(--ink);
}

/* Compliment */
.compliment-section {
    padding: 8px 0;
}

.compliment-section #compliment-text {
    font-size: 14px;
    font-style: italic;
    color: var(--ink);
}

/* Verdict */
.verdict-section {
    text-align: center;
    padding: 12px 0;
}

.verdict-label {
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--ink-light);
    margin-bottom: 8px;
}

.verdict-value {
    font-family: var(--serif);
    font-size: 36px;
    font-style: italic;
    color: var(--accent);
}

/* Overall score */
.overall-score-section {
    text-align: center;
    padding: 8px 0;
}

.overall-label {
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--ink-light);
    margin-bottom: 8px;
}

.overall-score {
    font-family: var(--serif);
    font-size: 48px;
    color: var(--ink);
    line-height: 1;
}

.overall-score::after {
    content: '/100';
    font-size: 16px;
    color: var(--ink-light);
}

/* Footer */
.receipt-footer {
    text-align: center;
    font-size: 10px;
    color: var(--ink-light);
    padding: 8px 0;
}

/* Result actions */
.result-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    flex-wrap: wrap;
    justify-content: center;
}

.result-actions .btn-primary {
    flex: 1;
    min-width: 200px;
}

/* Upgrade section */
.upgrade-section {
    margin-top: 32px;
    padding: 24px;
    background: #111;
    border: 1px solid #333;
    border-radius: 8px;
}

.upgrade-section h2 {
    font-family: var(--serif);
    font-size: 24px;
    color: var(--accent);
    margin-bottom: 12px;
}

.upgrade-section p {
    font-size: 13px;
    color: #999;
    margin-bottom: 20px;
    line-height: 1.6;
}

.payment-info {
    margin-bottom: 20px;
}

.payment-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #222;
    font-size: 13px;
    gap: 12px;
}

.payment-value {
    color: var(--paper);
    font-weight: 500;
}

.wallet-addr {
    font-size: 11px;
    color: var(--accent);
}

.btn-copy-wallet {
    background: none;
    border: 1px solid #333;
    color: #888;
    font-family: var(--mono);
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 3px;
    cursor: pointer;
}

.btn-copy-wallet:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.payment-instructions {
    font-size: 12px;
    color: #777;
    line-height: 1.6;
    margin-bottom: 20px;
}

.qr-placeholder {
    text-align: center;
}

.qr-img {
    display: inline-block;
    width: 160px;
    height: 160px;
    background: #fff;
    border-radius: 4px;
    padding: 8px;
    margin-bottom: 8px;
}

.qr-label {
    font-size: 11px;
    color: #666;
}

/* Gallery link */
.gallery-link {
    text-align: center;
    margin-top: 60px;
    padding-top: 30px;
    border-top: 1px solid #1a1a1a;
}

.gallery-link a {
    color: #666;
    text-decoration: none;
    font-size: 13px;
    transition: color 0.2s;
}

.gallery-link a:hover {
    color: var(--accent);
}

.verify-btn-inline {
    display: block;
    width: 100%;
    padding: 12px;
    background: var(--accent);
    color: #fff;
    border: none;
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1px;
    border-radius: 2px;
    cursor: pointer;
    margin-top: 12px;
    transition: background 0.2s;
}

.verify-btn-inline:hover { background: var(--accent-dim); }
.verify-btn-inline:disabled { opacity: 0.5; cursor: wait; }

.verify-status-inline {
    text-align: center;
    font-size: 12px;
    margin-top: 8px;
    min-height: 16px;
}

.verify-status-inline.success { color: #2a8a2a; font-weight: 700; }
.verify-status-inline.pending { color: var(--accent); }
.verify-status-inline.error { color: #c93a3a; }

/* Utility */
.hidden {
    display: none !important;
}

/* Nav */
.site-nav {
    text-align: center;
    margin-top: 32px;
    font-size: 12px;
}

.site-nav a {
    color: #777;
    text-decoration: none;
    transition: color 0.2s;
}

.site-nav a:hover {
    color: var(--accent);
}

.site-nav .nav-sep {
    color: #333;
    margin: 0 8px;
}

/* Mobile */
@media (max-width: 600px) {
    #app {
        padding: 20px 12px 60px;
    }
    
    .hero h1 {
        font-size: 36px;
    }
    
    .receipt {
        padding: 24px 16px;
        font-size: 12px;
    }
    
    .archetype-value {
        font-size: 22px;
    }
    
    .verdict-value {
        font-size: 28px;
    }
    
    .overall-score {
        font-size: 36px;
    }
    
    .step-arrow {
        display: none;
    }
    
    .how-it-works {
        flex-direction: column;
        gap: 12px;
    }
    
    .input-actions {
        flex-direction: column;
    }
    
    .btn-primary, .btn-secondary {
        width: 100%;
    }
}
