* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Menlo', 'Monaco', 'Consolas', 'Liberation Mono', 'Courier New', monospace;
}

body {
    font-family: 'Menlo', 'Monaco', 'Consolas', 'Liberation Mono', 'Courier New', monospace;
    background: linear-gradient(135deg, #ADD8E6 0%, #FAF0E6 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* Monospace font for all card text */
.word, .card .word, .example-card {
    font-family: 'Menlo', 'Monaco', 'Consolas', 'Liberation Mono', 'Courier New', monospace !important;
}

.game-container {
    background: linear-gradient(135deg, #F5F5DC 0%, #DDA0DD 100%);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    padding: 30px;
    max-width: 800px;
    width: 100%;
    min-height: 700px;
    position: relative;
    display: flex;
    flex-direction: column;
}

.splash-screen {
    text-align: center;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 600px;
    width: 100%;
    box-sizing: border-box;
    position: relative;
}

.splash-screen h1 {
    color: #333;
    font-size: 4rem;
    font-weight: bold;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.simple-instructions {
    font-size: 1.3rem;
    color: #555;
    margin: 0 auto 30px auto;
    text-align: center;
    font-weight: 500;
    max-width: 400px;
    line-height: 1.4;
}

.speed-selector {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 40px;
    gap: 15px;
}

.speed-label {
    font-size: 1.1rem;
    color: #555;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.speed-slider-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.speed-slider {
    width: 200px;
    height: 8px;
    background: linear-gradient(to right, #4CAF50 0%, #FF9800 50%, #F44336 100%);
    border-radius: 10px;
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.speed-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    background: white;
    border: 3px solid #667eea;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.speed-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.speed-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: white;
    border: 3px solid #667eea;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.speed-slider::-moz-range-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.speed-labels {
    display: flex;
    justify-content: center;
    gap: 35px;
    width: 200px;
}

.speed-option {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
    text-transform: capitalize;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
    user-select: none;
}

.speed-option:hover {
    color: #333;
    background: rgba(102, 126, 234, 0.1);
}

.speed-option.active {
    color: #667eea;
    background: rgba(102, 126, 234, 0.15);
    font-weight: 700;
    transform: scale(1.05);
}


.start-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 20px 40px;
    border-radius: 30px;
    font-size: 1.4rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.start-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(102, 126, 234, 0.4);
}

.rules-link {
    color: #666;
    text-decoration: none;
    font-size: 0.9rem;
    margin-top: 15px;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: inline-block;
}

.rules-link:hover {
    color: #333;
    background: rgba(255, 255, 255, 0.3);
    text-decoration: underline;
}

/* Rules Page Styles */
.rules-page {
    padding: 20px;
    max-width: 800px;
    margin: 0 auto;
}

.rules-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 20px;
}

.rules-header h1 {
    color: #333;
    font-size: 2.5rem;
    font-weight: bold;
    margin: 0;
}

.back-link {
    color: #667eea;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.back-link:hover {
    background: rgba(102, 126, 234, 0.1);
    text-decoration: underline;
}

.rules-content {
    line-height: 1.6;
}

.rule-section {
    margin-bottom: 30px;
}

.rule-section h2 {
    color: #333;
    font-size: 1.5rem;
    margin-bottom: 15px;
    border-left: 4px solid #667eea;
    padding-left: 15px;
}

.rule-section p {
    color: #555;
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.rule-section ul {
    color: #555;
    font-size: 1.1rem;
    padding-left: 20px;
}

.rule-section li {
    margin-bottom: 8px;
}

.set-rules {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px 0;
}

.set-rule {
    background: rgba(102, 126, 234, 0.1);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    border: 2px solid rgba(102, 126, 234, 0.2);
}

.set-rule.same {
    background: rgba(76, 175, 80, 0.15);
    border: 2px solid rgba(76, 175, 80, 0.3);
}

.set-rule.different {
    background: rgba(244, 67, 54, 0.15);
    border: 2px solid rgba(244, 67, 54, 0.3);
}

.example {
    background: #f9f9f9;
    border: 2px solid #e0e0e0;
    border-radius: 15px;
    padding: 20px;
    margin: 20px 0;
}

.example h3 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1.3rem;
}

.example-cards {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 15px 0;
    flex-wrap: wrap;
}

.example-card {
    background: #E6E6FA;
    border: 2px solid #DDA0DD;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    font-size: 1.1rem;
    font-weight: normal;
    color: #333;
    width: 140px;
    min-width: 140px;
}

.example-card .style-bold {
    font-weight: 900;
}

.example-card .style-italic {
    font-style: italic;
    font-weight: 400;
}

.example-card .style-underline {
    text-decoration: underline;
    font-weight: 400;
}

.example-card small {
    font-size: 0.7rem;
    color: #666;
    font-weight: normal;
    display: block;
    margin-top: 5px;
}

.example-explanation {
    font-size: 0.95rem;
    color: #666;
    text-align: left;
    font-style: italic;
    margin-top: 10px;
    margin-left: calc((100% - (3 * 140px + 2 * 15px)) / 2);
}

.scoring-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.score-item {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.7);
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid #e0e0e0;
    gap: 10px;
}

.score-emoji {
    font-size: 1.5rem;
    min-width: 30px;
}

.score-name {
    flex: 1;
    font-weight: 600;
    color: #333;
}

.score-points {
    font-weight: bold;
    color: #667eea;
}

.rankings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin: 20px 0;
}

.rank-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(102, 126, 234, 0.1);
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.rank-name {
    font-weight: 600;
    color: #333;
}

.rank-score {
    font-weight: bold;
    color: #667eea;
    font-size: 0.9rem;
}

.rules-footer {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 2px solid #f0f0f0;
}

.play-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 1.2rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
    display: inline-block;
}

