/* ========================================
   卡牌组件样式
   圆角矩形card，包含：角色名、角色图、技能、属性
   ======================================== */

.card {
    width: 120px;
    min-height: 200px;
    border: 2px solid var(--color-border);
    border-radius: 10px;
    background: var(--color-surface);
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    cursor: grab;
    transition: transform 0.15s, box-shadow 0.15s;
    position: relative;
    overflow: visible;
}

.card:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.card:active {
    cursor: grabbing;
}

/* ========================================
   等级背景特效
   ======================================== */

/* Lv.4-6：边框微弱光晕 */
.card-lv-glow {
    box-shadow: 0 0 8px var(--quality-color, rgba(76,175,80,0.3)), inset 0 0 6px rgba(255,255,255,0.03);
}
.card-lv-glow::before {
    content: '';
    position: absolute;
    top: -1px; left: -1px; right: -1px; height: 3px;
    background: linear-gradient(90deg, transparent, var(--quality-color, #4CAF50), transparent);
    border-radius: 10px 10px 0 0;
    animation: glow-sweep 2s ease-in-out infinite;
}

/* Lv.7-9：脉动光晕 */
.card-lv-pulse {
    box-shadow: 0 0 12px var(--quality-color, rgba(33,150,243,0.4)), inset 0 0 8px rgba(255,255,255,0.05);
    animation: lv-pulse 2s ease-in-out infinite;
}

/* Lv.10+：金色辉光 */
.card-lv-radiant {
    box-shadow: 0 0 20px rgba(255,215,0,0.5), 0 0 40px rgba(255,215,0,0.2), inset 0 0 10px rgba(255,215,0,0.05);
    animation: lv-radiant 3s ease-in-out infinite;
}

@keyframes glow-sweep {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

@keyframes lv-pulse {
    0%, 100% { box-shadow: 0 0 12px var(--quality-color, rgba(33,150,243,0.4)); }
    50% { box-shadow: 0 0 20px var(--quality-color, rgba(33,150,243,0.6)); }
}

@keyframes lv-radiant {
    0%, 100% { box-shadow: 0 0 20px rgba(255,215,0,0.5), 0 0 40px rgba(255,215,0,0.2); }
    50% { box-shadow: 0 0 30px rgba(255,215,0,0.7), 0 0 60px rgba(255,215,0,0.3); }
}

/* ----- 卡牌头部：种族名 + 名称 + 职业名 ----- */
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
}

.card-race-name,
.card-class-name {
    font-size: 13px;
    font-weight: bold;
    padding: 1px 4px;
    border-radius: 3px;
    background: rgba(255,255,255,0.08);
    flex-shrink: 0;
    white-space: nowrap;
}

.card-name {
    font-size: 13px;
    font-weight: bold;
    flex: 1;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ----- 卡牌中央信息区：种族变体名 + 名称（换行） ----- */
.card-info-center {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 4px 0;
}

.card-info-name {
    font-size: 17px;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* ----- 属性区域 ----- */
.card-attributes {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.attr-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    padding: 1px 4px;
}

.attr-label {
    color: var(--color-text-dim);
}

.attr-value {
    color: var(--color-text);
    font-weight: bold;
}

/* 奖励属性行（半神智力、肉盾力量）金色强调 */
.bonus-attr .attr-label {
    color: #FFD700;
}
.bonus-attr .attr-value {
    color: #FFD700;
}

/* ----- 技能区域 ----- */
.card-skills {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    min-height: 18px;
}

.skill-tag {
    font-size: 10px;
    font-weight: bold;
    padding: 1px 5px;
    border-radius: 3px;
    background: rgba(233, 69, 96, 0.2);
    color: var(--color-primary);
    white-space: nowrap;
}

.skill-tag.empty {
    background: transparent;
    color: var(--color-text-dim);
    font-style: italic;
    display: block;
    text-align: center;
    width: 100%;
}

/* 主动技能靠左，被动技能靠右 */
.active-skill {
    margin-right: auto;
}

.passive-skill {
    margin-left: auto;
}

/* ----- 卡牌底部：等级 ----- */
.card-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 10px;
    margin-top: -3px;
    padding: 0;
}

.card-level {
    color: var(--color-text);
    font-size: 13px;
    font-weight: bold;
}

/* ========================================
   卡牌堆叠样式 - 蜘蛛纸牌式层叠
   ======================================== */

/* 堆叠容器 */
.card-stack {
    position: relative;
    width: 100%;
}

/* 堆叠中的单张卡牌 */
.stacked-card {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stacked-card:hover {
    transform: translateX(2px) scale(1.02);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

/* 堆叠中非顶部卡牌的视觉效果 */
.stacked-card:not(:last-child) {
    cursor: pointer;
}

/* ========================================
   怪物卡牌样式 - 暗红色调，独立组件
   尺寸与角色卡牌一致：120px × 200px
   ======================================== */

.monster-card {
    width: 120px;
    min-height: 200px;
    border: 2px solid #8B0000;
    border-radius: 10px;
    background: linear-gradient(145deg, #1a0a0a, #2d1515);
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 8px rgba(139, 0, 0, 0.3);
}

.monster-card:hover {
    box-shadow: 0 0 16px rgba(139, 0, 0, 0.5);
}

/* 怪物卡牌头部 */
.monster-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1px 4px;
    gap: 2px;
}

.monster-card-race {
    font-size: 13px;
    font-weight: bold;
    padding: 1px 4px;
    border-radius: 3px;
    background: rgba(255,255,255,0.08);
    flex-shrink: 0;
    white-space: nowrap;
}

.monster-card-class {
    font-size: 13px;
    font-weight: bold;
    padding: 1px 4px;
    border-radius: 3px;
    background: rgba(255,255,255,0.08);
    flex-shrink: 0;
    white-space: nowrap;
}

.monster-card-label {
    font-size: 10px;
    font-weight: bold;
    color: #8B0000;
    padding: 1px 4px;
    border-radius: 3px;
    background: rgba(139, 0, 0, 0.15);
}

/* 怪物卡牌中央信息区 */
.monster-card-info {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 4px 0;
}

.monster-card-type-label {
    font-size: 18px;
    font-weight: bold;
    color: #8B0000;
}

.monster-card-name {
    font-size: 17px;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* 战斗模式的名称区域 */
.monster-card-name-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--color-text-dim);
}

/* 属性区域 */
.monster-card-attributes {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.monster-attr-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    padding: 1px 4px;
}

.monster-attr-label {
    color: var(--color-text-dim);
}

.monster-attr-value {
    color: var(--color-text);
    font-weight: bold;
}

/* 技能区域 */
.monster-card-skills {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    min-height: 18px;
}

.monster-skill-tag {
    font-size: 10px;
    font-weight: bold;
    padding: 1px 5px;
    border-radius: 3px;
    background: rgba(233, 69, 96, 0.2);
    color: var(--color-primary);
    white-space: nowrap;
}

.monster-skill-tag.empty {
    background: transparent;
    color: var(--color-text-dim);
    font-style: italic;
    display: block;
    text-align: center;
    width: 100%;
}

/* 怪物卡牌底部 */
.monster-card-footer {
}

.monster-card-type {
    color: #8B0000;
    font-size: 10px;
}

/* 堆叠拖拽组 */
.drag-group {
    display: flex;
    flex-direction: column;
    pointer-events: none;
    filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.5));
}

.drag-group .stacked-card {
    position: absolute !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    opacity: 0.92;
}

/* 堆叠计数徽章 */
.stack-count-badge {
    font-family: var(--font-main);
    pointer-events: none;
}

/* 格子内的堆叠（战斗模式） */
.cell-stack {
    width: 100%;
    height: 100%;
}

.cell-stack .stacked-card {
    width: 100% !important;
    height: 100% !important;
    border-radius: 4px;
}

/* 堆叠拆分动画 */
@keyframes stackSplit {
    0%   { transform: translateY(0); opacity: 1; }
    50%  { transform: translateY(-10px); opacity: 0.8; }
    100% { transform: translateY(0); opacity: 1; }
}

.stacked-card.splitting {
    animation: stackSplit 0.3s ease;
}

/* 堆叠合并动画 */
@keyframes stackMerge {
    0%   { transform: scale(0.95); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

.stacked-card.merged {
    animation: stackMerge 0.25s ease;
}

/* ========================================
   技能卡牌样式
   尺寸与角色卡牌一致(120x200)，独立展示，不可拖拽
   ======================================== */

.skill-card {
    width: 120px;
    height: 200px;
    min-height: 200px;
    max-height: 200px;
    border: 2px solid;
    border-radius: 10px;
    background: var(--color-surface);
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    overflow: hidden;
    transition: transform 0.15s, box-shadow 0.15s;
    cursor: default;
    pointer-events: auto;
}

.skill-card:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.skill-card-header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px 4px;
    border-radius: 4px;
    flex-shrink: 0;
}

.skill-card-type {
    font-size: 11px;
    font-weight: bold;
    padding: 1px 8px;
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.25);
    flex-shrink: 0;
}

.skill-card-quality-badge {
    font-size: 11px;
    font-weight: bold;
    padding: 1px 5px;
    border-radius: 3px;
    flex-shrink: 0;
    white-space: nowrap;
}

.skill-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 2px 0;
}

.skill-card-name {
    font-size: 15px;
    font-weight: bold;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.skill-card-divider {
    width: 50%;
    height: 1px;
    margin: 2px 0;
}

.skill-card-desc {
    font-size: 11px;
    color: var(--color-text-dim);
    text-align: center;
    line-height: 1.35;
    padding: 0 2px;
}

.skill-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 4px;
    border-top: 1px solid var(--color-border);
    font-size: 9px;
    flex-shrink: 0;
}

.skill-card-level {
    color: var(--color-text);
    font-weight: bold;
    font-size: 11px;
}

.skill-card-meta {
    display: flex;
    gap: 4px;
    align-items: center;
}

.skill-card-effect {
    color: var(--color-text-dim);
    font-style: italic;
}

.skill-card-value {
    color: var(--color-primary);
    font-weight: bold;
}

/* 战斗进行时技能卡牌不受影响 */
.battle-active .skill-card {
    pointer-events: auto !important;
}

/* ========================================
   物品卡牌样式
   尺寸与角色卡牌一致(120x200)，可拖拽交互
   展示：物品名称（品质颜色）、物品简介、物品数量
   ======================================== */

.item-card {
    width: 120px;
    height: 200px;
    min-height: 200px;
    max-height: 200px;
    border: 2px solid;
    border-radius: 10px;
    background: var(--color-surface);
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    overflow: hidden;
    transition: transform 0.15s, box-shadow 0.15s;
    cursor: grab;
    pointer-events: auto;
}

.item-card:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.item-card:active {
    cursor: grabbing;
}

.item-card-header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px 4px;
    border-radius: 4px;
    flex-shrink: 0;
}

