/* ---------- 9.7 HOW TO PLAY 画面 ---------- */

#howto-overlay {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 150;
    padding: 14px;
    box-sizing: border-box;
    opacity: 0;
    transition: opacity 0.5s ease;
}

/* 共通 overlay-bg を使う前提 */

.howto-container {
    position: relative;
    z-index: 2;
    display: flex;
    width: min(94vw, 920px);
    align-items: stretch;
    margin-top: 4px;
    gap: 16px;
}

.howto-panel {
    flex: 1;
    padding: 12px 12px;
    border-radius: 3px;
    border: 1px solid rgba(120,255,255,0.18);
    background:
        linear-gradient(
            to bottom,
            rgba(10, 24, 34, 0.72),
            rgba(4, 10, 18, 0.90)
        );
    box-shadow:
        0 0 30px rgba(0,255,255,0.08),
        inset 0 0 24px rgba(120,255,255,0.04);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    text-align: left;
}

.howto-panel:first-child {
    flex: 1.2;
}

.howto-panel:last-child {
    flex: 1;
}

.howto-title {
    color: #d8ffff;
    border-bottom: 1px solid rgba(0,255,255,0.45);
    padding-bottom: 6px;
    margin-top: 0;
    text-shadow: 0 0 10px rgba(0,255,255,0.35);
}

.control-group {
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.control-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.icon-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: calc(72px * var(--ui-scale, 1));
    min-width: calc(72px * var(--ui-scale, 1));
    margin-right: calc(10px * var(--ui-scale, 1));
    color: #0ff;
}

.control-icon {
    width: calc(56px * var(--ui-scale, 1));
    height: calc(26px * var(--ui-scale, 1));
    margin-bottom: 4px;
    filter: drop-shadow(0 0 5px rgba(0,255,255,0.45));
}

.device-label {
    font-size: calc(9px * var(--ui-scale, 1));
    color: #7ed8e0;
    letter-spacing: 0.08em;
}

.control-desc {
    color: #ccd8de;
    font-size: calc(11px * var(--ui-scale, 1));
}

.lbl,
.lbl-y {
    display: inline-block;
    width: calc(42px * var(--ui-scale, 1));
    font-weight: bold;
}

.lbl {
    color: #0ff;
}

.lbl-y {
    color: #ffde4a;
}

.keyboard-icon {
    color: #00ffff;
    filter: drop-shadow(0 0 8px rgba(0,255,255,0.7));
}

.key-group rect,
.key-space {
    fill: rgba(0,255,255,0.15);
    stroke: currentColor;
    stroke-width: 1px;
}

.wasd-keys rect {
    fill: rgba(0,255,255,0.30);
}

.arrow-keys rect {
    color: #ff00ff;
    fill: rgba(255,0,255,0.30);
    filter: drop-shadow(0 0 3px rgba(255,0,255,0.8));
}

.key-space {
    fill: rgba(255,255,0,0.20);
    stroke: #ffff00;
}

.key {
    display: inline-block;
    padding: 1px 4px 0 4px;
    margin: 0 1px;
    border: 1px solid #0ff;
    border-radius: 4px;
    background: rgba(0,255,255,0.12);
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    font-weight: bold;
    color: #fff;
    box-shadow:
        0 0 5px rgba(0,255,255,0.35),
        inset 0 0 5px rgba(0,255,255,0.18);
    text-shadow: 0 0 3px rgba(255,255,255,0.4);
    vertical-align: middle;
}

.lbl-y + .key,
.lbl-y ~ span + .key {
    border-color: #ffde4a;
    background: rgba(255,222,74,0.12);
    box-shadow:
        0 0 5px rgba(255,222,74,0.35),
        inset 0 0 5px rgba(255,222,74,0.18);
}

.item-desc {
    display: flex;
    align-items: center;
}

.item-icon {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 18px;
    height: 18px;
    border: 2px solid;
    font-weight: bold;
    font-size: 11px;
    margin-right: 15px;
    box-sizing: border-box;
    background: rgba(0,0,0,0.5);
}

.item-w {
    color: #0f0;
    border-color: #0f0;
    box-shadow: 0 0 5px #0f0;
}

.item-l,
.item-s {
    color: #0ff;
    border-color: #0ff;
    box-shadow: 0 0 5px #0ff;
}

.item-i {
    color: #ff0;
    border-color: #ff0;
    box-shadow: 0 0 5px #ff0;
}

.crystal-icon {
    display: inline-block;
    width: 11px;
    height: 11px;
    background: #008000;
    border: 1px solid #0f0;
    transform: rotate(45deg);
    margin: 4px 19px 4px 4px;
    box-shadow: 0 0 8px #0f0;
}

.howto-text {
    color: #c7d0d6;
    font-size: calc(11px * var(--ui-scale, 1));
}

.btn-training {
    border-color: #0f8;
    color: #0f8;
    box-shadow: 0 0 10px rgba(0,255,128,0.3);
}

/* ---------- portrait ---------- */
@media (orientation: portrait) {
    #howto-overlay {
        padding: 12px;
    }

    .howto-container {
        flex-direction: column;
        width: 96vw;
        gap: 14px;
    }

    .howto-panel {
        padding: 14px 12px;
        border-radius: 3px;
    }

    .howto-title {
        margin-bottom: 12px;
        font-size: calc(15px * var(--ui-scale, 1));
    }

    .control-group {
        margin-bottom: calc(12px * var(--ui-scale, 1));
        padding-bottom: calc(8px * var(--ui-scale, 1));
    }

    .control-desc {
        line-height: 1.65;
    }

    .item-desc {
        margin-bottom: calc(10px * var(--ui-scale, 1));
    }

    .howto-text {
        line-height: 1.8;
    }

    .howto-actions {
        margin-top: 10px;
    }
}

/* ---------- landscape ---------- */
@media (orientation: landscape) {
    #howto-overlay {
        padding: 10px;
    }

    .howto-container {
        flex-direction: row;
        width: min(94vw, 920px);
        gap: 12px;
    }

    .howto-panel {
        padding: 10px 10px;
        border-radius: 3px;
    }

    .howto-title {
        margin-bottom: 10px;
        font-size: calc(13px * var(--ui-scale, 1));
    }

    .control-group {
        margin-bottom: calc(10px * var(--ui-scale, 1));
        padding-bottom: calc(8px * var(--ui-scale, 1));
    }

    .control-desc {
        line-height: 1.6;
    }

    .item-desc {
        margin-bottom: calc(8px * var(--ui-scale, 1));
    }

    .howto-text {
        line-height: 1.6;
    }

    .howto-actions {
        margin-top: 10px;
    }
}