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

body {
    margin: 0;
    padding: clamp(10px, 3vw, 20px); /* 響應式內邊距 */
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #f0f0f0;
    font-family: Arial, sans-serif;
}

.container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: clamp(10px, 2vw, 20px); /* 響應式內邊距 */
}

main {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(1rem, 3vw, 2rem); /* 響應式間距 */
}

h1 {
    color: #333;
    text-align: center;
    margin-bottom: clamp(1rem, 4vw, 2rem);
    font-size: clamp(1.5rem, 5vw, 2rem); /* 響應式字體大小 */
}

.wheel-container {
    position: relative;
    width: min(90vw, 300px); /* 響應式寬度 */
    height: min(90vw, 300px); /* 響應式高度 */
    margin: 0 auto;
}

/* 其他現有的樣式保持不變 */
.wheel {
    width: 100%;
    height: 100%;
    z-index: 0;
}

.face-image {
    position: absolute;
    top: 43%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 33%;
    height: 33%;
    z-index: 2;
}

.face-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.pointer-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    pointer-events: none;
}

.pointer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    transform-origin: center center;
    transition: transform 5s cubic-bezier(0.17, 0.67, 0.12, 0.99);
    z-index: 3;  /* 確保最上層 */
    will-change: transform;  /* 優化性能 */
}

.pointer-image {
    position: absolute;
    top: 55%;
    left: 55%;
    transform: translate(-50%, -50%);
    width: min(30px, 10%);
    height: min(40px, 13%);
    background-image: url('img/pointer.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center center;
    z-index: 3;  /* 與 pointer 相同 */
}

.spin-button {
    padding: clamp(0.5rem, 2vw, 0.75rem) clamp(1rem, 4vw, 2rem);
    font-size: clamp(0.9rem, 3vw, 1.1rem);
    color: white;
    background-color: #3b82f6;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background-color 0.2s;
    width: min(200px, 80%); /* 響應式寬度 */
}

/* 結果提示框的響應式調整 */

.result-content h2 {
    margin-top: 0;
    color: #2563eb;
    font-size: clamp(1.2rem, 4vw, 1.5rem);
}

.result-content p {
    margin: 1rem 0;
    font-size: clamp(1rem, 3vw, 1.2rem);
    color: #333;
}

.result-content button {
    margin-top: 1rem;
    padding: clamp(0.3rem, 2vw, 0.5rem) clamp(1rem, 4vw, 2rem);
    font-size: clamp(0.9rem, 2.5vw, 1rem);
}

/* 首先添加 .result-popup 的樣式 */
.result-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: clamp(10px, 3vw, 20px); /* 添加響應式內邊距 */
    z-index: 1000;
}

.result-content {
    background-color: white;
    padding: clamp(1rem, 4vw, 2rem);
    border-radius: 0.5rem;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: min(400px, 95vw);  /* 響應式寬度 */
    max-height: min(90vh, 300px); /* 響應式高度 */
    display: flex;           /* 使用 flex 布局 */
    flex-direction: column;  /* 垂直排列 */
    justify-content: space-between; /* 內容分散對齊 */
}

/* 媒體查詢，用於更具體的調整 */
@media (max-width: 480px) {
    .container {
        padding: 5px;
    }
    
    .wheel-container {
        margin-bottom: 1rem;
    }
    
    .spin-button {
        margin-top: 1rem;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .wheel-container {
        margin-bottom: 1.5rem;
    }
}

@media (min-height: 100vh) {
    body {
        justify-content: center;
    }
}

/* 在小螢幕上調整內容大小 */
@media (max-width: 480px) {
    .result-content h2 {
        font-size: clamp(1.1rem, 4vw, 1.3rem);
    }
    
    .result-content p {
        font-size: clamp(0.9rem, 3vw, 1.1rem);
    }
    
    .result-content button {
        font-size: clamp(0.8rem, 2.5vw, 1rem);
        padding: clamp(0.3rem, 1.5vw, 0.5rem) clamp(1rem, 3vw, 1.5rem);
    }
}