/* style.css —— 柏青哥机台风:深红黑厅堂底 + 金/红霓虹 HUD/提示层/结算/竖屏旋转提示。
   所有元素 ID/类名与 hud.js(main.js)契约一致,仅改视觉。 */

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
  background: #160409; /* 柏青哥厅夜色(与 3D clearColor 同纲)*/
  color: #ffe9c2;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
    'Microsoft YaHei', sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
  overscroll-behavior: none;
}

/* 主舞台:横屏全屏铺满 */
#app {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
#game {
  width: 100vw;
  height: 100vh;
  display: block;
  touch-action: none;
}

/* —— 顶部 HUD(深色玻璃 + 金边 + 霓虹数字)—— */
#hud {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
  display: flex;
  gap: 10px;
  align-items: center;
  z-index: 5;
}
.hud-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: rgba(28, 6, 12, 0.72);
  border: 1px solid rgba(255, 200, 58, 0.55);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45), inset 0 0 12px rgba(255, 42, 68, 0.12);
  backdrop-filter: blur(7px);
}
.hud-label {
  font-size: 12px;
  color: #c9933a;
  letter-spacing: 1px;
}
.hud-val {
  font-size: 22px;
}
.led {
  font-family: 'Courier New', monospace;
  font-weight: 800;
  color: #ffd24a;
  min-width: 1ch;
  text-align: right;
  text-shadow: 0 0 8px rgba(255, 200, 58, 0.85), 0 0 2px rgba(255, 235, 180, 0.9);
}
.led.accent {
  color: #ff3b4a;
  text-shadow: 0 0 10px rgba(255, 42, 68, 0.9), 0 0 2px rgba(255, 150, 160, 0.9);
}

/* —— 底部控制提示 —— */
#hint {
  position: absolute;
  bottom: max(12px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 18px;
  background: rgba(28, 6, 12, 0.78);
  border: 1px solid rgba(255, 200, 58, 0.5);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: #ffd98a;
  z-index: 5;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
}
.guide {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 5;
}
.render-mode {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
  z-index: 6;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #ffd24a;
  background: rgba(28, 6, 12, 0.7);
  border: 1px solid rgba(255, 200, 58, 0.5);
  border-radius: 8px;
  pointer-events: none;
}
.guide.show {
  opacity: 1;
}
#guide-gamepad {
  top: max(10px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  padding: 6px 12px;
  background: rgba(28, 6, 12, 0.78);
  border: 1px solid rgba(255, 200, 58, 0.45);
  border-radius: 999px;
  font-size: 12px;
  color: #ffb74d;
}

/* —— 点6:开始按钮(纯鼠标可玩;ARMED/canStart 时亮起)—— */
#start-btn {
  position: absolute;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(74px, env(safe-area-inset-bottom));
  z-index: 6;
  padding: 14px 30px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #160409;
  background: linear-gradient(180deg, #ffd866, #ffc83a);
  border: 2px solid #ffe9a8;
  border-radius: 14px;
  box-shadow: 0 0 24px rgba(255, 200, 58, 0.65), 0 6px 16px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}
#start-btn.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
  animation: pulse 1.6s ease-in-out infinite;
}
#start-btn:hover {
  box-shadow: 0 0 34px rgba(255, 200, 58, 0.85), 0 8px 20px rgba(0, 0, 0, 0.5);
}
#start-btn:active {
  transform: translateY(1px);
}

/* —— 投币按钮(正式功能:余额 +10,出口涌出 10 颗白球真实落入白球盒;无限次可投)—— */
#coin-btn {
  position: absolute;
  left: max(14px, env(safe-area-inset-left));
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 6;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 700;
  color: #04141a;
  background: linear-gradient(180deg, #5fe9ff, #1fd8ff);
  border: 2px solid #b8f6ff;
  border-radius: 12px;
  box-shadow: 0 0 18px rgba(31, 216, 255, 0.55), 0 4px 12px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s ease, box-shadow 0.18s ease;
}
#coin-btn:hover {
  box-shadow: 0 0 26px rgba(31, 216, 255, 0.8), 0 6px 14px rgba(0, 0, 0, 0.45);
}
#coin-btn:active {
  transform: translateY(1px) scale(0.98);
}

