/* Professional and Modern Scrabble CSS */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700&family=Playfair+Display:wght@700&display=swap');

body {
    background-color: #f4f1ea;
    font-family: 'Montserrat', sans-serif;
    color: #3d3d3d;
}

.container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 20px;
}

h1 {
    font-family: 'Playfair Display', serif;
    text-align: center;
    font-size: 3.5rem;
    margin-bottom: 30px;
    color: #5a4a42;
}

/* Game Setup UI */
#game-setup {
    max-width: 400px;
    margin: 40px auto;
    padding: 30px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    text-align: center;
}

#game-setup input, #game-setup button {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border-radius: 8px;
    border: 1px solid #ddd;
    box-sizing: border-box; /* Important for padding and width */
    font-size: 1rem;
}

#game-setup button {
    background-color: #8b4513;
    color: white;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#game-setup button:hover {
    background-color: #a0522d;
}

#game-id-display {
    margin-top: 15px;
    font-weight: 600;
    color: #3d3d3d;
}


/* Main Game Area */
#scrabble-game {
    display: flex;
    justify-content: center;
    gap: 40px;
    align-items: flex-start;
}

#game-board {
    display: grid;
    grid-template-columns: repeat(15, 42px);
    grid-template-rows: repeat(15, 42px);
    border: 5px solid #c4a785;
    background-color: #dcd3c4;
    padding: 10px;
    gap: 3px;
    border-radius: 10px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
}

.board-tile {
    width: 42px;
    height: 42px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    background-color: #f5e8d7;
    color: #9c8c78;
    border-radius: 4px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.3s ease;
}

.board-tile.drag-over {
    background-color: #e8dcc8;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.2);
}

@keyframes place-anim {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.tile-placed-anim {
    animation: place-anim 0.3s ease-out;
}

@keyframes shake-anim {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.tile-invalid-anim {
    animation: shake-anim 0.3s ease-in-out;
}

/* Premium Square Styling */
.board-tile.tw { background-color: #d9534f; color: white; }
.board-tile.dw, .board-tile.★ { background-color: #f0ad4e; color: white; }
.board-tile.tl { background-color: #5bc0de; color: white; }
.board-tile.dl { background-color: #92c3d2; color: white; }
.board-tile.★ { font-size: 1.5rem; }

/* Placed Tile Styling */
.rack-tile, .board-tile.placed, .board-tile.provisional {
    background-color: #fdf5e6;
    color: #5a4a42;
    border: 1px solid #dcd3c4;
    font-size: 1.5rem;
    font-weight: 700;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.15);
    text-transform: uppercase;
}
.board-tile.provisional {
    box-shadow: 0 0 10px 3px #f0ad4e; /* Highlight for provisionally placed tiles */
}


.game-info {
    width: 320px;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

#scoreboard, #game-controls, #player-rack-container {
    background-color: #fff;
    border: 1px solid #ddd;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}

#scoreboard h2, #player-rack-container h2 {
    text-align: center;
    margin-top: 0;
    margin-bottom: 15px;
    font-family: 'Playfair Display', serif;
    color: #5a4a42;
}

#player-rack {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    background-color: #c4a785;
    border-radius: 8px;
    min-height: 70px;
    border: 2px solid #a78e6f;
}

.rack-tile {
    width: 45px;
    height: 45px;
    margin: 0 3px;
    cursor: grab;
}

.rack-tile:active {
    cursor: grabbing;
}

.rack-tile.selected {
    border-color: #f0ad4e;
    transform: translateY(-5px);
    box-shadow: 0 0 10px #f0ad4e;
}

#game-controls {
    display: flex;
    justify-content: space-around;
}

#game-controls button {
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

#game-controls button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

#play-word { background-color: #5cb85c; color: white; }
#pass-turn { background-color: #f0ad4e; color: white; }
#shuffle-rack { background-color: #5bc0de; color: white; }

#message-area {
    margin-top: 20px;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    min-height: 24px;
    background-color: #fff;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}
.message-error { background-color: #d9534f; color: white; }
.message-success { background-color: #5cb85c; color: white; }
.message-info { background-color: #5bc0de; color: white; }

#how-to-play {
    margin-bottom: 1rem;
    padding: 1rem;
    background-color: #f4f1ea;
    border-radius: 8px;
    border: 1px solid #dcd3c4;
    text-align: left;
}

#how-to-play h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    color: #8b4513;
}

#how-to-play p {
    margin: 0.5rem 0;
    line-height: 1.6;
}

#how-to-play strong {
    color: #5a4a42;
    font-weight: 700;
}
