body {
  background: #111;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: white;
  font-family: sans-serif;
}

#container {
  display: flex;
  gap: 40px;
  align-items: flex-start;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
  padding: 10px;
  box-sizing: border-box;
}

#scaleContainer {
  transform-origin: top left;
  width: 600px;
}

canvas {
  margin-top: 20px;
  background: black;
  border: 4px solid gold;
  border-radius: 10px;
  width: 100%;
  max-width: 100%;
  height: auto;
}

/* Controls */
#holdButtons {
  display: flex;
  justify-content: space-between;
  width: 600px;
  margin-top: 10px;
}

.holdButton {
  padding: 10px 16px;
  font-size: 16px;
  font-weight: bold;
  border-radius: 8px;
  background-color: #440000;
  color: white;
  border: 2px solid red;
  cursor: pointer;
  animation: pulseRed 1.5s infinite;
  transition: all 0.3s ease;
  flex: 1;
}
.holdButton.held {
  background-color: red;
  animation: none;
  color: black;
}
@keyframes pulseRed {
  0% { box-shadow: 0 0 5px red; }
  50% { box-shadow: 0 0 15px red; }
  100% { box-shadow: 0 0 5px red; }
}
.holdButton.disabled {
  opacity: 0.4;
  pointer-events: none;
  animation: none;
  background-color: #222;
  border-color: #555;
  color: #888;
}

#mainControls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 600px;
  margin-top: 10px;
}
#buttonRow {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Credit display */
#creditDisplay {
  font-size: 32px;
  color: red;
  font-family: 'Orbitron', monospace;
  background: #220000;
  padding: 10px 20px;
  border: 2px solid #aa0000;
  border-radius: 8px;
  box-shadow: 0 0 10px red, inset 0 0 10px #440000;
  text-shadow: 0 0 4px red;
  letter-spacing: 2px;
  width: 100%;
  text-align: center;
  box-sizing: border-box;
  margin-right: 5px;
}

.side-actions {
  display: flex;
  gap: 10px;
}
.action-btn {
  padding: 10px 22px;
  font-size: 18px;
  border-radius: 8px;
  border: 2px solid #ff0000;
  background: #220000;
  color: #fff;
  font-family: 'Orbitron', monospace;
  font-weight: bold;
  letter-spacing: 2px;
  box-shadow: 0 0 8px #660000;
  transition: background 0.16s, color 0.18s;
  cursor: pointer;
}
.action-btn:hover {
  background: #aa0000;
  color: #ffdddd;
  box-shadow: 0 0 14px #aa0000;
}

/* Play button with animation */
#playButton {
  padding: 12px 24px;
  font-size: 20px;
  font-weight: bold;
  border: none;
  border-radius: 12px;
  background-color: #ff9900;
  color: black;
  cursor: pointer;
  box-shadow: 0 0 10px #ff9900, 0 0 20px #ff6600;
  transition: all 0.3s ease;
  width: 100%;
}
#playButton.spinning {
  background-color: #663300;
  box-shadow: none;
  cursor: not-allowed;
  color: #aaa;
}
@keyframes pulseGlow {
  0% { box-shadow: 0 0 10px #ff9900, 0 0 20px #ff6600; }
  50% { box-shadow: 0 0 20px #ffaa33, 0 0 30px #ff6600; }
  100% { box-shadow: 0 0 10px #ff9900, 0 0 20px #ff6600; }
}
#playButton:not(.spinning) {
  animation: pulseGlow 1.5s infinite;
}

/* Message panel */
#messagePanel {
  font-family: sans-serif;
  margin-top: 20px;
  background: #1a1a1a;
  border: 2px solid #444;
  border-radius: 8px;
  padding: 10px;
  max-height: 200px;
  overflow-y: auto;
  width: 100%;
  box-sizing: border-box;
}
#messages .message {
  padding: 6px 10px;
  border-bottom: 1px solid #333;
  background-color: #1c1c1c;
  border-left: 4px solid #ff9900;
  color: #f1f1f1;
  margin-bottom: 4px;
  font-size: 14px;
  animation: fadeIn 0.5s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Right panel */
#rightPanel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

#paytable {
  background: #222;
  padding: 20px;
  border: 2px solid #ccc;
  border-radius: 10px;
  width: 250px;
}
#paytable table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
}
#paytable td {
  padding: 4px 0;
  color: #fff;
  vertical-align: middle;
}
#paytable .sym {
  height: 32px;
  width: auto;
  margin-right: 2px;
  vertical-align: middle;
}

