
*{box-sizing:border-box;margin:0;padding:0}

/* 全局優化 - 減少安卓設備閃爍 */
html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body,html{
width:100%;
min-height: 100vh;
overflow-x:hidden;
overflow-y:auto;
overscroll-behavior:none;
background:#2f0a3e;
font-family:-apple-system,sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-transform: translateZ(0);
transform: translateZ(0)
}

body.scrollable {
    overflow-y: auto;
    overscroll-behavior:auto;
}



.stage{
width:100%;
min-height:100vh;
min-height:100dvh;
position:relative;
overflow-x:hidden;
background:url('../image/bg2.webp') no-repeat center top/cover;
perspective: 800px;
z-index:10;
}
.stage.menu-open {
    box-shadow: -6px 0 40px rgba(0,0,0,0.6), -2px 0 20px rgba(0,0,0,0.3);
}
.stage.menu-open .hamburger-btn {
    display: none;
}

@media (orientation: landscape) and (min-width: 768px) {
    .stage {
        background-size: auto 100%;
    }
}

/* ============================= */
/* 背景循環動畫 */
/* ============================= */

.dynamic-background{
position:absolute;
top:0;
left:0;
width:100%;
height:100%;
z-index:0;
transition:opacity 2s ease;
-webkit-transform: translateZ(0);
transform: translateZ(0);
-webkit-backface-visibility: hidden;
backface-visibility: hidden
}

.slide{
position:absolute;
top:0;
left:0;
width:100%;
height:100%;
opacity:0;
background:no-repeat center top/cover;
background-size:cover;

animation-duration:32s;
animation-iteration-count:infinite;
animation-timing-function:linear;

-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
-webkit-perspective: 1000px
}

@media (orientation: landscape) and (min-width: 768px) {
    .slide {
        background-size: auto 100%;
    }
}

.slide:nth-child(1){background-image:url('../image/000.webp');animation-name:anim-1}
.slide:nth-child(2){background-image:url('../image/001.webp');animation-name:anim-2}
.slide:nth-child(3){background-image:url('../image/002.webp');animation-name:anim-3}
.slide:nth-child(4){background-image:url('../image/003.webp');animation-name:anim-4}
.slide:nth-child(5){background-image:url('../image/004.webp');animation-name:anim-5}
.slide:nth-child(6){background-image:url('../image/003.webp');animation-name:anim-6}
.slide:nth-child(7){background-image:url('../image/002.webp');animation-name:anim-7}
.slide:nth-child(8){background-image:url('../image/001.webp');animation-name:anim-8}

@keyframes anim-1{0%,7%{opacity:1}12.5%,93%{opacity:0}100%{opacity:1}}
@keyframes anim-2{0%,5.5%{opacity:0}12.5%,19.5%{opacity:1}25%,100%{opacity:0}}
@keyframes anim-3{0%,18%{opacity:0}25%,32%{opacity:1}37.5%,100%{opacity:0}}
@keyframes anim-4{0%,30.5%{opacity:0}37.5%,44.5%{opacity:1}50%,100%{opacity:0}}
@keyframes anim-5{0%,43%{opacity:0}50%,57%{opacity:1}62.5%,100%{opacity:0}}
@keyframes anim-6{0%,55.5%{opacity:0}62.5%,69.5%{opacity:1}75%,100%{opacity:0}}
@keyframes anim-7{0%,68%{opacity:0}75%,82%{opacity:1}87.5%,100%{opacity:0}}
@keyframes anim-8{0%,80.5%{opacity:0}87.5%,94.5%{opacity:1}100%{opacity:0}}

/* ============================= */
/* UI Overlay */
/* ============================= */

.ui-overlay{
position:absolute;
top:0;
left:0;
width:100%;
height:100%;
z-index:10
}

/* ============================= */
/* STEP1 UI */
/* ============================= */

#step1-ui{
width:100%;
height:100%;
display:flex;
flex-direction:column;
justify-content:flex-end;
align-items:center;
padding-bottom:8dvh;
transition:opacity 1.5s ease
}

.button-composite{
width:75vw;
max-width:300px;
display:flex;
flex-direction:column;
align-items:center;
gap:10px;
position: relative;
transform-origin: bottom center;
}

/* 根据屏幕高度动态缩放：高屏幕不缩放，矮屏幕等比缩小 */
@media (max-height: 700px) {
    .button-composite { transform: scale(0.9); }
}
@media (max-height: 600px) {
    .button-composite { transform: scale(0.82); }
}
@media (max-height: 500px) {
    .button-composite { transform: scale(0.75); }
}

.button-composite>img:first-child{
width:80%;
height:auto;
}

.image-button-wrapper{
width:100%;
cursor:pointer;
position:relative;
overflow:hidden;
border-radius:50px;
animation:pulseScale 3s infinite ease-in-out
}

.image-button-wrapper::after{
content:"";
position:absolute;
top:0;
left:-150%;
width:100%;
height:100%;
background:linear-gradient(90deg,transparent,rgba(255,255,255,0.4),transparent);
transform:skewX(-25deg);
animation:sweep 3s infinite ease-in-out
}

/* 三個按鍵的等邊三角形佈局 */
.buttons-container {
    width: 100%;
    margin-top: 10px;
    position: relative;
    height: 180px; /* 增加容器高度，使btn1離上面更遠 */
}

.image-button {
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    position: absolute;
    width: 40%; /* 確保三個按鈕大小相同 */
}

/* 等邊三角形佈局 */
#btn1 {
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
}

#btn2 {
    top: 10%;
    left: 15%;
    transform: translateX(-50%);
}

#btn3 {
    top: 10%;
    right: 15%;
    transform: translateX(50%);
}

.image-button:hover {
    transform: translate(-50%, -2px); /* 保持水平居中，只改變垂直位置 */
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

.image-button:active {
    transform: translate(-50%, 0); /* 保持水平居中，恢復垂直位置 */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* 爲btn3單獨調整懸停效果，因爲它的transform是translateX(50%) */
#btn3:hover {
    transform: translate(50%, -2px);
}

#btn3:active {
    transform: translate(50%, 0);
}

.image-button img {
    width: 100%;
    height: auto;
    display: block;
}

/* ============================= */
/* STEP2 UI */
/* ============================= */

