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

body {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    background: #ffffff;
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

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

/* Landing Page */
.landing-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
}

.game-title {
    font-size: 48px;
    font-weight: 700;
    letter-spacing: 0.2em;
    margin-bottom: 60px;
    color: #444451; 
}

/* Mobile title sizing */
@media (max-width: 600px) {
    .game-title {
        font-size: 36px;
        letter-spacing: 0.15em;
    }
}

@media (max-width: 400px) {
    .game-title {
        font-size: 28px;
        letter-spacing: 0.1em;
    }
}

.button-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.btn {
    padding: 12px 48px;
    font-size: 16px;
    border: 2px solid #444451;
    background: white;
    color: #444451;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    min-width: 200px;
    text-decoration: none;
    text-align: center;
    display: center;
}

.btn:hover {
    background: #444451;
    color: white;
}

.btn:active {
    transform: scale(0.98);
}

/* Settings Page */
.settings-page {
    padding: 40px;
    max-width: 500px;
    margin: 0 auto;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.settings-title {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 40px;
    text-align: center;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.setting-item {
    margin-bottom: 30px;
}

.setting-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #444451;
}

.setting-value {
    font-weight: 700;
    color: #538d4e;
}

.slider {
    width: 100%;
    height: 4px;
    background: #d3d6da;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    background: #538d4e;
    cursor: pointer;
    border-radius: 50%;
}

.slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: #538d4e;
    cursor: pointer;
    border-radius: 50%;
    border: none;
}

.settings-buttons {
    display: flex;
    gap: 15px;
    margin-top: 10px;
    justify-content: center;
}

.preset-buttons {
    display: flex;
    gap: 10px;
    margin-top: 30px;
    justify-content: center;
}

.preset-btn {
    background: #538d4e;
    color: white;
    border-color: #538d4e;
    font-size: 14px;
    padding: 10px 10px;
}

.preset-btn:hover {
    background: #4a7c47;
    border-color: #4a7c47;
    color: white;
}

.btn-secondary {    
    background: #787c7e;
    color: white;
    border-color: #787c7e;
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn-secondary:hover {
    background: #5a5e60;
    border-color: #5a5e60;
}

/* Game Page */
.game-page {
    height: 100vh;
    padding: 15px;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow:auto;
}

.game-header {
    text-align: center;
    margin-bottom: 15px;
    position: relative;
}

.end-game-btn {
    position: absolute;
    top: 0;
    right: 0;
    padding: 8px 16px;
    background: #787c7e;
    color: white;
    border: none;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: background 0.15s ease;
}

.end-game-btn:hover {
    background: #5a5e60;
}

.help-btn {
    position: absolute;
    top: 0;
    left: 0;
    padding: 8px 16px;
    background: #538d4e;
    color: white;
    border: none;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: background 0.15s ease;
}

.help-btn:hover {
    background: #4a7c47;
}

.timer {
    font-size: 36px;
    font-weight: 700;
    color: #444451;
    margin-bottom: 10px;
}

.time-bar {
    width: 100%;
    max-width: 400px;
    height: 8px;
    background: #d3d6da;
    margin: 0 auto;
    border-radius: 4px;
    overflow: hidden;
}

.time-bar-fill {
    height: 100%;
    background: #538d4e;
    transition: width 1s linear;
}

.game-content {
    display: flex;
    flex: 1;
    gap: 20px;
    align-items: stretch;
}

.player-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 15px;
    background: #f8f8f8;
    border: 1px solid #d3d6da;
}

.player-title {
    font-size: 18px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 10px;
}

.score {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 15px;
}

.player-collection {
    font-size: 14px;
    color: #787c7e;
    margin-bottom: 10px;
}

