/* Papa Caliente - Mobile-first Styles */

/* CSS Variables */
:root {
    --color-primary: #FF6B35;
    --color-hot: #FF2E2E;
    --color-warning: #FFB347;
    --color-accent: #FFD700;
    --color-success: #2ECC71;
    --color-eliminated: #666666;
    --color-bg: #1A1A2E;
    --color-card: #16213E;
    --color-text: #FFFFFF;
    --color-text-muted: #8B8B8B;
    --color-border: #2A2A4A;
    --color-life: #FF4757;
    --color-life-empty: #333;
    --color-danger: #E74C3C;

    --transition-speed: 0.3s;
    --shake-intensity: 0;
}

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

/* Base */
html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* Screens */
.screen {
    display: none;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 1.5rem 1rem;
}

.screen.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.container {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    text-align: center;
}

/* Logo */
.logo {
    font-size: 4rem;
    margin-bottom: 0.5rem;
    position: relative;
    display: inline-block;
}

.potato-emoji {
    display: inline-block;
    animation: float 3s ease-in-out infinite;
}

.fire-emoji {
    position: absolute;
    right: -1.5rem;
    top: -0.5rem;
    font-size: 2rem;
    animation: flicker 0.3s ease-in-out infinite alternate;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes flicker {
    0% { opacity: 0.7; transform: scale(1) rotate(-5deg); }
    100% { opacity: 1; transform: scale(1.1) rotate(5deg); }
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--color-text-muted);
}

.subtitle {
    color: var(--color-text-muted);
    font-size: 1rem;
    margin-bottom: 2rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all var(--transition-speed);
    min-height: 56px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    width: 100%;
}

.btn:active:not(:disabled) {
    transform: scale(0.98);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-hot));
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.4);
}

.btn-primary:active:not(:disabled) {
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.4);
}

.btn-secondary {
    background: var(--color-card);
    color: var(--color-text);
    border: 2px solid var(--color-border);
}

.btn-large {
    min-height: 70px;
    font-size: 1.5rem;
}

.btn-link {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 1rem;
    text-decoration: underline;
    -webkit-tap-highlight-color: transparent;
    margin-top: 1rem;
}

/* Players Setup */
.players-setup {
    background: var(--color-card);
    border-radius: 16px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.players-setup h2 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

#player-count {
    font-size: 0.9rem;
    font-weight: 400;
}

.players-list {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.player-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background: var(--color-bg);
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.player-item:last-child {
    margin-bottom: 0;
}

.player-item-name {
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.player-item-number {
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

.btn-remove {
    background: transparent;
    border: none;
    color: var(--color-danger);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    opacity: 0.7;
    -webkit-tap-highlight-color: transparent;
}

.btn-remove:active {
    opacity: 1;
}

.add-player-row {
    display: flex;
    gap: 0.5rem;
}

.add-player-row input {
    flex: 1;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 2px solid var(--color-border);
    border-radius: 10px;
    background: var(--color-bg);
    color: var(--color-text);
    outline: none;
}

.add-player-row input:focus {
    border-color: var(--color-primary);
}

.add-player-row input::placeholder {
    color: var(--color-text-muted);
}

.btn-add {
    width: 50px;
    min-height: 50px;
    padding: 0;
    font-size: 1.5rem;
    font-weight: 700;
    border-radius: 10px;
    background: var(--color-primary);
    color: white;
    border: none;
}

/* Settings Row */
.settings-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    color: var(--color-text-muted);
}

.stepper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--color-card);
    border-radius: 8px;
    padding: 0.25rem;
}

.btn-stepper {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 6px;
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 1.25rem;
    font-weight: 600;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.btn-stepper:active {
    background: var(--color-primary);
}

#lives-count {
    width: 2rem;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-life);
}

/* Ready Screen */
.ready-label {
    color: var(--color-text-muted);
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.starting-player {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-accent);
    margin-bottom: 2rem;
}

