/* =========================================================
   基本設定
   ========================================================= */

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;

    width: 100%;
    height: 100%;

    overflow: hidden;

    background: #111;
    color: #eee;

    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

button,
input {
    font: inherit;
}

button {
    border: 0;
    border-radius: 8px;

    padding: 8px 10px;

    background: #2b2f3a;
    color: #fff;

    cursor: pointer;
}

button:hover {
    background: #3a4050;
}

button.danger {
    background: #5a2222;
}

button.danger:hover {
    background: #742b2b;
}


/* =========================================================
   アプリ全体
   ========================================================= */

#app {
    display: grid;
    grid-template-columns: 1fr 360px;

    width: 100vw;
    height: 100vh;
}


/* =========================================================
   再生エリア
   ========================================================= */

.stageArea {
    position: relative;

    min-width: 0;

    background: #000;
}

.stage {
    position: absolute;
    inset: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    background: #000;
}

.mediaView {
    width: 100%;
    height: 100%;

    object-fit: contain;

    border: 0;
    background: #000;
}

#pdfCanvas {
    width: auto;
    height: auto;

    max-width: 100%;
    max-height: 100%;
}

.hidden {
    display: none !important;
}

.emptyHint {
    color: #aaa;

    text-align: center;
    line-height: 1.8;

    font-size: 20px;
}


/* =========================================================
   現在再生中の素材名
   ========================================================= */

.nowPlaying {
    position: absolute;

    left: 12px;
    bottom: 12px;

    max-width: 70%;

    padding: 6px 10px;

    border-radius: 999px;

    background: rgba(0, 0, 0, 0.55);
    color: #ddd;

    font-size: 13px;

    pointer-events: none;
}

/*
 * 操作パネルを隠している間は、
 * 再生画面上のファイル名も表示しない。
 */
body.panelHidden .nowPlaying {
    display: none;
}


/* =========================================================
   再生画面上の左右送りボタン
   通常は非表示。
   body に controlsVisible が付いた間だけ表示する。
   ========================================================= */

.stageArrow {
    position: absolute;

    top: 50%;

    transform: translateY(-50%);

    width: 56px;
    height: 96px;

    border-radius: 12px;

    background: rgba(20, 20, 20, 0.55);
    color: #fff;

    font-size: 56px;
    line-height: 1;

    opacity: 0;
    visibility: hidden;

    pointer-events: none;

    transition:
        opacity 0.25s ease,
        visibility 0.25s ease,
        background 0.2s ease;
}

.stageArrowLeft {
    left: 12px;
}

.stageArrowRight {
    right: 12px;
}

/*
 * マウス操作などがあった間だけ表示する。
 */
body.controlsVisible .stageArrow {
    opacity: 0.8;
    visibility: visible;

    pointer-events: auto;
}

body.controlsVisible .stageArrow:hover {
    opacity: 1;

    background: rgba(40, 40, 40, 0.85);
}


/* =========================================================
   操作パネル
   ========================================================= */

.panel {
    height: 100vh;

    overflow: auto;

    background: #181b22;

    border-left: 1px solid #333844;

    padding: 14px;
}

.panelHeader {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 8px;

    margin-bottom: 12px;
}

.panelHeader h1 {
    margin: 0;

    font-size: 18px;
}

.smallBtn {
    padding: 5px 8px;

    font-size: 12px;
}


/* =========================================================
   メイン操作ボタン
   ========================================================= */

.controls,
.demoControls {
    display: grid;
    grid-template-columns: 1fr 1fr;

    gap: 8px;

    margin-bottom: 12px;
}

.fileBtn {
    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 8px;

    padding: 8px 10px;

    background: #24507a;
    color: #fff;

    cursor: pointer;
}

.fileBtn input {
    display: none;
}


/* =========================================================
   オプション
   ========================================================= */

.options {
    display: grid;

    gap: 7px;

    padding: 10px;
    margin-bottom: 12px;

    border: 1px solid #303542;
    border-radius: 10px;

    background: #141720;

    font-size: 14px;
}

