  :root {
    --table-green: #0b5137;
    --card-bg: #fff;
    --card-border: #222;
    --card-radius: 8px;
/*    --card-width: 110px; */
    --card-height: 190px;   /* for jumbo */
     --card-width: calc(var(--card-height) * 0.7142857);
    --accent: #ffcc00;
  }

  * { box-sizing: border-box; }

 
body {
  margin: 0;
  font-family: system-ui, sans-serif;
/*  background: #053322; */
  background: linear-gradient(
  to bottom,
  #0f7f4f,
  #02150e
);

  color: #f5f5f5;
  display: flex;
  justify-content: center;
}

#game {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}
/* orig
#game {
  max-width: 1200px;
  width: 100%;
  padding: 16px;
  background: transparent;
}
*/
/*
  #game {
    max-width: 1200px;
    width: 100%;
    padding: 16px;
  }
*/
html, body {
  height: 100%;
  background: linear-gradient(to bottom, #0f7f4f, #02150e);
}
/* orig
  h1 {
    text-align: center;
    margin: 0 0 8px;
    letter-spacing: 0.08em;
    font-size: 24px;
    color: #ffe58f;
    text-shadow: 0 0 8px #000;
  }
*/

h1 {
    letter-spacing: 0.08em;
    font-size: 24px;
    color: #ffe58f;
    text-shadow: 0 0 8px #000;
  }

#title {
  position: absolute;
  margin: 0;
  padding: 0;
  /*  pointer-events: none; */ /* optional: title shouldn't block clicks */

  /* new so it it clickable */
  cursor: pointer;
  user-select: none;
  z-index: 9999; /* ensures it's on top */

}

#title:hover { opacity: 0.85; }


#status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    gap: 8px;
    font-size: 14px;
}

#message {
    flex: 1;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 999px;
    max-width: 500px;
    text-align: center;
}


button {
    border-radius: 999px;
    border: none;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    background: linear-gradient(135deg, #ffe58f, #ffb400);
    color: #333;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
  }

  #btn-new {
    border-radius: 999px;
    border: none;
    padding:10px 20px;
    font-size:1.4rem;
    font-weight: 600;
    cursor: pointer;
    background: linear-gradient(135deg, #ffe58f, #ffb400);
    color: #333;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
    position: absolute;
    width: 140px;   /* or whatever looks good */
    text-align: center;

    position: absolute;
    left: 90%;
    top:  40%;
    transform: translateX(-50%);
  }
  #btn-newMatch {
    border-radius: 999px;
    border: none;
    padding:10px 20px;
    font-size:1.4rem;
    font-weight: 600;
    cursor: pointer;
    background: linear-gradient(135deg, #ffe58f, #ffb400);
    color: #333;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
    position: absolute;
    width: 140px;   /* or whatever looks good */
    text-align: center;

    position: absolute;
    left: 90%;
    top:  40%;
    transform: translateX(-50%);
  }

  
  #btn-knock {
    border-radius: 999px;
    border: none;
    padding:10px 20px;
    font-size:1.4rem;
    font-weight: 600;
    cursor: pointer;
    background: linear-gradient(135deg, #ffe58f, #ffb400);
    color: #333;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
    position: absolute;
    width: 140px;   /* or whatever looks good */
    text-align: center;
    position: absolute;
    left: 90%;
    top: 40%;
    transform: translateX(-50%);
  }
  
  #btn-gin {
    border-radius: 999px;
    border: none;
    padding:10px 20px;
    font-size:1.4rem;
    font-weight: 600;
    cursor: pointer;
    background: linear-gradient(135deg, #ffe58f, #ffb400);
    color: #333;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
    position: absolute;
    width: 140px;   /* or whatever looks good */
    text-align: center;
    position: absolute;
    left: 90%;
    top: 40%;
    transform: translateX(-50%);
  }

    #btn-bigGin {
    border-radius: 999px;
    border: none;
    padding:10px 20px;
    font-size:1.4rem;
    font-weight: 600;
    cursor: pointer;
    background: linear-gradient(135deg, #ffe58f, #ffb400);
    color: #333;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
    position: absolute;
    width: 140px;   /* or whatever looks good */
    text-align: center;

    position: absolute;
    left: 90%;
    top:  40%;
    transform: translateX(-50%);
  }

  /*
  button:disabled {
    opacity: 0.4;
    cursor: default;
    box-shadow: none;
  }
*/

  .row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    align-items: center;
  }


  .hand {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
  }

  .card {
    width: var(--card-width);
    height: var(--card-height);
    border-radius: var(--card-radius);
    border: 1px solid var(--card-border);
    position: relative;
    overflow: hidden;

    /* The important part */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;

  }

  
  .player-card.layoff-used {
  top: 375px !important;  
/*  transition: top 0.2s ease;
  z-index: 999;
*/
  outline: 6px solid #ffe58f;
  }
   

