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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 50%, #0a0e27 100%);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    touch-action: none;
}

/* Screen Management */
.screen {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.screen.active {
    display: flex;
}

/* Start Screen */
#startScreen {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 50%, #0a0e27 100%);
}

.start-content {
    text-align: center;
    animation: fadeInScale 0.6s ease-out;
}

.game-title {
    font-size: 4.5rem;
    color: #ffffff;
    text-shadow: 0 0 40px rgba(0, 245, 255, 0.5), 0 0 80px rgba(0, 245, 255, 0.3);
    margin-bottom: 1rem;
    font-weight: 700;
    letter-spacing: 0.1em;
}

.game-subtitle {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 3rem;
    font-weight: 400;
    letter-spacing: 0.05em;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, #00f5ff 0%, #0099ff 100%);
    color: #0a0e27;
    border: none;
    padding: 1.2rem 3rem;
    font-size: 1.3rem;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(0, 245, 255, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 245, 255, 0.4);
}

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

/* Game Screen */
#gameScreen {
    flex-direction: column;
    background: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 50%, #0a0e27 100%);
}

.player-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0.5rem;
    position: relative;
    min-height: 0; /* Allow flex shrinking */
}

.player-area.player-2 {
    transform: rotate(180deg);
    transform-style: preserve-3d;
    will-change: transform;
}

.category-indicator {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 245, 255, 0.2);
    padding: 0.4rem 1rem;
    border-radius: 10px;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 600;
    color: #00f5ff;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    margin: 0.3rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.current-player-indicator {
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(139, 146, 167, 0.2);
    padding: 0.3rem 0.8rem;
    border-radius: 8px;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 500;
    color: #8b92a7;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.2);
    opacity: 0.6;
    transition: all 0.3s ease;
    margin: 0.3rem;
    letter-spacing: 0.02em;
}

.current-player-indicator.active {
    opacity: 1;
    background: rgba(0, 245, 255, 0.08);
    border-color: rgba(0, 245, 255, 0.4);
    color: #00f5ff;
}

/* Letters Grid */
.letters-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    flex: 1;
    padding: 0.3rem;
    transition: opacity 0.3s ease;
    min-height: 0; /* Allow flex shrinking */
}

.letters-grid.inactive {
    opacity: 0.4;
    pointer-events: none;
}

.letter-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(139, 146, 167, 0.15);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    aspect-ratio: 1;
    min-height: 0;
    padding: 0.3rem;
}

.letter-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0, 245, 255, 0.1), rgba(0, 153, 255, 0.05));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.letter-card:hover::before {
    opacity: 1;
}

.letter-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(0, 245, 255, 0.2), 0 0 20px rgba(0, 245, 255, 0.1);
    border-color: rgba(0, 245, 255, 0.4);
}

.letter-card:active {
    transform: translateY(-2px);
}

.letter-card.used {
    background: rgba(139, 146, 167, 0.05);
    border-color: rgba(139, 146, 167, 0.1);
    cursor: not-allowed;
    opacity: 0.3;
}

