* {
  box-sizing: border-box;
}

body, html {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #060609;
  color: #f1f5f9;
  font-family: "Malgun Gothic", sans-serif;
  user-select: none;
}

#scene-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  cursor: grab;
  touch-action: none; /* 모바일 기본 스크롤/당겨서 새로고침 차단 */
}

#scene-container:active {
  cursor: grabbing;
}

.ui-toggle-btn {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 30;
  background: rgba(20, 24, 36, 0.92);
  color: #facc15;
  border: 1px solid rgba(250, 204, 21, 0.45);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.ui-toggle-btn:hover {
  background: rgba(34, 40, 58, 0.96);
}

.hud-left {
  position: fixed;
  top: 48px;
  left: 12px;
  width: 215px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 20;
}

.hud-left.ui-hidden {
  display: none;
}

.left-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(12, 13, 20, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  padding: 12px;
  backdrop-filter: blur(8px);
}

.game-brand {
  font-size: 14px;
  font-weight: 900;
  color: #facc15;
  letter-spacing: 0.4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 6px;
}

.wallet-box {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  color: #cbd5e1;
}

.wallet-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.wallet-row strong {
  color: #38bdf8;
  font-family: "Consolas", monospace;
  font-size: 13.5px;
  margin-left: auto;
  margin-right: 2px;
}

.left-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mini-btn {
  width: 100%;
  background: #1e2230;
  color: #e2e8f0;
  border: 1px solid #3b4259;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 11.5px;
  font-weight: bold;
  cursor: pointer;
  text-align: center;
}

.mini-btn:hover {
  background: #2b3145;
}

.mini-btn.active {
  background: #1d4ed8;
  border-color: #60a5fa;
  color: #ffffff;
}

.guide-bar {
  background: rgba(10, 12, 18, 0.88);
  border: 1px solid rgba(250, 204, 21, 0.35);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.5;
  color: #fde68a;
  backdrop-filter: blur(6px);
}

.guide-bar b {
  color: #38bdf8;
}

.hover-label {
  position: fixed;
  pointer-events: none;
  z-index: 40;
  background: rgba(10, 12, 20, 0.92);
  color: #f8fafc;
  border: 1px solid rgba(250, 204, 21, 0.55);
  border-radius: 6px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.65);
  transform: translate(12px, -28px);
}

.hover-label.hidden {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 50;
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(460px, 92vw);
  background: #12141d;
  border: 2px solid #eab308;
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.85);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 15px;
  font-weight: bold;
  color: #facc15;
  border-bottom: 1px solid #2a2f42;
  padding-bottom: 10px;
  margin-bottom: 12px;
}

.close-x {
  background: #272b3b;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 4px 9px;
  cursor: pointer;
}

.modal-body {
  font-size: 13px;
  line-height: 1.65;
  color: #e2e8f0;
}

.modal-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 12px;
}

.modal-body th,
.modal-body td {
  border: 1px solid #2c3246;
  padding: 6px;
  text-align: center;
}

.modal-body th {
  background: #1b2030;
  color: #facc15;
}

.action-primary {
  width: 100%;
  margin-top: 12px;
  padding: 10px;
  background: linear-gradient(180deg, #eab308, #ca8a04);
  color: #111;
  font-weight: 900;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13.5px;
}

@media (max-width: 768px) {
  .hud-left {
    width: 175px;
  }
  .left-panel {
    padding: 9px;
    gap: 7px;
  }
  .guide-bar {
    font-size: 11px;
  }
}

/* 하단 원터치 간편 조작 바 */
.quick-controls {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 20;
  width: min(94vw, 460px);
  pointer-events: auto;
}

.qc-row-main {
  display: flex;
  gap: 8px;
  width: 100%;
}

.qc-row-sub {
  display: flex;
  gap: 8px;
  width: 100%;
}

.qc-sub-btn {
  padding: 7px 6px;
  font-size: 12px;
  font-weight: 800;
  border-radius: 8px;
  border-width: 1px;
}

.qc-bill {
  background: linear-gradient(180deg, #059669, #065f46);
  border-color: #34d399;
}

.qc-lend {
  background: linear-gradient(180deg, #0284c7, #075985);
  border-color: #38bdf8;
}

.qc-btn {
  flex: 1;
  padding: 14px 6px;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  font-size: 14px;
  font-weight: 900;
  color: #ffffff;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
  transition: transform 0.08s ease, opacity 0.15s ease;
}

.qc-btn:active {
  transform: scale(0.95);
}

.qc-start {
  background: linear-gradient(180deg, #dc2626, #991b1b);
  border-color: #f87171;
}

.qc-start.ready-lever {
  background: linear-gradient(180deg, #2563eb, #1d4ed8);
  border-color: #60a5fa;
}

.qc-stop {
  background: linear-gradient(180deg, #334155, #0f172a);
  border-color: #94a3b8;
}

.qc-stop.can-stop {
  background: linear-gradient(180deg, #0284c7, #0369a1);
  border-color: #38bdf8;
}

.qc-coin {
  background: linear-gradient(180deg, #d97706, #92400e);
  border-color: #fbbf24;
}

.qc-coin.disabled {
  opacity: 0.45;
}

/* 배팅 버튼 반분할 그룹 (1 BET + MAX/START) */
.qc-bet-group {
  flex: 1.25;
  display: flex;
  gap: 5px;
}

.qc-bet-group .qc-btn {
  padding: 14px 4px;
  font-size: 13px;
}

.qc-bet1 {
  background: linear-gradient(180deg, #4f46e5, #312e81);
  border-color: #818cf8;
}

.qc-bet1.disabled {
  opacity: 0.45;
}

.qc-btn.disabled {
  opacity: 0.35 !important;
  filter: grayscale(50%);
  cursor: default;
}