/* 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%;
   overscroll-behavior: none;
}
html {
   font-family: sans-serif;
   font-size: 10px;
   -webkit-text-size-adjust: 100%;
   -ms-text-size-adjust: 100%;
   -webkit-tap-highlight-color: rgba(0,0,0,0);
}
*, *::before, *::after {
   -webkit-box-sizing: border-box;
   -moz-box-sizing: border-box;
   box-sizing: border-box;
}
body {
   margin: 0;
   font-size: 14px;
   line-height: 1.42857143;
}
ul, ol {
   margin-top: 0;
   margin-bottom: 0;
}
ol ul, ul ol, ul ul, ol ol {
   margin-bottom: 0;
}
ul, ol {
   padding: 0;
   list-style: none;
}
button, input, optgroup, select, textarea {
   margin: 0;
   font: inherit;
   color: inherit;
}
button {
   overflow: visible;
   cursor: pointer;
}
img {
   border: 0;
   vertical-align: middle;
}
.container {
   width: 100%;
   padding-right: 15px;
   padding-left: 15px;
   margin-right: auto;
   margin-left: auto;
   max-width: 1140px;
}
body {
   position: relative;
   color: #f3f5f7;
   background: #0e8b44 url('../img/green_felt.jpg');
   background-size: cover;
   background-position: center;
   padding-bottom: 4em;
   touch-action: manipulation;
}
.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;
   background: rgba(0,0,0,.15);
   margin-top: 1.5em;
   margin-bottom: 0.5em;
   padding: 1em;
   line-height: 1;
}
#score > * {
   display: inline-block;
   min-width: 100px;
}
#score > *:last-child {
   float: right;
   text-align: right;
}
#score label {
   margin-bottom: 0;
}
#new-game {
   background-color: rgba(0,0,0,0.25);
   border: 1px solid rgba(255,255,255,0.2);
   border-radius: 4px;
   color: #f3f5f7;
   padding: 0.35em 0.9em;
   font-size: 0.85em;
   letter-spacing: 0.03em;
   cursor: pointer;
   min-width: auto;
   transition: background-color 0.2s, border-color 0.2s;
}
#new-game:hover {
   background-color: rgba(0,0,0,0.4);
   border-color: rgba(255,255,255,0.4);
}
#new-game:focus {
   outline: none;
   border-color: rgba(255,255,255,0.55);
   box-shadow: 0 0 0 2px rgba(255,255,255,0.1);
}
#bottom-bar-wrap {
   position: fixed;
   bottom: 0;
   left: 0;
   width: 100%;
   background: rgba(8,8,8,0.75);
   z-index: 1000;
}
#bottom-bar {
   display: flex;
   align-items: center;
   justify-content: center;
   gap: 2em;
   padding: 0.75em 1.5em;
   overflow-x: auto;
   scrollbar-width: none;
   -ms-overflow-style: none;
   white-space: nowrap;
   position: relative;
}
@media screen and (max-width: 767px) {
   #bottom-bar {
      justify-content: flex-start;
   }
}
#bottom-bar::-webkit-scrollbar {
   display: none;
}
.bottom-bar-arrow {
   position: absolute;
   top: 0;
   height: 100%;
   width: 2em;
   display: flex;
   align-items: center;
   justify-content: center;
   color: rgba(255,255,255,0.6);
   font-size: 1em;
   pointer-events: none;
   opacity: 0;
   transition: opacity 0.2s;
   z-index: 1001;
}
.bottom-bar-arrow.left {
   left: 0;
   background: linear-gradient(to right, rgba(8,8,8,0.75), transparent);
}
.bottom-bar-arrow.right {
   right: 0;
   background: linear-gradient(to left, rgba(8,8,8,0.75), transparent);
}
.bottom-bar-arrow.visible {
   opacity: 1;
}
#bottom-bar .bg-picker {
   display: inline-flex;
   align-items: center;
   gap: 0.4em;
}
#bottom-bar .bg-picker label {
   opacity: 0.7;
   font-size: 0.85em;
   cursor: default;
   letter-spacing: 0.03em;
   text-transform: uppercase;
   color: #f3f5f7;
}
#bg-select, #card-back-select {
   min-width: 7em;
   background-color: rgba(0,0,0,0.25);
   background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='rgba(255,255,255,0.5)'/%3E%3C/svg%3E");
   background-repeat: no-repeat;
   background-position: right 0.55em center;
   background-size: 8px;
   border: 1px solid rgba(255,255,255,0.2);
   border-radius: 4px;
   color: #f3f5f7;
   padding: 0.35em 1.8em 0.35em 0.65em;
   -webkit-appearance: none;
   -moz-appearance: none;
   appearance: none;
   cursor: pointer;
   font-size: 0.85em;
   letter-spacing: 0.03em;
   transition: border-color 0.2s, background-color 0.2s;
}
#bg-select:hover, #card-back-select:hover {
   background-color: rgba(0,0,0,0.4);
   border-color: rgba(255,255,255,0.4);
}
#bg-select:focus, #card-back-select:focus {
   outline: none;
   border-color: rgba(255,255,255,0.55);
   box-shadow: 0 0 0 2px rgba(255,255,255,0.1);
}
#bg-select option, #card-back-select option {
   background-color: #1a5e2a;
   color: #f3f5f7;
}
#show-scores-toggle,
#flip-layout-toggle {
   width: 16px;
   height: 16px;
   cursor: pointer;
   accent-color: #f0d080;
}
.kv-status {
   display: flex;
   align-items: center;
   gap: 0.4em;
}
.kv-status label {
   opacity: 0.7;
   font-size: 0.85em;
   letter-spacing: 0.03em;
   text-transform: uppercase;
   color: #f3f5f7;
}
.kv-indicator {
   width: 10px;
   height: 10px;
   border-radius: 50%;
   background: #888;
   display: inline-block;
   flex-shrink: 0;
}
.kv-indicator.green { background: #4caf50; }
.kv-indicator.red { background: #f44336; }
#scores-btn, #settings-btn {
   background-color: rgba(0,0,0,0.25);
   border: 1px solid rgba(255,255,255,0.2);
   border-radius: 4px;
   color: #f3f5f7;
   padding: 0.35em 0.9em;
   font-size: 0.85em;
   letter-spacing: 0.03em;
   cursor: pointer;
   transition: background-color 0.2s, border-color 0.2s;
}
#scores-btn:hover, #settings-btn:hover {
   background-color: rgba(0,0,0,0.4);
   border-color: rgba(255,255,255,0.4);
}
#score .timer button {
   display: none;
   position: absolute;
   -webkit-appearance: none;
   background: transparent;
   outline: none;
   border: 0;
   padding: 0;
   top: 0;
   left: 0;
   width: 3em;
   height: 100%;
}
#score .timer button i {
   position: absolute;
   top: 0;
   left: 0;
   width: 100%;
   height: 100%;
   font-size: 0;
}
#score .timer button i::before {
   position: absolute;
   top: 50%;
   left: 50%;
   width: 0.75em;
   height: 1em;
   margin-left: -0.375em;
   margin-top: -0.5em;
   font-size: 1.5rem;
   content: none;
}
#score .timer button i#play::before {
   border-top: 8px solid transparent;
   border-left: 12px solid #fff;
   border-bottom: 8px solid transparent;
}
#score .timer button i#pause::before {
   border-right: 4px solid #fff;
   border-left: 4px solid #fff;
}
[data-gameplay="active"] #score .timer button,
[data-gameplay="paused"] #score .timer button {
   display: inline-block;
}
[data-gameplay="active"] #score .timer button i#pause::before,
[data-gameplay="paused"] #score .timer button i#play::before {
   content: '';
}
[data-gameplay="active"] #score,
[data-gameplay="paused"] #score {
   padding-left: 3em;
}
#auto-win {
   display: none;
   -webkit-appearance: none;
   outline: none;
   position: absolute;
   left: 29%;
   top: 0;
   width: 13%;
   height: 100%;
   background: rgba(0,0,0,0.2);
   border: 2px dotted rgba(255,255,255,0.4);
   border-radius: 5px;
   color: #f3f5f7;
   cursor: pointer;
   font-size: 0.75em;
   letter-spacing: 0.05em;
   line-height: 1.4;
   text-transform: uppercase;
   z-index: 2;
   transition: background-color 0.2s, border-color 0.2s;
}
#auto-win:hover {
   background: rgba(0,0,0,0.38);
   border-color: rgba(255,255,255,0.65);
}
@media screen and (min-width: 768px) {
   #auto-win {
      border-radius: 10px;
      font-size: 0.85em;
   }
}
#table {
   opacity: 0;
   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: 13%;
   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;
}
#fnd .pile[data-empty="true"]::after {
   border: 2px solid rgba(255,255,255,0.2);
   border-radius: 5px;
   background: rgba(0,0,0,0.15);
   box-shadow: inset 0 0 8px rgba(0,0,0,0.2);
}
.card {
   display: block;
   position: absolute;
   top: 0;
   left: 0;
   background-color: #ddd;
   background-image: url('../img/card_back_bg.png');
   #background-size: contain;
   background-size: 100% 100%;
   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.325em;
   }
   .pile::after, .card {
      border-radius: 10px;
   }
}
@media screen and (min-width: 992px) {
   .card {
      font-size: 0.425em;
   }
}
@media screen and (min-width: 1200px) {
   .card {
      font-size: 0.525em;
   }
}
.card > div {
   display: none;
}
.card.up {
   background-image: url('../img/card_face_bg.png');
   background-repeat: repeat;
   color: #111;
   touch-action: none;
}
.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; }

/* stock */
   .stock {
      z-index: 1;
   }
   .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%;
   }

