/* Base Styles */
body, html {
    width: 100%;
    min-height: 100%;
    background-color: #121213;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #d7dadc;
}

#game-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

h1 {
    text-align: center;
    color: #d7dadc;
    margin: 20px 0;
    font-size: 2.5rem;
}

/* Modal Styles */
.modal {
    display: block;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
}

.modal-content {
    background-color: #2a2a2b;
    margin: 5% auto;
    padding: 30px;
    border: 2px solid #888;
    border-radius: 10px;
    width: 80%;
    max-width: 500px;
    color: #d7dadc;
}

.modal-content p {
    margin: 15px 0;
}

.modal-content input[type="checkbox"] {
    margin-left: 10px;
}

.coolBtn {
    background-color: #538d4e;
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 1.1rem;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 10px;
}

.coolBtn:hover {
    background-color: #6aaa64;
}

.gameOption {
    cursor: pointer;
}

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

/* Scoreboard */
#scoreboard {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin: 20px 0;
    padding: 15px;
    background-color: #2a2a2b;
    border-radius: 8px;
}

.score-item {
    font-size: 1.2rem;
}

.player-name {
    font-weight: bold;
    color: #6aaa64;
}

.player-score {
    color: #d7dadc;
    font-size: 1.4rem;
}

/* Board Container */
#scabble-board-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 20px;
    margin: 30px 0;
}

/* Challenge Panel */
#challenge-panel {
    width: 220px;
    background-color: #2a2a2b;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    max-height: 640px;
    overflow-y: auto;
}

#challenge-panel h3 {
    color: #d7dadc;
    font-size: 1rem;
    margin: 0 0 12px 0;
    text-align: center;
    border-bottom: 1px solid #4a4a4b;
    padding-bottom: 8px;
}

.challenge-empty {
    color: #6a6a6b;
    text-align: center;
    font-style: italic;
    font-size: 0.85rem;
}

.challenge-entry {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 8px;
    margin-bottom: 6px;
    background-color: #3a3a3b;
    border-radius: 6px;
    border: 2px solid transparent;
    font-size: 0.85rem;
}

.challenge-entry.challengeable {
    border-color: #dc3545;
    cursor: pointer;
}

.challenge-entry.challengeable:hover {
    background-color: #4a2a2a;
    border-color: #ff4d5e;
}

.challenge-player {
    color: #6aaa64;
    font-weight: bold;
    font-size: 0.75rem;
    width: 100%;
}

.challenge-word {
    color: #d7dadc;
    font-weight: bold;
    flex: 1;
    text-transform: uppercase;
}

.challenge-score {
    color: #ffa500;
    font-weight: bold;
}

.challenge-btn {
    width: 100%;
    text-align: center;
    color: #dc3545;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Board Grid */
#scabble-board {
    display: grid;
    grid-template-columns: repeat(15, 40px);
    grid-template-rows: repeat(15, 40px);
    gap: 2px;
    background-color: #3a3a3b;
    padding: 5px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

/* Board Squares */
.square {
    width: 40px;
    height: 40px;
    background-color: #d2b48c;
    border: 1px solid #8b7355;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border-radius: 3px;
}

.square.drop-hover {
    background-color: #90ee90;
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.3);
}

/* Multiplier Squares */
.multiplier-TW {
    background-color: #ff0000;
}

.multiplier-DW {
    background-color: #ffb3ba;
}

.multiplier-TL {
    background-color: #0000ff;
}

.multiplier-DL {
    background-color: #bae1ff;
}

.center-square {
    background-color: #ffb3ba;
}

