body {
  margin: 0;
  background: #052005;
  color: #fff;
  font-family: system-ui, -apple-system, sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}
#app {
  width: 100%;
  max-width: 540px;
  text-align: center;
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem 1rem;
  background: rgba(0,0,0,0.3);
  border-radius: 0 0 12px 12px;
}
#score {
  font-size: 0.9rem;
  opacity: 0.85;
  padding: 0.3rem;
}
#settings {
  padding: 0.6rem 1rem;
  display: flex;
  gap: 0.4rem;
  justify-content: center;
  flex-wrap: wrap;
  font-size: 0.8rem;
}
#settings select, #settings button {
  padding: 0.35rem 0.55rem;
  background: #146214;
  color: white;
  border: 1px solid #2a8a2a;
  border-radius: 6px;
}
#table {
  background: 
    radial-gradient(ellipse at center, #1a7a1a 0%, #0d4d0d 70%, #052005 100%),
    repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(0,0,0,0.03) 2px, rgba(0,0,0,0.03) 4px);
  border-radius: 24px;
  min-height: 320px;
  margin: 1rem;
  padding: 2rem 1rem;
  position: relative;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5), inset 0 0 40px rgba(0,0,0,0.2);
  border: 8px solid #1a1a1a;
  border-image: linear-gradient(145deg, #333, #111) 1;
}
.hand {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  margin: 1.2rem 0;
  min-height: 110px;
}
.card {
  width: 72px;
  height: 104px;
  background: linear-gradient(160deg, #fff 0%, #f5f5f5 100%);
  border-radius: 10px;
  position: relative;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4), 0 1px 3px rgba(0,0,0,0.2);
  border: 1px solid #ddd;
  transition: transform 0.2s ease, box-shadow 0.2s;
  font-family: 'Georgia', serif;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 16px rgba(0,0,0,0.5);
}
.card.red { color: #c41e3a; }
.card.black { color: #1a1a1a; }
.card .corner {
  position: absolute;
  font-size: 0.75rem;
  font-weight: bold;
  line-height: 1;
  text-align: center;
}
.card .corner.top { top: 6px; left: 6px; }
.card .corner.bottom {
  bottom: 6px;
  right: 6px;
  transform: rotate(180deg);
}
.card .center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.2rem;
  opacity: 0.9;
}
.card.back {
  background: 
    linear-gradient(135deg, #1e3a8a 0%, #1e40af 50%, #1d4ed8 100%);
  border: 1px solid #3b82f6;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.card.back::after {
  content: '';
  position: absolute;
  inset: 8px;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 6px;
  background: repeating-linear-gradient(45deg, transparent, transparent 4px, rgba(255,255,255,0.08) 4px, rgba(255,255,255,0.08) 8px);
}
#controls {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  padding: 1rem;
}
button {
  padding: 0.8rem 1.4rem;
  background: linear-gradient(180deg, #2d8a2d, #1f6b1f);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(0,0,0,0.3);
  transition: all 0.15s;
}
button:hover {
  background: linear-gradient(180deg, #3aa03a, #258025);
  transform: translateY(-1px);
}
button:active { transform: translateY(1px); }
#feedback {
  min-height: 2.2rem;
  padding: 0.6rem 1rem;
  font-size: 1rem;
}
#chart-overlay {
  background: rgba(20,20,20,0.95) !important;
  border: 1px solid #444;
  border-radius: 12px !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.6);
}

/* Phase 7 additions */
#discard-tray {
  position: absolute;
  bottom: 10px;
  right: 10px;
  width: 80px;
  height: 110px;
  background: rgba(0,0,0,0.4);
  border-radius: 8px;
  border: 2px dashed #444;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
  font-size: 0.7rem;
  color: #aaa;
}
#discard-tray .pile {
  width: 60px;
  background: linear-gradient(#333, #111);
  border-radius: 4px;
  transition: height 0.5s ease;
}
.card {
  animation: dealIn 0.3s ease-out;
}
@keyframes dealIn {
  from { transform: translateY(-20px) rotate(-5deg); opacity: 0; }
  to { transform: translateY(0) rotate(0); opacity: 1; }
}
.shuffle-anim {
  animation: shuffle 0.8s ease-in-out;
}
@keyframes shuffle {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05) rotate(2deg); }
}
#other-seats {
  display: flex;
  justify-content: space-around;
  margin: 0.5rem 0;
  min-height: 60px;
}
.seat-hand {
  display: flex;
  gap: 0.2rem;
}
.seat-hand .card {
  width: 40px;
  height: 56px;
  font-size: 0.6rem;
}
#penetration-label {
  font-size: 0.75rem;
}

