/* Word Hopper Game Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Lexend Deca', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.game-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    transition: opacity 0.3s ease;
}

.screen.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Start Screen Styles */
.start-content {
    text-align: center;
    background: rgba(255, 255, 255, 0.95);
    padding: 3rem;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    max-width: 500px;
    margin: 0 1rem;
}

.game-title {
    font-size: 3rem;
    font-weight: 700;
    color: #4c63d2;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.game-subtitle {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.instructions {
    background: #f8f9ff;
    padding: 1.5rem;
    border-radius: 10px;
    margin-bottom: 2rem;
    text-align: left;
    border-left: 4px solid #4c63d2;
}

.instructions p {
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.instructions strong {
    color: #4c63d2;
}

.game-button {
    background: linear-gradient(135deg, #4c63d2, #667eea);
    color: white;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Lexend Deca', sans-serif;
    margin: 0.5rem;
    min-width: 150px;
}

.game-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(76, 99, 210, 0.3);
}

.game-button.secondary {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
}

.game-button.secondary:hover {
    box-shadow: 0 10px 20px rgba(127, 140, 141, 0.3);
}

.back-to-site {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.back-link {
    color: #666;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.back-link:hover {
    color: #4c63d2;
}

/* Game Screen Styles */
#gameScreen {
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
}

.game-ui {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(5px);
}

.score-display {
    background: rgba(255, 255, 255, 0.9);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.score-label {
    color: #666;
    margin-right: 0.5rem;
}

#scoreValue {
    color: #4c63d2;
    font-size: 1.2rem;
    font-weight: 700;
}

.controls-hint {
    background: rgba(255, 255, 255, 0.9);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    color: #666;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Game Canvas */
#gameCanvas {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    background: linear-gradient(180deg, #87ceeb 0%, #98fb98 100%);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    width: 90vw;
    height: 85vh;
    max-width: 1200px;
    max-height: 600px;
}

/* Message History Panel - Left Side */
.message-history {
    position: fixed;
    top: 80px;
    left: 20px;
    width: 280px;
    max-height: 300px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    z-index: 12;
    border: 2px solid rgba(76, 99, 210, 0.2);
    overflow: hidden;
    transition: opacity 0.3s ease;
}

.message-history.hidden {
    opacity: 0;
    pointer-events: none;
}

.message-history-header {
    background: rgba(76, 99, 210, 0.1);
    padding: 0.8rem 1rem;
    border-bottom: 1px solid rgba(76, 99, 210, 0.2);
    font-weight: 600;
    color: #4c63d2;
    font-size: 0.9rem;
    text-align: center;
}

.message-history-content {
    max-height: 240px;
    overflow-y: auto;
    padding: 0.5rem;
}

.message-history-item {
    background: rgba(76, 99, 210, 0.05);
    margin-bottom: 0.5rem;
    padding: 0.6rem 0.8rem;
    border-radius: 10px;
    border-left: 3px solid #4c63d2;
    font-size: 0.8rem;
    line-height: 1.3;
    word-wrap: break-word;
}

.message-score {
    color: #666;
    font-weight: 500;
    font-size: 0.75rem;
    margin-bottom: 0.2rem;
}

.message-text {
    color: #4c63d2;
    font-weight: 600;
}

/* Custom Message Styles - Chat bubble following character */
.custom-message {
    position: fixed;
    transform: translateX(-50%) translateY(-100%);
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(8px);
    padding: 0.8rem 1.2rem;
    border-radius: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    z-index: 20;
    transition: opacity 0.3s ease, transform 0.3s ease;
    border: 2px solid rgba(76, 99, 210, 0.3);
    max-width: 350px;
    min-width: 150px;
    text-align: center;
    pointer-events: none;
    white-space: normal;
    word-wrap: break-word;
    line-height: 1.2;
}

/* Chat bubble tail pointing down towards character */
.custom-message::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid rgba(255, 255, 255, 0.75);
}

.custom-message:not(.hidden) {
    opacity: 1;
    transform: translateX(-50%) translateY(-100%);
}

.custom-message.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(-150%);
}

#messageText {
    font-size: 0.85rem;
    font-weight: 600;
    color: #4c63d2;
    text-align: center;
    display: block;
    text-shadow: none;
    margin: 0;
    word-wrap: break-word;
    line-height: 1.3;
    overflow-wrap: break-word;
}

/* Add a subtle glow effect */
.custom-message:not(.hidden) {
    animation: messageGlow 0.6s ease-out;
}

