/* =============================================================
   Media Share System スタイルシート
   テーマ: 夏の夜 / 夜景 / 花火 / 青春
   ダークテーマ固定・ガラスモーフィズム・深い青紫基調
   ============================================================= */

/* ---- デザイントークン ---------------------------------------- */
:root {
    /* 背景・面 */
    --bg:            #07111f;
    --bg-2:          #0a1730;
    --surface:       rgba(20, 30, 55, 0.72);
    --surface-2:     rgba(28, 40, 70, 0.55);
    --surface-solid: #101a30;
    --line:          rgba(120, 150, 210, 0.16);
    --line-strong:   rgba(140, 170, 230, 0.32);

    /* テキスト */
    --text:      #e8eefc;
    --text-sub:  #9fb0d0;
    --text-mute: #6f80a3;

    /* アクセント（夜景・花火のネオン） */
    --accent-cyan:   #4fc3f7;
    --accent-blue:   #6a8dff;
    --accent-violet: #a970ff;
    --danger:        #ff6b81;
    --success:       #46d6a6;

    /* 効果 */
    --radius:    18px;
    --radius-sm: 12px;
    --radius-lg: 22px;
    --blur:      18px;
    --shadow:    0 18px 48px rgba(3, 8, 20, 0.55);
    --shadow-sm: 0 8px 24px rgba(3, 8, 20, 0.42);
    --glow:      0 0 0 1px rgba(106, 141, 255, 0.14), 0 12px 40px rgba(30, 60, 140, 0.22);

    --sidebar-w: 264px;
    --font: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", "Yu Gothic", "Meiryo", system-ui, sans-serif;
    --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---- リセット ------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

/* html は基準高さのみ。body は固定高さにせず内容に応じて伸びるようにし、
   通常表示でも全要素が見えるよう自然な縦スクロールを許可する。 */
html { height: 100%; }

body {
    margin: 0;
    min-height: 100%;   /* 固定 height を避け、内容が増えたら縦に伸びる */
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    font-size: 15px;
    overflow-x: hidden; /* 不要な横スクロールは禁止（縦は自然にスクロール） */
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
ul { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, p, dl, dd { margin: 0; }

/* ---- 夜景グラデーション背景 ---------------------------------- */
.aurora {
    position: fixed;
    inset: 0;
    z-index: -2;
    background:
        radial-gradient(1100px 620px at 78% -8%, rgba(105, 60, 190, 0.22), transparent 60%),
        radial-gradient(900px 560px at 12% 4%, rgba(40, 110, 200, 0.20), transparent 58%),
        radial-gradient(1200px 700px at 50% 108%, rgba(30, 70, 150, 0.18), transparent 62%),
        linear-gradient(180deg, #060e1b 0%, #07111f 42%, #060b16 100%);
}
.aurora::after {
    /* 遠景の街明かりを思わせる、ごく薄い粒状のきらめき */
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(1.5px 1.5px at 20% 30%, rgba(180, 210, 255, 0.25), transparent),
        radial-gradient(1.5px 1.5px at 68% 22%, rgba(200, 180, 255, 0.20), transparent),
        radial-gradient(1px 1px at 82% 62%, rgba(160, 220, 255, 0.18), transparent),
        radial-gradient(1px 1px at 38% 72%, rgba(190, 200, 255, 0.16), transparent);
    opacity: 0.6;
}

/* ---- 共通ユーティリティ -------------------------------------- */
.glass {
    background: var(--surface);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
}

/* ---- ボタン --------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: var(--surface-2);
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    transition: transform 0.16s var(--ease), background 0.2s var(--ease), border-color 0.2s var(--ease);
    white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn--primary {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-violet));
    box-shadow: 0 10px 26px rgba(106, 100, 255, 0.28);
}
.btn--primary:hover { box-shadow: 0 12px 32px rgba(106, 100, 255, 0.4); }
.btn--ghost {
    background: rgba(30, 44, 76, 0.5);
    border-color: var(--line);
    color: var(--text-sub);
}
.btn--ghost:hover { color: var(--text); border-color: var(--line-strong); }
.btn--danger { background: rgba(255, 107, 129, 0.14); color: var(--danger); border-color: rgba(255, 107, 129, 0.3); }
.btn--danger:hover { background: rgba(255, 107, 129, 0.22); }
.btn--block { width: 100%; }
.btn--lg { padding: 13px 22px; font-size: 15px; }

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: rgba(20, 32, 58, 0.6);
    color: var(--text-sub);
    transition: color 0.18s, background 0.18s;
}
.icon-btn:hover { color: var(--text); background: rgba(40, 58, 100, 0.7); }

/* ---- アラート ------------------------------------------------- */
.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 18px;
    border: 1px solid transparent;
}
.alert--error { background: rgba(255, 107, 129, 0.12); color: #ffb3bf; border-color: rgba(255, 107, 129, 0.28); }
.alert--success { background: rgba(70, 214, 166, 0.12); color: #9ff0d4; border-color: rgba(70, 214, 166, 0.28); }

/* =============================================================
   ログイン画面
   ============================================================= */
.login {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 28px 20px;
    gap: 22px;
}
.login__panel {
    width: 100%;
    max-width: 400px;
    padding: 38px 32px 30px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow), var(--glow);
}
.login__head { text-align: center; margin-bottom: 24px; }
.login__mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    font-size: 24px;
    color: #dbe6ff;
    background: linear-gradient(140deg, rgba(79, 195, 247, 0.24), rgba(169, 112, 255, 0.24));
    border: 1px solid var(--line-strong);
    margin-bottom: 16px;
}
.login__title { font-size: 22px; font-weight: 700; letter-spacing: 0.02em; }
.login__lead { color: var(--text-sub); font-size: 13px; margin-top: 6px; }
.login__note { text-align: center; color: var(--text-mute); font-size: 12px; margin-top: 18px; }
.login__foot { color: var(--text-mute); font-size: 12px; letter-spacing: 0.08em; }

/* ---- フォーム部品 --------------------------------------------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field__label { font-size: 13px; color: var(--text-sub); font-weight: 600; }
.field__control {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    height: 46px;
    border-radius: var(--radius-sm);
    background: rgba(9, 16, 32, 0.66);
    border: 1px solid var(--line);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.field__control:focus-within {
    border-color: rgba(79, 195, 247, 0.5);
    box-shadow: 0 0 0 3px rgba(79, 195, 247, 0.12);
}
.field__control > i { color: var(--text-mute); font-size: 14px; }
.field__control input,
.field__control textarea {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 15px;
    width: 100%;
}
.field__control--area { height: auto; padding: 12px 14px; align-items: flex-start; }
.field__control--area textarea { resize: vertical; line-height: 1.6; }
.field__toggle { background: none; border: none; color: var(--text-mute); padding: 4px; }
.field__toggle:hover { color: var(--text-sub); }
.field__note { font-size: 12px; color: var(--text-mute); margin-top: -4px; }
.field--inline { flex-direction: row; align-items: center; gap: 14px; flex-wrap: wrap; }
.field--inline .field__label { min-width: 120px; }

/* =============================================================
   アプリレイアウト
   ============================================================= */
.layout { display: flex; min-height: 100vh; }

/* ---- サイドバー ----------------------------------------------- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    /* 項目が多く縦に収まらない場合は、フッター（ログアウト）が見切れないよう
       サイドバー内でスクロールさせる */
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 20px 16px;
    background: linear-gradient(180deg, rgba(12, 22, 44, 0.86), rgba(8, 15, 30, 0.9));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--line);
    z-index: 40;
}
.sidebar__brand { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; padding: 0 6px; }
.brand { display: flex; align-items: center; gap: 11px; }
.brand__mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px; height: 38px;
    border-radius: 12px;
    font-size: 17px;
    color: #dbe6ff;
    background: linear-gradient(140deg, rgba(79, 195, 247, 0.28), rgba(169, 112, 255, 0.28));
    border: 1px solid var(--line-strong);
}
.brand__text { font-weight: 700; font-size: 15px; letter-spacing: 0.01em; }
.sidebar__close { display: none; background: none; border: none; color: var(--text-sub); font-size: 20px; }

