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

body {
    font-family: 'Microsoft JhengHei', Arial, sans-serif;
    background: #0c0c2a;
    color: #ffffff;
    min-height: 100vh;
    background-image: radial-gradient(circle, #1a1a4a 0%, #0c0c2a 100%);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    text-align: center;
    position: relative;
    min-height: 100vh;
}

/* 頁面切換樣式 */
.page {
    display: none;
    animation: fadeIn 0.5s ease-in-out;
}

.page.active {
    display: block;
}

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

h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
    animation: title-glow 2s infinite ease-in-out;
}

h1:hover {
    animation: title-glow 1s infinite ease-in-out;
}

@keyframes title-glow {
    0% {
        text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
        transform: scale(1);
    }
    25% {
        text-shadow: 0 0 20px rgba(255, 215, 0, 0.8), 0 0 30px rgba(255, 215, 0, 0.6);
        transform: scale(1.02);
    }
    50% {
        text-shadow: 0 0 15px rgba(255, 215, 0, 0.7), 0 0 25px rgba(255, 215, 0, 0.5);
        transform: scale(1.05);
    }
    75% {
        text-shadow: 0 0 25px rgba(255, 215, 0, 0.9), 0 0 35px rgba(255, 215, 0, 0.7);
        transform: scale(1.02);
    }
    100% {
        text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
        transform: scale(1);
    }
}

h2 {
    font-size: 2.25rem;
    margin-bottom: 1.5rem;
    color: #e6e6fa;
}

.instructions {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    color: #b0e0e6;
}

/* 當前問題顯示 */
.current-question {
    background: rgba(26, 26, 74, 0.3);
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-radius: 15px;
    padding: 1rem;
    margin-bottom: 2rem;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.current-question p {
    color: #ffd700;
    font-size: 1.1rem;
    font-weight: bold;
    margin: 0;
}

.current-question .restart-button {
    margin: 0;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    min-width: auto;
}

/* 選中卡牌摘要 */
.selected-cards-summary {
    background: rgba(26, 26, 74, 0.3);
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-radius: 15px;
    padding: 1rem;
    margin-bottom: 2rem;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.2);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}

