:root{
  --bg:#0c372f; /* 主背景深綠 */
  --bg-2:#0f3a30; /* 次色 */
  --panel:#123a30; /* 卡片底色 */
  --accent:#c9b24b; /* 金色 / 主色 */
  --muted:#98b48f; /* 輔助文字 */
  --glass: rgba(255,255,255,0.03);
  --glass-2: rgba(255,255,255,0.015);
  --card: rgba(255,255,255,0.02);
  --shadow: 0 10px 40px rgba(0,0,0,0.55);
  --radius: 14px;
  --max-width:1100px;
  --gold-dark: #8f7a2a;
  --gold-mid:  #b59b3b;
  --gold-light:#e3c86a;
}

/* Reset + 基本 */
*{box-sizing:border-box;margin:0;padding:0}
html,body{
  height:100%;
  scroll-behavior: smooth; /* 升級：全域平滑捲動 */
}
/* 升級：自訂文字選取顏色，提升品牌質感 */
::selection { background: var(--accent); color: #07261f; }

body{
  font-family: "Noto Sans TC", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  background:linear-gradient(180deg,var(--bg), var(--bg-2) 60%);
  color:#eaf0e6; -webkit-font-smoothing:antialiased
}
a{color:var(--accent)}

/* 容器限制 */
.header-container{max-width:var(--max-width);margin:28px auto 8px;padding:0 20px}
.header-inner{display:flex;flex-direction:column;gap:10px;align-items:center;text-align:center}

/* 頭像 */
.avatar-wrap{display:flex;flex-direction:column;align-items:center;gap:8px;position:relative}
.avatar{width:132px;height:132px;border-radius:50%;object-fit:cover;border:none;box-shadow:0 10px 30px rgba(0,0,0,0.6);background:linear-gradient(180deg,var(--bg-2), #07261f)}

/* 標題群組 */
header.top h1{margin:12px 0 4px;font-size:64px;line-height:1.02;color:var(--accent);font-weight:900;text-shadow:0 4px 18px rgba(0,0,0,0.5)}
.titles{display:flex;flex-direction:column;gap:6px;align-items:center}
.titles .subtitle{margin:0;color:#f6f8f0;font-size:20px;font-weight:700}
.titles .note{margin:6px 0 0;color:var(--muted);font-size:14px}

/* 社群按鈕列 */
.socials-row{display:flex;gap:12px;margin-top:12px;justify-content:center;flex-wrap:wrap}
.social-link img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  transition: transform 0.2s ease;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3));
}
.social-link:hover img {
  transform: scale(1.1);
  filter: drop-shadow(0 6px 12px rgba(0,0,0,0.4));
}

/* 主要容器 */
.container{max-width:640px;margin:16px auto 48px;padding:32px 20px;border:2px solid var(--accent);border-radius:calc(var(--radius) + 2px);box-shadow:0 14px 46px rgba(0,0,0,0.55);}

/* 將原先中層樣式移到最內層 .step，並給予金色外框 */
.container > section{padding:0;border-radius:0;background:transparent;box-shadow:none;border:0;margin-bottom:16px;backdrop-filter:none;}

/* 可選：讓子容器在 hover 或聚焦時有金色微光（視覺強化） */
.container > section:hover{box-shadow:none}

.steps-indicator{display:flex;gap:4px;justify-content:space-between;margin-bottom:18px;align-items:flex-start;margin-top:22px; position: relative; z-index: 0;}
/* 新增：步驟連線效果 */
.steps-indicator::before {
  content: '';
  position: absolute;
  top: 23px; /* 圓點高度的一半 */
  left: 42px; /* 第一個圓點的中心 */
  right: 42px; /* 最後一個圓點的中心 */
  height: 2px;
  background: rgba(255,255,255,0.1);
  z-index: -1;
}
.step-item{display:flex;flex-direction:column;align-items:center;gap:6px;width:84px}
.step-label{font-size:12px;color:var(--muted);line-height:1.1;margin-top:4px;white-space:nowrap}
.step-item .step-dot{width:46px;height:46px;border-radius:50%;display:flex;align-items:center;justify-content:center;background:var(--glass);border:1px solid rgba(255,255,255,0.03);color:var(--muted)}
.step-item .step-dot.active{background:linear-gradient(180deg, rgba(185,212,106,0.12), rgba(185,212,106,0.06));color:#fff;box-shadow:0 6px 18px rgba(150,180,80,0.08);border:1px solid rgba(185,212,106,0.15)}
.step-item .step-dot.active + .step-label{color:var(--accent);font-weight:800}

.step{padding:18px;border-radius:12px;background:transparent;border:1px solid rgba(255,255,255,0.02);margin-bottom:16px}
.step h2{margin:0 0 12px;color:var(--accent);font-size:20px}
.editable-title-container{margin:0 0 12px}
.muted{color:var(--muted);font-size:14px}

input[type="text"], input[type="file"], textarea, input{width:100%;padding:12px;border-radius:10px;border:1px solid rgba(255,255,255,0.03);background:var(--panel);color:#eaf0e6}
label{display:block;margin:8px 0 6px;color:var(--muted)}
button{background:transparent;border:1px solid rgba(185,212,106,0.12);color:var(--accent);padding:10px 16px;border-radius:10px;cursor:pointer}
button:hover{background:rgba(185,212,106,0.04)}
/* 帳號輸入欄：初始有描邊、保留深色面板背景，輸入後文字改色但不反白 */
#accountInput, #lineInput{width:100%;padding:12px 16px;border-radius:12px;border:1px solid rgba(201,178,75,0.12);background:var(--panel);color:var(--muted);box-shadow:inset 0 4px 12px rgba(0,0,0,0.35);transition:box-shadow .14s, border-color .14s}
#accountInput::placeholder, #lineInput::placeholder{color:rgba(234,240,230,0.45)}
#accountInput:focus, #lineInput:focus{outline:none;border-color:var(--accent);box-shadow:0 10px 30px rgba(201,178,75,0.06)}
/* 當使用者已輸入（placeholder 消失）時，文字改為主色以突顯 */
#accountInput:not(:placeholder-shown), #lineInput:not(:placeholder-shown){color:var(--accent);font-weight:800}
/* 瀏覽器自動填入或 autofill 造成白底，強制覆寫成設計色 */
input#accountInput:-webkit-autofill,
input#accountInput:-webkit-autofill:hover,
input#accountInput:-webkit-autofill:focus,
input#accountInput:-internal-autofill-selected,
input#lineInput:-webkit-autofill,
input#lineInput:-webkit-autofill:hover,
input#lineInput:-webkit-autofill:focus,
input#lineInput:-internal-autofill-selected {
  -webkit-box-shadow: 0 0 0px 1000px var(--panel) inset !important;
  box-shadow: 0 0 0px 1000px var(--panel) inset !important;
  -webkit-text-fill-color: var(--accent) !important;
}
/* 另外強制在 focus/有值時保持背景 */
#accountInput:focus, #accountInput:not(:placeholder-shown), #lineInput:focus, #lineInput:not(:placeholder-shown){background:var(--panel);}
/* 強制描邊為金色（避免被瀏覽器或其他樣式覆蓋） */
#accountInput,
#accountInput:focus,
#accountInput:not(:placeholder-shown),
input#accountInput:-webkit-autofill,
input#accountInput:-webkit-autofill:focus,
input#accountInput:-webkit-autofill:hover,
input#accountInput:-internal-autofill-selected,
#lineInput,
#lineInput:focus,
#lineInput:not(:placeholder-shown),
input#lineInput:-webkit-autofill,
input#lineInput:-webkit-autofill:focus,
input#lineInput:-webkit-autofill:hover,
input#lineInput:-internal-autofill-selected {
  border:2px solid var(--accent) !important;
}

/* 確認帳號按鈕：拉長並置中，行動裝置 full-width、桌機限制 max-width，增加金色立體感 */
#accountSubmit{position: relative; overflow: hidden; display:block;width:100%;max-width:100%;margin:12px auto 20px;padding:12px 18px;border-radius:12px;border:1px solid rgba(201,178,75,0.14);background:linear-gradient(180deg,#f6e8b2 0%, #e6cf6a 45%, #c9b24b 100%);color:#07261f;font-weight:900;font-size:18px;text-align:center;box-shadow:none;transition:transform .12s ease, box-shadow .12s}
#accountSubmit:hover{box-shadow:none}
/* 升級：按鈕流光特效 (Shimmer Effect) */
#accountSubmit::after {
  content: ''; position: absolute; top: 0; left: -100%; width: 50%; height: 100%;
  background: linear-gradient(to right, transparent, rgba(255,255,255,0.6), transparent);
  transform: skewX(-25deg); animation: shimmer 3s infinite;
}
@keyframes shimmer {
  0% { left: -100%; }
  20%, 100% { left: 200%; }
}

