/*changed - COMPLETE VERSION with Mobile-Optimized WhatsApp Sharing*/
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #3498db;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
    padding-top: 10px;
    padding-bottom: 10px;
    overflow-y: auto;
    overscroll-behavior-y: contain;
}

.container {    
    background: rgba(168, 216, 234, 0.9);
    border-radius: 12px;
    padding: 20px;
    max-width: 750px;
    width: 100%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    position: relative;
    margin: auto;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.title-section {
    flex: 1;
}

.title-with-logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.game-logo {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    background: white;
    padding: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

h1 {
    font-size: 2.2rem;
    font-weight: bold;
    color: #2c5f7c;
    margin-bottom: 5px;
}

.tagline {
    font-size: 1rem;
    color: #2c5f7c;
    font-style: italic;
    margin: 0;
    opacity: 0.85;
}

/* Info Bar - Day Number, Timer, and Difficulty Selector */
.info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    gap: 10px;
}

.day-number {
    font-size: 1rem;
    color: #2c5f7c;
    font-weight: bold;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.7);
    border: 2px solid #2c5f7c;
    border-radius: 20px;
    white-space: nowrap;
}

.timer {
    font-size: 1.2rem;
    color: #d32f2f;
    font-weight: bold;
    padding: 8px 16px;
    background: white;
    border: 2px solid #d32f2f;
    border-radius: 20px;
    white-space: nowrap;
    flex: 1;
    text-align: center;
}

.difficulty-selector {
    display: flex;
    gap: 4px;
    background: rgba(255, 255, 255, 0.7);
    border: 2px solid #2c5f7c;
    border-radius: 20px;
    padding: 4px;
}

.difficulty-btn {
    background: transparent;
    color: #2c5f7c;
    border: none;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.difficulty-btn:hover {
    background: rgba(44, 95, 124, 0.1);
}

.difficulty-btn.active {
    background: #2c5f7c;
    color: white;
}

.header-icons {
    display: flex;
    gap: 12px;
}

.icon-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: #2c5f7c;
    transition: transform 0.2s;
}

.icon-btn svg {
    width: 26px;
    height: 26px;
}

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

/* How to Play Text Button */
.help-text-btn {
    background: #2c5f7c;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.help-text-btn:hover {
    background: #1a3a4d;
    transform: scale(1.05);
}

