* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    color: #333;
    padding-top: 20px;
}

.game-container {
    width: 100%;
    max-width: 1200px;
    min-height: 100vh;
    position: relative;
    padding: 20px;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    overflow-y: auto;
    padding-top: 20px;
}

.screen.active {
    opacity: 1;
    visibility: visible;
}

/* Welcome Screen */
.welcome-content {
    text-align: center;
    background: rgba(255, 255, 255, 0.95);
    padding: 50px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
}

.game-title {
    font-size: 4rem;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.game-subtitle {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 30px;
}

/* Quick Instructions Box */
.quick-instructions {
    background: rgba(102, 126, 234, 0.08);
    border: 1px solid rgba(102, 126, 234, 0.15);
    border-radius: 12px;
    padding: 15px 20px;
    margin-bottom: 25px;
    text-align: left;
}

.quick-instructions h3 {
    color: #667eea;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 10px;
    text-align: center;
}

.instruction-steps {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 5px 0;
}

.step-number {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.step-text {
    color: #333;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.3;
}

.player-input {
    margin-bottom: 30px;
}

.menu-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.copyright {
    margin-top: 30px;
    font-size: 0.7rem;
    color: #999;
    text-align: center;
    opacity: 0.8;
}

.player-input input {
    width: 300px;
    padding: 15px 20px;
    font-size: 1.1rem;
    border: 2px solid #ddd;
    border-radius: 50px;
    margin-bottom: 20px;
    transition: border-color 0.3s ease;
    outline: none;
}

.player-input input:focus {
    border-color: #667eea;
}

/* Buttons */
.btn {
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 10px;
    min-width: 150px;
    font-family: 'Poppins', sans-serif;
}

.btn.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn.secondary {
    background: rgba(255, 255, 255, 0.2);
    color: #333;
    border: 2px solid #ddd;
}

.btn.secondary:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.btn.danger {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    color: white;
}

.btn.danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(255, 107, 107, 0.3);
}

/* Game Screen */
#game-screen {
    flex-direction: column;
    align-items: stretch;
    padding: 20px;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.95);
    padding: 20px 30px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.game-info {
    display: flex;
    gap: 30px;
    align-items: center;
}