/* 能量流光效果：集中在按鈕兩側，並帶有呼吸感 */
.activities .activity-btn.selected::before,
.activities .activity-btn.selected::after,
.options-group .activity-btn.selected::before,
.options-group .activity-btn.selected::after {
  content:"";
  position:absolute;
  top: -20%;
  height: 140%;
  width: 55%;
  pointer-events: none;
  animation: pulseGlow 3.5s ease-in-out infinite;
  filter: blur(20px);
}

.activities .activity-btn.selected::before,
.options-group .activity-btn.selected::before {
  left: -10%;
  background: radial-gradient(ellipse at left, rgba(255, 215, 0, 0.6) 0%, transparent 75%);
}

.activities .activity-btn.selected::after,
.options-group .activity-btn.selected::after {
  right: -10%;
  background: radial-gradient(ellipse at right, rgba(255, 215, 0, 0.6) 0%, transparent 75%);
}

/* 確認按鈕與抽獎紀錄之間要有間隔 */
#records{margin-top:22px;padding:20px;border-radius:12px;background:var(--panel);border:2px solid var(--accent);}

/* step2 控制列：左右兩按鈕各自拉伸 */
.step-controls{display:flex;gap:12px;margin-top:12px}
.step-controls .btn-prev, .step-controls .btn-next{flex:1;padding:12px 16px;border-radius:12px;border:1px solid rgba(255,255,255,0.04);cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:8px;font-weight:800;letter-spacing:0.2px;transition:transform .16s cubic-bezier(.2,.9,.2,1), box-shadow .16s, background .16s}