.options label {
    display: flex;
    align-items: center;

    gap: 8px;
}


/* =========================================================
   表示時間設定
   ========================================================= */

.timing {
    padding: 10px;
    margin-bottom: 12px;

    border: 1px solid #303542;
    border-radius: 10px;

    background: #141720;
}

.timing label {
    display: grid;

    gap: 6px;

    font-size: 13px;
}

.timing input {
    width: 100%;

    padding: 7px;

    border: 1px solid #39404e;
    border-radius: 8px;

    background: #0d1016;
    color: #fff;
}


/* =========================================================
   プレイリスト
   ========================================================= */

.playlistHeader {
    margin: 10px 0 6px;

    font-weight: 700;
}

.hint {
    margin-top: 4px;

    color: #999;

    font-size: 12px;
    font-weight: 400;
    line-height: 1.5;
}

.playlist {
    display: grid;

    gap: 6px;

    list-style: none;

    padding: 0;
    margin: 0;
}

.playlist li {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;

    gap: 8px;

    padding: 8px;

    border: 1px solid #303542;
    border-radius: 10px;

    background: #20242d;
}

.playlist li.current {
    border-color: #74a9ff;

    background: #263247;
}

.itemTitle {
    overflow: hidden;

    white-space: nowrap;
    text-overflow: ellipsis;

    font-size: 13px;
}

.itemMeta {
    margin-top: 2px;

    color: #aaa;

    font-size: 11px;
}

.itemButtons {
    display: flex;

    gap: 4px;
}

.itemButtons button {
    padding: 4px 6px;

    font-size: 12px;
}


/* =========================================================
   ステータス表示
   ========================================================= */

.status {
    min-height: 30px;

    margin-top: 12px;
    padding: 8px;

    border-radius: 8px;

    background: #10131a;
    color: #bbb;

    font-size: 12px;
}


/* =========================================================
   アプリ情報・ライセンス
   ========================================================= */

.appFooter {
    margin-top: 12px;
    padding-top: 10px;

    border-top: 1px solid #444;

    color: #888;

    text-align: center;
    line-height: 1.5;

    font-size: 11px;

    user-select: none;
}


/* =========================================================
   操作パネル再表示ボタン
   通常は非表示。
   操作パネル非表示中かつ controlsVisible の間だけ表示。
   ========================================================= */

.showPanelBtn {
    position: absolute;

    right: 12px;
    top: 12px;

    z-index: 10;

    display: block;

    opacity: 0;
    visibility: hidden;

    pointer-events: none;

    transition:
        opacity 0.25s ease,
        visibility 0.25s ease,
        background 0.2s ease;
}

/*
 * 操作パネルが非表示で、
 * 一時的な操作表示中の場合だけ表示する。
 */
body.panelHidden.controlsVisible .showPanelBtn {
    opacity: 0.9;
    visibility: visible;

    pointer-events: auto;
}

body.panelHidden.controlsVisible .showPanelBtn:hover {
    opacity: 1;
}


/* =========================================================
   操作パネル非表示時
   ========================================================= */

body.panelHidden #app {
    grid-template-columns: 1fr;
}

body.panelHidden .panel {
    display: none;
}


/* =========================================================
   スマートフォン・狭い画面
   ========================================================= */

@media (max-width: 800px) {

    #app {
        grid-template-columns: 1fr;
        grid-template-rows: 55vh 45vh;
    }

    .panel {
        height: 45vh;

        border-left: 0;
        border-top: 1px solid #333844;
    }

    .stageArea {
        min-height: 0;
    }

    /*
     * スマートフォンでは送りボタンを少し小さくする。
     */
    .stageArrow {
        width: 44px;
        height: 76px;

        font-size: 44px;
    }

    .stageArrowLeft {
        left: 6px;
    }

    .stageArrowRight {
        right: 6px;
    }
}