#step2-ui{
display:block;
position:absolute;
top:0;left:0;
width:100%;height:100%;
opacity:1;
transition:opacity 2s ease;
}

.smoke-text-container{
position:absolute;
top:18%;
left:50%;
transform:translate(-50%,-50%);
width:85%;
display:flex;
flex-direction:column;
align-items:center;
gap:12px;
z-index:20
}

/* 響應式調整：當屏幕高度小於600px時，文字容器上移 */
@media (max-height: 600px) {
    .smoke-text-container {
        top: 25%;
    }
}

/* 當屏幕高度小於500px時，文字容器進一步上移 */
@media (max-height: 500px) {
    .smoke-text-container {
        top: 20%;
    }
}

.smoke-line{
color:#ffffff;
font-size:1.2rem;
font-weight:bold;
letter-spacing:.15rem;
text-align:center;
text-shadow:0 0 10px rgba(191,149,255,.6);
opacity:0;
transform:translateY(10px);
transition:all 2.5s ease;
white-space:nowrap
}

body.en-lang .smoke-line {
    font-size: 1rem;
    letter-spacing: .05rem;
}

.line-active{
opacity:1;
transform:translateY(0)
}

.evolution-image{
position:absolute;
bottom:0;
left:50%;
transform:translateX(-50%);
width:100vw;
max-width:500px;
opacity:0;
transition:opacity 1s ease
}

/* ── 水韵按钮（替换原 shimmer-btn） ── */
.water-btn {
    position: absolute;
    top: 48%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 170px;
    height: 170px;
    border-radius: 50%;
    cursor: pointer;
    outline: none;
    z-index: 150;
    background: rgba(8, 18, 38, 0.06);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.04);
    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.03),
        0 8px 32px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: opacity 1.4s ease;
    pointer-events: none;
}

.water-btn.show {
    opacity: 1;
    pointer-events: all;
}

.water-btn:hover {
    background: rgba(12, 28, 55, 0.15);
    box-shadow:
        inset 0 1px 2px rgba(255, 255, 255, 0.06),
        0 8px 40px rgba(0, 0, 0, 0.3);
}

/* 点击后原地淡出（不改变位置/大小） */
.water-btn.exit {
    opacity: 0 !important;
    transform: translate(-50%, -50%) !important;
    transition: opacity 1.2s ease !important;
    pointer-events: none !important;
}

/* 边缘羽化层 */
.water-btn::before {
    content: '';
    position: absolute;
    inset: -18px;
    border-radius: 50%;
    background: radial-gradient(ellipse at 30% 25%, 
        rgba(100, 170, 220, 0.12) 0%,
        rgba(60, 120, 180, 0.04) 40%,
        transparent 70%);
    filter: blur(12px);
    pointer-events: none;
    z-index: 0;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.water-btn:hover::before {
    opacity: 1;
    background: radial-gradient(ellipse at 30% 25%, 
        rgba(130, 190, 240, 0.18) 0%,
        rgba(80, 140, 200, 0.06) 40%,
        transparent 70%);
}

.glass-ring {
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
    background: radial-gradient(ellipse at 30% 25%, 
        rgba(180, 220, 250, 0.04) 0%, 
        rgba(120, 180, 230, 0.01) 40%,
        transparent 80%);
    filter: blur(6px);
    opacity: 0.5;
    transition: opacity 0.3s ease;
}
.water-btn:hover .glass-ring { opacity: 0.7; }

.highlight-arc {
    position: absolute;
    top: 8%;
    left: 18%;
    width: 32%;
    height: 22%;
    border-radius: 50%;
    pointer-events: none;
    z-index: 5;
    transform: rotate(-15deg);
    background: radial-gradient(ellipse at center,
        rgba(255, 255, 250, 0.22) 0%,
        rgba(255, 255, 245, 0.06) 35%,
        rgba(255, 255, 240, 0.01) 70%,
        transparent 100%);
    filter: blur(2px);
    transition: all 0.4s ease;
}
.water-btn:hover .highlight-arc {
    background: radial-gradient(ellipse at center,
        rgba(255, 255, 250, 0.32) 0%,
        rgba(255, 255, 245, 0.10) 35%,
        rgba(255, 255, 240, 0.02) 70%,
        transparent 100%);
    width: 34%;
    top: 6%;
    left: 16%;
}

.btn-text {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 6;
    pointer-events: none;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6), 0 0 10px rgba(0, 0, 0, 0.4);
    transition: all 0.4s ease;
    gap: 2px;
}
.btn-line {
    display: block;
    white-space: nowrap;
}
.water-btn:hover .btn-text {
    color: #ffffff;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7), 0 0 14px rgba(0, 0, 0, 0.5);
    letter-spacing: 0.13em;
}
.water-btn:active .btn-text {
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7), 0 0 20px rgba(0, 0, 0, 0.6);
}

.btn-water-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    z-index: 2;
    pointer-events: none;
    opacity: 0.4;
    transition: opacity 0.4s ease;
}
.water-btn:hover .btn-water-canvas {
    opacity: 0.6;
}

.ripple-dot {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 250, 240, 0.7);
    pointer-events: none;
    z-index: 7;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0);
}
.ripple-dot.flash {
    animation: dotPulse 0.7s ease-out forwards;
}

@keyframes dotPulse {
    0% { opacity: 0.6; transform: translate(-50%, -50%) scale(0.2); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(3.5); }
}

/* 背景涟漪 Canvas */
.step2-bg-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1s ease;
}

.step2-bg-canvas.show {
    opacity: 1;
}

@media (max-width: 560px) {
    .water-btn { width: 120px; height: 120px; top: 42%; }
    .btn-text { font-size: 0.85rem; letter-spacing: 0.06em; }
    .btn-line { white-space: normal; }
}
@media (max-width: 400px) {
    .water-btn { width: 100px; height: 100px; }
    .btn-text { font-size: 0.75rem; }
}

/* ============================= */
/* STEP3 UI */
/* ============================= */

#step3-ui{
display:none;
position:absolute;
top:0;
left:0;
width:100%;
height:100%;
opacity:0;
transition:opacity 2s ease
}

.universe-bg{
position:absolute;
top:0;
left:0;
width:100%;
height:100%;
z-index:5;
overflow:hidden;
pointer-events:none
}

