:root {
    --bg-color: #1a1a1a;
    --panel-border-depth: 3px;
    --panel-padding: 12px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    background-color: var(--bg-color);
    color: rgba(255, 255, 255, .9);
    overflow: hidden;
    height: 100vh;
    font-family: Tahoma, Verdana, Geneva, sans-serif;
    display: grid;
    grid-template-rows: 27px 1fr;
    grid-template-columns: 1fr;
    overscroll-behavior: none;
}

#controls {
    display: flex;
    align-items: center;
    padding: 0 10px;
    gap: 15px;
}

#puzzle-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

#puzzle-selector label {
    color: white;
    font-size: 12px;
    font-weight: bold;
}

#puzzle-select {
    padding: 4px 8px;
    border-radius: 3px;
    border: 1px solid #666;
    background: #333;
    color: white;
    font-size: 12px;
    cursor: pointer;
}

#puzzle-select:hover {
    background: #444;
}

#main-content {
    display: grid;
    grid-template-columns: 30px 1fr;
    height: 100vh;
    overflow: hidden;
}

#rewards-area {
    overflow-y: auto;
    overflow-x: hidden;
    padding: 5px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    font-size: 20px;
}

#rewards-area::-webkit-scrollbar {
    width: 4px;
}

.reward-dialog-content {
    display: flex;
    gap: 1rem;
    flex-direction: row;
    flex-wrap: wrap;
    align-content: flex-start;
}

#game-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    position: relative;
}

#puzzle-area,
#storage-area {
    height: 49vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

#puzzle-area {
    height: 49vh;
    display: grid;
    place-items: center;
    position: relative;
    border-bottom: 2px solid transparent;
}

#puzzle-area>.panel {
    grid-area: 1 / 1;
}

.panel {
    width: calc(var(--cell-size) * 8 + (var(--panel-padding) * 2) + (var(--panel-border-depth) * 2));
    height: calc(var(--cell-size) * 8 + (var(--panel-padding) * 2) + (var(--panel-border-depth) * 2));
    display: block;
    /* Elements are absolutely positioned */
    position: relative;
    padding: var(--panel-padding);
    border: var(--panel-border-depth) solid;
    border-color:
        rgba(255, 255, 255, 0.2)
        /* top: highlight */
        rgba(0, 0, 0, 0.3)
        /* right: shadow */
        rgba(0, 0, 0, 0.5)
        /* bottom: shadow */
        rgba(255, 255, 255, 0.1);
    /* left: highlight */

    border-radius: 4px;
    transition: transform 0.6s ease-in-out;
    box-sizing: border-box;
}

/* Panel 3D borders based on element colors but muted */
.panel-black {
    background-color: #222;
}

.panel-teal {
    background-color: #244;
}

.panel-orange {
    background-color: #442;
}

.panel-white {
    background-color: #444;
}

.panel-red {
    background-color: #432;
}

.panel-blue {
    background-color: #234;
}

.panel-green {
    background-color: #242;
}

.panel-yellow {
    background-color: #442;
}

.panel-grey {
    background-color: #444;
}

.panel-victory {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    text-align: center;
    padding: 20px;
    pointer-events: none;
}

.victory-message {
    font-size: 2rem;
    color: #8d5a03;
    text-shadow:
        /* top-left highlight */
        -1px -1px 1px rgba(255, 255, 255, 0.8),

        /* bottom-right inner dark */
        1px 1px 1px rgba(0, 0, 0, 0.4),

        /* bottom-left softer inner dark */
        -1px 1px 1px rgba(0, 0, 0, 0.25),

        /* outer drop shadow */
        2px 3px 4px rgba(0, 0, 0, 0.35);
}

.fas,
.fa-solid {
    color: #444;
    /* base icon colour */
    text-shadow:
        /* top-left highlight */
        -1px -1px 1px rgba(255, 255, 255, 0.8),

        /* bottom-right inner dark */
        1px 1px 1px rgba(0, 0, 0, 0.4),

        /* bottom-left softer inner dark */
        -1px 1px 1px rgba(0, 0, 0, 0.25),

        /* outer drop shadow */
        2px 3px 4px rgba(0, 0, 0, 0.35);
}

.reward-collected {
    font-size: 24px;
    color: #8d5a03;
    transition: all 0.2s ease;
    cursor: default;
    font-weight: lighter;
}

.reward-collected:hover {
    transform: scale(1.1);
    color: #96630a;
}

