/* === GENERAL PAGE STYLING === */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: radial-gradient(circle, #3D8E41 20%, #1B5E20 60%, #0A3C10 100%);
  background-size: cover;
  margin: 0;
  padding: 0;
  font-family: "Roboto", sans-serif;
  color: #fff;
}

.wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* === BREADCRUMB === */
.breadcrumb {
  font-size: 14px;
  padding: 15px 40px;
  color: #ffcc00;
  background: transparent;
}

.breadcrumb a {
  color: #EDEAE1;
  text-decoration: none;
  font-weight: 500;
}
.breadcrumb a:hover {
  text-decoration: underline;
}

/* === FOOTER === */
footer {
  background-color: transparent;
  color: white;
  text-align: center;
  padding: 8px;
  font-size: 14px;
}

.footer-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* === TOP ROW === */
.top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  padding: 10px 20px;
  gap: 20px;
}

.stockwaste {
  display: flex;
  gap: 20px;
  align-items: center;
  flex-shrink: 0;
}

.stock,
.waste {
  width: 80px;
  height: 120px;
  border: 1px solid #fff;
  background-color: rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  flex-shrink: 0;
}

/* === FOUNDATION === */
.foundation {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.foundation-pile {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

.foundation-pile img {
  width: 80px;
  height: 120px;
  border-radius: 6px;
  border: 1px solid #fff;
}

/* === OPTIONS === */
.options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 10px;
  border: 2px solid #ff7700;
}

.undo, .newgame {
  padding: 6px 14px;
  font-size: 14px;
  border-radius: 6px;
  border: none;
  background: #ff7700;
  color: white;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.undo:hover, .newgame:hover {
  background: #e76600;
}

/* === PLAY AREA === */
.playarea {
  display: flex;
  justify-content: center;
  padding: 20px;
}

.columns {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: nowrap;
  overflow-x: auto;
  width: 100%;
  padding-bottom: 20px;
}

.column {
  width: 80px;
  min-height: 300px;
  position: relative;
  flex-shrink: 0;
}

/* === CARDS === */
.column button, .stock button, .waste button {
  width: 80px;
  height: 120px;
  padding: 0;
  margin: 0;
  background: none;
  border: none;
  position: absolute;
  display: block;
  cursor: pointer;
}

button > img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 6px;
  pointer-events: none;
}

/* === CARD STACKING === */
.r1  { top: 0%; }
.r2  { top: 6%; }
.r3  { top: 12%; }
.r4  { top: 18%; }
.r5  { top: 24%; }
.r6  { top: 30%; }
.r7  { top: 36%; }
.r8  { top: 42%; }
.r9  { top: 48%; }
.r10 { top: 54%; }
.r11 { top: 60%; }
.r12 { top: 66%; }
.r13 { top: 72%; }
.r14 { top: 78%; }
.r15 { top: 84%; }
.r16 { top: 90%; }
.r17 { top: 96%; }
.r18 { top: 102%; }
.r19 { top: 108%; }

/* === MOBILE RESPONSIVENESS === */
/* === MOBILE PORTRAIT === */
@media screen and (max-width: 520px) and (orientation: portrait) {
  body {
    overflow-x: hidden; /* Prevent overall horizontal scroll */
  }

  .playarea {
    margin-top: -30px;
    width: 100%;
    box-sizing: border-box;
  }

  .top-row {
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
  }

  .stockwaste,
  .foundation {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: center;
    padding: 0 10px;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;

    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .stockwaste::-webkit-scrollbar,
  .foundation::-webkit-scrollbar {
    display: none;
  }

  .stock,
  .waste,
  .foundation-pile {
    width: 65px;
    height: 95px;
    flex: 0 0 auto;
    position: relative;
  }

  .stock button,
  .waste button {
    width: 65px;
    height: 95px;
    position: absolute;
    padding: 0;
    margin: 0;
    border: none;
    background: none;
  }

  .stock button img,
  .waste button img,
  .foundation-pile img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 6px;
  }

  .columns {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    padding: 10px;
    width: 100%;
    box-sizing: border-box;
  }

  /* Split into 2 rows: 4 + 3 using nth-child */
  .columns .column:nth-child(-n+4) {
    order: 1;
  }

  .columns .column:nth-child(n+5) {
    order: 2;
  }

  .columns .column {
    width: 65px;
    min-height: 220px;
    flex: 0 0 auto;
  }

  .columns .column button,
  .columns .card {
    width: 65px;
    height: 95px;
  }

  .options {
    flex-direction: row;
    justify-content: center;
    padding: 12px 12px;
    gap: 16px;
    margin: 0 auto;
    width: fit-content;
    box-sizing: border-box;
  }

  .undo,
  .newgame {
    font-size: 14px;
    padding: 8px 14px;
    border-radius: 6px;
  }
}

@media screen and (max-width: 800px) and (orientation: landscape) {
  body {
    overflow-x: hidden;
  }

  .playarea {
    margin-top: -20px;
    width: 100%;
    box-sizing: border-box;
  }

  .top-row {
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
  }

  .stockwaste,
  .foundation {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: center;
    gap: 12px;
    padding: 0 10px;
    width: 100%;
    box-sizing: border-box;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .stockwaste::-webkit-scrollbar,
  .foundation::-webkit-scrollbar {
    display: none;
  }

  .stock,
  .waste,
  .foundation-pile {
    width: 70px;
    height: 100px;
    flex: 0 0 auto;
    position: relative;
  }

  .stock button,
  .waste button {
    width: 70px;
    height: 100px;
    position: absolute;
    padding: 0;
    margin: 0;
    border: none;
    background: none;
  }

  .stock button img,
  .waste button img,
  .foundation-pile img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 6px;
  }

  .columns {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    gap: 12px;
    padding: 10px;
    width: 100%;
    box-sizing: border-box;
  }

  .columns .column {
    width: 70px;
    min-height: 240px;
    flex: 0 0 auto;
  }

  .columns .column button,
  .columns .card {
    width: 70px;
    height: 100px;
  }

  .options {
    flex-direction: row;
    justify-content: center;
    gap: 12px;
    padding: 10px 10px;
    width: fit-content;
    margin: 0 auto;
    box-sizing: border-box;
  }

  .undo,
  .newgame {
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 6px;
  }
}

/* === FIXED FOOTER MENU FOR MOBILE === */
.fixed-footer-menu-games {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 60px;
  background-color: #222;
  display: flex;
  justify-content: space-around;
  align-items: center;
  border-top: 2px solid #FEC107;
  z-index: 1000;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
}

/* Menu Item */
.fixed-footer-menu-games .menu-item {
  flex: 1;
  text-align: center;
  color: #FEC107;
  text-decoration: none;
  font-size: 11px;
  padding: 4px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  height: 100%;
}

/* Icon inside Menu */
.fixed-footer-menu-games .icon {
  font-size: 20px;
  margin-bottom: 2px;
}

/* Hide fixed footer on desktop */
@media screen and (min-width: 768px) {
  .fixed-footer-menu-games {
    display: none;
  }
}

/* Make sure body has bottom padding so content doesn't hide under footer */
body {
  padding-bottom: 80px;
}

.more-games-drawer {
  position: fixed;
  bottom: 60px;
  left: 0;
  width: 100%;
  max-height: 60vh;
  background: #111;
  border-top: 2px solid #FEC107;
  z-index: 999;
  padding: 10px;
  display: none;
  flex-direction: column;
  overflow-y: auto;
}

.more-games-drawer .drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-weight: bold;
  font-size: 14px;
  color: #FEC107;
}

.more-games-drawer .games-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.more-games-drawer .games-grid a {
  background-color: #222;
  color: #FEC107;
  padding: 8px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 13px;
  text-align: center;
}