/*  
.player-card.layoff-used {
    opacity: 0.45;
    filter: grayscale(60%);
    outline: 2px solid rgba(255,255,255,0.4);
    border-radius: var(--card-radius);
}
*/
  
#player.normal .card {
  width: var(--card-width);
  height: var(--card-height);
}

#player.small .card {
  width: calc(var(--card-width) * 0.8);
  height: calc(var(--card-height) * 0.8);
}

#player.smaller .card {
  width: calc(var(--card-width) * 0.65);
  height: calc(var(--card-height) * 0.65);
}

#player.tiny .card {
  width: calc(var(--card-width) * 0.5);
  height: calc(var(--card-height) * 0.5);
}

  /*
  .card {
      background-color: red;
      background: none;

    width: var(--card-width);
    height: var(--card-height);
    border-radius: var(--card-radius);
    border: 1px solid var(--card-border);
    background: var(--card-bg);
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.5);
    position: relative;
    padding: 0; 
    display: block; 
    flex-direction: column;
    justify-content: space-between;
    cursor: default;
    transition: transform 0.08s ease, box-shadow 0.08s ease, border-color 0.08s ease;
    background-origin: border-box;
    background-clip: border-box;

  overflow: hidden; 

  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
*/

  
  .hand-area.normal .card {
  transform: scale(1);
  transform-origin: top left;
}

  .hand-area.small .card {
  transform: scale(0.8);
  transform-origin: top left;
}

.hand-area.smaller .card {
  transform: scale(0.65);
  transform-origin: top left;
}

.hand-area.tiny .card {
  transform: scale(0.5);
  transform-origin: top left;
}

/*
.card.just-drawn {
  border-color: #ffb400;
  box-shadow: 0 0 40px #ffb400;
  transform: scale(1.1);
}
*/
/*
.card.just-drawn {
    outline: 5px solid #ffb400;
    outline-offset: -4px;
    border-color: #ffb400;
    box-shadow: 0 0 18px #ffb400;
    transform: scale(1.1);
}
*/

.card.just-drawn {
    transform: scale(1.12);
    border-color: #ffb400;
    outline: 4px solid #ffb400;
    outline-offset: -3px;
    box-shadow: 0 0 25px rgba(255, 180, 0, 0.8);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}


  .card.player-card {
    cursor: pointer;
  }

  .card.player-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 7px 0 rgba(0, 0, 0, 0.65);
    border-color: #ffb400;
  }

  .card.meld-card {
    box-shadow: 0 4px 0 rgba(0,0,0,0.5), 0 0 8px rgba(255,255,255,0.35);
  }


  .meld-gap {
  width: 50px;
  display: inline-block;
}

  
.meld-gap-between {
    width: 50px;   
    height: 1px;
    pointer-events: none;
}
 
  
  /*
.meld-gap {
  width: 50px;
  height: 1px;
}
 */
  
  .card.back {
    background: repeating-linear-gradient(
      135deg,
      #17506b,
      #17506b 6px,
      #0b2b3c 6px,
      #0b2b3c 12px
    );
    display: flex;
    align-items: center;
    justify-content: center;
    color: #e2f3ff;
    font-weight: 700;
    font-size: 22px;
  }

  /* the cpu cards */
  /*
  #cpu {
      position: relative;
      height: 150px;
      padding-left: 600px;
      transform: translateX(-40px);
  }
   */
   
  .card.layoff-used-cpu {
/*      
    top: calc(var(--cpu-card-top, 0px) + 40px) !important;
    transition: top 0.2s ease;
    z-index: 999;
} 
  .player-card.layoff-used {

  top: 4px !important;  
  transition: top 0.2s ease;
  z-index: 999;
*/
      outline: 6px solid #ffe58f;
      top: 75px !important;  

  }

  .corner {
    position: absolute;
    top: 4px;
    left: 4px;
  }

  .corner.bottom {
    top: auto;
    left: auto;
    right: 4px;
    bottom: 4px;
    transform: rotate(180deg);
  }

  .corner .rank {
      font-size: calc(var(--card-width) * 0.18);
  }
  