.nebula{
position:absolute;
width:200%;
height:200%;
top:-50%;
left:-50%;
background:radial-gradient(circle at 50% 50%, rgba(191,149,255,.15) 0%, transparent 60%);
filter:blur(60px);
animation:nebulaRotate 80s infinite linear
}


@keyframes nebulaRotate{
0%{transform:rotate(0deg)}
100%{transform:rotate(360deg)}
}

.card-container { 
position: absolute; 
top: 55%; 
left: 50%;
 transform: 
 translate(-50%, -50%); 
 width: 60px; 
 display: flex; 
 flex-direction: column; 
 align-items: center;
 opacity: 0; 
 transition: opacity 2s ease; 
 z-index: 30; }
        
.timer-svg-wrapper { 
position: absolute; 
top: 50%; left: 50%; 
transform: translate(-50%, -50%) rotate(-90deg);
 width: 360px; height: 360px; 
 pointer-events: none; z-index: 31; 
 opacity: 0; transition: opacity 2s ease; }
       
.timer-circle-bg { 
fill: none; 
stroke: rgba(255, 255, 255, 0.05); 
stroke-width: 2; }
        
.timer-circle-bar { 
fill: none; 
stroke: rgba(191, 149, 255, 0.6); 
stroke-width: 2; 
stroke-linecap: round; 
stroke-dasharray: 283; 
stroke-dashoffset: 283; 
filter: drop-shadow(0 0 5px rgba(191, 149, 255, 0.5)); }
        
.timer-run { 
animation: timerAnimate 10s linear forwards; }
        
@keyframes timerAnimate { to { stroke-dashoffset: 0; } }

.tarot-card { 
width: 100%;
height: auto; 
display: block; 
z-index: 32; 
animation: floatCard 4s infinite ease-in-out; }

.card-shadow { 
width: 40px; 
height: 8px; 
background: rgba(0, 0, 0, 1); 
border-radius: 50%; 
margin-top: 10px; 
filter: blur(4px); 
animation: shadowScale 4s infinite ease-in-out; }

@keyframes floatCard { 
0%, 100% { transform: translateY(0); } 50% { transform: translateY(-20px); } }
        
@keyframes shadowScale { 
0%, 100% { transform: scale(1); opacity: 0.9; } 50% { transform: scale(0.7); opacity: 0.4; } }

.fog-exit { 
animation: fogDissolve 2.5s forwards ease-out !important; }

@keyframes fogDissolve { 
0% { transform: translate(-50%, -50%) scale(1); 
opacity: 1; filter: blur(0px); 
} 100% { transform: translate(-50%, -50%) scale(2); 
opacity: 0; filter: blur(20px); } }


/* 【優化1】：添加 will-change 開啓卡牌和星星的硬件加速 */

.scatter-card {
touch-action: manipulation;
pointer-events: auto;
position: absolute;
width: 65px; 
height: auto;
z-index: 30000;
pointer-events: none;
transition: all 4.5s cubic-bezier(0.2, 0, 0.2, 1), opacity 1.5s ease;
opacity: 0;
display: block;
transform-origin: 50% 30%;
transform-style: preserve-3d;
will-change: transform; 
}

.scatter-card::after {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: linear-gradient(135deg, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.1) 50%, rgba(255,255,255,0.05) 100%);
box-shadow: 1px 1px 2px rgba(0,0,0,0.3);
border-radius: 3px;
pointer-events: none;
z-index: -1;
}

.scatter-card.shuffling {
	transition: transform 0.4s cubic-bezier(0.1, 0.8, 0.3, 1), 
				left 0.4s cubic-bezier(0.1, 0.8, 0.3, 1), 
				top 0.4s cubic-bezier(0.1, 0.8, 0.3, 1) !important;
}

.no-float { 
animation: none !important; }

.no-shadow { 
display: none !important; 
opacity: 0 !important; }

.p1-dissolve { 
opacity: 0 !important; 
pointer-events: none; }

@keyframes sweep{
0%{left:-150%}
30%{left:150%}
100%{left:150%}
}

@keyframes pulseScale{
0%,100%{transform:scale(1)}
50%{transform:scale(1.04)}
}

@keyframes softGlow{
0%{box-shadow:0 4px 15px rgba(255,255,255,.4)}
100%{box-shadow:0 4px 20px rgba(255,255,255,.6)}
}

.shuffle-progress-container {
	position: absolute;
	left: 50%;
	bottom: 65%;
	transform: translateX(-50%);
	width: 60%;
	height: 4px;
	background: rgba(255, 255, 255, 0.1);
	border-radius: 10px;
	overflow: hidden;
	backdrop-filter: blur(5px);
	border: 1px solid rgba(255, 255, 255, 0.05);
	opacity: 0;
	transition: opacity 1s ease, transform 1s ease;
	z-index: 200;
}

.progress-fade-out {
	opacity: 0 !important;
	transform: translateX(-50%) translateY(20px) !important;
	filter: blur(8px);
	pointer-events: none;
}

#shuffle-progress-bar {
	width: 0%;
	height: 100%;
	background: linear-gradient(90deg, rgba(191, 149, 255, 0.2), rgba(191, 149, 255, 0.8));
	box-shadow: 0 0 10px rgba(191, 149, 255, 0.5);
	transition: width 0.3s ease-out;
}

