:root {
    --bg-primary:   #0d1117;
    --bg-secondary: #161b22;
    --bg-card:      #1c2030;
    --border:       #2d3748;
    --accent:       #c8a84b;
    --accent-light: #d4b86a;
    --accent-dim:   rgba(200,168,75,0.12);
    --text:         #e6edf3;
    --text-muted:   #8b949e;
    --success:      #2ea043;
    --error-color:  #cf222e;
    --bitcoin:      #f7931a;
    --radius:       8px;
    --shadow:       0 4px 16px rgba(0,0,0,0.4);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, sans-serif;
    background: var(--bg-primary);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    font-size: 15px;
}

/* ── NAVBAR ─────────────────────────────────── */
.navbar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    height: 62px;
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 1rem;
}
.navbar-brand {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}
.navbar-brand svg { flex-shrink: 0; }
.navbar-nav {
    margin-left: auto;
    display: flex;
    gap: 0.25rem;
}
.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.45rem 0.9rem;
    border-radius: var(--radius);
    transition: all 0.18s;
    font-size: 0.9rem;
    font-weight: 500;
}
.nav-link:hover { color: var(--text); background: var(--bg-card); }
.nav-link.active { color: var(--accent); background: var(--accent-dim); }

/* ── CONTAINER ──────────────────────────────── */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* ── PAGE HEADER ────────────────────────────── */
.page-header { margin-bottom: 2rem; }
.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.3rem;
    letter-spacing: -0.02em;
}
.page-subtitle { color: var(--text-muted); font-size: 0.9rem; }

/* ── CARDS ──────────────────────────────────── */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow);
}
.card-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.card-title::before {
    content: "";
    display: inline-block;
    width: 3px;
    height: 14px;
    background: var(--accent);
    border-radius: 2px;
}

/* ── FORM ───────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }

label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea {
    width: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.625rem 0.875rem;
    color: var(--text);
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.18s, box-shadow 0.18s;
}
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(200,168,75,0.15);
}
input::placeholder { color: var(--text-muted); opacity: 0.6; }

/* ── PARTICIPANTS ────────────────────────────── */
.participants-list { display: flex; flex-direction: column; gap: 0.5rem; }

.participant-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.participant-row input { flex: 1; }

.btn-remove {
    background: transparent;
    border: 1px solid rgba(207,34,46,0.4);
    color: #f85149;
    border-radius: var(--radius);
    padding: 0 0.75rem;
    height: 40px;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    transition: all 0.18s;
    flex-shrink: 0;
}
.btn-remove:hover {
    background: rgba(207,34,46,0.15);
    border-color: #f85149;
}

.btn-add {
    background: transparent;
    border: 1px dashed var(--border);
    color: var(--text-muted);
    border-radius: var(--radius);
    padding: 0.55rem 1rem;
    cursor: pointer;
    width: 100%;
    font-size: 0.875rem;
    font-family: inherit;
    transition: all 0.18s;
    margin-top: 0.25rem;
}
.btn-add:hover { border-color: var(--accent); color: var(--accent); }

/* ── BUTTONS ────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.65rem 1.4rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.18s;
    text-decoration: none;
    font-family: inherit;
    white-space: nowrap;
}
.btn-primary {
    background: var(--accent);
    color: #0d1117;
    border-color: var(--accent);
}
.btn-primary:hover {
    background: var(--accent-light);
    border-color: var(--accent-light);
    box-shadow: 0 4px 14px rgba(200,168,75,0.35);
    transform: translateY(-1px);
}
.btn-secondary {
    background: var(--bg-card);
    color: var(--text);
    border-color: var(--border);
}
.btn-secondary:hover { background: var(--border); }
.btn-outline {
    background: transparent;
    color: var(--accent);
    border-color: var(--accent);
}
.btn-outline:hover { background: var(--accent-dim); }
.btn-sm { padding: 0.35rem 0.8rem; font-size: 0.8rem; }
.btn-lg { padding: 0.875rem 2rem; font-size: 1rem; }
.btn-full { width: 100%; }

/* ── ALERTS ─────────────────────────────────── */
.alert {
    padding: 0.875rem 1.1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
    line-height: 1.5;
}
.alert-error {
    background: rgba(207,34,46,0.1);
    border: 1px solid rgba(207,34,46,0.35);
    color: #f85149;
}
.alert-info {
    background: var(--accent-dim);
    border: 1px solid rgba(200,168,75,0.3);
    color: var(--accent-light);
}
.alert-success {
    background: rgba(46,160,67,0.1);
    border: 1px solid rgba(46,160,67,0.3);
    color: #3fb950;
}

/* ── INFO BOX ───────────────────────────────── */
.info-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--bitcoin);
    border-radius: var(--radius);
    padding: 0.875rem 1.1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
    line-height: 1.6;
}
.info-box strong { color: var(--bitcoin); }

/* ── LOADING SPINNER ────────────────────────── */
.loading {
    display: none;
    text-align: center;
    padding: 1.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}
.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
    margin: 0 auto 0.75rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── TABLE ──────────────────────────────────── */
