/* Thanks to
   @donpark on GitHub Scalable CSS Playing Cards
   https://donpark.github.io/scalable-css-playing-cards/ */

@font-face {
  font-family: 'Suit-Regular';
  src: url("../fonts/suit-regular.eot");
  src: url("../fonts/suit-regular.eot?#iefix") format('embedded-opentype'), url("../fonts/suit-regular.woff") format('woff'), url("../fonts/suit-regular.ttf") format('truetype'), url("../fonts/suit-regular.svg#suit-regular") format('svg');
  font-weight: normal;
  font-style: normal;
}
html, body {
   width: 100%;
   height: 100%;
}
body {
  position: relative;
  color: #f3f5f7;
  background: #0e8b44 url('../img/green_felt.jpg');
  background-size: cover;
  background-position: center;
  overflow: hidden;
  margin: 0;
}
/* include box-sizing to prevent width overflow causing wrapping */
*, *::before, *::after {
  box-sizing: border-box;
}
.container {
  padding-right:15px;
  padding-left:15px;
  margin-right:auto;
  margin-left:auto
}
@media (min-width:768px) {
  .container {
    width:750px
  }
}
@media (min-width:992px) {
  .container {
    width:970px
  }
}
@media (min-width:1200px) {
  .container {
    width:1170px
  }
}
.navbar {
   background: rgba(8,8,8,.75);
}
.navbar a {
   color: #fff;
}
.navbar li[data-active="false"] {
   opacity: 0.5;
   pointer-events: none;
}
.navbar li[data-active="true"] {
   opacity: 1;
   pointer-events: auto;
}
.template {
   display: none;
}
#score {
   position: relative;
   z-index: 10;
   background: rgba(0,0,0,.15);
   margin-top: 1.5em;
   margin-bottom: 0.5em;
   padding: 1em;
   line-height: 1;
   display: flex;
   justify-content: space-between;
   align-items: center;
}

/* Responsive tweaks for narrow/mobile portrait screens:
   - Stack controls and stats
   - Make each stat compact and readable
   - Hide redundant labels and surface the values
*/
@media (max-width: 480px) {
  #score {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    padding: 0.6rem;
  }

  /* Left controls: keep buttons visible but compact */
  #score .left-controls {
    width: 100%;
    display: flex;
    justify-content: flex-start;
    gap: 0.35rem;
    align-items: center;
  }
  #score .left-controls > button {
    padding: 0.35rem 0.5rem;
    font-size: 1.1rem;
    line-height: 1;
  }
  #score .left-controls > button svg {
    width: 1.1em;
    height: 1.1em;
  }

  /* Right stats: allow wrapping, make each stat a compact pill */
  #score .right-stats {
    width: 100%;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-left: 0;
    justify-content: space-between;
  }
  #score .right-stats > * {
    flex: 1 1 45%;
    min-width: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0.5rem;
    background: rgba(255,255,255,0.03);
    border-radius: 6px;
    font-size: 0.95rem;
  }

  /* Hide text labels to save horizontal space, keep numeric/value visible */
  /* Keep labels visible but compact so they remain readable on mobile */
  #score label {
    display: inline-block;
    margin: 0;
    padding: 0;
    font-size: 0.75rem;
    opacity: 0.95;
    margin-right: 0.35rem;
  }
  #score .right-stats span {
    font-weight: 700;
    font-size: 1.05rem;
  }

  /* Make the settings icon slightly smaller so layout breathes */
  #score .left-controls #open-settings {
    font-size: 1.2rem;
  }
}

/* Slightly looser rules for small tablets / larger phones */
@media (min-width: 481px) and (max-width: 767px) {
  #score {
    padding: 0.8rem;
    gap: 0.4rem;
  }
  #score .right-stats > * {
    flex: 1 1 30%;
    padding: 0.3rem 0.5rem;
  }
  #score label { display: inline-block; font-size: 0.85rem; opacity: 0.9; margin-right: 0.35rem; }
  #score .right-stats span { font-size: 1rem; }
}
#score .left-controls,
#score .right-stats {
   display: flex;
   align-items: center;
}