.fog-disperse {
	opacity: 0 !important;
	transform: translateY(-50px) scale(1.2) !important;
	filter: blur(10px);
	transition: all 1.5s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.card-stack-glow {
	animation: glowFadeIn 2.5s forwards ease-out !important;
}
@keyframes glowFadeIn {
	from { box-shadow: 0 0 0px rgba(191, 149, 255, 0); }
	to { box-shadow: 0 0 30px rgba(191, 149, 255, 0.4); }
}

.is-selected {
	box-shadow: 0 0 20px rgba(191, 149, 255, 0.6);
}

.magic-circle-container {
	position: absolute;
	top: 85%; 
	left: 50%;
	transform: translate(-50%, -50%) scale(1.2); 
	width: 600px; 
	height: 600px;
	pointer-events: none;
	z-index: 5;
	opacity: 0;
	display: flex;
	justify-content: center;
	align-items: center;
	transition: opacity 3s ease;
}

.magic-layer {
	position: absolute;
	width: 100%;
	height: 100%;
	background-repeat: no-repeat;
	background-position: center;
	background-size: auto; 
	mix-blend-mode: screen;
	will-change: transform;
}
.layer-inner { background-image: url('../image/q1.webp'); animation: rotateCCW 45s linear infinite; z-index: 8; }
.layer-mid { background-image: url('../image/q2.webp'); animation: rotateCW 65s linear infinite; z-index: 7; }
.layer-outer { background-image: url('../image/q3.webp'); animation: rotateCCW 95s linear infinite; transform: scale(1.2); z-index: 6; }

@keyframes rotateCW { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes rotateCCW { from { transform: rotate(360deg); } to { transform: rotate(0deg); } }

.select-tips-pos { position: absolute; width: 100%; text-align: center; z-index: 200; pointer-events: none; white-space: pre-line; }
.select-tips-pos.line-active { animation: smokeIn 1.2s ease-out forwards; }

#galaxy-bg{
	position:absolute;
	top:0;
	left:0;
	width:100%;
	height:100%;
	z-index:2;
	pointer-events:none;
}



#energy-core{
position:absolute;
left:50%;
top:50%;
width:260px;
height:260px;
transform:translate(-50%,-50%);
border-radius:50%;
background:radial-gradient(circle,
rgba(255,255,255,0.9) 0%,
rgba(255,230,180,0.7) 20%,
rgba(255,200,120,0.4) 40%,
rgba(255,180,80,0.15) 60%,
rgba(255,160,60,0.05) 70%,
transparent 80%);
filter:blur(2px);
z-index:4;
animation:corePulse 6s ease-in-out infinite;
pointer-events:none;
}

@keyframes corePulse{
0%,100%{transform:translate(-50%,-50%) scale(1);opacity:.9}
50%{transform:translate(-50%,-50%) scale(1.15);opacity:1}
}

@keyframes candleFlicker {
0%, 100% { filter: brightness(1) sepia(0.1); }
5% { filter: brightness(1.08) sepia(0.15); }
10% { filter: brightness(0.95) sepia(0.1); }
18% { filter: brightness(1.05) sepia(0.12); }
25% { filter: brightness(0.92) sepia(0.1); }
32% { filter: brightness(1.1) sepia(0.14); }
40% { filter: brightness(0.98) sepia(0.1); }
48% { filter: brightness(1.06) sepia(0.13); }
55% { filter: brightness(0.94) sepia(0.1); }
62% { filter: brightness(1.08) sepia(0.15); }
70% { filter: brightness(0.96) sepia(0.1); }
78% { filter: brightness(1.04) sepia(0.12); }
85% { filter: brightness(0.9) sepia(0.1); }
92% { filter: brightness(1.07) sepia(0.14); }
}

.candle-flicker {
    
animation: candleFlicker 11s ease-in-out infinite;
}

.focused-card-glow {
    position: absolute;
    /* 寬和高將由 JS 根據卡牌的真實尺寸動態設定 */
    border: 3px solid rgba(255, 215, 0, 0.9); /* 金色邊框 */
    border-radius: 6px; /* 小圓角，與卡牌邊緣匹配 */
    box-shadow: 
        0 0 5px 2px rgba(255, 215, 0, 0.3), /* 內部金色光 */
        0 0 2px 1px rgba(255, 165, 0, 0.2); /* 外部琥珀色散光 */
    will-change: opacity, transform;
    pointer-events: none;
    z-index: 5001; /* 確保在卡牌之上，魔法陣之下 */
    opacity: 0;
    transition: opacity 1.5s ease;
    /* 金色脈衝動畫 */
    animation: rectGlowPulse 3s infinite ease-in-out;
}

@keyframes rectGlowPulse {
    0%, 100% {
        filter: brightness(1) sepia(0.2); /* 增加一點暖色調 */
        opacity: 0.8;
    }
    50% {
        filter: brightness(1.4) sepia(0.4); /* 變亮並深化金色 */
        opacity: 1;
    }
}


/* 【優化15】：強制GPU渲染所有動畫元素 */
.scatter-card {
    will-change: transform, opacity;
    backface-visibility: hidden;
    transform: translateZ(0); /* 強制GPU層 */
}

/* 【優化16】：減少不必要的樣式計算 */
.scatter-card.shuffling {
    transition: transform 0.4s cubic-bezier(0.1, 0.8, 0.3, 1), 
                opacity 0.4s ease !important;
}

/* 【優化19】：簡化魔法陣動畫 */
.magic-layer {
    will-change: transform;
    backface-visibility: hidden;
}

/* 漢堡菜單按鈕 */
.hamburger-btn {
    position: fixed;
    top: 2%;
    right: 14px;
    z-index: 200;
    width: 40px;
    height: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 10px;
    padding: 8px;
    box-sizing: border-box;
    transition: all 0.3s ease;
}
.hamburger-btn:hover {
    background: rgba(255,255,255,0.2);
}
.hamburger-line {
    display: block;
    width: 100%;
    height: 2px;
    background: rgba(255,255,255,0.9);
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* 漢堡菜單覆蓋層（透明容器，菜單在舞台下方露出） */
.hamburger-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    z-index: 5;
    pointer-events: none;
}
.hamburger-overlay.show {
    pointer-events: auto;
    z-index: 15;
}

