@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&family=Nunito:wght@400;700&display=swap');

:root {
    --color-path: #e1d6c3;
    --color-sky: #87CEEB;
    --color-yellow: #FFD700;
    --color-black: #000;
    --color-white: #fff;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Nunito', sans-serif;
    background-color: #7dd3fc;
    /* bg-sky-300 */
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    user-select: none;
    touch-action: none;
}

.container {
    width: 100%;
    max-width: 900px;
    padding: 1rem;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Header */
header {
    background-color: #facc15;
    /* bg-yellow-400 */
    border: 4px solid #000;
    box-shadow: 4px 4px 0px 0px rgba(0, 0, 0, 0.5);
    padding: 1rem;
    border-radius: 0.75rem;
    /* rounded-xl */
    margin-bottom: 1.5rem;
    width: 100%;
    max-width: 42rem;
    /* max-w-2xl */
    text-align: center;
    position: relative;
}

h1 {
    font-family: 'Fredoka One', cursive;
    font-size: 1.875rem;
    /* text-3xl */
    color: #000;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: -0.05em;
    text-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

@media (min-width: 768px) {
    h1 {
        font-size: 2.25rem;
    }

    /* md:text-4xl */
}

.controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

/* Difficulty Buttons */
.difficulty-selector {
    display: flex;
    gap: 0.25rem;
    background-color: #000;
    padding: 0.25rem;
    border-radius: 0.5rem;
}

.diff-btn {
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
    font-weight: bold;
    font-size: 0.875rem;
    text-transform: uppercase;
    cursor: pointer;
    border: none;
    transition: background-color 0.3s;
}

.diff-btn.active {
    background-color: #facc15;
    color: #000;
}

.diff-btn.inactive {
    background-color: transparent;
    color: #fff;
}

.diff-btn.inactive:hover {
    background-color: #1f2937;
}

/* Sound Button */
.icon-btn {
    padding: 0.5rem;
    background-color: #fff;
    border-radius: 9999px;
    border: 2px solid #000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s;
}

.icon-btn:active {
    transform: translateY(4px);
}

/* Game Area */
.game-area {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
    max-width: 56rem;
    /* max-w-4xl */
    align-items: flex-start;
    justify-content: center;
}

@media (min-width: 1024px) {
    .game-area {
        flex-direction: row;
    }
}

/* Grid Container */
.grid-wrapper {
    position: relative;
    background-color: #000;
    padding: 0.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    margin: 0 auto;
}

.grid-board {
    display: grid;
    gap: 0.25rem;
    background-color: #1e293b;
    /* bg-slate-800 */
    padding: 0.25rem;
    border-radius: 0.25rem;
    touch-action: none;
}

.cell {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    border-radius: 0.25rem;
    cursor: pointer;
    border: 1px solid transparent;
    user-select: none;
    font-weight: bold;
    aspect-ratio: 1;
}

@media (min-width: 640px) {
    .cell {
        font-size: 1.125rem;
    }
}

@media (min-width: 768px) {
    .cell {
        font-size: 1.25rem;
    }
}

/* Cell States */
.cell.default {
    background-color: #fff;
    color: #334155;
    /* text-slate-700 */
    border-color: #e2e8f0;
}

.cell.default:hover {
    background-color: #fefce8;
}

.cell.selected {
    background-color: #fde047;
    /* bg-yellow-300 */
    color: #713f12;
    /* text-yellow-900 */
    transform: scale(1.05);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border-color: #eab308;
    z-index: 10;
}

/* Found Colors */
.bg-red-400 {
    background-color: #f87171;
}

.bg-blue-400 {
    background-color: #60a5fa;
}

.bg-green-400 {
    background-color: #4ade80;
}

.bg-yellow-400 {
    background-color: #facc15;
}

.bg-purple-400 {
    background-color: #c084fc;
}

.bg-pink-400 {
    background-color: #f472b6;
}

.bg-indigo-400 {
    background-color: #818cf8;
}

.bg-orange-400 {
    background-color: #fb923c;
}

.bg-teal-400 {
    background-color: #2dd4bf;
}

.cell.found {
    color: white;
    border-color: rgba(255, 255, 255, 0.2);
}

/* Sidebar / Word List */
.sidebar {
    background-color: #fff;
    padding: 1.5rem;
    border-radius: 0.75rem;
    border: 4px solid #1e293b;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    width: 100%;
}

@media (min-width: 1024px) {
    .sidebar {
        width: 16rem;
    }
}

h3 {
    font-size: 1.25rem;
    font-weight: 900;
    color: #1e293b;
    margin-top: 0;
    margin-bottom: 1rem;
    border-bottom: 4px solid #facc15;
    padding-bottom: 0.5rem;
}

.word-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

@media (min-width: 1024px) {
    .word-list {
        flex-direction: column;
        gap: 0.75rem;
    }
}

.word-item {
    padding: 0.25rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s;
}

.word-item.pending {
    background-color: #f1f5f9;
    color: #475569;
}

.word-item.found {
    color: white;
    box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
    transform: scale(0.95);
    opacity: 0.8;
    text-decoration: line-through;
}

/* Win Overlay */
.overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    z-index: 20;
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.overlay h2 {
    font-size: 2.25rem;
    font-weight: 900;
    color: #fff;
    margin: 0.5rem 0;
}

.overlay p {
    color: #fef08a;
    /* text-yellow-200 */
    font-weight: bold;
    margin-bottom: 1.5rem;
}

.restart-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: #facc15;
    color: #000;
    font-weight: bold;
    padding: 0.75rem 1.5rem;
    border-radius: 9999px;
    border: none;
    border-bottom: 4px solid #ca8a04;
    cursor: pointer;
    transition: all 0.2s;
}

.restart-btn:hover {
    background-color: #fde047;
    transform: scale(1.05);
}

.restart-btn:active {
    transform: translateY(4px);
    border-bottom: 0;
}

.hidden {
    display: none !important;
}