/* flipped top row (foundations left, stock/waste right) */
   body[data-layout="flipped"] #stock {
      float: right;
      margin-right: 0;
   }
   body[data-layout="flipped"] #waste {
      float: right;
      margin-right: 1.5%;
   }
   body[data-layout="flipped"] .fnd .pile {
      left: 0;
   }
   body[data-layout="flipped"] #auto-win {
      left: 58%;
   }

/* 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: 6em; left: 0; }
   .tab .card:nth-child(3) { top: 12em; left: 0; }
   .tab .card:nth-child(4) { top: 18em; left: 0; }
   .tab .card:nth-child(5) { top: 24em; left: 0; }
   .tab .card:nth-child(6) { top: 30em; left: 0; }
   .tab .card:nth-child(7) { top: 36em;  left: 0; }
   .tab .card:nth-child(8) { top: 42em;  left: 0; }
   .tab .card:nth-child(9) { top: 48em;  left: 0; }
   .tab .card:nth-child(10) { top: 54em;  left: 0; }
   .tab .card:nth-child(11) { top: 60em;  left: 0; }
   .tab .card:nth-child(12) { top: 66em;  left: 0; }
   .tab .card:nth-child(13) { top: 72em;  left: 0; }
   .tab .card:nth-child(14) { top: 78em;  left: 0; }
   .tab .card:nth-child(15) { top: 84em;  left: 0; }
   .tab .card:nth-child(16) { top: 90em;  left: 0; }
   .tab .card:nth-child(17) { top: 96em;  left: 0; }
   .tab .card:nth-child(18) { top: 102em;  left: 0; }
   .tab .card:nth-child(19) { top: 108em;  left: 0; }
   .tab .card:nth-child(20) { top: 114em;  left: 0; }
   .tab .card:nth-child(21) { top: 120em;  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: fixed;
      top: 0;
      left: 0;
      z-index: 10000;
      pointer-events: none;
      opacity: 0;
   }
   /* Touch hold visual feedback */
   .card.touching::before {
      box-shadow: 0 0 8px 4px rgba(255, 255, 255, 0.5);
   }

   /* Drag over pile highlight */
   .pile.drag-over {
      outline: 2px solid rgba(255, 255, 255, 0.7);
      border-radius: 5px;
      background: rgba(255, 255, 255, 0.08);
   }
   @media screen and (min-width: 768px) {
      .pile.drag-over {
         border-radius: 10px;
      }
   }
   
   /* Theme variables */
   body { --modal-bg: #1a3a2a; --modal-header-bg: #0e2419; --modal-btn-bg: #0e5c30; }
   body[data-felt="green"] { --modal-bg: #1a3a2a; --modal-header-bg: #0e2419; --modal-btn-bg: #0e5c30; }
   body[data-felt="blue"] { --modal-bg: #1a2a3a; --modal-header-bg: #0e1924; --modal-btn-bg: #0e3a5c; }
   body[data-felt="red"] { --modal-bg: #3a1a1a; --modal-header-bg: #240e0e; --modal-btn-bg: #5c1a1a; }
   body[data-felt="brown"] { --modal-bg: #2e2018; --modal-header-bg: #1c1208; --modal-btn-bg: #4a3020; }
   body[data-felt="grey"] { --modal-bg: #252525; --modal-header-bg: #151515; --modal-btn-bg: #3a3a3a; }
   body[data-felt="purple"] { --modal-bg: #2a1a3a; --modal-header-bg: #180e24; --modal-btn-bg: #3a1a5c; }

/* Settings Modal */
#settings-modal {
   position: fixed;
   top: 0;
   left: 0;
   width: 100%;
   height: 100%;
   display: flex;
   align-items: center;
   justify-content: center;
   z-index: 10001;
   pointer-events: none;
}
#settings-modal.settings-modal-hidden {
   display: none;
}
#settings-modal-box {
   width: 380px;
   background: var(--modal-bg);
   border: 1px solid #f0d080;
   border-radius: 16px;
   overflow: hidden;
   pointer-events: auto;
   box-shadow: 0 20px 60px rgba(0,0,0,0.7), 0 8px 20px rgba(0,0,0,0.5);
   max-height: 90vh;
   overflow-y: auto;
}
#settings-modal-header {
   padding: 20px 20px 0;
   text-align: center;
   position: relative;
}
#settings-modal-close {
   position: absolute;
   top: 16px;
   right: 16px;
   background: transparent;
   border: none;
   color: rgba(255,255,255,0.5);
   font-size: 22px;
   line-height: 1;
   cursor: pointer;
   padding: 0;
}
#settings-modal-close:hover {
   color: rgba(255,255,255,0.9);
}
#settings-modal-title {
   font-size: 22px;
   font-weight: 600;
   color: #f0d080;
   letter-spacing: 0.04em;
   padding-bottom: 16px;
   border-bottom: 1px solid rgba(240,208,128,0.2);
}
#settings-modal-body {
   padding: 16px 20px 20px;
}
.settings-section {
   margin-bottom: 24px;
}
.settings-section:last-child {
   margin-bottom: 0;
}
.settings-section-title {
   font-size: 11px;
   color: rgba(255,255,255,0.4);
   letter-spacing: 0.1em;
   text-transform: uppercase;
   margin-bottom: 12px;
}
.settings-field {
   margin-bottom: 12px;
}
.settings-toggle-row {
   display: flex;
   align-items: center;
   justify-content: space-between;
   gap: 1em;
}
.settings-toggle-row label {
   font-size: 13px;
   color: rgba(255,255,255,0.7);
   margin-bottom: 0;
   cursor: pointer;
}
.settings-field input[type="text"],
.settings-field input[type="password"] {
   width: 100%;
   background: rgba(0,0,0,0.3);
   border: 1px solid rgba(255,255,255,0.15);
   border-radius: 6px;
   color: #f3f5f7;
   padding: 0.5em 0.75em;
   font-size: 13px;
   outline: none;
   transition: border-color 0.2s;
   box-sizing: border-box;
}
.settings-field input[type="text"]:focus,
.settings-field input[type="password"]:focus {
   border-color: rgba(240,208,128,0.5);
}
#settings-username-status {
   font-size: 12px;
   margin-top: 5px;
   min-height: 16px;
}
#settings-username-status.available { color: #4caf50; }
#settings-username-status.taken { color: #f44336; }
#settings-username-status.checking { color: rgba(255,255,255,0.4); }
.settings-token-row {
   display: flex;
   gap: 0.5em;
}
.settings-token-row input {
   flex: 1;
}
#settings-token-copy,
#settings-token-change {
   background: rgba(0,0,0,0.25);
   border: 1px solid rgba(255,255,255,0.2);
   border-radius: 6px;
   color: #f3f5f7;
   font-size: 12px;
   padding: 0.4em 0.75em;
   cursor: pointer;
   transition: background-color 0.2s;
   white-space: nowrap;
}
#settings-token-copy:hover,
#settings-token-change:hover {
   background: rgba(0,0,0,0.4);
}
#settings-token-change {
   display: block;
   margin-top: 8px;
   width: 100%;
}
#settings-connect-btn {
   width: 100%;
   padding: 10px;
   background: var(--modal-btn-bg);
   border: 1px solid #f0d080;
   border-radius: 8px;
   color: #f0d080;
   font-size: 14px;
   letter-spacing: 0.05em;
   cursor: pointer;
   margin-top: 4px;
   transition: background 0.2s;
}
#settings-connect-btn:hover:not(:disabled) {
   background: rgba(240,208,128,0.15);
}
#settings-connect-btn:disabled {
   opacity: 0.4;
   cursor: not-allowed;
}
.settings-search-row {
   display: flex;
   gap: 0.5em;
}
.settings-search-row input {
   flex: 1;
}
#settings-friend-search-btn {
   background: rgba(0,0,0,0.25);
   border: 1px solid rgba(255,255,255,0.2);
   border-radius: 6px;
   color: #f3f5f7;
   font-size: 12px;
   padding: 0.4em 0.75em;
   cursor: pointer;
   transition: background-color 0.2s;
   white-space: nowrap;
}
#settings-friend-search-btn:hover {
   background: rgba(0,0,0,0.4);
}
#settings-search-result {
   font-size: 12px;
   margin-top: 6px;
   min-height: 16px;
}
#settings-search-result.found { color: #4caf50; }
#settings-search-result.not-found { color: #f44336; }
#settings-friends-list {
   list-style: none;
   padding: 0;
   margin: 0;
}
#settings-friends-list li {
   display: flex;
   align-items: center;
   justify-content: space-between;
   padding: 8px 0;
   border-bottom: 1px solid rgba(255,255,255,0.07);
   font-size: 13px;
   color: rgba(255,255,255,0.7);
}
#settings-friends-list li:last-child {
   border-bottom: none;
}
#settings-friends-list li button {
   background: transparent;
   border: 1px solid rgba(255,255,255,0.2);
   border-radius: 4px;
   color: rgba(255,255,255,0.4);
   font-size: 11px;
   padding: 0.2em 0.5em;
   cursor: pointer;
}
#settings-friends-list li button:hover {
   color: #f44336;
   border-color: #f44336;
}
   
