/* wasm-player overlay */
.wasm-player-overlay {
    position: fixed;
    /* デフォルトは縦長（縦横比 2:1 = 高さ:幅）。スマホアプリのプレビュー確認に適した向き。 */
    height: 90vh;
    width: 45vh;
    top: 5vh;
    left: calc(50vw - 22.5vh);
    min-width: 300px;
    min-height: 400px;
    max-width: 98vw;
    max-height: 95vh;
    z-index: 9999;
    background: #000;
    border-radius: 8px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.wasm-player-titlebar {
    height: 40px;
    min-height: 40px;
    background: #1a1a2e;
    display: flex;
    align-items: center;
    padding: 0 8px 0 14px;
    cursor: move;
    user-select: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.wasm-player-title {
    flex: 1;
    color: #999;
    font-size: 0.8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* タイトルバー右上のウィンドウボタン（回転・閉じる） */
.wasm-player-rotate,
.wasm-player-close {
    background: none;
    color: #888;
    border: none;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wasm-player-close {
    font-size: 20px;
}

.wasm-player-rotate .wasm-player-rotate-icon {
    width: 18px;
    height: 18px;
    display: block;
}

.wasm-player-rotate:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.wasm-player-close:hover {
    background: rgba(255, 80, 80, 0.2);
    color: #ff6b6b;
}

.wasm-player-body {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.wasm-player-frame {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* 8方向リサイズハンドル（全辺 + 全角）。edge は帯状、corner は角の正方形。 */
.wasm-player-resize-handle {
    position: absolute;
    z-index: 10000;
}

/* エッジ幅（辺のつかみしろ） */
:root {
    --wpr-edge: 6px;
    --wpr-corner: 14px;
}

/* 辺 */
.wpr-n {
    top: 0;
    left: var(--wpr-corner);
    right: var(--wpr-corner);
    height: var(--wpr-edge);
    cursor: ns-resize;
}

.wpr-s {
    bottom: 0;
    left: var(--wpr-corner);
    right: var(--wpr-corner);
    height: var(--wpr-edge);
    cursor: ns-resize;
}

.wpr-e {
    top: var(--wpr-corner);
    bottom: var(--wpr-corner);
    right: 0;
    width: var(--wpr-edge);
    cursor: ew-resize;
}

.wpr-w {
    top: var(--wpr-corner);
    bottom: var(--wpr-corner);
    left: 0;
    width: var(--wpr-edge);
    cursor: ew-resize;
}

/* 角 */
.wpr-ne {
    top: 0;
    right: 0;
    width: var(--wpr-corner);
    height: var(--wpr-corner);
    cursor: nesw-resize;
}

.wpr-nw {
    top: 0;
    left: 0;
    width: var(--wpr-corner);
    height: var(--wpr-corner);
    cursor: nwse-resize;
}

.wpr-se {
    bottom: 0;
    right: 0;
    width: var(--wpr-corner);
    height: var(--wpr-corner);
    cursor: nwse-resize;
    /* 右下だけは従来通りグリップを可視化 */
    background: linear-gradient(
        135deg,
        transparent 40%,
        rgba(255, 255, 255, 0.25) 40%,
        rgba(255, 255, 255, 0.25) 55%,
        transparent 55%,
        transparent 65%,
        rgba(255, 255, 255, 0.25) 65%
    );
}

.wpr-sw {
    bottom: 0;
    left: 0;
    width: var(--wpr-corner);
    height: var(--wpr-corner);
    cursor: nesw-resize;
}
