/* Baccarat Game Styling - Consistent with HiLo */
:root {
  --card-bg: rgba(255, 255, 255, 0.05);
  --accent: #c6ff00;
  --muted: #9aa0a6;
  --danger: #ff6b6b;
}

html {
  font-family: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
  background-color: #14151f;
  color: #fff;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.container {
  width: 100%;
  max-width: 650px;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1em;
}

.header h1 {
  font-size: 1.8em;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.back-link {
  color: #fff;
  text-decoration: none;
  font-size: 1em;
  line-height: 1;
  transition: all 0.2s;
  opacity: 0.7;
  display: flex;
  align-items: center;
}

.back-link:hover {
  opacity: 1;
  color: var(--accent);
  transform: translateX(-2px);
}

.balance-display {
  font-size: 1.2em;
  font-weight: 600;
  color: #00ff00;
}

button {
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  opacity: 0.8;
}

button:hover {
  opacity: 1;
}

button:active {
  opacity: 0.8;
}

.controls {
  background: var(--card-bg);
  padding: 16px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.controls-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.controls-row-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.controls label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  white-space: nowrap;
}

.controls input[type="number"],
.controls input[type="range"] {
  width: 100px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}

.controls input[type="range"] {
  width: 80px;
}

.controls input:focus {
  outline: none;
  border-color: var(--accent);
}

.controls input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.controls button {
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s;
  white-space: nowrap;
}


#start-game {
  background: var(--accent);
  color: #000;
}

#start-game:hover:not(:disabled) {
  background: #00ff00;
  transform: translateY(-1px);
}

#start-game:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#reset {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

#reset:hover {
  background: rgba(255, 255, 255, 0.15);
}

.message {
  color: #ffd166;
  font-size: 14px;
  text-align: right;
  min-height: 20px;
  flex: 1;
}

/* Game Section */
.game {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  margin-top: 20px;
}

.game-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 20px;
  width: 100%;
}

.card-stage {
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card-bg);
  border-radius: 12px;
  padding: 20px;
  width: 100%;
}

.deal-area {
  display: flex;
  flex-direction: row;
  gap: 20px;
}

/* Card visuals */
.hand-row {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
}

.hand-label {
  width: 60px;
  font-weight: 700;
  opacity: 0.8;
}

.hand-cards {
  display: flex;
  gap: 8px;
}

.player-third {
  order: -1;
}

.banker-third {
  order: 99;
}

.card {
  width: 80px;
  height: 120px;
  position: relative;
  perspective: 1000px;
  opacity: 1;
  transition: transform 0.45s ease-out, opacity 0.45s ease-out;
}

.card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform .56s;
}

.card-front,
.card-back {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Blue Card Back */
.card-front {
  background: linear-gradient(135deg,#1e3a8a,#3b82f6);
  border: 3px solid #60a5fa;
  font-size: 48px;
  font-weight: 700;
  color: #fff;
}

/* White Card Face */
.card-back {
  transform: rotateY(180deg);
  background: #fff;
  color: #000;
  flex-direction: column;
  padding: 14px;
  border: 3px solid #e0e0e0;
}

.card.flipped .card-inner {
  transform: rotateY(180deg);
}

.card-back .rank {
  font-size: 56px;
  font-weight: 800;
  line-height: 1;
}

.card-back .suit {
  font-size: 44px;
  margin-top: 6px;
}

.card-back .suit.red { color: #dc2626; }
.card-back .suit.black { color: #000; }

/* Third card displayed horizontally */
.card:not(.side-card).slide-in {
  transform: translateX(0);
}

.player-third.side-card.slide-in {
  transform: rotate(90deg) scale(0.85) translateX(0);
}

.banker-third.side-card.slide-in {
  transform: rotate(270deg) scale(0.85) translateX(0);
}

.player-third.side-card {
  transform: rotate(90deg) scale(0.85);
}

.banker-third.side-card {
  transform: rotate(270deg) scale(0.85);
}

/* Guess Buttons */
.guess-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  width: 100%;
  max-width: 640px;
}

.guess-btn {
  flex: 1;
  padding: 14px;
  border-radius: 12px;
  border: 2px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.03);
  color: #fff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.guess-btn .label {
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
}

.guess-btn .payout {
  font-weight: 800;
  color: var(--accent);
  font-size: 18px;
}

.guess-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.guess-btn.selected {
  outline:2px solid var(--accent);
  background:rgba(198,255,0,0.12);
}

.guess-btn.win {
  box-shadow: 0 8px 28px rgba(0,255,122,0.12);
  background: rgba(0,255,122,0.06);
  border-color: #00ff7a;
}

.guess-btn.lose {
  animation: shake .4s;
  box-shadow: 0 8px 28px rgba(255,40,40,0.12);
  background: rgba(255,40,40,0.06);
  border-color: #ff2828;
}

@keyframes shake {
  0% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-8px);
  }
  50% {
    transform: translateX(8px);
  }
  75% {
    transform: translateX(-4px);
  }
  100% {
    transform: translateX(0);
  }
}

/* ---------- HISTORY ---------- */
.history-container {
    margin-top: 20px;
    text-align: center;
}

.history-list {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.history-item {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    font-weight: bold;
    font-size: 12px;
}

/* Colors like real baccarat bead road */
.history-player { background: #1e90ff; } /* Blue */
.history-banker { background: #ff3b3b; } /* Red */
.history-tie    { background: #2ecc71; } /* Green */

.footer {
  margin-top: 2em;
  text-align: center;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.85em;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
  .header h1 {
    font-size: 1.3em;
  }

  .controls {
    gap: 8px;
  }

  .controls-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .controls-row-left {
    width: 100%;
    flex-direction: column;
    gap: 8px;
  }

  .controls label {
    width: 100%;
    justify-content: flex-start;
  }

  .controls button {
    width: 100%;
  }

  .message {
    text-align: center;
    justify-self: center;
    align-self: center;
  }

  .guess-buttons {
    flex-direction: row;
    gap: 8px;
  }

  .guess-btn {
    width: 100%;
  }

  .card {
    width: 50px;
    height: 75px;
  }

  .card-back .rank {
    font-size: 32px;
  }

  .card-back .suit {
    font-size: 28px;
    margin-top: 3px;
  }
}

