* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(rgba(15, 11, 22, 0.45), rgba(15, 11, 22, 0.75)),
    url("assets/ui/background.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  color: #fff;
  font-family: "Microsoft JhengHei", Arial, sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
}

.game {
  width: 660px;
  padding: 46px 34px 34px;
  background: rgba(36, 27, 50, 0.88);
  border-radius: 28px;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.65);
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* 機台外框圖片 */
.game::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("assets/ui/machine-frame.png");
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  pointer-events: none;
  z-index: 0;
}

/* 讓內容在機台圖層下方，但仍可操作 */
.game > * {
  position: relative;
  z-index: 2;
}

.game-header {
  margin-bottom: 18px;
}

h1 {
  margin: 0;
  font-size: 32px;
  letter-spacing: 2px;
  color: #fff4c7;
  text-shadow:
    0 2px 0 rgba(90, 45, 0, 0.55),
    0 0 16px rgba(255, 220, 120, 0.45);
}

.subtitle {
  margin: 8px 0 0;
  font-size: 15px;
  color: #d8c7ff;
}

/* 上方中獎資訊 */
.win-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  line-height: 1.5;
}

.win-info-detail {
  font-size: 15px;
  color: #d8c7ff;
}

.win-info-total {
  font-size: 18px;
  font-weight: bold;
  color: #ffdd55;
}

.status-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.status-item {
  padding: 12px 10px;
  background:
    linear-gradient(180deg, rgba(63, 43, 88, 0.96), rgba(38, 25, 58, 0.96));
  border-radius: 16px;
  border: 1px solid rgba(255, 220, 140, 0.22);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.08),
    inset 0 -4px 10px rgba(0, 0, 0, 0.28),
    0 6px 14px rgba(0, 0, 0, 0.25);
}

.status-label {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
  color: #c8b8e8;
}

.status-value {
  display: block;
  font-size: 24px;
  font-weight: bold;
  color: #ffdd55;
}

.slot-area {
  padding: 16px;
  margin-bottom: 18px;
  background: linear-gradient(180deg, #1b1328, #2a1d3d);
  border-radius: 20px;
  box-shadow:
    inset 0 0 18px rgba(0, 0, 0, 0.45),
    0 8px 24px rgba(0, 0, 0, 0.28);
}

/* 整台拉霸盤面 */
.slot-machine {
  display: grid;
  grid-template-columns: repeat(5, 96px);
  gap: 8px;
  justify-content: center;
  position: relative;
}

/* SVG 中獎連線覆蓋層 */
.line-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
  overflow: visible;
}

.win-line {
  fill: none;
  stroke: #ff3b8a;
  stroke-width: 6;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 8px rgba(255, 59, 138, 0.95));
}

