/*changed - COMPLETE VERSION with Mobile-Optimized WhatsApp Sharing + TIMER WIDTH FIX + IPAD FIXES*/
* {
    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;
    min-width: 180px;
    font-variant-numeric: tabular-nums;
}

.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, #d8d8d8, #e8e8e8);
    padding: 10px 6px;
    padding-bottom: max(20px, env(safe-area-inset-bottom, 20px));  /* Added more bottom padding */
    margin-bottom: 12px;  /* NEW: Lifts keyboard away from bottom edge */
    box-shadow: 0 -3px 15px rgba(0, 0, 0, 0.25);
    z-index: 999;
    border-top: 1px solid #b0b0b0;
    border-radius: 12px 12px 0 0;  /* Rounded top corners */
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 7px;  /* Slightly increased gap */
    margin-bottom: 7px;
}

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

.key-btn {
    flex: 1;
    max-width: 48px;  /* Increased from 42px */
    height: 50px;  /* Increased from 44px */
    background: linear-gradient(180deg, #ffffff 0%, #f5f5f5 50%, #e8e8e8 100%);
    border: 1px solid #999;
    border-radius: 6px;
    font-size: 19px;  /* Increased from 17px */
    font-weight: 700;
    color: #2c5f7c;
    cursor: pointer;
    transition: all 0.1s ease;
    box-shadow: 
        0 2px 0 0 #bbb,
        0 3px 6px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    position: relative;
    top: 0;
}

.key-btn:hover {
    background: linear-gradient(180deg, #f8f8f8 0%, #eeeeee 50%, #e0e0e0 100%);
}

.key-btn:active {
    background: linear-gradient(180deg, #e0e0e0 0%, #d8d8d8 50%, #d0d0d0 100%);
    box-shadow: 
        0 1px 0 0 #bbb,
        0 2px 4px rgba(0, 0, 0, 0.2),
        inset 0 2px 4px rgba(0, 0, 0, 0.15);
    transform: translateY(2px);
    top: 2px;
}

.key-btn.pressed {
    background: linear-gradient(180deg, #e0e0e0 0%, #d8d8d8 50%, #d0d0d0 100%);
    box-shadow: 
        0 1px 0 0 #bbb,
        0 2px 4px rgba(0, 0, 0, 0.2),
        inset 0 2px 4px rgba(0, 0, 0, 0.15);
    transform: translateY(2px);
    top: 2px;
}

.key-backspace {
    flex: 1.5;
    max-width: 72px;  /* Increased from 63px */
    background: linear-gradient(180deg, #ff8a5f 0%, #ff7347 50%, #ff6b35 100%);
    color: white;
    border-color: #e55a25;
    box-shadow: 
        0 2px 0 0 #c44a1f,
        0 3px 6px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.key-backspace:hover {
    background: linear-gradient(180deg, #ff9570 0%, #ff7e52 50%, #ff7040 100%);
}

.key-backspace:active,
.key-backspace.pressed {
    background: linear-gradient(180deg, #e55a25 0%, #d44920 50%, #c44a1f 100%);
    box-shadow: 
        0 1px 0 0 #c44a1f,
        0 2px 4px rgba(0, 0, 0, 0.25),
        inset 0 2px 4px rgba(0, 0, 0, 0.2);
    transform: translateY(2px);
    top: 2px;
}

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

/* Show keyboard only on mobile and tablet */
@media (max-width: 1024px) {
    .custom-keyboard {
        display: block;
    }
}

/* 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;
    gap: 15px;
    flex-wrap: wrap;
}

.copyright-main {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

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

.app-version {
    position: absolute;
    left: 0;
    font-size: 0.85rem;
    color: #2c5f7c;
    opacity: 0.7;
}

/* Creator Info Icon Styles */
.creator-info-icon {
    background: none;
    background-color: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    margin: 0;
    margin-left: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    transition: transform 0.2s, opacity 0.2s;
    opacity: 1;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.creator-info-icon:hover {
    transform: scale(1.15);
    opacity: 0.85;
}

.creator-info-icon:active {
    transform: scale(1.05);
}

.creator-info-icon:focus {
    outline: 2px solid rgba(255, 107, 53, 0.3);
    outline-offset: 2px;
    border-radius: 50%;
}

.creator-info-icon svg {
    width: 20px;
    height: 20px;
    display: block;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

/* 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;
}

/* ============================================ */
/* FLOATING SHARE BUTTON STYLES */
/* ============================================ */

.floating-share-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: #25D366;
    border: none;
    border-radius: 50%;
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 998;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px;
    animation: floatIn 0.5s ease-out;
}

.floating-share-btn svg {
    width: 28px;
    height: 28px;
    fill: white;
}

.floating-share-text {
    color: white;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.floating-share-btn:hover {
    background: #20BA5A;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 25px rgba(37, 211, 102, 0.5);
}

.floating-share-btn:active {
    transform: translateY(-1px) scale(1.02);
}

/* Pulse animation to draw attention */
@keyframes floatIn {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.8);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.floating-share-btn.pulse {
    animation: pulse 2s infinite, floatIn 0.5s ease-out;
}

/* ============================================ */
/* FLOATING STOP BUTTON STYLES (FOR FUN MODE) */
/* ============================================ */

.floating-stop-btn {
    position: fixed;
    bottom: 110px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: #d32f2f;
    border: none;
    border-radius: 50%;
    box-shadow: 0 4px 20px rgba(211, 47, 47, 0.4);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px;
    animation: floatIn 0.5s ease-out;
}

.floating-stop-btn svg {
    width: 24px;
    height: 24px;
    fill: white;
}

.floating-stop-text {
    color: white;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.floating-stop-btn:hover {
    background: #b71c1c;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 25px rgba(211, 47, 47, 0.5);
}

.floating-stop-btn:active {
    transform: translateY(-1px) scale(1.02);
}

.floating-stop-btn.pulse {
    animation: pulse-stop 2s infinite, floatIn 0.5s ease-out;
}

@keyframes pulse-stop {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(211, 47, 47, 0.4);
    }
    50% {
        box-shadow: 0 4px 25px rgba(211, 47, 47, 0.7), 0 0 0 8px rgba(211, 47, 47, 0.2);
    }
}

/* Hide floating buttons when modal is open */
body:has(.modal[style*="display: flex"]) .floating-share-btn,
body:has(.modal[style*="display: flex"]) .floating-stop-btn {
    opacity: 0;
    pointer-events: none;
}

/* ============================================ */
/* LEGAL MODAL STYLES */
/* ============================================ */

.legal-modal-content {
    max-width: 800px;
    max-height: 85vh;
    overflow-y: auto;
}

.loading-legal {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 1.1rem;
}

.legal-modal-content .legal-content {
    padding: 0;
}

.legal-modal-content h1 {
    color: #2c5f7c;
    margin-bottom: 10px;
    font-size: 2rem;
}

.legal-modal-content h2 {
    color: #2c5f7c;
    margin-top: 30px;
    margin-bottom: 15px;
    font-size: 1.4rem;
}

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

.legal-modal-content p {
    margin-bottom: 15px;
    color: #333;
    line-height: 1.6;
}

.legal-modal-content ul,
.legal-modal-content ol {
    margin-bottom: 15px;
    margin-left: 20px;
}

.legal-modal-content li {
    margin-bottom: 8px;
    line-height: 1.5;
}

.legal-modal-content .last-updated {
    color: #666;
    font-style: italic;
    margin-bottom: 30px;
    font-size: 0.9rem;
}

.legal-modal-content .highlight-box {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    padding: 15px;
    margin: 20px 0;
    border-radius: 4px;
}

/* ============================================ */
/* CREATOR PROFILE MODAL STYLES */
/* ============================================ */

.creator-modal-content {
    max-width: 600px;
    max-height: 85vh;
    background: linear-gradient(135deg, #A8D8EA 0%, #9AC8DB 100%);
    padding: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.creator-card {
    background: white;
    margin: 15px;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.creator-photo {
    width: 150px;
    height: 150px;
    margin: 0 auto 20px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.creator-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.creator-name {
    color: #2c5f7c;
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.8rem;
}

.creator-bio {
    color: #333;
    line-height: 1.6;
}

.creator-bio p {
    margin-bottom: 12px;
}

.creator-bio strong {
    color: #2c5f7c;
}

.creator-contact {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 15px 0;
}

.creator-email,
.creator-whatsapp {
    background: #e3f2fd;
    padding: 12px;
    border-radius: 6px;
    margin: 0;
}

.creator-email {
    border-left: 4px solid #2196f3;
}

.creator-whatsapp {
    border-left: 4px solid #25D366;
}

.creator-email a,
.creator-whatsapp a {
    color: #1565c0;
    text-decoration: none;
    font-weight: 600;
}

.creator-whatsapp a {
    color: #128C7E;
}

.creator-email a:hover,
.creator-whatsapp a:hover {
    text-decoration: underline;
}

.creator-thanks {
    background: #f5f5f5;
    padding: 12px;
    border-radius: 6px;
    margin-top: 15px;
    font-style: italic;
    color: #555;
}

.creator-thanks p {
    margin-bottom: 0;
}

/* ============================================ */
/* SHARE MODAL FOOTER STYLES */
/* ============================================ */

.share-footer {
    margin: 20px 0 10px 0;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 8px;
    text-align: center;
}

.share-footer p {
    margin: 0;
    color: #2c5f7c;
    font-size: 0.95rem;
    font-weight: 600;
}

/* ============================================ */
/* FLOATING INSTALL APP BUTTON STYLES */
/* ============================================ */

.floating-install-btn {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 60px;
    height: 60px;
    background: #2c5f7c;
    border: none;
    border-radius: 50%;
    box-shadow: 0 4px 20px rgba(44, 95, 124, 0.4);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 998;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px;
    animation: floatIn 0.5s ease-out;
}

.floating-install-btn svg {
    width: 28px;
    height: 28px;
    fill: white;
}

.floating-install-text {
    color: white;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.floating-install-btn:hover {
    background: #1a3a4d;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 25px rgba(44, 95, 124, 0.5);
}

.floating-install-btn:active {
    transform: translateY(-1px) scale(1.02);
}

/* Pulse animation to draw attention */
.floating-install-btn.pulse {
    animation: pulse-install 2s infinite, floatIn 0.5s ease-out;
}

@keyframes pulse-install {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(44, 95, 124, 0.4);
    }
    50% {
        box-shadow: 0 4px 25px rgba(44, 95, 124, 0.7), 0 0 0 8px rgba(44, 95, 124, 0.2);
    }
}

/* Hide install button when modal is open */
body:has(.modal[style*="display: flex"]) .floating-install-btn {
    opacity: 0;
    pointer-events: none;
}

/* ============================================ */
/* IPAD SPECIFIC ADJUSTMENTS (768px - 1024px) */
/* ============================================ */

@media (min-width: 769px) and (max-width: 1024px) {
    /* Give more bottom padding when on iPad for keyboard */
    body {
        padding-bottom: 300px;
    }

    /* Adjust floating buttons to be visible above mobile keyboard on iPad */
    .floating-share-btn {
        bottom: 320px;
    }
    
    .floating-stop-btn {
        bottom: 400px;
    }
    
    .floating-install-btn {
        bottom: 240px;
    }
}

/* ============================================ */
/* RESPONSIVE DESIGN - MOBILE AND SMALL TABLETS */
/* ============================================ */

@media (max-width: 768px) {
    body {
        padding: 10px;
        padding-bottom: 280px;  /* Increased to allow scrolling to footer */
        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: 0.9rem;
        padding: 6px 8px;
        min-width: 140px;
        max-width: 140px;
        flex: 0 0 auto;
    }

    .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;
    }

    .creator-info-icon {
        margin-left: 10px;
    }
    
    .creator-info-icon svg {
        width: 19px;
        height: 19px;
    }
    
    .copyright {
        gap: 10px;
    }

    .floating-install-btn {
        bottom: 220px;
        left: 20px;
        width: 56px;
        height: 56px;
    }
    
    .floating-install-btn svg {
        width: 26px;
        height: 26px;
    }
    
    .floating-install-text {
        font-size: 8px;
    }

    .floating-share-btn {
        bottom: 300px;
        right: 20px;
        width: 56px;
        height: 56px;
    }
    
    .floating-share-btn svg {
        width: 26px;
        height: 26px;
    }
    
    .floating-share-text {
        font-size: 8px;
    }

    .floating-stop-btn {
        bottom: 370px;
        right: 20px;
        width: 56px;
        height: 56px;
    }
    
    .floating-stop-btn svg {
        width: 22px;
        height: 22px;
    }
    
    .floating-stop-text {
        font-size: 8px;
    }

    .creator-modal-content {
        max-width: 95%;
        max-height: 90vh;
    }
    
    .creator-card {
        margin: 12px;
        padding: 18px;
    }
    
    .creator-photo {
        width: 120px;
        height: 120px;
    }
    
    .creator-name {
        font-size: 1.5rem;
    }
    
    .creator-bio {
        font-size: 0.95rem;
    }

    .legal-modal-content {
        max-height: 90vh;
        padding: 20px;
    }
    
    .legal-modal-content h1 {
        font-size: 1.6rem;
    }
    
    .legal-modal-content h2 {
        font-size: 1.3rem;
    }
    
    .legal-modal-content h3 {
        font-size: 1.1rem;
    }

    .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;
    }

    .share-footer {
        margin: 15px 0 10px 0;
        padding: 12px;
    }
    
    .share-footer p {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 5px;
        padding-bottom: 270px;  /* Increased to accommodate keyboard and allow footer visibility */
    }

    .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: 3px;
        flex-wrap: nowrap;
    }

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

    .timer {
        font-size: 0.75rem;
        padding: 5px 6px;
        min-width: 110px;
        max-width: 110px;
        flex: 0 0 auto;
    }

    .difficulty-selector {
        gap: 2px;
        padding: 2px;
        flex-shrink: 0;
    }
    
    .difficulty-btn {
        font-size: 0.6rem;
        padding: 4px 5px;
        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;
    }
    
    .copyright-main {
        display: inline-flex;
    }
    
    .page-views {
        position: static;
    }

    .app-version {
        position: static;
    }

    .creator-info-icon {
        margin-left: 8px;
    }
    
    .creator-info-icon svg {
        width: 18px;
        height: 18px;
    }

    .floating-install-btn {
        bottom: 210px;
        left: 15px;
        width: 52px;
        height: 52px;
    }
    
    .floating-install-btn svg {
        width: 24px;
        height: 24px;
    }
    
    .floating-install-text {
        font-size: 7px;
    }

    .floating-share-btn {
        bottom: 290px;
        right: 15px;
        width: 52px;
        height: 52px;
    }
    
    .floating-share-btn svg {
        width: 24px;
        height: 24px;
    }
    
    .floating-share-text {
        font-size: 7px;
    }

    .floating-stop-btn {
        bottom: 360px;
        right: 15px;
        width: 52px;
        height: 52px;
    }
    
    .floating-stop-btn svg {
        width: 20px;
        height: 20px;
    }
    
    .floating-stop-text {
        font-size: 7px;
    }

    .creator-card {
        margin: 10px;
        padding: 15px;
    }
    
    .creator-photo {
        width: 100px;
        height: 100px;
    }
    
    .creator-name {
        font-size: 1.3rem;
    }
    
    .creator-bio {
        font-size: 0.9rem;
    }
    
    .creator-email {
        padding: 10px;
        font-size: 0.9rem;
    }
    
    .creator-thanks {
        padding: 10px;
        font-size: 0.85rem;
    }

    .legal-modal-content {
        padding: 15px;
        width: 95%;
    }
    
    .legal-modal-content h1 {
        font-size: 1.4rem;
    }
    
    .legal-modal-content h2 {
        font-size: 1.2rem;
    }
    
    .legal-modal-content h3 {
        font-size: 1rem;
    }
    
    .legal-modal-content p,
    .legal-modal-content li {
        font-size: 0.9rem;
    }

    .key-btn {
        max-width: 44px;  /* Increased from 38px */
        height: 48px;  /* Increased from 42px */
        font-size: 18px;
    }
    
    .key-backspace {
        max-width: 66px;  /* Increased from 57px */
    }
    
    .keyboard-row {
        gap: 6px;
        margin-bottom: 6px;
    }
    
    .custom-keyboard {
        padding: 8px 4px;
        padding-bottom: max(18px, env(safe-area-inset-bottom, 18px));
        margin-bottom: 10px;
    }
}

@media (max-width: 360px) {
    .key-btn {
        max-width: 36px;  /* Increased from 32px */
        height: 42px;  /* Increased from 38px */
        font-size: 16px;
    }
    
    .key-backspace {
        max-width: 54px;
    }
    
    .keyboard-row {
        gap: 5px;
        margin-bottom: 5px;
    }
}

/* iPhone specific */
@media only screen 
  and (min-device-width: 375px) 
  and (max-device-width: 932px) 
  and (-webkit-min-device-pixel-ratio: 2) {
    .custom-keyboard {
        display: block;
    }
}

/* ============================================ */
/* STATISTICS MODAL STYLES */
/* ============================================ */

.stats-modal-content {
    max-width: 700px;
    max-height: 85vh;
    overflow-y: auto;
}

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

.stats-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
}

.stats-tab-btn {
    flex: 1;
    background: transparent;
    color: #666;
    border: none;
    padding: 10px 15px;
    border-radius: 8px 8px 0 0;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

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

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

.stats-tab-content {
    display: none;
}

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

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.stat-box {
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

.stat-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.stat-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: #2c5f7c;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
}

/* ============================================ */
/* RESPONSIVE STATS STYLES */
/* ============================================ */

@media (max-width: 768px) {
    .stats-modal-content {
        max-width: 95%;
        padding: 20px 15px;
    }
    
    .stats-modal-content h2 {
        font-size: 1.5rem;
    }
    
    .stats-tabs {
        gap: 4px;
    }
    
    .stats-tab-btn {
        padding: 8px 10px;
        font-size: 0.85rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .stat-box {
        padding: 15px;
    }
    
    .stat-value {
        font-size: 1.8rem;
    }
}

@media (max-width: 480px) {
    .stats-modal-content {
        padding: 15px;
        width: 95%;
    }
    
    .stats-modal-content h2 {
        font-size: 1.3rem;
        margin-bottom: 15px;
    }
    
    .stats-tabs {
        gap: 3px;
        padding-bottom: 8px;
    }
    
    .stats-tab-btn {
        padding: 6px 8px;
        font-size: 0.8rem;
    }
    
    .stat-box {
        padding: 12px;
    }
    
    .stat-icon {
        font-size: 1.5rem;
        margin-bottom: 8px;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .stat-label {
        font-size: 0.85rem;
    }
}