.corner .suit {
    font-size: calc(var(--card-width) * 0.20);
}

/* eh???
.rank { font-size: 22px; font-weight: 700; }
.suit { font-size: 24px; }

.red { color: #d11f3a; }
.black { color: #111; }
*/

#center-area {
    display: flex;
    justify-content: center;
    gap: 24px;
    align-items: center;
    margin: 8px 0 4px;
/*    margin-left: -190px; 
    margin-top: 90px; */
}

#tally-area {
/*  background: #0f7f4f; */
  background: transparent;
  border: none;
  border-radius: 8px;
  padding: 16px;
  width: fit-content;
  text-align: left;
  font-size: 16px;
  line-height: 1.4;
}

.tally-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 12px;
  text-align: center;
}

.tally-line {
  margin: 4px 0;
}


.knock-bubble {
  position: absolute;
  display: none;
  z-index: 1000;
  font-size: 32px;
  font-weight: bold;
  color: lightblue;
  background: white;
  border: 4px solid black;
  border-radius: 40px;
  padding: 20px 40px;
  box-shadow: 0 0 12px rgba(0,0,0,0.3);
  text-align: center;
  transform: scale(1);
  transition: opacity 0.3s ease, transform 0.3s ease;
  overflow: hidden; /* important for shimmer */
}

.knock-bubble::before {
  content: "";
  position: absolute;
  top: 0;
  left: -150%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    120deg,
    transparent 0%,
    rgba(255,255,255,0.6) 50%,
    transparent 100%
  );
  animation: shimmer 1.5s ease-out forwards;
}

.knock-bubble {
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.03); }
}

@keyframes shimmer {
  0% { left: -150%; }
  100% { left: 150%; }
}

#deadwood-info {
    margin-top: 4px;
    text-align: center;
    font-size: 20px;
    margin-left: -145px; /* move left */
  }

  /*
  #log {
    margin-top: 10px;
    max-height: 120px;
    overflow-y: auto;
    font-size: 12px;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.55);
    border-radius: 8px;
  }
 */
  #log {
  position: fixed;          /* stays in place on screen */
  right: 100px;              /* distance from right edge */
  top: 50%;                 /* vertical midpoint */
  transform: translateY(-70%); /* perfect vertical centering */

  width: 35ch;              /* ~25 characters wide */
  max-height: calc(1.2em * 9); /* 8 lines visible */
  overflow-y: auto;         /* scroll when full */

  margin: 0;
  padding: 6px 8px;

  font-size: 12px;
  line-height: 1.2em;       /* consistent line height */

  background: rgba(0, 0, 0, 0.55);
  border-radius: 8px;
}
#log p {
  margin: 0 0 4px 0;
}
/*
  #log p { margin: 2px 0; }
*/
  @media (max-width: 800px) {
    .card {
      width: 52px;
      height: 78px;
    }
  }

  .modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  justify-content: center;
  align-items: center;
      z-index: 999999;        /* higher than anything else */
}

  .modal-content {
       position: relative; /* <-- THIS is required */
  background: white;
  padding: 20px;
  border-radius: 8px;
  max-height: 80vh;      
  overflow-y: auto;      
  box-sizing: border-box;
/*  resize: both; */

}