/* 漢堡菜單面板（z-index低於stage，平時藏在右側） */
.hamburger-menu {
    position: fixed;
    top: 0;
    right: 0;
    width: 180px;
    max-width: 70vw;
    height: 100%;
    transform: translateX(100%);
    background:
        /* 星星层（在图片之上） */
        radial-gradient(2px 2px at 15% 10%, rgba(255,255,255,0.8) 50%, transparent),
        radial-gradient(2px 2px at 70% 5%, #fff 50%, transparent),
        radial-gradient(2px 2px at 25% 45%, rgba(200,220,255,0.7) 50%, transparent),
        radial-gradient(2px 2px at 80% 65%, rgba(255,255,255,0.6) 50%, transparent),
        radial-gradient(2px 2px at 45% 85%, #fff 50%, transparent),
        radial-gradient(1px 1px at 40% 20%, rgba(200,230,255,0.6) 50%, transparent),
        radial-gradient(1px 1px at 85% 30%, rgba(255,255,255,0.5) 50%, transparent),
        radial-gradient(1px 1px at 55% 55%, #fff 50%, transparent),
        radial-gradient(1px 1px at 10% 75%, rgba(200,230,255,0.5) 50%, transparent),
        radial-gradient(1px 1px at 65% 95%, rgba(255,255,255,0.7) 50%, transparent),
        /* 暗色叠加层 */
        linear-gradient(rgba(0,0,0,0.55), rgba(0,0,0,0.55)),
        /* 银河背景图（最底层） */
        #0a0418 url('../image/yinhe.webp') center center / cover no-repeat;
    border-left: 1px solid rgba(255,255,255,0.1);
    transition: transform 1s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    z-index: 5;
    pointer-events: auto;
    overflow: hidden;
}

.hamburger-overlay.show .hamburger-menu {
    transform: translateX(0);
}

/* 星星闪烁动画（JS生成） */
@keyframes menuStarAnim {
    0% { opacity: 0.2; transform: scale(0.5); }
    50% { opacity: 1; transform: scale(1); }
    100% { opacity: 0.3; transform: scale(0.6); }
}

.hamburger-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    position: relative;
    z-index: 1;
}
.hamburger-menu-title {
    color: rgba(255,255,255,0.5);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
}
.hamburger-close-btn {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.7);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}
.hamburger-close-btn:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

.hamburger-menu-body {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
    position: relative;
    z-index: 1;
    background: rgba(10, 4, 24, 0.35);
}

/* 菜單項 */
.hamburger-menu-item {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    gap: 12px;
}
.hamburger-menu-item:hover {
    background: rgba(255,255,255,0.06);
}
.hamburger-item-label {
    color: rgba(255,255,255,0.85);
    font-size: 15px;
    flex: 1;
}
.hamburger-sub-arrow {
    color: rgba(255,255,255,0.35);
    font-size: 10px;
    transition: transform 0.3s ease;
}
.hamburger-sub-arrow.open {
    transform: rotate(90deg);
}


/* 子菜单项勾选标记 */
.hamburger-sub-lang-check {
    margin-left: auto;
    color: #ffd700;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.hamburger-sub-lang-check.active {
    opacity: 1;
}

/* 下拉子菜单 */
.hamburger-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
    background: rgba(0,0,0,0.2);
}
.hamburger-submenu.open {
    max-height: 250px;
}
.hamburger-sub-item {
    padding: 12px 20px 12px 60px;
    color: rgba(255,255,255,0.65);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}
.hamburger-sub-item:hover {
    background: rgba(255,255,255,0.05);
    color: rgba(255,255,255,0.9);
}

/* 歷史記錄面板 */
.history-panel {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 320px;
    height: 100%;
    background: rgba(255, 255, 255, 0.15);
    border-left: 1px solid rgba(255, 255, 255, 0.3);
    transition: right 0.3s ease;
    z-index: 200;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    overflow: hidden;
}

/* 星河背景点缀 — 面板 */
.history-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(1px 1px at 10% 15%, rgba(255,255,255,0.6) 0%, transparent 100%),
        radial-gradient(1px 1px at 30% 40%, rgba(255,255,255,0.5) 0%, transparent 100%),
        radial-gradient(1.5px 1.5px at 50% 10%, rgba(255,255,255,0.7) 0%, transparent 100%),
        radial-gradient(1px 1px at 70% 60%, rgba(255,255,255,0.4) 0%, transparent 100%),
        radial-gradient(1.5px 1.5px at 85% 25%, rgba(255,255,255,0.6) 0%, transparent 100%),
        radial-gradient(1px 1px at 20% 75%, rgba(255,255,255,0.3) 0%, transparent 100%),
        radial-gradient(1.5px 1.5px at 60% 85%, rgba(255,215,0,0.4) 0%, transparent 100%),
        radial-gradient(1px 1px at 90% 80%, rgba(255,255,255,0.5) 0%, transparent 100%),
        radial-gradient(1px 1px at 40% 55%, rgba(255,215,0,0.3) 0%, transparent 100%),
        radial-gradient(1px 1px at 5% 90%, rgba(255,255,255,0.4) 0%, transparent 100%),
        radial-gradient(1.5px 1.5px at 75% 45%, rgba(255,215,0,0.5) 0%, transparent 100%);
    pointer-events: none;
    z-index: 0;
}

.history-panel > * {
    position: relative;
    z-index: 1;
}

/* 汉堡菜单内历史记录 */
.hamburger-history-empty {
    color: rgba(255,255,255,0.4);
    text-align: center;
    padding: 24px 16px;
    font-size: 13px;
}
.hamburger-history-item {
    padding: 10px 16px 10px 16px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    position: relative;
}
.hamburger-history-item:hover {
    background: rgba(255,255,255,0.05);
}
.hamburger-history-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.hamburger-history-type {
    font-size: 12px;
    font-weight: bold;
    color: #fff;
}
.hamburger-history-date {
    font-size: 10px;
    color: rgba(255,255,255,0.35);
    flex: 1;
}
.hamburger-history-preview {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 24px;
}
.hamburger-history-del {
    position: absolute;
    top: 8px;
    right: 10px;
    width: 18px;
    height: 18px;
    border: none;
    background: none;
    cursor: pointer;
    opacity: 0.3;
    transition: opacity 0.2s;
    padding: 0;
}
.hamburger-history-del:hover {
    opacity: 0.7;
}
.hamburger-history-del::before,
.hamburger-history-del::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 1px;
    background: #fff;
}
.hamburger-history-del::before {
    transform: translate(-50%, -50%) rotate(45deg);
}
.hamburger-history-del::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.history-panel.show {
    right: 0;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.history-header span {
    color: white;
    font-size: 16px;
    font-weight: bold;
}

.history-header .close-btn {
    font-size: 20px;
    cursor: pointer;
    color: white;
}

.history-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.empty-history {
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    padding: 50px 0;
}

/* 历史记录列表项 */
.history-item {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 12px;
    position: relative;
    transition: background 0.2s;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.15);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.history-item-type {
    color: #ffd700;
    font-size: 14px;
    font-weight: bold;
}

.history-item-date {
    color: rgba(255, 255, 255, 0.4);
    font-size: 11px;
}

.history-item-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.history-card-tag {
    display: inline-block;
    background: rgba(255, 215, 0, 0.12);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.85);
}

.history-card-tag small {
    color: rgba(255, 255, 255, 0.4);
    font-size: 10px;
}

