/* Variables */
:root {
    --primary: #ff6b9d;
    --primary-dark: #e85a8a;
    --primary-light: #ffb3c6;
    --secondary: #ffd93d;
    --accent: #ff8fab; /* Soft pink instead of green */
    --bg-light: #fff5f8;
    --bg-card: #ffffff;
    --text-dark: #2d3436;
    --text-light: #636e72;
    --shadow: rgba(255, 107, 157, 0.2);
    --gold: #ffd700;
    --silver: #c0c0c0;
    --bronze: #cd7f32;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Nunito', sans-serif;
    background: linear-gradient(135deg, var(--bg-light) 0%, #ffe4ec 100%);
    min-height: 100vh;
    color: var(--text-dark);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    padding: 30px 0;
}

header h1 {
    font-family: 'Press Start 2P', monospace;
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary) 0%, #ff8fab 50%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    line-height: 1.6;
    text-shadow: 2px 2px 0 rgba(0,0,0,0.1);
}

.subtitle {
    color: var(--text-light);
    font-size: 1.1rem;
}

/* Paused/Maintenance Banner */
.paused-banner {
    display: none; /* Shown via JS when CONFIG.REPORTS_PAUSED is true */
    align-items: center;
    gap: 16px;
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border: 3px solid #f0c040;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(240, 192, 64, 0.3);
}

.paused-banner-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.paused-banner-text strong {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.7rem;
    color: #856404;
    display: block;
    margin-bottom: 6px;
}

.paused-banner-text p {
    color: #856404;
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0;
}

/* Disabled form states */
.chat-input input:disabled,
.chat-input button:disabled,
.request-form input:disabled,
.request-form button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.chat-input button:disabled {
    background: #ccc;
    border-color: #999;
}

.request-form button:disabled {
    background: #ccc;
    border-color: #999;
}

/* Main Layout */
main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-top: 20px;
}

@media (max-width: 900px) {
    main {
        grid-template-columns: 1fr;
    }
}

/* Section Base */
section {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 4px 0 rgba(0,0,0,0.1);
    border: 3px solid #333;
}

section h2 {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    text-transform: uppercase;
}

section h2::before {
    content: '[>]';
    font-family: 'Press Start 2P', monospace;
    font-size: 0.7em;
}

/* Leaderboard */
.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pet-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: linear-gradient(135deg, #fafafa 0%, #f5f5f5 100%);
    border-radius: 4px;
    border: 2px solid #555;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.pet-card:hover {
    transform: translateX(8px);
    box-shadow: 0 8px 24px var(--shadow);
}