.reward-icon {
    font-size: 48px;
    font-weight: lighter;
    color: #ecb00a;
    pointer-events: auto;
    -webkit-user-drag: none;
    transition: all 0.3s ease;
    text-shadow:
        /* top-left highlight */
        -1px -1px 1px rgba(255, 255, 255, 0.8),

        /* bottom-right inner dark */
        1px 1px 1px rgba(0, 0, 0, 0.4),

        /* bottom-left softer inner dark */
        -1px 1px 1px rgba(0, 0, 0, 0.25),

        /* outer drop shadow */
        2px 3px 4px rgba(0, 0, 0, 0.35),
        /* glowing effect */
        0 0 10px rgba(242, 245, 55, 0.5);
}

.reward-icon:hover {
    transform: scale(1.2) rotate(10deg);
    color: #ecb00a;
    text-shadow:
        /* top-left highlight */
        -1px -1px 1px rgba(255, 255, 255, 0.8),

        /* bottom-right inner dark */
        1px 1px 1px rgba(0, 0, 0, 0.4),

        /* bottom-left softer inner dark */
        -1px 1px 1px rgba(0, 0, 0, 0.25),

        /* outer drop shadow */
        2px 3px 4px rgba(0, 0, 0, 0.35),
        /* glowing effect */
        0 0 20px rgba(255, 215, 0, 0.8);
}


#rewards-area .reward-collected {
    margin: 0 0 5px 0;
}

.hidden {
    display: none !important;
}

.element {
    justify-self: start;
    align-self: start;
    position: relative;
    z-index: 2;
    cursor: pointer;
    transition: left 0.2s ease-out, top 0.2s ease-out, transform 0.2s ease-out;
}

.element.raised,
.element.controller {
    filter: drop-shadow(-1px -1px 1px rgba(255, 255, 255, 0.8)) drop-shadow(3px 3px 2px rgba(0, 0, 0, 0.8));
}

.element.unlocked {
    filter: drop-shadow(-1px -1px 1px rgba(255, 255, 255, 0.8)) drop-shadow(3px 3px 2px rgba(0, 0, 0, 0.85));
}

.element.draggable {
    filter: drop-shadow(-1px -1px 1px rgba(255, 255, 255, 0.3)) drop-shadow(5px 5px 2px rgba(0, 0, 0, 0.85));
}

.element.rotates {
    filter: none;
}

.element.unlocked.rotates {
    filter: drop-shadow(5px 5px 2px rgba(0, 0, 0, 0.85));
}

.element.dragging {
    pointer-events: none;
    filter: drop-shadow(-1px -1px 1px rgba(255, 255, 255, 0.5)) drop-shadow(5px 5px 2px rgba(0, 0, 0, 0.95));
    transition: none;
}

.element.dragging.rotates {
    pointer-events: none;
    filter: drop-shadow(5px 5px 2px rgba(0, 0, 0, 0.95));
}

.element.sunken {
    cursor: default !important;
}

.element.done {
    /* Reuse the sunken look and add darkness */
    filter: url(#sunken-filter) drop-shadow(-1px -1px 1px rgba(0, 0, 0, 1)) drop-shadow(1px 1px 1px rgba(255, 255, 255, 0.5)) brightness(var(--plug-done-brightness, 0.7)) !important;
    cursor: pointer !important;
    pointer-events: auto;
}


/* Animations */
@keyframes wiggle {

    0% {
        transform: rotate(0deg);
    }

    10% {
        transform: rotate(3deg);
    }

    20% {
        transform: rotate(-3deg);
    }

    30% {
        transform: rotate(3deg);
    }

    40% {
        transform: rotate(0deg);
    }

    70% {
        transform: translateY(40px);
    }

    95% {
        transform: translateY(40px);
    }

    100% {
        transform: translateY(15px);
    }

}

@keyframes jump {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes rotateReverse {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(-360deg);
    }
}

.wiggle {
    animation: wiggle 1.5s ease-in-out forwards;
}

.jump {
    animation: jump 0.2s ease-in-out;
}

.rotating {
    animation: rotate 0.5s linear;
}

.rotating-reverse {
    animation: rotateReverse 0.5s linear;
}

/* Switch visuals */
.switch-ball {
    transition: cx 0.2s ease;
}

/* confetti styles */
.confetti-piece {
    position: fixed;
    top: -10px;
    opacity: 0.9;
    pointer-events: none;
    z-index: 9999;
    border-radius: 2px;
    animation: confetti-fall 10s ease-out forwards;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(0) rotate(0deg);
    }

    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

@keyframes satisfaction-flash {
    0% {
        background-color: inherit;
    }
    30% {
        background-color: #26263b;
    }
    100% {
        background-color: inherit;
    }
}

.button {
    background: none;
    border: none;
    color: #87ceeb;
    font-size: 20px;
    cursor: pointer;
    user-select: none;
    padding: 5px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#info-button {
    margin-left: auto;
}

#info-button:hover,
#reload-button:hover,
#new-button:hover {
    opacity: 0.75;
}