#score .right-stats {
   gap: 0.75rem;
}


#score .right-stats {
   margin-left: auto;
}
#score .right-stats > * {
   min-width: auto;
}
#score label {
   margin-bottom: 0;
}

/* Unified styles for left controls buttons */
#score .left-controls > button {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 1.1rem;
  padding: 0.25em 0.5em;
  border-radius: 4px;
  cursor: pointer;
  vertical-align: middle;
  display: inline-block;
  line-height: 1;
}

#score .left-controls #open-settings {
  font-size: 1.4rem;
}
 
/* icons inside buttons should size consistently */
#score .left-controls > button svg {
  width: 1.25em;
  height: 1.25em;
  vertical-align: middle;
  fill: currentColor;
}
 
/* restart is an icon-only button: remove extra padding */
#restart {
  padding: 0;
  margin: 0;
}
#auto-win {
   display: none;
   -webkit-appearance: none;
   outline: none;
   border: 0;
   position: absolute;
   z-index: 1;
   bottom: 0;
   width: 100%;
   background: rgba(0,0,0,.8);
   padding: 1em;
   line-height: 1;
}
#table {
   opacity: 1;
   width: 100%;
   padding: 15px 0;
}
#table > div {
   position: relative;
   margin-bottom: 10px;
}
#table > div:last-child {
   margin-bottom: 0;
}
#table > div::after {
   content: '';
   display: table-cell;
   clear: both;
}
#table ul {
   display: inline-block;
   padding: 0;
}
#table > div > ul {
   position: absolute;
   top: 0;
   left: 0;
   width: 100%;
   height: 100%;
}
.pile {
   display: block;
   position: relative;
   float: left;
   width: calc((100% - 9%) / 7);
   margin-right: 1.5%;
   margin-bottom: 10px;
   padding: 5px;
}
.pile:last-child {
   margin-right: 0;
}
.pile::after {
   content: '';
   position: absolute;
   top: 0;
   left: 0;
   width: 100%;
   height: 100%;
   border: 2px dotted rgba(0,0,0,.25);
   border-radius: 5px;
}
.card {
   display: block;
   position: absolute;
   top: 0;
   left: 0;
   background-color: #ddd;
   background-image: url('../img/card_back_bg.png');
   background-size: contain;
   background-repeat: no-repeat;
   width: 100%;
   height: 100%;
   font-family: 'Suit-Regular', sans-serif;
   font-size: 0.6vw;
   border-radius: 5px;
   z-index: -1;
}
.card * {
   pointer-events: none;
}
@media screen and (min-width: 768px) {
   .card {
      font-size: 0.3em;
   }
   .pile::after, .card {
      border-radius: 10px;
   }
}
@media screen and (min-width: 992px) {
   .card {
      font-size: 0.4em;
   }
}
@media screen and (min-width: 1200px) {
   .card {
      font-size: 0.45em;
   }
}
.card > div {
   display: none;
}
.card.up {
    background-image: url('../img/card_face_bg.png');
    background-repeat: repeat;
    color: #111;
}
.card.up > div {
   display: block;
}
.card::before {
   content: '';
   display: block;
   position: absolute;
   width: 100%;
   height: 100%;
   border-radius: 5px;
}
.card[data-selected="true"]::before {
   box-shadow: 0 0 6px 3px #FCDB1A;
}
@media screen and (min-width: 768px) {
   .card::before {
      border-radius: 10px;
   }
}
.card .suit {
   font-size: 5.8em;
   font-weight: normal;
   width: 0.6896551724137931em;
   height: 0.786206896551724em;
   line-height: 0.786206896551724em;
   position: absolute;
   text-align: center;
}
@media screen and (max-width: 767px) {
   .card > div > .suit {
      display: none;
   }
}
.card .heart,
.card .diamond {
   color: #cc0000;
}
.card .spade .suit::before { content: '♠' }
.card .heart .suit::before { content: '♥' }
.card .diamond .suit::before { content: '♦' }
.card .club .suit::before { content: '♣' }
.card .corner {
   line-height: 1;
   position: absolute;
   text-align: center;
}
.card .corner span {
   display: block;
   font-size: 9em;
   font-weight: bold;
   width: 1em;
   text-align: center;
}
@media screen and (min-width: 768px) {
   .card .corner span {
      font-size: 3em;
   }
}
.card .corner .suit {
   margin-top: 0;
   margin-left: 0;
}
.card .corner.top {
   left: 0.64em;
   top: 0.96em;
}
.card .corner.bottom {
   bottom: 0.96em;
   right: 0.64em;
   -ms-transform: rotate(180deg);
   -moz-transform: rotate(180deg);
   -webkit-transform: rotate(180deg);
   transform: rotate(180deg);
}
.card .ace span.suit.middle_center {
   font-size: 10.24em;
   left: 50%;
   top: 50%;
   margin-top: -0.5em;
   margin-left: -0.35em;
}
.card .face::before {
   display: none;
   content: '';
   position: absolute;
   top: 15.25%;
   left: 19%;
   width: 62%;
   height: 70.5%;
   background-repeat: no-repeat;
   background-size: contain;
}
@media screen and (min-width: 768px) {
   .card .face::before {
      display: block;
   }
}
.card .spade.king .face::before {
   background-image: url('../img/face-king-spade.png');
}
.card .spade.queen .face::before {
   background-image: url('../img/face-queen-spade.png');
}
.card .spade.jack .face::before {
   background-image: url('../img/face-jack-spade.png');
}
.card .heart.king .face::before {
   background-image: url('../img/face-king-heart.png');
}
.card .heart.queen .face::before {
   background-image: url('../img/face-queen-heart.png');
}
.card .heart.jack .face::before {
   background-image: url('../img/face-jack-heart.png');
}
.card .diamond.king .face::before {
   background-image: url('../img/face-king-diamond.png');
}
.card .diamond.queen .face::before {
   background-image: url('../img/face-queen-diamond.png');
}
.card .diamond.jack .face::before {
   background-image: url('../img/face-jack-diamond.png');
}
.card .club.king .face::before {
   background-image: url('../img/face-king-club.png');
}
.card .club.queen .face::before {
   background-image: url('../img/face-queen-club.png');
}
.card .club.jack .face::before {
   background-image: url('../img/face-jack-club.png');
}
.card .suit.top_center {
   left: 50%;
   top: 0;
   margin-left: -0.35em;
   margin-top: 0.65em;
}
.card .suit.top_left {
   left: 0;
   top: 0;
   margin-left: 0.65em;
   margin-top: 0.65em;
}
.card .suit.top_right {
   right: 0;
   top: 0;
   margin-right: 0.65em;
   margin-top: 0.65em;
}
.card .suit.middle_center {
   left: 50%;
   top: 50%;
   margin-left: -0.35em;
   margin-top: -0.5em;
}
.card .suit.middle_top {
   left: 50%;
   top: 0;
   margin-left: -0.35em;
   margin-top: 1.25em;
}
.card .suit.middle_bottom {
   bottom: 0;
   left: 50%;
   margin-bottom: 0.65em;
   margin-left: -0.35em;
   -ms-transform: rotate(180deg);
   -moz-transform: rotate(180deg);
   -webkit-transform: rotate(180deg);
   transform: rotate(180deg);
}
.card .suit.middle_left {
   left: 0;
   top: 50%;
   margin-left: 0.65em;
   margin-top: -0.5em;
}
.card .suit.middle_right {
   right: 0;
   top: 50%;
   margin-right: 0.65em;
   margin-top: -0.5em;
}
.card .suit.middle_top_center {
   left: 50%;
   top: 50%;
   margin-left: -0.35em;
   margin-top: -1.35em;
}
.card .suit.middle_top_left {
   left: 0;
   top: 50%;
   margin-left: 0.65em;
   margin-top: -1em;
}
.card .suit.middle_top_right {
   right: 0;
   top: 50%;
   margin-right: 0.65em;
   margin-top: -1em;
}
.card .suit.middle_bottom_left {
   bottom: 50%;
   left: 0;
   margin-left: 0.65em;
   margin-bottom: -1em;
   -ms-transform: rotate(180deg);
   -moz-transform: rotate(180deg);
   -webkit-transform: rotate(180deg);
   transform: rotate(180deg);
}
.card .suit.middle_bottom_right {
   bottom: 50%;
   right: 0;
   margin-bottom: -1em;
   margin-right: 0.65em;
   -ms-transform: rotate(180deg);
   -moz-transform: rotate(180deg);
   -webkit-transform: rotate(180deg);
   transform: rotate(180deg);
}
.card .suit.middle_bottom_center {
   bottom: 50%;
   left: 50%;
   margin-bottom: -1.35em;
   margin-left: -0.35em;
   -ms-transform: rotate(180deg);
   -moz-transform: rotate(180deg);
   -webkit-transform: rotate(180deg);
   transform: rotate(180deg);
}
.card .suit.bottom_center {
   bottom: 0;
   left: 50%;
   margin-bottom: 0.65em;
   margin-left: -0.35em;
   -ms-transform: rotate(180deg);
   -moz-transform: rotate(180deg);
   -webkit-transform: rotate(180deg);
   transform: rotate(180deg);
}
.card .suit.bottom_left {
   bottom: 0;
   left: 0;
   margin-bottom: 0.65em;
   margin-left: 0.65em;
   -ms-transform: rotate(180deg);
   -moz-transform: rotate(180deg);
   -webkit-transform: rotate(180deg);
   transform: rotate(180deg);
}
.card .suit.bottom_right {
   bottom: 0;
   right: 0;
   margin-bottom: 0.65em;
   margin-right: 0.65em;
   -ms-transform: rotate(180deg);
   -moz-transform: rotate(180deg);
   -webkit-transform: rotate(180deg);
   transform: rotate(180deg);
}
.card:nth-child(1),
.card:nth-child(2),
.card:nth-child(3),
.card:nth-child(4),
.card:nth-child(5) {
   box-shadow: 0 0 5px rgba(0,0,0,.25), 0 2px 1px rgba(0,0,0,.5);
   z-index: 1;
}
.card:nth-child(1) { top: 0; z-index: 5; }
.card:nth-child(2) { top: 2px; z-index: 4; }
.card:nth-child(3) { top: 4px; z-index: 3; }
.card:nth-child(4) { top: 6px; z-index: 2; }
.card:nth-child(5) { top: 8px; z-index: 1; }