.history-item-del {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    border: none;
    background: none;
    cursor: pointer;
    opacity: 0.4;
    transition: opacity 0.2s;
}

.history-item-del:hover {
    opacity: 0.8;
}

.history-item-del::before,
.history-item-del::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 1px;
    background: #fff;
}

.history-item-del::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.history-item-del::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.history-clear-all {
    width: 100%;
    padding: 10px;
    border: 1px solid rgba(255, 75, 75, 0.4);
    border-radius: 8px;
    background: rgba(255, 75, 75, 0.08);
    color: rgba(255, 120, 120, 0.8);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    margin-top: 4px;
}

.history-clear-all:hover {
    background: rgba(255, 75, 75, 0.15);
    color: #ff6464;
}

/* 历史记录详情弹窗 */
.history-detail-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.history-detail-modal.show {
    visibility: visible;
    opacity: 1;
}

.history-detail-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        /* 深蓝紫色调 */
        radial-gradient(ellipse at 30% 40%, rgba(60, 80, 150, 0.25) 0%, transparent 55%),
        radial-gradient(ellipse at 70% 30%, rgba(80, 100, 180, 0.2) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 70%, rgba(50, 70, 130, 0.2) 0%, transparent 60%),
        radial-gradient(ellipse at 20% 80%, rgba(70, 90, 160, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 60%, rgba(60, 100, 170, 0.18) 0%, transparent 55%),
        rgba(5, 10, 30, 0.82);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.history-detail-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: 85%;
    background:
        /* 银河光带 - 斜向青蓝色 */
        linear-gradient(135deg, transparent 0%, transparent 40%, rgba(100, 220, 255, 0.15) 45%, rgba(150, 200, 255, 0.25) 50%, rgba(100, 220, 255, 0.15) 55%, transparent 60%, transparent 100%),
        /* 紫色星云团 */
        radial-gradient(ellipse 80% 60% at 70% 20%, rgba(150, 100, 220, 0.35) 0%, rgba(100, 80, 180, 0.2) 30%, transparent 60%),
        /* 青蓝星云团 */
        radial-gradient(ellipse 60% 80% at 20% 30%, rgba(80, 180, 220, 0.3) 0%, rgba(60, 150, 200, 0.15) 40%, transparent 70%),
        /* 深蓝星云 */
        radial-gradient(ellipse 50% 50% at 80% 60%, rgba(80, 100, 180, 0.25) 0%, rgba(60, 80, 150, 0.1) 50%, transparent 80%),
        /* 淡紫色光晕 */
        radial-gradient(ellipse 40% 40% at 30% 70%, rgba(180, 140, 220, 0.2) 0%, transparent 60%),
        /* 底部深蓝渐变 */
        linear-gradient(180deg, rgba(10, 20, 45, 0.98) 0%, rgba(5, 15, 35, 0.99) 50%, rgba(3, 10, 30, 0.98) 100%);
    border-radius: 20px 20px 0 0;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    overflow: hidden;
    border-top: 1px solid rgba(100, 200, 255, 0.3);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* 银河 Canvas 背景层 */
.history-detail-galaxy {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    border-radius: 20px 20px 0 0;
}

/* 星云缓慢漂移呼吸动画 */
@keyframes nebulaDrift {
    0%   { transform: translate(0, 0) scale(1); }
    25%  { transform: translate(8px, -12px) scale(1.05); }
    50%  { transform: translate(-6px, 10px) scale(0.95); }
    75%  { transform: translate(10px, 5px) scale(1.03); }
    100% { transform: translate(0, 0) scale(1); }
}

/* 漂浮星屑动画 */
@keyframes starFloat1 {
    0%   { transform: translate(0, 0) scale(1); opacity: 0; }
    10%  { opacity: 0.6; }
    90%  { opacity: 0.6; }
    100% { transform: translate(20px, -80px) scale(0.6); opacity: 0; }
}
@keyframes starFloat2 {
    0%   { transform: translate(0, 0) scale(1); opacity: 0; }
    10%  { opacity: 0.5; }
    90%  { opacity: 0.5; }
    100% { transform: translate(-15px, -60px) scale(0.7); opacity: 0; }
}
@keyframes starFloat3 {
    0%   { transform: translate(0, 0) scale(1); opacity: 0; }
    10%  { opacity: 0.7; }
    90%  { opacity: 0.7; }
    100% { transform: translate(12px, -100px) scale(0.4); opacity: 0; }
}

.history-detail-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        /* 银河核心区域密集星光 */
        radial-gradient(2px 2px at 55% 35%, rgba(255, 255, 255, 0.9) 0%, transparent 100%),
        radial-gradient(1.5px 1.5px at 58% 32%, rgba(200, 230, 255, 0.8) 0%, transparent 100%),
        radial-gradient(1px 1px at 52% 38%, rgba(180, 220, 255, 0.7) 0%, transparent 100%),
        radial-gradient(1.5px 1.5px at 60% 40%, rgba(220, 240, 255, 0.6) 0%, transparent 100%),
        /* 散布的蓝色星光 */
        radial-gradient(1.5px 1.5px at 15% 20%, rgba(150, 220, 255, 0.8) 0%, transparent 100%),
        radial-gradient(1px 1px at 25% 15%, rgba(200, 240, 255, 0.6) 0%, transparent 100%),
        radial-gradient(1.5px 1.5px at 80% 25%, rgba(160, 210, 255, 0.7) 0%, transparent 100%),
        radial-gradient(1px 1px at 85% 18%, rgba(180, 230, 255, 0.5) 0%, transparent 100%),
        /* 紫色星光 */
        radial-gradient(1px 1px at 70% 55%, rgba(200, 180, 255, 0.6) 0%, transparent 100%),
        radial-gradient(1.5px 1.5px at 75% 60%, rgba(180, 160, 240, 0.5) 0%, transparent 100%),
        radial-gradient(1px 1px at 20% 70%, rgba(220, 200, 255, 0.5) 0%, transparent 100%),
        radial-gradient(1.5px 1.5px at 10% 65%, rgba(190, 170, 240, 0.6) 0%, transparent 100%),
        /* 边缘稀疏星光 */
        radial-gradient(1px 1px at 90% 80%, rgba(170, 220, 255, 0.5) 0%, transparent 100%),
        radial-gradient(1px 1px at 5% 85%, rgba(200, 220, 255, 0.4) 0%, transparent 100%),
        radial-gradient(1.5px 1.5px at 40% 90%, rgba(180, 200, 255, 0.5) 0%, transparent 100%),
        radial-gradient(1px 1px at 65% 85%, rgba(160, 210, 255, 0.4) 0%, transparent 100%),
        /* 细小星光点缀 */
        radial-gradient(0.5px 0.5px at 30% 25%, rgba(255, 255, 255, 0.5) 0%, transparent 100%),
        radial-gradient(0.5px 0.5px at 45% 50%, rgba(220, 240, 255, 0.4) 0%, transparent 100%),
        radial-gradient(0.5px 0.5px at 88% 45%, rgba(255, 255, 255, 0.4) 0%, transparent 100%),
        radial-gradient(0.5px 0.5px at 15% 45%, rgba(200, 230, 255, 0.5) 0%, transparent 100%);
    pointer-events: none;
    z-index: 0;
    animation: galaxyTwinkle 4s ease-in-out infinite;
}

