html,
body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #121212;
    font-family: 'Segoe UI', sans-serif;
    user-select: none;
    height: 100%;
    width: 100%;
    position: relative;
}

canvas {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 0;
    background-color: #121212;
}

#ui {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: rgba(10, 10, 10, 0.85);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    box-sizing: border-box;
    color: white;
    font-size: 14px;
    z-index: 30;
    user-select: none;
}

#ui button,
#ui input[type=range],
#ui input[type=file] {
    height: 30px;
    padding: 0 12px;
    font-size: 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: #0088cc;
    color: white;
    transition: background-color 0.3s ease;
    display: inline-block;
    user-select: none;
}

#ui button:hover {
    background: #005f8c;
}

#ui label {
    margin: 0 6px 0 0;
    white-space: nowrap;
}

.letter {
    position: absolute;
    font-weight: bold;
    font-size: 2rem;
    text-shadow: 0 0 8px rgba(0, 191, 255, 0.6);
    cursor: grab;
    user-select: none;
    pointer-events: auto;
    z-index: 20;
    width: 24px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    transition: opacity 0.3s ease;
}

.image-object {
    position: absolute;
    cursor: grab;
    user-select: none;
    z-index: 20;
    border-radius: 8px;
    box-shadow: 0 0 8px #00bfffaa;
    width: 60px;
    height: 60px;
    object-fit: contain;
    background: #222222aa;
    transition: left 0.1s, top 0.1s, opacity 0.3s ease;
}

.blackhole-img {
    position: absolute;
    pointer-events: auto;
    z-index: 10;
    user-select: none;
    filter: drop-shadow(0 0 12px #3399ffcc);
    cursor: grab;
    border-radius: 50%;
    background: radial-gradient(circle at center, #111122dd, #000000dd);
    transition: width 0.2s ease, height 0.2s ease, left 0.2s ease, top 0.2s ease;
}

@media (max-width: 420px) {
    #ui {
        position: fixed;
        bottom: 10px;
        left: 10px;
        right: 10px;
        display: flex;
        gap: 10px;
        overflow-x: auto;
        padding: 8px 12px;
        background: rgba(0, 0, 0, 0.65);
        border-radius: 12px;
        z-index: 1000;
        flex-wrap: nowrap;
        align-items: center;
        /* ← これで中身を縦方向中央に */
    }

    /* ボタンとスライダー共通 */
    #ui button,
    #ui input[type="range"] {
        flex: 0 0 auto;
        font-size: 16px;
        padding: 12px 16px;
        border-radius: 8px;
        border: none;
        background: #00c0ff;
        color: white;
        font-weight: bold;
        white-space: nowrap;
        line-height: 1;
        /* ← テキストの高さを揃える */
        vertical-align: middle;
        /* ← 高さのズレを補正 */
        display: flex;
        align-items: center;
        /* ← 内部のテキストを中央に */
        justify-content: center;
        /* ← 横方向も中央揃えに */
    }

    /* スライダーだけの追加調整（サイズ固定） */
    #ui input[type="range"] {
        width: 120px;
        height: 36px;
        /* ← 高さ指定でボタンに揃える */
        padding: 0;
        appearance: none;
    }
}