@import url("https://fonts.googleapis.com/css2?family=Righteous&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Love+Ya+Like+A+Sister&display=swap");

body {
    background-image: url("bg.png");
    background-size: cover;
}

body,
main {
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: white;
    font-family: "Love Ya Like A Sister", cursive;
}

main {
    margin-top: -20px;
}

h1 {
    font-size: 40px;
    background-color: #8cb9c4;
    padding: 10px;
    border-radius: 5px;
    text-align: center;
}

h2 {
    background-color: white;
    padding: 30px;
    color: black;
    border-radius: 20px;
    text-align: center;
    min-width: 300px;
    box-shadow: rgba(0, 0, 0, 0.1) 0px 10px 15px -3px, rgba(0, 0, 0, 0.05) 0px 4px 6px -2px;
}

#keyboard-container h2 {
  background-color: #1F7A4A;
  color: #FFF4E6;
  padding: 14px 28px;
  border-radius: 14px;
  border: 2px solid #8B5A2B;
  font-weight: 700;
  display: inline-block;
  box-shadow: 0 4px 0 #145A32;
  position: relative;
  overflow: hidden;
}

#snowman-container h2 {
  background-color: #C62828;
  color: #FFF4E6;
  padding: 14px 28px;
  border-radius: 14px;
  border: 2px solid #8B5A2B;
  font-weight: 700;
  display: inline-block;
  box-shadow: 0 4px 0 #8E1B1B;
  position: relative;
  overflow: hidden;
}

/* Play Again button styling */
#restart-btn {
    margin-left: 14px;
    background: linear-gradient(180deg, #FFD166 0%, #FFB35C 50%, #F2973A 100%);
    color: #3B2F2F;
    border: 0;
    padding: 10px 18px;
    border-radius: 12px;
    font-weight: 800;
    box-shadow: 0 6px 0 rgba(0,0,0,0.12), 0 2px 0 rgba(255,255,255,0.06) inset;
    cursor: pointer;
    transform: translateY(0);
    transition: transform 120ms ease, box-shadow 120ms ease, opacity 180ms ease;
}

#restart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 0 rgba(0,0,0,0.14), 0 2px 0 rgba(255,255,255,0.06) inset;
}

#restart-btn:active {
    transform: translateY(2px);
    box-shadow: 0 4px 0 rgba(0,0,0,0.12);
}

#restart-btn:focus {
    outline: 3px solid rgba(255, 209, 102, 0.35);
    outline-offset: 2px;
}

/* add small icon and mobile-friendly size */
#restart-btn::before {
    content: "🎁";
    display: inline-block;
    margin-right: 8px;
    transform: translateY(-1px);
}

@media (max-width: 480px) {
    #restart-btn {
        padding: 14px 22px;
        font-size: 18px;
        border-radius: 14px;
        margin-left: 8px;
    }
}

/* optional subtle pulse on hover for touch affordance */
@keyframes btnPulse {
    0% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-3px) scale(1.03); }
    100% { transform: translateY(0) scale(1); }
}

#restart-btn:hover { animation: btnPulse 600ms ease; }

/* Confetti styles */
.confetti {
    position: fixed;
    top: -12px;
    width: 10px;
    height: 14px;
    opacity: 0.95;
    border-radius: 2px;
    will-change: transform, opacity;
    z-index: 9999;
    pointer-events: none;
    transform-origin: center;
    animation: confetti-fall var(--dur, 2400ms) cubic-bezier(.2,.7,.3,1) var(--delay, 0ms) forwards;
}

@keyframes confetti-fall {
    to { transform: translateY(110vh) rotate(520deg); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .confetti { animation: none; display: none; }
}

/* confetti shapes */
.confetti.circle { border-radius: 50%; }
.confetti.triangle { clip-path: polygon(50% 0%, 0% 100%, 100% 100%); }
.confetti.star { clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }

/* Make restart button match the look of the win message inside the keyboard area */
#keyboard-container #restart-btn {
    background-color: #1F7A4A !important;
    color: #FFFFFF !important;
    padding: 14px 28px !important;
    border-radius: 14px !important;
    border: 2px solid #8B5A2B !important;
    font-weight: 700 !important;
    display: inline-block !important;
    box-shadow: 0 4px 0 #145A32 !important;
    margin-left: 12px !important;
}

