.stones-wrapper {
    position: relative;
    display: flex;
}

#stone-selector,
#standing-stone-selector,
.capstones {
    width: 12vw;
    height: 12vw;
    max-width: 60px;
    max-height: 60px;
    border: 3px solid #000;
    position: relative;
    cursor: pointer;
    box-sizing: border-box;
}

#stone-selector {
    border-right: none;
}

#standing-stone-selector {
    border-left: none;
}

.btn {
    background-color: #f0f0f0;
    border: 2px solid #000;
    padding: 8px 16px;
    font-family: monospace;
    font-weight: bold;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
    /* Mobile */
    color: #000;
    -webkit-appearance: none;
    appearance: none;
}

.turn-over {
    background-color: #87B981;
}

.pulse-red {
    animation: pulse-animation 1s ease-out 1;
}

@keyframes pulse-animation {
  0% {
    background-color: #ff4d4d;
    box-shadow: 0 0 0 0 rgba(255, 77, 77, 0.7);
  }
  70% {
    box-shadow: 0 0 0 15px rgba(255, 77, 77, 0);
  }
  100% {
    background-color: #f0f0f0;
    box-shadow: 0 0 0 0 rgba(255, 77, 77, 0);
  }
}

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

.btn:active {
    background-color: #ccc;
}

.select-box {
    position: relative;
    cursor: pointer;
}

.count-label {
    position: absolute;
    top: 2px;
    left: 4px;
    font-size: 12px;
    font-family: sans-serif;
    font-weight: bold;
    z-index: 10;
}

.active-turn-text {
    font-weight: bold;
    color: #000;
    text-decoration: underline;
}

.inactive-turn-text {
    color: #888;
    text-decoration: none;
}

.buttons {
    display: grid;
    grid-template-columns: auto auto;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    justify-content: center;
    gap: 2%;
    padding: 0 0.5%;
    padding-bottom: 0.5%;
}

.picker {
    display: grid;
    grid-template-columns: auto auto auto auto;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    justify-content: center;
    gap: 2%;
    padding: 0 0.5%;
    padding-top: 0.5%;
}

.white-info {
}

.black-info {
}

div.board {
    width: 85vmin;
    height: 85vmin;
    border: 5px solid #000;
    border-radius: 5px;
    margin: auto;
    display: grid;
    box-sizing: border-box;
}

body {
    margin: 0;
    height: 100vh;
    display: grid;
    place-items: center;
}

div.boardTile {
    box-sizing: border-box;
    background: #CE9E64;
    width: 100%;
    height: 100%;
    border: 2px solid #000;

    position: relative;
    overflow: visible;
}

.active_tile {
    outline: 5px solid #DB92C5;
    outline-offset: -3px;
    box-shadow: 0 0 10px rgba(0, 0, 255, 0.5);
    z-index: 5;
}

.piece {
    position: absolute;
    left: 50%;
    top: 50%;

    border: 2px solid rgba(0,0,0,.35);
    box-sizing: border-box;

    box-shadow: 0 3px 6px rgba(0,0,0,.25);

    transition: transform 0.15s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.15s ease-out;
    --lift: 0px;
}

.flat-piece, .capstone-piece {
    transform: translate(-50%, calc(-50% + var(--lift)));
}

.standing-piece {
    transform: translate(-50%, calc(-50% + var(--lift))) rotate(45deg);
}

.piece.in-buffer {
    --lift: -30px;
    box-shadow: 0 20px 30px rgba(0, 0, 0, 0.45);
    z-index: 20;
}

.capstone-piece {
    width: 58%;
    aspect-ratio: 1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.capstone-piece::after {
    content: '';
    width: 30%;
    aspect-ratio: 1;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.4);
    box-sizing: border-box;
}

.standing-piece {
    width: 50%;
    height: 18%;
    aspect-ratio: 1;
    border-radius: 8px;

    transform: translate(-50%, -50%) rotate(45deg);
}

.flat-piece {
    width: 50%;
    aspect-ratio: 1;
    border-radius: 8px;
}

.white-piece {
    background-color: #FBFFF3;
    border: 2px solid rgba(0, 0, 0, 0.4);
    box-shadow: 0 3px 6px rgba(0,0,0,.25), inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

.black-piece {
    background-color: #222222;
    border: 2px solid #686868;
    box-shadow: 0 3px 6px rgba(0,0,0,.4), inset 0 0 0 1px rgba(0, 0, 0, 0.5);
}

/* Mobile Specifics */
@media (orientation: portrait) {
    body, .btn, .select-box, div.boardTile, .piece, .flat-piece, 
    .standing-piece, .capstone-piece,#stone-selector,
    #standing-stone-selector, .capstones, .stones-wrapper, 
    .count-label,
    div.board {
        touch-action: manipulation;
    }
    body {
        display: flex;
        flex-direction: column;
        height: 100vh;
        box-sizing: border-box;
        padding: 3vh 0;
        justify-content: space-between;
    }

    .buttons {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 4vw;
        width: 100%;
    }

    .btn {
        width: 35vw;
        height: 8vh;
        font-size: 4vw;
        border-width: 0.8vw;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        white-space: nowrap;
        text-align: center;
    }

    div.board {
        flex-grow: 0;
        margin: auto 0;
    }

    .picker {
        flex: 1;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-evenly;
        width: 100%;
        padding: 0 4vw;
        box-sizing: border-box;
    }

    .stones-wrapper {
        display: flex;
        flex-shrink: 0;
    }

    #stone-selector,
    #standing-stone-selector,
    .capstones {
        width: 15vw;
        height: 15vw;
        max-width: 15vh;
        max-height: 15vh;
        border-width: 0.8vw;
        flex-shrink: 0;
    }

    .piece {
        border-width: 0.6vw;
    }

    .count-label {
        font-size: 3vw;
        top: 0.5vh;
        left: 1.5vw;
    }

    .white-info, .black-info {
        font-size: 3.5vw;
        white-space: nowrap;
        flex-shrink: 1;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 22vw;
        text-align: center;
    }
}
