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

body {
  font-family: system-ui, sans-serif;
  background: #1a472a;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.table {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 32px 24px;
  max-width: 640px;
  width: 100%;
}

h1 {
  color: #f5e6c8;
  font-size: 2rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ── Hand areas ── */
.hand-area {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.label {
  color: #c8e6c9;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.score {
  background: rgba(0,0,0,0.35);
  border-radius: 4px;
  padding: 1px 6px;
  font-weight: 700;
  color: #fff;
  margin-left: 6px;
}

.cards {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 110px;
}

/* ── Card ── */
.card {
  width: 70px;
  height: 100px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #ccc;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 4px 6px;
  font-weight: 700;
  font-size: 1rem;
  position: relative;
  box-shadow: 2px 3px 6px rgba(0,0,0,0.35);
  user-select: none;
}

.card.red { color: #c0392b; }
.card.black { color: #1a1a1a; }

.rank-top { font-size: 0.9rem; line-height: 1; }
.suit { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); font-size: 1.5rem; }
.rank-bot { font-size: 0.9rem; line-height: 1; align-self: flex-end; transform: rotate(180deg); }

.card.face-down {
  background-color: #1e3a8a;
  background-image:
    repeating-linear-gradient(
      45deg,
      rgba(255,255,255,0.07) 0px,
      rgba(255,255,255,0.07) 2px,
      transparent          2px,
      transparent          8px
    ),
    repeating-linear-gradient(
      -45deg,
      rgba(255,255,255,0.07) 0px,
      rgba(255,255,255,0.07) 2px,
      transparent          2px,
      transparent          8px
    );
  border-color: #1e40af;
  overflow: hidden;
}

/* белая рамка внутри */
.card.face-down::before {
  content: '';
  position: absolute;
  inset: 5px;
  border: 2px solid rgba(255,255,255,0.35);
  border-radius: 4px;
}

/* ромб в центре */
.card.face-down::after {
  content: '♦';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.6rem;
  color: rgba(255,255,255,0.4);
}

/* ── Result banner ── */
.result {
  min-height: 32px;
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  text-align: center;
  padding: 4px 16px;
  border-radius: 6px;
  transition: background 0.2s;
}
.result.win, .result.blackjack { background: rgba(22,163,74,0.7); }
.result.lose, .result.bust    { background: rgba(220,38,38,0.7); }
.result.push                  { background: rgba(100,100,100,0.6); }

/* ── Buttons ── */
.controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

button {
  padding: 10px 28px;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  background: #f5e6c8;
  color: #1a1a1a;
  transition: opacity 0.15s, transform 0.1s;
}
button:hover:not(:disabled) { opacity: 0.88; transform: translateY(-1px); }
button:active:not(:disabled) { transform: translateY(0); }
button:disabled { opacity: 0.35; cursor: not-allowed; }
button.secondary { background: rgba(255,255,255,0.2); color: #f5e6c8; }