.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav__item {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-sub);
    font-weight: 600;
    font-size: 14px;
    transition: background 0.18s, color 0.18s;
    position: relative;
}
.nav__item i { width: 20px; text-align: center; font-size: 15px; }
.nav__item:hover { background: rgba(40, 58, 100, 0.4); color: var(--text); }
.nav__item.is-active {
    color: #fff;
    background: linear-gradient(100deg, rgba(79, 195, 247, 0.2), rgba(169, 112, 255, 0.16));
    border: 1px solid var(--line-strong);
}
.nav__item.is-active::before {
    content: "";
    position: absolute;
    left: 4px; top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 20px;
    border-radius: 3px;
    background: linear-gradient(var(--accent-cyan), var(--accent-violet));
}

.sidebar__footer { border-top: 1px solid var(--line); padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    background: rgba(9, 16, 32, 0.55);
    color: var(--text-sub);
    font-size: 13px;
    font-weight: 600;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(4, 8, 18, 0.6);
    backdrop-filter: blur(2px);
    z-index: 35;
}

/* ---- メイン --------------------------------------------------- */
.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 26px;
    background: rgba(7, 14, 27, 0.72);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}
.topbar__menu { display: none; background: none; border: none; color: var(--text); font-size: 20px; }
.searchbar {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 560px;
    padding: 0 16px;
    height: 44px;
    border-radius: 14px;
    background: rgba(9, 16, 32, 0.6);
    border: 1px solid var(--line);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.searchbar:focus-within { border-color: rgba(79, 195, 247, 0.45); box-shadow: 0 0 0 3px rgba(79, 195, 247, 0.1); }
.searchbar i { color: var(--text-mute); }
.searchbar input { flex: 1; background: none; border: none; outline: none; color: var(--text); font-size: 14px; }
.topbar__upload { margin-left: auto; }

.content { padding: 26px; }

/* ---- ページ共通 ----------------------------------------------- */
.page { max-width: 1320px; margin: 0 auto; }
.page--narrow { max-width: 760px; }
.page__head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}
.page__head--wrap { flex-wrap: wrap; align-items: center; }
.page__title { font-size: 24px; font-weight: 700; letter-spacing: 0.01em; }
.page__count { color: var(--text-sub); font-size: 13px; margin-top: 4px; }
.page__tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 28px 0 14px;
}
.section-title { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 9px; }
.section-title i { color: var(--accent-cyan); }
.section-more { color: var(--text-sub); font-size: 13px; font-weight: 600; }
.section-more:hover { color: var(--accent-cyan); }

/* ---- ホーム --------------------------------------------------- */
.hero {
    border-radius: var(--radius-lg);
    padding: 34px 32px;
    margin-bottom: 22px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm), var(--glow);
}
.hero::after {
    content: "";
    position: absolute;
    right: -60px; top: -60px;
    width: 260px; height: 260px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(169, 112, 255, 0.25), transparent 65%);
    pointer-events: none;
}
.hero__hello { color: var(--text-sub); font-size: 13px; }
.hero__title { font-size: 27px; font-weight: 700; margin: 6px 0 8px; }
.hero__lead { color: var(--text-sub); font-size: 14px; max-width: 520px; }
.hero__actions { display: flex; gap: 12px; margin-top: 20px; flex-wrap: wrap; }

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 8px; }
.stat {
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: transform 0.18s var(--ease), border-color 0.2s;
}
.stat:hover { transform: translateY(-3px); border-color: var(--line-strong); }
.stat__icon {
    width: 42px; height: 42px;
    border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 18px;
    color: #dbe6ff;
    background: linear-gradient(140deg, rgba(79, 195, 247, 0.2), rgba(169, 112, 255, 0.2));
    margin-bottom: 8px;
}
.stat__num { font-size: 28px; font-weight: 700; }
.stat__label { color: var(--text-sub); font-size: 13px; }

.folder-strip { display: flex; gap: 12px; flex-wrap: wrap; }
.folder-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 14px;
    transition: transform 0.18s var(--ease), border-color 0.2s;
}
.folder-chip:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.folder-chip i { color: var(--accent-blue); }
.folder-chip__name { font-weight: 600; font-size: 14px; }
.folder-chip__count {
    font-size: 12px; color: var(--text-mute);
    background: rgba(9, 16, 32, 0.6);
    padding: 2px 8px; border-radius: 20px;
}

/* ---- 並び替え ------------------------------------------------- */
.sortbar { display: flex; align-items: center; gap: 10px; }
.sortbar__label { font-size: 13px; color: var(--text-sub); font-weight: 600; white-space: nowrap; }
.select { position: relative; display: inline-flex; align-items: center; }
.select select {
    appearance: none;
    -webkit-appearance: none;
    padding: 9px 38px 9px 14px;
    border-radius: var(--radius-sm);
    background: rgba(9, 16, 32, 0.66);
    border: 1px solid var(--line);
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    min-width: 140px;
}
.select select:focus { outline: none; border-color: rgba(79, 195, 247, 0.45); }
.select > i { position: absolute; right: 14px; pointer-events: none; color: var(--text-mute); font-size: 12px; }
.select--full { display: flex; flex: 1; }
.select--full select { width: 100%; }

/* =============================================================
   グリッド・カード
   ============================================================= */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 18px;
}
.card {
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s var(--ease), border-color 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    position: relative;
}
.card:hover { transform: translateY(-4px); border-color: var(--line-strong); box-shadow: var(--shadow); }
.card.is-dragging { opacity: 0.5; }
.card__thumb {
    position: relative;
    aspect-ratio: 4 / 3;
    background: #0c1221;
    cursor: pointer;
    overflow: hidden;
}
.card__thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s var(--ease); }
.card:hover .card__thumb img { transform: scale(1.05); }
.card__placeholder {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    font-size: 34px;
    color: rgba(140, 165, 215, 0.4);
    background: radial-gradient(circle at 50% 40%, rgba(40, 60, 110, 0.5), rgba(12, 18, 33, 0.9));
}
.card__play {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 52px; height: 52px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: rgba(9, 16, 32, 0.6);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(200, 220, 255, 0.4);
    color: #fff; font-size: 16px;
    transition: transform 0.2s var(--ease), background 0.2s;
}
.card:hover .card__play { transform: translate(-50%, -50%) scale(1.08); background: rgba(106, 141, 255, 0.5); }
.card__badge {
    position: absolute; bottom: 8px; right: 8px;
    padding: 3px 8px;
    border-radius: 8px;
    background: rgba(6, 12, 24, 0.78);
    font-size: 11px; font-weight: 600;
    letter-spacing: 0.02em;
}
.card__type {
    position: absolute; top: 8px; right: 8px;
    width: 26px; height: 26px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(6, 12, 24, 0.66);
    font-size: 11px; color: var(--text-sub);
}