.table-responsive { overflow-x: auto; border-radius: var(--radius); }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
thead { background: var(--bg-card); }
th {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
td {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid rgba(45,55,72,0.6);
    vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(255,255,255,0.02); }
.td-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }

/* ── BADGES ─────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    white-space: nowrap;
}
.badge-bitcoin {
    background: rgba(247,147,26,0.15);
    color: var(--bitcoin);
    border: 1px solid rgba(247,147,26,0.3);
}
.badge-winner {
    background: rgba(46,160,67,0.15);
    color: #3fb950;
    border: 1px solid rgba(46,160,67,0.3);
}

/* ── WINNER BOX ─────────────────────────────── */
.winner-box {
    background: linear-gradient(135deg, rgba(200,168,75,0.15), rgba(200,168,75,0.04));
    border: 2px solid var(--accent);
    border-radius: var(--radius);
    padding: 2.25rem 1.5rem;
    text-align: center;
    margin: 0.5rem 0;
}
.winner-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--accent);
    margin-bottom: 0.6rem;
    font-weight: 700;
}
.winner-name {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.2;
    letter-spacing: -0.02em;
}
.winner-index {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ── CODE BLOCK ─────────────────────────────── */
.code-block {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    font-family: SFMono-Regular, Cascadia Code, Fira Mono, Consolas, monospace;
    font-size: 0.78rem;
    color: var(--accent);
    word-break: break-all;
    overflow-x: auto;
    margin: 0.4rem 0;
    line-height: 1.5;
}

/* ── BITCOIN INFO GRID ──────────────────────── */
.bitcoin-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
    margin: 0.75rem 0;
}
.bitcoin-stat {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.875rem 1rem;
}
.bitcoin-stat-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.3rem;
    font-weight: 600;
}
.bitcoin-stat-value {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--bitcoin);
    word-break: break-all;
}

/* ── STEP LIST ──────────────────────────────── */
.step-list { list-style: none; counter-reset: steps; }
.step-list li {
    counter-increment: steps;
    display: flex;
    gap: 0.875rem;
    margin-bottom: 1rem;
    align-items: flex-start;
}
.step-list li::before {
    content: counter(steps);
    min-width: 26px;
    height: 26px;
    background: var(--accent);
    color: #0d1117;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 1px;
}
.step-content { flex: 1; }
.step-label {
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.3rem;
    color: var(--text);
}
.step-desc { font-size: 0.85rem; color: var(--text-muted); }

/* ── PARTICIPANTS SORTED ────────────────────── */
.participants-sorted {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 0.5rem;
    margin: 0.75rem 0;
}
.participant-chip {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.5rem 0.875rem;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.participant-chip.winner {
    border-color: var(--accent);
    background: var(--accent-dim);
    color: var(--accent);
    font-weight: 600;
}
.participant-num {
    font-size: 0.7rem;
    color: var(--text-muted);
    min-width: 18px;
    font-weight: 600;
}
.participant-chip.winner .participant-num { color: var(--accent); opacity: 0.7; }

/* ── VERIFY INSTRUCTIONS ────────────────────── */
.verify-steps {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
    font-size: 0.85rem;
    line-height: 1.7;
    color: var(--text-muted);
}
.verify-steps ol { padding-left: 1.25rem; }
.verify-steps li { margin-bottom: 0.4rem; }
.verify-steps code {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.1rem 0.4rem;
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--accent);
    word-break: break-all;
}
.verify-url {
    margin-top: 0.875rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-muted);
}
.verify-url a { color: var(--accent); }

/* ── ACTIONS ROW ─────────────────────────────── */
.actions-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

/* ── EMPTY STATE ────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}
.empty-state svg {
    width: 56px;
    height: 56px;
    opacity: 0.25;
    margin-bottom: 1rem;
}
.empty-state p { font-size: 0.9rem; }

/* ── FOOTER ─────────────────────────────────── */
footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.78rem;
    padding: 1.75rem 1.5rem;
    border-top: 1px solid var(--border);
    margin-top: 3rem;
}

/* ── DETAIL GRID ────────────────────────────── */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.875rem 2rem;
    margin-bottom: 0.5rem;
}
.detail-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    margin-bottom: 0.2rem;
}
.detail-value { font-size: 0.95rem; font-weight: 500; }

/* ── RESPONSIVE ─────────────────────────────── */
@media (max-width: 640px) {
    .navbar { padding: 0 1rem; }
    .container { padding: 1.25rem 1rem; }
    .page-title { font-size: 1.4rem; }
    .winner-name { font-size: 1.75rem; }
    .detail-grid { grid-template-columns: 1fr; }
    .bitcoin-info { grid-template-columns: 1fr 1fr; }
    th, td { padding: 0.6rem 0.75rem; }
    .card { padding: 1.1rem; }
    .btn { padding: 0.6rem 1.1rem; }
}
@media (max-width: 400px) {
    .bitcoin-info { grid-template-columns: 1fr; }
    .participants-sorted { grid-template-columns: 1fr; }
}