.play-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(102, 126, 234, 0.4);
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.header h1 {
    color: #333;
    font-size: 2.5rem;
    font-weight: bold;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-btn {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    border: 2px solid #e0e0e0;
    padding: 8px 16px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.header-btn:hover {
    background: rgba(255, 255, 255, 1);
    border-color: #2196F3;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.2);
}

#pauseButton.paused {
    background: rgba(76, 175, 80, 0.1);
    border-color: #4CAF50;
    color: #4CAF50;
}

#pauseButton.paused:hover {
    background: rgba(76, 175, 80, 0.2);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.stats {
    display: flex;
    gap: 24px;
    align-items: center;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.7);
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid #e8e8e8;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    min-width: 60px;
}

.stat-label {
    font-size: 0.7rem;
    color: #666;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.stat-value {
    font-size: 1.1rem;
    color: #333;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.message {
    text-align: center;
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 20px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.message.great {
    color: #4CAF50;
}

.message.nice {
    color: #2196F3;
}

.message.almost {
    color: #FF9800;
}

.grid-container {
    display: flex;
    justify-content: center;
    margin-bottom: 40px;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    max-width: 450px;
    transition: filter 0.3s ease;
}

.card-grid.paused {
    filter: blur(8px);
    pointer-events: none;
}

.player-cards.paused {
    filter: blur(8px);
}

.card {
    background: #E6E6FA;
    border: 2px solid #DDA0DD;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 120px;
    height: 80px;
    position: relative;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.card.selected {
    border-color: #007bff;
    background: #e3f2fd;
}

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

.card .word {
    font-size: 1.4rem;
    font-weight: 600;
    color: #333;
    text-align: center;
}

.card .word.style-bold {
    font-weight: 900;
}

.card .word.style-italic {
    font-style: italic;
    font-weight: 400;
}

.card .word.style-underline {
    text-decoration: underline;
    font-weight: 400;
}

.top-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 30px;
}

.player-cards {
    display: flex;
    gap: 20px;
}

.countdown-container {
    margin-top: 15px;
    width: 280px;
}

.countdown-bar-background {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.countdown-bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
    transition: width 0.1s linear;
    transform-origin: right;
}

.bottom-section {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 30px;
}

.player-cards .card {
    background: #e3f2fd;
    border-color: #007bff;
    cursor: default;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.player-cards .card:hover {
    transform: none;
    box-shadow: none;
}

.player-cards .card.countdown-pulsing {
    animation: gentle-pulse 1.5s ease-in-out infinite alternate;
}

@keyframes gentle-pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.02);
        opacity: 0.9;
    }
}