.card {
  width: 78px;
  height: 112px;
  background: linear-gradient(145deg, #ffffff 0%, #f8f8f8 40%, #eeeeee 100%);
  border-radius: 12px;
  position: relative;
  box-shadow: 
    0 6px 16px rgba(0,0,0,0.45),
    0 2px 4px rgba(0,0,0,0.25),
    inset 0 1px 0 rgba(255,255,255,0.8);
  border: 1px solid #ccc;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-family: 'Georgia', 'Times New Roman', serif;
  animation: dealIn 0.4s ease-out forwards;
  transform-style: preserve-3d;
}
.card:hover {
  transform: translateY(-8px) rotate(2deg) scale(1.05);
  box-shadow: 0 12px 24px rgba(0,0,0,0.55);
}
.card.red { color: #d32f2f; }
.card.black { color: #212121; }
.card .corner {
  position: absolute;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  text-shadow: 0 1px 1px rgba(0,0,0,0.1);
}
.card .corner.top { top: 7px; left: 7px; }
.card .corner.bottom {
  bottom: 7px;
  right: 7px;
  transform: rotate(180deg);
}
.card .center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.6rem;
  opacity: 0.95;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.15));
}
.card.back {
  background: 
    linear-gradient(135deg, #0d47a1 0%, #1565c0 40%, #1976d2 100%);
  border: 1px solid #42a5f5;
  box-shadow: 0 6px 16px rgba(0,0,0,0.5);
}
.card.back::before {
  content: '';
  position: absolute;
  inset: 6px;
  border: 2px solid rgba(255,255,255,0.35);
  border-radius: 8px;
  background: 
    repeating-linear-gradient(45deg, transparent, transparent 5px, rgba(255,255,255,0.08) 5px, rgba(255,255,255,0.08) 10px),
    repeating-linear-gradient(-45deg, transparent, transparent 5px, rgba(255,255,255,0.05) 5px, rgba(255,255,255,0.05) 10px);
}
@keyframes dealIn {
  0% { transform: translateY(-40px) rotateX(20deg) scale(0.8); opacity: 0; }
  60% { transform: translateY(5px) rotateX(-5deg) scale(1.02); opacity: 1; }
  100% { transform: translateY(0) rotateX(0) scale(1); opacity: 1; }
}
#table {
  background: 
    radial-gradient(ellipse at center, #1b5e20 0%, #0d3c0d 60%, #041a04 100%),
    repeating-linear-gradient(45deg, transparent, transparent 3px, rgba(0,0,0,0.04) 3px, rgba(0,0,0,0.04) 6px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.6), inset 0 0 60px rgba(0,0,0,0.3);
  border: 10px solid #1a1a1a;
  border-image: linear-gradient(145deg, #444, #111) 1;
}

/* Realistic action animations */
.card.dealt {
  animation: cardDeal 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}
@keyframes cardDeal {
  0% { transform: translateY(-60px) translateX(30px) rotate(15deg) scale(0.7); opacity: 0; }
  70% { transform: translateY(5px) translateX(0) rotate(-2deg) scale(1.05); opacity: 1; }
  100% { transform: translateY(0) rotate(0) scale(1); opacity: 1; }
}
.dealer-reveal .card.back {
  animation: flipCard 0.6s ease-in-out forwards;
}
@keyframes flipCard {
  0% { transform: rotateY(0); }
  50% { transform: rotateY(90deg); }
  100% { transform: rotateY(0); }
}
#feedback.action-result {
  animation: resultPulse 0.8s ease;
  font-weight: 600;
}
@keyframes resultPulse {
  0% { transform: scale(0.95); opacity: 0.7; }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}
.mode-active {
  background: linear-gradient(180deg, #4caf50, #2e7d32) !important;
  box-shadow: 0 0 12px rgba(76,175,80,0.6);
}
