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

body {
  font-family: 'Arial', sans-serif;
  background: linear-gradient(135deg, #1a5f3f 0%, #0d3d27 100%);
  color: #fff;
  height: 100vh;
  display: flex;
  flex-direction: column; /* 縦並び */
  justify-content: center;
  align-items: center;
  padding: 10px;
  overflow: hidden;
}

/* ここで縦並び */
.page {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

/* Ad Banner */
.ad-banner {
  width: 100%;
  max-width: 1400px;
  height: 80px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 10px;
  margin-bottom: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
}

.ad-placeholder {
  color: #999;
  font-size: 0.9rem;
  text-align: center;
}

/* Game Container */
.game-container {
  max-width: 1400px;
  width: 100%;
  height: calc(95vh - 90px); /* 広告バナー80px + margin 10pxを引く */
  background: rgba(0, 0, 0, 0.5);
  border-radius: 15px;
  padding: 15px;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header */
.game-header {
  text-align: center;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.game-header h1 {
  font-size: 2rem;
  color: #ffd700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
  letter-spacing: 3px;
  margin-bottom: 2px;
}

.subtitle {
  font-size: 0.9rem;
  color: #ccc;
  margin-top: 0;
}

/* Info Display */
.info-display {
  display: flex;
  justify-content: space-around;
  margin-bottom: 8px;
  padding: 8px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  flex-shrink: 0;
}

.info-item {
  text-align: center;
}

.info-label {
  display: block;
  font-size: 0.75rem;
  color: #999;
  margin-bottom: 2px;
}

.info-value {
  display: block;
  font-size: 1.5rem;
  font-weight: bold;
  color: #ffd700;
}

/* Paytable */
.paytable-container {
  margin-bottom: 8px;
  flex-shrink: 0;
}

.paytable-title {
  font-size: 0.9rem;
  text-align: center;
  margin-bottom: 5px;
  color: #ffd700;
}

.paytable {
  width: 100%;
  border-collapse: collapse;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  overflow: hidden;
  font-size: 0.75rem;
}

.paytable thead {
  background: rgba(255, 215, 0, 0.2);
}

.paytable th {
  padding: 4px 6px;
  text-align: center;
  font-weight: bold;
  color: #ffd700;
  font-size: 0.7rem;
}

.paytable th:first-child {
  text-align: left;
  padding-left: 10px;
}

.paytable td {
  padding: 3px 6px;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.paytable td:first-child {
  text-align: left;
  padding-left: 10px;
  font-weight: bold;
  font-size: 0.7rem;
}

.paytable-row {
  transition: all 0.3s ease;
}

.paytable-row:hover {
  background: rgba(255, 255, 255, 0.05);
}

.paytable-row.highlight {
  background: rgba(255, 215, 0, 0.3);
  animation: pulse 0.5s ease-in-out infinite alternate;
}

/* Controls */
.controls {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 10px;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.btn {
  padding: 10px 30px;
  font-size: 1rem;
  font-weight: bold;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
}

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

.btn-primary {
  background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
  color: #1a5f3f;
  box-shadow: 0 5px 20px rgba(255, 215, 0, 0.4);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 7px 25px rgba(255, 215, 0, 0.6);
}

.btn-secondary {
  background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
  color: #fff;
  box-shadow: 0 5px 20px rgba(76, 175, 80, 0.4);
}

.btn-secondary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 7px 25px rgba(76, 175, 80, 0.6);
}

/* Touch active state for mobile */
.btn.touch-active:not(:disabled) {
  transform: scale(0.95);
  opacity: 0.8;
}

/* Active state for keyboard/mouse */
.btn:active:not(:disabled) {
  transform: scale(0.95);
}

/* Instructions */
.instructions {
  text-align: center;
  color: #ccc;
  font-size: 0.7rem;
  line-height: 1.3;
  flex-shrink: 0;
}

.instructions p {
  margin: 3px 0;
}

.instructions .keyboard-shortcuts {
  margin-top: 2px;
  font-size: 0.65rem;
  color: #999;
}

.instructions kbd {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  padding: 1px 4px;
  font-family: 'Courier New', monospace;
  font-size: 0.85em;
  color: #ffd700;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.instructions .tip {
  margin-top: 3px;
  color: #ffd700;
}

/* Win Message Overlay */
.win-message {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.win-message.show {
  display: flex;
}

.win-content {
  text-align: center;
  animation: scaleIn 0.5s ease-out;
}

.win-content h2 {
  font-size: 3rem;
  color: #ffd700;
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
  margin-bottom: 15px;
}

.win-payout {
  font-size: 2.5rem;
  font-weight: bold;
  color: #fff;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: #1a5f3f;
  padding: 30px;
  border-radius: 15px;
  text-align: center;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
}

.modal-content h2 {
  font-size: 2.5rem;
  color: #ff4444;
  margin-bottom: 15px;
}

.modal-content p {
  font-size: 1.2rem;
  margin-bottom: 20px;
}

/* Responsive */
@media (max-width: 1200px) {
  .card {
    width: 90px !important;
    height: 130px !important;
  }

  .card-rank {
    font-size: 1.8rem !important;
  }

  .card-suit {
    font-size: 2.5rem !important;
  }
}

@media (max-width: 768px) {
  body {
    padding: 5px;
  }

  .ad-banner {
    height: 60px; /* モバイルでは広告を少し小さく */
    margin-bottom: 5px;
  }

  .ad-placeholder {
    font-size: 0.75rem;
  }

  .game-container {
    padding: 10px;
    height: calc(98vh - 65px); /* 広告バナー60px + margin 5pxを引く */
  }

  .game-header h1 {
    font-size: 1.5rem;
  }

  .subtitle {
    font-size: 0.75rem;
  }

  .info-value {
    font-size: 1.2rem;
  }

  .paytable {
    font-size: 0.65rem;
  }

  .paytable th,
  .paytable td {
    padding: 2px 4px;
  }

  .btn {
    padding: 8px 20px;
    font-size: 0.85rem;
  }

  .card-container {
    gap: 6px;
  }

  .card {
    width: 70px !important;
    height: 100px !important;
  }

  .card-rank {
    font-size: 1.4rem !important;
    top: 5px !important;
    left: 8px !important;
  }

  .card-suit {
    font-size: 2rem !important;
    bottom: 20px !important;
  }

  .instructions {
    font-size: 0.6rem;
  }

  .win-content h2 {
    font-size: 2rem;
  }

  .win-payout {
    font-size: 1.5rem;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