.draw3 .card:nth-child(1) { top: 0; z-index: 5; left: 56px; }
.draw3 .card:nth-child(2) { top: 2px; z-index: 4; left: 28px; }

/* stock */
   .stock {
      z-index: 1;
   }
/* small visual tweak: display reload counter in stock reload-icon */
.stock .reload-icon span {
  font-weight: bold;
  color: #fff;
  background: rgba(0,0,0,0.35);
  border-radius: 50%;
  width: 1.25em;
  height: 1.25em;
  display: inline-block;
  line-height: 1.25em;
  text-align: center;
}
   .stock .reload-icon {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      font-size: 3vw;
      font-weight: bold;
      line-height: 1;
      opacity: 0.25;
      z-index: 1;
   }
   @media screen and (max-width: 767px) {
      .stock .reload-icon {
         font-size: 5vw;
      }
   }
   .stock .reload-icon span {
      display: block;
      position: absolute;
      top: 50%;
      left: 0;
      width: 100%;
      text-align: center;
      padding: 0.25em;
      margin-top: -0.75em;
      pointer-events: none;
   }
   .stock .reload-icon span::before,
   .stock .reload-icon span::after {
      content: '';
      display: inline-block;
      border-style: solid;
   }
   .stock .reload-icon span::before {
      width: 1.25em;
      height: 1.25em;
      border-color: transparent black black black;
      border-radius: 50%;
      border-width: .125em;
      -webkit-transform: rotate(45deg);
      transform: rotate(45deg);
   }
   .stock .reload-icon span::after {
      position: absolute;
      top: 0;
      left: 50%;
      width: 0;
      height: 0;
      border-color: transparent transparent transparent black;
      border-width: .3125em 0 .3125em .5em;
   }