/* ---- 一括選択チェックボックス（カード左上） ------------------- */
.card__select {
    position: absolute;
    top: 8px; left: 8px;
    z-index: 5;
    width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
}
.card__select input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.card__select-box {
    width: 24px; height: 24px;
    border-radius: 7px;
    background: rgba(6, 12, 24, 0.72);
    border: 1.5px solid rgba(200, 220, 255, 0.6);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 12px;
    transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.card__select-box i { opacity: 0; transform: scale(0.6); transition: opacity 0.15s, transform 0.15s; }
.card.is-selected { outline: 2px solid var(--accent-blue); outline-offset: -2px; }
.card.is-selected .card__select-box { background: var(--accent-blue); border-color: var(--accent-blue); }
.card.is-selected .card__select-box i { opacity: 1; transform: scale(1); }
.card__body { padding: 12px 13px 10px; flex: 1; }
.card__title {
    display: block;
    font-size: 14px; font-weight: 600;
    color: var(--text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card__title:hover { color: var(--accent-cyan); }
.card__meta { color: var(--text-mute); font-size: 12px; margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.card__meta .dot { opacity: 0.5; }
.card__actions {
    display: flex; align-items: center; gap: 6px;
    padding: 0 10px 11px;
}
.card__actions .menu { margin-left: auto; }

/* ---- 操作メニュー（ポータル方式） --------------------------------
   メニュー本体は開くと JS が body 直下へ移動する。閉じている間はカード内に
   あり display:none。開くと .is-open が付き、デスクトップは --floating で
   画面に固定配置（見切れ防止・クランプ）、モバイルは --sheet でボトムシート。 */
.menu { position: relative; }
.menu__list {
    min-width: 176px;
    padding: 6px;
    border-radius: 12px;
    background: var(--surface-solid);
    border: 1px solid var(--line-strong);
    box-shadow: var(--shadow);
    display: none;
    flex-direction: column;
    gap: 2px;
}
.menu__list.is-open { display: flex; }

/* デスクトップ: ビューポート基準に固定配置し、はみ出さずスクロール可能 */
.menu__list--floating {
    position: fixed;
    z-index: 160;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    animation: menuPop 0.14s var(--ease);
}
@keyframes menuPop {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: none; }
}

/* 外側クリックで閉じるための背景。デスクトップは透明、モバイルは暗転。 */
.menu-backdrop {
    position: fixed; inset: 0;
    z-index: 150;
    display: none;
    background: transparent;
}
.menu-backdrop.is-open { display: block; }

.menu__list a,
.menu__list button {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 11px;
    border-radius: 8px;
    background: none; border: none;
    color: var(--text-sub);
    font-size: 13px; font-weight: 600;
    text-align: left; width: 100%;
    cursor: pointer;
}
.menu__list a:hover,
.menu__list button:hover { background: rgba(40, 58, 100, 0.55); color: var(--text); }
.menu__list i { width: 16px; text-align: center; }
.menu__list .is-danger { color: var(--danger); }
.menu__list .is-danger:hover { background: rgba(255, 107, 129, 0.16); }
/* メニュー内区切り線（破壊的操作の分離） */
.menu__sep { height: 1px; margin: 5px 6px; background: var(--line); }

/* =============================================================
   フォルダを空にする ダイアログ（確認 + 進捗）
   ============================================================= */
.cleardlg { position: fixed; inset: 0; z-index: 210; display: none; }
.cleardlg.is-open { display: block; }
.cleardlg__backdrop { position: absolute; inset: 0; background: rgba(4, 8, 18, 0.72); backdrop-filter: blur(4px); }
.cleardlg__panel {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: min(92vw, 440px);
    max-height: 90vh;
    overflow-y: auto;
    display: flex; flex-direction: column;
    gap: 14px;
    padding: 22px;
    border-radius: var(--radius-lg);
    background: var(--surface-solid);
    border: 1px solid var(--line-strong);
    box-shadow: var(--shadow);
}
.cleardlg__head { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; }
.cleardlg__head i { color: var(--danger); }
.cleardlg__body { color: var(--text-sub); font-size: 14px; line-height: 1.6; }
.cleardlg__body strong { color: var(--text); }
.cleardlg__types {
    display: flex; flex-wrap: wrap; gap: 6px;
    margin: 10px 0; padding: 0; list-style: none;
}
.cleardlg__types li {
    padding: 3px 10px; border-radius: 20px;
    background: rgba(40, 58, 100, 0.4);
    font-size: 12px; color: var(--text-sub);
}
.cleardlg__warn { color: var(--danger); font-weight: 600; }
.cleardlg__progress { display: flex; flex-direction: column; gap: 8px; }
.cleardlg__bar { height: 10px; border-radius: 6px; background: rgba(9, 16, 32, 0.85); overflow: hidden; }
.cleardlg__bar span {
    display: block; height: 100%; width: 0;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-violet));
    transition: width 0.25s var(--ease);
}
.cleardlg__count { text-align: center; font-size: 13px; color: var(--text-sub); font-variant-numeric: tabular-nums; }
.cleardlg__foot { display: flex; justify-content: flex-end; gap: 10px; }
.cleardlg__foot[hidden] { display: none; }
.cleardlg__progress[hidden] { display: none; }

/* モバイル: 画面下部から立ち上がるアクションシート */
@media (max-width: 640px) {
    .menu-backdrop.is-open { background: rgba(4, 8, 18, 0.5); }
    .menu__list--sheet {
        position: fixed;
        left: 0; right: 0; bottom: 0;
        z-index: 160;
        min-width: 0;
        border-radius: 20px 20px 0 0;
        padding: 8px 12px calc(14px + env(safe-area-inset-bottom));
        gap: 4px;
        max-height: 80vh;
        overflow-y: auto;
        box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.5);
        animation: sheetUp 0.22s var(--ease);
    }
    .menu__list--sheet::before {
        content: ""; display: block;
        width: 40px; height: 4px; margin: 4px auto 10px;
        border-radius: 3px; background: var(--line-strong);
    }
    .menu__list--sheet a,
    .menu__list--sheet button {
        padding: 13px 14px; font-size: 15px; min-height: 48px;
    }
    .menu__list--sheet i { width: 20px; font-size: 16px; }
    body.menu-open { overflow: hidden; }
}
@keyframes sheetUp {
    from { transform: translateY(100%); }
    to   { transform: none; }
}

/* =============================================================
   一括操作ツールバー（写真・動画・検索・フォルダ内一覧で共通）
   ============================================================= */