.pet-card.rank-1 {
    background: linear-gradient(135deg, #fff9e6 0%, #fff3cd 100%);
    border: 2px solid var(--gold);
}

.pet-card.rank-2 {
    background: linear-gradient(135deg, #f8f8f8 0%, #e8e8e8 100%);
    border: 2px solid var(--silver);
}

.pet-card.rank-3 {
    background: linear-gradient(135deg, #fff5eb 0%, #ffe8d6 100%);
    border: 2px solid var(--bronze);
}

.rank-badge {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Press Start 2P', monospace;
    font-weight: 800;
    font-size: 0.9rem;
    flex-shrink: 0;
    border: 2px solid #333;
}

.rank-1 .rank-badge {
    background: var(--gold);
    color: #8b6914;
}

.rank-2 .rank-badge {
    background: var(--silver);
    color: #555;
}

.rank-3 .rank-badge {
    background: var(--bronze);
    color: #5a3d1e;
}

.pet-card:not(.rank-1):not(.rank-2):not(.rank-3) .rank-badge {
    background: var(--bg-light);
    color: var(--text-light);
}

.pet-avatar {
    width: 60px;
    height: 60px;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #fff5f8 0%, #ffe4ec 100%);
    flex-shrink: 0;
    border: 2px solid #555;
}

.pet-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pet-emoji, .pet-emoji-fallback, .pet-pixel-fallback {
    font-size: 2.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Pixel fallback for pets without images */
.pet-pixel-fallback {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary) 0%, #ff8fab 100%);
    position: relative;
}

.pet-pixel-fallback::before {
    content: '?';
    font-family: 'Press Start 2P', monospace;
    font-size: 1.2rem;
    color: white;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.pet-info {
    flex: 1;
}

.pet-name {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-dark);
}

.pet-type {
    font-size: 0.85rem;
    color: var(--text-light);
    text-transform: capitalize;
}

.pet-score {
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--primary);
}

.last-updated {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 16px;
}

/* Chat */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 500px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f0f0f0;
    border-radius: 4px;
    border: 2px solid #555;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message {
    display: flex;
    gap: 12px;
    max-width: 85%;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message .avatar,
.message .pixel-avatar {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
    border: 2px solid #333;
}

/* Pixel Avatar Styles */
.pixel-avatar {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    position: relative;
    image-rendering: pixelated;
}

.pixel-avatar.addy-avatar {
    background: linear-gradient(135deg, var(--primary) 0%, #ff8fab 100%);
    border: 2px solid #333;
}

.pixel-avatar.addy-avatar::before {
    content: 'A';
    font-family: 'Press Start 2P', monospace;
    font-size: 1rem;
    color: white;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.pixel-avatar.user-avatar {
    background: linear-gradient(135deg, var(--accent) 0%, #ffc2d1 100%);
    border: 2px solid #333;
}

.pixel-avatar.user-avatar::before {
    content: 'U';
    font-family: 'Press Start 2P', monospace;
    font-size: 1rem;
    color: white;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.message.addy .avatar {
    background: linear-gradient(135deg, var(--primary) 0%, #ff8fab 100%);
}

.message.user .avatar {
    background: linear-gradient(135deg, var(--accent) 0%, #ffc2d1 100%);
}

.message .bubble {
    padding: 12px 16px;
    border-radius: 4px;
    line-height: 1.5;
    border: 2px solid #555;
}

.message.addy .bubble {
    background: white;
    border: 2px solid #555;
    border-bottom-left-radius: 0;
}

.message.user .bubble {
    background: linear-gradient(135deg, var(--accent) 0%, #ffc2d1 100%);
    color: white;
    border: 2px solid #333;
    border-bottom-right-radius: 0;
}

/* Chat Input */
.chat-input {
    display: flex;
    gap: 12px;
}

.chat-input input {
    flex: 1;
    padding: 14px 20px;
    border: 3px solid #333;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
}

.chat-input input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--shadow);
}

.chat-input button {
    padding: 14px 28px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: 3px solid #333;
    border-radius: 4px;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
}

.chat-input button:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 24px var(--shadow);
}

.chat-input button:active {
    transform: scale(0.98);
}

/* Input Info Container */
.input-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    margin-top: 5px;
    font-size: 0.8rem;
    color: var(--text-light);
    font-family: 'Nunito', sans-serif;
    opacity: 0.8;
}

/* Character Counter */
.char-counter {
    font-size: 0.75rem;
}

.char-counter.warning {
    color: #f59e0b;
    font-weight: 600;
}

.char-counter.limit {
    color: #ef4444;
    font-weight: 700;
}

/* Report Counter */
.report-counter {
    font-size: 0.75rem;
}

.report-counter.low {
    color: var(--primary);
    font-weight: 700;
    animation: pulse-warning 1.5s ease-in-out infinite;
}

.report-counter.cooldown {
    color: #f59e0b;
    font-weight: 700;
    animation: pulse-warning 1s ease-in-out infinite;
}

@keyframes pulse-warning {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

/* Footer */
footer {
    text-align: center;
    padding: 30px 0;
    color: var(--text-light);
    font-size: 0.9rem;
}

footer p::before {
    content: '< ';
    font-family: 'Press Start 2P', monospace;
}

footer p::after {
    content: ' >';
    font-family: 'Press Start 2P', monospace;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-light);
}

/* Scrollbar */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* Live Indicator */
.live-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--accent);
    margin-top: 16px;
}

.pulse {
    width: 10px;
    height: 10px;
    background: var(--accent);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

/* Upload Button */
.upload-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--secondary) 0%, #ffcd00 100%);
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.3rem;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.upload-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 24px rgba(255, 217, 61, 0.4);
}

/* Image Upload Area */
.image-upload-area {
    margin-bottom: 12px;
}

.upload-preview {
    position: relative;
    display: inline-block;
    margin-bottom: 12px;
}

.upload-preview img {
    max-width: 200px;
    max-height: 150px;
    border-radius: 12px;
    border: 3px solid var(--primary);
}

.remove-image {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 28px;
    height: 28px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.cat-select {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f5f5f5;
    border-radius: 12px;
}

.cat-select label {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.9rem;
}

.cat-select select {
    flex: 1;
    padding: 10px 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    background: white;
    cursor: pointer;
}

.cat-select select:focus {
    outline: none;
    border-color: var(--primary);
}

.detection-status {
    width: 100%;
    text-align: center;
    padding: 8px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    background: linear-gradient(135deg, #fff5f8 0%, #ffe4ec 100%);
    border-radius: 8px;
    margin-top: 8px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Gallery */
.gallery {
    margin-top: 24px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
}

.gallery-item {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    aspect-ratio: 1;
    box-shadow: 0 4px 12px var(--shadow);
    transition: transform 0.3s ease;
}

.gallery-item:hover {
    transform: scale(1.05);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-item .cat-tag {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Score Animation */
.pet-score {
    transition: transform 0.3s ease;
}

.pet-score.bump {
    animation: scoreBump 0.5s ease;
}

@keyframes scoreBump {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); color: var(--accent); }
}

/* Message with Image */
.message .bubble img {
    max-width: 200px;
    border-radius: 12px;
    margin-top: 8px;
    display: block;
}

/* Offline indicator */
.live-indicator.offline {
    color: #e74c3c;
}

.live-indicator.offline .pulse {
    background: #e74c3c;
    animation: none;
}

/* Username Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 8px;
    border: 4px solid #333;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 8px 0 rgba(0, 0, 0, 0.3);
    animation: modalPop 0.3s ease;
}

@keyframes modalPop {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-content h2 {
    font-family: 'Press Start 2P', monospace;
    color: var(--primary);
    margin-bottom: 10px;
    font-size: 0.9rem;
    line-height: 1.6;
}

.modal-content h2::before {
    content: '[*] ';
    font-family: 'Press Start 2P', monospace;
    font-size: 0.7em;
}

.modal-content p {
    color: var(--text-light);
    margin-bottom: 20px;
}

#username-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

#username-form input {
    padding: 14px 20px;
    border: 3px solid #333;
    border-radius: 4px;
    font-size: 1.1rem;
    font-family: inherit;
    text-align: center;
}

#username-form input:focus {
    outline: none;
    border-color: var(--primary);
}

#username-form button {
    padding: 14px 28px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: 3px solid #333;
    border-radius: 4px;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s;
    text-transform: uppercase;
}

#username-form button:hover {
    transform: scale(1.02);
}

/* Global Chat Log */
.global-chat {
    margin-top: 24px;
}

.global-chat h2::before {
    content: '[#]';
    font-family: 'Press Start 2P', monospace;
    font-size: 0.7em;
}

.total-reports-counter {
    font-size: 0.85rem;
    color: var(--text-light);
    font-style: italic;
    margin: 8px 0 12px 0;
    padding: 8px 12px;
    background: linear-gradient(135deg, rgba(255,107,157,0.1) 0%, rgba(255,217,61,0.1) 100%);
    border-radius: 8px;
    border-left: 3px solid var(--primary);
}

.global-chat-log {
    background: #f0f0f0;
    border-radius: 4px;
    border: 2px solid #555;
    padding: 16px;
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.global-message {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    background: white;
    border-radius: 4px;
    border: 2px solid #555;
    animation: slideIn 0.3s ease;
}

.global-message .user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    border: 2px solid #333;
    background: linear-gradient(135deg, var(--secondary) 0%, #ffcd00 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Press Start 2P', monospace;
    font-weight: 700;
    color: #8b6914;
    font-size: 0.6rem;
    flex-shrink: 0;
}

.global-message .message-content {
    flex: 1;
    min-width: 0;
}

.global-message .message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.global-message .username {
    font-weight: 700;
    color: var(--text-dark);
    font-size: 0.9rem;
}

.global-message .timestamp {
    font-size: 0.75rem;
    color: var(--text-light);
}

.global-message .message-text {
    color: var(--text-dark);
    font-size: 0.95rem;
    line-height: 1.4;
    word-break: break-word;
}

.global-message .message-image {
    max-width: 150px;
    border-radius: 8px;
    margin-top: 8px;
}

.global-message .cat-badge {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid #333;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.5rem;
    margin-left: 8px;
}

/* Current user indicator */
.current-user-badge {
    background: var(--accent);
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    border: 2px solid #333;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.6rem;
    margin-left: auto;
}

header .user-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
}

header .user-info span {
    color: var(--text-light);
}

.edit-name-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 4px 8px;
    opacity: 0.6;
    transition: opacity 0.2s, transform 0.2s;
}

.edit-name-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Version Number */
.version {
    font-size: 0.75rem;
    color: var(--text-light);
    opacity: 0.7;
    margin-top: 8px;
}

/* ===========================================
   MOBILE STYLES
   =========================================== */

/* Tablets and small screens */
@media (max-width: 768px) {
    .container {
        padding: 12px;
    }

    header {
        padding: 20px 0;
    }

    header h1 {
        font-size: 1.8rem;
    }

    .subtitle {
        font-size: 0.95rem;
        padding: 0 10px;
    }

    section {
        padding: 16px;
        border-radius: 20px;
    }

    section h2 {
        font-size: 1.2rem;
    }

    .chat-container {
        height: 400px;
    }

    .chat-messages {
        padding: 12px;
    }

    .message .bubble {
        padding: 10px 14px;
        font-size: 0.95rem;
    }

    .message .avatar {
        width: 35px;
        height: 35px;
        font-size: 1.3rem;
    }

    .pet-card {
        padding: 12px;
    }

    .pet-avatar {
        width: 50px;
        height: 50px;
    }

    .pet-name {
        font-size: 1rem;
    }

    .pet-score {
        font-size: 1.3rem;
    }

    .global-chat-log {
        max-height: 300px;
        padding: 12px;
    }

    .global-message {
        padding: 10px 12px;
    }
}

/* Mobile phones */
@media (max-width: 480px) {
    .container {
        padding: 8px;
    }

    header {
        padding: 15px 0;
    }

    header h1 {
        font-size: 1.5rem;
        line-height: 1.3;
    }

    .subtitle {
        font-size: 0.85rem;
    }

    header .user-info {
        flex-wrap: wrap;
        font-size: 0.85rem;
    }

    section {
        padding: 14px;
        border-radius: 16px;
        margin-bottom: 12px;
    }

    section h2 {
        font-size: 1.1rem;
        margin-bottom: 14px;
    }

    /* Chat adjustments */
    .chat-container {
        height: 350px;
    }

    .chat-messages {
        padding: 10px;
        gap: 12px;
    }

    .message {
        max-width: 90%;
        gap: 8px;
    }

    .message .avatar {
        width: 32px;
        height: 32px;
        font-size: 1.2rem;
    }

    .message .bubble {
        padding: 10px 12px;
        font-size: 0.9rem;
        border-radius: 14px;
    }

    .message .bubble p {
        line-height: 1.4;
    }

    /* Chat input */
    .chat-input {
        gap: 8px;
    }

    .chat-input input {
        padding: 12px 16px;
        font-size: 16px; /* Prevents iOS zoom on focus */
        border-radius: 25px;
    }

    .chat-input button {
        padding: 12px 20px;
        font-size: 0.9rem;
        border-radius: 25px;
    }

    /* Leaderboard adjustments */
    .pet-card {
        padding: 10px 12px;
        gap: 10px;
    }

    .rank-badge {
        width: 26px;
        height: 26px;
        font-size: 0.85rem;
    }

    .pet-avatar {
        width: 45px;
        height: 45px;
    }

    .pet-emoji, .pet-emoji-fallback {
        font-size: 1.8rem;
    }

    .pet-info {
        min-width: 0;
    }

    .pet-name {
        font-size: 0.95rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .pet-type {
        font-size: 0.75rem;
    }

    .pet-score {
        font-size: 1.2rem;
        min-width: 40px;
        text-align: right;
    }

    /* Global chat adjustments */
    .global-chat-log {
        max-height: 250px;
        padding: 10px;
        gap: 10px;
    }

    .global-message {
        padding: 10px;
        gap: 10px;
    }

    .global-message .user-avatar {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }

    .global-message .message-header {
        flex-wrap: wrap;
        gap: 4px;
    }

    .global-message .username {
        font-size: 0.85rem;
    }

    .global-message .timestamp {
        font-size: 0.7rem;
    }

    .global-message .message-text {
        font-size: 0.9rem;
    }

    .cat-badge {
        font-size: 0.7rem;
        padding: 2px 6px;
    }

    /* Footer */
    footer {
        padding: 15px 0;
    }

    footer p {
        font-size: 0.85rem;
    }

    .version {
        font-size: 0.7rem;
    }

    /* Username modal */
    .modal-content {
        margin: 20px;
        padding: 24px 20px;
        border-radius: 20px;
    }

    .modal-content h2 {
        font-size: 1.4rem;
    }

    .modal-content p {
        font-size: 0.95rem;
    }

    #username-input {
        padding: 14px 18px;
        font-size: 16px; /* Prevents iOS zoom */
    }

    #username-form button {
        padding: 14px 24px;
        font-size: 1rem;
    }
}

/* Extra small phones */
@media (max-width: 360px) {
    header h1 {
        font-size: 1.3rem;
    }

    .subtitle {
        font-size: 0.8rem;
    }

    .chat-container {
        height: 300px;
    }

    .pet-avatar {
        width: 40px;
        height: 40px;
    }

    .pet-emoji, .pet-emoji-fallback {
        font-size: 1.5rem;
    }
}

/* iOS specific fixes */
@supports (-webkit-touch-callout: none) {
    /* Prevent text size adjustment on orientation change */
    body {
        -webkit-text-size-adjust: 100%;
    }

    /* Better tap targets */
    .chat-input button,
    #username-form button {
        min-height: 44px;
    }

    /* Fix for iOS input zoom */
    input[type="text"] {
        font-size: 16px;
    }
}

/* Safe area for notched phones */
@supports (padding: max(0px)) {
    .container {
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
}

/* ===========================================
   MINECRAFT-STYLE PIXEL CATS BACKGROUND
   =========================================== */

.pixel-cats-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.pixel-cat {
    position: absolute;
    opacity: 0.5;
    transform: scale(var(--scale, 1));
    image-rendering: pixelated;
}

/* Minecraft Cat Structure */
.minecraft-cat {
    image-rendering: pixelated;
}

.mc-cat-body {
    width: 32px;
    height: 20px;
    position: relative;
    border-radius: 2px;
}

.mc-cat-head {
    width: 20px;
    height: 16px;
    position: absolute;
    top: -10px;
    left: -8px;
    border-radius: 2px;
}

.mc-cat-ear {
    width: 6px;
    height: 6px;
    position: absolute;
    top: -4px;
}

.mc-cat-ear.left { left: 1px; }
.mc-cat-ear.right { right: 1px; }

.mc-cat-face {
    position: absolute;
    top: 5px;
    left: 3px;
    right: 3px;
    height: 10px;
}

.mc-cat-eye {
    width: 4px;
    height: 4px;
    background: #1a1a1a;
    position: absolute;
    top: 0;
    border-radius: 1px;
}

.mc-cat-eye.left { left: 1px; }
.mc-cat-eye.right { right: 1px; }

.mc-cat-nose {
    width: 4px;
    height: 3px;
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 1px;
}

.mc-cat-tail {
    width: 6px;
    height: 16px;
    position: absolute;
    right: -6px;
    top: -6px;
    border-radius: 2px;
    transform: rotate(30deg);
    transform-origin: bottom left;
}

.mc-cat-legs {
    position: absolute;
    bottom: -8px;
    left: 4px;
    right: 4px;
    display: flex;
    justify-content: space-between;
}

.mc-cat-leg {
    width: 6px;
    height: 10px;
    border-radius: 1px;
}

/* Walking animations */
@keyframes walkLeft {
    0% { transform: translateX(100vw) scaleX(-1) scale(var(--scale, 1)); }
    100% { transform: translateX(-80px) scaleX(-1) scale(var(--scale, 1)); }
}

@keyframes walkRight {
    0% { transform: translateX(-80px) scaleX(1) scale(var(--scale, 1)); }
    100% { transform: translateX(100vw) scaleX(1) scale(var(--scale, 1)); }
}

@keyframes floatBob {
    0%, 100% { transform: translateY(0) scale(var(--scale, 1)); }
    50% { transform: translateY(-8px) scale(var(--scale, 1)); }
}

@keyframes legWalk {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(15deg); }
    75% { transform: rotate(-15deg); }
}

.pixel-cat.walk-left {
    animation: walkLeft var(--duration, 25s) linear infinite;
}

.pixel-cat.walk-left .mc-cat-leg {
    animation: legWalk 0.4s ease-in-out infinite;
}

.pixel-cat.walk-right {
    animation: walkRight var(--duration, 25s) linear infinite;
}

.pixel-cat.walk-right .mc-cat-leg {
    animation: legWalk 0.4s ease-in-out infinite;
}

.pixel-cat.floating {
    animation: floatBob 3s ease-in-out infinite;
}

/* Make sure main content is above cats */
.container {
    position: relative;
    z-index: 1;
}

.modal {
    z-index: 1000;
}

/* Reduce cats on mobile */
@media (max-width: 480px) {
    .pixel-cat {
        opacity: 0.35;
    }

    .mc-cat-body {
        width: 24px;
        height: 15px;
    }

    .mc-cat-head {
        width: 15px;
        height: 12px;
        top: -8px;
        left: -6px;
    }
}

/* ===========================================
   TABS & VETERANS SECTION
   =========================================== */

.leaderboard-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    padding: 12px 16px;
    background: #f0f0f0;
    border: 3px solid #555;
    border-radius: 4px;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.55rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-light);
}

