/* ════════════════════════════════════════════════════════════
   library.css — ファイルライブラリ + EMM + ディスクエディタ 共有CSS
   shell.html / x1pen.html から <link> で読み込む
════════════════════════════════════════════════════════════ */

/* ── EMM スロットビュー ── */
.emm-slot-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-bottom: 1px solid #1a1a1a;
}
.emm-slot-row.mounted { background: #151d10; }
.emm-slot-label {
    font-size: 0.75em;
    font-family: 'Courier New', monospace;
    color: #9966cc;
    width: 40px;
    flex-shrink: 0;
    font-weight: bold;
}
.emm-slot-info {
    flex: 1;
    font-size: 0.75em;
    color: #999;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.emm-unassigned { color: #cc4444; font-style: italic; }
.emm-slot-btns {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}
.emm-action-btn {
    font-size: 0.65em;
    padding: 2px 8px;
    border: 1px solid #333;
    border-radius: 3px;
    background: #1a1a1a;
    color: #888;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.1s;
}
.emm-action-btn:hover:not(:disabled) {
    border-color: #7744bb;
    color: #bb99dd;
    background: #1e1020;
}
.emm-action-btn:disabled { opacity: 0.25; cursor: not-allowed; }
.emm-action-del { color: #994444; border-color: #331818; }
.emm-action-del:hover:not(:disabled) {
    border-color: #aa3333;
    color: #ff6666;
    background: #1a0808;
}

/* EMM サイズ選択ラジオ */
.emm-size-radio {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    user-select: none;
    padding: 3px 8px;
    border: 1px solid #333;
    border-radius: 4px;
    background: #1a1a1a;
    transition: all 0.1s;
}
.emm-size-radio:hover { border-color: #666; }
.emm-size-radio input[type="radio"] { display: none; }
.emm-size-radio .emm-size-led {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: #1e1020;
    border: 1px solid #2a1840;
    flex-shrink: 0;
    transition: background 0.15s, box-shadow 0.15s;
}
.emm-size-radio input[type="radio"]:checked ~ .emm-size-led {
    background: #9966cc;
    border-color: #bb88ee;
    box-shadow: 0 0 4px rgba(153,102,204,0.6);
}
.emm-size-radio .emm-size-label {
    font-size: 0.65em;
    color: rgba(255,255,255,0.3);
    letter-spacing: 0.5px;
    font-family: 'Courier New', monospace;
    transition: color 0.15s;
}
.emm-size-radio input[type="radio"]:checked ~ .emm-size-label {
    color: #bb99dd;
}
.emm-custom-input {
    width: 70px;
    padding: 3px 6px;
    background: #1a1a1a;
    color: #ccc;
    border: 1px solid #444;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.75em;
    text-align: right;
}
.emm-custom-input:disabled { opacity: 0.3; }

/* ════════════════════════════════════════════════════════════
   ファイルライブラリ パネル
════════════════════════════════════════════════════════════ */
.library-panel {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.78);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.library-panel-inner {
    background: #1a1a1a;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    width: 700px;
    max-width: 96vw;
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0,0,0,0.7);
}

.lib-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 16px;
    border-bottom: 1px solid #2e2e2e;
    background: #111;
    flex-shrink: 0;
}

.lib-panel-title {
    font-size: 0.9em;
    font-weight: bold;
    color: #bbb;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.lib-close-btn {
    background: none;
    border: 1px solid #3a3a3a;
    color: #666;
    font-size: 0.75em;
    padding: 3px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.1s;
}
.lib-close-btn:hover { border-color: #cc4444; color: #ff7777; }

.lib-filters {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 9px 14px;
    border-bottom: 1px solid #222;
    background: #131313;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.lib-filter {
    background: #1e1e1e;
    border: 1px solid #333;
    color: #555;
    font-size: 0.7em;
    padding: 4px 13px;
    border-radius: 3px;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
    transition: all 0.1s;
}
.lib-filter:hover { border-color: #666; color: #999; }
.lib-filter.active { background: #2a1012; border-color: #c0404a; color: #ff9090; }

.lib-add-btn {
    margin-left: auto;
    background: #0a1e0a;
    border: 1px solid #225522;
    color: #44aa44;
    font-size: 0.75em;
    padding: 5px 14px;
    border-radius: 3px;
    cursor: pointer;
    font-family: inherit;
    letter-spacing: 0.3px;
    transition: all 0.1s;
}
.lib-add-btn:hover { background: #162816; border-color: #44aa44; color: #88ff88; }

.lib-fav-filter {
    background: #1e1e1e; border: 1px solid #333; color: #555;
    font-size: 0.8em; padding: 4px 10px; border-radius: 3px;
    cursor: pointer; transition: all 0.1s; margin-left: 2px;
}
.lib-fav-filter:hover { border-color: #886622; color: #ccaa44; }
.lib-fav-filter.active { background: #2a2210; border-color: #aa8833; color: #ffcc44; }

.lib-toolbar {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 14px; border-bottom: 1px solid #222;
    background: #151515; flex-shrink: 0;
}
.lib-search-input {
    flex: 1; background: #111; border: 1px solid #333; color: #aaa;
    padding: 5px 9px; border-radius: 3px; font-size: 0.82em;
    font-family: 'Courier New', monospace; outline: none; min-width: 0;
}
.lib-search-input:focus { border-color: #666; }
.lib-search-input::placeholder { color: #444; }
.lib-sort-select {
    background: #1a1a1a; border: 1px solid #333; color: #888;
    padding: 5px 8px; border-radius: 3px; font-size: 0.78em;
    font-family: inherit; outline: none; cursor: pointer; flex-shrink: 0;
}
.lib-sort-select:focus { border-color: #666; }
.lib-sort-select option { background: #1a1a1a; color: #aaa; }

.lib-fav-btn {
    background: none; border: 1px solid transparent; color: #333;
    padding: 2px 4px; cursor: pointer; font-size: 0.95em;
    transition: all 0.1s; flex-shrink: 0; line-height: 1;
}
.lib-fav-btn:hover { color: #886622; }
.lib-fav-btn.favorited { color: #ccaa44; }

.lib-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 10px;
    min-height: 100px;
}

.lib-empty {
    text-align: center;
    padding: 36px 20px;
    color: #444;
    font-size: 0.85em;
    line-height: 1.8;
}
.lib-empty small { color: #333; }

.lib-row {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 8px;
    border-radius: 4px;
    border: 1px solid transparent;
    margin-bottom: 3px;
    transition: background 0.1s;
}
.lib-row:hover { background: #222; }
.lib-row.mounted { background: #151d10; border-color: #253a18; }

.lib-type-badge {
    font-size: 0.58em;
    font-weight: bold;
    letter-spacing: 1px;
    padding: 2px 6px;
    border-radius: 3px;
    flex-shrink: 0;
    font-family: 'Courier New', monospace;
}
.lib-badge-fdd { background: #0d1e36; border: 1px solid #1a4a88; color: #5599ee; }
.lib-badge-hdd { background: #281c00; border: 1px solid #775500; color: #ccaa44; }
.lib-badge-cmt { background: #0a180a; border: 1px solid #1e4a1e; color: #44aa44; }
.lib-badge-emm { background: #1e1020; border: 1px solid #553388; color: #9966cc; }

.lib-file-name {
    flex: 1;
    font-size: 0.82em;
    color: #aaa;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: monospace;
    min-width: 0;
}

.lib-file-size {
    font-size: 0.7em;
    color: #484848;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 46px;
    text-align: right;
}

.lib-row-btns { display: flex; gap: 4px; flex-shrink: 0; align-items: center; }

.lib-mount-btn {
    background: #161628;
    border: 1px solid #2a2a55;
    color: #4a4a99;
    font-size: 0.63em;
    padding: 3px 9px;
    border-radius: 3px;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    letter-spacing: 0.5px;
    transition: all 0.1s;
    white-space: nowrap;
}
.lib-mount-btn:hover { border-color: #6666cc; color: #9999ff; background: #1e1e3a; }
.lib-mount-btn.active { background: #162010; border-color: #338833; color: #66ee66; }

.lib-dl-btn, .lib-del-btn {
    background: none;
    border: 1px solid transparent;
    font-size: 0.82em;
    padding: 2px 7px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.1s;
}
.lib-dl-btn { color: #3a4a55; }
.lib-dl-btn:hover { background: #161e28; border-color: #3a5a77; color: #7aaccc; }
.lib-del-btn { color: #3a2222; }
.lib-del-btn:hover { background: #201616; border-color: #663333; color: #bb5555; }

/* ── Drive 連携ボタン ── */
.cfg-drive-btn { background: #0a1a2e; border: 1px solid #1a4a88; color: #5599ee; }
.cfg-drive-btn:hover { background: #0d2244; border-color: #3a7acc; color: #88bbff; }
.cfg-drive-btn.connected { background: #0a1e0a; border-color: #2a7a2a; color: #55cc55; }
.lib-drive-pick-btn {
    background: #0a1a2e; border: 1px solid #1a4a88; color: #5599ee;
    font-size: 0.72em; padding: 4px 12px; border-radius: 3px; cursor: pointer;
    font-family: 'Courier New', monospace; letter-spacing: 0.5px;
    transition: all 0.1s;
}
.lib-drive-pick-btn:hover { background: #0d2244; border-color: #3a7acc; color: #88bbff; }
.lib-picker-btn { border-color: #2a5a1a; color: #66bb44; }
.lib-picker-btn:hover { background: #0d2a0d; border-color: #3a8a2a; color: #99dd66; }
.lib-drive-save-btn {
    background: none; border: 1px solid transparent; color: #2a3a4a;
    padding: 2px 6px; border-radius: 3px; cursor: pointer;
    font-size: 0.9em; transition: all 0.1s;
}
.lib-drive-save-btn.linked  { color: #3a7acc; border-color: #1a4a55; }
.lib-drive-save-btn:hover   { background: #0a1a2e; border-color: #1a4a88; color: #5599ee; }
.lib-drive-save-btn.saving  { opacity: 0.5; cursor: default; pointer-events: none; }

#drive-status {
    padding: 5px 14px;
    font-size: 0.82em;
    font-family: monospace;
    border-top: 1px solid #1a1a1a;
    flex-shrink: 0;
    min-height: 24px;
}
#drive-status.hidden         { display: none; }
#drive-status.drive-progress { color: #88aacc; }
#drive-status.drive-success  { color: #44bb66; }
#drive-status.drive-error    { color: #cc5555; }

/* ── ディスクエディタ ── */
.lib-edit-btn { color: #3a4a3a; }
.lib-edit-btn:hover { background: #162816; border-color: #447744; color: #88cc88; }
.disk-editor-info {
    padding: 8px 14px;
    border-bottom: 1px solid #222;
    background: #131313;
    font-size: 0.78em;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    flex-shrink: 0;
}
.disk-editor-info-item { color: #777; }
.disk-editor-warn { color: #cc8833; }
.disk-editor-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-bottom: 1px solid #222;
    background: #131313;
    flex-shrink: 0;
}
.disk-editor-tool-btn {
    background: #0a1e0a;
    border: 1px solid #225522;
    color: #44aa44;
    font-size: 0.75em;
    padding: 5px 14px;
    border-radius: 3px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.1s;
}
.disk-editor-tool-btn:hover { background: #162816; border-color: #44aa44; }
.disk-editor-footer {
    display: flex;
    justify-content: flex-end;
    padding: 8px 14px;
    border-top: 1px solid #222;
    background: #131313;
    flex-shrink: 0;
}
.disk-editor-row {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 8px;
    border-radius: 4px;
    border: 1px solid transparent;
    margin-bottom: 2px;
    font-size: 0.8em;
}
.disk-editor-row:hover { background: #222; }
.disk-editor-fname {
    flex: 1;
    color: #aaa;
    font-family: 'Courier New', monospace;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.disk-editor-fattr { color: #555; font-size: 0.85em; min-width: 30px; }
.disk-editor-fsize { color: #555; font-size: 0.85em; min-width: 55px; text-align: right; }
.disk-editor-fdate { color: #444; font-size: 0.85em; min-width: 90px; }
.disk-editor-fmode-edit { cursor: pointer; color: #997744; }
.disk-editor-fmode-edit:hover { color: #ccaa66; text-decoration: underline; }
.disk-editor-faddr { color: #558855; font-size: 0.85em; min-width: 45px; cursor: pointer; font-family: 'Courier New', monospace; }
.disk-editor-faddr:hover { color: #88cc88; text-decoration: underline; }
.disk-editor-dir-name { cursor: pointer; color: #6699cc; }
.disk-editor-dir-name:hover { color: #88bbee; text-decoration: underline; }
.disk-editor-breadcrumb { display: flex; align-items: center; gap: 4px; padding: 4px 8px; margin-bottom: 4px; font-size: 0.85em; color: #888; }
.disk-editor-breadcrumb-item { cursor: pointer; color: #6699cc; }
.disk-editor-breadcrumb-item:hover { color: #88bbee; text-decoration: underline; }
.disk-editor-breadcrumb-sep { color: #555; margin: 0 2px; }
.disk-editor-breadcrumb-current { color: #ccc; }
.disk-editor-row-btns { display: flex; gap: 4px; flex-shrink: 0; }
.disk-editor-btn {
    background: none;
    border: 1px solid #222;
    color: #3a4a55;
    padding: 2px 7px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.1s;
}
.disk-editor-btn:hover { background: #161e28; border-color: #3a5a77; color: #7aaccc; }
.disk-editor-btn-del { color: #3a2222; }
.disk-editor-btn-del:hover { background: #201616; border-color: #663333; color: #bb5555; }

/* ── 容量バー ── */
.lib-capacity {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border-top: 1px solid #1e1e1e;
    background: #0c0c0c;
    flex-shrink: 0;
    min-height: 30px;
}
.lib-cap-bar-wrap {
    flex: 1;
    height: 6px;
    background: #141414;
    border: 1px solid #222;
    border-radius: 3px;
    overflow: hidden;
}
.lib-cap-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #1a4428, #3a9944, #99cc33);
    border-radius: 3px;
    transition: width 0.5s;
}
.lib-cap-text {
    font-size: 0.68em;
    color: #484848;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── 共通ボタン (EMM 作成ダイアログ等) ── */
.hw-state-btn {
    background: #2a2a2a;
    color: #ccc;
    border: 1px solid #555;
    border-radius: 3px;
    padding: 3px 7px;
    font-size: 0.7em;
    font-weight: bold;
    letter-spacing: 0.5px;
    cursor: pointer;
    line-height: 1.2;
}
.hw-state-btn:hover { background: #3a3a3a; color: #fff; }

/* ── スクリーンショット ダイアログ ── */
#screenshot-modal {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.72);
    z-index: 100;
    display: flex; align-items: center; justify-content: center;
}
#screenshot-modal.hidden { display: none !important; }
.screenshot-dialog {
    background: #0d1a2e;
    border: 1px solid #1a4a88;
    border-radius: 7px;
    max-width: 95vw;
    display: flex; flex-direction: column;
    align-items: center;
    color: #aaccee;
    box-shadow: 0 8px 32px rgba(0,0,0,0.7);
    font-family: 'Courier New', monospace;
    padding: 16px;
}
.screenshot-preview {
    border: 1px solid #1a3a5a;
    border-radius: 4px;
    max-width: min(480px, 100%);
    max-height: 50vh;
    image-rendering: pixelated;
}
.screenshot-buttons {
    margin-top: 14px;
    display: flex; gap: 12px;
}
.screenshot-buttons button {
    padding: 7px 20px;
    border: 1px solid #1a4a88;
    border-radius: 4px;
    background: #0a1220;
    color: #aaccee;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    cursor: pointer;
}
.screenshot-buttons button:hover { background: #1a3a5a; color: #fff; }
.screenshot-buttons .btn-save { border-color: #3a7acc; color: #88bbff; }
.screenshot-buttons .btn-save:hover { background: rgba(64,128,192,0.75); color: #fff; }

/* ── Drive ファイルブラウザ モーダル ── */
#drive-browser-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}
#drive-browser-modal.hidden { display: none !important; }
.drive-browser-dialog {
    background: #0d1a2e;
    border: 1px solid #1a4a88;
    border-radius: 7px;
    width: 90%;
    max-width: 520px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0,0,0,0.7);
    font-family: 'Courier New', monospace;
    color: #aaccee;
}
.drive-browser-header {
    padding: 12px 14px;
    font-weight: bold;
    color: #aaccee;
    border-bottom: 1px solid #1a3a5a;
}
.drive-browser-search {
    display: flex;
    gap: 8px;
    padding: 8px 14px;
    border-bottom: 1px solid #1a3a5a;
}
.drive-browser-search input {
    flex: 1;
    font-size: 0.88em;
    padding: 6px 8px;
    background: #0a1220;
    color: #cce4ff;
    border: 1px solid #1a4a55;
    border-radius: 3px;
    outline: none;
    font-family: 'Courier New', monospace;
}
.drive-browser-search button {
    font-size: 0.85em;
    padding: 4px 14px;
    background: #0a1a2e;
    color: #5a7a8a;
    border: 1px solid #1a4a55;
    border-radius: 3px;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    transition: all 0.1s;
}
.drive-browser-search button:hover { border-color: #3a7acc; color: #aaccee; }
.drive-file-list {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    flex: 1;
    min-height: 100px;
    max-height: 50vh;
}
.drive-file-item {
    display: flex; align-items: center;
    padding: 8px 14px;
    cursor: pointer;
    border-bottom: 1px solid #0d2030;
    transition: background 0.1s;
}
.drive-file-item:hover { background: #0a2040; }
.drive-file-item:last-child { border-bottom: none; }
.drive-file-name {
    flex: 1; font-size: 0.88em;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    color: #cce4ff;
}
.drive-file-size {
    font-size: 0.76em; color: #5a7a8a;
    margin-left: 10px; flex-shrink: 0;
}
.drive-file-msg {
    padding: 18px 14px;
    color: #5a7a8a; font-size: 0.85em;
    list-style: none; text-align: center;
}
.drive-file-error { color: #cc5555; }
.drive-browser-footer {
    padding: 8px 14px;
    display: flex; align-items: center; justify-content: space-between;
    border-top: 1px solid #1a3a5a;
    flex-shrink: 0;
}
.drive-browser-hint {
    font-size: 0.75em; color: #3a5a6a; font-style: italic;
}
.drive-browser-footer button {
    background: #0a1a2e; border: 1px solid #1a4a55;
    color: #5a7a8a; padding: 4px 14px;
    border-radius: 3px; cursor: pointer;
    font-family: 'Courier New', monospace; font-size: 0.85em;
    transition: all 0.1s;
}
.drive-browser-footer button:hover { border-color: #3a7acc; color: #aaccee; }
