@charset "UTF-8";

/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    background-color: #000000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    color: #ffffff;
}

/* Game Container - Optimized for mobile */
.game-container {
    background-color: #000000;
    width: 100%;
    max-width: 400px;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile */
    padding: clamp(4px, 1.5vw, 10px);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0;
    position: relative;
    overflow: hidden;
}

/* Game Title - Hidden on mobile */
.game-title {
    display: none;
}

/* Word Display Area */
.word-display-container {
    background-color: transparent;
    padding: clamp(12px, 3vw, 18px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 0;
    position: relative;
    overflow: visible;
    flex: 1;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    background-color: rgba(0, 0, 0, 0.3);
    order: 1;
}

#word-display {
    font-size: clamp(1.6rem, 5.5vw, 2.3rem);
    font-weight: 300;
    color: #ffffff;
    text-align: center;
    width: 100%;
    min-height: clamp(40px, 8vw, 60px);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: visible;
    white-space: normal;
    word-break: break-word;
    transition: font-size 0.1s ease, opacity 0.3s ease;
    flex-shrink: 0;
}

/* Score Container */
.score-container {
    position: absolute;
    top: clamp(12px, 3vw, 18px);
    right: clamp(12px, 3vw, 18px);
    font-size: clamp(0.8rem, 2.2vw, 0.95rem);
    font-weight: 400;
    color: #a5a5a5;
    flex-shrink: 0;
    z-index: 10;
}

/* Control Buttons */
.control-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: clamp(6px, 1.5vw, 9px);
    margin-bottom: 0;
    flex-shrink: 0;
}

/* Top row of controls */
.top-controls {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: clamp(6px, 1.5vw, 9px);
    margin-bottom: 10px;
    flex-shrink: 0;
    align-items: center;
    order: 2;
}

.buttons-container {
    display: contents;
}

/* Control Button Styles */
.control-btn {
    border-radius: 8px;
    border: none;
    font-size: clamp(1.1rem, 4vw, 1.5rem);
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    padding: clamp(10px, 2.5vw, 14px);
    min-height: clamp(44px, 10vw, 56px);
}

.backspace-btn {
    background-color: #a5a5a5;
    color: #000000;
    font-size: clamp(1.6rem, 6vw, 2rem);
    aspect-ratio: 1/1;
    font-weight: 600;
}

.backspace-btn:active {
    background-color: #d0d0d0;
}

.enter-btn {
    background-color: #ff9f0a;
    color: #ffffff;
    grid-column: span 3;
    height: 100%;
    font-size: clamp(1.3rem, 5vw, 1.7rem);
    font-weight: 600;
    letter-spacing: 0.3px;
}

.enter-btn:active {
    background-color: #ffb84d;
}

.spacer {
    display: none;
}

/* Letters Grid Container */
.letters-grid-container {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 0;
    flex-shrink: 0;
    order: 3;
}

.letters-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: clamp(4px, 1.2vw, 6px);
    width: 100%;
}

.letter-ball {
    aspect-ratio: 1/1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(1.4rem, 4.5vw, 1.7rem);
    font-weight: 500;
    color: #ffffff;
    background-color: #333333;
    cursor: pointer;
    transition: background-color 0.15s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.letter-ball.selected {
    background-color: #1a1a1a;
    opacity: 0.5;
}

.letter-ball:active {
    background-color: #737373;
}

/* Message Display */
.message-display {
    font-size: clamp(1.2rem, 4vw, 1.6rem);
    color: #34c759;
    text-align: center;
    min-height: clamp(24px, 5vw, 36px);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    font-weight: 600;
}

/* Tutorial Message */
.tutorial-message {
    font-size: clamp(0.9rem, 3vw, 1.1rem);
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    animation: fadeInOut 4s ease-in-out infinite;
    font-weight: 300;
    font-style: italic;
}

@keyframes fadeInOut {
    0% { opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { opacity: 0; }
}

/* Shake animation for invalid words */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.shake {
    animation: shake 0.4s ease-in-out;
}

/* Success pulse animation */
@keyframes successPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.success-pulse {
    animation: successPulse 0.6s ease-in-out;
}

/* Confetti Canvas */
#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

/* Media Queries for larger screens */
@media (min-width: 768px) {
    .game-container {
        max-width: 500px;
        padding: clamp(10px, 3vw, 20px);
    }
}