.tab-btn:hover {
    background: #e0e0e0;
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-color: #333;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Mobile adjustments for tabs */
@media (max-width: 480px) {
    .leaderboard-tabs {
        flex-direction: column;
        gap: 6px;
    }

    .tab-btn {
        font-size: 0.5rem;
        padding: 10px 12px;
    }
}

/* ===========================================
   PET REQUESTS SECTION
   =========================================== */

.pet-requests {
    margin-top: 24px;
}

.pet-requests h2::before {
    content: '[+]';
}

.request-intro {
    color: var(--text-light);
    margin-bottom: 16px;
    text-align: center;
}

.request-form {
    margin-bottom: 24px;
}

.request-form .form-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.request-form input {
    flex: 1;
    min-width: 120px;
    padding: 12px 16px;
    border: 3px solid #333;
    border-radius: 4px;
    font-family: inherit;
    font-size: 1rem;
}

.request-form input:focus {
    outline: none;
    border-color: var(--primary);
}

.request-form button {
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: 3px solid #333;
    border-radius: 4px;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.6rem;
    cursor: pointer;
    transition: transform 0.2s;
    white-space: nowrap;
}

.request-form button:hover {
    transform: scale(1.02);
}

.most-requested {
    background: #f0f0f0;
    border-radius: 4px;
    border: 2px solid #555;
    padding: 16px;
}

.most-requested h3 {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.7rem;
    color: var(--text-dark);
    margin-bottom: 16px;
    text-transform: uppercase;
}

.most-requested h3::before {
    content: '>> ';
    color: var(--primary);
}

.pet-requests-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.no-requests {
    text-align: center;
    color: var(--text-light);
    padding: 20px;
}

.request-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: white;
    border-radius: 4px;
    border: 2px solid #555;
}

