:root {
    --bg: #100909;
    --panel: #1a1010;
    --panel2: #261414;
    --text: #ffe7d8;
    --muted: #d6a38b;
    --accent: #ff5c1a;
    --accent2: #ffb347;
    --border: #6a2c1c;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    --maxw: 1320px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(255, 92, 26, 0.14), transparent 28%),
        radial-gradient(circle at top right, rgba(255, 179, 71, 0.10), transparent 24%),
        linear-gradient(180deg, #0c0707 0%, #1a0c0c 100%);
    color: var(--text);
}

.page-shell {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 18px;
}

.site-header {
    text-align: center;
    padding: 20px 16px;
    margin-bottom: 18px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: linear-gradient(90deg, #2c1311, #451815, #2c1311);
    box-shadow: var(--shadow);
}

.site-header h1 {
    margin: 0;
    font-size: clamp(1.8rem, 4vw, 3rem);
    outline: none;
}

.subhead {
    margin-top: 10px;
    color: var(--muted);
}

.upload-panel,
.toolbar,
.pager,
.side-panel {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: linear-gradient(180deg, var(--panel), var(--panel2));
    box-shadow: var(--shadow);
}

.upload-panel {
    padding: 16px;
    margin-top: 0;
    margin-bottom: 0;
}

.upload-panel h2,
.side-panel h2 {
    margin-top: 0;
    color: #ffd5c2;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

label {
    font-weight: bold;
    color: #ffd0ba;
}

input[type="text"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    background: #120a09;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
}

textarea {
    resize: vertical;
    min-height: 160px;
}

.form-actions {
    display: flex;
    gap: 10px;
}

button {
    appearance: none;
    border: none;
    border-radius: 8px;
    padding: 10px 18px;
    font-weight: bold;
    cursor: pointer;
    background: linear-gradient(90deg, #ff5c1a, #ff7c2b);
    color: white;
}

button:hover {
    filter: brightness(1.08);
}

button.active {
    outline: 2px solid var(--accent2);
}

.status-message {
    margin-top: 12px;
    min-height: 22px;
    color: var(--accent2);
    font-weight: bold;
}

.toolbar {
    display: flex;
    gap: 10px;
    padding: 12px;
    margin-bottom: 18px;
    align-items: center;
    flex-wrap: wrap;
}

.toolbar select {
    max-width: 260px;
}

.toolbar input[type="text"] {
    width: 240px;
    max-width: 100%;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.card {
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background: linear-gradient(180deg, #1b1111, #120b0b);
    box-shadow: var(--shadow);
    transition: transform 0.15s ease, box-shadow 0.15s ease, outline 0.15s ease;
}

.card-highlight {
    outline: 3px solid var(--accent2);
    transform: translateY(-2px);
    box-shadow: 0 0 0 3px rgba(255, 179, 71, 0.15), var(--shadow);
}

.card img {
    display: block;
    width: 100%;
    height: 260px;
    object-fit: cover;
    background: #000;
}

.card-body {
    padding: 12px;
}

.card-title {
    margin: 0 0 8px 0;
    color: #ffd5c2;
    line-height: 1.3;
}

.card-meta {
    font-size: 0.88rem;
    color: var(--muted);
    margin-bottom: 12px;
}

.card-actions {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.heat-pill {
    display: inline-block;
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(255, 92, 26, 0.16);
    color: #ffd7c6;
    font-weight: bold;
}

.card-actions button {
    flex: 1;
    min-width: 90px;
}

.pager {
    margin-top: 20px;
    padding: 12px;
    display: flex;
    justify-content: center;
    gap: 14px;
    align-items: center;
}

.lower-panels {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 20px;
    margin-bottom: 18px;
}

.side-panel {
    padding: 16px;
    min-height: 100%;
}

.side-panel-body {
    color: var(--muted);
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    border: 1px dashed rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 16px;
}

.leaderboard-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.leaderboard-empty {
    color: var(--muted);
    border: 1px dashed rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 16px;
    text-align: center;
}

.leaderboard-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.02);
}

.leaderboard-rank {
    font-weight: bold;
    color: var(--accent2);
    min-width: 32px;
}

.leaderboard-main {
    flex: 1;
}

.leaderboard-gym {
    font-weight: bold;
    color: #ffd5c2;
    line-height: 1.3;
    margin-bottom: 4px;
}

.leaderboard-sub {
    font-size: 0.85rem;
    color: var(--muted);
}

.leaderboard-heat {
    font-weight: bold;
    color: #ffd7c6;
    white-space: nowrap;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 30px 20px;
    border: 1px dashed var(--border);
    border-radius: 12px;
    color: var(--muted);
}

@media (max-width: 900px) {
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }

    .lower-panels {
        grid-template-columns: 1fr;
    }

    .card img {
        height: 230px;
    }
}

@media (max-width: 640px) {
    .page-shell {
        padding: 12px;
    }

    .grid-3 {
        grid-template-columns: 1fr;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar select,
    .toolbar input[type="text"] {
        max-width: 100%;
        width: 100%;
    }

    .lower-panels {
        grid-template-columns: 1fr;
    }

    .card img {
        height: 280px;
    }
}