@keyframes galaxyTwinkle {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* 星屑粒子 */
.history-detail-stardust {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}

.history-detail-header,
.history-detail-body {
    position: relative;
    z-index: 1;
}

.history-detail-modal.show .history-detail-panel {
    transform: translateY(0);
}

.history-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px 14px;
    border-bottom: 1px solid rgba(100, 200, 255, 0.15);
    flex-shrink: 0;
    background: linear-gradient(90deg, transparent, rgba(100, 200, 255, 0.08), rgba(150, 180, 255, 0.05), transparent);
}

.history-detail-type {
    color: #ffd700;
    font-size: 17px;
    font-weight: bold;
}

.history-detail-date {
    color: rgba(255, 255, 255, 0.4);
    font-size: 12px;
    margin-top: 3px;
}

.history-detail-close {
    padding: 6px 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

.history-detail-close:hover {
    background: linear-gradient(135deg, rgba(100, 200, 255, 0.25), rgba(150, 180, 255, 0.2));
    border-color: rgba(100, 200, 255, 0.4);
    box-shadow: 0 0 20px rgba(100, 200, 255, 0.3), 0 0 40px rgba(150, 180, 255, 0.15);
}

.history-detail-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px 30px;
    position: relative;
    z-index: 1;
    /* 上下渐隐遮罩（加大范围） */
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 18%, #000 72%, transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0%, #000 18%, #000 72%, transparent 100%);
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
}

/* 滚动容器 */
.history-detail-scroll {
    position: relative;
    padding-top: 40px; /* 给遮罩层留出空间 */
    padding-bottom: 60px; /* 底部也留空间 */
}

.history-detail-card {
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02)),
        linear-gradient(90deg, rgba(100, 200, 255, 0.05), transparent, rgba(150, 180, 255, 0.04));
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-left: 2px solid rgba(100, 200, 255, 0.35);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 14px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.history-detail-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.history-detail-card-pos {
    color: rgba(150, 220, 255, 0.95);
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-shadow: 0 0 12px rgba(100, 200, 255, 0.4), 0 0 20px rgba(150, 220, 255, 0.2);
}

.history-detail-card-name {
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
}

.history-detail-card-name small {
    color: rgba(255, 255, 255, 0.35);
    font-size: 11px;
}

.history-detail-section {
    margin-top: 12px;
}

.history-detail-section-title {
    color: rgba(180, 200, 255, 0.85);
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    text-shadow: 0 0 10px rgba(150, 200, 255, 0.3);
}

.history-detail-text {
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    line-height: 1.7;
    white-space: pre-wrap;
}

/* 历史详情原始文本（居中展示） */
.history-detail-line {
    color: rgba(255, 255, 255, 0.82);
    font-size: 14px;
    line-height: 1.8;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    text-align: center;
}

.history-detail-line:last-child {
    border-bottom: none;
}

.history-detail-line strong {
    color: rgba(170, 220, 255, 0.95);
    text-shadow: 0 0 12px rgba(120, 200, 255, 0.35), 0 0 20px rgba(150, 220, 255, 0.15);
}

.history-detail-line br {
    display: block;
    content: '';
    margin: 6px 0;
}

/* 历史列表文本预览 */
.history-item-text {
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}



.copyright {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.35);
    letter-spacing: 1px;
    margin-top: 25px;
}

/* ============================= */
/* 協議彈窗樣式 */
/* ============================= */

.terms-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    overflow-y: auto;
}

.terms-modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.terms-modal {
    background: linear-gradient(135deg, rgba(47, 10, 62, 0.95) 0%, rgba(20, 5, 40, 0.98) 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

.terms-modal-overlay.show .terms-modal {
    transform: scale(1) translateY(0);
}

.terms-modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.terms-modal-header h2 {
    color: #fff;
    font-size: 18px;
    font-weight: 500;
    margin: 0;
}

.terms-modal-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.terms-modal-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.terms-modal-content {
    padding: 25px;
    overflow-y: auto;
    color: rgba(255, 255, 255, 0.85);
    font-size: 14px;
    line-height: 1.8;
    flex: 1;
}

.terms-modal-content::-webkit-scrollbar {
    width: 6px;
}

.terms-modal-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.terms-modal-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.terms-modal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.terms-modal-content h3 {
    color: #fff;
    font-size: 16px;
    margin: 20px 0 10px 0;
    font-weight: 500;
}

.terms-modal-content h3:first-child {
    margin-top: 0;
}

.terms-modal-content p {
    margin-bottom: 12px;
}

.terms-modal-content .terms-section {
    margin-bottom: 15px;
}

.terms-modal-content .terms-section-title {
    color: #fff;
    font-weight: 500;
    margin-bottom: 8px;
}

/* =====================================
   情緒驅動型決策引導系統 新增樣式
   ===================================== */

/* 鉤子句高亮 */
.hook-highlight {
    animation: hookFadeIn 1.2s ease;
    border-left: 2px solid rgba(255, 215, 0, 0.4) !important;
    padding-left: 14px !important;
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.08) 0%, transparent 100%) !important;
}
.hook-highlight p {
    color: #b8860b !important;
    font-weight: 500 !important;
}

@keyframes hookFadeIn {
    from { opacity:0; transform:translateY(12px); }
    to   { opacity:1; transform:translateY(0); }
}