.ready-potato {
    margin-bottom: 2rem;
}

.potato-emoji-large {
    font-size: 6rem;
    display: inline-block;
    animation: float 2s ease-in-out infinite;
}

.ready-hint {
    color: var(--color-text-muted);
    margin-bottom: 2rem;
}

/* Playing Screen */
.playing-container {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 3rem);
    min-height: calc(100dvh - 3rem);
    justify-content: space-between;
    padding: 1rem 0;
}

.round-info {
    margin-bottom: 1rem;
}

.round-label {
    color: var(--color-text-muted);
    font-size: 1rem;
}

.round-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-accent);
    margin-left: 0.5rem;
}

/* Potato Container */
.potato-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.potato {
    position: relative;
    transition: transform 0.1s ease;
}

.potato-emoji-huge {
    font-size: 8rem;
    display: inline-block;
    filter: brightness(1);
    transition: filter 0.3s ease;
}

.potato-fire {
    position: absolute;
    top: -1rem;
    right: -1rem;
    font-size: 3rem;
    animation: flicker 0.2s ease-in-out infinite alternate;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Potato shake animation based on intensity */
.potato.shaking {
    animation: potato-shake 0.1s ease-in-out infinite;
}

.potato.shaking .potato-fire {
    opacity: 1;
}

@keyframes potato-shake {
    0%, 100% {
        transform: translateX(calc(var(--shake-intensity, 0) * -8px))
                   rotate(calc(var(--shake-intensity, 0) * -3deg));
    }
    50% {
        transform: translateX(calc(var(--shake-intensity, 0) * 8px))
                   rotate(calc(var(--shake-intensity, 0) * 3deg));
    }
}

/* Intensity colors */
.potato.intensity-low .potato-emoji-huge {
    filter: brightness(1);
}

.potato.intensity-medium .potato-emoji-huge {
    filter: brightness(1.1) saturate(1.2);
}

.potato.intensity-high .potato-emoji-huge {
    filter: brightness(1.2) saturate(1.5) hue-rotate(-10deg);
}

.potato.intensity-critical .potato-emoji-huge {
    filter: brightness(1.3) saturate(2) hue-rotate(-20deg);
}

/* Pass Button */
.btn-pass {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--color-primary), var(--color-hot));
    color: white;
    border: 5px solid var(--color-accent);
    box-shadow: 0 0 40px rgba(255, 107, 53, 0.6);
    margin: 1.5rem auto;
    animation: pulse-btn 1s ease-in-out infinite;
    touch-action: manipulation;
}

.btn-pass:active {
    transform: scale(0.95);
    box-shadow: 0 0 20px rgba(255, 107, 53, 0.4);
}

@keyframes pulse-btn {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 40px rgba(255, 107, 53, 0.6);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 60px rgba(255, 107, 53, 0.8);
    }
}

/* Pass Indicator */
.pass-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    color: var(--color-text-muted);
    font-size: 1.1rem;
}

.current-player {
    color: var(--color-accent);
    font-weight: 600;
}

.next-player {
    color: var(--color-text);
    font-weight: 500;
}

.arrow {
    color: var(--color-primary);
    font-size: 1.5rem;
}

/* Boom Screen */
.boom-container {
    animation: shake-screen 0.5s ease-out;
}

@keyframes shake-screen {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
    20%, 40%, 60%, 80% { transform: translateX(10px); }
}

.explosion {
    position: relative;
    height: 120px;
    margin-bottom: 1rem;
}

.boom-emoji {
    font-size: 5rem;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    animation: boom-pop 0.5s ease-out forwards;
}

.boom-emoji.delay-1 {
    animation-delay: 0.1s;
    opacity: 0;
}

.boom-emoji.delay-2 {
    animation-delay: 0.2s;
    opacity: 0;
}