.bulkbar {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    padding: 10px 14px;
    margin-bottom: 14px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--line);
    position: sticky; top: 8px; z-index: 30;
}
.bulkbar.is-active { border-color: var(--accent-blue); box-shadow: 0 0 0 1px rgba(106, 141, 255, 0.28); }
.bulkbar__all { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; color: var(--text-sub); cursor: pointer; }
.bulkbar__all input { width: 18px; height: 18px; cursor: pointer; }
.bulkbar__count { font-size: 13px; color: var(--text-sub); }
.bulkbar__count strong { color: var(--text); font-variant-numeric: tabular-nums; }
.bulkbar__actions { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.bulkbar__actions .btn { min-height: 44px; }
.bulkbar__actions .btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ピッカーの追加トグル（例: 関連ファイルも一緒に移動） */
.picker__extra {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 20px;
    border-top: 1px solid var(--line);
    font-size: 13px; color: var(--text-sub); cursor: pointer;
}
.picker__extra[hidden] { display: none; }
.picker__extra input { width: 18px; height: 18px; cursor: pointer; }

/* =============================================================
   フォルダ表示
   ============================================================= */
.crumbs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 14px; }
.crumbs__item {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 11px;
    border-radius: 10px;
    color: var(--text-sub); font-weight: 600;
    transition: background 0.18s, color 0.18s;
}
.crumbs__item:hover { background: rgba(40, 58, 100, 0.45); color: var(--text); }
.crumbs__item.is-current { color: var(--text); }
.crumbs__item.drop-hover { background: rgba(106, 141, 255, 0.28); color: #fff; }
.crumbs__sep { color: var(--text-mute); font-size: 11px; }

.folders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 8px;
}
.folder-card {
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    transition: transform 0.18s var(--ease), border-color 0.2s, box-shadow 0.2s;
}
.folder-card:hover { transform: translateY(-3px); border-color: var(--line-strong); }
.folder-card.is-dragging { opacity: 0.5; }
.folder-card.drop-hover {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(106, 141, 255, 0.4);
}
.folder-card__link { display: flex; align-items: center; gap: 13px; flex: 1; min-width: 0; }
.folder-card__icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 19px; color: var(--accent-blue);
    background: linear-gradient(140deg, rgba(79, 195, 247, 0.14), rgba(169, 112, 255, 0.14));
    flex-shrink: 0;
}
/* 名前と件数を縦積みにし、名前は最大 2 行で省略（フルテキストは title 属性で表示） */
.folder-card__text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.folder-card__name {
    font-weight: 600; font-size: 15px;
    line-height: 1.35;
    /* 長い名前は 2 行までで省略記号。1 文字だけの縦潰れを防ぐため min-width:0 済み */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.folder-card__count { display: block; font-size: 12px; color: var(--text-mute); margin-top: 3px; }
.folder-card .menu { flex-shrink: 0; }

/* 汎用ファイルのカードサムネイル領域（クリックで詳細へ） */
.card__thumb--file { display: block; text-decoration: none; }

/* =============================================================
   詳細画面
   ============================================================= */
/* 汎用ファイルのプレビュー不可ステージ（アイコン＋ダウンロード導線） */
.detail__stage--file { min-height: 300px; }
.filestage {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 12px; text-align: center; padding: 30px 20px; width: 100%;
}
.filestage__icon {
    font-size: 72px;
    color: var(--accent-cyan);
    filter: drop-shadow(0 6px 18px rgba(79, 195, 247, 0.25));
}
.filestage__label {
    font-size: 12px; font-weight: 700; letter-spacing: 0.05em;
    padding: 3px 12px; border-radius: 20px;
    background: rgba(40, 58, 100, 0.5); color: var(--text-sub);
}
.filestage__name { font-weight: 600; word-break: break-all; max-width: 90%; }
.filestage__note { font-size: 13px; color: var(--text-mute); }

/* SHA256 等の長いハッシュ値 */
.meta-list__row--wrap { flex-direction: column; align-items: flex-start; gap: 4px; }
.hash {
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 11px; color: var(--text-sub);
    word-break: break-all; line-height: 1.5;
}
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.detail__stage {
    border-radius: var(--radius-lg);
    padding: 14px;
    display: flex; align-items: center; justify-content: center;
    min-height: 300px;
    overflow: hidden;
}
.detail__image { max-height: 74vh; width: auto; border-radius: var(--radius-sm); }
.detail__video { width: 100%; border-radius: var(--radius-sm); background: #000; max-height: 74vh; }
.detail__side { border-radius: var(--radius-lg); padding: 22px; }
.detail__title { font-size: 18px; font-weight: 700; margin-bottom: 16px; word-break: break-word; }

.meta-list { display: flex; flex-direction: column; gap: 2px; }
.meta-list__row {
    display: flex; justify-content: space-between; gap: 14px;
    padding: 10px 2px;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
}
.meta-list__row dt { color: var(--text-sub); }
.meta-list__row dd { color: var(--text); font-weight: 600; text-align: right; word-break: break-word; }

.detail__actions { margin-top: 20px; display: flex; flex-direction: column; gap: 10px; }
.detail__row { display: flex; gap: 8px; flex-wrap: wrap; }
.detail__row .btn { flex: 1; }

/* =============================================================
   アップロード
   ============================================================= */
.upload { border-radius: var(--radius-lg); padding: 22px; }
.upload__controls { margin-bottom: 16px; }
.dropzone {
    border: 1.5px dashed var(--line-strong);
    border-radius: var(--radius);
    padding: 44px 20px;
    text-align: center;
    background: rgba(9, 16, 32, 0.4);
    transition: border-color 0.2s, background 0.2s;
    cursor: pointer;
}
.dropzone:hover, .dropzone:focus { border-color: rgba(79, 195, 247, 0.5); outline: none; }
.dropzone.is-hover { border-color: var(--accent-cyan); background: rgba(79, 195, 247, 0.08); }
.dropzone__icon { font-size: 40px; color: var(--accent-blue); margin-bottom: 12px; }
.dropzone__title { font-size: 17px; font-weight: 700; }
.dropzone__sub { color: var(--text-sub); font-size: 13px; margin-top: 4px; }
.dropzone__hint { color: var(--text-mute); font-size: 12px; margin-top: 14px; line-height: 1.8; }

.upload-list { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.upload-item {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: rgba(9, 16, 32, 0.5);
    border: 1px solid var(--line);
}
.upload-item__icon { font-size: 18px; color: var(--text-sub); width: 22px; text-align: center; }
.upload-item__body { flex: 1; min-width: 0; }
.upload-item__name {
    font-size: 14px; font-weight: 600;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.upload-item__meta { font-size: 12px; color: var(--text-mute); margin-top: 2px; }
.upload-item__bar { height: 6px; border-radius: 6px; background: rgba(9, 16, 32, 0.8); margin-top: 8px; overflow: hidden; }
.upload-item__fill {
    height: 100%; width: 0;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-violet));
    transition: width 0.2s var(--ease);
}
.upload-item__status { font-size: 12px; font-weight: 600; width: 74px; text-align: right; flex-shrink: 0; }
.upload-item.is-done .upload-item__status { color: var(--success); }
.upload-item.is-error .upload-item__status { color: var(--danger); }
.upload-item.is-error { border-color: rgba(255, 107, 129, 0.3); }
.upload__footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.form__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form__actions { display: flex; justify-content: flex-end; margin-top: 4px; }

/* ---- 管理パネル ----------------------------------------------- */
.panel { border-radius: var(--radius-lg); padding: 24px; margin-bottom: 18px; }
.panel__title { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 9px; margin-bottom: 18px; }
.panel__title i { color: var(--accent-cyan); }

/* ---- 空表示・通知 --------------------------------------------- */
.empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-mute);
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    background: rgba(9, 16, 32, 0.3);
}
.empty i { font-size: 40px; opacity: 0.5; margin-bottom: 12px; display: block; }
.empty p { font-size: 14px; }
.empty--sm { padding: 30px 20px; }