/* Win Modal */
#win-modal {
   position: fixed;
   top: 0;
   left: 0;
   width: 100%;
   height: 100%;
   display: flex;
   align-items: center;
   justify-content: center;
   z-index: 10001;
   pointer-events: none;
}
#win-modal.win-modal-hidden {
   display: none;
}
#win-modal-box {
   width: 340px;
   background: var(--modal-bg);
   border: 1px solid #f0d080;
   border-radius: 16px;
   overflow: hidden;
   pointer-events: auto;
   box-shadow: 0 20px 60px rgba(0,0,0,0.7), 0 8px 20px rgba(0,0,0,0.5);
}
#win-modal-header {
   background: transparent;
   padding: 24px 20px 0;
   text-align: center;
   position: relative;
}
#win-modal-close {
   position: absolute;
   top: 16px;
   right: 16px;
   background: transparent;
   border: none;
   color: rgba(255,255,255,0.5);
   font-size: 22px;
   line-height: 1;
   cursor: pointer;
   padding: 0;
}
#win-modal-refresh {
   position: absolute;
   top: 16px;
   left: 16px;
   background: transparent;
   border: none;
   color: rgba(255,255,255,0.5);
   font-size: 18px;
   line-height: 1;
   cursor: pointer;
   padding: 0;
}
#win-modal-refresh:hover {
   color: rgba(255,255,255,0.9);
}
@keyframes spin-once {
   from { transform: rotate(0deg); }
   to   { transform: rotate(360deg); }
}
#win-modal-refresh.spinning {
   color: #f0d080;
   animation: spin-once 0.6s ease-in-out forwards;
}
#win-modal-close:hover {
   color: rgba(255,255,255,0.9);
}
#win-modal-title {
   font-size: 26px;
   font-weight: 600;
   color: #f0d080;
   letter-spacing: 0.04em;
}
#win-modal-subtitle {
   font-size: 11px;
   color: rgba(255,255,255,0.4);
   margin-top: 6px;
   letter-spacing: 0.1em;
   text-transform: uppercase;
}
#win-modal-divider {
   display: flex;
   align-items: center;
   margin: 14px 24px 4px;
   gap: 0;
}
#win-modal-divider::before,
#win-modal-divider::after {
   content: '';
   flex: 1;
   height: 1px;
   background: linear-gradient(to var(--dir, right), rgba(240,208,128,0), rgba(240,208,128,0.5));
}
#win-modal-divider::before {
   --dir: right;
}
#win-modal-divider::after {
   --dir: left;
}
#win-modal-divider span {
   color: #f0d080;
   font-size: 10px;
   padding: 0 8px;
   line-height: 1;
}
#win-score-list-wrap {
   position: relative;
   height: 363px;
   overflow: hidden;
}
#win-score-list-wrap::after {
   content: '';
   position: absolute;
   bottom: 0;
   left: 0;
   width: 100%;
   height: 80px;
   background: linear-gradient(to bottom, transparent, var(--modal-bg));
   pointer-events: none;
   z-index: 1;
}
#win-score-list {
   list-style: none;
   padding: 8px 0;
   margin: 0;
   height: 100%;
   overflow-y: auto;
   scrollbar-width: none;
   -ms-overflow-style: none;
}
#win-score-list::-webkit-scrollbar {
   display: none;
}
#win-score-list li {
   display: flex;
   align-items: center;
   padding: 10px 24px;
   gap: 14px;
}
#win-score-list li.win-score-current {
   background: rgba(240,208,128,0.1);
   border-left: 2px solid #f0d080;
}
#win-score-list li .win-score-rank {
   font-size: 11px;
   color: rgba(255,255,255,0.3);
   width: 28px;
   text-align: right;
}
#win-score-list li.win-score-current .win-score-rank {
   color: #f0d080;
   font-weight: 600;
}
#win-score-list li .win-score-value {
   font-size: 14px;
   color: rgba(255,255,255,0.4);
}
#win-score-list li.win-score-current .win-score-value {
   font-size: 15px;
   color: #f0d080;
   font-weight: 600;
}
#win-score-list li .win-score-you {
   font-size: 10px;
   color: rgba(240,208,128,0.55);
   letter-spacing: 0.07em;
   text-transform: uppercase;
   margin-left: auto;
}
#win-score-list li .win-score-friend {
   font-size: 10px;
   color: rgba(150,200,255,0.7);
   letter-spacing: 0.07em;
   text-transform: uppercase;
   margin-left: auto;
}
#win-modal-footer {
   padding: 12px 20px 20px;
}
#win-modal-new-game {
   width: 100%;
   padding: 11px;
   background: var(--modal-btn-bg);
   border: 1px solid #f0d080;
   border-radius: 8px;
   color: #f0d080;
   font-size: 14px;
   letter-spacing: 0.05em;
   cursor: pointer;
}
#win-modal-new-game:hover {
   background: rgba(240,208,128,0.15);
}
   
   /* Disable Grammarly */
   grammarly-card {
       display: none;
   }