/* Wager controls */
#wagerContainer {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  width: 100%;
}
#wagerContainer button {
  padding: 8px 16px;
  background-color: #333;
  color: white;
  border: 2px solid #777;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  font-size: 24px;
  transition: background-color 0.2s ease;
}
#wagerContainer button:hover {
  background-color: #555;
}
.lcd {
  font-size: 24px;
  color: red;
  font-family: 'Orbitron', monospace;
  background: #220000;
  padding: 8px 16px;
  border: 2px solid #aa0000;
  border-radius: 8px;
  box-shadow: 0 0 10px red, inset 0 0 10px #440000;
  text-shadow: 0 0 4px red;
  letter-spacing: 2px;
  width: 100%;
  text-align: center;
  box-sizing: border-box;
}

.highlight-win {
  animation: glow 1s ease-in-out infinite alternate;
  background-color: rgba(255, 255, 180, 0.3);
}
@keyframes glow {
  from { box-shadow: 0 0 5px rgba(255, 220, 0, 0.6); }
  to { box-shadow: 0 0 15px rgba(255, 220, 0, 0.9); }
}

/* Modal overlay & dialog */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 0, 0, 0.8);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}
.modal-overlay.active {
  display: flex;
}
.modal-dialog {
  min-width: 350px;
  max-width: 90vw;
  background: #1a0808;
  border: 2.5px solid #aa0000;
  border-radius: 18px;
  box-shadow: 0 0 24px 5px #440000, 0 0 10px #ff0000;
  padding: 32px 32px 24px 32px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: stretch;
  font-family: 'Orbitron', monospace;
  color: #fff;
  font-size: 18px;
  pointer-events: auto;
}
.modal-dialog .lcd {
  font-size: 26px;
  margin-bottom: 10px;
  margin-top: 0;
  border-width: 3px;
  letter-spacing: 3px;
}
.modal-dialog label {
  color: #ff9999;
  font-size: 16px;
  margin-bottom: 6px;
  display: block;
  letter-spacing: 1px;
}
.modal-dialog input[type="text"],
.modal-dialog input[type="number"] {
  padding: 10px;
  font-size: 17px;
  border-radius: 7px;
  border: 1.5px solid #881313;
  background: #110101;
  color: #ffdddd;
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 10px;
  outline: none;
  font-family: monospace;
}
.modal-dialog .readonly-input-group {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
}
.modal-dialog .readonly-input-group input {
  flex: 1;
  margin-bottom: 0;
}
.modal-dialog .btn-modal-sm {
  padding: 6px 11px;
  font-size: 13px;
  border-radius: 6px;
  margin-top: 0;
  font-family: inherit;
  background: #232;
  color: #cfc;
  border: 1px solid #484;
  transition: background 0.15s;
  cursor: pointer;
}
.modal-dialog .btn-modal-sm:hover {
  background: #484;
  color: #fff;
}
.modal-dialog .btn-modal {
  background: #333;
  border: 2px solid #aa0000;
  color: #fff;
  border-radius: 8px;
  padding: 12px;
  font-size: 18px;
  font-family: 'Orbitron', monospace;
  font-weight: bold;
  margin-top: 6px;
  transition: background 0.18s;
  cursor: pointer;
  letter-spacing: 2px;
}
.modal-dialog .btn-modal:hover {
  background: #661111;
}
.modal-dialog .modal-close {
  position: absolute;
  right: 18px;
  top: 12px;
  font-size: 24px;
  color: #ff4444;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0 4px;
  z-index: 11;
  font-family: inherit;
  transition: color 0.12s;
}
.modal-dialog .modal-close:hover {
  color: #fff;
  text-shadow: 0 0 8px #ff1111;
}
.modal-hint {
  font-size:15px;
  color:#ffa;
  opacity:0.8;
  margin-top: 5px;
}

@media (max-width: 768px) {
  #container {
    flex-direction: column;
    align-items: center;
    gap: 20px;
  }
  #paytable,
  #wagerContainer {
    width: 100%;
    max-width: 100%;
  }
  #playButton {
    width: 100%;
  }
  #wagerContainer {
    flex-direction: column;
    align-items: stretch;
  }
  .lcd,
  #creditDisplay {
    width: 100%;
    text-align: center;
  }
  .holdButton {
    flex: 1;
  }
  canvas {
    width: 100% !important;
    height: auto !important;
  }
  .modal-dialog {
    min-width: unset;
    max-width: 99vw;
    padding: 18px 8vw 14px 8vw;
  }
}

@media (max-width: 1024px) {
  #container {
    gap: 20px;
  }
  #paytable {
    width: 100%;
  }
  #wagerContainer {
    flex-wrap: wrap;
  }
}
