body {
  display: flex;
  margin: 0;
  overflow: hidden;
  flex-direction: column;
  align-items: center;
  background-color: black;
  font-family: 'Montserrat', sans-serif;
  background-image: url('../images/tableBackground.png');
  background-size: cover;
  background-position: bottom center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  text-align: center;
  color: white;
  width: 100vw;
  height: 100vh;
}

p { margin: 0; }

#input-name, #input-name-change {
  background: transparent;
  border: none;
  border-bottom: 2px solid white;
  color: white;
  text-align: center;
  outline: transparent;
  font-size: 18px;
}

#input-name { margin-top: 40vh; }

#menu-button, #info-button, #profile-button, #quit-button, #sound-button, #shop-button {
  height: 40px;
  width: 40px;
  font-size: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

#menu-button {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 501;
  transform: translateZ(81px);
}

#menu-buttons {
  display: flex;
  flex-direction: column;
  width: 40px;
  position: absolute;
  left: 0;
  top: 40px;
}

.menu-button { border-right: 2px solid transparent; }
.menu-button.selected { border-right: 2px solid white; }

#info-panel {
  font-size: 14px;
  font-weight: 200;
  text-align: center;
  letter-spacing: 1px;
  height: 400px;
  width: 80%;
  margin: 15vh auto;
}

#info-panel-overlay {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  height: 100vh;
  z-index: 500;
  transform: translateZ(81px);
  background-color: rgba(0,0,0,.6);
}

.menu-content {
  height: 100%;
  overflow: auto;
  background: rgba(0,0,0,.8);
  padding: 10px;
  border-radius: 10px;
}

#profile-content, #quit-content, #sound-content, #shop-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#profile-content p, #quit-content p {
  font-size: 18px;
  margin: 20px 0;
}

.sound-content { width: 100%; }

#sound-toggle {
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 500;
  cursor: default;
}

#sound-toggle span {
  margin-left: 10px;
  padding-left: 5px;
  width: 40px;
  cursor: pointer;
  color: grey;
  font-weight: 300;
}

#sound-toggle span.selected { color: white; font-weight: 500; }
#sound-toggle span:hover { color: white; }
#music-player { flex: 1; height: calc(100% - 50px); }

#submit-name-change, #quit-content button {
  background: transparent;
  border: none;
  border-bottom: 2px solid goldenrod;
  color: lightgoldenrodyellow;
  font-size: 18px;
  outline: transparent;
}

#submit-name-change:hover, #quit-content button:hover {
  border-bottom: 2px solid lightgoldenrodyellow;
  background-color: goldenrod;
  color: black;
  cursor: pointer;
}

#submit-name-change:active, #quit-content button:active {
  background-color: lightgoldenrodyellow;
  border-bottom: 2px solid goldenrod;
}

#info-content::-webkit-scrollbar { border-radius: 10px; background-color: rgba(0,0,0,.15); }
#info-content::-webkit-scrollbar-thumb { background-color: rgba(0,0,0,.3); border-radius: 5px; }

#credits { display: flex; flex-direction: column; align-items: center; text-align: center; }
#credits a { color: inherit; }
#description h2 { text-align: center; margin: 10px 0px 0px; }
#info-panel p { text-align: justify; text-shadow: 2px 2px 2px #000; }

/* === МАГАЗИН === */
#shop-content {
  padding: 20px;
}

#shop-content h2 {
  color: gold;
  margin-bottom: 20px;
}

.shop-item {
  background: rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 15px;
  margin: 10px 0;
  width: 80%;
  text-align: center;
  transition: 0.3s;
}

.shop-item:hover {
  background: rgba(255,255,255,0.15);
}

.shop-item h3 {
  margin: 0 0 10px 0;
  color: gold;
  font-size: 1.2em;
}

.shop-item p {
  margin: 5px 0;
  font-size: 0.9em;
}

.buy-btn, #watch-ad-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid goldenrod;
  color: lightgoldenrodyellow;
  font-size: 16px;
  padding: 5px 15px;
  cursor: pointer;
  margin-top: 10px;
  transition: 0.2s;
}

.buy-btn:hover, #watch-ad-btn:hover {
  background-color: goldenrod;
  color: black;
}

.buy-btn:disabled {
  opacity: 0.6;
  cursor: default;
  border-bottom: 2px solid grey;
  color: grey;
}

.buy-btn:disabled:hover {
  background: transparent;
  color: grey;
}

#watch-ad-btn {
  background-color: rgba(0, 100, 0, 0.5);
  border-bottom: 2px solid green;
  color: lightgreen;
}

#watch-ad-btn:hover {
  background-color: green;
  color: white;
}

#ad-timer {
  color: orange;
  font-size: 14px;
  margin-top: 5px;
  font-weight: bold;
}

/* === ОСТАЛЬНОЕ === */
h1 {
  font-weight: 700;
  font-size: 3em;
  margin: 0;
  cursor: default;
  user-select: none;
  text-shadow: -1px 0 darkgreen, 0 1px darkgreen, 1px 0 darkgreen, 0 -1px darkgreen
}