.notice { max-width: 480px; margin: 60px auto; text-align: center; padding: 42px 30px; border-radius: var(--radius-lg); }
.notice__code {
    font-size: 52px; font-weight: 800;
    background: linear-gradient(120deg, var(--accent-cyan), var(--accent-violet));
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
}
.notice__title { font-size: 20px; font-weight: 700; margin: 8px 0; }
.notice__text { color: var(--text-sub); font-size: 14px; margin-bottom: 22px; }

/* =============================================================
   モーダル（拡大表示・動画再生）
   ============================================================= */
.modal { position: fixed; inset: 0; z-index: 60; display: none; }
.modal.is-open { display: block; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(4, 8, 18, 0.82); backdrop-filter: blur(6px); }
.modal__body {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    max-width: min(92vw, 1100px);
    max-height: 90vh;
    display: flex; flex-direction: column;
}
.modal__close {
    position: absolute; top: -44px; right: 0;
    width: 38px; height: 38px;
    border-radius: 50%;
    background: rgba(20, 32, 58, 0.8);
    border: 1px solid var(--line-strong);
    color: #fff; font-size: 16px;
}
.modal__close:hover { background: rgba(40, 58, 100, 0.9); }
.modal__stage { display: flex; align-items: center; justify-content: center; }
.modal__stage img { max-width: 92vw; max-height: 88vh; border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.modal__stage video { max-width: 92vw; max-height: 88vh; border-radius: var(--radius-sm); background: #000; }

/* =============================================================
   トースト通知
   ============================================================= */
.toast-stack { position: fixed; bottom: 22px; right: 22px; z-index: 80; display: flex; flex-direction: column; gap: 10px; }
.toast {
    display: flex; align-items: center; gap: 11px;
    padding: 13px 17px;
    border-radius: var(--radius-sm);
    background: var(--surface-solid);
    border: 1px solid var(--line-strong);
    box-shadow: var(--shadow);
    font-size: 14px; font-weight: 600;
    min-width: 240px; max-width: 360px;
    animation: toast-in 0.28s var(--ease);
}
.toast.is-hide { animation: toast-out 0.24s var(--ease) forwards; }
.toast i { font-size: 16px; }
.toast--success i { color: var(--success); }
.toast--error i { color: var(--danger); }
.toast--info i { color: var(--accent-cyan); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(12px); } }

/* =============================================================
   ドラッグ＆ドロップ移動用の簡易モーダル
   ============================================================= */
.picker { position: fixed; inset: 0; z-index: 70; display: none; }
.picker.is-open { display: block; }
.picker__backdrop { position: absolute; inset: 0; background: rgba(4, 8, 18, 0.7); backdrop-filter: blur(4px); }
.picker__panel {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: min(92vw, 420px);
    max-height: 76vh;
    display: flex; flex-direction: column;
    border-radius: var(--radius-lg);
    background: var(--surface-solid);
    border: 1px solid var(--line-strong);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.picker__head { padding: 18px 20px; border-bottom: 1px solid var(--line); font-weight: 700; }
.picker__tree { padding: 10px; overflow-y: auto; flex: 1; }
.picker__foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.tree-node { }
.tree-node__row {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-sub);
}
.tree-node__row:hover { background: rgba(40, 58, 100, 0.5); color: var(--text); }
.tree-node__row.is-selected { background: rgba(106, 141, 255, 0.28); color: #fff; }
.tree-node__row i { color: var(--accent-blue); width: 16px; text-align: center; }
.tree-node__children { padding-left: 18px; }

/* =============================================================
   タップ領域（最低 48px × 48px を保証）
   ============================================================= */
.tap {
    min-width: 48px;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* =============================================================
   下部ナビゲーション（スマートフォン専用・既定は非表示）
   ============================================================= */
.bottom-nav {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    display: none;
    justify-content: space-around;
    align-items: stretch;
    height: 62px;
    padding-bottom: env(safe-area-inset-bottom);
    background: rgba(8, 15, 30, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--line);
    z-index: 50;
}
.bottom-nav__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--text-mute);
    font-size: 10.5px;
    font-weight: 600;
    position: relative;
}
.bottom-nav__item i { font-size: 18px; }
.bottom-nav__item.is-active { color: var(--accent-cyan); }
.bottom-nav__item.is-active::before {
    content: "";
    position: absolute;
    top: 0; left: 50%;
    transform: translateX(-50%);
    width: 26px; height: 3px;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-violet));
}

/* =============================================================
   FAB（フローティングアクションボタン・スマートフォン専用）
   ============================================================= */
.fab {
    position: fixed;
    right: 16px;
    bottom: calc(62px + 16px + env(safe-area-inset-bottom));
    display: none;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    z-index: 55;
}
.fab__main {
    width: 56px; height: 56px;
    border-radius: 50%;
    border: none;
    color: #fff;
    font-size: 20px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-violet));
    box-shadow: 0 12px 30px rgba(106, 100, 255, 0.42);
    transition: transform 0.24s var(--ease);
}
.fab.is-open .fab__main { transform: rotate(45deg); }
.fab__menu {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}
.fab.is-open .fab__menu { opacity: 1; pointer-events: auto; transform: none; }
.fab__action { display: flex; align-items: center; gap: 10px; background: none; border: none; padding: 0; }
.fab__label {
    background: var(--surface-solid);
    border: 1px solid var(--line);
    padding: 8px 13px;
    border-radius: 10px;
    font-size: 13px; font-weight: 600;
    color: var(--text);
    box-shadow: var(--shadow-sm);
}
.fab__icon {
    width: 46px; height: 46px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--surface-solid);
    border: 1px solid var(--line-strong);
    color: var(--accent-cyan);
    font-size: 16px;
}

/* =============================================================
   ボトムシート（フォルダツリー）
   ============================================================= */