/* —— 落球 toast —— */
.toast {
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  padding: 14px 30px;
  border-radius: 14px;
  font-size: 26px;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 8;
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.toast.win {
  color: #ffd24a;
  background: rgba(40, 6, 12, 0.95);
  border: 2px solid #ffc83a;
  box-shadow: 0 0 30px rgba(255, 200, 58, 0.55), inset 0 0 18px rgba(255, 42, 68, 0.25);
  text-shadow: 0 0 12px rgba(255, 200, 58, 0.9);
}
.toast.lose {
  color: #8a8076;
  background: rgba(20, 8, 10, 0.92);
  border: 2px solid #4a3a30;
}

/* —— 大覆盖层(柏青哥厅暗场 + 霓虹)—— */
#overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 40%, rgba(70, 10, 22, 0.7), rgba(12, 3, 6, 0.94));
  z-index: 10;
  backdrop-filter: blur(4px);
}
#overlay.show {
  display: flex;
}
.ov {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
  padding: 20px;
}
.ov.show {
  display: flex;
}
.title-emoji {
  font-size: 88px;
  animation: bob 1.6s ease-in-out infinite;
  filter: drop-shadow(0 8px 18px rgba(255, 42, 68, 0.55));
}
.title-name {
  margin: 0;
  font-size: 54px;
  letter-spacing: 4px;
  background: linear-gradient(90deg, #ffc83a, #ff2a44, #1fd8ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 30px rgba(255, 42, 68, 0.35);
}
.title-sub {
  margin: 0;
  font-size: 16px;
  color: #ffb74d;
}
.title-pulse {
  margin-top: 6px;
  font-size: 20px;
  font-weight: 700;
  color: #ffe9c2;
  padding: 12px 26px;
  background: rgba(40, 8, 14, 0.85);
  border: 1px solid rgba(255, 200, 58, 0.6);
  border-radius: 999px;
  animation: pulse 1.6s ease-in-out infinite;
  box-shadow: 0 0 22px rgba(255, 42, 68, 0.35);
}
.title-best {
  margin: 6px 0 0;
  font-size: 14px;
  color: #c9933a;
}
.go-title {
  margin: 0;
  font-size: 38px;
  background: linear-gradient(90deg, #ffc83a, #ff2a44);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.go-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(170px, 1fr));
  gap: 12px 28px;
  margin: 8px 0;
}
.go-grid > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 16px;
  background: rgba(30, 8, 14, 0.8);
  border: 1px solid rgba(255, 200, 58, 0.35);
  border-radius: 10px;
}
.go-grid span {
  font-size: 12px;
  color: #c9933a;
}
.go-grid b {
  font-size: 24px;
  color: #ffd24a;
  font-family: 'Courier New', monospace;
  text-shadow: 0 0 8px rgba(255, 200, 58, 0.6);
}
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* 按键徽标(金) */
.g-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  padding: 0 8px;
  margin: 0 3px;
  background: rgba(255, 200, 58, 0.14);
  border: 1px solid rgba(255, 200, 58, 0.65);
  border-radius: 7px;
  font-size: 14px;
  color: #ffd24a;
  box-shadow: 0 0 10px rgba(255, 200, 58, 0.25);
}

/* —— 竖屏旋转提示(暗底金字)—— */
#rotate {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: #160409;
  z-index: 100;
  text-align: center;
  color: #ffd98a;
}
.rotate-icon {
  font-size: 72px;
  animation: rot 2s ease-in-out infinite;
}
.rotate-text {
  font-size: 22px;
  font-weight: 700;
}
@keyframes rot {
  0%, 40% { transform: rotate(0deg); }
  60%, 100% { transform: rotate(-90deg); }
}
/* 仅真实触屏/移动设备(pointer: coarse)竖屏时提示旋转。
   PC(鼠标/fine 指针)无论窗口多窄都不弹 —— 改由布局 letterbox/自适应显示游戏。 */
@media (orientation: portrait) and (pointer: coarse) {
  #rotate {
    display: flex;
  }
  #app {
    display: none;
  }
}
