/* Improved styles for the blackjack game room layout with better UI */

body {
    margin: 0;
    padding: 0;
  }
  
  main {
    height: 100vh;
    width: 100%;
    position: relative;
    overflow: hidden;
  }
  
  .blackjack-div {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(135deg, var(--bg-color) 0%, var(--sec-color) 100%);
    position: relative;
  }
  
  /* New game UI layout for better organization */
  .game-ui {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
  }
  
  .score-display {
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: #181825;
    padding: 20px;
    border-radius: 10px;
    border: 2px solid #181825;
  }
  
  .score-item {
    text-align: center;
    /* Fixed vertical alignment by adding proper flex properties */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
  }
  
  .score-label {
    display: block;
    color: var(--green);
    font-size: 1.2rem;
    font-weight: bold;
    /* Removed margin to fix text offset issue */
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
    line-height: 1.2;
  }
  
  /* Updated to target span instead of h2 for score values */
  .score-value {
    color: var(--white);
    font-size: 2rem;
    margin: 0;
    text-shadow: 0 0 10px var(--green);
    line-height: 1.2;
    font-weight: bold;
  }
  
  .game-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: rgba(0, 0, 0, 0.8);
    padding: 20px;
    border-radius: 10px;
    border: 2px solid var(--green);
  }
  
  .left-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 15%;
    height: 100%;
    position: absolute;
    left: 0;
    background-color: rgb(255, 255, 255);
    color: rgb(0, 0, 0);
    z-index: 10;
  }
  
  .left-column img {
    width: 100px;
    height: 100px;
    object-fit: cover;
  }
  
  .right-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 15%;
    height: 100%;
    position: absolute;
    right: 0;
    background-color: rgb(255, 255, 255);
    color: rgb(0, 0, 0);
    z-index: 10;
  }
  
  .house-table {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    translate: -300px 100px;
    border-radius: 50%;
    scale: 0.8;
    background-color: rgba(154, 154, 154, 0);
    padding: 20px;
    width: 1200px;
    height: 1200px;
    overflow: hidden;
    z-index: 5;
  }
  
  .center-stack {
    display: none;
  }
  
  .blackjack-button {
    background: var(--green);
    border: none;
    padding: 12px 24px;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--bg-color);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    user-select: none;
    min-width: 120px;
  }
  
  .blackjack-button:hover {
    background: #4ade80;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(86, 222, 147, 0.3);
  }
  
  .blackjack-button:active {
    transform: translateY(0);
  }
  
  .paw {
    position: absolute;
    z-index: 1000;
    bottom: 30px;
    left: 30px;
    pointer-events: none;
}

/* Animation for the floating effect */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-40px);
    }
}

