/* Game Specific Styles */

.game-header {
    width: 100%;
    max-width: 600px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 4px solid var(--ink-black);
    padding-bottom: 10px;
}

.hidden {
    display: none !important;
}

.screen {
    background: white;
    border: var(--border-thick);
    box-shadow: var(--box-shadow-hard);
    padding: 40px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 100;
}

.modal-win {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 30px;
    border: var(--border-thick);
    box-shadow: var(--box-shadow-hard);
    width: 90%;
    max-width: 500px;
    text-align: center;
    z-index: 200;
}

@keyframes popIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.difficulty-options {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 30px;
}

.timer-display {
    font-family: 'Space Grotesk', monospace;
    font-size: 1.5rem;
    font-weight: bold;
    margin-right: 20px;
}

.btn.small {
    padding: 5px 15px;
    font-size: 1rem;
    box-shadow: 4px 4px 0px var(--ink-black);
}

.btn.small:hover {
    box-shadow: 6px 6px 0px var(--ink-black);
}

.btn.white {
    background: white;
    color: var(--ink-black);
}

/* Grid System */
#game-board {
    display: grid;
    gap: 5px;
    background: var(--ink-black);
    padding: 5px;
    border: var(--border-thick);
    box-shadow: var(--box-shadow-hard);
    user-select: none;
}

.tile {
    width: 80px;
    height: 80px;
    background: white;
    position: relative;
    cursor: pointer;
    transition: transform 0.1s;
    box-sizing: border-box;
    /* We will use borders or pseudo-elements to draw the colors */
}

/* Responsive tile size */
@media (max-height: 800px) {
    .tile {
        width: 60px;
        height: 60px;
    }
}

.tile:hover {
    z-index: 10;
    transform: scale(1.05);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.tile.selected {
    outline: 4px solid var(--ink-black);
    transform: scale(0.9);
    z-index: 5;
}

.tile.dragging {
    opacity: 0.5;
    transform: scale(0.9);
}

.tile.drag-over {
    outline: 4px dashed var(--brand-red);
    transform: scale(1.05);
    z-index: 10;
}

/* Edge Colors Logic
   We'll use internal divs for edges to allow triangles or bars.
   Trapezoids/Triangles look best for "edges".
*/

.edge {
    position: absolute;
    width: 0;
    height: 0;
}

.edge-top {
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-left: 40px solid transparent;
    /* Half of tile width */
    border-right: 40px solid transparent;
    border-top: 40px solid;
    /* Color will be set via JS */
    border-bottom: 0;
    z-index: 1;
}

.edge-bottom {
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-left: 40px solid transparent;
    border-right: 40px solid transparent;
    border-bottom: 40px solid;
    border-top: 0;
    z-index: 1;
}

.edge-left {
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-top: 40px solid transparent;
    /* Half of tile height */
    border-bottom: 40px solid transparent;
    border-left: 40px solid;
    border-right: 0;
    z-index: 1;
}

.edge-right {
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    border-top: 40px solid transparent;
    border-bottom: 40px solid transparent;
    border-right: 40px solid;
    border-left: 0;
    z-index: 1;
}

/* Adjust edge sizes for smaller tiles */
@media (max-height: 800px) {

    .edge-top,
    .edge-bottom {
        border-left-width: 30px;
        border-right-width: 30px;
        border-top-width: 30px;
        border-bottom-width: 30px;
    }

    .edge-left,
    .edge-right {
        border-top-width: 30px;
        border-bottom-width: 30px;
        border-left-width: 30px;
        border-right-width: 30px;
    }
}