@keyframes messageGlow {
    0% {
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    }
    50% {
        box-shadow: 0 8px 25px rgba(76, 99, 210, 0.4), 0 0 20px rgba(76, 99, 210, 0.3);
    }
    100% {
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    }
}

/* Game Over Screen Styles */
.game-over-content {
    text-align: center;
    background: rgba(255, 255, 255, 0.95);
    padding: 3rem;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    max-width: 400px;
    margin: 0 1rem;
}

.game-over-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #e74c3c;
    margin-bottom: 1.5rem;
}

.final-score {
    background: #f8f9ff;
    padding: 1.5rem;
    border-radius: 10px;
    margin-bottom: 2rem;
    border-left: 4px solid #4c63d2;
}

.final-score #finalScore {
    color: #4c63d2;
    font-size: 2rem;
    font-weight: 700;
    margin-left: 0.5rem;
}

.game-over-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

/* Ending Sequence Styles */
.ending-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 50%, #ffecd2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 1s ease;
}

.ending-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.ending-overlay.fade-out {
    opacity: 0;
    transition: opacity 1s ease;
}

.ending-message {
    font-size: 3rem;
    font-weight: 700;
    color: #fff;
    text-align: center;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3);
    padding: 2rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    transform: scale(0.5) translateY(50px);
    opacity: 0;
    transition: all 1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-width: 80%;
    line-height: 1.2;
}

.ending-message.animate-in {
    transform: scale(1) translateY(0);
    opacity: 1;
    animation: messageGlow 2s ease-in-out infinite alternate;
}

/* Special styling for the romantic message */
.ending-message.romantic-message {
    background: linear-gradient(135deg, rgba(255, 182, 193, 0.2), rgba(255, 192, 203, 0.2));
    border: 2px solid rgba(255, 182, 193, 0.4);
    color: #fff;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.4), 0 0 20px rgba(255, 182, 193, 0.6);
}

.ending-message.romantic-message.animate-in {
    animation: romanticGlow 2s ease-in-out infinite alternate;
}

@keyframes romanticGlow {
    0% {
        text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.4), 0 0 20px rgba(255, 182, 193, 0.6);
        box-shadow: 0 0 30px rgba(255, 182, 193, 0.4);
    }
    100% {
        text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.4), 0 0 40px rgba(255, 182, 193, 0.9);
        box-shadow: 0 0 50px rgba(255, 182, 193, 0.7);
    }
}

/* Click instruction for interactive ending */
.click-instruction {
    font-size: 1.2rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
    margin-top: 2rem;
    padding: 1rem 2rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    transform: scale(0.8) translateY(20px);
    opacity: 0;
    transition: all 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    user-select: none;
}

/* Special styling for romantic instruction */
.click-instruction.romantic-instruction {
    background: linear-gradient(135deg, rgba(255, 182, 193, 0.2), rgba(255, 192, 203, 0.2));
    border: 2px solid rgba(255, 182, 193, 0.4);
    color: rgba(255, 255, 255, 0.9);
}

.click-instruction.romantic-instruction:hover {
    background: linear-gradient(135deg, rgba(255, 182, 193, 0.3), rgba(255, 192, 203, 0.3));
    border-color: rgba(255, 182, 193, 0.6);
    transform: scale(1.05) translateY(0);
}

.click-instruction.animate-in {
    transform: scale(1) translateY(0);
    opacity: 1;
    animation: pulseGlow 2s ease-in-out infinite;
}

.click-instruction.romantic-instruction.animate-in {
    animation: romanticPulse 2s ease-in-out infinite;
}

@keyframes romanticPulse {
    0% {
        box-shadow: 0 0 15px rgba(255, 182, 193, 0.4);
    }
    50% {
        box-shadow: 0 0 25px rgba(255, 182, 193, 0.7), 0 0 35px rgba(255, 182, 193, 0.4);
    }
    100% {
        box-shadow: 0 0 15px rgba(255, 182, 193, 0.4);
    }
}

.click-instruction:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05) translateY(0);
}

@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.6), 0 0 30px rgba(255, 255, 255, 0.3);
    }
    100% {
        box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    }
}

/* Special ending message on game over screen */
.special-ending-message {
    text-align: center;
    margin: 2rem 0;
    padding: 2rem;
    background: linear-gradient(135deg, #ff9a9e, #fecfef);
    border-radius: 15px;
    color: white;
    box-shadow: 0 10px 30px rgba(255, 154, 158, 0.3);
}

.special-ending-message p {
    margin: 0.5rem 0;
    font-size: 1.1rem;
    font-weight: 500;
}

.heart-animation {
    font-size: 3rem;
    animation: heartBeat 1.5s ease-in-out infinite;
    margin-bottom: 1rem;
}

@keyframes heartBeat {
    0% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.1);
    }
    50% {
        transform: scale(1);
    }
    75% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* Enhanced message glow animation for ending */