/* Shared X button styling */
.modal-close {
    position: absolute;
    top: 10px;
    font-size: 24px;
    font-weight: bold;
     color: #c00; /* 🔥 red X */
    cursor: pointer;
    user-select: none;
    transition: 0.2s;
    z-index: 9999;
}

.modal-close:hover {
    color: black;
    transform: scale(1.2);
}

/* Left X */
.modal-close.left {
    left: 10px;
}

/* Right X */
.modal-close.right {
    right: 10px;
}


#modal-text {
    display: block; /* forces it onto its own line rev8 */
    color: black;
    /*  font-family: "Courier New", monospace;  */
    white-space: pre; /* preserves alignment and newlines */
}

#modal-extra {
    color: black;
}

.modal-header {
/*  display: inline-block;*/     /* shrink to fit text */
  font-size: 14px;           /* smaller text */
  font-weight: 600;
  padding: 4px 10px;         /* small pill shape */
  background: lightgrey;       /* light gray */
  border-radius: 6px;
  margin-bottom: 10px;       /* spacing above content */
  cursor: move;              /* optional: looks draggable */
  color: black;

  display: block;
  width: fit-content;
  margin: 0 auto 10px auto;   /* centers the badge */
  text-align: center;
  padding-bottom: 6px;
  
}

.resize-handle {
  position: absolute;
  width: 16px;
  height: 16px;
  right: 4px;
  bottom: 4px;
  cursor: se-resize;
  background:
    linear-gradient(135deg, transparent 50%, rgba(0,0,0,0.3) 50%) 0 0,
    linear-gradient(135deg, transparent 50%, rgba(0,0,0,0.3) 50%) 4px 4px,
    linear-gradient(135deg, transparent 50%, rgba(0,0,0,0.3) 50%) 8px 8px;
  background-size: 4px 4px;
  background-repeat: no-repeat;
  border-radius: 4px;
  touch-action: none;
}

#player {
  width: 100%;
  display: block;
  position: relative;
}


/*
.scoreboard {
    display: flex;
  justify-content: center;
  align-items: center;
  gap: 22px;
  margin: 12px 0 20px;
  font-family: "Segoe UI", sans-serif;
  margin: 12px auto 20px; 
  margin-left: auto;
  margin-right: auto;
  width: fit-content;
  transform: translateX(-40px);
  transform: translateY(0px); 
}
*/
.scoreboard {
  position: absolute;        /* allows free placement */
  left: 40px;                /* push to far left */
  top: 40%;                  /* vertical center */
  transform: translateY(-50%); /* perfect centering */

  display: flex;
  flex-direction: column;    /* CPU on top, You on bottom */
  align-items: center;
  gap: 18px;

  font-family: "Segoe UI", sans-serif;
}

.score-block {
  background: linear-gradient(180deg, #1e3a8a, #1e40af); /* deep blue */
  color: white;
  padding: 10px 22px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25),
              inset 0 0 10px rgba(255,255,255,0.15);
  text-align: center;
  min-width: 90px;
  transition: transform 0.2s ease;
  transform: scale(1.25); /* 25% bigger */
}

.score-block .label {
  font-size: 14px;
  opacity: 0.85;
  letter-spacing: 0.5px;
}

.score-block .value {
  font-size: 30px;
  font-weight: 700;
  margin-top: 2px;
  text-shadow: 0 0 6px rgba(255,255,255,0.6);
}

.divider {
  font-size: 20px;
  color: #1e3a8a;
  font-weight: 700;
  opacity: 0.7;
}

/* Optional bump animation */
.score-bump {
  animation: bump 0.3s ease;
}

.star {
  position: absolute;
  font-size: 24px;     /* adjust as needed */
  color: gold;         /* or whatever theme you want */
  pointer-events: none;
}

