@import url('https://fonts.googleapis.com/css2?family=Jersey+20&family=Pirata+One&family=VT323&display=swap');

body {
  background-color: #0c0f1e; 
  color: #edf2f7;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  min-height: 100vh; 
  overflow: hidden; 
  position: relative; 
}

.balatro-bg {
  position: fixed; 
  top: 0; left: 0; width: 100vw; height: 100vh;
  z-index: -1; 
  filter: blur(70px); 
  opacity: 0.9; 
}

.blob {
  position: absolute;
  border-radius: 50%; 
}

.orange {
  width: 90vw; height: 90vw; background-color: #e58a33; top: -10vh; left: -10vw;
  animation: blob-swirl-1 23s ease-in-out infinite alternate; opacity: 0.6;
}

.blue {
  width: 80vw; height: 80vw; background-color: #3b76e5; bottom: -20vh; right: -20vw;
  animation: blob-swirl-2 17s ease-in-out infinite alternate; opacity: 0.7;
}

.purple {
  width: 60vw; height: 60vw; background-color: #6a34e5; top: 40%; left: 30%;
  animation: blob-swirl-3 13s ease-in-out infinite alternate; opacity: 0.5;
}

@keyframes blob-swirl-1 {
  0% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(15vw, 10vh) scale(1.1); }
  66% { transform: translate(-10vw, 20vh) scale(0.9); }
  100% { transform: translate(5vw, -5vh) scale(1.05); }
}

@keyframes blob-swirl-2 {
  0% { transform: translate(0, 0) scale(1.1); }
  50% { transform: translate(-20vw, -15vh) scale(1); }
  100% { transform: translate(10vw, 10vh) scale(1.1); }
}

@keyframes blob-swirl-3 {
  0% { transform: translate(0, 0) scale(1); rotate(0deg); }
  50% { transform: translate(10vw, -10vh) scale(1.2); rotate(180deg); }
  100% { transform: translate(-5vw, 5vh) scale(1.1); rotate(-90deg); }
}

body::before {
  content: " ";
  display: block;
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.2) 50%), 
              linear-gradient(90deg, rgba(255, 0, 0, 0.04), rgba(0, 255, 0, 0.02), rgba(0, 255, 0, 0.04));
  background-size: 100% 4px, 6px 100%;
  z-index: 9999;
  pointer-events: none; 
}

#game-title {
  position: fixed;
  bottom: 40px;
  left: 50px;
  margin: 0;
  font-family: 'Pirata One', cursive;
  font-size: 90px;
  color: #edf2f7;
  letter-spacing: 4px;
  z-index: 10;
  text-shadow: 0 5px 15px rgba(0,0,0,0.8);
  pointer-events: none;
}

#score-board {
  position: fixed;
  top: 40px;
  right: 50px;
  font-family: 'VT323', monospace;
  font-size: 42px;
  color: #a8f7c8;
  z-index: 10;
  text-shadow: 0 4px 10px rgba(0,0,0,0.8);
}

#game-board {
  display: grid;
  grid-template-columns: repeat(6, 80px) 90px;
  grid-template-rows: repeat(6, 80px) 90px;
  gap: 10px;
  position: absolute;
  top: 50%;
  left: 61.8%; 
  transform: translate(-50%, -50%); 
  z-index: 10;
}

.card {
  width: 100%; height: 100%;
  perspective: 1000px;
  cursor: pointer;
}

.card:hover .card-inner {
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
  transform: scale(1.02); 
  transition: transform 0.2s ease-out;
}

.card-inner {
  position: relative;
  width: 100%; height: 100%;
  transition: transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1);
  transform-style: preserve-3d;
  border-radius: 8px;
}

.card.is-flipped .card-inner {
  transform: rotateY(180deg);
}

.card-front, .card-back {
  position: absolute;
  width: 100%; height: 100%;
  backface-visibility: hidden;
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: 'VT323', monospace; 
  font-size: 50px; 
}

.card-front {
  background: linear-gradient(135deg, #2d3748, #4a5568);
  border: 2px solid #718096;
}

.card-back {
  transform: rotateY(180deg);
  background-color: #cbd5e0;
  color: #1a202c;
  box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.1);
}