.letter-card.used:hover {
    transform: none;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

.letter {
    font-size: 2rem;
    color: #ffffff;
    font-weight: 700;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    letter-spacing: -0.02em;
}

.points {
    font-size: 1rem;
    color: #00f5ff;
    font-weight: 600;
    margin-top: 0.2rem;
    text-shadow: 0 2px 8px rgba(0, 245, 255, 0.4);
}

/* Game Center */
.game-center {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(139, 146, 167, 0.1);
    border-bottom: 1px solid rgba(139, 146, 167, 0.1);
    position: relative;
    z-index: 10;
    min-height: 100px;
    flex-shrink: 0;
}

/* Score Sides - Rotated 90° and positioned */
.score-side {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(139, 146, 167, 0.15);
    padding: 0.5rem 0.3rem;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    min-width: 35px;
    position: absolute;
}

.score-top {
    transform: rotate(-90deg);
    left: 0.5rem;
    top: 0.5rem;
}

.score-bottom {
    transform: rotate(90deg);
    right: 0.5rem;
    bottom: 0.5rem;
}

.score-label {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 600;
    margin-bottom: 0.2rem;
    letter-spacing: 0.05em;
}

.score-value {
    font-size: 1.4rem;
    color: #00f5ff;
    font-weight: 700;
    text-shadow: 0 2px 12px rgba(0, 245, 255, 0.5);
}

.timer-container {
    position: relative;
    width: 90px;
    height: 90px;
    margin: 0.5rem 0;
    cursor: pointer;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.timer-container:hover {
    transform: scale(1.05);
}

.timer-container:active {
    transform: scale(0.98);
}

.timer-container.waiting {
    animation: pulse 1.5s ease-in-out infinite;
}

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

.timer-circle {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.timer-bg {
    fill: none;
    stroke: rgba(139, 146, 167, 0.2);
    stroke-width: 6;
}

.timer-progress {
    fill: none;
    stroke: #00f5ff;
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.1s linear;
    filter: drop-shadow(0 0 8px rgba(0, 245, 255, 0.6));
}

.timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.2rem;
    color: #ffffff;
    font-weight: 700;
    text-shadow: 0 2px 16px rgba(0, 245, 255, 0.5);
    transition: opacity 0.3s ease;
}

.start-round-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.75rem;
    color: #00f5ff;
    font-weight: 600;
    text-align: center;
    text-shadow: 0 2px 12px rgba(0, 245, 255, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    line-height: 1.2;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.start-round-text.rotated {
    transform: translate(-50%, -50%) rotate(180deg);
}

.timer-container.waiting .timer-text {
    opacity: 0;
}

.timer-container.waiting .start-round-text {
    opacity: 1;
}

.current-player {
    font-size: 1.2rem;
    color: #ffffff;
    font-weight: 600;
    margin-top: 1rem;
    padding: 0.6rem 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(139, 146, 167, 0.2);
    border-radius: 12px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background: linear-gradient(135deg, #1a1f3a 0%, #0a0e27 100%);
    border: 1px solid rgba(0, 245, 255, 0.2);
    padding: 2.5rem;
    border-radius: 24px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(0, 245, 255, 0.1);
    animation: scaleIn 0.3s ease-out;
    max-width: 90%;
    backdrop-filter: blur(20px);
}

.modal-content.rotated {
    transform: rotate(180deg);
    animation: scaleInRotated 0.3s ease-out;
}

#modalTitle {
    color: #ffffff;
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.modal-info {
    margin: 1.5rem 0;
    font-size: 1.3rem;
    color: rgba(255, 255, 255, 0.7);
}

.modal-info p {
    margin: 0.5rem 0;
}

.modal-info span {
    font-weight: 700;
    color: #00f5ff;
    text-shadow: 0 2px 12px rgba(0, 245, 255, 0.4);
}

.modal-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

.btn-success {
    background: linear-gradient(135deg, #00f5a0 0%, #00d9ff 100%);
    color: #0a0e27;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.2rem;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 6px 24px rgba(0, 245, 160, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
}

.btn-danger {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: #ffffff;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.2rem;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 6px 24px rgba(255, 107, 107, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
}

.btn-success:hover,
.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 245, 255, 0.4);
}

.btn-success:active,
.btn-danger:active {
    transform: translateY(0);
}

/* Winner Screen */
#winnerScreen {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 50%, #0a0e27 100%);
}

.winner-content {
    text-align: center;
    animation: fadeInScale 0.6s ease-out;
}

.winner-title {
    font-size: 3.5rem;
    color: #ffffff;
    text-shadow: 0 0 40px rgba(0, 245, 255, 0.6), 0 0 80px rgba(0, 245, 255, 0.3);
    margin-bottom: 1rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.winner-name {
    font-size: 2.5rem;
    color: #00f5ff;
    font-weight: 700;
    margin-bottom: 2rem;
    text-shadow: 0 0 30px rgba(0, 245, 255, 0.6);
}

.final-scores {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 245, 255, 0.2);
    padding: 2rem 3rem;
    border-radius: 20px;
    margin-bottom: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.final-score {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.4rem;
    color: rgba(255, 255, 255, 0.8);
    margin: 1rem 0;
    gap: 3rem;
    font-weight: 500;
}

.final-score span:last-child {
    font-weight: 700;
    color: #00f5ff;
    font-size: 2rem;
    text-shadow: 0 2px 12px rgba(0, 245, 255, 0.5);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes scaleInRotated {
    from {
        transform: scale(0.8) rotate(180deg);
        opacity: 0;
    }
    to {
        transform: scale(1) rotate(180deg);
        opacity: 1;
    }
}

/* Responsive adjustments for small screens */
@media (max-width: 768px) {
    .game-title {
        font-size: 3rem;
    }
    
    .letter {
        font-size: 1.8rem;
    }
    
    .points {
        font-size: 0.9rem;
    }
    
    .category-indicator {
        font-size: 0.85rem;
        padding: 0.3rem 0.8rem;
    }
    
    .current-player-indicator {
        font-size: 0.7rem;
        padding: 0.25rem 0.6rem;
    }
}

@media (max-height: 700px) {
    .player-area {
        padding: 0.3rem;
    }
    
    .letters-grid {
        gap: 0.4rem;
        padding: 0.2rem;
    }
    
    .letter-card {
        padding: 0.2rem;
        border-radius: 10px;
    }
    
    .letter {
        font-size: 1.6rem;
    }
    
    .points {
        font-size: 0.85rem;
        margin-top: 0.1rem;
    }
    
    .category-indicator {
        font-size: 0.8rem;
        padding: 0.3rem 0.7rem;
        margin: 0.2rem;
    }
    
    .current-player-indicator {
        font-size: 0.65rem;
        padding: 0.2rem 0.5rem;
        margin: 0.2rem;
    }
    
    .timer-container {
        width: 80px;
        height: 80px;
        margin: 0.3rem 0;
    }
    
    .timer-text {
        font-size: 2rem;
    }
    
    .start-round-text {
        font-size: 0.65rem;
    }
    
    .game-center {
        padding: 0.3rem;
        min-height: 85px;
    }
    
    .score-side {
        padding: 0.4rem 0.25rem;
        min-width: 30px;
    }
    
    .score-top {
        left: 0.3rem;
        top: 0.3rem;
    }
    
    .score-bottom {
        right: 0.3rem;
        bottom: 0.3rem;
    }
    
    .score-label {
        font-size: 0.6rem;
    }
    
    .score-value {
        font-size: 1.2rem;
    }
}

/* Extra small screens (Samsung phones, etc.) */
@media (max-height: 650px) {
    .player-area {
        padding: 0.2rem;
    }
    
    .letters-grid {
        gap: 0.3rem;
        padding: 0.15rem;
    }
    
    .letter-card {
        padding: 0.15rem;
        border-radius: 8px;
    }
    
    .letter {
        font-size: 1.4rem;
    }
    
    .points {
        font-size: 0.75rem;
        margin-top: 0.1rem;
    }
    
    .category-indicator {
        font-size: 0.75rem;
        padding: 0.25rem 0.6rem;
        margin: 0.15rem;
        border-radius: 8px;
    }
    
    .current-player-indicator {
        font-size: 0.6rem;
        padding: 0.2rem 0.4rem;
        margin: 0.15rem;
        border-radius: 6px;
    }
    
    .timer-container {
        width: 70px;
        height: 70px;
        margin: 0.2rem 0;
    }
    
    .timer-text {
        font-size: 1.8rem;
    }
    
    .start-round-text {
        font-size: 0.6rem;
        line-height: 1.1;
    }
    
    .game-center {
        padding: 0.25rem;
        min-height: 75px;
    }
    
    .score-side {
        padding: 0.3rem 0.2rem;
        min-width: 28px;
        border-radius: 8px;
    }
    
    .score-top {
        left: 0.25rem;
        top: 0.25rem;
    }
    
    .score-bottom {
        right: 0.25rem;
        bottom: 0.25rem;
    }
    
    .score-label {
        font-size: 0.55rem;
        margin-bottom: 0.15rem;
    }
    
    .score-value {
        font-size: 1.1rem;
    }
}

/* Made with Bob */