h1 #black {
  color: black;
  text-shadow: -1px 0 white, 0 1px white, 1px 0 white, 0 -1px white;
  animation: zoomleft 1s;
}

h1 #jack {
  margin-left: -5px;
  animation: zoomright 1s;
}

h1 #io {
  font-style: italic; 
  color: darkgreen;
  text-shadow: -1px 0 white, 0 1px white, 1px 0 white, 0 -1px white;
  margin-left: -14px;
  transform: translateX(-25px);
  font-size: .8em;
  opacity: 0;
  animation: .5s ease 1s normal forwards 1 fadein;
}

@keyframes zoomleft {
  0% { margin-right: -300px; opacity: 0;}
  30% { opacity: 0; }
  100% { margin-right: -5px; opacity: 1;}
}

@keyframes zoomright {
  0% { margin-left: -300px; opacity: 0;}
  30% { opacity: 0; }
  100% { margin-left: -5px; opacity: 1;}
}

@keyframes fadein {
  from {opacity: 0}
  to {opacity: 1}
}

.container {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  width: calc(100vw - 20px);
  height: calc(100% - 58px);
  box-sizing: border-box;
  border-radius: 20px;
  padding: 10px;
}

.player-container {
  display: flex;
  width: 100%;
  justify-content: space-around;
}

.hand-user-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: 5px;
  text-shadow: 1px 1px 1px black;
}

.hand-player-name { width: 90%; }
.hand-player-name.selected { background: linear-gradient(rgba(255,215,0,0.0), rgba(255,215,0,0.5)); }

.hand-player-stats { display: flex; align-items: flex-start; width: 90%; }
.hand-player-stats p { flex: 1; min-width: 33%; font-size: .8em; height: 100%; }

.hand-player-money { background-color: rgba(255,0,0,.5); }
.hand-player-bet { background-color: rgba(0,255,0,.5); }
.hand-player-total { background-color: rgba(0,0,255,.5); }

.hand {
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  height: 150px;
  width: 150px;
  margin: 10px 0 -50px;
  border-radius: 20px;
  box-sizing: border-box; 
  transition: .25s all;
}

.player-container .hand { background-color: rgba(0,0,0,0); }
.split-hand { position: relative; }

.split-hand.selected::before {
  content: '';
  border-top: 10px solid gold;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-radius: 35%;
  position: absolute;
  top: -10px;
  left: 25%;
  animation: bouncing 0.8s ease-in-out infinite;
}

@keyframes bouncing {
  50% { top: -20px; }
}

#player-hand {
  transform: translateY(-100px) scale(1.2);
  z-index: 20;
}

.card {
  height: 145px;
  width: 100px;
  border-radius: 6px;
  display: inline-block;
  margin: 0px -40px;
  background-size: contain;
  background-repeat: no-repeat;
}

#dealer-hand .card { transform: perspective(500px) rotateY(0deg); }
#dealer-hand div:first-child { background-size: cover; }
#dealer-card-1 { transform: perspective(500px) rotateY(180deg); background-size: cover; }

.banner {
  margin: 10px;
  height: 60px;
  color: white;
  box-sizing: border-box;
  display: flex;
  width: 100%;
}

.text-container { flex-grow: 1; }

.text-box {
  font-family: 'Dosis', sans-serif;
  font-weight: 200;
  font-size: 1em;
  letter-spacing: 2px;
  display: flex;
  margin: 0 7%;
  height: 60px;
  box-sizing: border-box;
}

.text-box p {
  font-weight: 600;
  font-size: 1.1em;
  letter-spacing: 3px;
  text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;
}

.text-container {
  height: 60px;
  box-sizing: border-box;
  display: flex;
  justify-content: space-between;
  width: 33.3%;
}

#money-box { border-right: solid 2px white; }
#total-box { border-left: solid 2px white; }

#player-money, #player-bet, #player-box, #dealer-box { display: flex; align-items: center; }
#player-money, #player-box { justify-content: flex-start; text-align: left; }
#player-bet, #dealer-box { justify-content: flex-end; text-align: right; }
#player-box { color: lightblue; }
#dealer-box { color: gold; }

#message {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 1em;
  font-weight: 300;
  width: 100%; 
  height: 60px;
  text-shadow: 2px 2px 1px #000;
  left: 0px;
  transition: .4s all;
}

#message p { font-size: 1em; font-weight: 300; }

input { font-family: 'Dosis', sans-serif; margin: 5px; font-size: 1em; }
#bet-form { width: 100%; }

#input-bet {
  padding: 3px;
  font-weight: 100;
  font-size: 1.2em;
  text-align: center;
  outline: transparent;
  border: none;
  border-radius: 1px; 
  background-color: rgba(0,0,0,.75);
  color: gold;
  letter-spacing: 1px;
}

#submit-bet {
  border: none;
  border-bottom: solid 2px goldenrod;
  border-radius: 1px; 
  font-size: 1.2em;
  font-weight: 800;
  letter-spacing: 2px;
  box-shadow: 2px 2px 2px black;
  background-color: black;
  outline: transparent;
  transition: .25s all;
  box-sizing: border-box;
  padding: 0 2px;
  color: lightgoldenrodyellow;
  letter-spacing: 1px;
}