/* ensure emoji/icon in restart button remains vertically centered */
#restart-btn::before { transform: translateY(0); }

#keyboard-container h2::before,
#snowman-container h2::before {
  content: "";
  position: absolute;
  inset: -50%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.35) 0%,
    rgba(255, 255, 255, 0.15) 40%,
    transparent 60%
  );
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.5s ease;
}

#keyboard-container h2:hover::before,
#snowman-container h2:hover::before {
  opacity: 1;
  transform: translateX(30%);
}

#snowman-container {
    position: relative;
    width: 250px;
    height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin-bottom: -50px;
}

/* Note: 3D prototype removed; keep standard layout and 2D removal animation */

.hat {
    width: 150px;
    position: absolute;
    left: 75px;
    top: 0;
    z-index: 10;
}

.scarf {
    width: 110px;
    position: absolute;
    left: 66px;
    top: 110px;
    z-index: 9;
}

.nose {
    width: 30px;
    position: absolute;
    top: 84px;
    left: 96px;
    z-index: 8;
}

.eyes {
    width: 43px;
    position: absolute;
    top: 72px;
    left: 100px;
    z-index: 7;
}

.mouth {
    width: 43px;
    position: absolute;
    top: 95px;
    left: 103px;
    z-index: 6;
}

.left-hand {
    width: 120px;
    position: absolute;
    left: 180px;
    top: 90px;
    z-index: 5;
}

.right-hand {
    width: 120px;
    position: absolute;
    left: -50px;
    top: 82px;
    z-index: 4;
}

.body-top {
    width: 110px;
    position: absolute;
    top: 40px;
    z-index: 3;
}

.body-middle {
    width: 130px;
    position: absolute;
    top: 110px;
    z-index: 2;
}

.body-bottom {
    width: 190px;
    position: absolute;
    top: 180px;
    z-index: 1;
}

#empty-letter-container {
    display: flex;
    justify-content: center;
    gap: 12px;
}

#empty-letter-container > .letter-container {
    margin: 0;
    width: 45px;
    height: 48px;
    text-align: center;
    border-bottom: 3px solid rgba(0, 0, 0, 0.5);
}

#keyboard-container {
    display: flex;
    gap: 24px;
    width: 600px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 20px;
}

#keyboard-container > .letter {
    cursor: pointer;
}

.letter-container > .letter {
    margin-bottom: 8px;
}

.letter {
    font-family: "Righteous", cursive;
    background-color: white;
    color: black;
    width: 32px;
    padding: 6px;
    display: inline-block;
    border-radius: 5px;
    font-size: 22px;
    text-align: center;
    box-shadow: rgba(0, 0, 0, 0.4) 0px 2px 4px, rgba(0, 0, 0, 0.3) 0px 7px 13px -3px,
        rgba(0, 0, 0, 0.2) 0px -3px 0px inset;
}

.letter:hover {
    box-shadow: rgba(0, 0, 0, 0.15) 0px 2px 8px;
}

/* Removal animation */
.removing {
    opacity: 0;
    transform: translateY(-18px) scale(0.9);
    transition: opacity 400ms ease, transform 400ms ease;
}

#controls {
    margin: 10px 0;
    display: flex;
    gap: 12px;
    align-items: center;
}

#mute-btn {
    font-size: 18px;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
}

#scoreboard {
    color: #FFF4E6;
    display: flex;
    gap: 12px;
    align-items: center;
}

/* Added by JavaScript */
.selected {
    background-color: grey;
    cursor: not-allowed;
    box-shadow: rgba(0, 0, 0, 0.15) 0px 2px 8px;
}

.hidden {
    display: none;
}

#error-message {
    background-color: red;
    color: yellow;
    padding: 18px;
    font-size: 18px;
    font-weight: bold;
    line-height: 1.2;
    position: fixed;
    z-index: 100;
    border-radius: 8px;
}

#blackout {
    width: 100vw;
    height: 100vh;
    background-color: #0000003d;
    z-index: 99;
    position: fixed;
}