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

:root {
    --bg: #1a1a2e;
    --surface: #16213e;
    --card: #0f3460;
    --accent: #e94560;
    --accent2: #f5a623;
    --text: #eaeaea;
    --muted: #9a9ab0;
    --radius: 12px;
    --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

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

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Header ── */
header {
    background: var(--surface);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid var(--accent);
}

header h1 { font-size: 1.6rem; letter-spacing: 1px; }
header h1 a { color: var(--accent2); }

nav { display: flex; gap: 1.5rem; }
nav a { color: var(--text); font-weight: 500; }
nav a:hover { color: var(--accent); text-decoration: none; }

/* ── Main ── */
main {
    flex: 1;
    padding: 2rem;
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
}

main.narrow { max-width: 560px; }

h2 { margin-bottom: 1rem; color: var(--accent2); }

/* ── Voting ── */
.tagline {
    text-align: center;
    font-size: 1.2rem;
    color: var(--muted);
    margin-bottom: 1.5rem;
}

.versus-wrap { text-align: center; }

.versus {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.critter-btn {
    background: var(--card);
    border: 3px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    padding: 0.75rem;
    transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    max-width: 380px;
    box-shadow: var(--shadow);
}

.critter-btn:hover {
    border-color: var(--accent);
    transform: scale(1.03);
    box-shadow: 0 8px 32px rgba(233,69,96,0.35);
}

.critter-btn img {
    width: 100%;
    max-width: 340px;
    height: 320px;
    object-fit: cover;
    border-radius: 8px;
    display: block;
}

.critter-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
}

.vs-badge {
    font-size: 2rem;
    font-weight: 900;
    color: var(--accent);
    text-shadow: 0 0 12px var(--accent);
    flex-shrink: 0;
}

/* ── Result ── */
.result-wrap {
    display: flex;
    gap: 2rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.result-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
    max-width: 340px;
    box-shadow: var(--shadow);
    position: relative;
}

.result-card img {
    width: 100%;
    height: 280px;
    object-fit: cover;
    border-radius: 8px;
}

.winner-card { border: 3px solid var(--accent2); }
.loser-card  { border: 3px solid #555; opacity: 0.7; }

.result-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-weight: 700;
    margin: 0.5rem 0;
    font-size: 0.9rem;
}

.winner-badge { background: var(--accent2); color: #111; }
.loser-badge  { background: #555; color: var(--text); }

.next-msg {
    text-align: center;
    font-size: 1.1rem;
    color: var(--muted);
    margin-top: 1rem;
}

/* ── Leaderboard ── */
.stat-line { color: var(--muted); margin-bottom: 1rem; }

.filter-bar {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.filter-btn {
    padding: 0.4rem 1rem;
    border-radius: 20px;
    background: var(--surface);
    color: var(--text);
    font-size: 0.9rem;
    border: 1px solid #333;
}

.filter-btn:hover, .filter-btn.active {
    background: var(--accent);
    color: #fff;
    text-decoration: none;
}

.leaderboard { display: flex; flex-direction: column; gap: 0.6rem; }

.lb-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--card);
    border-radius: var(--radius);
    padding: 0.6rem 1rem;
    box-shadow: var(--shadow);
}

.lb-rank {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent2);
    width: 2.5rem;
    flex-shrink: 0;
}

.lb-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.lb-info { flex: 1; }
.lb-info strong { display: block; }
.lb-info small { color: var(--muted); }

.lb-stats { text-align: right; }
.elo-score { font-size: 1.3rem; font-weight: 700; color: var(--accent); display: block; }
.lb-stats small { color: var(--muted); }

/* ── Upload / Cards ── */
.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
}

.success-card { border: 2px solid var(--accent2); }

label {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

input[type=text], input[type=password], input[type=file], select {
    background: var(--bg);
    color: var(--text);
    border: 1px solid #444;
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    width: 100%;
}

.req { color: var(--accent); }

.btn-primary {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.6rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}
.btn-primary:hover { opacity: 0.85; }

.error-msg  { color: var(--accent);  margin-bottom: 1rem; }
.success-msg { color: var(--accent2); margin-bottom: 1rem; }

.empty-state { text-align: center; padding: 3rem; color: var(--muted); font-size: 1.1rem; }

/* ── Admin ── */
.admin-stats {
    display: flex;
    gap: 2rem;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    color: var(--accent2);
    font-weight: 600;
}

.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.admin-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 0.75rem;
    text-align: center;
    box-shadow: var(--shadow);
}

.admin-card img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.admin-card p { font-size: 0.85rem; color: var(--muted); margin-bottom: 0.5rem; }
.admin-card p strong { color: var(--text); }

.admin-actions { display: flex; gap: 0.4rem; justify-content: center; }

.btn-approve, .btn-reject {
    padding: 0.3rem 0.8rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
}
.btn-approve { background: #2ecc71; color: #111; }
.btn-reject  { background: var(--accent); color: #fff; }

/* ── Footer ── */
footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--muted);
    font-size: 0.85rem;
    border-top: 1px solid #333;
}

/* ── Responsive ── */
@media (max-width: 640px) {
    .versus { flex-direction: column; gap: 1rem; }
    .vs-badge { transform: rotate(90deg); }
    .critter-btn img { height: 220px; }
    .result-wrap { flex-direction: column; align-items: center; }
    header { flex-direction: column; gap: 0.5rem; }
}