.multiplier-label {
    font-size: 10px;
    font-weight: bold;
    color: #ffffff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* Tiles */
.tile {
    width: 36px;
    height: 36px;
    background: linear-gradient(145deg, #fffacd, #f0e68c);
    border: 2px solid #8b7355;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: grab;
    position: relative;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    user-select: none;
}

.tile:active {
    cursor: grabbing;
}

.tile-letter {
    font-size: 20px;
    font-weight: bold;
    color: #000;
}

.tile-value {
    font-size: 9px;
    position: absolute;
    bottom: 2px;
    right: 4px;
    color: #333;
}

/* Board Tiles */
.board-tile.locked {
    background: linear-gradient(145deg, #e8dcc4, #d4c5aa);
    cursor: default;
}

.board-tile.unlocked.own-tile {
    background: linear-gradient(145deg, #90ee90, #76c776);
    border-color: #228b22;
    box-shadow: 0 0 8px rgba(34, 139, 34, 0.6);
}

.board-tile.unlocked.opp-tile {
    background: linear-gradient(145deg, #ffcccb, #ff9999);
    border-color: #8b0000;
    opacity: 0.85;
    box-shadow: 0 0 8px rgba(139, 0, 0, 0.6);
}

/* Selected for Swap */
.tile.selected-for-swap {
    background: linear-gradient(145deg, #87ceeb, #5f9ea0);
    border-color: #1e90ff;
    box-shadow: 0 0 12px rgba(30, 144, 255, 0.8);
    transform: scale(1.05);
}

/* Tile Rack */
#tile-rack-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 30px 0;
}

#tile-rack {
    display: flex;
    gap: 8px;
    padding: 15px;
    background-color: #8b7355;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    min-height: 60px;
}

#tile-rack.drop-hover {
    background-color: #a0866b;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.6);
}

#rack-controls {
    margin-top: 10px;
}

/* Game Controls */
#game-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 30px 0;
}

#game-controls button {
    padding: 12px 30px;
    font-size: 1.1rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

#submit-word {
    background-color: #538d4e;
    color: white;
}

#submit-word:hover:not(:disabled) {
    background-color: #6aaa64;
    transform: scale(1.05);
}

#submit-word:disabled {
    background-color: #4a4a4b;
    cursor: not-allowed;
    opacity: 0.5;
}

#recall-tiles {
    background-color: #ffa500;
    color: white;
}

#recall-tiles:hover {
    background-color: #ff8c00;
    transform: scale(1.05);
}

#swap-tiles {
    background-color: #17a2b8;
    color: white;
}

#swap-tiles:hover:not(:disabled) {
    background-color: #138496;
    transform: scale(1.05);
}

#swap-tiles:disabled {
    background-color: #4a4a4b;
    cursor: not-allowed;
    opacity: 0.5;
}

/* Info Display */
#info-display {
    text-align: center;
    margin: 20px 0;
    font-size: 1.1rem;
    min-height: 30px;
}

/* Blank Letter Selection Modal */
#blank-modal .modal-content {
    text-align: center;
}

#blank-letter-options {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
    margin-top: 20px;
}

#blank-letter-options button {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    font-weight: bold;
}

/* Responsive Design */
@media (max-width: 768px) {
    #scabble-board-container {
        flex-direction: column;
        align-items: center;
    }

    #challenge-panel {
        width: 100%;
        max-width: 480px;
        max-height: 200px;
    }

    #scabble-board {
        grid-template-columns: repeat(15, 30px);
        grid-template-rows: repeat(15, 30px);
    }

    .square {
        width: 30px;
        height: 30px;
    }

    .tile {
        width: 28px;
        height: 28px;
    }

    .tile-letter {
        font-size: 16px;
    }

    .tile-value {
        font-size: 7px;
    }

    .multiplier-label {
        font-size: 8px;
    }

    h1 {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    #scabble-board {
        grid-template-columns: repeat(15, 24px);
        grid-template-rows: repeat(15, 24px);
    }

    .square {
        width: 24px;
        height: 24px;
    }

    .tile {
        width: 22px;
        height: 22px;
    }

    .tile-letter {
        font-size: 12px;
    }

    .tile-value {
        font-size: 6px;
        bottom: 1px;
        right: 2px;
    }

    .multiplier-label {
        font-size: 6px;
    }

    h1 {
        font-size: 1.5rem;
    }

    #game-controls button {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
}

/* Animations */
@keyframes tile-place {
    from {
        transform: scale(0.8);
        opacity: 0.5;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.tile {
    animation: tile-place 0.2s ease-out;
}

/* Dragging styles */
.ui-draggable-dragging {
    z-index: 1000;
    opacity: 0.8;
    transform: scale(1.1);
}
