:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a25;
    --accent-purple: #a855f7;
    --accent-pink: #ec4899;
    --accent-cyan: #22d3ee;
    --accent-orange: #f97316;
    --text-primary: #f4f4f5;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --border-color: #27272a;
    --glow-purple: rgba(168, 85, 247, 0.3);
    --glow-cyan: rgba(34, 211, 238, 0.3);
}

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

body {
    font-family: 'Space Grotesk', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Animated background grid */
.bg-grid {
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(168, 85, 247, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(168, 85, 247, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: 0;
}

.bg-gradient {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(168, 85, 247, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(236, 72, 153, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(34, 211, 238, 0.05) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

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

/* Header */
header {
    text-align: center;
    margin-bottom: 3rem;
}

.logo {
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(2rem, 6vw, 3.5rem);
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-pink), var(--accent-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

.tagline {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

.price-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, var(--accent-orange), #fbbf24);
    color: #000;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 0 30px rgba(249, 115, 22, 0.3);
}

.price-badge svg {
    width: 18px;
    height: 18px;
}

/* Main card */
.main-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.03),
        0 20px 50px -20px rgba(0, 0, 0, 0.5);
}

/* Input section */
.input-section {
    margin-bottom: 2rem;
}

.input-label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.input-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.prefix-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.prefix-static {
    position: absolute;
    left: 1rem;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-muted);
    font-size: 1rem;
    pointer-events: none;
    z-index: 2;
}

.prefix-input {
    width: 100%;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem 1rem 1rem 5.5rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.1rem;
    color: var(--text-primary);
    transition: all 0.2s;
}

.prefix-input:focus {
    outline: none;
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 4px var(--glow-purple);
}

.prefix-input::placeholder {
    color: var(--text-muted);
}

/* Position select */
.position-section {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.position-option {
    flex: 1;
    min-width: 120px;
}

.position-option input {
    display: none;
}

.position-option label {
    display: block;
    padding: 0.75rem 1rem;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    font-weight: 500;
}

.position-option input:checked + label {
    border-color: var(--accent-purple);
    background: rgba(168, 85, 247, 0.1);
    color: var(--accent-purple);
}

.position-option label:hover {
    border-color: var(--text-muted);
}

/* Difficulty indicator */
.difficulty-indicator {
    background: var(--bg-tertiary);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 2rem;
}

.difficulty-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.difficulty-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.difficulty-value {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
}

.difficulty-bar {
    height: 6px;
    background: var(--bg-primary);
    border-radius: 3px;
    overflow: hidden;
}

.difficulty-fill {
    height: 100%;
    border-radius: 3px;
    transition: all 0.3s;
    width: 0%;
}

.difficulty-easy { background: #22c55e; }
.difficulty-medium { background: #eab308; }
.difficulty-hard { background: #f97316; }
.difficulty-extreme { background: #ef4444; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-pink));
    color: white;
    width: 100%;
    box-shadow: 0 4px 20px var(--glow-purple);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--glow-purple);
}

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

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

.btn-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
    width: 100%;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.3);
}

/* Mining status */
.mining-status {
    display: none;
    margin-top: 2rem;
}

.mining-status.active {
    display: block;
}

.status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.status-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.pulse-dot {
    width: 10px;
    height: 10px;
    background: var(--accent-cyan);
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-box {
    background: var(--bg-primary);
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
}

.stat-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--accent-cyan);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.current-attempt {
    background: var(--bg-primary);
    border-radius: 10px;
    padding: 1rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--text-muted);
    word-break: break-all;
    margin-bottom: 1.5rem;
    max-height: 100px;
    overflow-y: auto;
}

/* Results */
.results-section {
    display: none;
    margin-top: 2rem;
}

.results-section.active {
    display: block;
}

.result-card {
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.1), rgba(168, 85, 247, 0.1));
    border: 1px solid var(--accent-cyan);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.result-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.result-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    word-break: break-all;
    background: var(--bg-primary);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    position: relative;
}

.result-value.nsec {
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.copy-btn:hover {
    color: var(--text-primary);
    background: var(--border-color);
}

.warning-box {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 10px;
    padding: 1rem;
    margin-top: 1rem;
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.warning-box svg {
    flex-shrink: 0;
    color: #ef4444;
}

.warning-box p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Payment modal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    max-width: 400px;
    width: 100%;
    text-align: center;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.modal-subtitle {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.lightning-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, var(--accent-orange), #fbbf24);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightning-icon svg {
    width: 40px;
    height: 40px;
    color: #000;
}

.qr-container {
    background: white;
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    display: none;
}

.qr-container.active {
    display: block;
}

.qr-container canvas {
    max-width: 100%;
    height: auto;
}

.invoice-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    word-break: break-all;
    background: var(--bg-primary);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    max-height: 80px;
    overflow-y: auto;
    text-align: left;
    display: none;
}

.invoice-text.active {
    display: block;
}

.modal-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.btn-lightning {
    background: linear-gradient(135deg, var(--accent-orange), #fbbf24);
    color: #000;
}

.btn-lightning:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(249, 115, 22, 0.3);
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.modal-close:hover {
    color: var(--text-primary);
}

/* Info section */
.info-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.info-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
}

.info-card h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.info-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 3rem;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

footer a {
    color: var(--accent-purple);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 600px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .position-section {
        flex-direction: column;
    }
}

/* Success animation */
@keyframes successPulse {
    0% { box-shadow: 0 0 0 0 rgba(34, 211, 238, 0.4); }
    70% { box-shadow: 0 0 0 20px rgba(34, 211, 238, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 211, 238, 0); }
}

.result-card.success {
    animation: successPulse 2s ease-out;
}

/* Thread count */
.thread-section {
    margin-bottom: 1.5rem;
}

.thread-slider {
    width: 100%;
    margin-top: 0.5rem;
    accent-color: var(--accent-purple);
}

.thread-display {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}
