* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: #1b5e20;
  color: #fff;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  text-align: center;
  padding: 0.75rem;
  background: #0d3311;
}

h1 {
  font-size: 1.6rem;
  letter-spacing: 2px;
}

h2 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
  text-align: center;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
}

.hand {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  min-height: 106px;
}

#table-center {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 3rem;
  padding: 0.5rem 0;
}

.pile {
  text-align: center;
}

.pile-label {
  font-size: 0.8rem;
  margin-top: 4px;
  color: #a5d6a7;
}

/* ---- Card styling ---- */

.card-element {
  width: 68px;
  height: 96px;
  border: 2px solid #999;
  border-radius: 8px;
  background: #fff;
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-weight: bold;
  cursor: default;
  user-select: none;
  transition: transform 0.15s, box-shadow 0.15s;
}

.card-element .card-rank {
  font-size: 1.2rem;
  line-height: 1.1;
}

.card-element .card-suit {
  font-size: 1.5rem;
  line-height: 1.1;
}

.card-element.red {
  color: #c62828;
}

.card-element.black {
  color: #212121;
}

.card-element.face-down {
  background: linear-gradient(135deg, #1565c0, #0d47a1);
  border-color: #0d47a1;
}

.card-element.face-down .card-back {
  font-size: 2.2rem;
  color: rgba(255, 255, 255, 0.25);
}

.card-element.playable {
  cursor: pointer;
  box-shadow: 0 0 10px 3px #ffeb3b;
  border-color: #fdd835;
}

.card-element.playable:hover {
  transform: translateY(-8px);
  box-shadow: 0 0 16px 5px #ffeb3b;
}

footer {
  text-align: center;
  padding: 0.75rem;
  background: #0d3311;
}

#status {
  font-size: 1.05rem;
  min-height: 1.5em;
}

#new-game-btn {
  margin-top: 0.5rem;
  padding: 0.4rem 1.2rem;
  font-size: 0.95rem;
  background: #ffeb3b;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  color: #333;
  font-weight: bold;
}

#new-game-btn:hover {
  background: #fdd835;
}

/* ---- Flying card animation ---- */

.card-flying {
  position: fixed;
  z-index: 1000;
  transition: top 0.4s ease-in-out, left 0.4s ease-in-out;
  pointer-events: none;
}

.card-flying.card-flip {
  transition: top 0.4s ease-in-out, left 0.4s ease-in-out, transform 0.25s ease-in;
  transform: rotateY(90deg);
}

.card-flying.card-flip-reveal {
  transition: transform 0.25s ease-out;
  transform: rotateY(0deg);
}
