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

body {
    font-family: 'Comic Sans MS', 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 0;
    margin: 0;
    display: block !important;
    /* Override homepage flex layout */
}

.typing-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

/* Player Name Display */
.player-name {
    cursor: pointer;
    transition: all 0.3s;
}

.player-name:hover {
    color: #667eea !important;
    transform: scale(1.05);
}

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

.name-modal.active {
    display: flex;
}

.name-modal-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
    animation: modalSlideIn 0.3s;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.name-modal-content h2 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 2rem;
}

.name-modal-content p {
    color: #666;
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.name-input {
    width: 100%;
    padding: 15px;
    font-size: 1.2rem;
    border: 3px solid #e0e0e0;
    border-radius: 10px;
    text-align: center;
    margin-bottom: 20px;
    transition: all 0.3s;
}

.name-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.name-btn {
    width: 100%;
    padding: 15px;
    font-size: 1.2rem;
    font-weight: bold;
    color: white;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

.name-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

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

/* Stats Bar */
.stats-bar {
    background: #f8f9fa;
    padding: 6px 10px;
    border-radius: 10px;
    display: flex;
    justify-content: space-around;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.stat-item {
    text-align: center;
}

.stat-label {
    font-size: 0.7rem;
    color: #666;
    display: block;
    margin-bottom: 2px;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: bold;
    color: #667eea;
}

/* Game Area - 2 Column Layout */
.game-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 10px;
    align-items: stretch;
}

/* Left Column */
.left-column {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Right Column */
.right-column {
    display: flex;
    flex-direction: column;
    gap: 0;
    height: 100%;
}

/* Target Section */
.target-section {
    background: white;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    height: 100%;
}

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

.target-word {
    font-size: 2.5rem;
    font-weight: bold;
    color: #667eea;
    margin: 10px 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.pronunciation {
    font-size: 1rem;
    color: #764ba2;
    font-style: italic;
    transition: all 0.3s;
}

.pronunciation:hover {
    color: #ff6b6b;
    transform: scale(1.1);
}

/* Input Section */
.input-section {
    background: white;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: 100%;
    justify-content: center;
}

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

.typing-input {
    width: 100%;
    padding: 10px;
    font-size: 1.2rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    text-align: center;
    transition: all 0.3s;
}

.typing-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.submit-btn {
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: bold;
    color: white;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

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

.feedback {
    text-align: center;
    font-size: 0.9rem;
    font-weight: bold;
    padding: 6px;
    border-radius: 6px;
    min-height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feedback.correct {
    background: #d4edda;
    color: #155724;
    animation: slideIn 0.3s;
}

.feedback.incorrect {
    background: #f8d7da;
    color: #721c24;
    animation: shake 0.5s;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-10px);
    }

    75% {
        transform: translateX(10px);
    }
}

/* Progress Bar */
.progress-container {
    background: #f0f0f0;
    border-radius: 6px;
    height: 10px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    width: 0%;
    transition: width 0.3s;
}

/* Keyboard Guide */
.keyboard-guide {
    background: white;
    padding: 12px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 10px;
}

.keyboard-guide h3 {
    color: #667eea;
    margin-bottom: 8px;
    font-size: 1rem;
}

.telex-rules {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 10px;
}

.rule-item {
    background: #f8f9fa;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.rule-key {
    background: #667eea;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: monospace;
    font-weight: bold;
    font-size: 0.95rem;
}

.rule-result {
    font-size: 1.3rem;
    color: #764ba2;
    font-weight: bold;
}

.telex-tones {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
}

.telex-tones p {
    margin-bottom: 12px;
    color: #667eea;
    font-size: 1.1rem;
    font-weight: bold;
}

/* 6-column grid for tone marks */
.tone-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
}

.tone-box {
    background: white;
    padding: 10px;
    border-radius: 6px;
    text-align: center;
    font-size: 1.05rem;
    color: #333;
    border: 2px solid #e0e0e0;
    transition: all 0.3s;
}

.tone-box:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.2);
}

/* Tone key styling (s, f, r, x, j, z) */
.tone-key {
    display: inline-block;
    background: #667eea;
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-family: monospace;
    font-weight: bold;
    font-size: 1.3rem;
    margin-right: 4px;
}

.tone-key.delete {
    background: #dc3545;
}

/* Tone example styling (á, à, ả, ã, ạ) */
.tone-example {
    display: inline-block;
    color: #764ba2;
    font-weight: bold;
    font-size: 1.4rem;
    margin-left: 4px;
}

.tone-delete {
    color: #dc3545;
    font-weight: bold;
}

/* Responsive */
@media (max-width: 768px) {
    .game-area {
        grid-template-columns: 1fr;
    }

    .target-word {
        font-size: 3rem;
    }

    .telex-rules {
        grid-template-columns: 1fr;
    }

    /* Tone grid: 2 columns on mobile */
    .tone-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .tone-box {
        padding: 8px;
        font-size: 0.9rem;
    }

    .tone-key {
        font-size: 1.1rem;
        padding: 4px 10px;
    }

    .tone-example {
        font-size: 1.2rem;
    }
}

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

.celebration.active {
    display: flex;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.celebration-content {
    text-align: center;
    animation: zoomIn 0.5s;
}

@keyframes zoomIn {
    from {
        transform: scale(0);
    }

    to {
        transform: scale(1);
    }
}

.celebration .emoji {
    font-size: 10rem;
    margin-bottom: 20px;
    animation: rotate 1s infinite;
}

@keyframes rotate {

    0%,
    100% {
        transform: rotate(-10deg);
    }

    50% {
        transform: rotate(10deg);
    }
}

.celebration .message {
    font-size: 4rem;
    color: white;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

/* Responsive */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }

    .target-word {
        font-size: 3.5rem;
    }

    .typing-input {
        font-size: 2rem;
    }

    .telex-rules {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Force header to stay at fixed height - Desktop */
.header .container {
    height: 35px !important;
    min-height: 35px !important;
    max-height: 35px !important;
    overflow: hidden;
    flex-wrap: nowrap !important;
}

.header .logo {
    flex-shrink: 0;
}

.header .nav {
    flex-shrink: 0;
}

.header .team-text-wrapper {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Mobile: increase header height for better visibility */
@media (max-width: 768px) {
    .header .container {
        height: 50px !important;
        min-height: 50px !important;
        max-height: 50px !important;
    }

    .header .logo-img {
        height: 40px !important;
    }

    .header .network-highlight,
    .header .team-highlight {
        font-size: 14px !important;
    }

    .header .player-name {
        font-size: 13px !important;
    }
}