.request-rank {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--secondary) 0%, #ffcd00 100%);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.6rem;
    color: #8b6914;
    border: 2px solid #333;
    flex-shrink: 0;
}

.request-info {
    flex: 1;
}

.request-name {
    font-weight: 700;
    color: var(--text-dark);
    font-size: 1rem;
}

.request-type {
    font-size: 0.8rem;
    color: var(--text-light);
    text-transform: capitalize;
}

.request-by {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 2px;
}

.request-votes {
    display: flex;
    align-items: center;
    gap: 8px;
}

.vote-btn {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--secondary) 0%, #ffcd00 100%);
    border: 2px solid #333;
    border-radius: 4px;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.7rem;
    cursor: pointer;
    transition: transform 0.2s;
    color: #333;
}

.vote-btn:hover {
    transform: scale(1.1);
}

.vote-btn:active {
    transform: scale(0.95);
}

.vote-count {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.8rem;
    color: var(--primary);
    min-width: 30px;
    text-align: center;
}

/* Mobile adjustments for pet requests */
@media (max-width: 480px) {
    .request-form .form-row {
        flex-direction: column;
    }

    .request-form input {
        min-width: 100%;
    }

    .request-form button {
        width: 100%;
    }

    .request-card {
        padding: 12px;
    }

    .request-name {
        font-size: 0.9rem;
    }
}

