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

:root{
    --bg:#0f172a;
    --surface:#1e293b;
    --surface-2:#334155;
    --text:#e2e8f0;
    --text-muted:#94a3b8;
    --accent:#f7931a;
    --accent-hover:#e67e22;
    --success:#34d399;
    --error:#ef4444;
    --border:#334155;
    --radius:12px;
    --radius-sm:8px;
    --shadow-card:0 1px 3px rgba(0,0,0,.3),0 1px 2px rgba(0,0,0,.2);
    --shadow-hover:0 4px 12px rgba(0,0,0,.4);
    --glow-focus:0 0 0 3px rgba(247,147,26,.25);
}

html{font-size:16px;-webkit-font-smoothing:antialiased}

body{
    font-family:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
    background:var(--bg);color:var(--text);
    min-height:100vh;display:flex;flex-direction:column;
}
body>main{flex:1}

a{color:var(--accent);transition:color .15s}
a:hover{color:var(--accent-hover)}

/* ── Nav ─────────────────────────────────────────────────────────────────── */

.nav{
    display:flex;align-items:center;gap:.75rem;
    padding:.75rem 2rem;border-bottom:1px solid var(--border);
    background:var(--surface);position:sticky;top:0;z-index:50;
}
.nav-brand{
    display:flex;align-items:center;gap:.5rem;
    font-size:1.25rem;font-weight:700;color:var(--accent);
    text-decoration:none;white-space:nowrap;
}
.nav-brand:hover{color:var(--accent-hover)}
.nav-tagline{display:none;font-size:.8rem;color:var(--text-muted)}
.nav-end{
    display:flex;align-items:center;gap:.4rem;
    margin-left:auto;
}
.nav-user{
    display:flex;align-items:center;gap:.35rem;
    color:var(--text-muted);text-decoration:none;font-size:.85rem;
    font-weight:500;padding:.3rem .6rem;border-radius:var(--radius-sm);
    transition:background .15s,color .15s;white-space:nowrap;
}
.nav-user:hover{background:var(--surface-2);color:var(--text)}

@media(min-width:640px){
    .nav-tagline{display:inline}
}

/* ── Container ───────────────────────────────────────────────────────────── */

.container{
    max-width:960px;margin:0 auto;padding:2rem 1.5rem;
    width:100%;
}

/* ── Card ────────────────────────────────────────────────────────────────── */

.card{
    background:var(--surface);border:1px solid var(--border);
    border-radius:var(--radius);padding:2rem;margin-bottom:1.5rem;
    box-shadow:var(--shadow-card);
}

/* ── Typography ──────────────────────────────────────────────────────────── */