/* waste */
   .waste {
      z-index: 1;
   }

/* foundation */
   .fnd .pile {
      left: 43.5%;
   }
   .fnd .pile::before {
      content: '';
      position: absolute;
      top: 50%;
      left: 0;
      width: 100%;
      color: #000;
      font-family: 'Suit-Regular', sans-serif;
      font-size: 10vw;
      margin-top: -0.6em;
      line-height: 1;
      text-align: center;
      opacity: 0.25;
   }
   @media screen and (min-width: 768px) {
      .fnd .pile::before {
         font-size: 6em;
      }
   }
   @media screen and (min-width: 992px) {
      .fnd .pile::before {
         font-size: 7em;
      }
   }
   @media screen and (min-width: 1200px) {
      .fnd .pile::before {
         font-size: 8em;
      }
   }
   .fnd .pile.spades::before { content: '♠' }
   .fnd .pile.hearts::before { content: '♥' }
   .fnd .pile.diamonds::before { content: '♦' }
   .fnd .pile.clubs::before { content: '♣' }

/* tableau */
   .tab .card {
      box-shadow: 0 0 5px rgba(0,0,0,.5);
      z-index: 1;
      margin-bottom: 10em;
   }
   /* face up */
   .tab .card:nth-child(2) { top: 5em; left: 0; }
   .tab .card:nth-child(3) { top: 10em; left: 0; }
   .tab .card:nth-child(4) { top: 15em; left: 0; }
   .tab .card:nth-child(5) { top: 20em; left: 0; }
   .tab .card:nth-child(6) { top: 25em; left: 0; }
   .tab .card:nth-child(7) { top: 30em;  left: 0; }
   .tab .card:nth-child(8) { top: 35em;  left: 0; }
   .tab .card:nth-child(9) { top: 40em;  left: 0; }
   .tab .card:nth-child(10) { top: 45em;  left: 0; }
   .tab .card:nth-child(11) { top: 50em;  left: 0; }
   .tab .card:nth-child(12) { top: 55em;  left: 0; }
   .tab .card:nth-child(13) { top: 60em;  left: 0; }
   .tab .card:nth-child(14) { top: 65em;  left: 0; }
   .tab .card:nth-child(15) { top: 70em;  left: 0; }
   .tab .card:nth-child(16) { top: 75em;  left: 0; }
   .tab .card:nth-child(17) { top: 80em;  left: 0; }
   .tab .card:nth-child(18) { top: 85em;  left: 0; }
   .tab .card:nth-child(19) { top: 90em;  left: 0; }
   .tab .card:nth-child(20) { top: 95em;  left: 0; }
   .tab .card:nth-child(21) { top: 100em;  left: 0; }
   /* face down */
   .tab .pile[data-unplayed='1'] .card:nth-child(2),
   .tab .pile[data-unplayed='2'] .card:nth-child(2),
   .tab .pile[data-unplayed='3'] .card:nth-child(2),
   .tab .pile[data-unplayed='4'] .card:nth-child(2),
   .tab .pile[data-unplayed='5'] .card:nth-child(2),
   .tab .pile[data-unplayed='6'] .card:nth-child(2) { top: 3em; }
   .tab .pile[data-unplayed='2'] .card:nth-child(3),
   .tab .pile[data-unplayed='3'] .card:nth-child(3),
   .tab .pile[data-unplayed='4'] .card:nth-child(3),
   .tab .pile[data-unplayed='5'] .card:nth-child(3),
   .tab .pile[data-unplayed='6'] .card:nth-child(3) { top: 6em; }
   .tab .pile[data-unplayed='3'] .card:nth-child(4),
   .tab .pile[data-unplayed='4'] .card:nth-child(4),
   .tab .pile[data-unplayed='5'] .card:nth-child(4),
   .tab .pile[data-unplayed='6'] .card:nth-child(4) { top: 9em; }
   .tab .pile[data-unplayed='4'] .card:nth-child(5),
   .tab .pile[data-unplayed='5'] .card:nth-child(5),
   .tab .pile[data-unplayed='6'] .card:nth-child(5) { top: 12em; }
   .tab .pile[data-unplayed='5'] .card:nth-child(6),
   .tab .pile[data-unplayed='6'] .card:nth-child(6) { top: 15em; }
   .tab .pile[data-unplayed='6'] .card:nth-child(7) { top: 18em; }
   /* piles with odd # of face down cards */
   .tab .pile[data-unplayed='1'] .card:nth-child(3) { top: 9em; left: 0; }
   .tab .pile[data-unplayed='1'] .card:nth-child(4),
   .tab .pile[data-unplayed='3'] .card:nth-child(5) { top: 15em; left: 0; }
   .tab .pile[data-unplayed='1'] .card:nth-child(5),
   .tab .pile[data-unplayed='3'] .card:nth-child(6),
   .tab .pile[data-unplayed='5'] .card:nth-child(7) { top: 21em; left: 0; }
   .tab .pile[data-unplayed='1'] .card:nth-child(6),
   .tab .pile[data-unplayed='3'] .card:nth-child(7),
   .tab .pile[data-unplayed='5'] .card:nth-child(8) { top: 27em; left: 0; }
   .tab .pile[data-unplayed='1'] .card:nth-child(7),
   .tab .pile[data-unplayed='3'] .card:nth-child(8),
   .tab .pile[data-unplayed='5'] .card:nth-child(9) { top: 33em;  left: 0; }
   .tab .pile[data-unplayed='1'] .card:nth-child(8),
   .tab .pile[data-unplayed='3'] .card:nth-child(9),
   .tab .pile[data-unplayed='5'] .card:nth-child(10) { top: 39em;  left: 0; }
   .tab .pile[data-unplayed='1'] .card:nth-child(9),
   .tab .pile[data-unplayed='3'] .card:nth-child(10),
   .tab .pile[data-unplayed='5'] .card:nth-child(11) { top: 45em;  left: 0; }
   .tab .pile[data-unplayed='1'] .card:nth-child(10),
   .tab .pile[data-unplayed='3'] .card:nth-child(11),
   .tab .pile[data-unplayed='5'] .card:nth-child(12) { top: 51em;  left: 0; }
   .tab .pile[data-unplayed='1'] .card:nth-child(11),
   .tab .pile[data-unplayed='3'] .card:nth-child(12),
   .tab .pile[data-unplayed='5'] .card:nth-child(13) { top: 57em;  left: 0; }
   .tab .pile[data-unplayed='1'] .card:nth-child(12),
   .tab .pile[data-unplayed='3'] .card:nth-child(13),
   .tab .pile[data-unplayed='5'] .card:nth-child(14) { top: 63em;  left: 0; }
   .tab .pile[data-unplayed='1'] .card:nth-child(13),
   .tab .pile[data-unplayed='3'] .card:nth-child(14),
   .tab .pile[data-unplayed='5'] .card:nth-child(15) { top: 69em;  left: 0; }
   .tab .pile[data-unplayed='1'] .card:nth-child(14),
   .tab .pile[data-unplayed='3'] .card:nth-child(15),
   .tab .pile[data-unplayed='5'] .card:nth-child(16) { top: 75em;  left: 0; }
   .tab .pile[data-unplayed='1'] .card:nth-child(15),
   .tab .pile[data-unplayed='3'] .card:nth-child(16),
   .tab .pile[data-unplayed='5'] .card:nth-child(17) { top: 81em;  left: 0; }
   .tab .pile[data-unplayed='1'] .card:nth-child(16),
   .tab .pile[data-unplayed='3'] .card:nth-child(17),
   .tab .pile[data-unplayed='5'] .card:nth-child(18) { top: 87em;  left: 0; }
   .tab .pile[data-unplayed='1'] .card:nth-child(17),
   .tab .pile[data-unplayed='3'] .card:nth-child(18),
   .tab .pile[data-unplayed='5'] .card:nth-child(19) { top: 93em;  left: 0; }
   .tab .pile[data-unplayed='1'] .card:nth-child(18),
   .tab .pile[data-unplayed='3'] .card:nth-child(19),
   .tab .pile[data-unplayed='5'] .card:nth-child(20) { top: 99em;  left: 0; }
   .tab .pile[data-unplayed='1'] .card:nth-child(19),
   .tab .pile[data-unplayed='3'] .card:nth-child(20),
   .tab .pile[data-unplayed='5'] .card:nth-child(21) { top: 105em;  left: 0; }
   .tab .pile[data-unplayed='1'] .card:nth-child(20),
   .tab .pile[data-unplayed='3'] .card:nth-child(21) { top: 111em;  left: 0; }
   .tab .pile[data-unplayed='1'] .card:nth-child(21) { top: 117em;  left: 0; }
   /* piles with even # of face down cards */
   .tab .pile[data-unplayed='2'] .card:nth-child(4) { top: 12em; left: 0; }
   .tab .pile[data-unplayed='2'] .card:nth-child(5),
   .tab .pile[data-unplayed='4'] .card:nth-child(6) { top: 18em; left: 0; }
   .tab .pile[data-unplayed='2'] .card:nth-child(6),
   .tab .pile[data-unplayed='4'] .card:nth-child(7),
   .tab .pile[data-unplayed='6'] .card:nth-child(8) { top: 24em; left: 0; }
   .tab .pile[data-unplayed='2'] .card:nth-child(7),
   .tab .pile[data-unplayed='4'] .card:nth-child(8),
   .tab .pile[data-unplayed='6'] .card:nth-child(9) { top: 30em;  left: 0; }
   .tab .pile[data-unplayed='2'] .card:nth-child(8),
   .tab .pile[data-unplayed='4'] .card:nth-child(9),
   .tab .pile[data-unplayed='6'] .card:nth-child(10) { top: 36em;  left: 0; }
   .tab .pile[data-unplayed='2'] .card:nth-child(9),
   .tab .pile[data-unplayed='4'] .card:nth-child(10),
   .tab .pile[data-unplayed='6'] .card:nth-child(11) { top: 42em;  left: 0; }
   .tab .pile[data-unplayed='2'] .card:nth-child(10),
   .tab .pile[data-unplayed='4'] .card:nth-child(11),
   .tab .pile[data-unplayed='6'] .card:nth-child(12) { top: 48em;  left: 0; }
   .tab .pile[data-unplayed='2'] .card:nth-child(11),
   .tab .pile[data-unplayed='4'] .card:nth-child(12),
   .tab .pile[data-unplayed='6'] .card:nth-child(13) { top: 54em;  left: 0; }
   .tab .pile[data-unplayed='2'] .card:nth-child(12),
   .tab .pile[data-unplayed='4'] .card:nth-child(13),
   .tab .pile[data-unplayed='6'] .card:nth-child(14) { top: 60em;  left: 0; }
   .tab .pile[data-unplayed='2'] .card:nth-child(13),
   .tab .pile[data-unplayed='4'] .card:nth-child(14),
   .tab .pile[data-unplayed='6'] .card:nth-child(15) { top: 66em;  left: 0; }
   .tab .pile[data-unplayed='2'] .card:nth-child(14),
   .tab .pile[data-unplayed='4'] .card:nth-child(15),
   .tab .pile[data-unplayed='6'] .card:nth-child(16) { top: 72em;  left: 0; }
   .tab .pile[data-unplayed='2'] .card:nth-child(15),
   .tab .pile[data-unplayed='4'] .card:nth-child(16),
   .tab .pile[data-unplayed='6'] .card:nth-child(17) { top: 78em;  left: 0; }
   .tab .pile[data-unplayed='2'] .card:nth-child(16),
   .tab .pile[data-unplayed='4'] .card:nth-child(17),
   .tab .pile[data-unplayed='6'] .card:nth-child(18) { top: 84em;  left: 0; }
   .tab .pile[data-unplayed='2'] .card:nth-child(17),
   .tab .pile[data-unplayed='4'] .card:nth-child(18),
   .tab .pile[data-unplayed='6'] .card:nth-child(19) { top: 90em;  left: 0; }
   .tab .pile[data-unplayed='2'] .card:nth-child(18),
   .tab .pile[data-unplayed='4'] .card:nth-child(19),
   .tab .pile[data-unplayed='6'] .card:nth-child(20) { top: 96em;  left: 0; }
   .tab .pile[data-unplayed='2'] .card:nth-child(19),
   .tab .pile[data-unplayed='4'] .card:nth-child(20),
   .tab .pile[data-unplayed='6'] .card:nth-child(21) { top: 102em;  left: 0; }
   .tab .pile[data-unplayed='2'] .card:nth-child(20),
   .tab .pile[data-unplayed='4'] .card:nth-child(21) { top: 108em;  left: 0; }
   .tab .pile[data-unplayed='2'] .card:nth-child(21) { top: 114em;  left: 0; }
   /* Confetti */
   #confetti {
      position: absolute;
      top: 0;
      left: 0;
      z-index: 10000;
      pointer-events: none;
      opacity: 0;
   }
   /* Disable Grammarly */
   grammarly-card {
       display: none;
   }