/* 上一步按鈕樣式 (整合後) */
.step-controls .btn-prev{
  background:linear-gradient(180deg, rgba(6,90,72,0.95), rgba(4,60,45,0.95));
  color:var(--accent);
  border:2px solid rgba(201,178,75,0.22);
  box-shadow:0 8px 28px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.02);
  text-shadow:0 1px 0 rgba(0,0,0,0.35);
}
.step-controls .btn-prev::before{content:"◀";font-size:14px;opacity:0.92}
.step-controls .btn-prev:hover{
  box-shadow:0 18px 44px rgba(0,0,0,0.6);
  background:linear-gradient(180deg, rgba(8,110,86,0.98), rgba(6,80,62,0.98));
}

.step-controls .btn-next{background:linear-gradient(180deg,#f6e8b2 0%, #e6cf6a 50%, #c9b24b 100%);color:#07261f;text-shadow:0 1px 0 rgba(255,255,255,0.2);box-shadow:0 10px 30px rgba(201,178,75,0.12), inset 0 -4px 10px rgba(255,255,255,0.06)}
.step-controls .btn-next::after{content:"▶";font-size:14px;opacity:0.96}
.step-controls .btn-next:hover{box-shadow:0 22px 48px rgba(201,178,75,0.18), inset 0 -6px 18px rgba(255,255,255,0.06)}

@media (max-width:600px){
  /* 行動裝置：左右並排，對稱各占一半；超窄螢幕才直列 */
  .step-controls{display:flex;flex-direction:row;gap:12px;align-items:center;width:100%;padding:0}
  .step-controls .btn-prev, .step-controls .btn-next{flex:1;padding:14px 16px;font-size:16px;border-radius:12px;min-height:48px;box-sizing:border-box;display:flex;justify-content:center;align-items:center}
  .step-controls .btn-prev{order:1}
  .step-controls .btn-next{order:2}
}

/* 超窄螢幕才直列（例如舊款小手機或超窄視窗） */
@media (max-width:380px){
  .step-controls{flex-direction:column;gap:10px}
  .step-controls .btn-prev, .step-controls .btn-next{flex:0 0 100%;width:100%}
}

/* 活動選擇按鈕（step2）- 使按鈕較大、字體放大並具選取狀態 */
.activities, .options-group, .games{width:100%}
.activities .activity-btn, .options-group .activity-btn, .games .activity-btn{position: relative; overflow: hidden; display:block;width:100%;padding:22px 18px;border-radius:12px;border:2px solid rgba(201,178,75,0.4);background:linear-gradient(180deg, rgba(255,255,255,0.01), rgba(0,0,0,0.02));color:#f0f6ea;font-size:20px;font-weight:800;text-align:center;cursor:pointer;min-height:72px;transition:box-shadow .12s ease, transform .12s ease;margin-bottom:6px}
.activities .activity-btn:hover, .options-group .activity-btn:hover, .games .activity-btn:hover{box-shadow:0 12px 34px rgba(201,178,75,0.06)}
.activities .activity-btn:active, .options-group .activity-btn:active, .games .activity-btn:active{transform:scale(0.98)}
.activities .activity-btn.selected, .options-group .activity-btn.selected, .games .activity-btn.selected{
  border-color:var(--accent);
  border-width:4px;
  box-shadow:0 0 20px rgba(201,178,75,0.2);
  /* 移植原本 game-name-glow 的字體特效 */
  background: linear-gradient(to right, var(--gold-dark) 0%, var(--gold-mid) 20%, #fff3c4 50%, var(--gold-mid) 80%, var(--gold-dark) 100%);
  background-size: 200% auto;
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: goldShine 3s linear infinite;
  font-weight: 900;
}

/* Custom Radio Button Styles */
.radio-label {
  display: flex !important; /* Override .activity-btn's display:block */
  align-items: center;
  justify-content: flex-start; /* Align items to the start */
  text-align: left; /* Override text-align:center from .activity-btn */
  position: relative;
  font-size: 15px;
  font-weight: 600;
}

.hidden-radio {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.custom-radio {
  flex-shrink: 0; /* Prevent shrinking */
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 2px solid rgba(201,178,75,0.6);
  border-radius: 50%;
  margin-right: 15px;
  transition: all 0.2s;
  position: relative;
}

.hidden-radio:checked + .custom-radio {
  border-color: var(--accent);
}

.custom-radio::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background-color: var(--accent);
  transition: transform 0.15s ease-in-out;
}

.hidden-radio:checked + .custom-radio::after {
  transform: translate(-50%, -50%) scale(1);
}

/* Verification Title Style */
.verification-title {
  text-align: center;
  color: var(--accent);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
}

/* Platform Registration Links (No button style, side-by-side) */
.platform-row {
  display: flex;
  justify-content: center;
  gap: 36px;
  flex-wrap: wrap;
}
.platform-link {
  animation: breathe 3s infinite ease-in-out;
}
.platform-link:hover { 
  animation: none;
  transform: scale(1.15); 
  transition: transform 0.3s ease;
}
.platform-link img { max-height: 60px; width: auto; object-fit: contain; display: block; border-radius: 12px; }

/* Collapsible content for sliding effect */
.collapsible-content {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  visibility: hidden;
  /* Closing: 極速淡出(0.1s)消除殘影，接著再縮小高度 */
  transition: 
    opacity 0.1s ease-out,
    visibility 0.1s linear,
    max-height 0.4s cubic-bezier(0, 0, 0.2, 1),
    margin 0.4s cubic-bezier(0, 0, 0.2, 1);
}

.collapsible-content.expanded {
  max-height: 1200px; /* 縮減最大高度以減少關閉時的延遲感 */
  opacity: 1;
  visibility: visible;
  /* Opening: 先展開高度，稍微延遲後再淡入內容 */
  transition: 
    max-height 0.5s ease-in-out,
    margin 0.5s ease-in-out,
    opacity 0.3s ease-in 0.15s,
    visibility 0s linear;
}

/* Fix: Ensure margin collapses completely for sections */
.container > section.collapsible-content { margin-bottom: 0; }
.container > section.collapsible-content.expanded { margin-bottom: 16px; }

.result-text{font-size:20px;color:#fff;padding:12px}

/* 抽獎結果標題：金色漸層與發光效果，避免換行 */
.result-title{
  font-size:2em;
  margin:0 0 10px;
  white-space:nowrap;
  display:inline-block;
  padding:0 6px;
}

/* 只套用在文字（不影響 emoji） */
.result-title-text{
  display:inline-block;
  background:linear-gradient(90deg, var(--gold-light) 0%, #fff3b0 40%, var(--gold-mid) 100%);
  -webkit-background-clip:text;
  background-clip:text;
  color:transparent;
  text-shadow:0 3px 10px rgba(227,200,106,0.35), 0 8px 28px rgba(181,155,59,0.12);
  filter:drop-shadow(0 10px 24px rgba(181,155,59,0.12));
  vertical-align: middle;
  transform: translateY(-2px); /* 微調：視字體情況，若覺得還不夠置中可加這行 */
}

.result-title .emoji{ /* 保留 emoji 的原始顏色與大小 */
  display:inline-block;
  vertical-align:middle;
}

/* 針對拉霸機 (gameId=1) 的結果文字，移除金色特效 (避免 Emoji 顯示異常) */
#gameResultArea[data-game-id="1"] .result-title-text {
  background: none;
  -webkit-background-clip: border-box;
  background-clip: border-box;
  color: #fff;
  text-shadow: 0 2px 5px rgba(0,0,0,0.5);
  filter: none;
}

/* 中獎金額樣式 (中國風雲霧邊框) */
.result-amount {
  position: relative;
  display: inline-block;
  margin-top: 16px;
  padding: 15px 30px;
  background-color: #fff4dc;
  border: 4px solid #e39b2d;
  border-radius: 12px;
  color: #8b6b2f;
  font-family: "DFKai-SB",  "BiauKai", "KaiTi", "STKaiti", "Noto Serif TC", "PingFang TC", "Heiti TC", system-ui, serif;  font-size: 24px;
  font-weight: bold;
  white-space: nowrap;
  text-align: center;
  box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}

/* 外層雙線框 (模擬卷雲邊框感) */
.result-amount::after {
  content: "";
  position: absolute;
  inset: -10px;
  border: 2px solid #e39b2d;
  border-radius: 20px;
  pointer-events: none;
  box-shadow: 0 0 15px rgba(227, 155, 45, 0.2);
}

.result-amount span {
  position: relative;
  z-index: 1;
}

.result-amount strong {
  color: #c0392b;
  font-weight: 900;
  margin: 0 4px;
}

/* 抽獎紀錄卡 */
.plays-list .play-record{padding:10px;border-radius:10px;background:rgba(0,0,0,0.06);margin-bottom:8px}

/* 小螢幕響應式 */
@media (max-width:900px){
  .header-inner{flex-direction:column;align-items:center}
  .socials-row{margin-left:0}
  .header-container{padding:0 16px}
  .steps-wrapper{padding:22px 18px;margin:14px}

  /* 只針對特定元件略窄並置中（避免廣泛覆蓋） */
  #accountInput,
  #accountSubmit,
  #records,
  .activities .activity-btn,
  .options-group .activity-btn,
  .step{
    max-width:520px;
    margin-left:auto;
    margin-right:auto;
    width:100%;
    box-sizing:border-box;
  }
}
@media (max-width:600px){
  .avatar{width:96px;height:96px}
  header.top h1{font-size:34px}
  .titles .subtitle{font-size:20px}
  .steps-indicator{gap:8px}
  .container{margin:12px;padding:0 12px}
}

/* 小提示文字 */
.muted.now{background:rgba(0,0,0,0.08);padding:10px;border-radius:8px;margin-bottom:8px}

/* 頁腳樣式 */
.site-footer{text-align:center;padding:24px 0 36px;color:var(--muted);font-size:14px;opacity:0.8}

/* 新增：說明卡片樣式 (從 HTML inline style 提取) */
.info-card { border:1px solid rgba(166,184,120,0.25); padding:14px; border-radius:10px; background:linear-gradient(180deg,rgba(0,0,0,0.02),rgba(0,0,0,0.04)); margin:12px 0; color:#eaf3d6; text-align: center; font-family: "Noto Sans TC", "Segoe UI Emoji", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; font-variant-numeric: lining-nums; }
.info-card h3 { margin:0 0 8px; color:#f0e7a8; font-size:1.05em; }
.info-card .desc { font-size:0.95em; color:#dfe8c0; white-space: pre-wrap; word-break: break-word; line-height: 1.6; }

/* Step 5 標題置中 */
#step5InfoTitle { text-align: center; }

/* 新增：個別元件微調 */
.StepNote { margin-top: 12px; }
#verificationStep { margin-bottom: 24px; }

@keyframes pulseGlow {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.9; }
}

@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

/* Step 4 Upload Area */
.upload-area {
  position: relative;
  width: 100%;
  height: 240px;
  border: 2px dashed rgba(201,178,75,0.4);
  border-radius: 12px;
  background: rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: border-color 0.2s, background 0.2s;
  cursor: pointer;
}
.upload-area:hover { border-color: var(--accent); background: rgba(201,178,75,0.05); }
.file-input { position: absolute; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 2; }
.upload-placeholder { display: flex; flex-direction: column; align-items: center; color: var(--muted); pointer-events: none; transition: opacity 0.2s; }
.upload-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.7; }
.upload-text { font-size: 16px; font-weight: 600; }
.upload-preview {
  position: absolute; width: 100%; height: 100%; object-fit: contain; z-index: 1;
  background: rgba(0,0,0,0.2); backdrop-filter: blur(5px);
}

/* --- 遊戲互動介面樣式 --- */
#activeGameArea {
  margin: 50px 0; /* 增加與上方 info-card 的距離 */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.game-ui {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
.game-action-btn {
  background: linear-gradient(180deg, #f6e8b2 0%, #c9b24b 100%);
  color: #07261f;
  font-weight: 900;
  font-size: 18px;
  padding: 12px 32px;
  border: none;
  border-radius: 50px;
  box-shadow: 0 6px 20px rgba(201,178,75,0.3);
  cursor: pointer;
  transition: transform 0.1s;
}
.game-action-btn:active { transform: scale(0.95); }
.game-action-btn:disabled { opacity: 0.6; cursor: not-allowed; filter: grayscale(1); }

/* 1. 拉霸機樣式 (純CSS立體化) */
.slot-machine {
  /* 機身金屬質感背景 */
  background: linear-gradient(to bottom, #2a2a2a 0%, #111 100%);
  padding: 15px; /* 縮小內距 */
  border-radius: 20px 20px 10px 10px;
  
  /* 複雜的邊框模擬立體外殼 */
  border: none;
  box-shadow: 
    /* 內發光 */
    inset 0 1px 0 rgba(255,255,255,0.15),
    /* 機身層次 */
    0 0 0 4px #000,
    0 0 0 8px #333,
    0 0 0 10px #000,
    /* 金屬外框 */
    0 0 0 14px var(--gold-dark),
    0 0 0 16px var(--gold-light),
    0 0 0 18px var(--gold-dark),
    /* 投影 */
    0 20px 50px rgba(0,0,0,0.8);
    
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  margin: 20px auto 0; /* 優化：縮小上方間距，讓畫面更緊湊 */
  max-width: 380px; /* 限制最大寬度，讓整體縮小 */
  box-sizing: border-box;
}

/* 拉霸機提示文字 */
.slot-machine::before {
  content: "👇 請點擊拉桿啟動 👇";
  position: absolute;
  top: -60px; /* 往上移，增加與機台的距離 */
  left: 0;
  width: 100%;
  text-align: center;
  color: var(--gold-light);
  font-size: 18px;
  font-weight: 800;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
  animation: breathe 2s infinite ease-in-out;
  pointer-events: none;
}

/* 底座 */
.slot-machine::after {
  content: '';
  position: absolute;
  bottom: -24px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  height: 24px;
  background: linear-gradient(to bottom, #333, #111);
  border-radius: 0 0 15px 15px;
  z-index: -1;
  box-shadow: 0 10px 20px rgba(0,0,0,0.6);
  border: 2px solid #000;
  border-top: none;
}
.slot-title {
  background: #000;
  color: #ffd700;
  padding: 8px 24px;
  border-radius: 50px;
  border: 2px solid #b8860b;
  font-weight: 900;
  font-size: 20px; /* 縮小標題字體 */
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.2), inset 0 0 10px rgba(0,0,0,0.8);
  margin-bottom: 5px;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.slot-window {
  display: flex;
  gap: 10px;
  background: #000;
  padding: 15px;
  border-radius: 8px;
  height: 180px; /* 加大視窗高度 (上下更寬) */
  position: relative;
  box-shadow: inset 0 0 30px rgba(0,0,0,1);
  border: 4px solid #333;
  border-bottom-color: #444; /* 下緣反光 */
}
/* 滾輪光影遮罩：模擬圓柱體反光 */
.slot-overlay {
  position: absolute; top:0; left:0; width:100%; height:100%; z-index: 5; pointer-events: none;
  background: linear-gradient(180deg, 
    rgba(0,0,0,0.9) 0%, 
    rgba(0,0,0,0.5) 15%, 
    rgba(255,255,255,0.05) 40%, 
    rgba(255,255,255,0.0) 50%, 
    rgba(0,0,0,0.5) 85%, 
    rgba(0,0,0,0.9) 100%);
  box-shadow: inset 0 0 15px rgba(0,0,0,0.8);
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.05);
}
.slot-reel {
  width: 60px;
  font-size: 38px; /* 縮小符號字體 */
  text-align: center;
  line-height: 150px; /* 配合視窗高度調整 (讓符號置中) */
  display: flex;
  flex-direction: column;
  /* 圓柱體立體感 */
  background: linear-gradient(to right, #ccc 0%, #fff 40%, #fff 60%, #ccc 100%);
  box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
  border-radius: 4px;
  filter: blur(0px); /* 預設無模糊 */
  /* 動畫控制 */
  transition: transform 3s cubic-bezier(0.1, 0.9, 0.2, 1), filter 0.3s; 
}
/* 新增：轉動時的動態模糊效果 */
.slot-reel.blur-reel {
  filter: blur(4px);
}

/* 拉霸機大獎 7 的特殊樣式 */
.slot-7 {
  color: #e60000;
  font-family: "Arial Black", "Impact", sans-serif;
  font-weight: 900;
  text-shadow: 
    2px 2px 0px #550000, 
    -1px -1px 0px #ff5555,
    0 0 10px rgba(255, 0, 0, 0.4);
  font-size: 1.1em;
  display: inline-block;
  vertical-align: middle;
}

/* 拉桿 */
.slot-lever-base { position: absolute; right: -25px; top: 50%; width: 18px; height: 50px; background: linear-gradient(90deg, #444, #222); border-radius: 0 8px 8px 0; border: 2px solid #111; border-left: none; cursor: pointer; z-index: 10; }
.slot-lever { width: 12px; height: 80px; background: linear-gradient(90deg, #ccc, #999); position: absolute; bottom: 10px; left: 4px; transform-origin: bottom center; transition: transform 0.3s; border-radius: 5px; box-shadow: 2px 2px 5px rgba(0,0,0,0.5); }
.slot-knob { 
  width: 32px; 
  height: 32px; 
  background: radial-gradient(circle at 30% 30%, #ff4d4d, #990000); 
  border-radius: 50%; position: absolute; top: -15px; left: -10px; 
  box-shadow: 0 4px 6px rgba(0,0,0,0.4); }
.slot-lever.pulled { transform: rotateX(70deg); }

/* 2. 輪盤樣式 */
.roulette-container {
  position: relative;
  width: 280px;
  height: 280px;
  margin: 20px auto 0; /* 優化：縮小上方間距 */
}

/* 輪盤提示文字 */
.roulette-container::before {
  content: "👇 請點擊中間按鈕啟動 👇";
  position: absolute;
  top: -60px; /* 往上移，增加與輪盤的距離 */
  left: 0;
  width: 100%;
  text-align: center;
  color: var(--gold-light);
  font-size: 18px;
  font-weight: 800;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
  animation: breathe 2s infinite ease-in-out;
  pointer-events: none;
}

.roulette-outer-rim {
  width: 100%; height: 100%;
  border-radius: 50%;
  background: conic-gradient(from 45deg, #8b6c42, #f6e8b2, #b8860b, #f6e8b2, #8b6c42); /* 金屬光澤 */
  padding: 15px;
  box-shadow: 
    0 20px 50px rgba(0,0,0,0.8), 
    inset 0 2px 3px rgba(255,255,255,0.4), 
    inset 0 -2px 3px rgba(0,0,0,0.4);
  border: 1px solid #5e4b15;
  position: relative;
}
.roulette-wheel {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 5px solid #333;
  /* JS 動態設定背景 */
  transition: transform 4s cubic-bezier(0.2, 0.8, 0.1, 1);
  position: relative;
  box-shadow: inset 0 0 30px rgba(0,0,0,0.8);
  overflow: hidden;
}
.roulette-center-knob {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 60px; height: 60px;
  background: radial-gradient(circle at 30% 30%, #fff0c4, #c9b24b, #8a6d3b);
  border-radius: 50%;
  box-shadow: 0 5px 15px rgba(0,0,0,0.6), inset 0 0 5px rgba(255,255,255,0.5);
  z-index: 5;
  border: 3px solid #5e4b15;
  cursor: pointer;
  transition: transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.roulette-center-knob:active {
  transform: translate(-50%, -50%) scale(0.95);
  box-shadow: 0 2px 8px rgba(0,0,0,0.6);
}
/* 增加 GO 文字 */
.roulette-center-knob::after {
  content: "GO";
  font-weight: 900;
  color: #423108;
  font-size: 18px;
  text-shadow: 0 1px 0 rgba(255,255,255,0.4);
}
.roulette-pointer {
  position: absolute;
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 28px solid #e74c3c; /* 紅色指針 */
  z-index: 10;
  filter: drop-shadow(0 4px 2px rgba(0,0,0,0.4));
}

/* 輪盤內的文字標籤 */
.roulette-label {
  position: absolute;
  top: 0;
  left: 50%;
  width: 40px;
  margin-left: -20px;
  height: 50%; /* 半徑 */
  transform-origin: bottom center;
  text-align: center;
  padding-top: 15px; /* 距離邊緣的距離 */
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.9);
  font-size: 16px;
  pointer-events: none;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  z-index: 2;
}

/* 隱藏舊按鈕 */
#rouletteStartBtn {
  display: none !important;
}


/* 3. 寶箱動畫樣式 */
.box-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px; /* 加入間距 */
  padding: 0;
  min-height: 130px; /* 給予一個最小高度 */
  flex-wrap: wrap; /* 在小螢幕上換行 */
}

/* 當容器內有寶箱時，顯示提示文字 */
.box-container:has(.treasure-chest-instance)::before {
  content: "👇 請點擊選擇一個寶箱 👇";
  width: 100%; /* 強制佔滿一行，讓寶箱換行到下方 */
  text-align: center;
  color: var(--gold-light);
  font-size: 18px;
  font-weight: 800;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
  animation: breathe 2s infinite ease-in-out; /* 使用現有的呼吸動畫 */
}

/* 當已有抽獎結果時，隱藏提示文字 (寶箱/拉霸/輪盤) - 遊戲進行中的隱藏由 .playing 控制 */
body:has(.result-title) .box-container::before,
body:has(#gameResultText:not(:empty)) .box-container::before,
body:has(.result-title) .slot-machine::before,
body:has(#gameResultText:not(:empty)) .slot-machine::before,
body:has(.result-title) .roulette-container::before,
body:has(#gameResultText:not(:empty)) .roulette-container::before {
  display: none !important;
}

/* 當整個遊戲區塊處於 playing 狀態時，統一隱藏各遊戲的提示文字（最小改動） */
#activeGameArea.playing .slot-machine::before,
#activeGameArea.playing .roulette-container::before,
#activeGameArea.playing .box-container::before {
  display: none !important;
}

.treasure-chest-instance {
  width: 100px; /* 縮小寶箱尺寸 */
  height: auto;
  cursor: pointer;
  transform-origin: center bottom; /* 讓搖動看起來更自然 */
  transition: opacity 0.5s; /* 為了點擊後淡化效果 */
}

.shake-2d {
  animation: shake-2d 0.82s cubic-bezier(.36,.07,.19,.97) both infinite;
}

@keyframes shake-2d {
  10%, 90% {
    transform: translate3d(-1px, 0, 0);
  }
  20%, 80% {
    transform: translate3d(2px, 0, 0);
  }
  30%, 50%, 70% {
    transform: translate3d(-4px, 0, 0);
  }
  40%, 60% {
    transform: translate3d(4px, 0, 0);
  }
}

/* 彩帶特效 */
.confetti {
  position: fixed;
  width: 8px;
  height: 8px;
  z-index: 9999;
  pointer-events: none;
  border-radius: 2px;
}

@keyframes goldShine {
  to {
    background-position: 200% center;
  }
}

/* 全域 Loading 遮罩 */
.global-loading {
  position: fixed; top:0; left:0; width:100%; height:100%;
  background: rgba(0,0,0,0.6); z-index: 9999;
  display: flex; justify-content: center; align-items: center;
  color: #fff; font-size: 20px; font-weight: bold;
  backdrop-filter: blur(4px);
}
