h1 {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.info-icon {
    position: relative;
    display: inline-block;
    cursor: pointer;
    font-size: 24px;
    margin-left: 10px;
    color: #666;
    transition: color 0.3s ease;
}

.info-icon:hover {
    color: #000;
}

.popup {
    display: none;
    position: fixed;
    width: 320px;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    pointer-events: auto;
    transition: opacity 0.2s ease;
    opacity: 0;
}

.popup.visible {
    opacity: 1;
}

.instruction {
    padding: 10px;
}

.instruction p {
    margin: 10px 0;
    font-size: 16px;
    line-height: 1.5;
    color: #333;
}


.popup-content {
    position: relative;
    padding: 20px;
    border-radius: 10px;
    animation: popupAppear 0.2s ease;
}

@keyframes popupAppear {
    from {
        transform: translateY(-10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close-btn {
    position: absolute;
    right: 15px;
    top: 10px;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.close-btn:hover {
    color: #000;
}

.demo-lamps {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 15px 0;
    padding: 10px;
    background-color: #f5f5f5;
    border-radius: 8px;
}

.demo-lamp.red:after {
    content: '赤';
}

.demo-lamp.yellow:after {
    content: '黄';
}

.demo-lamp.blue:after {
    content: '青';
}

.demo-lamp.yellow.second-flash {
    animation: demoYellowTwice 3s infinite;
}

.demo-lamp.blue.third-flash {
    animation: demoBlue 3s infinite;
}

@keyframes demoYellowTwice {
    0%, 100% {
        background-color: rgba(255, 255, 0, 0.05);
        box-shadow: none;
    }
    15%, 25% {
        background-color: #ffff00;
        box-shadow: 0 0 30px rgba(255, 255, 0, 0.8),
                    inset 0 0 20px rgba(255, 255, 255, 0.6);
    }
    35%, 45% {
        background-color: #ffff00;
        box-shadow: 0 0 30px rgba(255, 255, 0, 0.8),
                    inset 0 0 20px rgba(255, 255, 255, 0.6);
    }
    30%, 50%, 100% {
        background-color: rgba(255, 255, 0, 0.05);
        box-shadow: none;
    }
}

@keyframes demoBlue {
    0%, 50% {
        background-color: rgba(0, 0, 255, 0.05);
        box-shadow: none;
    }
    65%, 75% {
        background-color: #0000ff;
        box-shadow: 0 0 30px rgba(0, 0, 255, 0.8),
                    inset 0 0 20px rgba(255, 255, 255, 0.6);
    }
    85%, 100% {
        background-color: rgba(0, 0, 255, 0.05);
        box-shadow: none;
    }
}

.demo-lamp {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid #333;
    background-color: transparent;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #000;
    font-size: 14px;
}

.demo-lamp.first-yellow:after,
.demo-lamp.second-yellow:after {
    content: '黄';
}

.demo-lamp.blue:after {
    content: '青';
}

.demo-button {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    box-shadow:
        0 8px 16px rgba(0, 0, 0, 0.2),
        0 4px 4px rgba(0, 0, 0, 0.1),
        inset 0 2px 3px rgba(255, 255, 255, 0.3);
    transform: translateY(-4px);
}

.demo-button.red {
    background-color: #ff0000;
    color: white;
}
.demo-button.red:after { content: '赤'; }

.demo-button.yellow {
    background-color: #ffff00;
    color: black;
}
.demo-button.yellow:after { content: '黄'; }

.demo-button.blue {
    background-color: #0000ff;
    color: white;
}
.demo-button.blue:after { content: '青'; }

.demo-button-press {
    position: relative;
    height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin: 15px 0;
    padding: 10px;
    background-color: #f5f5f5;
    border-radius: 8px;
}

.demo-buttons {
    display: flex;
    gap: 15px;
    align-items: center;
}

.demo-button {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    position: relative;
}

.demo-button.yellow { background-color: #ffff00; }
.demo-button.blue { background-color: #0000ff; }

.demo-button.yellow.second-flash {
    animation: demoButtonPressTwice 3s infinite;
    animation-delay: 1.65s;
}

.demo-button.blue.third-flash {
    animation: demoButtonPress 3s infinite;
    animation-delay: 2.45s;
}

@keyframes demoButtonPressTwice {
    0%, 100% {
        transform: translateY(-8px);
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3),
                   0 6px 6px rgba(0, 0, 0, 0.2),
                   inset 0 2px 3px rgba(255, 255, 255, 0.3);
        opacity: 1;
    }
    5%, 10% {
        transform: translateY(4px);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2),
                   inset 0 1px 2px rgba(255, 255, 255, 0.2);
        opacity: 0.9;
    }
    15%, 20% {
        transform: translateY(-8px);
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3),
                   0 6px 6px rgba(0, 0, 0, 0.2),
                   inset 0 2px 3px rgba(255, 255, 255, 0.3);
        opacity: 1;
    }
    25%, 30% {
        transform: translateY(4px);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2),
                   inset 0 1px 2px rgba(255, 255, 255, 0.2);
        opacity: 0.9;
    }
    35%, 100% {
        transform: translateY(-8px);
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3),
                   0 6px 6px rgba(0, 0, 0, 0.2),
                   inset 0 2px 3px rgba(255, 255, 255, 0.3);
        opacity: 1;
    }
}

.demo-hand {
    position: absolute;
    font-size: 36px;
    top: 10px;
    animation: demoHandMove 3s infinite;
}

@keyframes demoButtonPress {
    0%, 100% {
        transform: translateY(-8px);
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3),
                   0 6px 6px rgba(0, 0, 0, 0.2),
                   inset 0 2px 3px rgba(255, 255, 255, 0.3);
        opacity: 1;
    }
    5%, 25% {
        transform: translateY(4px);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2),
                   inset 0 1px 2px rgba(255, 255, 255, 0.2);
        opacity: 0.9;
    }
    15%, 35% {
        transform: translateY(-8px);
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3),
                   0 6px 6px rgba(0, 0, 0, 0.2),
                   inset 0 2px 3px rgba(255, 255, 255, 0.3);
        opacity: 1;
    }
}

