:root { 
    --cell-size: min(40px, calc((100vw - 40px) / 17));  /* Responsive cell size */
}

body { 
    font-family: system-ui; 
    display: flex; 
    flex-direction: row;
    gap: 2rem;
    padding: 20px;
    margin: 0;
    min-height: 100vh;
    background: #f5f5f5;
}

@media (max-width: 768px) {
    body {
        flex-direction: column;
    }
}

#board { 
    display: grid; 
    gap: 2px; 
    background: #225588; 
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    /* Make board size responsive and include gaps in total width */
    width: calc(15 * var(--cell-size) + 28px);  /* 28px = 14 gaps * 2px + 20px padding */
    height: calc(15 * var(--cell-size) + 28px);
    grid-template-columns: repeat(15, var(--cell-size));
    grid-template-rows: repeat(15, var(--cell-size));
}

.cell { 
    width: var(--cell-size); 
    height: var(--cell-size);
    border: 1px solid #666; 
    display: flex;
    justify-content: center; 
    align-items: center;
    background: #f0f0f0; 
    font-size: 0.8em;
    position: relative;
    box-shadow: inset 0 0 2px rgba(0,0,0,0.1);
    margin: 0;
}

.cell.dragover {
    background: #e0e0ff;
    box-shadow: inset 0 0 4px rgba(0,0,255,0.3);
}

/* Bonus styling */
.bonus[data-bonus^="2W"],
.bonus[data-bonus^="3W"] {
    background: #ffebf3;  /* Light pink for word multipliers */
}

.bonus[data-bonus^="2L"],
.bonus[data-bonus^="3L"] {
    background: #e6f3ff;  /* Light blue for letter multipliers */
}

/* Tile styling */
.tile { 
    background-color: #ffe; 
    border: 1px solid #ca8;
    cursor: pointer; 
    user-select: none;
    width: calc(var(--cell-size) - 8px);
    height: calc(var(--cell-size) - 8px);
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    box-shadow: none;
    transition: transform 0.1s ease-in-out;
    position: relative;
    touch-action: none;
    z-index: 100;
}

.tile span:first-child {
    font-size: 1.2em;
    line-height: 1;
    position: relative;
    z-index: 101;
}

.tile .points {
    position: absolute;
    bottom: 1px;
    right: 2px;
    font-size: 0.55em;
    font-weight: normal;
    color: #666;
    background-color: transparent;
    padding: 0;
    border-radius: 0;
    min-width: 0;
    text-align: right;
    box-shadow: none;
    z-index: 102;
    border: none;
}

.tile.placed {
    cursor: default;
    background-color: #ffe;
    box-shadow: none;
    border-color: #ca8;
    opacity: 1.0;
}

.tile.selected {
    background: #ffa;
    box-shadow: 0 0 4px rgba(0,0,0,0.4);
    transform: scale(1.1);
}

/* Ensure tiles are above bonus markers */
.cell .tile {
    position: relative;
    z-index: 2;
    background-color: #ffe;
    border: 1px solid #ca8;
}

/* Add a solid background to completely cover the cell background */
.cell.has-tile {
    background-image: none !important; /* Remove background image when tile is present */
}

#controls { 
    display: flex; 
    flex-direction: column; 
    gap: 1rem;
    min-width: 200px;
    position: sticky;
    top: 20px;
}

#status {
    background: #225588;
    color: white;
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    min-height: 60px;
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#score {
    font-size: 1.4em;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

#message {
    font-size: 0.9em;
    opacity: 0.9;
}

#tray {
    display: flex;
    gap: 4px;
    padding: 15px;
    background: #fff;
    border-radius: 8px;
    min-height: var(--cell-size);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    flex-wrap: wrap;
}

.button-group {
    display: flex;
    gap: 8px;
}

button {
    padding: 10px 20px;
    font-size: 1em;
    cursor: pointer;
    background: white;
    border: none;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
    flex: 1;
}

button:hover {
    background: #f0f0f0;
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0,0,0,0.15);
}

button:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

@media (max-width: 768px) {
    .tile {
        width: calc(var(--cell-size) + 4px);  /* Slightly bigger touch target */
        height: calc(var(--cell-size) + 4px);
    }
    
    .tile span:first-child {
        font-size: 1.6em;  /* Bigger letters on mobile */
    }
    
    .tile .points {
        font-size: 0.9em;  /* Bigger points on mobile */
        min-width: 12px;
        height: 12px;
        padding: 2px;
    }

    #tray {
        padding: 20px;  /* More padding for better touch interaction */
        gap: 8px;  /* More space between tiles */
    }
}

.github-link {
    margin-top: 1rem;
    text-align: center;
}

.github-link a {
    color: #225588;
    text-decoration: none;
    font-size: 0.9em;
    display: inline-block;
    padding: 5px 10px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.github-link a:hover {
    background-color: #f0f0f0;
    text-decoration: underline;
}

.logo {
    margin-top: 1.5rem;
    text-align: center;
}

.logo img {
    max-width: 100%;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
} 