body {
    background-color: #000;
    color: #fff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    overflow: hidden;
}

#bg-current,
#bg-next {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: -10;
    /* Transition is kept for smooth small increments, but logic will drive it */
    transition: clip-path 0.4s ease;
}

#bg-next {
    z-index: -9;
    clip-path: inset(0 100% 0 0);
    /* Initially completely hidden from the right */
}

#game-container {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 20px;
    border-radius: 20px;
    /* Optional: Container glass effect */
    /* background: rgba(255, 255, 255, 0.05); */
}

canvas {
    background-color: rgba(255, 255, 255, 0.03);
    /* White/Gray Glass */
    backdrop-filter: blur(1px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
}

#game-canvas {
    background-color: rgba(200, 200, 200, 0.15);
    /* Slightly lighter for play area */
}

.panel {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    padding: 15px;
    border-radius: 12px;
    text-align: center;
    min-width: 220px;
    /* 180pxから220pxにさらに拡大 */
    margin-bottom: 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

#ui-left {
    min-width: 300px;
    /* 250pxから300pxに拡大 */
}

.progress-container {
    width: 100%;
    margin: 15px 0;
    filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.3));
}

.gauge-bg {
    fill: rgba(0, 0, 0, 0.5);
}

.gauge-fill {
    fill: url(#gauge-gradient);
    transition: width 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Define Gradient in HTML or via CSS if supported, but SVG is better. 
   We can also use flat colors or simple fills. Let's use a nice gold color. */
.gauge-fill {
    fill: #ffd700;
    filter: drop-shadow(0 0 3px #fff);
}

.gauge-fill-level {
    fill: #00f2ff;
    transition: width 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    filter: drop-shadow(0 0 3px #fff);
}

#next-level-info {
    font-size: 0.75rem;
    color: #ccc;
    margin-top: 5px;
}

#points-to-next {
    font-weight: bold;
    color: #fff;
}

h2 {
    margin: 0 0 10px 0;
    font-size: 1.2rem;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

#score,
#level,
#max-chain,
#game-timer {
    font-size: 1.5rem;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

#ranking-list {
    text-align: left;
    padding-left: 20px;
    margin: 0;
    font-size: 0.9rem;
    list-style-type: decimal;
    color: #fff;
}

#ranking-list li {
    margin-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding-bottom: 2px;
}

.ranking-name {
    flex: 0 0 40px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ranking-score {
    flex: 1;
    text-align: right;
    font-weight: bold;
}

.ranking-chain {
    font-size: 0.75rem;
    color: #ffd700;
    margin: 0 5px;
    font-style: italic;
}

.ranking-date {
    font-size: 0.7rem;
    color: #fff;
    min-width: 75px;
    text-align: right;
}

#ranking-list li.highlight {
    color: #ffd700;
    font-weight: bold;
    animation: flash 1s infinite alternate;
}

@keyframes flash {
    from {
        opacity: 1;
    }

    to {
        opacity: 0.7;
    }
}

#next-canvas {
    background-color: rgba(255, 255, 255, 0.02);
    /* More transparent */
}

#star-container {
    font-size: 2.5rem;
    /* Slightly larger stars */
    color: #444;
    letter-spacing: 8px;
    margin-bottom: 5px;
}

#bomb-panel h2 {
    color: #ff3333;
    animation: bomb-title-pulse 2s infinite;
}

@keyframes bomb-title-pulse {
    0% {
        opacity: 0.8;
    }

    50% {
        opacity: 1;
        text-shadow: 0 0 10px #ff3333;
    }

    100% {
        opacity: 0.8;
    }
}

.star-slot.active {
    color: #ffd700;
    text-shadow: 0 0 10px #ffd700, 0 0 20px #fff;
    animation: star-pulse 1s infinite alternate;
}

@keyframes star-pulse {
    from {
        transform: scale(1);
    }

    to {
        transform: scale(1.1);
    }
}

#bomb-hint {
    font-size: 0.75rem;
    color: #ffd700;
    margin-top: 5px;
}

#bomb-effect {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 8rem;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 20px #ff0000, 0 0 40px #ffcc00;
    pointer-events: none;
    z-index: 3000;
    opacity: 0;
    transition: opacity 0.2s;
}

#bomb-effect.active {
    animation: bomb-flash 1s forwards;
}

@keyframes bomb-flash {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }

    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }

    80% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.0);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(2.0);
    }
}

#bomb-progress-bar {
    width: 0;
    height: 4px;
    background: #ff0000;
    position: absolute;
    bottom: 0;
    left: 0;
    transition: width 0.1s linear;
}

.panel {
    position: relative;
    overflow: hidden;
}

/* Utiltiy */
/* Utiltiy */
.hidden {
    visibility: hidden;
}

/* Title Screen */
#title-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('image/title.jpg') no-repeat center center fixed;
    background-size: cover;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

#title-screen h1 {
    font-size: 4rem;
    color: #fff;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8), 0 0 20px rgba(0, 100, 255, 0.8);
    margin-bottom: 50px;
    font-family: 'Comic Sans MS', sans-serif;
    /* Friendly font */
}

#start-btn {
    font-size: 2.5rem;
    padding: 20px 60px;
    border-radius: 50px;
    border: none;
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 99%, #fecfef 100%);
    color: white;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

#start-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
}

#controls-hint {
    position: fixed;
    bottom: 55px;
    /* Visitor counter is below this */
    right: 15px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    color: #ffd700;
    z-index: 1000;
    pointer-events: none;
}

#visitor-counter {
    position: fixed;
    bottom: 10px;
    right: 15px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    color: #eee;
    z-index: 1000;
    pointer-events: none;
    text-align: right;
    line-height: 1.4;
}

#visitor-counter span {
    font-weight: bold;
    color: #ffd700;
}

.toggle-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #eee;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
    width: 80px;
}

.toggle-btn.on {
    background: #ffd700;
    color: #111;
    border-color: #fff;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.toggle-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Chain Effect */
.chain-effect {
    position: fixed;
    pointer-events: none;
    z-index: 5000;
    font-weight: 900;
    text-align: center;
    white-space: nowrap;
    font-family: 'Arial Black', sans-serif;
    color: #fff;
    text-shadow:
        0 0 10px #ff00de,
        0 0 20px #ff00de,
        0 0 40px #ff00de;
    animation: chain-pop 0.8s ease-out forwards;
}

@keyframes chain-pop {
    0% {
        transform: translate(-50%, -50%) scale(0) rotate(-20deg);
        opacity: 0;
    }

    30% {
        transform: translate(-50%, -50%) scale(1.5) rotate(10deg);
        opacity: 1;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.2) rotate(-5deg);
    }

    100% {
        transform: translate(-50%, -100%) scale(1.0) rotate(0deg);
        opacity: 0;
    }
}

.chain-explosion {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.8) 0%, rgba(255, 0, 222, 0.4) 50%, transparent 70%);
    transform: translate(-50%, -50%) scale(0);
    border-radius: 50%;
    z-index: -1;
    animation: explosion-bloom 0.8s ease-out forwards;
}

@keyframes explosion-bloom {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }

    50% {
        opacity: 0.8;
    }

    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}