/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

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

/* 导航栏 */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    padding: 15px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    font-size: 24px;
    font-weight: bold;
    color: #667eea;
    text-decoration: none;
}

.navbar-menu {
    display: flex;
    gap: 20px;
    list-style: none;
}

.navbar-menu a {
    color: #333;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 5px;
    transition: background 0.3s;
}

.navbar-menu a:hover {
    background: #667eea;
    color: white;
}

/* 卡片容器 */
.card {
    background: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

/* 按钮 */
.btn {
    display: inline-block;
    padding: 12px 24px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    text-decoration: none;
    transition: all 0.3s;
}

.btn:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #6c757d;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: #dc3545;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-success {
    background: #28a745;
}

.btn-success:hover {
    background: #218838;
}

/* 表单 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 消息提示 */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ========== 卡牌网格 ========== */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 24px;
    margin-top: 20px;
    justify-items: center;
}

/* ========== 游戏卡牌样式 ========== */
.game-card {
    width: 200px;
    height: 300px;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    border: 3px solid #555;
    background: #1a1a2e;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.game-card:hover {
    transform: translateY(-8px) scale(1.03);
    box-shadow: 0 12px 30px rgba(0,0,0,0.4);
}

/* 稀有度边框颜色 */
.game-card.rarity-border-N  { border-color: #8E8E8E; }
.game-card.rarity-border-R  { border-color: #5C9BD1; }
.game-card.rarity-border-SR { border-color: #C77DD8; box-shadow: 0 4px 15px rgba(199,125,216,0.3); }
.game-card.rarity-border-SSR { border-color: #FFD700; box-shadow: 0 4px 20px rgba(255,215,0,0.4); }
.game-card.rarity-border-UR  { border-color: #FF1493; box-shadow: 0 4px 20px rgba(255,20,147,0.4); }

.game-card.rarity-border-SSR:hover { box-shadow: 0 12px 35px rgba(255,215,0,0.5); }
.game-card.rarity-border-UR:hover  { box-shadow: 0 12px 35px rgba(255,20,147,0.5); }

/* 金色卡牌动画 */
.game-card.golden-card {
    animation: card-golden-glow 2s ease-in-out infinite;
}

@keyframes card-golden-glow {
    0%, 100% { box-shadow: 0 0 20px rgba(255, 215, 0, 0.5); }
    50% { box-shadow: 0 0 35px rgba(255, 215, 0, 0.8); }
}

/* 卡牌图片区域 */
.game-card-art {
    width: 100%;
    height: 180px;
    overflow: hidden;
    position: relative;
    background: #16213e;
}

.game-card-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* 无图片占位：渐变+首字 */
.game-card-art-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 72px;
    font-weight: bold;
    color: rgba(255,255,255,0.8);
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.placeholder-N  { background: linear-gradient(135deg, #4a4a4a, #7a7a7a); }
.placeholder-R  { background: linear-gradient(135deg, #2a5c8e, #5C9BD1); }
.placeholder-SR { background: linear-gradient(135deg, #6a2d8e, #C77DD8); }
.placeholder-SSR { background: linear-gradient(135deg, #8B6914, #FFD700, #DAA520); }
.placeholder-UR  { background: linear-gradient(135deg, #8B0A50, #FF1493, #FF69B4); }

/* 稀有度角标 */
.game-card-rarity {
    position: absolute;
    top: 6px;
    left: 6px;
    padding: 2px 10px;
    border-radius: 10px;
    color: white;
    font-size: 11px;
    font-weight: bold;
    z-index: 2;
    letter-spacing: 1px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* 卡牌信息区域 */
.game-card-info {
    padding: 8px 10px;
    background: linear-gradient(180deg, #1a1a2e 0%, #0f0f23 100%);
    height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.game-card-name {
    font-size: 15px;
    font-weight: bold;
    color: #e0e0e0;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

/* 卡牌属性标签 */
.game-card-tags {
    display: flex;
    justify-content: center;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.game-card-tag {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 8px;
    color: #ccc;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
}

/* 卡牌战斗数值 */
.game-card-stats {
    display: flex;
    justify-content: space-around;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 6px;
}

.game-card-stat {
    text-align: center;
}

.game-card-stat-label {
    font-size: 9px;
    color: #888;
    text-transform: uppercase;
}

.game-card-stat-value {
    font-size: 14px;
    font-weight: bold;
    color: #e0e0e0;
}

.game-card-stat-value.atk { color: #ff6b6b; }
.game-card-stat-value.def { color: #51cf66; }
.game-card-stat-value.hp  { color: #4dabf7; }

/* 卡牌底部信息（等级、技能） */
.game-card-footer {
    font-size: 10px;
    color: #888;
    text-align: center;
    padding-top: 2px;
}

/* 未拥有卡牌蒙层 */
.game-card.not-owned {
    opacity: 0.5;
    filter: grayscale(70%);
}

.game-card.not-owned:hover {
    opacity: 0.7;
    filter: grayscale(40%);
}

.game-card-owned-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 8px;
    z-index: 2;
    font-weight: bold;
}

.game-card-owned-badge.owned {
    background: rgba(40, 167, 69, 0.9);
    color: white;
}

.game-card-owned-badge.not-owned-text {
    background: rgba(0, 0, 0, 0.6);
    color: #aaa;
}

/* 旧版兼容 - card-item 保留基础支持 */
.card-item {
    background: white;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

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

.card-item.golden {
    background: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
    animation: card-golden-glow 2s ease-in-out infinite;
}

.card-item.golden::before {
    content: '\2605 金色 \2605';
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 215, 0, 0.9);
    color: #000;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: bold;
}

.card-rarity {
    display: inline-block;
    padding: 5px 15px;
    border-radius: 15px;
    color: white;
    font-weight: bold;
    margin-bottom: 10px;
}

.card-name {
    font-size: 20px;
    font-weight: bold;
    margin: 15px 0;
}

.card-stats {
    display: flex;
    justify-content: space-around;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.stat {
    text-align: center;
}

.stat-label {
    font-size: 12px;
    color: #666;
}

.stat-value {
    font-size: 18px;
    font-weight: bold;
    color: #667eea;
}

/* 稀有度颜色 */
.rarity-N { background: #8E8E8E; }
.rarity-R { background: #5C9BD1; }
.rarity-SR { background: #C77DD8; }
.rarity-SSR { background: #FFD700; color: #333; }
.rarity-UR { background: #FF1493; }

/* 资源显示 */
.resources {
    display: flex;
    gap: 30px;
    justify-content: center;
    margin: 20px 0;
}

.resource-item {
    background: white;
    padding: 15px 30px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.resource-label {
    font-size: 14px;
    color: #666;
}

.resource-value {
    font-size: 28px;
    font-weight: bold;
    color: #667eea;
}

/* 抽卡按钮区域 */
.gacha-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin: 30px 0;
}

.gacha-btn {
    padding: 20px 40px;
    font-size: 18px;
    font-weight: bold;
}

/* 抽卡结果 */
.gacha-result {
    display: none;
    margin-top: 30px;
}

.gacha-result.show {
    display: block;
    animation: fadeIn 0.5s;
}

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

/* 战斗日志 */
.battle-log {
    background: white;
    border-radius: 10px;
    padding: 20px;
    max-height: 500px;
    overflow-y: auto;
    font-family: monospace;
    margin-top: 20px;
}

.battle-log-entry {
    padding: 8px;
    margin: 5px 0;
    border-radius: 5px;
}

.log-start { background: #d4edda; color: #155724; }
.log-round { background: #cce5ff; color: #004085; font-weight: bold; }
.log-attack { background: #fff3cd; color: #856404; }
.log-skill { background: #f8d7da; color: #721c24; font-weight: bold; }
.log-defeat { background: #d6d8db; color: #383d41; }
.log-victory { background: #d4edda; color: #155724; font-weight: bold; }

/* 3D卡牌效果 */
.card-3d {
    perspective: 1000px;
}

.card-3d-inner {
    position: relative;
    width: 100%;
    height: 300px;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.card-3d:hover .card-3d-inner {
    transform: rotateY(10deg) rotateX(5deg);
}

/* 响应式 */
@media (max-width: 768px) {
    .card-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 16px;
    }

    .game-card {
        width: 160px;
        height: 250px;
    }

    .game-card-art {
        height: 145px;
    }

    .game-card-info {
        height: 105px;
        padding: 6px 8px;
    }

    .game-card-art-placeholder {
        font-size: 56px;
    }

    .gacha-buttons {
        flex-direction: column;
    }

    .resources {
        flex-direction: column;
        gap: 15px;
    }
}