/* 情緒關鍵詞發光 */
.emotion-glow {
    animation: emotionGlow 2.5s ease-in-out infinite;
    border-left: 2px solid rgba(191, 149, 255, 0.5) !important;
}
.emotion-glow p {
    color: rgba(160, 120, 220, 0.95) !important;
    font-style: italic;
}

@keyframes emotionGlow {
    0%,100% { box-shadow: 0 0 8px rgba(191,149,255,0.1); }
    50%     { box-shadow: 0 0 18px rgba(191,149,255,0.25); }
}

/* 逐字慢顯延遲動畫（確認句） */
.confirm-phrase {
    animation: confirmReveal 1.6s ease forwards;
    overflow: hidden;
}
.confirm-phrase p {
    animation: typewriterAppear 2.5s steps(30, end);
    white-space: normal;
    overflow: hidden;
    display: block;
}

@keyframes typewriterAppear {
    from { max-height:0; opacity:0; }
    to   { max-height:200px; opacity:1; }
}

@keyframes confirmReveal {
    from { opacity:0; transform:translateY(16px); }
    to   { opacity:1; transform:translateY(0); }
}

/* typewriter-delay 逐字慢顯 */
.typewriter-delay {
    animation: slowFadeIn 3s ease forwards;
}

@keyframes slowFadeIn {
    0%   { opacity:0; }
    60%  { opacity:0; }
    100% { opacity:1; }
}

/* 專業牌組預告卡片 */
.premium-preview-card {
    transition: all 0.4s ease;
}
.premium-preview-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(255,215,0,0.2) !important;
    border-color: rgba(255,215,0,0.5) !important;
}
.premium-preview-card div[style*="cursor:pointer"] {
    user-select: none;
}
.premium-preview-card div[style*="cursor:pointer"]:hover {
    background: rgba(255,215,0,0.15) !important;
    box-shadow: 0 0 15px rgba(255,215,0,0.2);
}

/* 確認句特殊排版 */
.confirm-phrase p {
    line-height: 1.8 !important;
    letter-spacing: 0.5px !important;
}

/* ========== Footer 底部全宽横条 ========== */
.site-footer {
    width: 100%;
    padding: 20px 20px calc(16px + env(safe-area-inset-bottom, 0px));
    background: #1f072a;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    position: relative;
    z-index: 5;
}

.footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.footer-link {
    color: rgba(255, 255, 255, 0.4);
    font-size: 12px;
    text-decoration: none;
    transition: color 0.3s ease;
    letter-spacing: 0.5px;
}

.footer-link:hover {
    color: rgba(255, 215, 0, 0.7);
}

.footer-link:active {
    color: rgba(255, 215, 0, 0.85);
}

.footer-divider {
    color: rgba(255, 255, 255, 0.15);
    font-size: 12px;
    user-select: none;
}

.footer-company {
    color: rgba(255, 255, 255, 0.2);
    font-size: 10px;
    letter-spacing: 1px;
    user-select: none;
}

/* ========== 对话框滚动条 ========== */
#dialog-message-container::-webkit-scrollbar {
    width: 4px;
}
#dialog-message-container::-webkit-scrollbar-track {
    background: transparent;
}
#dialog-message-container::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 2px;
}

/* ============================= */
/* iOS 安装引导浮层 */
/* ============================= */
.ios-install-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}
.ios-install-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.ios-install-modal {
    background: linear-gradient(160deg, #1a0a2e, #0f0520);
    border: 1px solid rgba(180,150,255,0.15);
    border-radius: 20px;
    padding: 32px 24px 24px;
    max-width: 300px;
    width: 80%;
    text-align: center;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 40px rgba(140,100,220,0.1);
    animation: fadeInUp 0.5s ease;
}

.ios-install-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(255,255,255,0.06);
    border-radius: 50%;
    color: rgba(255,255,255,0.5);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.ios-install-close:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
}

.ios-install-icon {
    font-size: 2.4rem;
    margin-bottom: 12px;
    filter: drop-shadow(0 0 12px rgba(255,215,0,0.3));
}

.ios-install-title {
    color: rgba(220,200,255,0.9);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 20px;
}

.ios-install-steps {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.ios-install-step {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
    padding: 10px 14px;
}

.ios-step-num {
    color: #ffd700;
    font-size: 1rem;
    min-width: 22px;
    text-align: center;
    text-shadow: 0 0 8px rgba(255,215,0,0.3);
}

.ios-step-text {
    color: rgba(255,255,255,0.75);
    font-size: 0.85rem;
}

/* iOS 步骤图标样式 */
.ios-step-icon-only {
    justify-content: center;
    gap: 14px;
}
.ios-safari-icon {
    display: block;
    flex-shrink: 0;
}
.ios-home-icon {
    display: block;
    flex-shrink: 0;
    margin-left: auto;
}

.ios-install-footer {
    color: rgba(255,255,255,0.25);
    font-size: 0.65rem;
    margin-top: 6px;
    letter-spacing: 0.5px;
}

/* ============================= */
/* 底部抽屉（footer） */
/* ============================= */
.footer-drawer {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    z-index: 10001 !important;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    background: #1f072a;
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 20px);
}
.footer-drawer.open {
    transform: translateY(0);
}
.footer-drawer-overlay {
    position: fixed !important;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: transparent;
    z-index: 10000 !important;
    pointer-events: none;
}
.footer-drawer-overlay.show {
    pointer-events: auto;
}
body.footer-drawer-open { overflow: hidden !important; }
.footer-pull-hint {
    position: fixed !important;
    bottom: env(safe-area-inset-bottom, 0px) !important;
    left: 50% !important;
    transform: translateX(-50%);
    z-index: 10002 !important;
    padding: 6px 20px calc(8px + env(safe-area-inset-bottom, 0px));
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.3s, transform 0.3s;
}
.footer-pull-hint:hover { opacity: 0.9; }
.footer-pull-hint.hidden { opacity: 0; pointer-events: none; }
/* PC 端：footer 常驻显示 */
@media (min-width: 1024px) {
    .footer-drawer { transform: translateY(0) !important; }
    .footer-drawer-overlay, .footer-pull-hint { display: none !important; }
    .stage { transition: height 0.4s cubic-bezier(0.22, 1, 0.36, 1) !important; }
}
