* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background:
        linear-gradient(180deg,
            #0f172a 0%,
            #020617 100%);

    color: white;

    font-family:
        "Segoe UI",
        sans-serif;

    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    min-height: 100vh;
}

.game-wrapper {
    width: 100%;
    max-width: 48vh;
    padding: 1.5vh;
}

.game-frame {
    background:
        rgba(255, 255, 255, 0.05);

    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 0 30px rgba(0, 229, 255, .15);
}

/* ===== HUD ===== */

.hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.4vh 1.5vh;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.hud-group {
    display: flex;
    gap: 1.9vh;
}

.info {
    display: flex;
    flex-direction: column;
}

.label {
    font-size: 0.9vh;
    color: #94a3b8;
    letter-spacing: 2px;
}

.value {
    font-size: 1.5vh;
    font-weight: 700;
    color: #00e5ff;
    text-shadow: 0 0 10px rgba(0, 229, 255, .7);
}

.score-progress {
    width: 7.5vh;
    height: 0.5vh;
    margin-top: 8px;
    background:
        rgba(255, 255, 255, .08);

    border-radius: 999px;
    overflow: hidden;
}

.score-progress-fill {
    width: 0%;
    height: 100%;
    border-radius: 999px;
    background:
        linear-gradient(90deg,
            #00e5ff,
            #0099ff);

    box-shadow:
        0 0 10px rgba(0, 229, 255, .7);

    transition:
        width .2s ease;
}

.icon-btn {
    width: 4vh;
    height: 4vh;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    color: white;
    font-size: 1.9vh;
    background: rgba(255, 255, 255, .08);
    transition: .2s;
}

.icon-btn:hover {
    transform: translateY(-2px);
    background: rgba(0, 229, 255, .2);
    box-shadow: 0 0 15px rgba(0, 229, 255, .4);
}

.hud-actions {
    display: flex;
    gap: 10px;
}

.power-btn {
    color: #0077ff;
    text-shadow: 0 0 10px rgba(66, 99, 245, .6);
}

.power-btn:hover {
    background: rgba(66, 135, 245, .15);
    box-shadow: 0 0 15px rgba(66, 135, 245, .35);
    color: #5f7cfa;
}

#settingsButton:hover {
    transform: scale(1.1) rotate(90deg);
}

/* ===== Canvas ===== */
.canvas-container {
    position: relative;
    padding: 0.9vh;
}

#gameCanvas {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 18px;
    background: #111827;
}

#luckyCanvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

#slotCanvas {
    position: absolute;
    /* top: 0;
    left: 0; */
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    /* 操作はgameCanvasへ通す */
}

/* ===== Bottom ===== */
.bottom-panel {
    padding: 1.4vh;
}

/* ---------- PC ---------- */
#pcControls {
    display: flex;
    flex-direction: column;
    gap: 0.6vh;
}

.key-row {
    display: flex;
    justify-content: space-between;
    font-size: 1vh;
    padding: 0.8vh 1.2vh;
    border-radius: 12px;
    background: rgba(255, 255, 255, .05);
}

.key-row span:first-child {
    color: #00e5ff;
    font-weight: bold;
}

/* ---------- スマホ ---------- */
#mobileControls {
    display: none;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.control-btn {
    border: none;
    border-radius: 16px;
    color: white;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    background: rgba(255, 255, 255, .08);
    box-shadow: 0 0 15px rgba(0, 229, 255, .2);
    transition: .15s;
}

.control-btn:active {
    transform: scale(.95);
}

.launch-btn {
    width: 50px;
    height: 70px;
}

.addBall-btn {
    width: 50px;
    height: 70px;
}

.flipper-group {
    display: flex;
    gap: 15px;
}

.flipper-group button {
    width: 50px;
    height: 70px;
}

/* ---------- スマホ切替 ---------- */
@media (max-width:768px) {
    #pcControls {
        display: none;
    }

    #mobileControls {
        display: flex;
    }
}

/* ===== Setting ===== */
.settings-modal {
    position: fixed;
    inset: 0;
    display: none;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, .65);
    backdrop-filter: blur(6px);
    z-index: 1000;
}

.settings-modal.show {
    display: flex;
}

.settings-panel {
    width: 90%;
    max-width: 44vh;
    max-height: 80vh;
    overflow-y: auto;
    background: rgba(15, 23, 42, .95);
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 24px;
    padding: 2vh;
    box-shadow: 0 0 40px rgba(0, 229, 255, .25);
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2vh;
}

.settings-header h2 {
    color: #00e5ff;
}

.close-btn {
    width: 3vh;
    height: 3vh;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    background: rgba(255, 255, 255, .08);
    color: white;
    font-size: 1.5vh;
}

.settings-section {
    margin-bottom: 4vh;
}

.settings-section h3 {
    margin-bottom: 1vh;
    color: #00e5ff;
}

.key-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.key-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

kbd {
    padding: 0.5vh 1vh;
    border-radius: 8px;
    background: #1e293b;
    border: 0.1vh solid rgba(255, 255, 255, .15);
    color: #00e5ff;
}

.help-text {
    margin-top: 1vh;
    display: flex;
    flex-direction: column;
    gap: 1vh;
    color: #cbd5e1;
}

/* Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 4.5vh;
    height: 2.5vh;
}

.switch input {
    display: none;
}

.slider {
    position: absolute;
    inset: 0;
    cursor: pointer;
    background: #334155;
    border-radius: 999px;
    transition: .2s;
}

.slider::before {
    content: "";
    position: absolute;
    width: 2vh;
    height: 2vh;
    left: 0.3vh;
    top: 0.3vh;
    border-radius: 50%;
    background: white;
    transition: .2s;
}

input:checked+.slider {
    background: #00e5ff;
}

input:checked+.slider::before {
    transform: translateX(2.1vh);
}

a:link {
  color: #0066cc;
}