.submit-btn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.submit-btn:hover:not(:disabled) {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

.submit-btn:disabled {
    background: #cccccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.sets-history-container {
    margin-top: 30px;
    position: relative;
}


.sets-history-panel {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border: 2px solid #2196F3;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    max-width: 600px;
    width: 90vw;
    max-height: 400px;
    z-index: 1000;
}

.sets-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.sets-history-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.2rem;
}

.sets-history-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.sets-history-close:hover {
    background: #f0f0f0;
    color: #333;
}

.sets-history-content {
    max-height: 300px;
    overflow-y: auto;
}

.no-sets {
    text-align: center;
    color: #666;
    font-style: italic;
    margin: 20px 0;
}

.set-entry {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #f9f9f9;
}

.set-cards {
    display: flex;
    gap: 8px;
    flex: 1;
}

.mini-card-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.mini-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.8rem;
    min-width: 40px;
    text-align: center;
}

.mini-card-pos {
    font-size: 0.6rem;
    color: #666;
    font-weight: normal;
    text-align: center;
}

.mini-card.style-bold {
    font-weight: 900;
}

.mini-card.style-italic {
    font-style: italic;
}

.mini-card.style-underline {
    text-decoration: underline;
}

.set-result {
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 4px;
    color: white;
    font-size: 0.8rem;
}

.set-result.clean {
    background: #4CAF50;
}

.set-result.beans {
    background: #2196F3;
}

.set-result.fungus {
    background: #9C27B0;
}

.set-result.slime {
    background: #FF9800;
}

.game-over {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border: 3px solid #4CAF50;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    z-index: 1000;
}

.game-over h2 {
    color: #4CAF50;
    margin-bottom: 20px;
    font-size: 2rem;
}

.game-over p {
    margin-bottom: 15px;
    font-size: 1.2rem;
    color: #666;
}

.final-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 20px auto;
    max-width: 200px;
}

.final-emoji {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    border: 2px solid #ddd;
}

.game-stats {
    margin: 20px 0;
}

.admire-btn {
    background: #FF9800;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-right: 15px;
}

.admire-btn:hover {
    background: #F57C00;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 152, 0, 0.4);
}

.admire-board-btn {
    background: #FF9800;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.admire-board-btn:hover {
    background: #F57C00;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 152, 0, 0.4);
}