.win-line-glow {
  fill: none;
  stroke: rgba(255, 221, 85, 0.75);
  stroke-width: 12;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* 每一軸的可視窗，只露出 5 格 */
.reel-window {
  width: 96px;
  height: 400px; /* 80px × 5 */
  overflow: hidden;
  position: relative;
  border-radius: 16px;
  background: #120d1b;
  border: 2px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    inset 0 12px 20px rgba(0, 0, 0, 0.45),
    inset 0 -12px 20px rgba(0, 0, 0, 0.45);
}

/* 滾動的符號條 */
.reel-strip {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  will-change: transform;
}

/* 單一符號格 */
.reel-symbol {
  width: 96px;
  height: 80px;
  background: linear-gradient(180deg, #fff2c4, #e7c96b);
  color: #241b32;
  border-radius: 14px;
  margin-bottom: 0;
  font-size: 38px;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  box-shadow:
    inset 0 -5px 0 rgba(0, 0, 0, 0.18),
    inset 0 4px 0 rgba(255, 255, 255, 0.55);
  border-bottom: 1px solid rgba(0, 0, 0, 0.18);
}

/* 符號圖片 */
.symbol-img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  display: block;
  pointer-events: none;
  user-select: none;
}

/* 中獎符號 */
.reel-symbol.win {
  background: linear-gradient(180deg, #fff8a8, #ffcc33);
  color: #7a3b00;
  box-shadow:
    0 0 20px rgba(255, 221, 85, 0.95),
    0 0 36px rgba(255, 153, 0, 0.45),
    inset 0 -5px 0 rgba(0, 0, 0, 0.18);
  transform: scale(1.04);
  position: relative;
  z-index: 2;
}

/* 上下遮罩，讓滾輪更像在機台裡 */
.reel-window::before,
.reel-window::after {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  height: 48px;
  z-index: 4;
  pointer-events: none;
}

.reel-window::before {
  top: 0;
  background: linear-gradient(180deg, rgba(18, 13, 27, 0.85), transparent);
}

.reel-window::after {
  bottom: 0;
  background: linear-gradient(0deg, rgba(18, 13, 27, 0.85), transparent);
}

/* 中央判斷列提示線 */
.reel-window .center-line {
  position: absolute;
  left: 0;
  top: 160px; /* 第 3 格起點：80px × 2 */
  width: 100%;
  height: 80px;
  border-top: 2px solid rgba(255, 221, 85, 0.75);
  border-bottom: 2px solid rgba(255, 221, 85, 0.75);
  z-index: 3;
  pointer-events: none;
}

.control-panel {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

button {
  border: none;
  font-family: inherit;
  font-weight: bold;
  cursor: pointer;
  transition:
    transform 0.12s ease,
    background 0.12s ease,
    opacity 0.12s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

.main-button {
  padding: 13px 42px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffe17a, #ffbd24);
  color: #241b32;
  font-size: 21px;
  box-shadow: 0 6px 0 #a96700;
}

.main-button:hover:not(:disabled) {
  background: linear-gradient(180deg, #fff0a8, #ffcc33);
}

.main-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

/* 下注加減按鈕 */
.bet-button {
  padding: 12px 22px;
  border-radius: 999px;
  background: linear-gradient(180deg, #c4b5fd, #8b5cf6);
  color: #ffffff;
  font-size: 17px;
  box-shadow: 0 5px 0 #4c1d95;
}

.bet-button:hover:not(:disabled) {
  background: linear-gradient(180deg, #ddd6fe, #a78bfa);
}

.bet-button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  box-shadow: none;
}

/* 重製金幣按鈕 */
.reset-button {
  padding: 12px 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, #fca5a5, #ef4444);
  color: #ffffff;
  font-size: 16px;
  box-shadow: 0 5px 0 #7f1d1d;
}

.reset-button:hover:not(:disabled) {
  background: linear-gradient(180deg, #fecaca, #f87171);
}

.reset-button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  box-shadow: none;
}

.stop-panel {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

.stop-button {
  padding: 10px 6px;
  border-radius: 12px;
  font-size: 14px;
  background: linear-gradient(180deg, #93e6ff, #38bdf8);
  color: #172033;
  box-shadow: 0 4px 0 #0b6d91;
}

.stop-button:disabled {
  opacity: 0.32;
  cursor: not-allowed;
  box-shadow: none;
}

.reel-info-panel {
  margin-bottom: 14px;
  padding: 14px;
  background: #1c1428;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.reel-info-panel h2 {
  margin: 0 0 12px;
  font-size: 18px;
  color: #ffe17a;
}

.reel-info-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.reel-info-card {
  padding: 10px 6px;
  background: #2f2341;
  border-radius: 12px;
  font-size: 13px;
}

.reel-info-card strong {
  display: block;
  margin-bottom: 5px;
  color: #ffffff;
}

.reel-info-card span {
  display: block;
  min-height: 20px;
  color: #d8c7ff;
  font-size: 14px;
}

.result-text {
  min-height: 30px;
  margin: 0;
  font-size: 18px;
  line-height: 1.5;
  color: #ffffff;
}

/* 小螢幕簡單支援 */
@media (max-width: 720px) {
  body {
    align-items: flex-start;
    padding: 6px;
    min-height: 100vh;
    overflow-x: hidden;
  }

  .game {
    width: 100%;
    max-width: 430px;
    padding: 14px 10px 12px;
    border-radius: 18px;
  }

  .game-header {
    margin-bottom: 8px;
  }

  h1 {
    font-size: 20px;
    letter-spacing: 1px;
  }

  .subtitle {
    margin-top: 4px;
  }

  .win-info {
    gap: 2px;
    line-height: 1.25;
  }

  .win-info-detail {
    font-size: 12px;
    max-height: 34px;
    overflow: hidden;
  }

  .win-info-total {
    font-size: 14px;
  }

  .status-panel {
    gap: 6px;
    margin-bottom: 8px;
  }

  .status-item {
    padding: 6px 4px;
    border-radius: 10px;
  }

  .status-label {
    font-size: 11px;
    margin-bottom: 2px;
  }

  .status-value {
    font-size: 17px;
  }

  .slot-area {
    padding: 8px;
    margin-bottom: 8px;
    border-radius: 14px;
  }

  .slot-machine {
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
  }

  .reel-window {
    width: 100%;
    height: 240px; /* 48px × 5 */
    border-radius: 10px;
  }

  .reel-symbol {
    width: 100%;
    height: 48px;
    border-radius: 8px;
  }

  .symbol-img {
    width: 40px;
    height: 40px;
  }

  .reel-window::before,
  .reel-window::after {
    height: 28px;
  }

  .reel-window .center-line {
    top: 96px; /* 48px × 2 */
    height: 48px;
  }

  .control-panel {
    gap: 5px;
    margin-bottom: 8px;
    flex-wrap: nowrap;
  }

  .main-button {
    padding: 10px 16px;
    font-size: 15px;
    white-space: nowrap;
  }

  .bet-button {
    padding: 8px 8px;
    font-size: 12px;
    white-space: nowrap;
  }

  .reset-button {
    padding: 8px 8px;
    font-size: 12px;
    white-space: nowrap;
  }

  .stop-panel {
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    margin-bottom: 8px;
  }

  .stop-button {
    font-size: 11px;
    padding: 7px 2px;
    border-radius: 8px;
  }

  .reel-info-panel {
    padding: 8px;
    margin-bottom: 6px;
    border-radius: 12px;
  }

  .reel-info-panel h2 {
    display: none;
  }

  .reel-info-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
  }

  .reel-info-card {
    padding: 5px 2px;
    border-radius: 8px;
    font-size: 10px;
  }

  .reel-info-card strong {
    margin-bottom: 2px;
    font-size: 10px;
  }

  .reel-info-card span {
    min-height: 16px;
    font-size: 10px;
  }

  .result-text {
    display: none;
  }
}

 