/* ===========================================
   MEET THE PETS - PET BIOS SECTION
   =========================================== */

.pets-tab-btn {
    background: linear-gradient(135deg, var(--bg-light) 0%, #ffe4ec 100%);
}

.pets-tab-btn.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.pets-intro {
    text-align: center;
    padding: 12px 16px;
    margin-bottom: 16px;
    background: linear-gradient(135deg, rgba(255,107,157,0.1) 0%, rgba(255,217,61,0.1) 100%);
    border-radius: 4px;
    border-left: 3px solid var(--primary);
}

.pets-intro p {
    color: var(--text-light);
    font-size: 0.85rem;
    line-height: 1.5;
}

/* Search Box */
.search-box {
    margin-bottom: 16px;
}

.search-box input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #555;
    border-radius: 4px;
    font-family: inherit;
    font-size: 1rem;
    background: white;
    transition: all 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--shadow);
}

.search-box input::placeholder {
    color: var(--text-light);
}

#pets-search {
    border-color: #555;
}

#pets-search:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--shadow);
}

.pets-bio-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pet-bio-card {
    background: white;
    border-radius: 4px;
    border: 2px solid #555;
    padding: 16px;
    transition: all 0.3s ease;
}

.pet-bio-card:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px var(--shadow);
}

/* Veteran Memorial Card Styling */
.pet-bio-card.veteran-memorial {
    background: linear-gradient(135deg, #faf5ff 0%, #ede9fe 100%);
    border-color: #8b5cf6;
    position: relative;
}

.pet-bio-card.veteran-memorial::before {
    content: '★ In Loving Memory ★';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%);
    color: white;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.45rem;
    padding: 4px 12px;
    border-radius: 4px;
    white-space: nowrap;
}

