@media (min-width: 768px) {
  #app {
    min-height: auto;
  }

  .table-area {
    min-height: 500px;
  }
}

:root {
  --felt: #0f4f29;
  --felt-dark: #0a3a1e;
  --gold: #d4af37;
  --gold-dark: #8c701a;
  --charcoal: #1a1a1e;
  --text: #f2f2f2;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Georgia', 'Times New Roman', serif;
  background: var(--charcoal);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

#app {
  width: 100%;
  max-width: 900px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.screen {
  display: none;
  flex-direction: column;
  flex: 1;
  width: 100%;
  padding: clamp(16px, 4vw, 32px);
}

.screen.active {
  display: flex;
}

h1.title {
  text-align: center;
  color: var(--gold);
  letter-spacing: 2px;
  margin: 20px 0 4px;
  font-size: 2rem;
}

.subtitle {
  text-align: center;
  opacity: 0.85;
  margin-bottom: 24px;
  font-style: italic;
}

.stat-row {
  text-align: center;
  margin-bottom: 8px;
}

.stat-row .cash {
  color: var(--gold);
  font-size: 1.3rem;
  font-weight: bold;
}

.stat-row .rep {
  opacity: 0.9;
}

button {
  font-family: inherit;
  font-size: 1rem;
  border: none;
  border-radius: 8px;
  padding: 14px 18px;
  cursor: pointer;
  background: var(--gold-dark);
  color: var(--text);
  transition: background 0.15s ease;
}

button:hover:not(:disabled) {
  background: var(--gold);
  color: #1a1a1e;
}

button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-primary {
  width: 100%;
  margin-top: 20px;
  padding: 16px;
  font-size: 1.1rem;
}

.btn-secondary {
  width: 100%;
  margin-top: 12px;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.bet-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 18px;
}

.bet-row .bet-amount {
  min-width: 110px;
  text-align: center;
  font-size: 1.2rem;
  color: var(--gold);
}

.bet-row button {
  width: 56px;
  height: 44px;
}

.table-area {
  background: var(--felt);
  border: 6px solid var(--felt-dark);
  border-radius: 16px;
  padding: clamp(12px, 3vw, 24px);
  margin-top: 16px;
  width: 100%;

  display: flex;
  flex-direction: column;
  justify-content: center;
  /* centers vertically */
  align-items: center;
  /* centers horizontally */
  gap: 30px;
}

.hand-block {
  width: 100%;
  text-align: center;
  margin-bottom: 18px;
}

.hand-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.8;
  margin-bottom: 10px;
  text-align: center;
}

.cards {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  /* centers cards */
  align-items: center;
  margin-bottom: 8px;
}

.card.red {
  color: #b0202f;
}

.card.hidden {
  background: var(--gold-dark);
  color: var(--gold-dark);
}

.hand-value {
  font-size: 0.95rem;
  opacity: 0.9;
  text-align: center;
}

.message {
  text-align: center;
  color: var(--gold);
  font-size: 1.05rem;
  min-height: 1.4em;
  margin-top: 10px;
}

.location-card {
  background: #24241f;
  border: 1px solid var(--gold-dark);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 12px;
}

.location-card h3 {
  margin: 0 0 4px;
  color: var(--gold);
}

.location-card p {
  margin: 0 0 10px;
  font-size: 0.9rem;
  opacity: 0.85;
}

.location-card button {
  width: 100%;
}

.location-card.current {
  border-color: var(--gold);
}

.location-card.current button {
  background: #3a3a2a;
  cursor: default;
}

.back-link {
  text-align: center;
  margin-top: 16px;
  opacity: 0.8;
  cursor: pointer;
  text-decoration: underline;
}

footer.hint {
  text-align: center;
  font-size: 0.75rem;
  opacity: 0.5;
  padding: 10px;
}

/* Card flip animation */

.card-flip {
  width: 70px;
  height: 100px;
  perspective: 400px;
  flex-shrink: 0;
  min-width: 70px;
}

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

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

.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.4rem;
}

.card-back {
  background: var(--gold-dark);
}

.card-front {
  background: #fff;
  color: #1a1a1e;
  transform: rotateY(180deg);
  position: relative;
  display: block;
  /* override the flex centering from .card-face for this element */
  padding: 6px;
}

.card-front.red {
  color: #b0202f;
}

.card-corner {
  position: absolute;
  font-size: 0.85rem;
  line-height: 1.1;
  text-align: center;
}

.card-corner.top-left {
  top: 6px;
  left: 6px;
}

.card-corner.bottom-right {
  bottom: 6px;
  right: 6px;
  transform: rotate(180deg);
  /* classic cards mirror the bottom index upside-down */
}

.card-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2rem;
}

.card-front {
  padding: 0;
}
.card-img {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 6px;
}
