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

body {
    font-family: 'Arial', sans-serif;
    background-color: #121212;
    color: #f0f0f0;
    line-height: 1.6;
    -webkit-text-size-adjust: 100%; /* 防止 iOS 横屏时文字自动放大 */
}

header {
    text-align: center;
    padding: 40px 20px 10px;
    margin-bottom: 5px;
    background-color: transparent;
    box-shadow: none;
}

header h1 {
    margin: 0;
    font-size: 1.6rem;
    color: #e0e0e0;
}

header p {
    margin: 1rem 0 0;
    color: #666;
    font-size: clamp(0.9rem, 3vw, 1rem);
}

@media (max-width: 768px) {
    header {
        padding: 35px 15px 10px;
    }

    header h1 {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    header {
        padding: 30px 10px 8px;
    }

    header h1 {
        font-size: 1.4rem;
    }
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

.section-title {
    margin: 2rem 0 1rem;
    padding-bottom: 0.5rem;
    color: #e0e0e0;
    font-size: clamp(1.2rem, 4vw, 1.5rem);
}

.card-section {
    display: grid;
    grid-template-columns: repeat(10, 1fr); /* 固定为10列，与您的布局一致 */
    grid-auto-rows: auto;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.card-section::after {
    content: "";
    display: block;
    grid-column: 1 / -1;
    height: 0;
}

/* 雷诺曼牌特定布局 */
.lenormand-grid {
    grid-template-columns: repeat(6, 1fr);
}

@media (max-width: 1200px) {
    .card-section {
        grid-template-columns: repeat(8, 1fr);
    }
}

@media (max-width: 992px) {
    .card-section {
        grid-template-columns: repeat(6, 1fr);
    }
}

@media (max-width: 768px) {
    .card-section {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .lenormand-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 480px) {
    .card-section {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .card {
        display: flex;
        flex-direction: column;
        height: 100%;
    }
    
    .card img {
        flex-grow: 1;
        object-position: center;
    }
    
    .lenormand-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.card {
    cursor: pointer;
    border-radius: 10px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background-color: #2a2a2a;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.card img {
    width: 100%;
    height: auto;
    display: block;
    aspect-ratio: 2/3;  /* Standard tarot/card ratio */
    object-fit: contain;
}

.card-title {
    padding: 0.8rem;
    text-align: center;
    font-size: clamp(0.8rem, 3vw, 0.9rem);
    background-color: #2a2a2a;
    color: #e0e0e0;
    min-height: 4rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.card-title div:first-child {
    margin-bottom: 0.3rem;
}

/* Modal Styles */
.card-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    overflow-y: auto;
}

.modal-content {
    position: relative;
    background-color: #2a2a2a;
    margin: 2rem auto;
    width: 95%;
    max-width: 1000px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    animation: modalFadeIn 0.3s;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close-button {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    z-index: 10;
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    background-color: transparent;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-button:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.1);
}

.modal-body {
    display: flex;
    flex-direction: column;
    padding: 2rem;
}

@media (min-width: 768px) {
    .modal-body {
        flex-direction: row;
        gap: 2rem;
    }
    
    .modal-image-container {
        flex: 0 0 300px;
        margin-bottom: 0;
    }
}

.modal-image-container {
    text-align: center;
    margin-bottom: 1.5rem;
}

.modal-image-container img {
    max-width: 300px;
    max-height: 500px;
    width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: none;
    aspect-ratio: 2/3;
    object-fit: contain;
}

.modal-info {
    flex: 1;
}

.modal-info h2 {
    margin-bottom: 1rem;
    color: #e0e0e0;
    text-align: center;
    line-height: 1.4;
}

.modal-info h2 div:first-child {
    margin-bottom: 0.3rem;
}

.modal-description {
    margin-bottom: 1.5rem;
    line-height: 1.8;
    color: #d0d0d0;
}

.description-content {
    margin-bottom: 2rem;
}

.description-en {
    margin-bottom: 1rem;
    color: #d0d0d0;
}

.description-zh {
    color: #e0e0e0;
}

.card-attributes {
    margin: 1.5rem 0;
    padding: 0;
    background-color: transparent;
    border-radius: 0;
}

.attribute-section {
    margin-bottom: 1.5rem;
}

.attribute-section h3 {
    color: #e0e0e0;
    font-size: 0.85rem;
    margin-bottom: 0.8rem;
}

.attribute-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.attribute {
    margin: 0.5rem 0;
    color: #e0e0e0;
    font-size: clamp(0.85rem, 3vw, 0.95rem);
}

.attribute-list .attribute {
    background-color: #3a3a3a;
    color: #d0d0d0;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    margin: 0;
    font-size: 0.9rem;
    white-space: nowrap;
}

.attribute-label {
    color: #888;
    margin-right: 0.5rem;
}


footer {
    text-align: center;
    padding: 1.5rem;
    background-color: #1e1e1e;
    margin-top: 2rem;
    font-size: clamp(0.9rem, 3vw, 1rem);
}

footer a {
    color: #e0e0e0;
    text-decoration: none;
    transition: color 0.3s ease;
}

footer a:hover {
    color: #fff;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .modal-content {
        margin: 1rem;
        width: calc(100% - 2rem);
    }

    .modal-body {
        padding: 1rem;
    }

    .modal-image-container img {
        max-width: 100%;
        height: auto;
        aspect-ratio: 2/3;
        object-fit: contain;
    }

    .close-button {
        top: 5px;
        right: 10px;
    }
}

@media (max-width: 480px) {
    .card-attributes {
        padding: 0;
        margin: 0.8rem 0;
    }
    
    .attribute-section {
        padding: 0;
    }
    
    .attribute-section h3 {
        padding: 0;
        margin-bottom: 0.8rem;
    }
    
    .modal-description {
        padding: 0;
    }
}

/* 适配刘海屏 */
@supports (padding: max(0px)) {
    .modal-content {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }
}

/* 处理长按图片的默认行为 */
img {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* 优化触摸体验 */
@media (hover: none) {
    .card:hover {
        transform: none;
    }

    .card:active {
        transform: scale(0.98);
    }
}

/* Filter Styles */
.filter-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1rem 0;
    align-items: center;
}

.deck-type {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.lenormand-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    justify-content: center;
}

.lenormand-filters .filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    justify-content: center;
}

.filter-row .filter-option {
    width: auto;
}

.filter-row .filter-text {
    width: auto;
    text-align: center;
}

.tarot-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    justify-content: center;
}

.filter-option {
    position: relative;
    cursor: pointer;
}

.filter-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.filter-text {
    display: block;
    padding: 0.3rem 0.6rem;
    background-color: #2a2a2a;
    color: #888;
    border-radius: 20px;
    font-size: 0.75rem;
    transition: all 0.3s ease;
}

.filter-option input[type="radio"]:checked + .filter-text {
    background-color: #3a3a3a;
    color: #e0e0e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Card number badge for Lenormand */
.card.lenormand .card-number {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    background-color: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    z-index: 1;
}

@media (hover: hover) {
    .filter-text:hover {
        background-color: #3a3a3a;
        color: #e0e0e0;
    }
}

@media (max-width: 480px) {
    .filter-section {
        gap: 0.8rem;
    }

    .deck-type, .tarot-filters {
        gap: 0.5rem;
    }

    .filter-text {
        padding: 0.25rem 0.4rem;
        font-size: 0.7rem;
    }
}

/* 优化触摸体验 */
@media (hover: none) {
    .filter-text:active {
        transform: scale(0.95);
    }
}

.floating-home-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: #fff;
    padding: 12px 20px;
    border-radius: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    text-decoration: none;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s, box-shadow 0.2s;
    z-index: 1000;
}

.floating-home-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.home-icon {
    font-size: 20px;
}

.button-text {
    font-size: 16px;
}

/* 针对移动设备的响应式设计 */
@media (max-width: 768px) {
    .floating-home-button {
        bottom: 20px;
        right: 20px;
        padding: 10px 16px;
    }
    
    .button-text {
        font-size: 14px;
    }
}

/* 导航菜单样式 */
.nav-menu {
    position: fixed;
    top: 15px;
    right: 15px;
    display: flex;
    background-color: #2a2a2a;
    border-radius: 20px;
    padding: 3px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    gap: 3px;
}

.nav-item {
    padding: 5px 12px;
    color: #e0e0e0;
    text-decoration: none;
    border-radius: 15px;
    font-size: 13px;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.nav-item:hover {
    background-color: #3a3a3a;
    transform: translateY(-1px);
}

.nav-item.active {
    background-color: #4a4a4a;
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

@media (max-width: 768px) {
    .nav-menu {
        top: 8px;
        right: 8px;
        padding: 2px;
    }

    .nav-item {
        padding: 4px 10px;
        font-size: 12px;
    }

    header {
        padding-top: 3rem;
    }
}

@media (max-width: 480px) {
    .nav-menu {
        top: 6px;
        right: 6px;
        padding: 2px;
    }

    .nav-item {
        padding: 3px 8px;
        font-size: 11px;
    }

    header {
        padding-top: 2.5rem;
    }
} 