#star-tr {
  cursor: pointer;
  pointer-events: auto;
  width: 40px;
  height: 40px;
  font-size: 24px; /* optional, but harmless now */
}
/*
#star-ml {
  cursor: pointer;
  pointer-events: auto;
  width: 40px;
  height: 40px;
  font-size: 80px;
  color: red;
  text-align: center;
}
*/

#star-ml {
  cursor: pointer;
  pointer-events: auto;
  padding: 8px 14px;
  background: gold;        /* #0b5137; */
/*  border: 2px solid #d33; */
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: black;  /* white; */
  text-align: center;
  width: fit-content;
  user-select: none;
  transition: all 0.15s ease;
}
/*
#star-ml:hover {
  background: #ffe5e5;
  border-color: #b00;
  color: #b00;
  transform: translateY(-1px);
}

#star-ml:active {
  transform: translateY(1);
  background: #ffd6d6;
}
*/

#star-mla {
  position: absolute;
  font-size: 16px;     /* adjust as needed */
  color: white;         /* or whatever theme you want */
  pointer-events: none;
}
#star-mlb {
  position: absolute;
  font-size: 16px;     /* adjust as needed */
  color: white;         /* or whatever theme you want */
  pointer-events: none;
}
#star-mlc {
  position: absolute;
  font-size: 16px;     /* adjust as needed */
  color: white;         /* or whatever theme you want */
  pointer-events: none;
}

@keyframes bump {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.25); }
  100% { transform: scale(1); }
}

.discard-animate {
  animation: discardDrop 200ms ease-out;
}

@keyframes discardDrop {
  0% {
    transform: scale(0.7) rotate(-8deg);
    opacity: 0;
  }
  60% {
    transform: scale(1.08) rotate(2deg);
    opacity: 1;
  }
  100% {
    transform: scale(1) rotate(0deg);
  }
}

/* Scoreboard is clickable */
.scoreboard {
  cursor: pointer;
  user-select: none;
}

.scoreboard * {
  pointer-events: none;
}

/*
#back-door {
    position: fixed;
    bottom: 20px;
    right: 20px;
    
    flex-wrap: wrap;
    gap: 8px 12px;
    
    
    background: rgba(0,0,0,0.4);
    
    padding: 4px 8px;
    font-size: 8px;
		  
    border-radius: 8px;
  }
   */
#back-door {
  position: fixed;
  bottom: 20px;
/*  right: 200px;*/
  right: 50%;
  
  flex-wrap: wrap;
  gap: 8px 12px;

  background: rgba(0,0,0,0.4);
  padding: 4px 8px;
  font-size: 12px;   /* affects text, but not buttons */
  border-radius: 8px;
}

#back-door button {
  font-size: 14px;   /* this is the important part */
  padding: 3px 6px;
}

/*
#back-door {
/ flex-wrap: wrap;
  gap: 8px 12px;      
  max-width: 600px;
  margin-top: 600px;
  margin-left: 300px;   
}
 */
 
.help-active {
  background: #0078d4;   /* Microsoft blue, looks professional */
  color: white;
  font-weight: 600;
  border-radius: 4px;
}

.gameRules-active {
  background: #0078d4;   /* Microsoft blue, looks professional */
  color: white;
  font-weight: 600;
  border-radius: 4px;
}


.starflash {
  position: absolute;
  width: 10px;   
  height: 10px;
  background: #FFD700; 
  clip-path: polygon(
    50% 0%,
    61% 35%,
    98% 35%,
    68% 57%,
    79% 91%,
    50% 70%,
    21% 91%,
    32% 57%,
    2% 35%,
    39% 35%
  );
  opacity: 0;
  animation: starFlash 0.8s ease-out forwards;

  
  box-shadow:
      0 0 6px #FFD700,
      0 0 10px #FFEA00,
      0 0 14px rgba(255, 215, 0, 0.8);
}



@keyframes starFlash {
  0%   { opacity: 0; transform: scale(0.2); }
  40%  { opacity: 1; transform: scale(1.8); }
  100% { opacity: 0; transform: scale(0.1); }
}


#starburst-canvas {
    position: fixed;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 999999;
    display: block;
}