.share-results-btn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.share-results-btn:hover {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

.restart-btn {
    background: #2196F3;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.restart-btn:hover {
    background: #1976D2;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(33, 150, 243, 0.4);
}


/* Touch and Mobile Enhancements */
* {
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight on iOS */
    -webkit-touch-callout: none; /* Disable callouts on iOS */
}

/* Prevent text selection on game elements */
.card, .header-btn, .start-btn, .restart-btn, .share-results-btn, .admire-board-btn {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Improve touch targets */
.card, .header-btn, button {
    cursor: pointer;
    touch-action: manipulation; /* Prevent double-tap zoom */
}

/* Desktop button text */
@media (min-width: 769px) {
    .header-btn {
        font-size: 0.9rem;
        width: auto;
        min-width: 80px;
        padding: 8px 12px;
        flex-direction: row;
        gap: 5px;
    }
}

/* Mobile Styles */
@media (max-width: 768px) {
    body {
        padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
        align-items: flex-start;
        min-height: 100vh;
        /* Prevent horizontal scrolling */
        overflow-x: hidden;
    }
    
    /* Mobile splash screen - clean rebuild */
    .game-container {
        height: calc(100dvh - 40px);
        max-height: calc(100vh - 100px);
        min-height: 500px;
        margin: 10px 5px;
        padding: 20px;
        border-radius: 15px;
        align-items: center; /* Added for horizontal centering of children */
        overflow-y: auto;
    }
    
    .splash-screen {
        height: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 0;
    }
    
    .splash-screen h1 {
        font-size: 2rem;
        margin-bottom: 15px;
    }
    
    .simple-instructions {
        font-size: 1rem;
        margin-bottom: 15px;
        max-width: 280px;
    }
    
    .speed-selector {
        margin-bottom: 25px;
        gap: 12px;
    }
    
    .speed-label {
        font-size: 1rem;
    }
    
    .speed-slider {
        width: 180px;
        height: 6px;
    }
    
    .speed-slider::-webkit-slider-thumb {
        width: 20px;
        height: 20px;
    }
    
    .speed-slider::-moz-range-thumb {
        width: 20px;
        height: 20px;
    }
    
    .speed-labels {
        width: 180px;
        gap: 25px;
    }
    
    .speed-option {
        font-size: 0.8rem;
        padding: 3px 6px;
    }
    
    .start-btn {
        padding: 12px 30px;
        font-size: 1rem;
        min-width: 160px;
    }
    
    .rules-link {
        font-size: 0.8rem;
        margin-top: 12px;
        padding: 6px 12px;
    }
    
    /* Mobile Rules Page */
    .rules-page {
        padding: 15px;
    }
    
    .rules-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        margin-bottom: 25px;
        padding-bottom: 15px;
    }
    
    .rules-header h1 {
        font-size: 1.8rem;
        margin: 0;
    }
    
    .back-link {
        font-size: 0.9rem;
        padding: 6px 12px;
    }
    
    .rules-content {
        line-height: 1.5;
    }
    
    .rule-section {
        margin-bottom: 25px;
    }
    
    .rule-section h2 {
        font-size: 1.3rem;
        margin-bottom: 12px;
        padding-left: 12px;
        border-left-width: 3px;
    }
    
    .rule-section p {
        font-size: 1rem;
        margin-bottom: 8px;
    }
    
    .rule-section ul {
        font-size: 1rem;
        padding-left: 15px;
    }
    
    .rule-section li {
        margin-bottom: 6px;
    }
    
    .set-rules {
        grid-template-columns: 1fr;
        gap: 15px;
        margin: 15px 0;
    }
    
    .set-rule {
        padding: 15px;
        border-radius: 10px;
    }
    
    .example {
        padding: 15px;
        margin: 15px 0;
        border-radius: 12px;
    }
    
    .example h3 {
        font-size: 1.2rem;
        margin-bottom: 8px;
    }
    
    .example-cards {
        flex-direction: column;
        align-items: center;
        gap: 10px;
        margin: 12px 0;
    }
    
    .example-card {
        width: 180px;
        min-width: 180px;
        max-width: 180px;
        padding: 12px;
        font-size: 1rem;
    }
    
    .example-card small {
        font-size: 0.75rem;
        margin-top: 4px;
    }
    
    .example-explanation {
        font-size: 0.9rem;
        margin-top: 8px;
        text-align: left;
        margin-left: 0;
    }
    
    .scoring-grid {
        grid-template-columns: 1fr;
        gap: 10px;
        margin: 15px 0;
    }
    
    .score-item {
        padding: 10px 12px;
        gap: 8px;
    }
    
    .score-emoji {
        font-size: 1.3rem;
        min-width: 25px;
    }
    
    .score-name {
        font-size: 0.9rem;
    }
    
    .score-points {
        font-size: 0.9rem;
    }
    
    .rankings-grid {
        grid-template-columns: 1fr;
        gap: 8px;
        margin: 15px 0;
    }
    
    .rank-item {
        padding: 8px 12px;
    }
    
    .rank-name {
        font-size: 0.9rem;
    }
    
    .rank-score {
        font-size: 0.8rem;
    }
    
    .rules-footer {
        margin-top: 30px;
        padding-top: 15px;
    }
    
    .play-button {
        padding: 12px 25px;
        font-size: 1rem;
    }
    
    /* Game Interface Mobile */
    .header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
        margin-bottom: 4px;
    }
    
    .header h1 {
        font-size: 1.6rem;
        margin: 0;
    }
    
    .header-controls {
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: space-between;
        align-items: center;
        gap: 6px;
        padding: 0 5px;
    }
    
    .header-btn {
        padding: 4px 8px;
        font-size: 1.3rem;
        min-height: 40px;
        min-width: 50px;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(255, 255, 255, 0.9);
        border: 1px solid #ddd;
        flex-direction: column;
        width: 50px;
        height: 40px;
    }
    
    .stats {
        display: flex;
        gap: 12px;
        align-items: center;
        order: 2; /* Put stats in the middle */
    }
    
    .stat-item {
        text-align: center;
        width: 50px;
        height: 40px;
        padding: 4px 8px;
        background: rgba(255, 255, 255, 0.9);
        border: 1px solid #ddd;
        border-radius: 12px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }
    
    .stat-label {
        font-size: 0.65rem;
        margin-bottom: 1px;
        display: block;
        line-height: 1;
    }
    
    .stat-value {
        font-size: 0.85rem;
        font-weight: bold;
        display: block;
        line-height: 1;
    }
    
    /* Player Cards Mobile */
    .top-section {
        margin-bottom: 20px;
        margin-top: 0px;
    }
    
    .player-cards {
        gap: 8px;
        margin-bottom: 12px;
    }
    
    .player-cards .card {
        padding: 12px 16px;
        min-height: 50px;
        flex: 1;
        max-width: none;
    }
    
    .player-cards .card .word {
        font-size: 1.1rem;
    }
    
    /* Countdown Bar Mobile */
    .countdown-container {
        margin-top: 8px;
        margin-bottom: 12px;
    }
    
    .countdown-bar-background {
        height: 6px;
        border-radius: 3px;
    }
    
    /* Grid Mobile */
    .grid-container {
        display: flex;
        justify-content: center;
        margin-bottom: 5px;
        margin-top: 2px;
        /* Removed padding: 0 5px; */
    }
    
    .card-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
        width: 100%;
        margin: 0 auto;
    }
    
    .card-grid .card {
        padding: 8px 6px;
        min-height: 55px;
        border-radius: 10px;
        transition: all 0.2s ease;
        /* Improved touch targets */
        min-width: 85px;
        aspect-ratio: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        max-width: 95px;
    }
    
    .card-grid .card:hover {
        transform: none;
        box-shadow: none;
    }
    
    .card-grid .card:active {
        background-color: #e8f4fd;
    }
    
    /* Enhanced mobile button feedback */
    .header-btn:active,
    .start-btn:active,
    .restart-btn:active,
    .share-results-btn:active,
    .admire-board-btn:active {
        transform: scale(0.95);
        opacity: 0.8;
    }
    
    .card-grid .card .word {
        font-size: 1rem;
        line-height: 1.2;
    }
    
    .emoji-card {
        background: rgba(255, 255, 255, 0.9) !important;
    }
    
    .emoji {
        font-size: 3.6rem !important;
    }
    
    /* Ensure emoji cards fit well in mobile grid */
    .emoji-card .emoji {
        font-size: 3.2rem !important;
    }
    
    /* Message Mobile */
    .message {
        font-size: 1rem;
        padding: 6px 16px;
        margin: 8px 0;
        border-radius: 20px;
        height: 28px;
    }

    /* Game Over Modal Mobile */
    .game-over {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: calc(100vw - 40px);
        max-width: 350px;
        max-height: calc(100vh - 40px);
        overflow-y: auto;
        padding: 25px 20px;
        border-radius: 15px;
        margin: 0;
    }
    
    .game-over h2 {
        font-size: 1.5rem;
        margin-bottom: 15px;
    }
    
    .final-grid {
        max-width: 180px;
        gap: 6px;
        margin: 15px auto;
    }
    
    .final-emoji {
        font-size: 1.5rem;
        border-radius: 8px;
        border-width: 1px;
    }
    
    .game-stats {
        margin: 15px 0;
    }
    
    .game-stats p {
        font-size: 1rem;
        margin-bottom: 8px;
    }
    
    .admire-board-btn,
    .share-results-btn,
    .restart-btn {
        padding: 12px 20px;
        font-size: 0.9rem;
        margin: 8px 5px;
        min-height: 44px;
        border-radius: 22px;
        min-width: 120px;
    }
    
    /* History Panel Mobile */
    .sets-history-panel {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        max-width: none !important;
        max-height: none !important;
        border-radius: 0 !important;
        transform: none !important;
        padding: 20px;
        z-index: 1000;
        overflow-y: auto;
    }
    
    .sets-history-header {
        position: sticky;
        top: 0;
        background: white;
        padding: 10px 0 15px 0;
        margin-bottom: 15px;
        border-bottom: 1px solid #eee;
    }
    
    .sets-history-header h3 {
        font-size: 1.3rem;
    }
    
    .sets-history-close {
        font-size: 1.5rem;
        padding: 8px;
        min-height: 44px;
        min-width: 44px;
    }
    
    .set-entry {
        margin-bottom: 15px;
        padding: 12px;
        border-radius: 10px;
    }
    
    .set-cards {
        gap: 8px;
        margin-bottom: 8px;
    }
    
    .mini-card {
        font-size: 0.9rem;
        padding: 6px 10px;
    }
    
    .mini-card-pos {
        font-size: 0.7rem;
    }
}

