/* 全局樣式 */
:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --text-color: #333;
    --light-text: #666;
    --background: #f7f9fc;
    --card-background: #fff;
    --shadow: 0 4px 12px rgba(0,0,0,0.05);
    --hover-shadow: 0 8px 16px rgba(0,0,0,0.12);
}

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

body {
    font-family: "Helvetica Neue", Arial, sans-serif;
    background: var(--background);
    color: var(--text-color);
    line-height: 1.6;
}

/* 頁首樣式 */
.main-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 1.5rem 1rem;
    text-align: center;
    box-shadow: var(--shadow);
}

.main-header h1 {
    font-size: 2.2rem;
    letter-spacing: 1px;
    cursor: pointer;
    transition: transform 0.3s ease;
    margin-bottom: 0.5rem;
}

.main-header h1:hover {
    transform: scale(1.05);
}

/* 導航欄樣式 */
.nav-tabs {
    display: flex;
    justify-content: center;
    gap: 1rem;
    padding: 0.5rem;
    background: var(--card-background);
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
}

.tab-btn {
    padding: 0.5rem 1.2rem;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.tab-btn.active {
    background: var(--primary-color);
    color: white;
}

/* 區塊容器樣式 */
.section-block {
    display: none;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.section-block.active {
    display: block;
}

/* 記憶卡片樣式 */
.memories-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
    padding: 10px;
    max-width: 1200px;
    margin: 0 auto;
}

.memory-card {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: transparent;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    aspect-ratio: 16/10;
    cursor: pointer;
    transform: translateY(0);
    box-shadow: var(--shadow);
}

.memory-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.memory-card:hover img {
    transform: scale(1.1);
    filter: brightness(1.1);
}

.memory-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.memory-card:hover .memory-card-content {
    background: linear-gradient(to top, 
        rgba(0, 0, 0, 0.8) 0%,
        rgba(0, 0, 0, 0.5) 50%,
        rgba(0, 0, 0, 0) 100%);
    transform: translateY(0);
}

.memory-card-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    text-align: left;
    background: linear-gradient(to top, 
        rgba(0, 0, 0, 0.6) 0%,
        rgba(0, 0, 0, 0.3) 50%,
        rgba(0, 0, 0, 0) 100%);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(5px);
}

.memory-card-content h3 {
    color: rgba(255, 255, 255, 0.85);
    margin: 0;
    font-size: 0.95em;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    font-weight: 400;
    letter-spacing: 0.3px;
    padding-left: 10px;
}

.memory-card-content p {
    color: rgba(255, 255, 255, 0.75);
    margin: 3px 0 0;
    font-size: 0.8em;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.4);
    font-weight: 300;
    letter-spacing: 0.2px;
    padding-left: 10px;
}

/* 为点击效果添加额外的样式 */
.memory-card.clicked {
    animation: cardClickFlip 0.6s forwards;
}

@keyframes cardClickFlip {
    0% {
        transform: rotateY(0) scale(1);
    }
    50% {
        transform: rotateY(180deg) scale(1.1);
    }
    100% {
        transform: rotateY(0) scale(1);
        opacity: 0;
    }
}

/* 轮播图进入特效 */
.carousel-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    animation: carouselEnter 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    transform-origin: center;
    padding-top: 20px;
}

@keyframes carouselEnter {
    0% {
        opacity: 0;
        transform: perspective(1000px) rotateY(-90deg);
    }
    100% {
        opacity: 1;
        transform: perspective(1000px) rotateY(0);
    }
}

/* 朋友留言卡片樣式 */
.friends-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 1rem;
}

.friend-card {
    background: var(--card-background);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.friend-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 1;
    pointer-events: none;
}

.friend-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.friend-card:hover::before {
    opacity: 0.1;
}

.friend-card .avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto 1rem;
    display: block;
    object-fit: cover;
    transition: all 0.4s ease;
    position: relative;
    z-index: 2;
}

.friend-card:hover .avatar {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.friend-card h3 {
    text-align: center;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    transition: all 0.4s ease;
    position: relative;
    z-index: 2;
}

.friend-card:hover h3 {
    transform: translateY(-2px);
    color: var(--primary-color);
}

.friend-card .preview {
    color: var(--light-text);
    text-align: center;
    font-style: italic;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    transition: all 0.4s ease;
    position: relative;
    z-index: 2;
}

.friend-card:hover .preview {
    transform: translateY(-2px);
    color: var(--text-color);
}

/* 測驗樣式 */
.quiz-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background: var(--card-background);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.quiz-start-screen {
    text-align: center;
    padding: 20px;
}

.quiz-start-screen h2 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    background: var(--primary-color);
    color: white;
    cursor: pointer;
    transition: background 0.3s ease;
    font-size: 1rem;
    margin-top: 1rem;
}

