/* AI Comedy Club — xkcd-inspired style */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Courier New', 'Lucida Console', monospace;
    background: #fff;
    color: #333;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 16px;
}

/* Nav */
header {
    text-align: center;
    padding: 16px 0;
    border-bottom: 2px solid #333;
    margin-bottom: 20px;
}

header h1 { font-size: 1.4em; letter-spacing: 1px; }
header h1 a { color: #333; text-decoration: none; }

nav { margin-top: 8px; font-size: 0.85em; }
nav a { color: #666; text-decoration: none; margin: 0 10px; }
nav a:hover, nav a.active { color: #333; font-weight: bold; }

/* Single joke display */
.joke-display {
    text-align: center;
    padding: 20px 0;
}

.joke-display h2 {
    font-size: 1.2em;
    margin-bottom: 15px;
    font-style: italic;
}

.joke-display .comic-image {
    max-width: 100%;
    border: 1px solid #ccc;
    margin: 15px auto;
    display: block;
}

/* Comic panels */
.panels {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-width: 700px;
    margin: 20px auto;
    justify-content: center;
}

.panel {
    border: 2px solid #333;
    padding: 15px;
    background: #fafafa;
    position: relative;
    flex: 1 1 300px;
    max-width: 340px;
    min-height: 100px;
}

.panel .character {
    font-weight: bold;
    font-size: 0.75em;
    color: #666;
    margin-bottom: 5px;
    text-transform: uppercase;
}

.panel .speech {
    font-size: 0.9em;
    line-height: 1.4;
}

.panel .year-label {
    position: absolute;
    top: 3px;
    right: 8px;
    font-size: 0.7em;
    color: #999;
    font-style: italic;
}

/* Joke text (non-comic) */
.joke-text {
    font-size: 1.1em;
    line-height: 1.6;
    max-width: 600px;
    margin: 20px auto;
    padding: 20px;
    border-left: 3px solid #333;
    text-align: left;
}

/* Meta */
.joke-meta {
    margin-top: 15px;
    font-size: 0.8em;
    color: #999;
}

.comedian-tag {
    display: inline-block;
    padding: 2px 8px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 0.85em;
}

/* Nav arrows */
.joke-nav {
    text-align: center;
    padding: 15px 0;
    border-top: 1px solid #eee;
    margin-top: 10px;
}

.joke-nav a {
    color: #333;
    text-decoration: none;
    margin: 0 12px;
    padding: 5px 10px;
    font-size: 0.9em;
}

.joke-nav a:hover { background: #eee; }

/* Vote button */
.vote-btn {
    cursor: pointer;
    background: none;
    border: 1px solid #ccc;
    padding: 4px 12px;
    font-family: inherit;
    font-size: 0.85em;
}

.vote-btn:hover { border-color: #333; }

/* Battle */
.battle-container {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    padding: 20px 0;
}

.battle-card {
    flex: 1;
    max-width: 380px;
    border: 2px solid #333;
    padding: 20px;
    cursor: pointer;
    transition: background 0.15s;
    text-align: center;
}

.battle-card:hover { background: #f5f5f5; }
.battle-card.selected { background: #e8f5e9; border-color: #4caf50; }
.battle-card h3 { margin-bottom: 10px; }

/* Submit */
.submit-form {
    max-width: 500px;
    margin: 30px auto;
    text-align: center;
}

.submit-form input[type="text"] {
    width: 100%;
    padding: 10px;
    font-family: inherit;
    font-size: 1em;
    border: 2px solid #333;
    margin-bottom: 10px;
}

.submit-form button {
    padding: 8px 30px;
    font-family: inherit;
    font-size: 1em;
    background: #333;
    color: #fff;
    border: none;
    cursor: pointer;
}

.submit-form button:hover { background: #555; }

#results { margin-top: 20px; }

/* Leaderboard */
.leaderboard-row {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
    gap: 10px;
}

.leaderboard-row .rank { font-weight: bold; width: 30px; font-size: 1.1em; }
.leaderboard-row .emoji { font-size: 1.3em; }
.leaderboard-row .info { flex: 1; }
.leaderboard-row .stats { font-size: 0.8em; color: #999; }

.loading { text-align: center; color: #999; padding: 40px; font-style: italic; }

.upload-zone {
    border: 2px dashed #ccc;
    padding: 30px;
    text-align: center;
    color: #999;
    cursor: pointer;
    margin-bottom: 12px;
}

.upload-zone.dragover { border-color: #333; background: #f0f0f0; }

/* Spinner */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
    display: inline-block;
    width: 24px; height: 24px;
    border: 3px solid #ddd;
    border-top-color: #333;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 15px auto;
}
.loading-block {
    text-align: center;
    padding: 20px 0;
}
.loading-block .spinner {
    width: 32px; height: 32px;
    margin: 0 auto 10px;
}
.loading-block .loading-text {
    font-size: 0.85em;
    color: #999;
    font-style: italic;
}

@media (max-width: 600px) {
    .battle-container { flex-direction: column; }
    .panels { flex-direction: column; }
    .panel { max-width: 100%; }
}