#submit-bet:hover {
  background-color: goldenrod;
  color: black;
  border-bottom: solid 2px rgba(0,0,0,.75);
  animation: flashingborder .75s linear infinite alternate;
  cursor: pointer;
}

#submit-bet:active {
  box-shadow: none;
  transform: perspective(500) translateZ(-10px);
  color: white;
  background-color: lightgray;
}

#button-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  box-sizing: border-box;
  transform: translateY(-55px);
  z-index: 50;
}

button {
  font-family: 'Dosis', sans-serif;
  font-weight: 500;
  font-size: 1.2em;
  letter-spacing: 2px;
  margin: 0px 5px;
  box-shadow: 2px 2px 2px black;
  transition: .25s all;
  background-color: black;
  color: lightgoldenrodyellow;
  border: none;
  border-bottom: 2px solid goldenrod;
  outline: transparent;
}

button:hover {
  color: black;
  background-color: goldenrod;
  border-bottom: solid 2px rgba(0,0,0,.75);
  animation: flashingborder .75s linear infinite alternate;
  cursor: pointer;
  border-radius: 0px;
}

button:active {
  box-shadow: none;
  color: lightgoldenrodyellow;
  background-color: black;
}

@keyframes flashingborder {
  50% { border-bottom: solid 2px rgba(0,0,0,0); }
}

.flyin { animation: flyin .5s ease-out; }
.loop { animation: flipover 1s ease-out forwards; transform-style: preserve-3d; }

@keyframes flyin {
  0% { transform: perspective(500px) translate3d(30px, -1000px, 50px) rotate(60deg); }
}

@keyframes flipover {
  0% { transform: perspective(500px) translate3d(0px, 0px, 0px) rotateY(-180deg); }
  35% { transform: perspective(500px) translate3d(-85px, 0px, 0px) rotateY(-180deg); }
  50% { transform: perspective(500px) translate3d(-85px, 0px, 30px) rotateY(-81deg); }
  75% { transform: perspective(500px) translate3d(-80px, 0px, 30px) rotateY(30deg); z-index: 5; }
  100% { transform: perspective(500px) translate3d(-80px, 0px, 30px) rotateY(30deg); }
}

.subdued { opacity: .2; box-shadow: none; border: none; animation: none; }
.subdued:hover { animation: none; background-color: black; color: lightgoldenrodyellow; cursor: default; border: none; }
.hidden { visibility: hidden; }
.removed { display: none; }

@media screen and (max-width: 700px) {
  body { display: flex; box-sizing: border-box; flex-direction: column; align-items: center; margin: 0; }
  h1 { font-size: 2em; }
  #credits { font-size: 10px; }
  .menu-content { border-radius: 00px 0px 0px 10px; box-sizing: border-box; }
  #info-panel { margin: 40px 0px 40px 42px; width: calc(100vw - 42px); height: calc(100vh - 80px); }
  #profile-content p, #quit-content p { font-size: 15px; margin: 20px 0; }
  #sound-toggle span { font-weight: 400; }
  #sound-toggle span.selected { font-weight: 600; }
  .container { width: 100%; }
  .banner { display: flex; height: auto; justify-content: space-between; width: 100%; margin: 10px 0; font-size: 1em; }
  .text-box p, .text-box span { font-size: 1em; }
  #message-box { position: fixed; display: flex; flex-direction: column; justify-content: center; align-items: center; top: calc(38vh + 2px); width: 100vw; }
  #message { display: flex; flex-direction: column; align-items: center; justify-content: center; }
  #message p { background-color: rgba(0,0,0,.75); }
  #input-bet { background-color: black; }
  #money-box, #total-box { width:48%; }
  #button-bar { width: 70%; flex-wrap: wrap; }
  #button-bar button { margin: 3px 5px; font-size: 1em; }
  #player-hand { transform: translateY(-150px) scale(1.4); }
  .player-container .hand-container:nth-child(1) { position: fixed; bottom: 45vh; left: 0; transform: rotate(45deg) translateY(125px) translateX(50px) scale(.7); }
  .player-container .hand-container:nth-child(1) .hand-user-info { align-items: flex-start; justify-content: flex-start; transform: rotate(-45deg) translateX(10px); min-height: 65px; }
  .player-container .hand-container:nth-child(1) .hand-player-name { text-align: left; text-shadow: 1px 1px 1px black; }
  .player-container .hand-container:nth-child(1) .hand-player-name.selected { background: linear-gradient(to right, rgba(255,215,0,0.5),rgba(255,215,0,0.0)); }
  .player-container .hand-container:nth-child(1) .hand-player-stats { flex-direction: column; align-items: center; }
}
/* === РЕКЛАМНОЕ МОДАЛЬНОЕ ОКНО === */
#ad-modal {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

#ad-modal button:disabled {
    opacity: 0.6;
    cursor: not-allowed !important;
}

#ad-modal #claim-reward:not(:disabled):hover {
    background: lightgoldenrodyellow !important;
    transform: scale(1.05);
    transition: 0.2s;
}

#ad-modal #close-ad:hover {
    color: white;
}