body {
    font-family: sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: #f0f8ff;
    color: #333;
    padding-bottom: 50px;
}

#game-container {
    width: 90%;
    max-width: 500px;
    margin-top: 10px;
    position: relative;
}

#timer {
    font-size: 1.5em;
    font-weight: bold;
    margin-top: 15px;
    color: #0277bd;
}

#tissue-box {
    width: 100%;
    height: auto;
    cursor: default;
}

.surface {
    transition: fill 0.2s ease, stroke 0.2s ease, opacity 0.2s ease, filter 0.2s ease;
    cursor: pointer;
}

.surface:not(.active-surface):hover {
   filter: brightness(1.05);
}

.surface.active-surface {
    stroke: #f57c00;
    stroke-width: 2.5;
    filter: brightness(1.1);
}

.surface.active-surface:hover {
    filter: brightness(1.2);
}

#opening-cover.opening-opened {
    transform: translateY(-10px) scale(0.95);
    opacity: 0.7;
    transform-origin: 50% 50%;
    transition: transform 0.4s ease, opacity 0.4s ease;
}

.side-unfolding, .flap-unfolding {
    transition: transform 0.6s ease-out, opacity 0.6s ease-out;
}

#side-left.side-left-unfolded {
    transform: translateX(-35px) rotateY(90deg);
    transform-origin: 50px 125px;
    opacity: 0.7;
}

#side-right.side-right-unfolded {
    transform: translateX(35px) rotateY(-90deg);
    transform-origin: 350px 125px;
    opacity: 0.7;
}

#front.flap-front-unfolded {
    transform: translateY(-35px) rotateX(90deg);
    transform-origin: 200px 50px;
    opacity: 0.6;
}

#top-surface.flap-back-unfolded {
    transform: scale(0.95) translateY(5px);
    opacity: 0.6;
    transform-origin: 50% 50%;
}

#bottom.flap-bottom-unfolded {
    transform: translateY(35px) rotateX(-90deg);
    transform-origin: 200px 200px;
    opacity: 0.6;
}

.unfolded {
    pointer-events: none;
    cursor: default;
}

.surface.unfolded {
    cursor: default;
    stroke: #0277bd;
    stroke-width: 1;
    filter: none;
}

.hidden {
    display: none;
}

.flap-label {
    pointer-events: none;
    font-weight: bold;
}

#message {
    font-weight: bold;
}

#reset-button {
    margin-top: 15px;
    padding: 10px 20px;
    font-size: 1em;
    cursor: pointer;
    background-color: #4fc3f7;
    color: white;
    border: none;
    border-radius: 5px;
    transition: background-color 0.2s ease;
}

#reset-button:hover {
    background-color: #03a9f4;
}

#instructions {
    margin-top: 30px;
    padding: 15px;
    background-color: #e3f2fd;
    border-radius: 8px;
    border: 1px solid #90caf9;
    width: 90%;
    max-width: 500px;
    box-sizing: border-box;
}

#instructions h2 {
    margin-top: 0;
    color: #0d47a1;
    text-align: center;
}

#instructions ol {
    padding-left: 20px;
}

#instructions li {
    margin-bottom: 10px;
    line-height: 1.5;
}

#instructions p {
    text-align: center;
    margin-top: 15px;
    font-style: italic;
    color: #1565c0;
}

#leaderboard-container {
    margin-top: 30px;
    padding: 15px;
    background-color: #fff;
    border-radius: 8px;
    border: 1px solid #ccc;
    width: 90%;
    max-width: 500px;
    box-sizing: border-box;
}

#leaderboard-container h2 {
    margin-top: 0;
    text-align: center;
    color: #333;
}

#leaderboard {
    max-height: 300px;
    overflow-y: auto;
}

#leaderboard div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 5px;
    border-bottom: 1px solid #eee;
}

#leaderboard div:last-child {
    border-bottom: none;
}

#leaderboard .rank {
    min-width: 25px;
    text-align: right;
    margin-right: 10px;
    color: #666;
    font-weight: bold;
}

#leaderboard .username {
    font-weight: bold;
    display: flex;
    align-items: center;
    flex-grow: 1;
    margin-right: 10px;
}

#leaderboard .username img {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin-right: 8px;
}

#leaderboard .score {
    color: #0277bd;
    font-weight: bold;
    min-width: 60px;
    text-align: right;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.shake {
    animation: shake 0.3s ease-in-out;
}