/* Game Board */
.game-board {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.word-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.tile-container {
    display: flex;
    gap: 8px;
    flex: 1;
}

.tile {
    background: white;
    border: 3px solid #2c5f7c;
    border-radius: 8px;
    aspect-ratio: 1;
    flex: 1;
    min-width: 40px;
    max-width: 85px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    color: #2c5f7c;
    transition: all 0.2s ease;
}

.tile:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.tile.selected {
    border-color: #ff6b35;
    border-width: 4px;
    background: #fff8f5;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.3);
}

.tile.filled {
    background: #e3f2fd;
}

.tile.correct {
    background: #c8e6c9;
    border-color: #4caf50;
    color: #2e7d32;
}

/* Flip Buttons Container */
.flip-buttons {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
}

.flip-btn {
    background: linear-gradient(135deg, #d0d0d0 0%, #e8e8e8 100%);
    border: 3px solid #555;
    border-radius: 8px;
    width: 70px;
    height: 33px;
    font-size: 1.4rem;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.flip-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.25);
}

.flip-btn:active {
    transform: translateY(0);
}

/* Active button state */
.flip-btn.active {
    background: linear-gradient(135deg, #ff6b35 0%, #ff8c5f 100%);
    color: white;
    border-color: #ff6b35;
}

/* Correct button state */
.flip-btn.correct {
    background: linear-gradient(135deg, #4caf50 0%, #66bb6a 100%);
    color: white;
    border-color: #4caf50;
}

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

/* Clues */
.clues {
    background: white;
    padding: 15px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 10px;
}

.clue-pair {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
}

.clue-pair:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.clue {
    display: flex;
    gap: 10px;
    font-size: 1.1rem;
    padding: 8px;
    border-radius: 6px;
    transition: background 0.2s;
}

.clue.active {
    background: rgba(33, 150, 243, 0.15);
    border-left: 4px solid #2196f3;
    padding-left: 12px;
}

.clue-label {
    font-weight: bold;
    color: #1565c0;
    min-width: 30px;
}

.clue-text {
    color: #1565c0;
}

/* Custom Mobile Keyboard */
.custom-keyboard {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to bottom, #e8e8e8, #f5f5f5);
    padding: 8px 4px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
    z-index: 999;
    border-top: 1px solid #d0d0d0;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-bottom: 6px;
}

.keyboard-row:last-child {
    margin-bottom: 0;
}

.key-btn {
    flex: 1;
    max-width: 36px;
    height: 42px;
    background: white;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    color: #2c5f7c;
    cursor: pointer;
    transition: all 0.1s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.key-btn:active {
    background: #e0e0e0;
    transform: scale(0.95);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.key-backspace {
    flex: 1.5;
    max-width: 54px;
    background: #ff6b35;
    color: white;
    border-color: #ff6b35;
}

.key-backspace:active {
    background: #e55a25;
}

.key-backspace svg {
    display: block;
    margin: 0 auto;
}

/* Show keyboard only on mobile */
@media (max-width: 768px) {
    .custom-keyboard {
        display: block;
    }
    
    body {
        padding-bottom: 160px;
    }
    
    .container {
        margin-bottom: 20px;
    }
}

@media (max-width: 480px) {
    .key-btn {
        max-width: 32px;
        height: 38px;
        font-size: 14px;
    }
    
    .key-backspace {
        max-width: 48px;
    }
    
    .keyboard-row {
        gap: 3px;
        margin-bottom: 5px;
    }
}

/* Footer */
.copyright {
    text-align: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px solid rgba(44, 95, 124, 0.2);
    color: #2c5f7c;
    font-size: 0.9rem;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.page-views {
    position: absolute;
    right: 0;
    font-size: 0.85rem;
    color: #2c5f7c;
    opacity: 0.7;
}

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

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Game Over Modal Styling */
.game-over-content {
    background: linear-gradient(135deg, #3498db 0%, #2c5f7c 100%);
    color: white;
    text-align: center;
    max-width: 500px;
    padding: 40px;
    animation: modalSlideIn 0.5s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.game-over-content h2 {
    color: white;
    font-size: 2.5rem;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    animation: titleBounce 0.6s ease-out 0.3s both;
}

@keyframes titleBounce {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.game-over-content p {
    color: white;
    font-size: 1.3rem;
    margin-bottom: 30px;
    line-height: 1.6;
}

/* Game Over Modal Buttons Container */
.game-over-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
}

/* WhatsApp Share Button */
.btn-share-whatsapp {
    background: #25D366;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 10px rgba(37, 211, 102, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-share-whatsapp:hover {
    background: #20BA5A;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(37, 211, 102, 0.4);
}

.btn-share-whatsapp:active {
    transform: translateY(0);
}

.btn-share-whatsapp svg {
    width: 20px;
    height: 20px;
}

.btn-close-game {
    background: #ff6b35;
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.btn-close-game:hover {
    background: #ff8c5f;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

.btn-close-game:active {
    transform: translateY(0);
}

.close-modal {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    line-height: 1;
}

.close-modal:hover {
    color: #000;
}

.modal-content h2 {
    color: #2c5f7c;
    margin-bottom: 20px;
    font-size: 1.8rem;
}

.modal-content h3 {
    color: #2c5f7c;
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 1.3rem;
}

.help-content {
    color: #333;
    line-height: 1.6;
}

.help-content p {
    margin-bottom: 15px;
}

.help-content h3 {
    color: #2c5f7c;
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 1.3rem;
}

.help-content ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

.help-content li {
    margin-bottom: 8px;
}

/* ============================================ */
/* MOBILE-OPTIMIZED SHARE MODAL STYLES */
/* ============================================ */

/* Share Modal Content */
.share-modal-content {
    max-width: 500px;
    text-align: center;
}

.share-modal-content h2 {
    color: #2c5f7c;
    margin-bottom: 20px;
    font-size: 1.8rem;
}

/* Share Preview */
.share-preview {
    margin: 20px 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background: white;
}

.share-image {
    width: 100%;
    max-width: 400px;
    height: auto;
    display: block;
    margin: 0 auto;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: default; /* Allow long-press on iOS */
}

/* Mobile Instructions */
.mobile-instructions {
    background: #e3f2fd;
    padding: 15px;
    border-radius: 8px;
    margin: 20px 0;
    border-left: 4px solid #2196f3;
    text-align: left;
}

.mobile-instructions p {
    margin: 0 0 10px 0;
    color: #1565c0;
    font-size: 1rem;
    font-weight: bold;
}

.mobile-instructions ol {
    margin: 10px 0 0 0;
    padding-left: 20px;
    color: #1565c0;
}

.mobile-instructions li {
    margin: 8px 0;
    line-height: 1.5;
}

.mobile-instructions strong {
    color: #0d47a1;
    font-weight: 700;
}

/* Share Instructions */
.share-instructions {
    background: #e3f2fd;
    padding: 12px;
    border-radius: 8px;
    margin: 15px 0;
    border-left: 4px solid #2196f3;
}

.share-instructions p {
    margin: 0;
    color: #1565c0;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Share Message Box */
.share-message-box {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    border: 2px solid #e0e0e0;
}

.message-label {
    margin: 0 0 10px 0;
    color: #666;
    font-size: 0.9rem;
    font-weight: 600;
}

#share-message-text {
    width: 100%;
    min-height: 100px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    resize: vertical;
    background: white;
    color: #333;
    margin-bottom: 10px;
}

/* Copy Message Button */
.btn-copy-message {
    background: #ff6b35;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 20px;
    font-size: 0.95rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
    max-width: 250px;
}

.btn-copy-message:hover {
    background: #e55a25;
    transform: translateY(-1px);
}

/* Save Image Button */
.btn-save-image {
    background: #2c5f7c;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 10px rgba(44, 95, 124, 0.3);
    width: 100%;
    max-width: 300px;
    margin: 10px auto;
    display: block;
}

.btn-save-image:hover {
    background: #1a3a4d;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(44, 95, 124, 0.4);
}

.btn-save-image:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Open WhatsApp Button */
.btn-open-whatsapp {
    background: #25D366;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 10px rgba(37, 211, 102, 0.3);
    width: 100%;
    max-width: 300px;
    margin: 10px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
}

.btn-open-whatsapp:hover {
    background: #20BA5A;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(37, 211, 102, 0.4);
}

.btn-open-whatsapp svg {
    width: 20px;
    height: 20px;
}

/* Close Modal Button */
.btn-close-modal {
    background: #757575;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 20px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 15px;
}

.btn-close-modal:hover {
    background: #616161;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 10px;
        padding-bottom: 160px;
        align-items: flex-start;
    }

    .container {
        padding: 20px;
        margin-top: 0;
        margin-bottom: 20px;
    }

    h1 {
        font-size: 2rem;
    }

    .game-logo {
        width: 50px;
        height: 50px;
    }

    .tagline {
        font-size: 0.9rem;
    }

    .info-bar {
        margin-bottom: 12px;
        gap: 6px;
    }

    .day-number {
        font-size: 0.8rem;
        padding: 6px 8px;
    }

    .timer {
        font-size: 1rem;
        padding: 6px 8px;
    }

    .difficulty-selector {
        gap: 3px;
        padding: 3px;
    }

    .difficulty-btn {
        font-size: 0.75rem;
        padding: 5px 8px;
    }

    .tile {
        min-width: 40px;
        max-width: 60px;
    }

    .flip-btn {
        width: 60px;
        height: 28px;
        font-size: 1.2rem;
    }

    .clue {
        font-size: 1rem;
    }

    .modal-content {
        padding: 25px;
    }

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

@media (max-width: 480px) {
    body {
        padding: 5px;
        padding-bottom: 20px;
    }

    .container {
        padding: 15px;
        margin-bottom: 20px;
    }

    h1 {
        font-size: 1.5rem;
    }

    .game-logo {
        width: 45px;
        height: 45px;
    }

    .title-with-logo {
        gap: 10px;
    }

    .tagline {
        font-size: 0.8rem;
    }

    .info-bar {
        margin-bottom: 10px;
        gap: 4px;
        flex-wrap: wrap;
    }

    .day-number {
        font-size: 0.7rem;
        padding: 5px 8px;
        flex-shrink: 0;
    }

    .timer {
        font-size: 0.85rem;
        padding: 5px 8px;
        min-width: 0;
        flex: 1 1 auto;
    }

    .difficulty-selector {
        gap: 2px;
        padding: 2px;
        flex-shrink: 0;
    }
    
    .difficulty-btn {
        font-size: 0.65rem;
        padding: 4px 6px;
        border-radius: 12px;
    }

    .help-text-btn {
        font-size: 0.85rem;
        padding: 6px 12px;
    }

    .tile-container {
        gap: 5px;
    }

    .tile {
        min-width: 30px;
        max-width: 50px;
        border-width: 2px;
    }

    .word-row {
        gap: 10px;
    }

    .flip-btn {
        width: 50px;
        height: 24px;
        font-size: 1rem;
        border-width: 2px;
    }

    .flip-buttons {
        gap: 3px;
    }

    .clue {
        font-size: 0.9rem;
    }

    .clues {
        padding: 15px;
    }

    .modal-content {
        padding: 20px;
        width: 95%;
    }

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

    .help-content {
        font-size: 0.95rem;
    }

    .game-over-content {
        padding: 30px 20px;
    }

    .game-over-content h2 {
        font-size: 2rem;
    }

    .game-over-content p {
        font-size: 1.1rem;
    }

    .game-over-buttons {
        gap: 12px;
    }
    
    .btn-share-whatsapp {
        padding: 12px 25px;
        font-size: 0.95rem;
    }
    
    .btn-share-whatsapp svg {
        width: 18px;
        height: 18px;
    }
    
    .btn-close-game {
        padding: 12px 30px;
        font-size: 1rem;
    }

    .copyright {
        flex-direction: column;
        gap: 8px;
    }

    .page-views {
        position: static;
    }

    /* Share Modal Mobile Responsive */
    .share-modal-content {
        padding: 20px 15px;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .share-modal-content h2 {
        font-size: 1.5rem;
    }
    
    .share-image {
        max-width: 100%;
    }
    
    .mobile-instructions {
        padding: 12px;
    }
    
    .mobile-instructions p {
        font-size: 0.95rem;
    }
    
    .mobile-instructions li {
        font-size: 0.9rem;
    }
    
    #share-message-text {
        min-height: 80px;
        font-size: 0.85rem;
    }
    
    .btn-save-image,
    .btn-open-whatsapp,
    .btn-copy-message {
        padding: 12px 20px;
        font-size: 0.9rem;
    }
}