.item-card-type {
    font-size: 11px;
    font-weight: bold;
    padding: 1px 8px;
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.25);
    flex-shrink: 0;
}

.item-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 2px 0;
}

.item-card-name {
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.item-card-divider {
    width: 40%;
    height: 1px;
    margin: 2px 0;
}

.item-card-desc {
    font-size: 11px;
    color: var(--color-text-dim);
    text-align: center;
    line-height: 1.35;
    padding: 0 4px;
}

.item-card-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2px 4px;
    border-top: 1px solid var(--color-border);
    flex-shrink: 0;
}

.item-card-quantity {
    color: var(--color-text);
    font-weight: bold;
    font-size: 12px;
}

/* 战斗进行时物品卡牌不受影响 */
.battle-active .item-card {
    pointer-events: auto !important;
}

/* ========================================
   确认对话框样式
   ======================================== */

.confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.confirm-box {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 24px 28px;
    min-width: 320px;
    max-width: 420px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.confirm-message {
    font-size: 14px;
    line-height: 1.6;
    color: var(--color-text);
    white-space: pre-line;
    margin-bottom: 20px;
    text-align: center;
}

.confirm-buttons {
    display: flex;
    justify-content: center;
    gap: 16px;
}

.confirm-btn {
    padding: 8px 28px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font-main);
}

.confirm-btn-ok {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
    font-weight: bold;
}

.confirm-btn-ok:hover {
    opacity: 0.9;
}

.confirm-btn-cancel {
    background: transparent;
    color: var(--color-text);
}

.confirm-btn-cancel:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}