.card.val-0 .card-back {
  background: linear-gradient(135deg, #100505 0%, #300a0a 50%, #050000 100%);
  border: 2px solid #9b2c2c;
  background-image: url('skull.png');
  background-size: 90%; 
  background-position: center;
  background-repeat: no-repeat;
  filter: drop-shadow(0 0 10px rgba(255, 0, 0, 0.8)) hue-rotate(-10deg);
  box-shadow: 0 0 40px rgba(229, 62, 62, 0.7), inset 0 0 20px rgba(0, 0, 0, 0.9);
  color: transparent; 
  text-shadow: none;
}

.card.val-1 .card-back {
  background: linear-gradient(135deg, #d6d9df 0%, #ffffff 25%, #aeb4be 50%, #6e7683 100%);
  color: #1a202c;
  border: 2px solid #ffffff;
  box-shadow: 0 0 15px rgba(174, 180, 190, 0.5), inset 0 0 10px rgba(255, 255, 255, 0.6);
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);
}

.card.val-2 .card-back {
  background: linear-gradient(135deg, #7a1b1b 0%, #a82e2e 25%, #591010 50%, #2b0404 100%);
  color: #fce4e4;
  border: 2px solid #c94c4c;
  box-shadow: 0 0 20px rgba(122, 27, 27, 0.6), inset 0 0 15px rgba(255, 100, 100, 0.2);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.card.val-3 .card-back {
  background: linear-gradient(135deg, #d4af37 0%, #fffcb3 25%, #c59b27 50%, #8a5a19 100%);
  color: #3e2723;
  border: 2px solid #fffcb3;
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.6), inset 0 0 15px rgba(255, 255, 255, 0.4);
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);
}

.hint {
  display: flex;
  flex-direction: column;
  font-family: 'VT323', monospace;
  background-color: rgba(20, 25, 40, 0.85);
  backdrop-filter: blur(5px);
  border: 2px solid #4a5568;
  border-radius: 8px;
  overflow: hidden; 
  box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

.hint-score {
  flex: 1; 
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  border-bottom: 2px solid #4a5568; 
  background: linear-gradient(180deg, rgba(255,255,255,0.08) 0%, rgba(0,0,0,0) 100%);
  font-size: 28px;
  color: #ecc94b; 
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.hint-bombs {
  flex: 1; 
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  background-color: rgba(0, 0, 0, 0.4); 
  font-size: 24px;
  color: #fc8181; 
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.bomb-icon {
  margin-left: 6px;
  display: inline-block;
  width: 55px; 
  height: 55px;
  background-image: url('skull.png');
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  color: transparent; 
}

#game-over-screen {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background-color: rgba(0, 0, 0, 0.9);
  display: none; 
  justify-content: center;
  align-items: center;
  z-index: 1000; 
  backdrop-filter: blur(10px); 
}

.modal-content {
  background-color: #2d3748;
  padding: 40px;
  border-radius: 12px;
  text-align: center;
  border: 1px solid #4a5568;
  box-shadow: 0 10px 50px rgba(0,0,0,0.8);
}

.modal-content h2 {
  margin-top: 0;
  font-family: 'Pirata One', cursive; 
  color: #fc8181;
  font-size: 60px;
  letter-spacing: 2px;
  text-shadow: 0 0 10px rgba(252, 129, 129, 0.5);
}

.modal-content p {
  font-family: 'VT323', monospace;
  font-size: 32px;
}

#btn-restart {
  margin-top: 20px;
  padding: 10px 30px;
  font-family: 'VT323', monospace;
  font-size: 28px;
  cursor: pointer;
  background-color: #ed8936; 
  color: white;
  border: none;
  border-radius: 6px;
  transition: background-color 0.2s, transform 0.1s;
  box-shadow: 0 4px 0 #c05621;
}

#btn-restart:hover {
  background-color: #dd6b20;
  transform: translateY(-1px);
}

#btn-restart:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #c05621;
}

#btn-restart-game {
  position: fixed;
  top: 90px;
  right: 50px;
  background-color: rgba(26, 5, 5, 0.85);
  border: 1px solid #9b2c2c;
  color: #fc8181;
  font-family: 'VT323', monospace;
  font-size: 22px;
  padding: 2px 16px;
  border-radius: 4px;
  cursor: pointer;
  z-index: 10;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.6), inset 0 0 8px rgba(155, 44, 44, 0.4);
  transition: all 0.2s ease;
  backdrop-filter: blur(5px);
}

