@font-face {
    font-family: 'Kards数字复合字体';
    src: url('fonts/Kards数字复合字体.ttf') format('ttf');
}

@font-face {
    font-family: 'Kards文字复合字体Bold';
    src: url('fonts/Kards文字复合字体Bold.ttf') format('ttf');
}

@font-face {
    font-family: 'Kards文字复合字体Regular';
    src: url('fonts/Kards文字复合字体Regular.ttf') format('ttf');
}

html, body {
    overflow: hidden; /* 禁止页面滚动 */
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Kards文字复合字体Regular', Arial, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: #2f2f2f;
    background-image: url('assets/background.jpg');
    background-size: cover;
    transform-origin: center center;
    transform: scale(1);
    padding-top: 0;
}

.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    position: relative;
    left: 0;
    transform: none;
    margin: 0 auto;
    transform: scale(0.6);
}

.card {
    width: 500px;
    height: 704px;
    border-radius: 15px;
    padding: 20px;
    background-color: #fff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    position: relative;
    background-image: url('assets/模板.png');
    background-size: cover;
    overflow: hidden;
    transform-style: preserve-3d;
    transition: 
        transform 0.6s cubic-bezier(0.18, 0.89, 0.32, 1.28),
        box-shadow 0.6s ease;
    backface-visibility: hidden;
    will-change: transform, box-shadow;
    perspective: 1000px;
}

.card img {
    width: 100%;
    height: auto;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

.card .unit-type-image {
    z-index: 1;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 6px 12px 12px rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: 
        opacity 0.6s cubic-bezier(0.18, 0.89, 0.32, 1.28),
        transform 0.6s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    pointer-events: none;
    z-index: 4;
}

.card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 120%;
    background: linear-gradient(
        226deg,
        rgba(255, 255, 255, 0.4) 0%,
        rgba(255, 255, 255, 0.4) 35%,
        rgba(255, 255, 255, 0.2) 42%,
        rgba(255, 255, 255, 0) 60%
    );
    transform: translateY(-20%);
    transition: transform 0.6s cubic-bezier(0.18, 0.9, 0.58, 1);
    pointer-events: none;
    z-index: 5;
}

.card:hover::before {
    opacity: 0.3;
    transform: rotateX(7deg) translateY(-6px) scale(1.05);
}

.card:hover::after {
    transform: translateY(0%);
}

.card h2 {
    text-align: center;
    font-size: 40px;
    margin: 5px 0 0 0;
    position: relative;
    z-index: 3;
    font-family: 'Kards文字复合字体Bold', sans-serif;
    color: #bec1af;
}

.card .cost-fuel {
    position: absolute;
    top: 30px;
    left: 30px;
    display: flex;
    align-items: flex-end;
    gap: 5px;
    z-index: 4;
    font-family: 'Kards数字复合字体', sans-serif;
}

.cost-value {
    font-size: 50px;
    line-height: 1;
    color: #bec1af;
}

.fuel-value {
    font-size: 25px;
    line-height: 1;
    color: #bec1af;
    position: relative;
    top: -2px;
}

.card .unit-stats {
    position: absolute;
    bottom: 165px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    z-index: 3;
}

.card .unit-stats .attack,
.card .unit-stats .defense {
    position: absolute;
    bottom: 0;
    width: 120px;
    text-align: center;
    font-size: 40px;
    color: #c8cdbb;
    font-family: 'Kards数字复合字体', sans-serif;
}

.card .unit-stats .attack {
    left: 75px;
}

.card .unit-stats .defense {
    right: 75px;
}

.card .unit-stats .unit-name {
    display: none;
}

.card .unit-stats p {
    margin: 0 5px;
}

.card .unit-type {
    display: none;
    left: 50%;
    transform: translateX(-50%);
    font-size: 18px;
    font-weight: bold;
    font-family: 'Kards数字复合字体', sans-serif;
}

.card .attributes {
    text-align: center;
    margin: 2px 0;
    font-size: 20px;
    color: #4e4e49;
    font-weight: bold;
    font-family: 'Kards文字复合字体Bold', sans-serif;
}

.card .effects {
    text-align: center;
    font-size: 20px;
    color: #0a0a0f;
    margin-top: 5px;
    font-family: 'Kards数字复合字体', sans-serif;
}

.wheel {
    margin-top: 20px;
}

.button-container {
    display: flex;
    gap: 15px;
    width: 500px; /* 与卡牌同宽 */
    margin-top: 25px;
    padding: 10px;
}

button {
    flex: 1;
    padding: 15px 25px;
    font-weight: bold;
    font-family: 'Kards文字复合字体Bold', sans-serif;
    font-size: 20px;
    letter-spacing: 1px;
    background: linear-gradient(rgba(255,255,255,0.1), rgba(0,0,0,0.1));
    border: 1px solid rgba(255,255,255,0.2);
    color: #e0e0e0;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    transition: 
        transform 0.2s ease,
        box-shadow 0.2s ease,
        filter 0.2s ease;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    filter: brightness(1.1);
}

button.save-btn {
    background: linear-gradient(#676f52, #848f68);
}

button:active {
    transform: translateY(1px);
    filter: brightness(0.9);
}

.info-container {
    position: absolute;
    bottom: 10px;
    left: 10px;
    right: 10px;
    height: 130px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    z-index: 3;
}

.attributes, .effects {
    margin: 2px 0;
    font-size: 16px;
    line-height: 1.3;
    text-align: center;
    flex-shrink: 0;
    word-break: break-all;
    color: #4e4e49;
    max-width: 90%;
    min-height: 20px;
    border-bottom: 1px dashed #ccc;
    position: relative;
    z-index: 4;
}

.attributes:not(:focus):empty, 
.effects:not(:focus):empty {
    display: none;
}

[contenteditable="true"]:empty::before {
    content: attr(data-placeholder);
    color: #999;
    font-style: italic;
}

[contenteditable="true"]:focus {
    outline: 2px solid #4a90e2;
    background: rgba(74, 144, 226, 0.1);
}

.unit-display-container {
    position: absolute;
    top: 100px;
    left: 14px;
    right: 14px;
    height: 460px;
    z-index: 1;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.unit-display {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    position: absolute;
    min-width: 100%;
    min-height: 100%;
    top: 50%;
    left: 50%;
}

/* 确保现有图片层级更高 */
.card img:not(.unit-display) {
    z-index: 2;
}

img {
    user-select: none;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    pointer-events: none;
}

.download-prompt {
    font-size: 20px;
    color: #999;
    text-align: center;
    font-family: 'Kards文字复合字体Regular', sans-serif;
    animation: pulse 2s infinite;
    opacity: 0.8;
}

@keyframes pulse {
    0% { opacity: 0.8; }
    50% { opacity: 0.5; }
    100% { opacity: 0.8; }
}