* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #14532d;
  margin: 0;
  padding: 12px;
  color: #fff;
  -webkit-tap-highlight-color: transparent;
}
.wrap { max-width: 720px; margin: 0 auto; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  margin-bottom: 10px;
  gap: 10px;
}
#status { flex: 1; opacity: 0.85; }
#newbtn {
  background: #4f46e5; color: white; border: 0; padding: 6px 12px;
  border-radius: 6px; cursor: pointer; font-size: 13px;
}
#newbtn:hover { background: #4338ca; }
.topslots {
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 10px;
  flex-wrap: wrap;
}
.stock-area, .foundations {
  display: flex;
  gap: 8px;
}
.pile {
  width: 56px;
  height: 80px;
  border: 1.5px dashed rgba(255,255,255,0.4);
  border-radius: 6px;
  position: relative;
  cursor: pointer;
}
.tableaus {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}
.tableau {
  min-height: 360px;
  position: relative;
}
.card {
  width: 100%;
  max-width: 64px;
  height: 80px;
  background: white;
  color: #1f2937;
  border: 1px solid #1f2937;
  border-radius: 6px;
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 4px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}
.card.red { color: #dc2626; }
.card.facedown {
  background: repeating-linear-gradient(45deg, #1e3a8a, #1e3a8a 5px, #1e40af 5px, #1e40af 10px);
  color: transparent;
}
.card.selected { box-shadow: 0 0 0 3px #fde047; }
.card .rank { font-size: 16px; }
.card .suit { font-size: 22px; line-height: 1; }
.tableau .card { width: 56px; }
.tableau .card:nth-child(n) { /* stacked positions assigned in JS via top */ }
.pile .card {
  position: absolute;
  top: 0;
  left: 0;
  width: 56px;
}
.foundation .placeholder, .stock .placeholder, .draw .placeholder {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  font-size: 22px; opacity: 0.45; pointer-events: none;
}
.result {
  margin-top: 16px;
  padding: 12px;
  border-radius: 6px;
  font-size: 18px;
  font-weight: 600;
  text-align: center;
}
.result.win { background: #d1fae5; color: #065f46; }
.result.hidden { display: none; }