@keyframes boom-pop {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

.boom-title {
    font-size: 4rem;
    font-weight: 700;
    color: var(--color-hot);
    text-shadow: 0 0 30px var(--color-hot);
    margin-bottom: 1.5rem;
    animation: boom-text 0.5s ease-out;
}

@keyframes boom-text {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

.boom-player {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.boom-text {
    color: var(--color-text-muted);
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.boom-lives {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    font-size: 2.5rem;
}

.life-heart {
    animation: heart-pop 0.3s ease-out forwards;
}

.life-heart.lost {
    filter: grayscale(1);
    opacity: 0.5;
}

.life-heart.just-lost {
    animation: heart-break 0.5s ease-out forwards;
}

@keyframes heart-pop {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

@keyframes heart-break {
    0% { transform: scale(1); filter: none; }
    50% { transform: scale(1.3); filter: hue-rotate(180deg); }
    100% { transform: scale(0.8); filter: grayscale(1); opacity: 0.5; }
}

/* Eliminated Screen */
.eliminated-container {
    animation: fadeIn 0.5s ease-out;
}

.eliminated-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
    animation: skull-shake 0.5s ease-out;
}

@keyframes skull-shake {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-10deg); }
    75% { transform: rotate(10deg); }
}

.eliminated-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-eliminated);
    margin-bottom: 1rem;
}

.eliminated-player {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.eliminated-text {
    color: var(--color-text-muted);
    margin-bottom: 2rem;
}

.remaining-players {
    color: var(--color-text-muted);
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.remaining-players span {
    color: var(--color-accent);
    font-weight: 600;
}

/* Finished Screen */
.finished-container {
    animation: fadeIn 0.5s ease-out;
}

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

.trophy {
    font-size: 6rem;
    margin-bottom: 1rem;
    animation: trophy-bounce 1s ease-in-out infinite;
}

@keyframes trophy-bounce {
    0%, 100% { transform: translateY(0) rotate(-5deg); }
    50% { transform: translateY(-20px) rotate(5deg); }
}

.winner-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-accent);
    margin-bottom: 1rem;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.winner-name {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.winner-text {
    color: var(--color-text-muted);
    margin-bottom: 3rem;
}

.finished-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--color-card);
    border-radius: 20px;
    padding: 2rem;
    max-width: 400px;
    width: 100%;
    position: relative;
    animation: modal-pop 0.3s ease-out;
}

@keyframes modal-pop {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 2rem;
    cursor: pointer;
    padding: 0.5rem;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
}

.modal h2 {
    margin-bottom: 1.5rem;
    color: var(--color-text);
}

.help-content {
    text-align: left;
    margin-bottom: 1.5rem;
}

.help-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 0.5rem;
}

.help-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.help-item p {
    color: var(--color-text-muted);
    font-size: 0.95rem;
    line-height: 1.4;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    font-size: 0.95rem;
    z-index: 2000;
    opacity: 0;
    transition: all 0.3s ease-out;
    max-width: calc(100% - 2rem);
    text-align: center;
    background: var(--color-card);
    border: 1px solid var(--color-border);
}

.toast.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success {
    background: var(--color-success);
    border-color: var(--color-success);
}

.toast.error {
    background: var(--color-danger);
    border-color: var(--color-danger);
}

/* Responsive */
@media (min-width: 400px) {
    .potato-emoji-huge {
        font-size: 10rem;
    }

    .btn-pass {
        width: 180px;
        height: 180px;
        font-size: 1.75rem;
    }

    .potato-fire {
        font-size: 4rem;
    }
}

@media (max-height: 600px) {
    .playing-container {
        padding: 0.5rem 0;
    }

    .potato-emoji-huge {
        font-size: 6rem;
    }

    .btn-pass {
        width: 140px;
        height: 140px;
    }
}

/* Prevent text selection on game elements */
.potato, .btn-pass, .boom-emoji, .trophy {
    -webkit-user-select: none;
    user-select: none;
}