.pet-bio-card.veteran-memorial:hover {
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.3);
}

.veteran-avatar-glow {
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.4);
}

.pet-bio-avatar .veteran-halo {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 10px;
    background: linear-gradient(135deg, #ffd700 0%, #ffed4a 100%);
    border-radius: 50%;
    border: 2px solid #b8860b;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
    z-index: 10;
}

.pet-memorial-banner {
    background: linear-gradient(135deg, #ddd6fe 0%, #c4b5fd 100%);
    border: 2px solid #8b5cf6;
    border-radius: 4px;
    padding: 10px 12px;
    margin-bottom: 12px;
    font-style: italic;
    color: #5b21b6;
    text-align: center;
    font-size: 0.9rem;
}

.pet-bio-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.pet-bio-avatar {
    width: 60px;
    height: 60px;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
    border: 2px solid #555;
    background: linear-gradient(135deg, #fff5f8 0%, #ffe4ec 100%);
}

.pet-bio-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pet-bio-rank {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.8);
    color: var(--gold);
    font-family: 'Press Start 2P', monospace;
    font-size: 0.5rem;
    text-align: center;
    padding: 2px;
}

.pet-bio-title {
    flex: 1;
    min-width: 120px;
}

.pet-bio-name {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.75rem;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.pet-bio-type {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 4px;
    text-transform: capitalize;
}

.pet-bio-score {
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 700;
}

.pet-bio-modifier {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 10px;
    border-radius: 4px;
    border: 2px solid #555;
    min-width: 70px;
    background: #f5f5f5;
}

.pet-bio-modifier.positive {
    border-color: #10b981;
    background: #f0fdf4;
}

.pet-bio-modifier.negative {
    border-color: var(--primary);
    background: #fff5f8;
}

.pet-bio-modifier.neutral {
    background: #f5f5f5;
}

.modifier-label {
    font-size: 0.5rem;
    color: var(--text-light);
    text-transform: uppercase;
    font-family: 'Press Start 2P', monospace;
}

.modifier-value {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.8rem;
    font-weight: 700;
}

.pet-bio-modifier.positive .modifier-value {
    color: #10b981;
}

.pet-bio-modifier.negative .modifier-value {
    color: var(--primary);
}

.pet-bio-modifier.neutral .modifier-value {
    color: var(--text-light);
}

.pet-bio-description {
    font-size: 0.85rem;
    color: var(--text-dark);
    line-height: 1.5;
    margin-bottom: 12px;
    padding: 10px 12px;
    background: #f0f0f0;
    border-radius: 4px;
    border-left: 3px solid var(--primary);
}

.pet-bio-traits {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
}

.pet-bio-strengths,
.pet-bio-weaknesses {
    padding: 10px 12px;
    border-radius: 4px;
    border: 2px solid #555;
    background: #fafafa;
}

.pet-bio-strengths {
    border-left: 3px solid #10b981;
}

.pet-bio-weaknesses {
    border-left: 3px solid var(--primary);
}

.pet-bio-strengths h4,
.pet-bio-weaknesses h4 {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.45rem;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.pet-bio-strengths h4 {
    color: #10b981;
}

.pet-bio-weaknesses h4 {
    color: var(--primary);
}

.pet-bio-strengths ul,
.pet-bio-weaknesses ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.pet-bio-strengths li,
.pet-bio-weaknesses li {
    font-size: 0.8rem;
    padding: 3px 0;
    padding-left: 14px;
    position: relative;
    color: var(--text-dark);
}

.pet-bio-strengths li::before {
    content: '+';
    position: absolute;
    left: 0;
    color: #10b981;
    font-weight: 700;
}

.pet-bio-weaknesses li::before {
    content: '-';
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: 700;
}

.pet-bio-tip {
    font-size: 0.8rem;
    padding: 8px 12px;
    background: #f0f0f0;
    border-radius: 4px;
    border: 2px solid #555;
    color: var(--text-light);
}

.pet-bio-tip strong {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.45rem;
    color: var(--text-dark);
}

/* Mobile adjustments for pet bios */
@media (max-width: 600px) {
    .pet-bio-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .pet-bio-modifier {
        width: 100%;
        flex-direction: row;
        justify-content: space-between;
    }

    .pet-bio-traits {
        grid-template-columns: 1fr;
    }

    .pet-bio-avatar {
        width: 50px;
        height: 50px;
    }

    .pet-bio-name {
        font-size: 0.65rem;
    }
}

@media (max-width: 480px) {
    .pet-bio-card {
        padding: 12px;
    }

    .pet-bio-description {
        font-size: 0.8rem;
        padding: 8px 10px;
    }

    .pet-bio-strengths,
    .pet-bio-weaknesses {
        padding: 8px 10px;
    }

    .pet-bio-strengths li,
    .pet-bio-weaknesses li {
        font-size: 0.75rem;
    }

    .pet-bio-tip {
        font-size: 0.75rem;
        padding: 6px 10px;
    }
}

/* ===========================================
   VERSION BADGE
   =========================================== */
.header-version {
    font-family: 'Nunito', sans-serif;
    font-size: 0.5em;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    vertical-align: middle;
    opacity: 0.8;
}

/* ===========================================
   DISABLED INPUT STATE
   =========================================== */
#chat-form button[type="submit"].disabled,
#chat-form button[type="submit"]:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
}

#chat-form button[type="submit"].disabled:hover,
#chat-form button[type="submit"]:disabled:hover {
    background: #ccc;
    transform: none;
    box-shadow: none;
}

#message-input:disabled {
    background: #f5f5f5;
    color: #999;
    cursor: not-allowed;
}

.report-counter.exhausted {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
    color: white;
    animation: pulse-warning 1s ease-in-out infinite;
}

@keyframes pulse-warning {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ===========================================
   INLINE PET QUIPS - Speech bubbles on leaderboard
   =========================================== */

/* Position pet cards to allow quip overflow */
.pet-card {
    position: relative;
    overflow: visible;
}

/* Inline quip bubble - positioned near pet avatar */
.pet-quip-inline {
    position: absolute;
    left: -10px;
    top: -8px;
    transform: translateX(-100%);
    max-width: 160px;
    opacity: 0;
    pointer-events: none;
    z-index: 5;
    transition: opacity 0.4s ease;
}

.pet-quip-inline.loaded {
    opacity: 1;
}

.quip-inline-text {
    display: block;
    background: #fefefe;
    padding: 6px 10px;
    font-size: 0.7rem;
    line-height: 1.4;
    color: #555;
    font-style: italic;

    /* Pixelated box style */
    border: 2px solid #ddd;
    border-radius: 2px;
    box-shadow:
        2px 2px 0 #e8e8e8,
        inset 0 1px 0 rgba(255,255,255,0.9);
}

/* Speech bubble pointer */
.quip-inline-text::after {
    content: '';
    position: absolute;
    right: -8px;
    top: 12px;
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-left: 8px solid #ddd;
}

.quip-inline-text::before {
    content: '';
    position: absolute;
    right: -5px;
    top: 14px;
    width: 0;
    height: 0;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    border-left: 6px solid #fefefe;
    z-index: 1;
}

/* Hide quips on smaller screens */
@media (max-width: 900px) {
    .pet-quip-inline {
        display: none;
    }
}

/* Make leaderboard section allow overflow */
.leaderboard {
    overflow: visible !important;
}

.leaderboard-list {
    overflow: visible;
}
