.game-ui {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 2rem;
}

.health-bar-container {
    flex: 1;
}

.health-bar-wrapper {
    height: 30px;
    background-color: #1e293b;
    border: 2px solid var(--glass-border);
    border-radius: 15px;
    overflow: hidden;
    position: relative;
}

.health-bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #10b981, #34d399);
    transition: width 0.05s ease-out;
}

.health-bar.enemy {
    background: linear-gradient(90deg, #ef4444, #f87171);
}

.sub-bar-container {
    display: flex;
    gap: 8px;
    margin-top: 5px;
    width: 60%;
}

.shield-bar-container,
.dash-bar-container {
    flex: 1;
    position: relative;
    height: 8px;
}

.shield-bar-wrapper,
.dash-bar-wrapper {
    height: 100%;
    background-color: #0f172a;
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    overflow: hidden;
}

.shield-bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #67e8f9, #22d3ee);
    transition: width 0.2s ease;
}

.dash-bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #a855f7, #c084fc);
    transition: width 0.1s linear;
}

.bow-ammo-container {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 100%;
}

.bow-ammo-icon-wrapper {
    position: relative;
    width: 18px;
    height: 18px;
    background-color: #000;
    /* 減っている時の背景色（黒） */
    clip-path: polygon(50% 0%, 100% 50%, 75% 50%, 75% 100%, 25% 100%, 25% 50%, 0% 50%);
}

.bow-ammo-icon-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* JSで制御 */
    background-color: #3b82f6;
    /* 青色塗りつぶし */
    transition: height 0.1s linear;
}

.bow-ammo-text {
    color: #cbd5e1;
    font-size: 14px;
    font-weight: bold;
    font-family: monospace;
}

.break-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #f43f5e;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 1px;
    text-shadow: 0 0 5px rgba(244, 63, 94, 0.5);
    white-space: nowrap;
    z-index: 5;
}

.player-name {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
}

.vs-text {
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

.canvas-container {
    position: relative;
    width: 100%;
    background: #0f172a;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

canvas {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1000 / 400;
}

.game-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    background: rgba(15, 23, 42, 0.9);
    padding: 3rem;
    border-radius: 20px;
    border: 1px solid var(--primary);
    backdrop-filter: blur(10px);
    z-index: 100;
}

.game-message h2 {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    font-family: 'Outfit', sans-serif;
}

.hidden {
    display: none;
}

.controls-info {
    display: flex;
    gap: 2rem;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.controls-info h3 {
    font-size: 1.1rem;
    border-right: 1px solid var(--glass-border);
    padding-right: 1.5rem;
}

/* Mobile Controls */
.mobile-controls {
    display: none;
    position: fixed;
    bottom: 30px;
    left: 20px;
    right: 20px;
    justify-content: space-between;
    align-items: flex-end;
    z-index: 1000;
    pointer-events: none;
}

.d-pad,
.action-btns {
    display: flex;
    gap: 15px;
    pointer-events: auto;
}

.d-pad {
    display: grid;
    grid-template-areas:
        ". up ."
        "left . right";
    gap: 10px;
}

.action-btns {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.ctrl-btn {
    width: 65px;
    height: 65px;
    background: rgba(30, 41, 59, 0.7);
    border: 2px solid rgba(165, 180, 252, 0.4);
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    user-select: none;
    touch-action: manipulation;
    backdrop-filter: blur(5px);
    transition: background 0.2s, transform 0.1s;
}

.ctrl-btn:active {
    background: rgba(99, 102, 241, 0.9);
    transform: scale(0.9);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .container {
        padding: 0.5rem !important;
    }

    .game-ui {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
        margin-bottom: 0.5rem;
    }

    .health-bar-container {
        min-width: 140px;
    }

    .vs-text {
        font-size: 1.2rem;
        order: -1;
        width: 100%;
        text-align: center;
    }

    #game-timer {
        font-size: 1.5rem;
        order: -1;
    }

    .health-bar-wrapper {
        height: 18px;
    }

    .mobile-controls {
        display: flex;
        padding-bottom: constant(safe-area-inset-bottom);
        padding-bottom: env(safe-area-inset-bottom);
    }

    .controls-info {
        display: none;
    }

    nav {
        margin-bottom: 0.5rem;
        padding: 0.5rem 1rem;
    }

    .logo {
        font-size: 1rem;
    }

    .canvas-container {
        border-radius: 10px;
    }

    /* リザルト画面のモバイル調整 */
    .game-message {
        width: 85%;
        padding: 1.5rem;
    }

    .game-message h2 {
        font-size: 1.8rem;
        margin-bottom: 1rem;
    }

    .game-message .btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }
}

.key-history-container {
    position: absolute;
    top: 100px;
    right: 20px;
    width: 150px;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(165, 180, 252, 0.3);
    border-radius: 12px;
    backdrop-filter: blur(8px);
    z-index: 50;
    padding: 0.75rem;
    pointer-events: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.key-history-container.hidden {
    display: none;
}

.key-history-header {
    font-size: 0.75rem;
    font-weight: 800;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    padding-bottom: 0.25rem;
}

.key-history-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.key-item {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    color: #fff;
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    animation: key-slide-in 0.2s ease-out forwards;
}

@keyframes key-slide-in {
    from {
        opacity: 0;
        transform: translateX(10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}