.sheet { position: fixed; inset: 0; z-index: 120; display: none; }
.sheet.is-open { display: block; }
.sheet__backdrop { position: absolute; inset: 0; background: rgba(4, 8, 18, 0.6); backdrop-filter: blur(3px); }
.sheet__panel {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    background: var(--surface-solid);
    border-top-left-radius: 22px;
    border-top-right-radius: 22px;
    border-top: 1px solid var(--line-strong);
    box-shadow: 0 -20px 50px rgba(3, 8, 20, 0.6);
    padding-bottom: env(safe-area-inset-bottom);
    animation: sheet-up 0.28s var(--ease);
}
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet__handle { width: 44px; height: 5px; border-radius: 5px; background: var(--line-strong); margin: 10px auto 4px; }
.sheet__head { display: flex; align-items: center; justify-content: space-between; padding: 6px 16px 12px; border-bottom: 1px solid var(--line); }
.sheet__title { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.sheet__title i { color: var(--accent-cyan); }
.sheet__body { overflow-y: auto; padding: 8px; -webkit-overflow-scrolling: touch; }
.sheet__loading { padding: 16px; color: var(--text-mute); font-size: 14px; }
.sheet-link {
    display: flex; align-items: center; gap: 11px;
    padding: 13px 16px;
    border-radius: 10px;
    color: var(--text-sub);
    font-weight: 600; font-size: 14px;
    min-height: 48px;
}
.sheet-link:hover, .sheet-link:active { background: var(--surface-2); color: var(--text); }
.sheet-link i { color: var(--accent-blue); width: 16px; text-align: center; }

/* トップバーのフォルダボタン（既定は非表示） */
.topbar__folder { display: none; background: none; border: none; color: var(--text); font-size: 18px; border-radius: 12px; }
.topbar__folder:hover { background: rgba(40, 58, 100, 0.4); }

/* =============================================================
   高機能ビューア（画像スワイプ・ズーム / 動画）
   ============================================================= */
.viewer { position: fixed; inset: 0; z-index: 200; display: none; }
.viewer.is-open { display: block; }
.viewer__backdrop { position: absolute; inset: 0; background: rgba(3, 6, 14, 0.96); }
.viewer__bar {
    position: absolute;
    top: 0; left: 0; right: 0;
    display: flex; align-items: center; gap: 8px;
    padding: max(10px, env(safe-area-inset-top)) 12px 10px;
    z-index: 3;
    background: linear-gradient(180deg, rgba(3, 6, 14, 0.7), transparent);
}
.viewer__title { flex: 1; color: var(--text); font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer__tools { display: flex; gap: 2px; }
.viewer__btn {
    width: 48px; height: 48px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 12px;
    background: none; border: none;
    color: var(--text); font-size: 16px; font-weight: 600;
    text-decoration: none;
}
.viewer__btn:hover { background: rgba(255, 255, 255, 0.1); }
.viewer__nav {
    position: absolute;
    top: 50%; transform: translateY(-50%);
    width: 50px; height: 50px;
    border-radius: 50%;
    background: rgba(20, 32, 58, 0.6);
    border: 1px solid var(--line-strong);
    color: #fff; font-size: 17px;
    z-index: 3;
    display: flex; align-items: center; justify-content: center;
}
.viewer__nav--prev { left: 14px; }
.viewer__nav--next { right: 14px; }
.viewer__nav:hover { background: rgba(40, 58, 100, 0.8); }
.viewer__stage {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
    touch-action: none;
}
.viewer__img {
    max-width: 100%; max-height: 100%;
    user-select: none; -webkit-user-drag: none;
    will-change: transform;
}
.viewer__stage.is-zoomed { cursor: grab; }
.viewer__video { width: 100%; max-width: 100%; max-height: 100%; background: #000; }
.viewer__videobar {
    position: absolute;
    left: 50%; transform: translateX(-50%);
    bottom: calc(16px + env(safe-area-inset-bottom));
    display: flex; gap: 8px;
    z-index: 3;
    background: rgba(9, 16, 32, 0.7);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 4px;
    backdrop-filter: blur(8px);
}

/* =============================================================
   アップロード選択ボタン / 詳細アコーディオン / 動画ツール
   ============================================================= */
.upload-picker { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.upload-picker__btn { flex: 1; min-width: 150px; min-height: 48px; }
.is-mobile-only { display: none; }

.meta-accordion { margin: 0; }
.meta-accordion__summary { display: none; }

.detail__zoomhint {
    position: absolute;
    bottom: 12px; right: 12px;
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 11px;
    border-radius: 20px;
    background: rgba(6, 12, 24, 0.72);
    color: var(--text-sub);
    font-size: 12px; font-weight: 600;
    pointer-events: none;
}
.detail__stage[data-file-card] { position: relative; cursor: zoom-in; }
.detail__image { cursor: zoom-in; }
.video-tools { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 12px; }
.video-tools .btn { min-height: 44px; }

/* 段階読み込み: 読み込み完了までは背景のみ、完了でフェード表示 */
.lazy-img { opacity: 0; transition: opacity 0.45s var(--ease); }
.lazy-img.is-loaded { opacity: 1; }

/* =============================================================
   レスポンシブ
   ブレークポイントは端末境界ではなくレイアウト破綻点で設定する。
   ============================================================= */

/* ノートPC〜タブレット横: 詳細を縦積みに */
@media (max-width: 1024px) {
    .detail { grid-template-columns: 1fr; }
    .detail__side { order: 2; }
}

/* タブレット縦以下: サイドバーをスライド式（ハンバーガー）へ */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.28s var(--ease);
        width: min(300px, 82vw);
        box-shadow: var(--shadow);
    }
    .sidebar.is-open { transform: translateX(0); }
    .sidebar__close { display: inline-flex; }
    .main { margin-left: 0; }
    .topbar__menu { display: inline-flex; }
    .topbar__folder { display: inline-flex; }
    .sidebar-overlay.is-open { display: block; }
    .topbar__upload span { display: none; }
}

/* タブレット縦: 一覧は 3 列 */
@media (max-width: 768px) {
    .stat-row { grid-template-columns: repeat(3, 1fr); }
    .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .folders-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* スマートフォン: 専用レイアウトへ切り替え */
@media (max-width: 640px) {
    .content { padding: 16px 12px 92px; }        /* 下部ナビ分の余白を確保 */
    .bottom-nav { display: flex; }
    .fab { display: flex; }
    .is-mobile-only { display: inline-flex; }
    .topbar__upload { display: none; }           /* アップロードは FAB に集約 */

    /* 一覧は 2 列・カード幅は画面いっぱい */
    .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .folders-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .stat-row { grid-template-columns: 1fr; }

    .page__head { flex-direction: column; align-items: flex-start; }
    .page__tools { width: 100%; }
    .form__grid { grid-template-columns: 1fr; }
    .hero { padding: 24px 20px; }
    .hero__title { font-size: 21px; }
    .toast-stack { left: 12px; right: 12px; bottom: calc(72px + env(safe-area-inset-bottom)); }
    .toast { min-width: 0; }

    /* 詳細情報はアコーディオン化（タップで開閉） */
    .meta-accordion__summary {
        display: flex; align-items: center; justify-content: space-between;
        cursor: pointer; list-style: none;
        padding: 14px 4px;
        font-size: 15px; font-weight: 700;
        min-height: 48px;
    }
    .meta-accordion__summary::-webkit-details-marker { display: none; }
    .meta-accordion__summary > span { display: flex; align-items: center; gap: 8px; }
    .meta-accordion__summary i.fa-circle-info { color: var(--accent-cyan); }
    .meta-accordion__chevron { transition: transform 0.2s var(--ease); color: var(--text-mute); }
    .meta-accordion[open] .meta-accordion__chevron { transform: rotate(180deg); }

    .card__actions { padding: 0 8px 9px; gap: 4px; }
    /* タップ領域を 44px 以上に拡大（Apple/Google の推奨） */
    .card__actions .icon-btn { width: 44px; height: 44px; }
    /* 長いファイル名はモバイルでは 2 行まで表示（省略記号付き） */
    .card__title {
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow-wrap: anywhere;
        line-height: 1.32;
    }
    .detail__side { padding: 18px; }
    .viewer__nav { width: 44px; height: 44px; }
}

/* 極小画面（スマホ縦の狭い端末）: 1 列表示 */
@media (max-width: 380px) {
    .grid { grid-template-columns: 1fr; }
    .folders-grid { grid-template-columns: 1fr; }
}

/* 大画面: 余白と列幅をゆったり */
@media (min-width: 1600px) {
    .page { max-width: 1520px; }
    .grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
}

/* ビューア表示中は背面のスクロールを抑止 */
body.viewer-open { overflow: hidden; }

/* =============================================================
   マルチユーザー・管理画面（追加コンポーネント）
   ============================================================= */

/* 容量メーター（トップバー右上） */
.storage-meter {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 12px;
    border-radius: 12px;
    background: rgba(9, 16, 32, 0.5);
    border: 1px solid var(--line);
    color: var(--text-sub);
    white-space: nowrap;
}
.storage-meter__info { display: flex; flex-direction: column; gap: 4px; min-width: 130px; }
.storage-meter__bar { height: 5px; border-radius: 5px; background: rgba(9, 16, 32, 0.85); overflow: hidden; }
.storage-meter__bar span { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--accent-cyan), var(--accent-violet)); }
.storage-meter__text { font-size: 11px; }

/* サイドナビの区切り見出し */
.nav__section { font-size: 11px; color: var(--text-mute); font-weight: 700; padding: 16px 14px 6px; letter-spacing: 0.08em; }

/* 管理メニュー導線 */
.admin-menu { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.admin-menu__item {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 18px; border-radius: var(--radius);
    color: var(--text-sub); font-weight: 600; font-size: 13px;
    transition: transform 0.18s var(--ease), border-color 0.2s, color 0.2s;
}
.admin-menu__item:hover { transform: translateY(-2px); color: var(--text); border-color: var(--line-strong); }
.admin-menu__item i { font-size: 20px; color: var(--accent-cyan); }

/* データテーブル（PC は表・スマホはカード化） */
.table-wrap { border-radius: var(--radius); padding: 6px; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table th { color: var(--text-sub); font-weight: 600; font-size: 12px; letter-spacing: 0.02em; }
.data-table tbody tr:hover, .data-table tbody tr:hover { background: rgba(40, 58, 100, 0.18); }
.data-table__actions { text-align: right; white-space: nowrap; }
.data-table__actions .icon-btn { margin-left: 2px; }
.data-table__empty { text-align: center; color: var(--text-mute); padding: 30px; }
.data-table__ua { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }

.admin-search .field__control { height: 42px; min-width: 220px; }

/* バッジ・状態表示 */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge--admin { background: rgba(169, 112, 255, 0.18); color: #cbb4ff; }
.badge--user { background: rgba(79, 195, 247, 0.16); color: #a9e0fb; }
.dot-status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.dot-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; }
.dot-status.is-on { color: var(--success); }
.dot-status.is-on::before { background: var(--success); }
.dot-status.is-off { color: var(--text-mute); }
.dot-status.is-off::before { background: var(--text-mute); }
.icon-btn.is-danger-text { color: var(--danger); }
.icon-btn.is-danger-text:hover { background: rgba(255, 107, 129, 0.16); }

/* ページネーション */
.pager { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 18px; }
.pager__item {
    min-width: 44px; height: 44px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line);
    color: var(--text-sub); font-weight: 600; font-size: 14px;
}
.pager__item:hover { color: var(--text); border-color: var(--line-strong); }
.pager__item.is-active { background: linear-gradient(135deg, var(--accent-blue), var(--accent-violet)); color: #fff; border-color: transparent; }

/* トグルスイッチ */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch__slider { width: 46px; height: 26px; border-radius: 20px; background: rgba(9, 16, 32, 0.85); border: 1px solid var(--line); position: relative; transition: background 0.2s; flex-shrink: 0; }
.switch__slider::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--text-sub); transition: transform 0.2s, background 0.2s; }
.switch input:checked + .switch__slider { background: linear-gradient(90deg, var(--accent-cyan), var(--accent-blue)); }
.switch input:checked + .switch__slider::after { transform: translateX(20px); background: #fff; }
.switch input:disabled + .switch__slider { opacity: 0.5; }
.switch__label { font-size: 14px; color: var(--text-sub); }

/* チェックボックス（権限マトリクス） */
.checkbox { display: inline-flex; cursor: pointer; }
.checkbox input { display: none; }
.checkbox__box {
    width: 24px; height: 24px; border-radius: 6px;
    border: 1px solid var(--line-strong); background: rgba(9, 16, 32, 0.6);
    display: inline-flex; align-items: center; justify-content: center; transition: background 0.15s;
}
.checkbox__box::after { content: "\f00c"; font-family: "Font Awesome 6 Free"; font-weight: 900; font-size: 12px; color: #fff; opacity: 0; transition: opacity 0.15s; }
.checkbox input:checked + .checkbox__box { background: linear-gradient(135deg, var(--accent-blue), var(--accent-violet)); border-color: transparent; }
.checkbox input:checked + .checkbox__box::after { opacity: 1; }

/* 容量入力 */
.quota-input { display: flex; gap: 10px; margin-top: 10px; align-items: center; }
.field__control--sm { height: 44px; max-width: 160px; }

/* フォルダ権限レイアウト */
.fp-layout { display: grid; grid-template-columns: 280px 1fr; gap: 16px; align-items: start; }
.fp-side { border-radius: var(--radius); padding: 10px; max-height: 72vh; overflow-y: auto; }
.fp-side__head { font-weight: 700; padding: 8px 10px; color: var(--text-sub); }
.fp-tree { display: flex; flex-direction: column; gap: 2px; }
.fp-folder { display: flex; align-items: center; gap: 8px; padding: 10px; border-radius: 8px; color: var(--text-sub); font-size: 14px; font-weight: 600; }
.fp-folder:hover { background: var(--surface-2); color: var(--text); }
.fp-folder.is-active { background: rgba(106, 141, 255, 0.24); color: #fff; }
.fp-folder i { color: var(--accent-blue); }
.fp-main { border-radius: var(--radius); padding: 18px; min-height: 240px; }
.fp-main__head { margin-bottom: 14px; }
.fp-matrix__col, .fp-matrix__cell { text-align: center; }
.fp-uname { display: block; font-size: 12px; color: var(--text-mute); }

/* スマートフォン: テーブルをカード化 */
@media (max-width: 640px) {
    .storage-meter { display: none; }
    .admin-menu { grid-template-columns: repeat(2, 1fr); }
    .fp-layout { grid-template-columns: 1fr; }
    .fp-side { max-height: 300px; }

    .data-table thead { display: none; }
    .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
    .data-table tr { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; background: rgba(9, 16, 32, 0.4); overflow: hidden; }
    .data-table td { display: flex; justify-content: space-between; gap: 12px; text-align: right; white-space: normal; }
    .data-table td:last-child { border-bottom: none; }
    .data-table td::before { content: attr(data-label); color: var(--text-mute); font-size: 12px; font-weight: 600; text-align: left; flex-shrink: 0; }
    .data-table__ua { max-width: none; }
    .admin-search .field__control { min-width: 0; width: 100%; }
}

/* =============================================================
   セッション管理（ログイン端末一覧）
   ============================================================= */
.panel__head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.session-list { display: flex; flex-direction: column; gap: 10px; }
.session-card {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    background: rgba(9, 16, 32, 0.45);
    border: 1px solid var(--line);
}
.session-card.is-current { border-color: var(--accent-blue); box-shadow: 0 0 0 1px rgba(106, 141, 255, 0.3); }
.session-card__icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; color: var(--accent-cyan);
    background: linear-gradient(140deg, rgba(79, 195, 247, 0.14), rgba(169, 112, 255, 0.14));
    flex-shrink: 0;
}
.session-card__body { flex: 1; min-width: 0; }
.session-card__title { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.session-card__meta { color: var(--text-mute); font-size: 12px; margin-top: 4px; display: flex; gap: 12px; flex-wrap: wrap; }
.session-card__btn { flex-shrink: 0; }
.tag { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 20px; }
.tag--current { background: rgba(106, 141, 255, 0.2); color: #c9d6ff; }

@media (max-width: 560px) {
    .session-card { flex-wrap: wrap; }
    .session-card__btn { width: 100%; }
}

/* =============================================================
   チャンクアップロードの進捗 UI（Google ドライブ / YouTube Studio 風）
   ============================================================= */
.up-list { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.up-item {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: rgba(9, 16, 32, 0.5);
    border: 1px solid var(--line);
}
.up-item__icon {
    width: 40px; height: 40px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 17px; color: var(--accent-cyan);
    background: linear-gradient(140deg, rgba(79, 195, 247, 0.14), rgba(169, 112, 255, 0.14));
    flex-shrink: 0;
}
.up-item__main { flex: 1; min-width: 0; }
.up-item__top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.up-item__name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-item__pct { font-size: 13px; font-weight: 700; color: var(--text-sub); flex-shrink: 0; }
.up-item__bar { height: 6px; border-radius: 6px; background: rgba(9, 16, 32, 0.85); margin: 7px 0 6px; overflow: hidden; }
.up-item__fill { display: block; height: 100%; width: 0; border-radius: 6px; background: linear-gradient(90deg, var(--accent-cyan), var(--accent-violet)); transition: width 0.3s var(--ease); }
.up-item__sub { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--text-mute); }
.up-item__cancel { width: 36px; height: 36px; border-radius: 10px; border: 1px solid transparent; background: rgba(20, 32, 58, 0.6); color: var(--text-sub); flex-shrink: 0; }
.up-item__cancel:hover { color: var(--danger); background: rgba(255, 107, 129, 0.14); }
.up-item.is-done { border-color: rgba(70, 214, 166, 0.3); }
.up-item.is-done .up-item__fill { background: var(--success); }
.up-item.is-done .up-item__status { color: var(--success); }
.up-item.is-error { border-color: rgba(255, 107, 129, 0.3); }
.up-item.is-error .up-item__status { color: var(--danger); }
.up-item.is-canceled { opacity: 0.6; }
.upload__note { flex: 1; color: var(--text-mute); font-size: 12px; display: flex; align-items: center; gap: 8px; }
.upload__note i { color: var(--accent-cyan); }

/* =============================================================
   関連ファイル（GoPro MP4/LRV・Insta360 前後レンズ など）
   ============================================================= */
.related { margin-top: 20px; }
.related__title { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.related__title i { color: var(--accent-cyan); }
.related__list { display: flex; flex-direction: column; gap: 8px; }
.related__item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: 12px;
    background: rgba(9, 16, 32, 0.5); border: 1px solid var(--line);
    transition: border-color 0.2s, transform 0.18s var(--ease);
}
.related__item:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.related__icon {
    width: 38px; height: 38px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; color: var(--accent-cyan);
    background: linear-gradient(140deg, rgba(79, 195, 247, 0.14), rgba(169, 112, 255, 0.14));
    flex-shrink: 0;
}
.related__body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.related__role { font-size: 12px; color: var(--accent-blue); font-weight: 600; }
.related__name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.related__go { color: var(--text-mute); font-size: 12px; }

/* =============================================================
   メモ（フォルダ別）
   ============================================================= */
/* フォルダ画面のメモ導線 */
.note-entry {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 16px; border-radius: var(--radius);
    color: var(--text); margin-bottom: 8px;
    transition: transform 0.18s var(--ease), border-color 0.2s;
}
.note-entry:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.note-entry__icon {
    width: 44px; height: 44px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; color: var(--accent-cyan);
    background: linear-gradient(140deg, rgba(79, 195, 247, 0.14), rgba(169, 112, 255, 0.14));
    flex-shrink: 0;
}
.note-entry__body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.note-entry__title { font-weight: 600; font-size: 15px; }
.note-entry__sub { font-size: 12px; color: var(--text-mute); }
.note-entry__count { font-size: 12px; color: var(--text-mute); background: rgba(9, 16, 32, 0.6); padding: 2px 10px; border-radius: 20px; }
.note-entry__go { color: var(--text-mute); font-size: 13px; }

/* メモ一覧カード */
.note-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.note-card {
    border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--line);
    box-shadow: var(--shadow-sm); position: relative;
    transition: transform 0.18s var(--ease), border-color 0.2s, box-shadow 0.2s;
}
.note-card:hover { transform: translateY(-3px); border-color: var(--line-strong); box-shadow: var(--shadow); }
.note-card__link, .note-card--link { display: flex; flex-direction: column; gap: 8px; padding: 16px; color: var(--text); }
.note-card__icon {
    width: 40px; height: 40px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 17px; color: var(--accent-cyan);
    background: linear-gradient(140deg, rgba(79, 195, 247, 0.14), rgba(169, 112, 255, 0.14));
}
.note-card__title { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-card__date { font-size: 12px; color: var(--text-mute); }
.note-card .menu { position: absolute; top: 8px; right: 8px; }

/* メモ編集 */
.note-editor { border-radius: var(--radius-lg); padding: 22px; }
.note-editor__title {
    width: 100%; background: none; border: none; outline: none;
    color: var(--text); font-size: 22px; font-weight: 700; padding: 4px 0;
}
.note-editor__title::placeholder { color: var(--text-mute); }
.note-editor__rule { border: none; border-top: 1px solid var(--line); margin: 12px 0; }
.note-editor__content {
    width: 100%; background: none; border: none; outline: none;
    color: var(--text); font-size: 15px; line-height: 1.8; resize: none;
    min-height: 220px; overflow: hidden; font-family: inherit;
}
.note-editor__content::placeholder { color: var(--text-mute); }
.note-editor__meta { margin-top: 14px; font-size: 12px; color: var(--text-mute); }
.note-status { font-size: 13px; color: var(--text-sub); min-width: 88px; text-align: right; white-space: nowrap; }

/* アクセシビリティ: 視差を抑えたいユーザーへの配慮 */
@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