/* Updated player cards container for better positioning and floating effect */
.player-cards-container {
    position: absolute;
    scale: 1.3;
    bottom: 10px;
    left: 30px;
    z-index: 1000;
    animation: float 3s ease-in-out infinite;
}
  
  .your-cards {
    display: flex;
    flex-direction: row;
    gap: 10px;
    position: relative;
  }
  
  #gameEnd {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 999;
    color: var(--green);
    font-size: 5em;
    transform: scale(0);
    visibility: hidden;
    text-align: center;
    text-shadow: 0 0 10px var(--green), 0 0 20px var(--green), 0 0 30px var(--green), 0 0 40px var(--green);
  }
  
  #gameEnd p {
    margin: 0.5em 0;
  }
  
  @keyframes zoomIn {
    from {
      transform: scale(0);
    }
    to {
      transform: scale(1);
    }
  }
  
  @keyframes zoomOut {
    from {
      transform: scale(1);
    }
    to {
      transform: scale(0);
    }
  }
  
  .card {
    background-color: #181825;
    border: 1px solid #181825;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    /* Made cards larger and removed complex transforms */
    width: 240px;
    height: 336px;
    position: relative;
  }

  .card:active {
    z-index: 2000;
  }
  
  #player-profile,
  #challenger-profile,
  #your-stake-image,
  #challenger-stake-image {
    width: 100px;
    height: 100px;
    object-fit: cover;
  }
  
  #player-profile,
  #challenger-profile {
    margin-top: 50px;
    margin-bottom: 50px;
    filter: grayscale(100%);
    -webkit-filter: grayscale(100%);
  }
  
  #chal-peak {
    z-index: 0;
    height: 100%;
    position: absolute;
    scale: 1;
  }
  
  #your-card-1 {
    transform: rotate(-10deg);
    z-index: 1;
  }
  #your-card-2 {
    transform: translate(-15px, -5px) rotate(-5deg);
    z-index: 2;
  }
  #your-card-3 {
    transform: translate(-30px, -10px) rotate(0deg);
    z-index: 3;
  }
  #your-card-4 {
    transform: translate(-45px, -5px) rotate(5deg);
    z-index: 4;
  }
  #your-card-5 {
    transform: translate(-60px, 0px) rotate(10deg);
    z-index: 5;
  }
  #your-card-6 {
    transform: translate(-75px, 5px) rotate(15deg);
    z-index: 6;
  }
  
  

  
  .header {
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
  }
  
  .grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    padding-top: 10px;
  }
  
  .card-count {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  
  .main-menu,
  .cheats-menu {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
  }
  
  .cheats-menu {
    display: none;
  }
  
  .game-title {
    font-size: 4em;
    transform: rotate(-5deg);
    user-select: none;
    cursor: pointer;
  }
  
  .game-title-flipped {
    transform: rotate(5deg);
  }
  
  h2 {
    translate: 0px -80px;
  }
  
  .button-grid {
    display: grid;
    margin-top: 40px;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    width: 50%;
  }
  
  .button-grid button {
    background: var(--green);
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--bg-color);
    cursor: pointer;
    border-radius: 25px;
    transition: var(--transition);
    user-select: none;
  }
  
  .button-grid-2 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    justify-content: center;
    align-items: center;
  }
  
  .menu-button {
    font-size: 1.5em;
    margin: 10px;
    padding: 10px 20px;
    cursor: pointer;
    transition: transform 0.3s;
  }
  
  .menu-button:hover {
    transform: scale(1.1);
  }
  
  .fade-out {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: black;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s;
  }
  
  .fade-out.active {
    opacity: 1;
    pointer-events: auto;
  }
  
  .hidden {
    display: none;
  }
  
  .locked {
    opacity: 0.5;
    pointer-events: none;
  }
  
  .joker-cards {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
  }
  
  .joker-card {
    width: 50px;
    height: auto;
    transition: filter 1s linear;
    margin: 0 10px;
    animation: hover 2s infinite ease-in-out;
  }
  
  .joker-card:nth-child(1) {
    animation-delay: 0.2s;
  }
  .joker-card:nth-child(2) {
    animation-delay: 0.4s;
  }
  .joker-card:nth-child(3) {
    animation-delay: 0.6s;
  }
  .joker-card:nth-child(4) {
    animation-delay: 0.8s;
  }
  .joker-card:nth-child(5) {
    animation-delay: 1.0s;
  }
  
  @keyframes hover {
    0%,
    100% {
      transform: translateY(0);
    }
    50% {
      transform: translateY(-10px);
    }
  }
  

  
  #opponent-select {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
  }
  
  .opponent-challengers {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }
  
  .cutscene-replay {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
  }
  
  .button-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
    justify-items: center;
  }
  
  #cutscene-replay-return-button {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
  }
  
  #opponent-return-button,
  #achievements-return-button,
  #return-button,
  #cutscene-replay-return-button {
    position: absolute;
    bottom: 10px;
  }

  
  /* Fixed cutscene modal positioning to be relative to main instead of fixed */
  .text-modal {
    position: absolute;
    bottom: 5%;
    width: 50%;
    left: 25%;
    background: var(--sec-color);
    padding: 1em;
    color: white;
    text-shadow: 0px 0px 10px #ffffff;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    z-index: 1000;
  }
  
  #continue-button,
  #skip-button,
  #back-button {
    background: transparent;
    border: none;
    color: white;
    text-shadow: 0px 0px 10px #ffffff;
    cursor: pointer;
  }
  
  #modal-img {
    float: left;
    margin-right: 1em;
    width: 100px;
    height: 100px;
    border-radius: 10px;
    filter: grayscale(100%);
    -webkit-filter: grayscale(100%);
  }
  
  #text-content {
    overflow: auto;
    margin-right: 1em;
  }
  
  #continue-button {
    position: absolute;
    bottom: 10px;
    right: 10px;
  }
  
  #skip-button {
    position: absolute;
    top: 10px;
    right: 10px;
  }
  
  #back-button {
    position: absolute;
    bottom: 10px;
    margin-right: 1em;
  }
  
  /* Fixed cutscene div positioning to be relative to main */
  #cutscene-div {
    background: linear-gradient(135deg, var(--bg-color) 0%, var(--sec-color) 100%);
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 100;
    display: none;
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
  }
  
  /* Enhanced mobile responsiveness and touch-friendly design */
  @media (max-width: 768px) {
    .blackjack-div {
      padding: 10px;
    }
  
    .game-ui {
      position: absolute;
      top: 10px;
      left: 10px;
      right: 10px;
      flex-direction: column;
      gap: 15px;
      z-index: 100;
    }
  
    .score-display {
      /* Show only player score on mobile */
      flex-direction: row;
      justify-content: center;
      padding: 15px;
      gap: 15px;
    }
  
    .score-item {
      flex: 1;
      min-width: 0;
    }
  
    .score-label {
      font-size: 1rem;
    }
  
    /* Updated to target score-value instead of h2 */
    .score-value {
      font-size: 1.5rem;
    }
  
    .game-controls {
      flex-direction: row;
      justify-content: center;
      padding: 15px;
      gap: 10px;
    }
  
    .blackjack-button {
      flex: 1;
      min-height: 44px;
      font-size: 1rem;
      padding: 12px 16px;
      min-width: 80px;
    }
  
    /* Hide house table completely on mobile */
    .house-table {
      display: none;
    }
  

  
    .player-cards-container {
      bottom: 15px;
      left: 15px;
    }
  
    .your-cards {
      gap: 5px;
    }
  }
  
  @media (max-width: 480px) {
    .game-ui {
      top: 5px;
      left: 5px;
      right: 5px;
    }
  
    .score-display {
      padding: 10px;
      gap: 10px;
    }
  
    .score-label {
      font-size: 0.9rem;
    }
  
    /* Updated to target score-value instead of h2 */
    .score-value {
      font-size: 1.3rem;
    }
  
    .game-controls {
      padding: 10px;
      gap: 8px;
    }
  
    .blackjack-button {
      font-size: 0.9rem;
      padding: 10px 12px;
    }
  

  
    .player-cards-container {
      bottom: 10px;
      left: 10px;
    }
  }
  
  @media (max-height: 600px) and (orientation: landscape) {
    .game-ui {
      flex-direction: row;
      justify-content: space-between;
      align-items: flex-start;
    }
  
    .score-display {
      flex-direction: column;
      gap: 10px;
    }
  
    .game-controls {
      flex-direction: column;
      gap: 8px;
    }
  
    .blackjack-button {
      font-size: 0.9rem;
      padding: 8px 12px;
    }
  
    .player-cards-container {
      bottom: 50px;
      right: 50px;
    }
  }
  
  /* Touch-friendly improvements */
  .blackjack-button,
  .menu-button {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  
  .blackjack-button:active,
  .menu-button:active {
    transform: scale(0.95);
  }
  
  /* Prevent zoom on input focus for iOS */
  input,
  select,
  textarea {
    font-size: 16px;
  }