.btn:hover {
    background: var(--secondary-color);
}

.question-container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 1rem;
}

.options-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
}

.option-item {
    background-color: #f5f5f5;
    padding: 1rem;
    margin: 0.8rem 0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.option-item:hover {
    background-color: #e0e0e0;
}

.option-item.selected {
    background-color: #4CAF50;
    color: white;
}

.hint {
    font-size: 0.9rem;
    margin: 0.5rem 0;
}

.text-input-container {
    width: 100%;
    max-width: 300px;
    margin: 1rem auto;
}

.text-input-container input {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
}

.submit-multiple {
    margin-top: 1rem;
}

/* 模態框樣式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(5px);
}

.modal.show {
    opacity: 1;
}

.modal-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: transparent;
}

.close {
    position: absolute;
    right: 15px;
    top: 15px;
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.close::before {
    content: '×';
    color: white;
    font-size: 24px;
    line-height: 0;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -45%);
    padding-bottom: 2px;
}

.modal-body {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 輪播樣式 */
.carousel-slide {
    position: relative;
    width: 100%;
    height: 100%;
    display: none;
}

.carousel-slide.active {
    display: block;
}

.carousel-slide img {
    width: 100%;
    height: 75vh;
    object-fit: contain;
    margin-top: 15px;
}

/* 全局样式中的 caption */
.carousel-caption {
    position: absolute;
    bottom: 120px;
    left: 0;
    right: 0;
    width: 100%;
    padding: 10px 0;
    margin: 0;
    text-align: center;
    background: transparent;
}

.carousel-caption h2 {
    font-size: 1.1em;
    margin: 0;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.6);
    font-weight: 400;
    letter-spacing: 0.5px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.carousel-caption p {
    font-size: 0.95em;
    margin: 5px 0 0 0;
    color: rgba(255, 255, 255, 0.85);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    font-weight: 300;
    letter-spacing: 0.3px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.carousel-nav {
    position: absolute;
    top: 50%;
    width: 100%;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    pointer-events: none;
}

.carousel-button {
    background: rgba(255, 255, 255, 0.3);
    border: none;
    color: white;
    padding: 15px 20px;
    cursor: pointer;
    border-radius: 50%;
    font-size: 1.2rem;
    transition: background 0.3s ease;
    pointer-events: auto;
}

.carousel-button:hover {
    background: rgba(255, 255, 255, 0.5);
}

.carousel-dots {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 1010;
}

.carousel-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: background 0.3s ease;
}

.carousel-dot.active {
    background: white;
}

/* 響應式設計 */
@media screen and (max-width: 768px) {
    .main-header {
        padding: 1.6rem 0.8rem;
    }

    .main-header h1 {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
        letter-spacing: 0.5px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        line-height: 1.4;
    }

    .nav-tabs {
        padding: 0.5rem;
        margin: 0.3rem auto 0.8rem;
        max-width: 95%;
    }

    .tab-btn {
        padding: 0.4rem 1rem;
        font-size: 0.9rem;
    }

    .memories-container {
        gap: 10px;
        padding: 8px;
    }

    .memory-card {
        aspect-ratio: 16/10;
    }

    .memory-card-content {
        padding: 8px;
    }

    .memory-card-content h3 {
        font-size: 0.9em;
    }

    .memory-card-content p {
        font-size: 0.75em;
        margin-top: 2px;
    }

    .modal {
        padding: 0;
    }

    .modal-content {
        width: 100%;
        height: 100%;
        margin: 0;
        border-radius: 0;
        padding: 0;
    }

    .modal-body {
        padding: 0;
    }

    .carousel-container {
        position: relative;
        width: 100%;
        height: 100vh;
        background: #000;
        display: flex;
        align-items: center;
    }

    .carousel-slide {
        width: 100%;
        height: 100%;
        display: none;
        position: relative;
    }

    .carousel-slide.active {
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 0 10px;
    }

    .carousel-slide img {
        max-width: 100%;
        max-height: 75vh;
        width: auto;
        height: auto;
        object-fit: contain;
    }

    /* 普通 YouTube 视频容器 */
    .video-wrapper {
        width: 95% !important;
        max-width: 600px;
        margin: 0 auto;
        height: auto;
    }

    .video-container {
        position: relative;
        width: 100%;
        padding-top: 56.25%;
    }

    .video-container iframe {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        border: none;
    }

    /* Shorts 视频容器 */
    .video-wrapper.short-video {
        width: 95% !important;
        max-width: 450px;
        margin: 0 auto;
    }

    .video-wrapper.short-video .video-container {
        padding-top: 177.78%;
    }

    /* 导航按钮样式 */
    .carousel-button {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        width: 40px;
        height: 40px;
        background: rgba(255, 255, 255, 0.2);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        border: none;
        color: white;
        font-size: 20px;
        z-index: 10;
    }

    .carousel-button.prev {
        left: 10px;
    }

    .carousel-button.next {
        right: 10px;
    }

    /* 调整 caption 位置 */
    .carousel-caption {
        bottom: 120px;
        padding: 10px;
    }

    /* caption 文字样式微调 */
    .carousel-caption h2 {
        font-size: 1em;
        margin-bottom: 3px;
    }

    .carousel-caption p {
        font-size: 0.85em;
        opacity: 0.9;
    }

    /* 保持指示点位置不变 */
    .carousel-dots {
        position: absolute;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        display: flex;
        justify-content: center;
        gap: 8px;
        z-index: 10;
        width: auto;
    }

    .quiz-start-screen h2 {
        font-size: 1.5rem;
    }

    .difficulty-buttons {
        gap: 1rem;
        padding: 0 1rem;
    }

    .difficulty-buttons .btn {
        min-width: 140px;
        padding: 0.7rem 1.2rem;
        font-size: 0.9rem;
    }

    .quiz-note {
        padding: 0 1rem;
    }
}

@media screen and (max-width: 480px) {
    .main-header {
        padding: 1.5rem 0.6rem;
    }

    .main-header h1 {
        font-size: 1.3rem;
    }

    .nav-tabs {
        padding: 0.4rem;
    }

    .tab-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }

    .memories-container {
        grid-template-columns: 1fr;
        padding: 10px;
    }

    .memory-card {
        aspect-ratio: 16/10;
    }

    .memory-card-content {
        padding: 8px;
    }

    .memory-card-content h3 {
        font-size: 1em;
    }

    .memory-card-content p {
        font-size: 0.75em;
    }

    .carousel-slide img {
        max-height: 70vh;
    }

    .video-wrapper.short-video {
        width: 90%;
    }

    .quiz-start-screen h2 {
        font-size: 1.3rem;
        padding: 0 0.5rem;
    }

    .difficulty-buttons {
        flex-direction: column;
        gap: 0.8rem;
        align-items: center;
    }

    .difficulty-buttons .btn {
        width: 100%;
        max-width: 280px;
        min-width: unset;
        margin: 0;
        padding: 0.8rem 1rem;
    }

    /* 問題區域的RWD */
    .question-container {
        padding: 0.5rem;
    }

    .question-container h3 {
        font-size: 1.1rem;
    }

    .options-list {
        padding: 0;
    }

    .option-item {
        padding: 0.8rem;
        margin: 0.5rem 0;
        font-size: 0.9rem;
    }

    .hint {
        font-size: 0.8rem;
    }

    .text-input-container input {
        padding: 0.6rem;
        font-size: 0.9rem;
    }

    .score-detail {
        font-size: 0.8rem;
    }
}