@keyframes demoHandMove {
    0%, 50% { transform: translateX(0) translateY(0); }
    55%, 60% { transform: translateX(0) translateY(50px); }
    65% { transform: translateX(0) translateY(0); }
    70%, 75% { transform: translateX(0) translateY(50px); }
    80% { transform: translateX(0) translateY(0); }
    85%, 90% { transform: translateX(65px) translateY(50px); }
    95%, 100% { transform: translateX(0) translateY(0); }
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    text-align: center;
}

.mode-selection {
    margin: 20px 0;
}

.mode-btn {
    padding: 10px 20px;
    margin: 0 10px;
    font-size: 18px;
    cursor: pointer;
}

.game-area {
    margin-top: 30px;
}

.lamps {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
}

.lamp {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    transition: all 0.2s ease;
    border: 3px solid #333;
    background-color: #444;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #000;
    font-size: 20px;
}

.lamp.red {
    background-color: rgba(255, 0, 0, 0.05);
    box-shadow: none;
}

.lamp.yellow {
    background-color: rgba(255, 255, 0, 0.05);
    box-shadow: none;
}

.lamp.blue {
    background-color: rgba(0, 0, 255, 0.05);
    box-shadow: none;
}

.lamp.red.active {
    background-color: #ff0000;
    box-shadow: 0 0 30px rgba(255, 0, 0, 0.8),
                inset 0 0 20px rgba(255, 255, 255, 0.6);
}

.lamp.yellow.active {
    background-color: #ffff00;
    box-shadow: 0 0 30px rgba(255, 255, 0, 0.8),
                inset 0 0 20px rgba(255, 255, 255, 0.6);
}

.lamp.blue.active {
    background-color: #0000ff;
    box-shadow: 0 0 30px rgba(0, 0, 255, 0.8),
                inset 0 0 20px rgba(255, 255, 255, 0.6);
}

.buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
}

#change-mode {
    margin-top: 20px;
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    transition: background-color 0.2s;
}

#change-mode:hover {
    background-color: #e0e0e0;
}

.game-btn {
    width: 150px;
    height: 150px;
    font-size: 36px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: white;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 10px 20px rgba(0, 0, 0, 0.3),
        0 6px 6px rgba(0, 0, 0, 0.2),
        inset 0 2px 3px rgba(255, 255, 255, 0.3),
        inset 0 -2px 3px rgba(0, 0, 0, 0.3);
    transform: translateY(-8px);
}

.game-btn:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(
        circle at 30% 30%,
        rgba(255, 255, 255, 0.3) 0%,
        rgba(255, 255, 255, 0) 50%,
        rgba(0, 0, 0, 0.1) 50%,
        rgba(0, 0, 0, 0.2) 100%
    );
    border-radius: 50%;
}

.game-btn:after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(
        circle at 70% 70%,
        rgba(0, 0, 0, 0.1) 0%,
        rgba(0, 0, 0, 0.2) 100%
    );
    border-radius: 50%;
}

.game-btn:active {
    transform: translateY(4px);
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.2),
        inset 0 2px 3px rgba(0, 0, 0, 0.3),
        inset 0 -1px 2px rgba(0, 0, 0, 0.3);
}

.game-btn.red {
    background-color: #ff0000;
}

.game-btn.yellow {
    background-color: #ffff00;
    color: black;
}

.game-btn.blue {
    background-color: #0000ff;
}

.timer {
    font-size: 24px;
    margin-top: 20px;
}

/* 結果メッセージ用 */
#result-message {
  margin: 20px 0 10px 0;
  color: #333;
}

/* ボタン配置用 */
.button-group {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
} 