/* --- 基礎設定 --- */
:root {
    --bg-color: #fdfdfb;    /* 暖白胡粉色 */
    --text-color: #2c2c2c;  /* 墨黑 */
    --accent-color: #a63d40; /* 朱紅 */
    --border-color: #e0e0e0;
}

body {
    font-family: "Hiragino Mincho ProN", "Yu Mincho", "MS PMincho", "Noto Serif TC", serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    /* 修正手機滾動問題 */
    min-height: 100vh; 
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-y: auto; /* 允許垂直捲動 */
    -webkit-tap-highlight-color: transparent;
}

.container {
    text-align: center;
    width: 100%;
    max-width: 450px;
    padding: 30px 20px; /* 縮減上下內距 */
    box-sizing: border-box;
}

h1 {
    font-weight: 300;
    letter-spacing: 0.3em;
    font-size: 1.1rem;
    margin: 0 0 30px 0;
    position: relative;
}

h1::after {
    content: "";
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 1px;
    background: var(--text-color);
}

/* --- 餅乾與動畫 --- */
@keyframes float {
    0% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
    100% { transform: translateY(0); }
}

@keyframes jiggle {
    0% { transform: scale(1); }
    50% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

#cookie-container {
    cursor: pointer;
    margin-bottom: 20px;
    outline: none;
}

.cookie-img {
    width: 160px; /* 縮小餅乾尺寸以節省空間 */
    height: auto;
    animation: float 4s ease-in-out infinite;
    transition: width 0.3s ease;
}

.cookie-active {
    animation: jiggle 0.3s ease-out !important;
}

#hint {
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    color: #999;
    margin-top: 15px;
    transition: opacity 0.3s;
}

/* --- 日式直排紙條樣式 --- */
#fortune-paper {
    background-color: #fff;
    padding: 25px 15px;
    width: 65%;
    margin: 0 auto;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
    
    /* 預設隱藏狀態 */
    display: none; 
    opacity: 0;
    transform: scale(0.95);
    transition: all 0.6s ease;
}

/* 當 JS 加入 .show 時顯示 */
#fortune-paper.show {
    display: block; /* 顯示 */
    opacity: 1;
    transform: scale(1);
}

.paper-inner {
    border: 1px solid var(--accent-color);
    padding: 15px 5px;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.fortune-text {
    font-size: 1.1rem;
    line-height: 1.8;
    font-weight: 500;
    writing-mode: vertical-rl; /* 直排關鍵 */
    text-orientation: upright;
    letter-spacing: 0.25em;
    margin: 0 auto;
}

.lucky-number {
    font-size: 0.65rem;
    margin-top: 15px;
    letter-spacing: 0.1em;
    color: var(--accent-color);
}

/* --- 按鈕群組 --- */
.button-group {
    margin-top: 30px;
    margin-bottom: 40px; /* 增加底部間距確保不被手機工具列擋住 */
    display: none; 
    justify-content: center;
    gap: 12px;
}

/* 讓按鈕在 active 狀態顯示 */
.button-group.active {
    display: flex !important;
}

button {
    background: none;
    border: 1px solid var(--text-color);
    padding: 10px 20px;
    font-family: inherit;
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.2s;
}

#reset-btn {
    background-color: #000;
    color: #fff;
}

button:active {
    transform: scale(0.95);
    opacity: 0.8;
}
#share-btn{
    color: #000
}

/* 針對小螢幕優化 */
@media (max-height: 600px) {
    .cookie-img { width: 120px; }
    h1 { margin-bottom: 20px; }
}
.brand-name {
    font-family: "Garamond", "Georgia", serif; /* 經典襯線體 */
    font-size: 0.7rem;
    letter-spacing: 0.4em;
    text-transform: uppercase;
    color: #999; /* 淺灰色，不搶主標題戲 */
    margin-bottom: 10px;
    opacity: 0.8;
}