/* Drag & Drop visuals */
.card.dragging {
  opacity: 0.8;
  transform: scale(1.02);
  z-index: 1000;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.pile.drag-over::after {
  border-color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.02);
}

/* unified above */

/* unified above */

.settings-form .form-row {
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.settings-form label {
  font-size: 0.95rem;
  color: #222;
}
.settings-form select, .settings-form input[type="checkbox"] {
  font-size: 1rem;
}
.settings-form .form-actions {
  text-align: right;
}
.settings-form .form-actions button {
  padding: 0.5em 0.75em;
  border: 0;
  background: #0e8b44;
  color: #fff;
  border-radius: 4px;
  cursor: pointer;
}
.modal-content .settings-form {
  color: #111;
}

/* Scoreboard Modal */
.modal {
  display: block;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0.4);
}

.modal-content {
  background-color: #fefefe;
  margin: 15% auto;
  padding: 20px;
  border: 1px solid #888;
  width: 80%;
  max-width: 600px;
  color: #333;
  border-radius: 10px;
}

.close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
}

.close:hover,
.close:focus {
  color: black;
  text-decoration: none;
  cursor: pointer;
}

#scoreboard-modal h2 {
  text-align: center;
  margin-bottom: 20px;
}

#scoreboard-modal table {
  width: 100%;
  border-collapse: collapse;
}

#scoreboard-modal th, #scoreboard-modal td {
  border: 1px solid #ddd;
  padding: 8px;
  text-align: left;
}

#scoreboard-modal th {
  background-color: #f2f2f2;
}

.sort-buttons {
  text-align: center;
  margin-bottom: 20px;
}

.sort-buttons button {
  padding: 10px 15px;
  margin: 0 5px;
  cursor: pointer;
  border: 1px solid #ccc;
  background-color: #f8f8f8;
  border-radius: 5px;
}

.sort-buttons button:hover {
  background-color: #e7e7e7;
}

.modal.hidden {
  display: none;
}
/* Highlight row for current game's score in scoreboard modal */
#scoreboard-modal table tr.highlight {
  background: rgba(255, 223, 0, 0.12);
  transition: background-color 220ms ease;
}
#scoreboard-modal table tr.highlight td {
  font-weight: 700;
}