/* Copyright (c) 2025 Rob Young */
:root {
    --bg-color: #0f172a;
    --board-bg: #1e293b;
    --grid-line: #334155;
    --tile-bg: #f8fafc;
    --tile-text: #0f172a;
    --accent-color: #38bdf8;
    --accent-hover: #0ea5e9;
    --text-color: #e2e8f0;
    --overlay-bg: rgba(15, 23, 42, 0.85);
    --font-main: 'Outfit', sans-serif;
    --cell-size: 30px;
    --gap-size: 2px;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
}

#app {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 800px;
    min-height: 100vh;
    padding: 20px;
    position: relative;
}

/* Header */
#header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 10px;
    padding: 0 20px;
}

h1 {
    font-weight: 700;
    letter-spacing: 2px;
    background: linear-gradient(to right, var(--accent-color), #a855f7);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

#score-display {
    font-size: 1.2rem;
    font-weight: 600;
}

/* Game Container */
#game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

/* Board */
#board {
    display: grid;
    grid-template-columns: repeat(12, var(--cell-size));
    grid-template-rows: repeat(12, var(--cell-size));
    gap: 0;
    background-color: var(--grid-line);
    border: 2px solid var(--grid-line);
    margin-bottom: 20px;
    position: relative;
}

.grid-cell {
    width: var(--cell-size);
    height: var(--cell-size);
    background-color: var(--board-bg);
    border-right: 1px solid var(--grid-line);
    border-bottom: 1px solid var(--grid-line);
    transition: background-color 0.2s;
}

.grid-cell:nth-child(12n) {
    border-right: none;
}

.grid-cell:nth-child(n + 133) {
    border-bottom: none;
}

.grid-cell.hovered {
    background-color: rgba(56, 189, 248, 0.2);
}

/* Tiles */
.tile {
    background-color: var(--tile-bg);
    color: var(--tile-text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    border-radius: 4px;
    cursor: grab;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    position: absolute;
    z-index: 10;
    transition: transform 0.1s, box-shadow 0.1s;
}

.tile:active {
    cursor: grabbing;
    transform: scale(1.05);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    z-index: 20;
}

.tile.word-claimable {
    background-color: rgba(56, 189, 248, 0.3);
    border: 2px solid var(--accent-color);
    cursor: pointer;
}

.tile.word-claimable:hover {
    background-color: rgba(56, 189, 248, 0.5);
    transform: scale(1.02);
}

.tile-letter {
    width: var(--cell-size);
    height: var(--cell-size);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

/* Tray */
#tray-container {
    width: 100%;
    height: 80px;
    background-color: rgba(30, 41, 59, 0.5);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    border: 1px solid var(--grid-line);
}

#tray {
    display: flex;
    gap: 10px;
    width: 100%;
    height: 100%;
    position: relative;
    align-items: center;
    justify-content: center;
}

/* Action Buttons */
#action-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

/* Controls */
#controls {
    text-align: center;
    width: 100%;
    margin-bottom: 10px;
}

#instructions {
    font-size: 0.9rem;
    color: #94a3b8;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-family: var(--font-main);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    background-color: #334155;
    color: white;
}

.btn:hover {
    background-color: #475569;
}

.primary-btn {
    background-color: var(--accent-color);
    color: var(--bg-color);
}

.primary-btn:hover {
    background-color: var(--accent-hover);
}

/* Overlay */
#overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--overlay-bg);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    transition: opacity 0.3s;
}

#overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.panel {
    background-color: var(--board-bg);
    padding: 40px;
    border-radius: 16px;
    text-align: center;
    border: 1px solid var(--grid-line);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    max-width: 400px;
    width: 90%;
}

.panel.hidden {
    display: none;
}

.panel h2 {
    font-size: 2rem;
    margin-bottom: 20px;
    color: var(--accent-color);
}

.panel p {
    font-size: 1.2rem;
    margin-bottom: 30px;
}

/* Word List */
#word-list-container {
    width: 100%;
    max-height: 200px;
    margin-top: 10px;
    background-color: rgba(30, 41, 59, 0.5);
    border-radius: 12px;
    border: 1px solid var(--grid-line);
    overflow: hidden;
}

#word-list {
    max-height: 200px;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.word-entry {
    padding: 8px 12px;
    background-color: rgba(56, 189, 248, 0.1);
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent-color);
    border-left: 3px solid var(--accent-color);
}

#word-list::-webkit-scrollbar {
    width: 8px;
}

#word-list::-webkit-scrollbar-track {
    background: rgba(30, 41, 59, 0.5);
    border-radius: 4px;
}

#word-list::-webkit-scrollbar-thumb {
    background: var(--grid-line);
    border-radius: 4px;
}

#word-list::-webkit-scrollbar-thumb:hover {
    background: #475569;
}