:root {
    --primary-color: #e8a2a2;
    --secondary-color: #c3aed6;
    --text-dark: #433c4c;
    --text-light: #ffffff;
    --background: #e6d5d5;
    --card-shadow: 0 4px 20px rgba(232, 162, 162, 0.25);
}

body {
    background: linear-gradient(135deg, var(--background-color) 0%, #ffffff 100%);
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.page-title {
    color: var(--primary-color);
    text-align: center;
    font-size: 24px;
    margin: 40px 0;
    cursor: pointer;
    user-select: none;  /* 防止文字被选中 */
    transition: opacity 0.2s;
}

.page-title:hover {
    opacity: 0.8;
}

.cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 25px;
    padding: 20px;
    max-width: 1000px;
    margin: 0 auto;
}

.card {
    height: 320px;
    position: relative;
    z-index: 1;
    perspective: 1000px;
}

/* 根据卡片位置设置不同的翻转原点 */
.card:nth-child(odd) .card-inner {
    transform-origin: 50% 50%; /* 奇数卡片从中间翻转 */
}

.card:nth-child(even) .card-inner {
    transform-origin: 50% 50%; /* 偶数卡片从中间翻转 */
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s;
    transform-style: preserve-3d;
    cursor: pointer;
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
}

.card-front {
    background: white;
}

.card-front img {
    width: 100%;
    height: 55%;
    object-fit: cover;
}

.card-label {
    padding: 15px;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    color: white;
    height: 45%;
}

.card-label h3 {
    margin: 0 0 8px 0;
    font-size: 1.3em;
}

.card-label p {
    margin: 0;
    opacity: 0.9;
}

.card-back {
    background: white;
    transform: rotateY(180deg);
    padding: 30px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-radius: 0 0 12px 12px;
}

.card-back h4 {
    color: var(--primary-color);
    margin: 0 0 20px 0;
    font-size: 1.3em;
    text-align: center;
}

.card-back ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.card-back li {
    padding: 15px 0;
    border-bottom: 1px solid #eee;
    color: var(--text-color);
}

.card-back li i {
    margin-right: 10px;
    color: var(--primary-color);
}

.card-front .card-header {
    background: var(--primary-color);
    padding: 20px;
    border-radius: 12px 12px 0 0;
    height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .container {
        padding: 15px 10px;
    }

    .page-title {
        font-size: 1.8em;
        margin-bottom: 30px;
    }

    .cards-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        padding: 15px;
    }
    
    .card {
        width: 100%;
        margin: 0;
        font-size: 14px;
    }

    .card:last-child {
        margin-bottom: 20px;
    }

    .card-front .card-header,
    .card-back {
        width: 100%;
        box-sizing: border-box;
    }

    .card-inner {
        transform-style: flat;
    }

    .card-front, .card-back {
        position: static;
        width: 100%;
        height: auto;
        backface-visibility: visible;
        -webkit-backface-visibility: visible;
    }

    .card-back {
        transform: none;
        display: block;
        border-radius: 0 0 12px 12px;
    }

    .card-front {
        border-radius: 12px 12px 0 0;
    }

    .card-front img {
        height: 160px;
    }

    .card-label h3 {
        font-size: 1.2em;
    }

    .card-back h4 {
        font-size: 1.1em;
        margin-bottom: 15px;
    }

    .card-back li {
        padding: 8px 0;
    }

    /* 调整弹窗样式 */
    .modal-content {
        width: 90%;
        margin: 20px auto;
        max-height: 90vh;
    }

    .card-front .card-header {
        padding: 15px;
        height: 90px;
    }

    .card-front h3 {
        font-size: 1.2em;
        margin-bottom: 5px;
    }

    .card-front p {
        font-size: 0.9em;
    }

    .card-back {
        padding: 15px;
    }

    .card-back h4 {
        font-size: 1.1em;
        margin-bottom: 15px;
    }

    .card-back li {
        padding: 8px 0;
    }
}

/* 添加暗色模式支持 */
@media (prefers-color-scheme: dark) {
    :root {
        --background-color: #1a1a1a;
        --text-color: #ffffff;
    }

    body {
        background: linear-gradient(135deg, var(--background-color) 0%, #2d2d2d 100%);
    }

    .card-front, .card-back {
        background: #2d2d2d;
    }

    .card-back li {
        border-bottom-color: #3d3d3d;
        color: #ffffff;
    }

    .card.active .card-back {
        background: #2d2d2d;
        border-top-color: #3d3d3d;
    }
}

/* 桌面端卡片翻转效果 */
@media (min-width: 769px) {
    .card:hover {
        z-index: 2;
    }

    .card-inner {
        position: relative;
        width: 100%;
        height: 100%;
        transition: transform 0.8s;
        transform-style: preserve-3d;
        cursor: pointer;
    }

    /* 奇数卡片向右翻转 */
    .card:nth-child(odd):hover .card-inner {
        transform: rotateY(-180deg);
    }

    /* 偶数卡片向左翻转 */
    .card:nth-child(even):hover .card-inner {
        transform: rotateY(180deg);
    }

    .card-front, .card-back {
        position: absolute;
        width: 100%;
        height: 100%;
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
    }

    .card-back {
        transform: rotateY(180deg);
        background: white;
    }
}

/* 添加链接样式 */
.card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.card-link:hover {
    text-decoration: none;
}

/* 密码验证对话框样式 */
.password-dialog {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.password-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    width: 300px;
}

.password-content h2 {
    margin: 0 0 20px 0;
    color: var(--text-dark);
    text-align: center;
}

.password-content input {
    width: 100%;
    padding: 10px;
    margin-bottom: 20px;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-sizing: border-box;
}

.dialog-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.dialog-buttons button {
    padding: 8px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.dialog-buttons button:first-child {
    background: var(--primary-color);
    color: white;
}

.dialog-buttons button:last-child {
    background: #eee;
    color: var(--text-dark);
}

/* 暗色模式 */
@media (prefers-color-scheme: dark) {
    .password-content {
        background: #2d2d2d;
    }

    .password-content h2 {
        color: #fff;
    }

    .password-content input {
        background: #3d3d3d;
        border-color: #4d4d4d;
        color: #fff;
    }

    .dialog-buttons button:last-child {
        background: #3d3d3d;
        color: #fff;
    }
} 