body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    margin: 0;
    background: #f5f5f5;
    color: #333;
}

header {
    background: #060450;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

header h1 {
    margin: 0;
}

nav a {
    margin-left: 15px;
    text-decoration: none;
    color: #ea2170;
    font-weight: bold;
}

main {
    max-width: 900px;
    margin: 20px auto;
    padding: 0 15px 30px;
}

#swipe-area {
    text-align: center;
}

#photo-container {
    position: relative;
    margin: 0 auto 15px;
    max-width: 500px;
    min-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

#swipe-card {
    width: 100%;
    max-width: 420px;
    height: 420px;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    position: relative;
    touch-action: none;
    user-select: none;
    transition: transform 0.25s ease-out;
    will-change: transform;
}

#swipe-card img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    pointer-events: none;
}

#loading {
    color: #777;
    margin-bottom: 10px;
}

#photo-meta {
    margin-top: 8px;
    font-size: 0.9rem;
    color: #555;
}

#controls {
    margin-top: 10px;
}

#controls button {
    margin: 0 10px;
    padding: 10px 18px;
    font-size: 1rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
}

/* Both vote buttons are positive now (every swipe is a like). The left
   button uses the KittySwipe pink, the right uses the existing green —
   visually distinct so the gesture still feels directional, but neither
   reads as a downvote. */
#btn-down {
    background: #ea2170;
    color: #fff;
}

#btn-up {
    background: #51cf66;
    color: #fff;
}

.hint {
    font-size: 0.85rem;
    color: #666;
}

.msg {
    padding: 10px 12px;
    border-radius: 4px;
    margin-bottom: 15px;
}

.msg.success {
    background: #d3f9d8;
    border: 1px solid #69db7c;
}

.msg.error {
    background: #ffe3e3;
    border: 1px solid #ff6b6b;
}

form label {
    display: block;
    margin-bottom: 10px;
}

form input[type="file"] {
    margin-top: 5px;
}

form button {
    padding: 8px 16px;
    border-radius: 4px;
    border: none;
    background: #4dabf7;
    color: #fff;
    cursor: pointer;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

th, td {
    padding: 8px 10px;
    border-bottom: 1px solid #eee;
    text-align: left;
}

th {
    background: #fafafa;
}

.thumb {
    max-width: 80px;
    max-height: 80px;
    border-radius: 4px;
}

.btn-approve {
    background: #51cf66;
    padding: 6px 10px;
    border-radius: 4px;
    color: white;
    text-decoration: none;
}

.btn-delete {
    background: #ff6b6b;
    padding: 6px 10px;
    border-radius: 4px;
    color: white;
    text-decoration: none;
}

/* ---------- Upload status panel ---------- */

#uploadStatus {
    display: none;
    text-align: center;
    padding: 40px 20px;
    max-width: 420px;
    margin: 30px auto 0;
}

#uploadStatus.is-visible {
    display: block;
    animation: uploader-fade-in 0.25s ease-out both;
}

@keyframes uploader-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
}

.uploader-spinner {
    position: relative;
    width: 72px;
    height: 72px;
    margin: 0 auto 18px;
}

/* Two concentric arcs that spin at different speeds — gives a nicer feel
   than a single ring. The outer arc uses the KittySwipe pink, the inner
   arc uses the navy header colour. */
.uploader-spinner::before,
.uploader-spinner::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    border-style: solid;
    border-color: transparent;
}
.uploader-spinner::before {
    inset: 0;
    border-width: 6px;
    border-top-color: #ea2170;
    border-right-color: #ea2170;
    animation: uploader-spin 0.9s linear infinite;
}
.uploader-spinner::after {
    inset: 12px;
    border-width: 4px;
    border-top-color: #060450;
    border-left-color: #060450;
    animation: uploader-spin 1.4s linear infinite reverse;
}
@keyframes uploader-spin {
    to { transform: rotate(360deg); }
}

.uploader-status-text {
    font-size: 1.05rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 14px;
    min-height: 1.4em;
}

.uploader-bar {
    position: relative;
    height: 10px;
    background: #eee;
    border-radius: 999px;
    overflow: hidden;
    max-width: 320px;
    margin: 0 auto;
}

.uploader-bar-fill {
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 0%;
    background: linear-gradient(90deg, #ea2170, #ff8ab3);
    border-radius: 999px;
    transition: width 0.25s ease-out;
}

/* Indeterminate mode: a stripe slides across the track. */
.uploader-bar.is-indeterminate .uploader-bar-fill {
    width: 35%;
    animation: uploader-indeterminate 1.4s ease-in-out infinite;
    transition: none;
}
@keyframes uploader-indeterminate {
    0%   { left: -35%; }
    100% { left: 100%; }
}

.uploader-percent {
    margin-top: 8px;
    font-size: 0.85rem;
    color: #888;
    min-height: 1.1em;
}

.uploader-hint {
    margin-top: 14px;
    font-size: 0.8rem;
    color: #999;
}

/* Honour reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
    .uploader-spinner::before,
    .uploader-spinner::after,
    .uploader-bar.is-indeterminate .uploader-bar-fill {
        animation: none;
    }
}

/* ---------- Mobile / narrow screens ---------- */

/* Tablet & smaller — keep the desktop layout but trim padding. */
@media (max-width: 800px) {
    main {
        margin-top: 12px;
        padding: 0 12px 24px;
    }
    header {
        padding: 8px 14px;
    }
}

/* Phone-sized screens. */
@media (max-width: 640px) {
    /* The header was a single flex row with a wide 200px logo and a nav on
       the right; on a narrow screen that pushes the nav off the side. Let
       it wrap and shrink the logo. */
    header {
        flex-wrap: wrap;
        gap: 6px 12px;
        padding: 8px 12px;
    }
    header h1 img {
        width: 140px !important;  /* overrides the inline width="200" */
        height: auto;
    }
    nav {
        display: flex;
        flex-wrap: wrap;
        gap: 4px 14px;
        width: 100%;
    }
    nav a {
        margin-left: 0;
        font-size: 0.95rem;
    }

    /* Swipe view — the fixed 420px card is too tall on small phones and
       pushed the vote buttons below the fold. Size the card by viewport
       height instead, and keep image aspect intact. */
    #photo-container {
        min-height: 0;
        max-width: 100%;
        margin-bottom: 10px;
    }
    #swipe-card {
        max-width: 100%;
        height: 62vh;
        max-height: 520px;
        border-radius: 10px;
    }
    #swipe-card img {
        object-fit: cover;
    }

    /* Vote buttons: bigger touch targets, side by side, full width. */
    #controls {
        display: flex;
        gap: 10px;
        padding: 0 8px;
    }
    #controls button {
        flex: 1 1 0;
        margin: 0;
        padding: 14px 0;
        font-size: 1rem;
    }
    .hint {
        text-align: center;
    }

    /* Upload form — fill the screen on mobile so the file picker isn't
       cramped, and make the submit button a real tap target. */
    form input[type="file"] {
        width: 100%;
        box-sizing: border-box;
    }
    form button {
        width: 100%;
        padding: 12px 16px;
        font-size: 1rem;
    }

    /* Tables (moderate/stats) — let them scroll horizontally instead of
       breaking the layout. */
    main table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .thumb {
        max-width: 56px;
        max-height: 56px;
    }

    /* Upload status panel slightly tighter on mobile. */
    #uploadStatus {
        padding: 28px 16px;
    }
    .uploader-spinner {
        width: 60px;
        height: 60px;
    }
}