@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@900&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Zen+Tokyo+Zoo&display=swap");

body {
    margin: 0;
    overflow: hidden;
    font-family: "Noto Sans TC", sans-serif;
    touch-action: none;
    user-select: none;
    /* 新增的動畫背景 */
    background: linear-gradient(270deg, #0f0c29, #302b63, #24243e, #8a0e0e);
    background-size: 400% 400%;
    animation: WarzoneBackground 15s ease infinite;
}

/* 新增的背景動畫 Keyframes */
@keyframes WarzoneBackground {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

#ui-layer {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    width: 100%;
    pointer-events: none;
}

#debug-panel {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
    text-align: left;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.5);
    padding: 10px;
    border-radius: 5px;
}

/* 查克拉槽樣式 (橫式左下) */
#chakra-container {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 300px; /* 寬度 */
    height: 25px; /* 高度 */
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid #4488ff;
    border-radius: 12px; /* 稍微圓角 */
    overflow: hidden;
    z-index: 10;
    box-shadow: 0 0 15px rgba(0, 100, 255, 0.3);
    /* 稍微傾斜增加速度感 */
    transform: skew(-15deg);
}

#chakra-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%; /* 初始值 */
    background: linear-gradient(to right, #0044aa, #00ccff); /* 橫向漸層 */
    box-shadow: 0 0 20px #00ccff;
    transition: width 0.1s linear; /* 改為寬度動畫 */
}

#chakra-label {
    position: absolute;
    bottom: 50px; /* 放在槽上方 */
    left: 20px;
    color: #00ccff;
    font-weight: bold;
    letter-spacing: 2px;
    font-size: 1.2rem;
    text-shadow: 0 0 5px #00ccff;
    font-family: "Zen Tokyo Zoo", sans-serif;
}

.status-badge {
    background: rgba(0, 0, 0, 0.85);
    border-left: 6px solid var(--theme-color, #0ff);
    color: #fff;
    padding: 15px 50px;
    font-size: 1.8rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 4px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.6);
    transition: all 0.2s;
    clip-path: polygon(10% 0, 100% 0, 100% 100%, 0% 100%);
    text-shadow: 0 0 15px var(--theme-color, #0ff);
}

.controls-hint {
    display: flex;
    gap: 20px;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    background: rgba(0, 0, 0, 0.8);
    padding: 10px 25px;
    border-radius: 4px;
    border: 1px solid #444;
}

.input_video {
    display: none;
}

#loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #0ff;
    font-size: 1.5rem;
    font-weight: bold;
    text-align: center;
    z-index: 20;
    background: rgba(0, 0, 0, 0.9);
    padding: 30px;
    border: 1px solid #0ff;
    box-shadow: 0 0 30px #0ff;
    transition: opacity 0.5s;
}

/* 低查克拉警示 */
.low-chakra {
    border-color: #ff0000 !important;
    box-shadow: 0 0 20px #ff0000 !important;
}
.low-chakra #chakra-bar {
    background: linear-gradient(to right, #550000, #ff0000) !important;
    box-shadow: 0 0 20px #ff0000 !important;
}

/* --- Battle UI Styles --- */
#battle-ui {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    z-index: 15;
    pointer-events: none;
    font-family: "Noto Sans TC", sans-serif;
}

.player-hud,
.opponent-hud {
    width: 40%;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px;
    border-radius: 8px;
    border: 2px solid #555;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
}

.opponent-hud {
    border-color: #c93434;
}

.player-hud {
    border-color: #3482c9;
}

.name {
    color: #fff;
    font-weight: 900;
    letter-spacing: 2px;
    margin-bottom: 5px;
    text-shadow: 0 0 5px #000;
}

.hp-bar-container {
    width: 100%;
    height: 20px;
    background: #222;
    border-radius: 5px;
    overflow: hidden;
    border: 1px solid #111;
}

.hp-bar {
    width: 100%;
    height: 100%;
    transition: width 0.3s ease-in-out;
}

#player-hp-bar {
    background: linear-gradient(to right, #0088ff, #00ffff);
    box-shadow: 0 0 10px #00ffff;
}

#opponent-hp-bar {
    background: linear-gradient(to right, #ff4444, #ff9999);
    box-shadow: 0 0 10px #ff4444;
}

.hp-value {
    color: #fff;
    font-size: 0.9rem;
    font-weight: bold;
    text-align: right;
    margin-top: 3px;
}

.hidden {
    display: none !important;
}

/* --- Casting Bar Styles --- */
#casting-container {
    position: absolute;
    bottom: 150px;
    left: 50%;
    transform: translateX(-50%);
    width: 400px;
    z-index: 12;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
#casting-label {
    color: #fff;
    font-size: 1.2rem;
    font-weight: bold;
    text-shadow:
        0 0 5px #000,
        0 0 10px #000;
}
.casting-bar-bg {
    width: 100%;
    height: 15px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid #888;
    border-radius: 8px;
    padding: 2px;
}
#casting-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(to right, #ffe400, #ff8c00);
    border-radius: 5px;
    transition: width 0.05s linear;
}