.selected-card-item {
    background: rgba(42, 42, 106, 0.5);
    border: 1px solid rgba(255, 215, 0, 0.5);
    border-radius: 10px;
    padding: 1rem;
    min-width: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.card-image-small {
    width: 80px;
    height: 80px;
    background-size: cover;
    background-position: center;
    border-radius: 8px;
    border: 2px solid rgba(255, 215, 0, 0.5);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: scale(0);
    transition: all 0.5s ease;
}

.card-image-small.show {
    opacity: 1;
    transform: scale(1);
}

.card-info {
    text-align: center;
}

.card-label {
    color: #b0e0e6;
    font-weight: bold;
    margin-right: 0.5rem;
}

.selected-card-item span:last-child {
    color: #ffd700;
    font-weight: bold;
}

/* 頁面導航按鈕 */
.page-navigation {
    margin-top: 3rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.back-button, .next-button, .restart-button {
    padding: 1rem 2rem;
    border: 2px solid;
    border-radius: 30px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Microsoft JhengHei', Arial, sans-serif;
    min-width: 150px;
}

.next-button {
    background: rgba(26, 26, 74, 0.7);
    color: #ffd700;
    border-color: #ffd700;
}

.next-button:hover:not(:disabled) {
    background: rgba(42, 42, 106, 0.8);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
    transform: translateY(-2px);
}

.next-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.restart-button {
    background: rgba(74, 26, 26, 0.7);
    color: #ff6b6b;
    border-color: #ff6b6b;
}

.restart-button:hover {
    background: rgba(106, 42, 42, 0.8);
    box-shadow: 0 0 15px rgba(255, 107, 107, 0.3);
    transform: translateY(-2px);
}

/* 設置按鈕和面板樣式 */
.settings-container {
    position: absolute;
    top: 10px;
    right: 20px;
    z-index: 1000;
}

.settings-button {
    padding: 0.3rem 0.8rem;
    background: #1a1a4a;
    color: #ffd700;
    border: 1px solid #ffd700;
    border-radius: 30px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.settings-button:hover {
    background: #2a2a6a;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.settings-panel {
    position: absolute;
    top: 40px;
    right: 0;
    width: 300px;
    background: #1a1a4a;
    border: 2px solid #ffd700;
    border-radius: 10px;
    padding: 1rem;
    z-index: 1000;
    display: none;
    text-align: left;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

.api-key-container {
    display: flex;
    flex-direction: column;
}

.api-key-container label {
    margin-bottom: 5px;
    color: #e6e6fa;
}

.api-key-container input {
    padding: 8px;
    margin-bottom: 10px;
    border: 1px solid #4a4a8a;
    background: #0c0c2a;
    color: #ffffff;
    border-radius: 5px;
}

.save-button {
    padding: 0.5rem 1rem;
    background: #1a1a4a;
    color: #ffd700;
    border: 1px solid #ffd700;
    border-radius: 5px;
    cursor: pointer;
    align-self: flex-end;
    transition: all 0.3s ease;
}

.save-button:hover {
    background: #2a2a6a;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

/* 占卜問題輸入框 */
.question-container {
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.question-container label {
    margin-bottom: 10px;
    font-size: 1.2rem;
    color: #b0e0e6;
}

.question-container input {
    padding: 10px 15px;
    width: 70%;
    max-width: 500px;
    border: 2px solid #4a4a8a;
    background: rgba(12, 12, 42, 0.7);
    color: #ffffff;
    border-radius: 30px;
    font-size: 1rem;
    transition: all 0.3s ease;
    margin-bottom: 15px;
}

.question-container input:focus {
    border-color: #ffd700;
    outline: none;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

/* 預設問題按鈕樣式 */
.preset-questions {
    margin-top: 15px;
    display: block;
    text-align: center;
}

.preset-btn {
    display: inline-block;
    margin: 5px 10px;
    padding: 8px 16px;
    background: rgba(26, 26, 74, 0.7);
    color: #b0e0e6;
    border: 1px solid #4a4a8a;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Microsoft JhengHei', Arial, sans-serif;
}

.preset-btn:hover {
    background: rgba(42, 42, 106, 0.8);
    border-color: #ffd700;
    color: #ffffff;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
    transform: translateY(-2px);
}

.preset-btn:active {
    transform: translateY(0);
}

/* 小重新抽牌按鈕樣式 */
.reset-button-small {
    display: inline-block;
    margin: 5px 10px;
    padding: 8px 16px;
    background: rgba(26, 26, 74, 0.7);
    color: #ffd700;
    border: 1px solid #ffd700;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Microsoft JhengHei', Arial, sans-serif;
}

.reset-button-small:hover {
    background: rgba(42, 42, 106, 0.8);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
    transform: translateY(-2px);
}

.reset-button-small:active {
    transform: translateY(0);
}

.card-section {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
    flex: 1;
    align-items: flex-start;
    min-height: 400px;
}

.card-pile {
    margin: 1rem;
    width: 450px;
    position: relative;
    display: flex;
    flex-direction: column;
}

.cards {
    position: relative;
    height: 420px;
    margin-bottom: 1rem;
    background-color: rgba(26, 26, 74, 0.3);
    border-radius: 15px;
    padding: 15px;
    transition: all 0.5s ease;
    flex: 1;
    min-height: 350px;
}

.card {
    width: 90px;
    height: 90px;
    background-color: #1a1a4a;
    background-image: radial-gradient(circle at center, #2a2a6a 0%, #1a1a4a 100%);
    background-size: cover;
    background-position: center;
    border-radius: 12px;
    position: absolute;
    cursor: pointer;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
    transform-style: preserve-3d;
    backface-visibility: hidden;
    border: 3px solid #ffd700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card::before {
    content: "★";
    color: #ffd700;
    font-size: 36px;
    opacity: 0.8;
}

.card:hover {
    transform: translateY(-10px) scale(1.05);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5), 0 0 20px rgba(255, 215, 0, 0.5);
    border-color: #ffff00;
    z-index: 100;
}

.selected-card {
    width: 450px;
    height: 450px;
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%) scale(0);
    border-radius: 15px;
    background-size: cover;
    background-position: center;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.7);
    opacity: 0;
    transition: all 0.5s ease;
    border: 5px solid #ffd700;
    z-index: 200;
}

.card-name {
    height: 4.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: #ffd700;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

/* 女巫聯繫頁面樣式 */
.witch-connecting-container {
    background: rgba(26, 26, 74, 0.3);
    background-image: url('witch.png');
    background-size: cover;
    background-position: center -1%;
    background-repeat: no-repeat;
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-radius: 15px;
    padding: 2rem;
    margin: 0;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.2);
    position: relative;
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 350px;
}

.witch-connecting-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 26, 74, 0.7);
    border-radius: 15px;
    z-index: 1;
}

.witch-connecting {
    text-align: center;
    color: #b0e0e6;
    font-size: 1.5rem;
    font-weight: bold;
    letter-spacing: 1px;
    position: relative;
    z-index: 2;
}

.witch-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: float 3s infinite ease-in-out;
}

.connecting-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.dot {
    width: 12px;
    height: 12px;
    background: #ffd700;
    border-radius: 50%;
    animation: dot-pulse 1.5s infinite ease-in-out;
}

.dot:nth-child(2) {
    animation-delay: 0.2s;
}

.dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dot-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* 聊天界面 */
.chat-container {
    background: rgba(26, 26, 74, 0.5);
    background-image: url('witch.png');
    background-size: cover;
    background-position: center 20%;
    background-repeat: no-repeat;
    border-radius: 15px;
    padding: 1rem;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
    position: relative;
    height: 600px;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 500px;
}

.chat-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 26, 74, 0.7);
    border-radius: 15px;
    z-index: 1;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    margin-bottom: 1rem;
    background: rgba(12, 12, 42, 0.5);
    border-radius: 10px;
    text-align: left;
    position: relative;
    z-index: 2;
    min-height: 300px;
}