/* Extra Small Mobile (iPhone 13 mini and smaller) */
@media (max-width: 375px) {
    .splash-screen h1 {
        font-size: 2.2rem;
    }
    
    .simple-instructions {
        font-size: 1rem;
        max-width: 250px;
    }
    
    .start-btn {
        padding: 16px 35px;
        font-size: 1rem;
        min-width: 180px;
    }
    
    .header h1 {
        font-size: 1.6rem;
    }
    
    .header-btn {
        width: 40px;
        height: 36px;
        font-size: 1.1rem;
        padding: 3px 6px;
    }
    
    .stats {
        gap: 8px;
    }
    
    .stat-item {
        width: 40px;
        height: 36px;
        padding: 3px 6px;
    }
    
    .stat-label {
        font-size: 0.6rem;
    }
    
    .stat-value {
        font-size: 0.8rem;
    }
    
    .card-grid {
        gap: 4px;
        width: 100%;
        margin: 0 auto;
    }
    
    .card-grid .card {
        padding: 6px 4px;
        min-height: 48px;
    }
    
    .card-grid .card .word {
        font-size: 0.9rem;
    }
    
    .player-cards .card {
        padding: 8px 10px;
        min-height: 40px;
    }
    
    .player-cards .card .word {
        font-size: 0.95rem;
    }
    
    .final-grid {
        max-width: 150px;
        gap: 4px;
    }
    
    .final-emoji {
        font-size: 1.3rem;
    }
    
    .game-over {
        width: calc(100vw - 30px);
        padding: 20px 15px;
    }
    
    .emoji-card .emoji {
        font-size: 2.8rem !important;
    }
}
    
    .mini-card {
        min-width: 35px;
        padding: 3px 6px;
        font-size: 0.7rem;
    }
    
    .mini-card-pos {
        font-size: 0.5rem;
    }
    
    .splash-screen h1 {
        font-size: 3rem;
    }
    
    .game-description {
        font-size: 1.1rem;
        margin-bottom: 30px;
    }
    
    .scoring-info {
        padding: 20px;
        margin-bottom: 30px;
    }
    
    .start-btn {
        padding: 15px 30px;
        font-size: 1.2rem;
    }

.emoji-card {
    background: #E6E6FA !important;
    border: 2px solid #DDA0DD !important;
    cursor: default !important;
}

.emoji-card .emoji {
    font-size: 2.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}