/* 超小螢幕 */
@media screen and (max-width: 320px) {
    .main-header {
        padding: 1.5rem 0.6rem;
    }

    .main-header h1 {
        font-size: 1.1rem;
    }

    .difficulty-buttons .btn {
        font-size: 0.85rem;
        padding: 0.7rem 0.8rem;
    }
}

/* 動畫效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

/* 添加入場動畫效果 */
@keyframes floatIn {
    0% {
        transform: translateY(20px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes scaleIn {
    0% {
        transform: scale(0.9);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 朋友留言卡片樣式 */
.friend-message-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(240, 242, 245, 0.95));
    border-radius: 12px;
    padding: 2rem;
    max-width: 90%;
    width: 600px;
    margin: 0 auto;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.1), inset 0 1px 1px rgba(255, 255, 255, 0.5);
    transform-origin: center;
    perspective: 2000px;
    transform-style: preserve-3d;
    border: 1px solid rgba(255, 255, 255, 0.8);
    animation: cardFlip 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.8) 0.1em, transparent 0.1em),
        linear-gradient(90deg, rgba(255, 255, 255, 0.8) 0.1em, transparent 0.1em);
    background-size: 25px 25px;
    background-position: -1px -1px;
}

@keyframes cardFlip {
    0% {
        opacity: 0;
        transform: rotateY(180deg) scale(0.3);
    }
    40% {
        opacity: 1;
        transform: rotateY(10deg) scale(1.05);
    }
    60% {
        transform: rotateY(-5deg) scale(0.98);
    }
    80% {
        transform: rotateY(2deg) scale(1.01);
    }
    100% {
        transform: rotateY(0) scale(1);
    }
}

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