.word-list {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.word-container {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    background: white;
    border: 1px solid #d3d6da;
    cursor: pointer;
    transition: all 0.15s ease;
}

.word-container:hover {
    border-color: #878a8c;
}

.word-container.opponent-word:hover {
    background: #fff3e0;
}

.word-tile {
    width: 36px;
    height: 36px;
    background: white;
    border: 2px solid #d3d6da;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 16px;
    font-weight: 700;
    color: #444451;
    text-transform: uppercase;
    transition: all 0.15s ease;
    cursor: pointer;
}

.word-tile.selected {
    background: #c9b458;
    color: white;
    border-color: #c9b458;
}

.word-tile.stolen {
    opacity: 0.5;
    text-decoration: line-through;
}

.word-points {
    margin-left: auto;
    padding: 0 8px;
    font-size: 12px;
    color: #538d4e;
    font-weight: 700;
}

.word-points.steal-bonus {
    color: #c9b458;
}

.selected-preview {
    min-height: 50px;
    padding: 8px;
    background: #fff;
    border: 2px dashed #d3d6da;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 4px;
}

.clear-btn {
    padding: 4px 12px;
    background: #787c7e;
    color: white;
    border: none;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: background 0.15s ease;
    margin-bottom: 5px;
}

.clear-btn:hover {
    background: #5a5e60;
}

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

.preview-tile {
    width: 30px;
    height: 30px;
    background: #538d4e;
    color: white;
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
}

.preview-tile.from-opponent {
    background: #c9b458;
}

.create-btn {
    padding: 12px;
    background: #538d4e;
    color: white;
    border: none;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: background 0.15s ease;
}

.create-btn:hover {
    background: #4a7c47;
}

.create-btn:disabled {
    background: #787c7e;
    cursor: not-allowed;
}

.tile-pool {
    flex: 2;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-content: center;
    gap: 8px;
    padding: 20px;
    min-height: 200px;
    background: white;
    border: 2px solid #d3d6da;
}

.game-tile {
    width: 48px;
    height: 48px;
    background: white;
    border: 2px solid #d3d6da;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    font-weight: 700;
    color: #444451;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.15s ease;
}

.game-tile:hover {
    transform: scale(1.05);
    border-color: #878a8c;
}

.game-tile.selected {
    background: #538d4e;
    color: white;
    border-color: #538d4e;
}

/* Custom Alert Modal Styles */
.alert-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

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

.alert-modal-content {
    background: white;
    border: 2px solid #d3d6da;
    padding: 30px;
    padding-top: 40px;
    min-width: 300px;
    max-width: 500px;
    position: relative;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    animation: slideIn 0.2s ease;
}

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

.alert-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 24px;
    color: #787c7e;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease;
}

.alert-close-btn:hover {
    color: #121213;
}

.alert-message {
    font-size: 16px;
    color: #121213;
    line-height: 1.5;
    margin-bottom: 20px;
    text-align: center;
    white-space: pre-line;
}

.alert-ok-btn {
    display: block;
    margin: 0 auto;
    padding: 10px 30px;
    background: white;
    border: 2px solid #121213;
    color: #121213;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.15s ease;
}

.alert-ok-btn:hover {
    background: #121213;
    color: white;
}

.alert-ok-btn:active {
    transform: scale(0.98);
}

.tutorial-content {
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.tutorial-content .alert-message {
    text-align: left;
    max-height: 60vh;
    overflow-y: auto;
}

/* Cooperative Mode Styles */
.cooperative-layout {
    flex-direction: row;
    gap: 20px;
}

.cooperative-player-area {
    flex: 1;
    max-width: none;
    margin: 0;
    width: auto;
}

.cooperative-layout .tile-pool {
    order: 0;
    flex: 1;
    min-height: 150px;
}

/* Tile Counter */
.tile-counter {
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    margin-top: 5px;
    transition: color 0.3s ease;
}

.tile-counter.safe {
    color: #538d4e;
}

.tile-counter.warning {
    color: #c9b458;
}

.tile-counter.danger {
    color: #ff6b6b;
}

/* Portrait mobile: stack vertically */
@media (max-width: 700px) and (orientation: portrait) {
    .cooperative-layout {
        flex-direction: column;
    }
    
    .cooperative-layout .tile-pool {
        order: -1;
        min-height: 120px;
    }
    
    .cooperative-player-area {
        max-width: 600px;
        margin: 0 auto;
        width: 100%;
    }
}

/* Small landscape devices */
@media (max-height: 600px) and (orientation: landscape) {
    .cooperative-layout .tile-pool {
        min-height: 100px;
    }
}

/* Responsive adjustments */
@media (max-height: 600px) {
    .game-title { font-size: 36px; }
    .timer { font-size: 28px; }
    .game-tile { width: 40px; height: 40px; font-size: 18px; }
    .word-tile { width: 30px; height: 30px; font-size: 14px; }
}

@media (max-width: 700px) {
    .game-content { 
        flex-direction: column; 
    }
    .player-area { 
        flex: none; 
        height: auto; 
    }
    .tile-pool { 
        min-height: 120px; 
        order: -1;
    }
}