h1{font-size:1.65rem;font-weight:700;margin-bottom:.5rem;letter-spacing:-.02em}
h2{font-size:1.25rem;font-weight:600;margin-bottom:.4rem}
.subtitle{color:var(--text-muted);margin-bottom:1.5rem;font-size:.95rem;line-height:1.5}
.text-center{text-align:center}
.text-muted{color:var(--text-muted)}

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.btn{
    display:inline-flex;align-items:center;justify-content:center;gap:.4rem;
    padding:.55rem 1.15rem;border-radius:var(--radius-sm);font-weight:600;
    font-size:.875rem;border:none;cursor:pointer;
    text-decoration:none;transition:all .15s;line-height:1.3;
    white-space:nowrap;
}
.btn-primary{background:var(--accent);color:#111827}
.btn-primary:hover{background:var(--accent-hover);transform:translateY(-1px);box-shadow:0 2px 8px rgba(247,147,26,.3)}
.btn-secondary{background:var(--surface-2);color:var(--text)}
.btn-secondary:hover{background:#475569;transform:translateY(-1px)}
.btn-ghost{background:transparent;color:var(--text-muted);padding:.3rem .6rem}
.btn-ghost:hover{background:var(--surface-2);color:var(--text)}
.btn-lg{padding:.85rem 2rem;font-size:1rem;width:100%;justify-content:center}
.btn-sm{padding:.3rem .7rem;font-size:.8rem}
.btn-xs{padding:.2rem .5rem;font-size:.75rem;border-radius:6px}

/* ── Alerts ──────────────────────────────────────────────────────────────── */

.alert{
    padding:.75rem 1rem;border-radius:var(--radius-sm);margin-bottom:1rem;
    font-size:.875rem;display:flex;align-items:center;gap:.5rem;
}
.alert-error{background:#450a0a;border:1px solid var(--error);color:#fca5a5}
.alert-info{background:#1e3a5f;border:1px solid #3b82f6;color:#93c5fd}

/* ── Forms ───────────────────────────────────────────────────────────────── */

.form-group{margin-bottom:1.25rem}
.form-group label{
    display:block;font-weight:600;margin-bottom:.35rem;font-size:.875rem;
}
.hint{display:block;font-size:.8rem;color:var(--text-muted);margin-top:.25rem;line-height:1.4}

.file-input{
    display:block;width:100%;
    background:var(--bg);border:1px solid var(--border);
    border-radius:var(--radius-sm);padding:.65rem .75rem;color:var(--text);
    font-size:.875rem;cursor:pointer;transition:border-color .15s;
}
.file-input:hover{border-color:var(--text-muted)}
.file-input:focus{outline:none;border-color:var(--accent);box-shadow:var(--glow-focus)}
.file-input::file-selector-button{
    background:var(--surface-2);color:var(--text);
    border:none;border-radius:6px;padding:.35rem .75rem;
    margin-right:.75rem;cursor:pointer;font-weight:500;
    transition:background .15s;
}
.file-input::file-selector-button:hover{background:#475569}

.text-input{
    width:100%;background:var(--bg);border:1px solid var(--border);
    border-radius:var(--radius-sm);padding:.65rem .9rem;
    font-size:.925rem;color:var(--text);transition:border-color .15s,box-shadow .15s;
}
.text-input:focus{outline:none;border-color:var(--accent);box-shadow:var(--glow-focus)}
.text-input::placeholder{color:#64748b}

.price-input-wrap{position:relative;display:flex;align-items:center}
.currency-sign{
    position:absolute;left:.9rem;font-weight:600;
    font-size:1.05rem;color:var(--text-muted);pointer-events:none;
}
.price-input{
    width:100%;background:var(--bg);border:1px solid var(--border);
    border-radius:var(--radius-sm);padding:.65rem .75rem .65rem 2.25rem;
    font-size:1.05rem;font-weight:600;color:var(--text);
    transition:border-color .15s,box-shadow .15s;
}
.price-input:focus{outline:none;border-color:var(--accent);box-shadow:var(--glow-focus)}
.price-input::placeholder{font-weight:400;color:#64748b}

/* ── Gallery ──────────────────────────────────────────────────────────────── */

.gallery-header{
    display:flex;justify-content:space-between;align-items:flex-start;
    margin-bottom:1.5rem;gap:.75rem;
}
.gallery-header h1{margin-bottom:0;font-size:1.5rem}
.gallery-header .subtitle{margin-bottom:0;font-size:.85rem}

.gallery-sort{
    display:flex;align-items:center;gap:.35rem;
    font-size:.8rem;color:var(--text-muted);white-space:nowrap;
}
.gallery-sort .sep{color:var(--border);user-select:none}
.gallery-sort a{
    display:inline-block;color:var(--text-muted);text-decoration:none;
    padding:.25rem .5rem;border-radius:6px;transition:all .15s;
}
.gallery-sort a:hover{background:var(--surface-2);color:var(--text)}
.gallery-sort a.active{background:var(--accent);color:#111827;font-weight:600}

.gallery-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(260px,1fr));
    gap:1rem;
    margin-bottom:1.5rem;
}
.gallery-card{
    background:var(--surface);border:1px solid var(--border);
    border-radius:var(--radius);padding:1.25rem;
    display:flex;flex-direction:column;
    transition:transform .15s,box-shadow .15s,border-color .15s;
    box-shadow:var(--shadow-card);cursor:pointer;
    text-decoration:none;color:inherit;
}
.gallery-card:hover{
    transform:translateY(-3px);box-shadow:var(--shadow-hover);
    border-color:var(--accent);
}
.gallery-card:active{transform:translateY(-1px)}
.gallery-card-top{
    display:flex;align-items:flex-start;justify-content:space-between;
    margin-bottom:.6rem;gap:.5rem;
}
.gallery-card-icon{
    font-size:1.8rem;line-height:1;flex-shrink:0;
}
.gallery-card-badge{
    font-size:.65rem;font-weight:600;text-transform:uppercase;
    background:var(--surface-2);color:var(--text-muted);
    padding:.15rem .5rem;border-radius:4px;white-space:nowrap;
    letter-spacing:.03em;
}
.gallery-card-title{
    font-weight:600;font-size:.925rem;margin-bottom:.25rem;
    overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
    color:var(--text);
}
.gallery-card-meta{
    color:var(--text-muted);font-size:.8rem;margin-bottom:.75rem;
    display:flex;flex-wrap:wrap;gap:.3rem .5rem;
}
.gallery-card-meta .author-link{color:var(--accent);font-weight:500}
.gallery-card-price{
    font-size:1.2rem;font-weight:700;color:var(--accent);
    margin-bottom:.15rem;font-variant-numeric:tabular-nums;
}
.gallery-card-usd{
    color:var(--text-muted);font-size:.8rem;margin-bottom:.75rem;
}
.gallery-card footer{
    margin-top:auto;padding-top:.75rem;
    border-top:1px solid var(--border);
}
.gallery-card .btn{width:100%}

/* ── Empty State ─────────────────────────────────────────────────────────── */

.empty-state{
    text-align:center;padding:4rem 1rem;color:var(--text-muted);
}
.empty-state .icon{font-size:3.5rem;margin-bottom:1rem;line-height:1}
.empty-state h2{color:var(--text);margin-bottom:.5rem}
.empty-state p{margin-bottom:1.25rem}

.gallery-empty{
    composes:empty-state;
}

/* ── Pagination ──────────────────────────────────────────────────────────── */

.pagination{
    display:flex;justify-content:center;align-items:center;
    gap:.35rem;margin:1.5rem 0;
}
.pagination a,.pagination span{
    padding:.4rem .7rem;border-radius:var(--radius-sm);font-size:.85rem;
    min-width:2rem;text-align:center;transition:all .15s;
}
.pagination a{background:var(--surface);color:var(--text);text-decoration:none;border:1px solid var(--border)}
.pagination a:hover{background:var(--surface-2);border-color:var(--text-muted)}
.pagination .current{background:var(--accent);color:#111827;font-weight:600;border:1px solid var(--accent)}

/* ── Auth Forms ──────────────────────────────────────────────────────────── */

.auth-wrap{
    display:flex;justify-content:center;padding:2rem 0;
}
.auth-card{
    max-width:420px;width:100%;text-align:center;
}
.auth-card .auth-icon{
    font-size:2.5rem;margin-bottom:.75rem;line-height:1;
}
.auth-card h1{margin-bottom:.35rem}
.auth-card .subtitle{margin-bottom:1.5rem;font-size:.875rem}
.auth-card .form-group{text-align:left}
.auth-card .btn-lg{margin-top:.25rem}
.auth-card .auth-divider{
    display:flex;align-items:center;gap:.75rem;margin:1.25rem 0;
    color:var(--text-muted);font-size:.8rem;
}
.auth-card .auth-divider::before,
.auth-card .auth-divider::after{
    content:'';flex:1;height:1px;background:var(--border);
}
.auth-card .auth-alt{
    margin-top:1rem;font-size:.85rem;color:var(--text-muted);
}
.auth-card .auth-alt a{font-weight:600}

/* ── Upload Form ─────────────────────────────────────────────────────────── */

.upload-card{max-width:640px;margin:0 auto}
.upload-card h1{margin-bottom:.25rem}
.upload-anon-notice{
    display:flex;align-items:center;gap:.5rem;
    background:var(--bg);border:1px solid var(--border);
    border-radius:var(--radius-sm);padding:.65rem .9rem;
    font-size:.85rem;color:var(--text-muted);margin-bottom:1.25rem;
}

.how-it-works{
    margin-top:2rem;padding-top:1.5rem;border-top:1px solid var(--border);
}
.how-it-works h3{
    font-size:.925rem;margin-bottom:.75rem;color:var(--text-muted);
    font-weight:600;
}
.how-it-works ol{
    display:flex;flex-direction:column;gap:.5rem;
    margin-left:1rem;list-style-position:outside;
}
.how-it-works li{
    font-size:.875rem;color:var(--text-muted);line-height:1.5;
    padding-left:.25rem;
}
.how-it-works li strong{color:var(--text)}

/* ── Profile ─────────────────────────────────────────────────────────────── */

.profile-header{
    text-align:center;margin-bottom:2rem;
}
.profile-avatar{
    width:64px;height:64px;border-radius:50%;background:var(--accent);
    display:flex;align-items:center;justify-content:center;
    margin:0 auto 1rem;font-size:1.5rem;font-weight:700;color:#111827;
    box-shadow:0 0 0 3px var(--surface),0 0 0 5px var(--accent);
}
.profile-header h1{font-size:1.5rem;margin-bottom:.2rem}
.profile-header .subtitle{font-size:.85rem;margin-bottom:0}
.profile-stats{
    display:flex;justify-content:center;gap:2rem;margin-top:1rem;
}
.profile-stat{text-align:center}
.profile-stat .num{font-size:1.2rem;font-weight:700;color:var(--text);font-variant-numeric:tabular-nums}
.profile-stat .label{font-size:.8rem;color:var(--text-muted);margin-top:.1rem}

/* ── Dashboard ───────────────────────────────────────────────────────────── */

.dashboard-header{
    display:flex;justify-content:space-between;align-items:center;
    margin-bottom:1.5rem;gap:.75rem;flex-wrap:wrap;
}
.dashboard-header h1{margin-bottom:0;font-size:1.5rem}
.dashboard-header .subtitle{margin-bottom:0;font-size:.85rem}

.dash-wrap{
    background:var(--surface);border:1px solid var(--border);
    border-radius:var(--radius);overflow:hidden;
    box-shadow:var(--shadow-card);
}
.dash-table{width:100%;border-collapse:collapse;font-size:.85rem}
.dash-table thead{background:var(--bg)}
.dash-table th{
    text-align:left;padding:.6rem .75rem .6rem 1.25rem;
    font-weight:600;font-size:.75rem;text-transform:uppercase;
    letter-spacing:.04em;color:var(--text-muted);border-bottom:1px solid var(--border);
    white-space:nowrap;
}
.dash-table td{
    padding:.65rem .75rem .65rem 1.25rem;
    border-bottom:1px solid var(--border);color:var(--text);
    vertical-align:middle;
}
.dash-table tr:last-child td{border-bottom:none}
.dash-table tr:hover td{background:rgba(255,255,255,.02)}
.dash-table .file-name{
    max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
    font-weight:500;
}
.dash-table .num{font-variant-numeric:tabular-nums}
.dash-table .actions{display:flex;gap:.35rem;align-items:center}

/* ── Error Pages ─────────────────────────────────────────────────────────── */

.error-wrap{
    display:flex;justify-content:center;align-items:center;
    min-height:50vh;padding:2rem;
}
.error-card{
    text-align:center;max-width:400px;
}
.error-card .icon{font-size:4rem;margin-bottom:1rem;line-height:1}
.error-card h1{font-size:3rem;margin-bottom:.25rem;font-weight:800}
.error-card .message{color:var(--text-muted);margin-bottom:1.5rem;font-size:1rem}
.error-card .btn-group{display:flex;gap:.5rem;justify-content:center;flex-wrap:wrap}

/* ── File Page (reused across templates) ─────────────────────────────────── */

.file-page{text-align:center}
.file-icon{font-size:3rem;text-align:center;margin-bottom:1rem;line-height:1}
.file-meta{
    display:flex;justify-content:center;gap:2rem;
    margin:1rem 0 1.5rem;color:var(--text-muted);font-size:.9rem;
    flex-wrap:wrap;
}
.pricing-box{
    background:var(--bg);border:1px solid var(--border);
    border-radius:var(--radius);padding:1.25rem;margin-bottom:1.5rem;
    text-align:center;
}
.price-btc{font-size:1.8rem;font-weight:700;color:var(--accent)}
.price-usd{font-size:.925rem;margin-top:.25rem}
.address-stats{
    display:grid;grid-template-columns:repeat(3,1fr);
    gap:1rem;margin:1.5rem 0;
}
.address-stats>div{text-align:center}
.stat-value{font-size:1.1rem;font-weight:600;color:var(--text)}
.stat-label{font-size:.8rem;color:var(--text-muted)}

/* ── Footer ──────────────────────────────────────────────────────────────── */

.footer{
    text-align:center;padding:1.5rem 2rem;color:var(--text-muted);
    font-size:.8rem;border-top:1px solid var(--border);line-height:1.8;
    margin-top:auto;
}
.footer a{color:#6b7280;text-decoration:none;transition:color .15s}
.footer a:hover{color:var(--accent)}
.footer .sep{color:var(--border);margin:0 .4rem;user-select:none}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media(max-width:768px){
    .container{padding:1.5rem 1rem}
    .nav{padding:.6rem 1rem}
    .gallery-grid{grid-template-columns:repeat(auto-fit,minmax(220px,1fr))}
    .profile-stats{gap:1.25rem}
    .address-stats{gap:.75rem}
}

@media(max-width:480px){
    .container{padding:1rem .75rem}
    .card{padding:1.25rem}
    h1{font-size:1.35rem}
    .gallery-grid{grid-template-columns:1fr}
    .profile-stats{flex-direction:column;gap:.5rem}
    .dash-table{font-size:.8rem}
    .dash-table th,.dash-table td{padding:.5rem .4rem .5rem .6rem}
    .dash-table .file-name{max-width:120px}
    .pagination{gap:.2rem}
    .pagination a,.pagination span{padding:.3rem .55rem;min-width:1.75rem;font-size:.8rem}
    .file-meta{flex-direction:column;align-items:center;gap:.5rem}
    .address-stats{grid-template-columns:1fr 1fr;gap:.5rem}
}