/* 添加微妙的卡片背景装饰元素 */
.friend-message-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, rgba(255,255,255,0) 70%);
    opacity: 0.5;
    pointer-events: none;
    z-index: -1;
}

/* 添加卡片边缘装饰 */
.friend-message-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, 
        rgba(103,126,234,0.3),
        rgba(118,75,162,0.6), 
        rgba(103,126,234,0.3));
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

.friend-message-header {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
    position: relative;
    animation: slideDown 0.6s ease 0.6s forwards;
    opacity: 0;
    width: 100%;
}

.friend-message-header::after {
    content: '';
    position: absolute;
    bottom: -0.75rem;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0,0,0,0.1), transparent);
    animation: expandLine 0.4s ease 0.8s forwards;
}

.friend-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.5);
    animation: popIn 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.8s forwards;
    opacity: 0;
    transform: scale(0);
    margin-right: 1rem;
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0) rotateZ(45deg);
    }
    50% {
        transform: scale(1.2) rotateZ(-5deg);
    }
    70% {
        transform: scale(0.9) rotateZ(2deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotateZ(0);
    }
}

.friend-message-header h2 {
    color: var(--text-color);
    font-size: 1.5rem;
    margin: 0;
    opacity: 0;
    animation: fadeIn 0.6s ease 0.4s forwards;
    text-shadow: 0 1px 2px rgba(0,0,0,0.05);
    flex: 1;
}

.friend-message-content {
    text-align: left;
    padding: 1.5rem;
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-color);
    animation: fadeIn 0.6s ease 0.6s forwards;
    opacity: 0;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
    margin: 0.5rem 0;
    position: relative;
    flex: 1;
    max-height: 60vh;
    overflow-y: auto;
}

.friend-message-content::-webkit-scrollbar {
    width: 6px;
}

.friend-message-content::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.03);
    border-radius: 4px;
}

.friend-message-content::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.1);
    border-radius: 4px;
}

.friend-message-content::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.2);
}

.friend-message-content p {
    margin: 0;
    position: relative;
    opacity: 0.95;
    color: rgba(50, 50, 70, 0.9);
    text-shadow: 0 1px 1px rgba(255,255,255,0.5);
    padding: 0 0.5rem;
    line-height: 1.7;
    letter-spacing: 0.01em;
    white-space: pre-wrap;
    font-family: 'Noto Sans TC', sans-serif;
}

.friend-message-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%239C92AC' fill-opacity='0.04' fill-rule='evenodd'%3E%3Ccircle cx='3' cy='3' r='3'/%3E%3Ccircle cx='13' cy='13' r='3'/%3E%3C/g%3E%3C/svg%3E");
    z-index: -1;
    opacity: 0.3;
    pointer-events: none;
    border-radius: 8px;
}

/* 模拟手写纸质卡片 */
.friend-message-card {
    position: relative;
    background-color: #f8f8f8;
}

.paper-decoration {
    position: absolute;
    right: 10px;
    top: 10px;
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, transparent 50%, rgba(0,0,0,0.03) 50%);
    border-radius: 0 0 0 4px;
}

.date-stamp {
    position: absolute;
    bottom: 15px;
    right: 20px;
    font-size: 0.8rem;
    color: rgba(0,0,0,0.4);
    font-style: italic;
}

/* 響應式設計補充 */
@media (max-width: 768px) {
    .friend-message-card {
        width: 95%;
        padding: 1.5rem;
        margin: 1rem auto;
        border-radius: 10px;
    }

    .friend-avatar {
        width: 45px;
        height: 45px;
        margin-right: 0.8rem;
    }

    .friend-message-header h2 {
        font-size: 1.3rem;
    }

    .friend-message-content {
        font-size: 1rem;
        padding: 1rem;
        line-height: 1.6;
    }
    
    .friend-message-content p {
        font-size: 0.95rem;
        line-height: 1.7;
    }
}