#info-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 2.5%;
    z-index: 3000;
}

#info-content {
    background: #2a2a2a;
    padding: .5rem;
    border-radius: 5px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    width: 95%;
    max-width: 500px;
    height: 85vh;
    max-height: 600px;
    position: relative;
    border-left: 3px solid rgba(255, 255, 255, 0.50);
    border-top: 3px solid rgba(255, 255, 255, 0.50);
    border-right: 3px solid rgba(0, 0, 0, 0.50);
    border-bottom: 3px solid rgba(0, 0, 0, 0.50);
    display: flex;
    flex-direction: column;
    color: rgba(255, 255, 255, 0.85);
}

#info-content p {
    margin-top: 1rem;
}

#dialog-header {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 1rem;
    text-align: center;
    padding-right: 1.25rem;
}

#dialog-scroll-container {
    flex: 1;
    overflow-y: auto;
    padding-right: 10px;
}

#dialog-scroll-container::-webkit-scrollbar {
    width: 8px;
}

#dialog-scroll-container::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 4px;
}

#dialog-scroll-container::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
}

#dialog-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

#info-close {
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 24px;
    cursor: pointer;
    color: #ccc;
}

#info-close:hover {
    opacity: 0.75;
}

#share-button {
    background-color: #c0c0c0;
    color: rgb(31, 37, 44);
    padding: 5px;
    font-weight: bold;
    cursor: pointer;
}

#share-button:hover {
    opacity: 0.75;
}

/* Switch ball raised effect */
.switch-ball.raised {
    filter: drop-shadow(-1px -1px 1px rgba(255, 255, 255, 0.8)) drop-shadow(3px 3px 1px rgba(0, 0, 0, 0.3));
}

/* Switch pill sunken effect */
.switch-pill.sunken {
    filter: url(#sunken-filter) drop-shadow(-1px -1px 1px rgba(0, 0, 0, 1)) drop-shadow(1px 1px 1px rgba(255, 255, 255, 0.5));
}

.title-text {
    font-size: 2rem;
    letter-spacing: 0.1rem;
    font-weight: lighter;
    color: #ecb00a;
    text-shadow:
        /* top-left highlight */
        -1px -1px 1px rgba(255, 255, 255, 0.8),

        /* bottom-right inner dark */
        1px 1px 1px rgba(0, 0, 0, 0.4),

        /* bottom-left softer inner dark */
        -1px 1px 1px rgba(0, 0, 0, 0.25),

        /* outer drop shadow */
        2px 3px 4px rgba(0, 0, 0, 0.35),
        /* glowing effect */
        0 0 0 rgba(242, 245, 55, 0.5);

}

.settings-toggle {
    cursor: pointer;
    color: rgb(212, 212, 91);
    text-shadow: black 2px 2px 2px;
}
.title-circle {
    letter-spacing: 0.2rem;
    font-size: 60%;
}

.title-raised {
    color: #5958a2ff;
    text-shadow:
        /* top-left highlight */
        -1px -1px 1px rgba(255, 255, 255, 0.8),

        /* bottom-right inner dark */
        1px 1px 1px rgba(0, 0, 0, 0.4),

        /* bottom-left softer inner dark */
        -1px 1px 1px rgba(0, 0, 0, 0.25),

        /* outer drop shadow */
        2px 3px 4px rgba(0, 0, 0, 0.35),
}

.title-sunken {
    color: #121111;
    text-shadow:
        /* top-left highlight */
        -1px -1px 1px black,

        /* bottom-right inner dark */
        1px 1px 1px rgba(255, 255, 255, 0.4),

        /* bottom-left softer inner dark */
        -1px 1px 1px rgba(255, 255, 255, 0.25),

        /* glowing effect */
        0 0 10px rgba(0, 0, 0, 0.5);
}