#btn-restart-game:hover {
  background-color: rgba(40, 10, 10, 0.9);
  border-color: #e53e3e;
  color: #fff;
  box-shadow: 0 4px 10px rgba(229, 62, 62, 0.3), inset 0 0 12px rgba(229, 62, 62, 0.6);
  transform: translateY(-1px);
}

#btn-restart-game:active {
  transform: translateY(1px);
  box-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

.card.val-1 .card-back::after { content: "1"; }
.card.val-2 .card-back::after { content: "2"; }
.card.val-3 .card-back::after { content: "3"; }

#start-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: rgba(12, 15, 30, 0.4); 
  backdrop-filter: blur(4px); 
}
#start-title {
  font-family: 'Pirata One', cursive;
  font-size: 200px;
  color: #fce4e4;
  margin: 0 0 60px 0;
  text-shadow: 0 10px 30px rgba(0, 0, 0, 0.9), 0 0 15px rgba(229, 62, 62, 0.6);
  cursor: default;
  user-select: none;
}

#start-title span {
  display: inline-block;
  transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275), 
              color 0.2s, 
              text-shadow 0.2s;
}
#start-title span.space {
  width: 30px;
  pointer-events: none; 
}
#start-title span:hover {
  transform: translateY(-20px) scale(1.15);
  color: #fffcb3;
  text-shadow: 
    0 20px 40px rgba(0, 0, 0, 0.8), 
    0 0 20px rgba(212, 175, 55, 0.8), 
    0 0 10px rgba(255, 255, 255, 0.6);
}

.controls-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
}

#btn-start {
  background: linear-gradient(135deg, #7a1b1b 0%, #2b0404 100%);
  color: #fce4e4;
  border: 2px solid #c94c4c;
  padding: 30px 70px;
  font-size: 70px;
  font-family: 'Jersey 20', sans-serif;
  cursor: pointer;
  border-radius: 8px;
  box-shadow: 0 0 20px rgba(122, 27, 27, 0.8), inset 0 0 15px rgba(255, 100, 100, 0.2);
  transition: all 0.2s;
  transform: translateY(-30px);
}

#btn-start:hover {
  transform: scale(1.05) translateY(-30px);
  box-shadow: 0 0 30px rgba(229, 62, 62, 1), inset 0 0 20px rgba(255, 100, 100, 0.4);
}

#volume-slider {
  -webkit-appearance: none;
  width: 200px;
  height: 8px;
  background: #2b0404;
  border: 1px solid #c94c4c;
  border-radius: 4px;
  outline: none;
  box-shadow: 0 0 10px rgba(122, 27, 27, 0.6);
  transform: translateY(-30px);
}

#volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #d4af37;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.8);
}

.server-input-wrapper {
  position: absolute;
  bottom: 40px;
  left: 50px; 
  display: flex;
  align-items: center;
  background: rgba(43, 4, 4, 0.6); 
  border: 1px solid #c94c4c;
  border-radius: 25px; 
  padding: 5px;
  width: 50px; 
  height: 50px;
  box-sizing: border-box;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  box-shadow: 0 0 10px rgba(122, 27, 27, 0.4);
  z-index: 100;
}

.server-input-wrapper:hover,
.server-input-wrapper:focus-within {
  width: 300px;
  background: rgba(43, 4, 4, 0.9);
  box-shadow: 0 0 20px rgba(229, 62, 62, 0.6), inset 0 0 10px rgba(255, 100, 100, 0.2);
}

.server-icon {
  min-width: 40px;
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

.server-icon svg {
  width: 22px;
  height: 22px;
  color: #d4af37;
  filter: drop-shadow(0 0 5px rgba(212, 175, 55, 0.5));
  transition: all 0.3s ease;
}

.server-input-wrapper:hover .server-icon svg,
.server-input-wrapper:focus-within .server-icon svg {
  color: #fffcb3;
  filter: drop-shadow(0 0 10px rgba(255, 252, 179, 0.8));
  transform: scale(1.1) rotate(15deg);
}

#servername {
  background: transparent;
  border: none;
  outline: none;
  color: #fce4e4;
  font-family: 'VT323', monospace;
  font-size: 24px;
  width: 100%;
  padding: 0 10px;
  opacity: 0; 
  transition: opacity 0.3s;
}

.server-input-wrapper:hover #servername,
.server-input-wrapper:focus-within #servername {
  opacity: 1;
  transition-delay: 0.1s; 
}

#servername::placeholder {
  color: rgba(252, 228, 228, 0.4);
}