.chat-message {
    margin-bottom: 1rem;
    padding: 0.8rem;
    border-radius: 10px;
    max-width: 80%;
}

.user-message {
    background: #1a1a4a;
    color: #ffffff;
    align-self: flex-end;
    margin-left: auto;
}

.witch-message {
    background: #4a1a4a;
    color: #f5f5f5;
    align-self: flex-start;
}

.chat-input-container {
    display: flex;
    gap: 10px;
    position: relative;
    z-index: 2;
    flex-shrink: 0;
    margin-top: auto;
}

.chat-input-container input {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #4a4a8a;
    background: rgba(12, 12, 42, 0.7);
    color: #ffffff;
    border-radius: 30px;
    font-size: 1rem;
}

.chat-input-container input:focus {
    border-color: #ffd700;
    outline: none;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.send-button {
    padding: 0.5rem 1.5rem;
    background: #1a1a4a;
    color: #ffd700;
    border: 2px solid #ffd700;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.send-button:hover {
    background: #2a2a6a;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.reset-button {
    margin-top: 2rem;
    padding: 1rem 2rem;
    background: #1a1a4a;
    color: #ffd700;
    border: 2px solid #ffd700;
    border-radius: 30px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
    display: none;
}

.reset-button:hover {
    background: #2a2a6a;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    transform: translateY(-3px);
}

.reset-button:active {
    transform: translateY(1px);
}

.cards.selected {
    opacity: 0.3;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .page-layout {
        flex-direction: column;
        gap: 1rem;
    }
    
    .left-panel {
        flex: none;
        width: 100%;
        position: static;
        height: auto;
        min-height: auto;
    }
    
    .right-panel {
        width: 100%;
        order: -1; /* 在手機版上，右側面板先顯示 */
    }
    
    .current-question {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    
    .current-question .restart-button {
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
    }
    
    .card-section {
        flex-direction: column;
        align-items: center;
    }
    
    .card-pile {
        width: 100%;
        max-width: 450px;
    }
    
    .question-container {
        flex-direction: column;
    }
    
    .question-container input {
        width: 100%;
    }
    
    .preset-questions {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    
    .preset-btn {
        width: 100%;
        max-width: 300px;
        padding: 10px 16px;
    }
    
    .page-navigation {
        flex-direction: column;
        align-items: center;
    }
    
    .back-button, .next-button, .restart-button {
        width: 100%;
        max-width: 300px;
    }
    
    .selected-cards-summary {
        flex-direction: column;
        align-items: center;
    }
    
    .selected-card-item {
        width: 100%;
        max-width: 300px;
    }
    
    /* 手機版聊天界面優化 */
    .chat-container {
        height: 70vh; /* 使用視窗高度的70% */
        min-height: 400px;
        max-height: 600px;
        margin-bottom: 1rem;
    }
    
    .chat-messages {
        flex: 1;
        min-height: 300px;
        max-height: 50vh;
    }
    
    .chat-input-container {
        margin-top: auto;
        padding-top: 1rem;
    }
    
    /* 手機版女巫聯繫容器優化 */
    .witch-connecting-container {
        height: 60vh;
        min-height: 350px;
        max-height: 500px;
    }
    
    /* 手機版卡片區域優化 */
    .cards {
        height: 300px;
        min-height: 250px;
    }
    
    .selected-card {
        width: 100%;
        max-width: 350px;
        height: 350px;
        top: 80px; /* 增加與標題的距離，避免擋到標題 */
    }
    
    .card-name {
        height: 3.5rem;
        font-size: 1.5rem;
    }
}

/* 頁腳樣式 */
.site-footer {
    margin-top: 3rem;
    padding: 1.5rem 0;
    border-top: 1px solid rgba(255, 215, 0, 0.3);
    color: #b0e0e6;
    font-size: 0.9rem;
    opacity: 0.8;
    clear: both;
    position: relative;
    z-index: 10;
}

.site-footer p {
    margin: 0;
    line-height: 1.5;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.8);
}

/* 直式版本專用樣式 */
.center-content {
    text-align: center;
    margin: 0.3rem 0 2rem 0;
    padding: 1.5rem;
    background: rgba(26, 26, 74, 0.3);
    border-radius: 15px;
    border: 2px solid rgba(255, 215, 0, 0.3);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.2);
}

.center-title {
    font-size: 2.2rem;
    margin-bottom: 1rem;
    color: #ffd700;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
    animation: title-glow 2s infinite ease-in-out;
}

.center-instructions {
    font-size: 1.3rem;
    color: #b0e0e6;
    line-height: 1.6;
    text-shadow: 0 0 8px rgba(176, 224, 230, 0.4);
}

/* 直式版本的響應式設計 */
@media (max-width: 768px) {
    .center-content {
        margin: 2rem 0;
        padding: 1.5rem;
    }
    
    .center-title {
        font-size: 1.8rem;
    }
    
    .center-instructions {
        font-size: 1.1rem;
    }
} 

/* 頁面佈局 - 左右分欄 */
.page-layout {
    display: flex;
    gap: 2rem;
    align-items: stretch;
    margin-bottom: 2rem;
}

.left-panel {
    flex: 7;
    position: sticky;
    top: 2rem;
    display: flex;
    flex-direction: column;
}

.right-panel {
    flex: 3;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

/* 手機版頁面佈局優化 */
@media (max-width: 768px) {
    .page-layout {
        flex-direction: column;
        gap: 1rem;
        margin-bottom: 1rem;
    }
    
    .left-panel {
        flex: none;
        width: 100%;
        position: static;
        height: auto;
        min-height: auto;
        order: 1; /* 在手機版上，左側面板先顯示（在上面） */
    }
    
    .right-panel {
        width: 100%;
        order: 2; /* 在手機版上，右側面板後顯示（在下面） */
        margin-bottom: 0;
    }
    
    /* 手機版聊天頁面特殊處理 - 保持左側面板在上面的順序 */
    #page-6 .page-layout {
        flex-direction: column; /* 聊天頁面也保持左側面板在上面 */
    }
    
    #page-6 .left-panel {
        order: 1;
    }
    
    #page-6 .right-panel {
        order: 2;
        margin-bottom: 0;
    }
} 