.game-info > div {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.label {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 5px;
}

.value {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
}

.timer-container {
    text-align: center;
}

.timer-label {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 5px;
}

.timer {
    font-size: 2rem;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 10px;
}

.timer.warning {
    color: #f39c12;
    animation: pulse 1s infinite;
}

.timer.danger {
    color: #e74c3c;
    animation: pulse 0.5s infinite;
}

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

.timer-bar {
    width: 200px;
    height: 8px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

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

.timer-progress.warning {
    background: linear-gradient(90deg, #f39c12 0%, #e67e22 100%);
}

.timer-progress.danger {
    background: linear-gradient(90deg, #e74c3c 0%, #c0392b 100%);
}

.game-area {
    display: flex;
    gap: 20px;
    flex: 1;
    min-height: 500px;
}

.shards-container {
    flex: 2;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    position: relative;
    height: 100%;
    overflow: hidden;
}

.shard {
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
    color: white;
    padding: 15px 10px;
    border-radius: 10px;
    text-align: center;
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    user-select: none;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.shard:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.shard.selected {
    background: linear-gradient(135deg, #fdcb6e 0%, #e17055 100%);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 10px 25px rgba(253, 203, 110, 0.4);
}

.shard.matched {
    background: linear-gradient(135deg, #00b894 0%, #00a085 100%);
    animation: matchEffect 0.6s ease;
}

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

.matched-words {
    flex: 1;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.matched-words h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.matched-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.matched-word {
    background: linear-gradient(135deg, #00b894 0%, #00a085 100%);
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    font-weight: 600;
    text-align: center;
    animation: slideIn 0.5s ease;
}

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

.game-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

/* Leaderboard Screen */
.leaderboard-content {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    text-align: center;
    max-width: 600px;
    width: 100%;
}

.leaderboard-content h2 {
    color: #667eea;
    margin-bottom: 30px;
    font-size: 2.5rem;
}

.leaderboard-list {
    margin-bottom: 20px;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    margin-bottom: 10px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 10px;
    transition: background 0.3s ease;
}

.leaderboard-item:hover {
    background: rgba(102, 126, 234, 0.2);
}

.leaderboard-item.top-3 {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: #333;
    font-weight: 600;
}

.leaderboard-rank {
    font-weight: 700;
    font-size: 1.2rem;
    min-width: 40px;
}

.leaderboard-name {
    flex: 1;
    text-align: left;
    margin-left: 20px;
}

.leaderboard-score {
    font-weight: 600;
    color: #667eea;
}

/* Game Over Screen */
.game-over-content {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    text-align: center;
    max-width: 500px;
    width: 100%;
}

.game-over-content h2 {
    color: #e74c3c;
    margin-bottom: 30px;
    font-size: 2.5rem;
}

.final-stats {
    margin-bottom: 30px;
}

.stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.stat-label {
    color: #666;
}

.stat-value {
    font-weight: 600;
    color: #333;
    font-size: 1.2rem;
}

.high-score-message {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: #333;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 30px;
    font-weight: 600;
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { box-shadow: 0 0 20px rgba(255, 215, 0, 0.3); }
    to { box-shadow: 0 0 30px rgba(255, 215, 0, 0.6); }
}

.game-over-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Pause Screen */
.pause-content {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    text-align: center;
}

.pause-content h2 {
    color: #667eea;
    margin-bottom: 30px;
    font-size: 2.5rem;
}

.pause-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Loading Screen */
.loading-content {
    text-align: center;
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    width: 100%;
}

.spinner {
    width: 80px;
    height: 80px;
    border: 8px solid rgba(255, 255, 255, 0.3);
    border-top: 8px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 30px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-content p {
    font-size: 1.2rem;
    font-weight: 600;
}

/* Tutorial Screen */
.tutorial-content {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    max-width: 800px;
    width: 100%;
    text-align: center;
}

.tutorial-content h2 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 2.2rem;
}

.tutorial-subtitle {
    color: #666;
    font-size: 1.1rem;
    margin-bottom: 30px;
}

.tutorial-example {
    margin-bottom: 30px;
}

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

.tutorial-shards-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 8px;
    max-width: 600px;
    margin: 0 auto 20px;
    padding: 15px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 15px;
    border: 2px dashed rgba(102, 126, 234, 0.2);
}

.tutorial-shard {
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
    color: white;
    padding: 15px 10px;
    border-radius: 10px;
    text-align: center;
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    user-select: none;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tutorial-shard:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.tutorial-shard.selected {
    background: linear-gradient(135deg, #fdcb6e 0%, #e17055 100%);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 10px 25px rgba(253, 203, 110, 0.4);
}

.tutorial-shard.matched {
    background: linear-gradient(135deg, #00b894 0%, #00a085 100%);
    animation: matchEffect 0.6s ease;
}

.tutorial-shard.tutorial-placeholder {
    background: rgba(102, 126, 234, 0.1);
    border: 2px dashed rgba(102, 126, 234, 0.3);
    color: rgba(102, 126, 234, 0.4);
    cursor: default;
    font-size: 0.8rem;
    font-weight: 400;
}

.tutorial-shard.tutorial-placeholder:hover {
    transform: none;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.tutorial-shard.tutorial-placeholder::before {
    content: "•••";
    opacity: 0.3;
}

.tutorial-instruction {
    margin: 20px 0;
    padding: 15px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.tutorial-instruction p {
    color: #333;
    font-size: 1.1rem;
    margin: 0;
}

.tutorial-matched {
    margin-top: 20px;
    padding: 15px;
    background: rgba(0, 184, 148, 0.1);
    border-radius: 10px;
    min-height: 60px;
}

.tutorial-matched h4 {
    color: #00b894;
    margin-bottom: 10px;
}

.tutorial-matched-word {
    background: linear-gradient(135deg, #00b894 0%, #00a085 100%);
    color: white;
    padding: 8px 15px;
    border-radius: 8px;
    font-weight: 600;
    display: inline-block;
    margin: 5px;
    animation: slideIn 0.5s ease;
}

.tutorial-animation {
    margin: 20px 0;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.combining-word {
    font-size: 2rem;
    font-weight: 700;
    color: #667eea;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.8s ease;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.combining-word.show {
    opacity: 1;
    transform: scale(1);
    animation: wordCombine 1.5s ease;
}

@keyframes wordCombine {
    0% { 
        opacity: 0;
        transform: scale(0.5) rotate(-5deg);
    }
    50% { 
        opacity: 1;
        transform: scale(1.2) rotate(2deg);
    }
    100% { 
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

.tutorial-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Countdown Screen */
.countdown-content {
    text-align: center;
    color: white;
}

.countdown-content h2 {
    font-size: 3rem;
    margin-bottom: 30px;
    color: white;
}

.countdown-number {
    font-size: 8rem;
    font-weight: 700;
    color: #667eea;
    text-shadow: 0 0 30px rgba(102, 126, 234, 0.5);
    margin-bottom: 20px;
    animation: countdownPulse 1s ease-in-out;
}

@keyframes countdownPulse {
    0% { transform: scale(0.8); opacity: 0.5; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

.countdown-message {
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.8);
}

/* Loading Screen Tips */
.tip-container {
    margin-top: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    backdrop-filter: blur(10px);
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.tip-container h3 {
    color: white;
    margin-bottom: 10px;
    font-size: 1.3rem;
}

.tip-container p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    line-height: 1.4;
    margin: 0;
}

/* Instructions Screen */
.instructions-content {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.instructions-content h2 {
    color: #667eea;
    margin-bottom: 30px;
    font-size: 2.2rem;
    text-align: center;
}

.instructions-list {
    margin-bottom: 30px;
}

.instruction-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 25px;
    padding: 20px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 15px;
    border-left: 4px solid #667eea;
    transition: all 0.3s ease;
}

.instruction-item:hover {
    background: rgba(102, 126, 234, 0.1);
    transform: translateX(5px);
}

.instruction-icon {
    font-size: 2rem;
    margin-right: 20px;
    flex-shrink: 0;
    width: 60px;
    text-align: center;
}

.instruction-text {
    flex: 1;
}

.instruction-text h3 {
    color: #333;
    margin-bottom: 8px;
    font-size: 1.3rem;
    font-weight: 600;
}

.instruction-text p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 0;
}

.instruction-text strong {
    color: #667eea;
    font-weight: 600;
}

.instructions-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Game Choice Screen */
.game-choice-content {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    text-align: center;
    max-width: 500px;
    width: 100%;
}

.game-choice-content h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 2.2rem;
}

.choice-subtitle {
    color: #666;
    font-size: 1.1rem;
    margin-bottom: 30px;
}

.choice-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.choice-buttons .btn {
    width: 100%;
    padding: 20px;
    font-size: 1.2rem;
}

.back-btn {
    margin-top: 20px;
}

/* Feedback Screen */
.feedback-content {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    text-align: center;
    max-width: 600px;
    width: 100%;
}

.feedback-content h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 2.2rem;
}

.feedback-subtitle {
    color: #666;
    font-size: 1.1rem;
    margin-bottom: 30px;
}

.feedback-form {
    margin-bottom: 20px;
}

.feedback-input-group {
    margin-bottom: 20px;
    text-align: left;
}

.feedback-input-group label {
    display: block;
    color: #333;
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.feedback-input-group textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    resize: vertical;
    min-height: 120px;
    transition: border-color 0.3s ease;
    outline: none;
}

.feedback-input-group textarea:focus {
    border-color: #667eea;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.2);
}

.character-count {
    text-align: right;
    margin-top: 5px;
    font-size: 0.9rem;
    color: #666;
}

.feedback-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.feedback-status {
    margin-top: 20px;
    padding: 15px;
    border-radius: 10px;
    font-weight: 600;
    display: none;
}

.feedback-status.success {
    background: linear-gradient(135deg, #00b894 0%, #00a085 100%);
    color: white;
    display: block;
    position: relative;
}

.feedback-status.success::before {
    content: "✓";
    font-size: 2rem;
    font-weight: bold;
    margin-right: 10px;
    animation: tickAnimation 0.6s ease-in-out;
}

@keyframes tickAnimation {
    0% { 
        transform: scale(0) rotate(-45deg);
        opacity: 0;
    }
    50% { 
        transform: scale(1.2) rotate(-45deg);
        opacity: 1;
    }
    100% { 
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.feedback-status.error {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    color: white;
    display: block;
}

.feedback-status.loading {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    display: block;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 0;
        margin: 0;
        overflow: hidden;
        align-items: flex-start;
        padding-top: 0;
        height: 100vh;
        position: fixed;
        width: 100vw;
    }
    
    .game-container {
        padding: 0;
        height: 100vh;
        max-width: 100vw;
        width: 100vw;
        overflow: hidden;
        position: fixed;
        top: 0;
        left: 0;
    }
    
    .screen {
        padding: 10px 5px;
        width: 100vw;
        height: 100vh;
        overflow-y: auto;
        align-items: flex-start;
        padding-top: 10px;
        position: fixed;
        top: 0;
        left: 0;
    }
    
    /* Allow scrolling only for tutorial and game screens */
    #tutorial-screen {
        overflow-y: auto;
        height: 100vh;
        padding-bottom: 60px;
    }
    
    #game-screen {
        overflow-y: auto;
    }
    
    /* Disable scrolling for home, leaderboard, game over screens */
    #welcome-screen,
    #leaderboard-screen,
    #game-over-screen,
    #pause-screen,
    #game-choice-screen,
    #loading-screen,
    #countdown-screen {
        overflow: hidden;
        height: 100vh;
        position: fixed;
        top: 0;
        left: 0;
    }
    
    /* Allow scrolling for feedback screen */
    #feedback-screen {
        overflow-y: auto;
        height: 100vh;
        padding-bottom: 60px;
    }
    
    .game-title {
        font-size: 2.2rem;
        margin-bottom: 10px;
    }
    
    .welcome-content {
        padding: 20px 10px;
        margin: 0;
        border-radius: 0;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        justify-content: center;
        width: 100%;
        box-sizing: border-box;
    }
    
    .game-subtitle {
        font-size: 0.95rem;
        margin-bottom: 20px;
    }
    
    .player-input {
        margin-bottom: 20px;
    }
    
    .player-input input {
        width: 90%;
        max-width: 300px;
        padding: 12px 15px;
        font-size: 1rem;
        margin-bottom: 15px;
        border-radius: 25px;
    }
    
    .menu-buttons {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        width: 100%;
        max-width: 400px;
        margin: 0 auto;
    }
    
    .instructions-content {
        padding: 15px 10px;
        margin: 0;
        max-height: none;
        border-radius: 0;
        width: 100%;
        box-sizing: border-box;
        overflow-y: visible;
    }
    
    .instructions-content h2 {
        font-size: 1.5rem;
        margin-bottom: 15px;
    }
    
    .instruction-item {
        flex-direction: column;
        text-align: center;
        padding: 12px;
        margin-bottom: 12px;
        border-radius: 8px;
    }
    
    .instruction-icon {
        margin-right: 0;
        margin-bottom: 8px;
        width: auto;
        font-size: 1.3rem;
    }
    
    .instruction-text h3 {
        font-size: 1rem;
        margin-bottom: 4px;
    }
    
    .instruction-text p {
        font-size: 0.85rem;
        line-height: 1.3;
    }
    
    .instructions-controls {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        margin-top: 15px;
        max-width: 400px;
        margin-left: auto;
        margin-right: auto;
    }
    
    /* Game Screen Mobile Optimizations */
    #game-screen {
        padding: 0;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        overflow-y: auto;
    }
    
    .game-header {
        flex-direction: column;
        gap: 8px;
        text-align: center;
        padding: 8px;
        margin-bottom: 5px;
        border-radius: 0;
        flex-shrink: 0;
    }
    
    .game-info {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        width: 100%;
    }
    
    .game-info > div {
        min-width: auto;
        padding: 4px;
    }
    
    .label {
        font-size: 0.7rem;
        margin-bottom: 2px;
    }
    
    .value {
        font-size: 0.9rem;
    }
    
    .timer-container {
        grid-column: 1 / -1;
        margin-top: 5px;
    }
    
    .timer {
        font-size: 1.3rem;
        margin-bottom: 5px;
    }
    
    .timer-bar {
        width: 100px;
        height: 4px;
        margin: 0 auto;
    }
    
    .game-area {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 5px;
        min-height: 0;
        overflow: hidden;
    }
    
    .shards-container {
        flex: 1;
        position: relative;
        padding: 8px;
        border-radius: 8px;
        min-height: 0;
        width: 100%; /* Take full width since matched words is hidden */
        overflow: hidden;
    }
    
    .shard {
        padding: 6px 4px; /* Reduced vertical padding */
        font-size: 0.75rem;
        min-height: auto;
        height: 100%;
        border-radius: 6px;
        font-weight: 700;
        display: flex;
        align-items: center;
        justify-content: center;
        word-break: break-all;
        hyphens: auto;
    }
    
    .matched-words {
        display: none; /* Hide matched words box on mobile */
    }
    
    .matched-words h3 {
        font-size: 0.85rem;
        margin-bottom: 5px;
    }
    
    .matched-word {
        padding: 4px 8px;
        font-size: 0.75rem;
        border-radius: 4px;
        margin-bottom: 3px;
    }
    
    .game-controls {
        flex-shrink: 0;
        margin-top: 8px;
        gap: 12px;
        padding: 8px;
        display: flex !important;
        justify-content: center;
        max-width: 300px;
        margin-left: auto;
        margin-right: auto;
        position: fixed;
        bottom: 10px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 1000;
        background: rgba(255, 255, 255, 0.95);
        border-radius: 25px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
        -webkit-backdrop-filter: blur(10px);
        backdrop-filter: blur(10px);
    }
    
    .btn {
        min-width: auto;
        width: 100%;
        padding: 12px 16px;
        font-size: 0.9rem;
        margin: 0;
        border-radius: 25px;
        min-height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 600;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        transition: all 0.2s ease;
    }
    
    .btn:active {
        transform: translateY(1px);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    }
    
    /* Other screens mobile optimization */
    .leaderboard-content,
    .game-over-content,
    .pause-content {
        padding: 20px 10px;
        margin: 0;
        border-radius: 0;
        min-height: auto;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        width: 100%;
        box-sizing: border-box;
    }
    
    /* Loading screen mobile optimization */
    .loading-content {
        padding: 20px 10px;
        margin: 0;
        width: 100%;
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        min-height: 100vh;
    }
    
    .loading-content .spinner {
        width: 40px;
        height: 40px;
        border-width: 4px;
        margin-bottom: 15px;
    }
    
    .loading-content p {
        font-size: 1rem;
        margin-bottom: 20px;
    }
    
    .tip-container {
        max-width: 90%;
        padding: 15px;
        margin-top: 20px;
    }
    
    .tip-container h3 {
        font-size: 1.1rem;
        margin-bottom: 8px;
    }
    
    .tip-container p {
        font-size: 0.9rem;
        line-height: 1.3;
    }
    
    .leaderboard-content h2,
    .game-over-content h2,
    .pause-content h2 {
        font-size: 1.6rem;
        margin-bottom: 15px;
    }
    
    .leaderboard-item {
        padding: 10px 12px;
        margin-bottom: 6px;
        border-radius: 6px;
        font-size: 0.85rem;
    }
    
    .leaderboard-rank {
        font-size: 0.9rem;
        min-width: 30px;
    }
    
    .leaderboard-name {
        margin-left: 10px;
        font-size: 0.85rem;
    }
    
    .leaderboard-score {
        font-size: 0.85rem;
    }
    
    .stat {
        padding: 6px 0;
    }
    
    .stat-label {
        font-size: 0.85rem;
    }
    
    .stat-value {
        font-size: 0.95rem;
    }
    
    .game-over-controls,
    .pause-controls {
        gap: 6px;
        width: 100%;
    }
    
    .game-over-controls,
    .pause-controls {
        display: grid;
        grid-template-columns: 1fr;
        gap: 12px;
        max-width: 280px;
        margin: 0 auto;
    }
    
    .game-over-controls .btn,
    .pause-controls .btn {
        width: 100%;
        margin: 0;
        min-height: 48px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .game-title {
        font-size: 1.8rem;
    }
    
    .game-subtitle {
        font-size: 0.85rem;
    }
    
    .welcome-content {
        padding: 20px 10px;
        margin: 0;
        border-radius: 0;
        min-height: auto;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        width: 100%;
        box-sizing: border-box;
    }
    
    .instruction-text h3 {
        font-size: 0.95rem;
    }
    
    .instruction-text p {
        font-size: 0.8rem;
    }
    
    .game-header {
        padding: 6px;
    }
    
    .label {
        font-size: 0.65rem;
    }
    
    .value {
        font-size: 0.8rem;
    }
    
    .timer {
        font-size: 1.1rem;
    }
    
    .timer-bar {
        width: 80px;
    }
    
    .shards-container {
        gap: 1px 6px; /* Even more reduced vertical gap */
        padding: 4px;
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        grid-template-rows: repeat(4, 1fr);
        height: calc(100vh - 200px); /* Fixed height to eliminate blue space */
        max-height: 400px;
    }
    
    .shard {
        padding: 2px 2px; /* Minimal vertical padding */
        font-size: 0.75rem;
        min-height: 35px; /* Even smaller minimum height */
        height: 100%;
        max-height: 80px;
    }
    
    .matched-words {
        max-height: 100px;
        padding: 6px;
    }
    
    .matched-words h3 {
        font-size: 0.8rem;
    }
    
    .matched-word {
        padding: 3px 6px;
        font-size: 0.7rem;
    }
    
    .btn {
        padding: 10px 12px;
        font-size: 0.85rem;
        min-height: 44px;
    }
    
    .leaderboard-content h2,
    .game-over-content h2,
    .pause-content h2 {
        font-size: 1.4rem;
    }
    
    .menu-buttons {
        gap: 10px;
        max-width: 350px;
    }
    
    .game-controls {
        gap: 10px;
        max-width: 280px;
    }
    
    .instructions-controls {
        gap: 10px;
        max-width: 350px;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    .shard {
        min-height: 65px;
        padding: 16px 8px;
        font-size: 0.9rem;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }
    
    .shard:hover {
        transform: none;
    }
    
    .shard:active {
        transform: scale(0.95);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    }
    
    .btn {
        min-height: 48px;
        padding: 14px 20px;
        font-size: 0.95rem;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }
    
    .btn:hover {
        transform: none;
    }
    
    .btn:active {
        transform: translateY(1px);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    }
    
    .player-input input {
        min-height: 48px;
        padding: 14px 20px;
        font-size: 1rem;
    }
}

/* Additional mobile UX improvements */
@media (max-width: 768px) {
    .btn.primary {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    }
    
    .btn.secondary {
        background: rgba(255, 255, 255, 0.9);
        border: 2px solid #667eea;
        color: #667eea;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }
    
    .btn.danger {
        background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
        box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
    }
    
    /* Enhanced shard interactions */
    .shard.selected {
        transform: scale(1.05);
        box-shadow: 0 6px 20px rgba(253, 203, 110, 0.4);
        z-index: 10;
        position: relative;
    }
    
    .shard.matched {
        transform: scale(1.02);
        box-shadow: 0 4px 15px rgba(0, 184, 148, 0.4);
    }
    
    /* Improved input styling */
    .player-input input {
        border: 3px solid #ddd;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        transition: all 0.3s ease;
    }
    
    .player-input input:focus {
        border-color: #667eea;
        box-shadow: 0 4px 20px rgba(102, 126, 234, 0.2);
        transform: translateY(-1px);
    }
}