@keyframes messageGlow {
    0% {
        text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3), 0 0 20px rgba(255, 255, 255, 0.5);
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
    }
    100% {
        text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3), 0 0 40px rgba(255, 255, 255, 0.8);
        box-shadow: 0 0 40px rgba(255, 255, 255, 0.6);
    }
}

/* Responsive styles for ending sequence */
@media (max-width: 768px) {
    .ending-message {
        font-size: 2rem;
        padding: 1.5rem;
        max-width: 90%;
    }
    
    .click-instruction {
        font-size: 1rem;
        padding: 0.8rem 1.5rem;
        margin-top: 1.5rem;
    }
    
    .special-ending-message {
        margin: 1rem 0;
        padding: 1.5rem;
    }
    
    .heart-animation {
        font-size: 2.5rem;
    }
}

@media (max-width: 480px) {
    .ending-message {
        font-size: 1.5rem;
        padding: 1rem;
        max-width: 95%;
    }
    
    .click-instruction {
        font-size: 0.9rem;
        padding: 0.6rem 1rem;
        margin-top: 1rem;
    }
    
    .special-ending-message p {
        font-size: 1rem;
    }
    
    .heart-animation {
        font-size: 2rem;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .game-title {
        font-size: 2.5rem;
    }
    
    .start-content, .game-over-content {
        padding: 2rem;
        margin: 0 1rem;
    }
    
    #gameCanvas {
        width: 95vw;
        height: 80vh;
        max-width: none;
        max-height: none;
    }
    
    .game-ui {
        padding: 0.5rem 1rem;
    }
    
    .message-history {
        width: 250px;
        max-height: 280px;
        top: 70px;
        left: 15px;
    }
    
    .message-history-content {
        max-height: 220px;
    }
    
    .message-history-item {
        font-size: 0.75rem;
        padding: 0.5rem 0.6rem;
    }
    
    .custom-message {
        max-width: 280px;
        min-width: 120px;
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }
    
    #messageText {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .game-title {
        font-size: 2rem;
    }
    
    .game-button {
        padding: 0.8rem 1.5rem;
        font-size: 1rem;
    }
    
    .game-over-buttons {
        flex-direction: column;
    }
    
    .message-history {
        width: 220px;
        max-height: 250px;
        top: 60px;
        left: 10px;
    }
    
    .message-history-content {
        max-height: 190px;
    }
    
    .message-history-header {
        padding: 0.6rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .message-history-item {
        font-size: 0.7rem;
        padding: 0.4rem 0.5rem;
    }
    
    .custom-message {
        top: 70px;
        padding: 0.5rem 1rem;
        max-width: 220px;
    }
    
    #messageText {
        font-size: 0.8rem;
    }
}

/* Password Screen Styles */
.password-content {
    text-align: center;
    background: rgba(255, 255, 255, 0.95);
    padding: 3rem;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    max-width: 450px;
    margin: 0 1rem;
    border: 2px solid rgba(76, 99, 210, 0.2);
}

.password-subtitle {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.password-form {
    margin-bottom: 2rem;
}

.password-input {
    width: 100%;
    max-width: 280px;
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    font-family: 'Lexend Deca', sans-serif;
    border: 2px solid #ddd;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    text-align: center;
    letter-spacing: 2px;
    transition: all 0.3s ease;
    background: #f8f9ff;
}

.password-input:focus {
    outline: none;
    border-color: #4c63d2;
    background: white;
    box-shadow: 0 0 0 3px rgba(76, 99, 210, 0.1);
}

.password-input::placeholder {
    letter-spacing: normal;
    color: #999;
}

.password-error {
    color: #e74c3c;
    font-weight: 600;
    margin-top: 1rem;
    padding: 0.5rem;
    background: rgba(231, 76, 60, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(231, 76, 60, 0.2);
}

.password-error.hidden {
    display: none;
}

/* Shake animation for incorrect password */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Responsive design for password screen */
@media (max-width: 768px) {
    .password-content {
        padding: 2rem;
        margin: 0 1rem;
    }
    
    .password-input {
        font-size: 1rem;
        padding: 0.8rem 1.2rem;
    }
}

@media (max-width: 480px) {
    .password-content {
        padding: 1.5rem;
    }
    
    .password-input {
        font-size: 0.9rem;
        padding: 0.7rem 1rem;
    }
} 