/* 添加缺失的动画定义 */
@keyframes slideDown {
    0% {
        opacity: 0;
        transform: translateY(-20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes expandLine {
    from {
        opacity: 0;
        width: 0;
        left: 50%;
    }
    to {
        opacity: 1;
        width: 100%;
        left: 0;
    }
}

/* 生日特效元素 */
.birthday-effects {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2000;
    overflow: hidden;
}

/* 气泡容器 */
.bubbles-container {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
}

/* 气泡效果 */
.bubble {
    position: absolute;
    border-radius: 50%;
    opacity: 0.7;
    animation: bubbleFloat 8s linear infinite;
}

@keyframes bubbleFloat {
    0% {
        transform: translateY(0) translateX(0) scale(0);
        opacity: 0;
    }
    10% {
        opacity: 0.7;
        transform: translateY(-10%) translateX(5%) scale(1);
    }
    90% {
        opacity: 0.7;
    }
    100% {
        transform: translateY(-100vh) translateX(10%) scale(0.8);
        opacity: 0;
    }
}

/* 闪光容器 */
.glitters-container {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
}

/* 闪光效果 */
.glitter {
    position: absolute;
    border-radius: 50%;
    opacity: 0;
    transform: scale(0);
    animation: glitterPulse 1s ease-in-out infinite alternate;
}

@keyframes glitterPulse {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(0.5);
        opacity: 0.5;
    }
}

/* 闪烁的星星 */
.star {
    position: absolute;
    background: white;
    animation: twinkle 2s linear infinite;
    opacity: 0.8;
    border-radius: 50%;
    box-shadow: 0 0 10px 2px white;
}

@keyframes twinkle {
    0%, 100% {
        opacity: 0.2;
        transform: scale(0.8);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* 生日文字 */
.birthday-text {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 5rem;
    font-weight: bold;
    background: linear-gradient(to right, #ff8a00, #e52e71, #ff8a00);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.4);
    animation: birthdayText 4s ease-in-out forwards, textGradient 5s linear infinite;
    opacity: 0;
    z-index: 2002;
    font-family: 'Arial', sans-serif;
    white-space: nowrap;
    will-change: transform, opacity;
}

@keyframes birthdayText {
    0% {
        transform: translate(-50%, -50px) scale(0.5);
        opacity: 0;
    }
    15% {
        transform: translate(-50%, 0) scale(1.1);
        opacity: 1;
    }
    25%, 75% {
        transform: translate(-50%, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, 50px) scale(0.8);
        opacity: 0;
    }
}

@keyframes textGradient {
    0% {
        background-position: 0% center;
    }
    100% {
        background-position: 200% center;
    }
}

/* 响应式调整 */
@media (max-width: 768px) {
    .birthday-text {
        font-size: 2.5rem;
    }
}

/* 打字机效果相关样式 */
.typewriter-text {
    white-space: pre-wrap;
    border-right: 2px solid transparent;
    animation: cursor-blink 1s step-end infinite;
    position: relative;
    min-height: 1.5em;
}

.typewriter-text.typing {
    border-right: 2px solid #555;
}

@keyframes cursor-blink {
    0%, 100% {
        border-right-color: transparent;
    }
    50% {
        border-right-color: #555;
    }
}

/* 消息内容样式优化 */
.friend-message-content p {
    margin: 0;
    position: relative;
    opacity: 0.95;
    color: rgba(50, 50, 70, 0.9);
    text-shadow: 0 1px 1px rgba(255,255,255,0.5);
    padding: 0 0.5rem;
    line-height: 1.7;
    letter-spacing: 0.01em;
    white-space: pre-wrap;
    font-family: 'Noto Sans TC', sans-serif;
}

.video-wrapper {
    position: relative;
    width: 80%;
    margin: 0 auto;
    aspect-ratio: 16/9;
}

.video-wrapper.short-video {
    width: 40%;
    aspect-ratio: 9/16;
}

.video-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.difficulty-buttons {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.difficulty-buttons .btn {
    min-width: 160px;
    padding: 0.8rem 1.5rem;
    transition: all 0.3s ease;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    margin: 0.5rem;
    flex: 1;
    max-width: 200px;
}

/* 使用紫色系的配色 */
#easy-mode {
    background: linear-gradient(135deg, #7E57C2, #5E35B1);  /* 中等深度的紫色渐变 */
    color: white;
    border: none;
}

#easy-mode:hover {
    background: linear-gradient(135deg, #6A1B9A, #4527A0);  /* 悬停时稍微深一点 */
    transform: translateY(-2px);
}

#medium-mode {
    background-color: #7E57C2;
    color: #fff;
}
#medium-mode:hover {
    background-color: #673AB7;
}

#hard-mode {
    background: linear-gradient(135deg, #673AB7, #512DA8);
    color: white;
    border: none;
}

#hard-mode:hover {
    background: linear-gradient(135deg, #512DA8, #4527A0);
    transform: translateY(-2px);
}

.quiz-note {
    font-size: 0.9em;
    color: #666;
    margin-top: 2.5rem;
    font-style: italic;
    padding: 0.5rem 0;
}

/* 當按鈕被選中時的樣式 */
.btn:active {
    transform: scale(0.95);
}

/* 結果顯示的RWD */
.quiz-result {
    text-align: center;
    padding: 2rem;
}

.quiz-result h2 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    animation: fadeIn 0.5s ease;
}

.score-animation, .final-score {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin: 2rem 0;
}

.score-number {
    font-size: 4rem;
    font-weight: bold;
    color: #7E57C2;
    font-family: 'Arial', sans-serif;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.score-text {
    font-size: 2rem;
    color: #666;
}

/* 成功和失敗的不同樣式 */
.quiz-result.success .score-number {
    color: #7E57C2;
}

.quiz-result.fail .score-number {
    color: #e57373;
}

/* 動畫效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.final-score {
    animation: pulse 1s ease infinite;
}

/* RWD 適配 */
@media screen and (max-width: 768px) {
    .score-number {
        font-size: 3.5rem;
    }
    
    .score-text {
        font-size: 1.8rem;
    }
}

@media screen and (max-width: 480px) {
    .quiz-result h2 {
        font-size: 1.5rem;
    }

    .score-number {
        font-size: 3rem;
    }
    
    .score-text {
        font-size: 1.5rem;
    }
}

.score-detail {
    font-size: 0.9rem;
    color: #666;
    margin: 0.5rem 0;
    font-style: italic;
}

@media screen and (max-width: 480px) {
    .score-detail {
        font-size: 0.8rem;
    }
}

/* 徽章基本樣式 */
.badge-container {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 2rem auto;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.badge-container.show {
    opacity: 1;
    transform: scale(1);
}

.badge-outer {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(45deg, #f3f3f3, #fff);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: rotate 20s linear infinite;
}

.badge-inner {
    width: 80%;
    height: 80%;
    border-radius: 50%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* 不同難度的徽章樣式 */
.easy-badge .badge-inner {
    background: linear-gradient(135deg, #7E57C2, #5E35B1);  /* 中等深度的紫色渐变 */
    border: 2px solid #9575CD;
}

.hard-badge .badge-inner {
    background: linear-gradient(135deg, #673AB7, #512DA8);  /* 更深的紫色 */
    border: 2px solid #7E57C2;
}

/* 徽章圖標 */
.badge-icon {
    font-size: 4rem;
    z-index: 2;
    animation: pulse 2s ease-in-out infinite;
}

/* 閃光效果 */
.badge-shine {
    position: absolute;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        rgba(255,255,255,0) 0%,
        rgba(255,255,255,0.5) 50%,
        rgba(255,255,255,0) 100%
    );
    transform: rotate(45deg);
    animation: shine 3s ease-in-out infinite;
}

/* 緞帶效果 */
.badge-ribbon {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    background: #673AB7;
    padding: 8px 20px;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.badge-title {
    color: white;
    font-size: 1rem;
    font-weight: bold;
    white-space: nowrap;
}

.congratulation-text {
    font-size: 1.2rem;
    color: #673AB7;
    margin: 1rem 0;
    font-weight: bold;
}

/* 動畫效果 */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes shine {
    0% {
        transform: translateX(-200%) translateY(-200%) rotate(45deg);
    }
    100% {
        transform: translateX(200%) translateY(200%) rotate(45deg);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

/* 難度特定的動畫效果 */
.hard-badge .badge-outer::before {
    content: '';
    position: absolute;
    width: 110%;
    height: 110%;
    border-radius: 50%;
    border: 2px solid #673AB7;
    animation: expand 2s ease-in-out infinite;
}

@keyframes expand {
    0% {
        transform: scale(0.95);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.4;
    }
    100% {
        transform: scale(0.95);
        opacity: 0.8;
    }
}

/* RWD 適配 */
@media screen and (max-width: 768px) {
    .badge-container {
        width: 150px;
        height: 150px;
    }

    .badge-icon {
        font-size: 3rem;
    }

    .badge-title {
        font-size: 0.9rem;
    }
}

@media screen and (max-width: 480px) {
    .badge-container {
        width: 120px;
        height: 120px;
    }

    .badge-icon {
        font-size: 2.5rem;
    }

    .badge-title {
        font-size: 0.8rem;
        padding: 6px 16px;
    }
}

/* 保持手機版的原始樣式，只針對大螢幕進行調整 */
@media screen and (min-width: 768px) {
    .quiz-result.success {
        /* 縮小整體結果區域的padding */
        padding: 1rem;
    }

    .final-score {
        /* 縮小分數顯示的margin */
        margin: 1rem 0;
    }

    .score-number {
        /* 縮小分數字體 */
        font-size: 3rem;
    }

    .score-text {
        /* 縮小"分"字的大小 */
        font-size: 1.5rem;
    }

    .badge-container {
        /* 縮小徽章大小 */
        width: 150px;
        height: 150px;
        margin: 1rem auto;
    }

    .badge-icon {
        /* 縮小徽章圖標 */
        font-size: 3rem;
    }

    .badge-ribbon {
        /* 調整緞帶位置 */
        bottom: -15px;
    }

    .badge-title {
        /* 調整緞帶文字 */
        font-size: 0.9rem;
        padding: 6px 16px;
    }

    .congratulation-text {
        /* 縮小祝賀文字的margin */
        margin: 0.5rem 0;
    }

    .score-detail {
        /* 縮小分數詳情的margin */
        margin: 0.3rem 0;
    }

    /* 確保按鈕不會太大 */
    .quiz-result .btn {
        padding: 0.5rem 1.5rem;
        margin-top: 0.5rem;
    }
}

/* 修改日期樣式 */
.message-date {
    opacity: 0;
    position: relative;
    font-family: 'Courier New', monospace;
    color: #666;
    text-align: right;
    margin-top: 20px;
    padding-right: 10px;
    font-size: 0.9em;
    letter-spacing: 2px;
    transform: translateY(20px);
    transition: all 0.5s ease;
}

.message-date.show {
    opacity: 1;
    transform: translateY(0);
}

.message-date::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%,
        rgba(102, 102, 102, 0.2) 50%,
        transparent 100%
    );
    animation: shine 2s infinite;
}

@keyframes shine {
    0% {
        background-position: -200% center;
    }
    100% {
        background-position: 200% center;
    }
}

/* 修改留言內容樣式 */
.message-content {
    position: relative;
    padding: 20px;
    line-height: 1.8;
    white-space: pre-wrap;
}

/* Footer 樣式 */
.site-footer {
    background-color: #f8f9fa;
    padding: 20px 0;
    text-align: center;
    margin-top: 50px;
    border-top: 1px solid #e7e7e7;
    width: 100%;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.site-footer p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

/* 隱藏記憶卡片樣式 */
.hidden-memory {
    animation: fadeInScale 0.8s ease-out;
    position: relative;
}

.hidden-memory::before {
    content: '🔓';
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 20px;
    z-index: 2;
    filter: drop-shadow(0 0 2px rgba(0,0,0,0.5));
}

/* 解鎖通知樣式 */
.unlock-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #FFD700, #FFA500);  /* 金色渐变背景 */
    color: #8B4513;  /* 深棕色文字，与金色搭配 */
    padding: 15px 25px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3),  /* 金色阴影 */
                0 0 30px rgba(255, 215, 0, 0.2);    /* 外发光效果 */
    z-index: 1000;
    animation: slideIn 1s ease-out; /* 入场动画延长到1秒 */
    border: 1px solid rgba(255, 215, 0, 0.5);  /* 淡金色边框 */
}

.unlock-notification.fade-out {
    animation: slideOut 1s ease-in forwards; /* 离场动画延长到1秒 */
}

.unlock-content h3 {
    margin: 0 0 8px 0;
    font-size: 1.1em;
    color: #8B4513;  /* 深棕色标题 */
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.5);  /* 白色文字阴影 */
}

.unlock-content p {
    margin: 0;
    font-size: 0.9em;
    color: #A0522D;  /* 稍浅的棕色文字 */
    opacity: 0.9;
}

/* 添加一个微光效果 */
.unlock-notification::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, 
        transparent 0%,
        rgba(255, 255, 255, 0.1) 45%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0.1) 55%,
        transparent 100%);
    animation: shimmer 2s infinite;
    border-radius: 10px;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    0% {
        transform: translateX(0);
        opacity: 1;
    }
    100% {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes fadeInScale {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* 問題圖片容器樣式 */
.question-image-container {
    margin: 20px auto;
    text-align: center;
    max-width: 400px;  /* 限制最大寬度 */
    width: 90%;        /* 在小屏幕上自適應 */
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.question-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;    /* 保持圖片比例 */
    border-radius: 8px;
    transition: transform 0.3s ease;
}

/* 竖向照片的特殊处理 */
.question-image.vertical {
    max-height: 500px;  /* 限制最大高度 */
    width: auto;        /* 寬度自適應 */
    max-width: 100%;    /* 確保不會超出容器 */
    margin: 0 auto;     /* 水平居中 */
}

.question-image:hover {
    transform: scale(1.02);
}

/* 移動端適配 */
@media screen and (max-width: 768px) {
    .question-image-container {
        max-width: 300px;  /* 在移動端更小一些 */
    }
    
    .question-image.vertical {
        max-height: 400px;  /* 移動端降低最大高度 */
    }
}

/* 小屏幕進一步優化 */
@media screen and (max-width: 480px) {
    .question-image.vertical {
        max-height: 350px;  /* 更小屏幕進一步降低高度 */
    }
}

/* 错误题目回顾样式 */
.wrong-questions-review {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background: var(--card-background);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.wrong-questions-review h2 {
    color: var(--text-color);
    text-align: center;
    margin-bottom: 30px;
    font-size: 1.8rem;
    font-weight: 600;
}

.wrong-question {
    margin-bottom: 30px;
    padding: 20px;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease;
}

.wrong-question:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.wrong-question h3 {
    color: #e74c3c;
    margin-bottom: 15px;
    font-size: 1.2rem;
    font-weight: 500;
    display: flex;
    align-items: center;
}

.wrong-question h3::before {
    content: "❌";
    margin-right: 8px;
    font-size: 1rem;
}

.wrong-question p {
    color: var(--text-color);
    font-size: 1.1rem;
    margin-bottom: 15px;
    line-height: 1.5;
}

.wrong-question .options-list {
    list-style: none;
    padding: 0;
    margin: 15px 0;
}

.wrong-question .option-item {
    padding: 12px 15px;
    margin: 8px 0;
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    font-size: 1rem;
    color: var(--text-color);
    background: #f8f9fa;
    transition: all 0.3s ease;
    cursor: default;
}

.wrong-question .option-item.selected {
    background-color: #fff5f5;
    border-color: #e74c3c;
    color: #e74c3c;
    position: relative;
}

.wrong-question .option-item.selected::after {
    content: "你的選擇";
    position: absolute;
    right: 15px;
    font-size: 0.85rem;
    color: #e74c3c;
    font-weight: 500;
}

.wrong-answer {
    padding: 15px;
    background-color: #fff5f5;
    border: 1px solid #e74c3c;
    border-radius: 8px;
    margin-top: 15px;
    color: #e74c3c;
    font-size: 1rem;
}

.wrong-answer p {
    margin: 0;
    color: #e74c3c;
    display: flex;
    align-items: center;
}

.wrong-answer p::before {
    content: "你的答案：";
    font-weight: 500;
    margin-right: 8px;
}

.question-image-container {
    margin: 15px 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.question-image {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

.question-image:hover {
    transform: scale(1.02);
}

#restart-quiz {
    display: block;
    width: 200px;
    margin: 30px auto 0;
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

#restart-quiz:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 响应式设计 */
@media screen and (max-width: 768px) {
    .wrong-questions-review {
        padding: 15px;
        margin: 10px;
    }

    .wrong-questions-review h2 {
        font-size: 1.5rem;
        margin-bottom: 20px;
    }

    .wrong-question {
        padding: 15px;
        margin-bottom: 20px;
    }

    .wrong-question h3 {
        font-size: 1.1rem;
    }

    .wrong-question p {
        font-size: 1rem;
    }

    .wrong-question .option-item {
        padding: 10px;
        font-size: 0.95rem;
    }

    #restart-quiz {
        width: 100%;
        margin-top: 20px;
    }
}

@media screen and (max-width: 480px) {
    .wrong-questions-review h2 {
        font-size: 1.3rem;
    }

    .wrong-question h3 {
        font-size: 1rem;
    }

    .wrong-question p {
        font-size: 0.95rem;
    }

    .wrong-question .option-item {
        padding: 8px;
        font-size: 0.9rem;
    }

    .wrong-answer {
        padding: 12px;
        font-size: 0.9rem;
    }
} 