/* --- Variables & Basic Styles --- */
:root {
    --bg-color: #f8f8f8;
    --text-color: #1a1a1a;
    --card-bg-color: #ffffff;
    --border-color: #e6e6e6;
    --accent-color: #007aff;
    --secondary-text-color: #6e6e73;
    --sidebar-width: 260px;

    /* 検索ボックスの基準幅と最大幅（拡張時） */
    --search-base: 440px;
    --search-max: 560px;
}
html, body { height: 100%; margin: 0; overflow: hidden; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}
.page-wrapper { display: flex; height: 100%; }

/* --- Sidebar --- */
.sidebar { width: var(--sidebar-width); background-color: #ffffff; border-right: 1px solid var(--border-color); height: 100%; position: relative; z-index: 1000; display: flex; flex-direction: column; flex-shrink: 0; transition: margin-left 0.3s ease-in-out; }
.page-wrapper.sidebar-collapsed .sidebar { margin-left: calc(-1 * var(--sidebar-width)); }
.sidebar-content { flex-grow: 1; overflow-y: auto; padding: 24px; }
/* 変更後：justify-content: center を追加し、gapを削除 */
.sidebar-logo { 
    display: flex; 
    align-items: center; 
    justify-content: center; /* 中央揃え */
    padding-bottom: 24px; 
    margin-bottom: 16px; 
    border-bottom: 1px solid var(--border-color); 
    text-decoration: none; 
    color: inherit; 
}
/* 画像サイズはそのまま（必要であれば width/height を調整してください） */
.sidebar-logo img { width: 40px; height: 40px; -webkit-user-drag: none; user-select: none; }
/* spanのスタイル定義はHTMLから要素を削除したので無視されますが、念のため残しておいても問題ありません */
.sidebar-logo span { font-size: 20px; font-weight: 600; }
.sidebar-header { margin-bottom: 16px; }
.filters .filter-group { margin-bottom: 24px; }
.filters h4 { margin: 0 0 16px 0; color: var(--secondary-text-color); font-size: 14px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.company-group { margin-bottom: 18px; }
.company-name { font-size: 16px; font-weight: 600; margin: 0 0 14px 0; }
.service-list { padding-left: 20px; }
.filter-item { display: flex; align-items: center; gap: 15px; margin-bottom: 15px; cursor: pointer; user-select: none; }
.filter-label-text { font-size: 16px; line-height: 1; }
.checkBox { display: block; width: 12px; height: 12px; border-radius: 3px; position: relative; overflow: hidden; box-shadow: 0px 0px 0px 2px var(--text-color); flex-shrink: 0; }
.checkBox .transition { width: 60px; height: 60px; background-color: var(--text-color); top: -52px; left: -52px; position: absolute; transform: rotateZ(45deg); z-index: 100; transition: 300ms ease; }
.filter-item input[type="checkbox"] { position: absolute; opacity: 0; height: 0; width: 0; }
.filter-item input[type="checkbox"]:checked ~ .checkBox .transition { left: -10px; top: -10px; }
/* === 修正版：なめらかなアニメーション === */
.sidebar-user-profile {
    border-top: 1px solid var(--border-color);
    padding: 20px 24px 18px; /* 通常時の余白 */
    display: flex;
    align-items: center;
    justify-content: flex-start; /* 左寄せ固定 */
    gap: 14px;
    flex-shrink: 0;
    border-radius: 12px;
    position: relative;
    /* padding-leftのアニメーションを追加してヌルっと動かす */
    transition: background-color 0.4s cubic-bezier(0.2, 0.8, 0.2, 1),
                border-color 0.4s cubic-bezier(0.2, 0.8, 0.2, 1),
                box-shadow 0.4s cubic-bezier(0.2, 0.8, 0.2, 1),
                padding-left 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sidebar-user-profile.is-logged-in {
    background-color: rgba(0, 122, 255, 0.06);
    border-color: rgba(0, 122, 255, 0.2);
    box-shadow: 0 3px 9px rgba(0, 122, 255, 0.08);
    cursor: pointer;
}
.sidebar-user-profile.is-logged-in.is-hover {
    background-color: rgba(0, 122, 255, 0.12);
    border-color: rgba(0, 122, 255, 0.32);
    box-shadow: 0 10px 24px rgba(0, 122, 255, 0.14);
    /* 中央寄せ(justify-content:center)はやめて、左余白を増やして中央に見せる */
    padding-left: 70px;
}
.user-avatar {
    width: 46px; height: 46px; border-radius: 50%;
    background: linear-gradient(135deg, rgba(255,255,255,0.4), rgba(255,255,255,0));
    display: grid; place-items: center; overflow: hidden; position: relative; flex-shrink: 0;
    transition: box-shadow 320ms cubic-bezier(0.33, 1, 0.68, 1), transform 320ms cubic-bezier(0.33, 1, 0.68, 1);
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.05), 0 2px 6px rgba(0,0,0,0.06);
}
.sidebar-user-profile.is-logged-in.is-hover .user-avatar {
    box-shadow: inset 0 0 0 1px rgba(122,174,255,0.45), 0 6px 16px rgba(122,174,255,0.18);
    transform: translateY(-1px);
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; display: none; }
.user-avatar.has-photo img { display: block; }
.user-icon {
    font-size: 28px; color: #aeb4c2;
    transition: transform 360ms cubic-bezier(0.33, 1, 0.68, 1), color 360ms cubic-bezier(0.33, 1, 0.68, 1);
}
.user-avatar.has-photo .user-icon { display: none; }
.sidebar-user-profile.is-logged-in.is-hover .user-icon { transform: translateY(-1px); color: #7aaeff; }

.user-info {
    display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
    /* カクつく原因となる align-items のtransitionを削除 */
    transition: transform 360ms cubic-bezier(0.33, 1, 0.68, 1), opacity 200ms ease;
}
.sidebar-user-profile.is-logged-in.is-hover .user-info {
    transform: translateY(-1px);
    /* ここでも align-items: center は指定しない */
}

.user-name { font-weight: 600; }
.user-status {
    font-size: 13px; color: var(--secondary-text-color);
    transition: opacity 280ms cubic-bezier(0.33, 1, 0.68, 1), transform 280ms cubic-bezier(0.33, 1, 0.68, 1), max-height 320ms cubic-bezier(0.22, 0.68, 0, 1);
    max-height: 20px; overflow: hidden;
}
.sidebar-user-profile.is-logged-in.is-hover .user-status {
    opacity: 0; transform: translateY(-6px); max-height: 0;
}
/* === 修正版ここまで === */

/* --- Main Content & Header Layout --- */
.main-content { flex-grow: 1; height: 100vh; overflow-y: auto; }

/* ヘッダー（崩れ対策済み） */
.header {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 24px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 20px;
    position: sticky; /* 絶対配置（検索・フィルター）の基準 */
    top: 0;
    z-index: 900;
}
.header-left, .header-center, .header-right { display: flex; align-items: center; min-width: 0; }
.header-left { gap: 16px; justify-content: flex-start; }
.header-center { justify-content: center; } /* 中央カラムは表示用。検索自体は絶対配置で中央固定 */
.header-right { gap: 12px; justify-content: flex-end; white-space: nowrap; }

.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.logo .header-logo-icon { width: 32px; height: 32px; -webkit-user-drag: none; user-select: none; }
.logo span { font-size: 22px; font-weight: 600; }
.icon-btn { background: none; border: none; cursor: pointer; color: var(--text-color); padding: 8px; border-radius: 50%; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; transition: background-color 0.2s ease; }
.icon-btn:hover { background-color: rgba(0,0,0,0.05); }

/* ===== 検索：常にヘッダーど真ん中。拡張は search:focus-within のみで発火 ===== */
.search {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: var(--search-base);
    max-width: var(--search-max);
    min-width: 240px;
    z-index: 902;
    transition: width .25s cubic-bezier(.2,.7,.3,1); /* スムーズ（以前の挙動に戻す） */
}
.search:focus-within {
    width: var(--search-max); /* クリックで発火するのは検索内のみ（フィルターでは発火しない） */
}
.search__input { width: 100%; min-width: 0; padding: 10px 40px 10px 20px; border: 1px solid var(--border-color); border-radius: 20px; font-size: 16px; background-color: var(--bg-color); transition: box-shadow 0.2s ease, background-color .2s ease; }
.search__input:focus { outline: 1px solid var(--accent-color); background-color: #fff; box-shadow: 0 6px 16px rgba(0,0,0,0.08); }
.search__button { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; padding: 8px; }
.search__icon { width: 20px; height: 20px; fill: var(--secondary-text-color); }

/* ===== フィルター：常に右側。検索最大幅ぶんスペースを確保し、検索拡張の影響を受けない ===== */
.sort-switcher,
.filter-switcher {
    position: absolute;
    right: calc(50% + var(--search-max) / 2 + 16px); /* 検索の最大幅の“右端”から一定距離に固定 */
    top: 50%;
    transform: translateY(-50%);
    z-index: 901;
    width: max-content; /* ラベルが長くなると左にだけ広がる */
}

/* Header Buttons */
.glass-btn, .login-btn, .lang-btn { padding: 10px 20px; border-radius: 8px; font-weight: 500; cursor: pointer; transition: all 0.2s ease; border: 1px solid transparent; white-space: nowrap; }
.glass-btn { background: rgba(255, 255, 255, 0.2); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-color: rgba(0, 0, 0, 0.1); box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.glass-btn:hover { background: rgba(255, 255, 255, 0.4); }
.login-btn { background-color: var(--accent-color); color: white; }
.login-btn:hover { background-color: #0056b3; }

/* 言語切替（既存） */
.language-switcher { position: relative; }
.lang-btn { background: none; border-color: var(--border-color); display: flex; align-items: center; gap: 8px; }
.lang-btn:hover { background-color: rgba(0,0,0,0.05); }
.lang-btn .arrow-icon { font-size: 12px; }
.lang-menu { position: absolute; top: calc(100% + 8px); right: 0; background-color: white; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); list-style: none; padding: 8px; margin: 0; width: 150px; z-index: 1000; opacity: 0; visibility: hidden; transform: translateY(10px); transition: opacity 0.2s ease, transform 0.2s ease; }
.lang-menu.show { opacity: 1; visibility: visible; transform: translateY(0); }
.lang-menu li a { display: block; padding: 8px 12px; color: var(--text-color); text-decoration: none; border-radius: 4px; }
.lang-menu li a:hover { background-color: #f0f0f0; }

/* --- Gallery & Cards --- */
.container { padding: 24px; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; }

.prompt-card { background-color: var(--card-bg-color); border-radius: 12px; overflow: hidden; border: 1px solid var(--border-color); display: flex; flex-direction: column; cursor: pointer; transition: box-shadow 0.2s ease, transform 0.2s ease; }
.prompt-card:hover { transform: translateY(-5px); box-shadow: 0 8px 24px rgba(0,0,0,0.08); }

/* サムネイル */
.card-thumb-wrap { position: relative; width: 100%; height: 200px; overflow: hidden; background-color: #f0f0f0; }
.card-thumbnail { width: 100%; height: 100%; object-fit: cover; display: block; background-color: #f0f0f0; }
.card-thumb-wrap .thumb-badge { position: absolute; left: 8px; bottom: 8px; background: rgba(0,0,0,0.65); color: #fff; font-size: 12px; padding: 4px 7px; border-radius: 7px; display: inline-flex; align-items: center; gap: 4px; }

/* ▼ 複数メディア用プレビューグリッド */
.thumb-grid { width: 100%; height: 200px; display: grid; gap: 2px; background: #000; }
.thumb-grid.columns-1 { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.thumb-grid.columns-2 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; }
.thumb-grid.columns-3, .thumb-grid.columns-4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.thumb-cell { position: relative; overflow: hidden; background: #111; }
.thumb-cell img, .thumb-cell video { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-cell .thumb-badge { position: absolute; right: 6px; bottom: 6px; background: rgba(0,0,0,0.6); color: #fff; font-size: 12px; padding: 2px 6px; border-radius: 6px; display: inline-flex; align-items: center; gap: 4px; }
.thumb-placeholder { width: 100%; height: 100%; color: #ccc; display: grid; place-items: center; font-size: 12px; letter-spacing: 1px; }
.thumb-grid.columns-3 .thumb-cell:nth-child(3) { grid-column: 1 / -1; }

.card-content { padding: 16px; flex-grow: 1; }
.card-title { font-size: 18px; font-weight: 600; margin: 0 0 12px 0; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; min-height: 44px; }
.card-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { font-size: 12px; padding: 4px 10px; border-radius: 6px; font-weight: 500; color: white; }
.tag.secondary { background-color: #f0f0f0; color: var(--secondary-text-color); }

/* ▼ メタ行（作者＋アクション） */
.card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px 12px;
    background: transparent;
}
.author-name { font-size: 12px; color: var(--secondary-text-color); font-style: italic; }

.card-actions-inline { display: flex; gap: 4px; }
.action-btn {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--secondary-text-color);
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.05s ease;
    position: relative;
}
.action-btn:hover { background-color: #f5f5f5; color: var(--text-color); }
/* 押した瞬間にギュッと縮む演出（心地よいクリック感） */
.action-btn:active { 
    transform: scale(0.9); 
    transition-duration: 0.05s; 
}
.action-btn .count { font-size: 14px; font-weight: 500; }
.favorite-btn.active { color: #ff4757; }
/* 保存（ブックマーク）のアクティブ色 */
.bookmark-btn.active { color: #00b894; }

/* === Card Flip Animation === */
.gallery-grid { perspective: 1200px; }
.prompt-card { position: relative; transform-origin: left center; will-change: transform, box-shadow; }
.prompt-card::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, rgba(0,0,0,0.08), rgba(0,0,0,0) 35%); opacity: 0; transition: opacity .2s ease; border-radius: 12px; }
.prompt-card.flipping { animation: flipPage 620ms cubic-bezier(.2,.65,.2,1) both; }
.prompt-card.flipping::after { opacity: 1; }
@keyframes flipPage {
  0% { transform: rotateY(0deg) scale(1); box-shadow: 0 8px 24px rgba(0,0,0,0.08); }
  25% { transform: rotateY(-18deg) scale(1.02); box-shadow: 0 12px 28px rgba(0,0,0,0.10); }
  55% { transform: rotateY(-92deg) scale(1.0); box-shadow: 0 10px 22px rgba(0,0,0,0.08); }
  100% { transform: rotateY(-180deg) scale(0.98); box-shadow: 0 6px 16px rgba(0,0,0,0.06); }
}
@media (prefers-reduced-motion: reduce) { .prompt-card.flipping { animation: none; } }

/* --- Post & Detail Modals --- */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); display: none; align-items: center; justify-content: center; z-index: 2000; }
.modal-overlay.show { display: flex; }
.modal-content { background: white; padding: 30px 40px; border-radius: 12px; width: 90%; max-width: 600px; max-height: 90vh; overflow-y: auto; position: relative; box-shadow: 0 10px 30px rgba(0,0,0,0.2); }
.close-modal-btn { position: absolute; top: 15px; right: 15px; background: none; border: none; font-size: 24px; color: #aaa; cursor: pointer; transition: color 0.2s ease; }
.close-modal-btn:hover { color: #333; }
.modal-content h2 { margin-top: 0; margin-bottom: 24px; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 8px; }
.form-group input[type="text"], .form-group textarea { width: 100%; padding: 12px; border: 1px solid #ccc; border-radius: 6px; font-size: 16px; box-sizing: border-box; }
.form-group textarea { resize: vertical; }
.checkbox-group { display: flex; flex-wrap: wrap; gap: 15px 25px; }
.checkbox-group label { display: flex; align-items: center; gap: 8px; font-weight: normal; cursor: pointer; }
.checkbox-group input[type="checkbox"] { width: 16px; height: 16px; }
.form-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 30px; }
.form-actions .submit-btn, .form-actions .cancel-btn { padding: 12px 24px; border-radius: 8px; font-size: 16px; font-weight: 600; cursor: pointer; border: none; }
.submit-btn { background-color: var(--accent-color); color: white; }
.submit-btn.is-submitting { opacity: 0.85; }
.cancel-btn { background-color: #e9e9e9; color: #333; }
.submit-btn:disabled,
.cancel-btn:disabled,
.close-modal-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.file-upload-wrapper { display: flex; align-items: center; gap: 12px; }
.file-input-hidden { display: none; }
.file-upload-button { padding: 10px 15px; border-radius: 6px; background-color: #e9e9e9; color: #333; border: none; cursor: pointer; font-weight: 500; transition: background-color 0.2s; }
.file-upload-button:hover { background-color: #dcdcdc; }
.file-name-display { color: var(--secondary-text-color); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Ensure only the visible button is clickable for file selection */
label[for="post-file"] {
  pointer-events: none;
  cursor: default;
}

/* ===== My Page layout (Refined Design) ===== */

/* 背景などを少し落ち着いた雰囲気に */
.mypage-body {
    background-color: #fafafa; /* 少し明るく清潔感のある白系 */
}

/* --- Minimal Header --- */
.mypage-header-minimal {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 40px;
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(250, 250, 250, 0.85); /* ページ背景に合わせる */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.nav-back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    color: var(--text-color);
    background: transparent;
    transition: background-color 0.2s ease, transform 0.2s ease;
    text-decoration: none;
    font-size: 18px;
}
.nav-back-btn:hover {
    background-color: rgba(0,0,0,0.05);
    transform: translateX(-2px);
}

.header-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
    letter-spacing: 0.5px;
}
.header-spacer { width: 44px; } /* 左ボタンとのバランス用 */

.mypage-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px 24px 80px;
}

/* --- Profile Hero Section --- */
.profile-hero {
    display: flex;
    justify-content: center;
    margin-bottom: 60px;
    margin-top: 20px;
}
.profile-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    text-align: center;
}

/* アバターアップローダー */
.avatar-container {
    position: relative;
    width: 120px;
    height: 120px;
}
.avatar-uploader {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.avatar-uploader:hover {
    transform: scale(1.05);
}
.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #fff;
}
.avatar-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 24px;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.avatar-uploader:hover .avatar-overlay {
    opacity: 1;
}

/* プロフィール情報 */
.profile-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 320px;
}

/* 入力欄をテキスト見出し風に */
.minimal-input {
    background: transparent;
    border: 1px solid transparent;
    border-bottom: 1px solid transparent; /* フォーカス時以外は透明 */
    font-size: 24px;
    font-weight: 700;
    color: var(--text-color);
    text-align: center;
    padding: 4px 8px;
    width: 100%;
    outline: none;
    border-radius: 4px;
    transition: border-color 0.2s, background-color 0.2s;
}
.minimal-input:hover {
    background-color: rgba(0,0,0,0.03);
}
.minimal-input:focus {
    background-color: #fff;
    border-bottom-color: var(--accent-color);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.minimal-input::placeholder {
    color: #ccc;
    font-weight: 400;
}

.status-text {
    font-size: 12px;
    color: var(--secondary-text-color);
    height: 18px; /* ちらつき防止の高さ確保 */
    margin: 0;
}

/* 保存ボタン */
.save-btn-round {
    margin-top: 12px;
    background-color: var(--text-color);
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 8px 24px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}
.save-btn-round:hover {
    background-color: #333;
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(0,0,0,0.2);
}
.save-btn-round:active {
    transform: translateY(0);
}

/* --- Modern Tabs & Feed Actions --- */
.feed-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0;
}

.modern-tabs {
    display: flex;
    gap: 24px;
}
.tab-link {
    background: none;
    border: none;
    padding: 12px 0;
    font-size: 15px;
    font-weight: 500;
    color: var(--secondary-text-color);
    cursor: pointer;
    position: relative;
    transition: color 0.2s ease;
}
.tab-link::after {
    content: '';
    position: absolute;
    bottom: -1px; /* border-bottomに重ねる */
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--text-color);
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.tab-link:hover {
    color: var(--text-color);
}
.tab-link.active {
    color: var(--text-color);
    font-weight: 600;
}
.tab-link.active::after {
    transform: scaleX(1);
}

.feed-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-bottom: 8px; /* タブの高さに合わせる調整 */
}

.icon-text-btn {
    background: none;
    border: none;
    color: var(--secondary-text-color);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 6px;
    transition: all 0.2s ease;
}
.icon-text-btn:hover {
    background-color: rgba(0,0,0,0.05);
    color: var(--text-color);
}

.danger-text-btn {
    background: none;
    border: none;
    color: #ff4757;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    transition: background 0.2s ease;
}
.danger-text-btn:hover {
    background-color: #fff0f1;
}
.danger-text-btn:disabled {
    opacity: 0;
    pointer-events: none;
}

/* 既存のグリッドの調整（JS側で制御されるクラスに対応） */
#feed-grid { margin-top: 16px; }
#feed-grid .prompt-card { position: relative; transition: transform 0.1s ease, box-shadow 0.2s ease; }
#feed-grid.selection-mode .prompt-card { animation: wiggle 0.45s ease-in-out infinite alternate; cursor: pointer; }
#feed-grid.selection-mode .prompt-card .selection-checkbox { opacity: 1; pointer-events: auto; }
#feed-grid .prompt-card.selected { outline: 2px solid var(--accent-color); outline-offset: -2px; }

/* チェックボックス（既存維持・または微調整） */
.selection-checkbox { position: absolute; top: 10px; right: 10px; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.95); border: 1px solid var(--border-color); border-radius: 50%; box-shadow: 0 2px 4px rgba(0,0,0,0.1); opacity: 0; pointer-events: none; transition: opacity 0.2s ease; }
.selection-checkbox input { appearance: none; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--accent-color); background: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; position: relative; transition: background-color 0.2s ease, border-color 0.2s ease; }
.selection-checkbox input:checked { background: var(--accent-color); border-color: var(--accent-color); }
.selection-checkbox input:checked::after { content: "\2713"; color: #fff; font-size: 11px; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -55%); }
@keyframes wiggle { from { transform: rotate(-1.5deg); } to { transform: rotate(1.5deg); } }

/* モバイル対応 */
@media (max-width: 600px) {
    .mypage-header-minimal { padding: 15px 20px; }
    .mypage-container { padding: 10px 16px 80px; }
    .profile-hero { margin-bottom: 40px; }
    .modern-tabs { gap: 16px; }
    .tab-link { font-size: 14px; }
}

/* ▼ 投稿フォーム：プロンプト切替UI ＋ 個別入力 */
.prompt-mode {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 6px 0 10px;
}
.switch {
    position: relative; width: 44px; height: 24px; display: inline-block;
}
.switch input { display: none; }
.switch .slider {
    position: absolute; cursor: pointer; inset: 0; background: #ddd; border-radius: 999px; transition: background .2s;
}
.switch .slider::before {
    content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; background: #fff; border-radius: 50%; transition: transform .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch input:checked + .slider { background: var(--accent-color); }
.switch input:checked + .slider::before { transform: translateX(20px); }
.switch-label { color: var(--secondary-text-color); font-size: 14px; }

#prompt-permedia-wrapper.hidden { display: none; }

/* スロット付きプロンプト入力 */
.prompt-unified-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 6px;
}
.prompt-highlight-frame {
    position: relative;
}
.slot-insert-btn {
    border: 1px solid #c8d2e7;
    border-radius: 999px;
    background: #f3f7ff;
    color: #2f4ea8;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    padding: 6px 11px;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, transform .05s ease;
}
.slot-insert-btn:hover {
    background: #e6efff;
    border-color: #acbfe8;
}
.slot-insert-btn:active {
    transform: translateY(1px);
}
.slot-insert-btn:focus-visible {
    outline: 2px solid rgba(0,122,255,.35);
    outline-offset: 1px;
}
.prompt-highlight-layer {
    position: absolute;
    inset: 0;
    margin: 0;
    padding: 12px;
    border: 1px solid transparent;
    border-radius: 6px;
    box-sizing: border-box;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
    color: transparent;
    font: inherit;
    line-height: inherit;
}
#post-prompt {
    position: relative;
    z-index: 2;
    background: transparent;
}
.prompt-slot-token {
    background: rgba(0,122,255,.16);
    box-shadow: inset 0 0 0 1px rgba(0,122,255,.36);
    border-radius: 4px;
}
.detail-slot-token {
    background: rgba(0,122,255,.16);
    box-shadow: inset 0 0 0 1px rgba(0,122,255,.36);
    border-radius: 4px;
    color: inherit;
    padding: 0 3px;
}

/* 個別プロンプトアイテム */
.permedia-item {
    display: grid;
    grid-template-columns: 56px 1fr;
    grid-template-rows: auto auto;
    grid-column-gap: 12px;
    grid-row-gap: 6px;
    align-items: center;
    margin-bottom: 12px;
}
.permedia-thumb {
    width: 56px; height: 56px;
    border-radius: 8px;
    background: #f0f0f0;
    overflow: hidden;
    position: relative;
    grid-row: 1 / span 2;
    display: grid; place-items: center;
}
.permedia-thumb img, .permedia-thumb video {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.permedia-file {
    font-size: 11px; color: #777; letter-spacing: .5px;
}
.permedia-badge {
    position: absolute; right: 4px; bottom: 4px;
    background: rgba(0,0,0,.6); color: #fff;
    border-radius: 6px; font-size: 10px; padding: 1px 4px;
    display: inline-flex; align-items: center; gap: 3px;
}
.permedia-label {
    font-size: 13px; color: var(--secondary-text-color);
}
.permedia-index {
    display: inline-block; min-width: 22px; text-align: center;
    background: #e9eefb; color: #3b5bdb; border-radius: 999px; padding: 2px 6px; margin-right: 6px; font-weight: 600;
}
.permedia-item textarea {
    grid-column: 2 / -1;
    width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 6px; box-sizing: border-box;
}

/* ▼▼ 詳細モーダル：安定レイアウト ▼▼ */
.detail-modal-content {
    display: grid;
    grid-template-rows: minmax(260px, 60%) 1fr;
    background: white;
    width: 90%;
    max-width: 800px;
    height: 90vh;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    opacity: 0;
    transform: scale(0.95) translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.modal-overlay.show .detail-modal-content { opacity: 1; transform: scale(1) translateY(0); }

.detail-media-container {
    position: relative;
    min-height: 260px;
    background-color: #000;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; min-width: 0;
}
.carousel-stage { width: 100%; height: 100%; position: relative; }
.carousel-slide { position: absolute; inset: 0; opacity: 0; pointer-events: none; transition: opacity .25s ease; display: flex; align-items: center; justify-content: center; }
.carousel-slide.active { opacity: 1; pointer-events: auto; }
.carousel-slide img, .carousel-slide video { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }

.carousel-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; border: none; border-radius: 50%; background: rgba(0,0,0,0.5); color: #fff; cursor: pointer; z-index: 5; display: grid; place-items: center; }
.carousel-nav:hover { background: rgba(0,0,0,0.65); }
.carousel-nav.prev { left: 12px; }
.carousel-nav.next { right: 12px; }

/* ドット（正円） */
.carousel-dots { position: absolute; bottom: 8px; left: 0; right: 0; display: flex; justify-content: center; gap: 8px; z-index: 6; }
.carousel-dot {
    width: 8px; height: 8px; aspect-ratio: 1/1;
    border: none; padding: 0; line-height: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    display: inline-block; flex: 0 0 auto; cursor: pointer;
    appearance: none; -webkit-appearance: none;
}
.carousel-dot.active { background: rgba(255,255,255,0.95); }

.detail-info-container { padding: 25px 30px; overflow-y: auto; min-height: 0; }
#detail-title { margin-top: 0; margin-bottom: 5px; }
#detail-author { display: block; margin-bottom: 15px; }
#detail-tags { margin-bottom: 25px; line-height: 2; }
.detail-section { margin-bottom: 25px; }
.detail-section h3 { margin: 0; border-bottom: 1px solid var(--border-color); padding-bottom: 5px; }

/* コメントは必ず表示されるように */
#detail-comment { display: block; }

/* コピー */
.detail-section-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.copy-btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border-color); background: #fff; padding: 6px 12px; border-radius: 8px; font-size: 14px; cursor: pointer; transition: background-color .15s ease, border-color .15s ease, transform .05s ease; }
.copy-btn:hover { background: #f5f5f5; }
.copy-btn:active { transform: translateY(1px); }
.copy-btn.copied { border-color: #46c266; background: #e8f7ed; }
.copy-btn.error { border-color: #e55353; background: #fdeaea; }

.detail-section pre, .detail-section p {
    margin: 10px 0 0 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 15px;
    background-color: #f9f9f9;
    padding: 10px;
    border-radius: 6px;
}

/* かわいいエフェクト（控えめ） */
.action-btn .burst { position: absolute; left: 50%; top: 50%; pointer-events: none; transform: translate(-50%, -50%); z-index: 2; }
.action-btn .particle { position: absolute; left: 0; top: 0; opacity: 0; transform: translate(-50%, -50%) scale(0.6); animation: burst-pop 700ms ease-out forwards; will-change: transform, opacity; user-select: none; }
@keyframes burst-pop {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.6) rotate(0); }
    40% { opacity: 1; transform: translate(calc(-50% + var(--tx)*.5), calc(-50% + var(--ty)*.5)) scale(1) rotate(var(--rot)); }
    100% { opacity: 0; transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(0.8) rotate(var(--rot)); }
}
.action-btn.jelly { animation: jelly-pop 360ms cubic-bezier(.2, .7, .3, 1) both; }
@keyframes jelly-pop { 0%{transform:scale(1);}30%{transform:scale(1.18);}60%{transform:scale(0.95);}100%{transform:scale(1);} }

/* ▼▼ 操作行（削除 & 報告）：右下に内容幅で固定 ▼▼ */
.detail-cta-row{
    position: absolute;
    inset: auto 12px 12px auto;   /* right:12px; bottom:12px と同義 */
    display: flex;
    align-items: center;
    gap: 8px;
    width: max-content;           /* ← 左端まで広がらないように中身の幅に縮める */
    z-index: 10;
}

/* ▼▼ 報告ボタン（デフォは単体右下固定） ▼▼ */
.report-btn{
    position: absolute;
    right: 12px;
    bottom: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    font-size: 13px;
    line-height: 1;
    color: var(--secondary-text-color);
    background: rgba(255,255,255,0.9);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transition: background-color .15s ease, color .15s ease, transform .05s ease, border-color .15s ease;
}

/* === 削除確認ポップアップ === */
#confirm-overlay.modal-overlay { 
  /* 既存の .modal-overlay と同じ表示制御: .show が付いたら表示、無ければ非表示 */
  display: none;
  background: rgba(10, 12, 20, 0.35);  /* ← 0.35 を上下して暗さ（不透明度）を調整 */
  backdrop-filter: blur(10px);         /* ← 10 を上下してぼかしを調整 */
  -webkit-backdrop-filter: blur(10px);
}
#confirm-overlay.modal-overlay.show {
  display: flex;            /* 中央配置のため flex に */
  align-items: center;
  justify-content: center;
  z-index: 4000;            /* 他より前面に */
}

/* Glassmorphism スタイル（リンクカード準拠） */
.confirm-card {
  position: relative;
  width: 100%;
  max-width: 500px;
  padding: 3rem;
  text-align: center;

  /* ガラス感：透明度とブラー、彩度を強めに */
  background: rgba(30, 28, 45, 0.42);               /* ← 0.42 を上下して透け具合 */
  backdrop-filter: blur(16px) saturate(120%);
  -webkit-backdrop-filter: blur(16px) saturate(120%);
  border: 1px solid rgba(167, 199, 231, 0.22);      /* 枠を少し強調 */
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.35);         /* 影を少し強めに */

  color: #e9edf5;
   /* 出現は .show 付与時に下の keyframes で制御 */
}

/* A) オーバーレイ自体もスッと現れる（暗幕のフェード） */
#confirm-overlay.modal-overlay.show {
  animation: confirm-overlay-fade .18s ease-out both; /* 既存の z-index:4000 は保持 */
}

/* B) カードのベース状態（非表示時の初期値） */
#confirm-overlay .confirm-card {
  opacity: 0;
  transform: translateY(14px) scale(0.985);
  will-change: opacity, transform;
}

/* C) .show が付いた瞬間に “ふわっと”出現する */
#confirm-overlay.show .confirm-card {
  animation: confirm-float-in .28s cubic-bezier(.2,.7,.3,1) both;
}

/* --- Keyframes（出現）--- */
@keyframes confirm-float-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.985);
    filter: saturate(110%);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: saturate(120%);
  }
}

/* --- Keyframes（暗幕）--- */
@keyframes confirm-overlay-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* 閉じアニメ（任意） */
#confirm-overlay.closing .confirm-card {
  animation: confirm-float-out .18s ease-in forwards;
}
@keyframes confirm-float-out {
  to {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
}

/* アニメを減らしたいユーザー配慮 */
@media (prefers-reduced-motion: reduce) {
  #confirm-overlay.modal-overlay.show { animation: none; }
  #confirm-overlay .confirm-card,
  #confirm-overlay.show .confirm-card { animation: none; opacity: 1; transform: none; }
}

.confirm-card h3 {
  margin: 0 0 12px;
  font-size: 20px;
  font-weight: 700;
}
.confirm-card p {
  margin: 0 0 20px;
  line-height: 1.6;
  color: #cdd6e5;
}

.confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ボタン */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: rgba(255,255,255,0.1);
  color: #e9edf5;
  cursor: pointer;
  transition: transform .05s ease, background-color .15s ease, border-color .15s ease;
}
.btn:active { transform: translateY(1px); }

.btn-danger {
  background: rgba(220, 38, 38, 0.9);
  border-color: rgba(220, 38, 38, 0.25);
}
.btn-danger:hover { background: rgba(220, 38, 38, 1); }

.btn-accent {
  background: rgba(0, 122, 255, 0.9);
  border-color: rgba(0, 122, 255, 0.35);
}
.btn-accent:hover { background: rgba(0, 122, 255, 1); }

.btn-ghost {
  background: rgba(255,255,255,0.08);
  border-color: rgba(167,199,231,0.2);
}
.btn-ghost:hover { background: rgba(255,255,255,0.14); }

/* 操作行（右下コンテナ）に入ったときは絶対配置を解除して横並びに */
.detail-cta-row .report-btn,
.detail-cta-row .delete-btn{
    position: static !important;
    right: auto;
    bottom: auto;
}

.report-btn:hover{ background:#fff; color: var(--text-color); border-color:#dcdcdc; }
.report-btn:active{ transform: translateY(1px); }
.report-btn i{ font-size: 12px; }

/* ▼▼ 編集ボタン ▼▼ */
.edit-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 13px;
    line-height: 1;
    color: var(--secondary-text-color);
    background: rgba(255,255,255,0.9);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transition: background-color .15s ease, color .15s ease, transform .05s ease, border-color .15s ease;
}
/* ホバー時は青色（アクセントカラー）っぽく */
.edit-btn:hover {
    background: #fff;
    color: var(--accent-color);
    border-color: var(--accent-color);
}
.edit-btn:active {
    transform: translateY(1px);
}
.edit-btn i {
    font-size: 12px;
}

/* 操作行（右下コンテナ）に入ったときは絶対配置を解除して横並びに */
.detail-cta-row .edit-btn, /* ← 追加 */
.detail-cta-row .report-btn,
.detail-cta-row .delete-btn {
    position: static !important;
    right: auto;
    bottom: auto;
}

/* ▼▼ 削除ボタン ▼▼ */
.delete-btn{
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    font-size: 13px;
    line-height: 1;
    color: var(--secondary-text-color);
    background: rgba(255,255,255,0.9);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transition: background-color .15s ease, color .15s ease, transform .05s ease, border-color .15s ease;
}
.delete-btn:hover{ background:#fff; color: #b00020; border-color:#f1c7c7; }
.delete-btn:active{ transform: translateY(1px); }
.delete-btn i{ font-size: 12px; }

/* --- Responsive Design --- */
@media (max-width: 1024px) {
  .sidebar { position: fixed; transform: translateX(calc(-1 * var(--sidebar-width))); margin-left: 0; }
  .page-wrapper.sidebar-open .sidebar { transform: translateX(0); }
  .header { grid-template-columns: auto 1fr; }
  .header-center { display: none; } /* ] */  /* ← ここを閉じる */
}

/* --- Toast (snackbar) --- */
#toast-container {
  position: fixed;
  left: 50%;
  bottom: 24px; /* 少し下に移動 */
  transform: translateX(-50%);
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 10px; /* 間隔を少し広げる */
  align-items: center;
  pointer-events: none;
  max-width: 90%; /* 幅を制限して中央に */
}

.toast {
  pointer-events: auto;
  color: #f8f8f8; /* リンクカードに合わせて明るいテキスト色に */
  
  /* リンクカードのGlassmorphismスタイルを適用 */
  background: rgba(30, 28, 45, 0.75); /* リンクカードに合わせたダークな背景、少し透明度を上げる */
  backdrop-filter: blur(10px); /* リンクカードに近いぼかし具合 */
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(167, 199, 231, 0.15); /* リンクカードの境界線を適用、少し強調 */
  border-radius: 12px; /* リンクカードより少し小さく、トーストに合う角丸 */
  box-shadow: 0 10px 30px rgba(0,0,0,0.25); /* リンクカードに近い強い影 */

  padding: 14px 22px; /* パディングを増やす */
  font-size: 15px; /* フォントサイズを維持 */
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: 12px; /* アイコンとテキストの間隔を広げる */
  animation: toast-in .35s cubic-bezier(.2, .7, .3, 1) forwards; /* アニメーションを微調整 */
  min-width: 240px; /* 最低幅を確保 */
  text-align: center; /* テキストを中央寄せ */
  max-width: 400px; /* トーストの最大幅を設定 */
}

/* 各種メッセージタイプ */
.toast.info {
    color: #f8f8f8;
    /* infoは基本のダークグラスモフィズムを維持 */
}
.toast.success {
    color: #33a433; /* 成功時は明るい緑系のテキスト色 */
    background: rgba(185, 228, 202, 0.952); /* 緑系のダークグラスモフィズム */
    border-color: rgba(144, 238, 144, 0.25); /* 明るい緑の境界線 */
    box-shadow: 0 10px 30px rgba(39, 174, 96, 0.2); /* 緑系の影 */
}
.toast.error {
    color: #ffe6e6; /* エラー時は明るい赤系のテキスト色 */
    background: rgba(231, 76, 60, 0.75); /* 赤系のダークグラスモフィズム */
    border-color: rgba(255, 99, 71, 0.25); /* 明るい赤の境界線 */
    box-shadow: 0 10px 30px rgba(231, 76, 60, 0.2); /* 赤系の影 */
}

/* アイコン（例: Font Awesomeなどを使用する場合） */
.toast .icon {
    font-size: 20px;
    line-height: 1;
    flex-shrink: 0; /* アイコンが縮まないように */
}
.toast.success .icon { color: #82e0aa; } /* 明るい緑のアイコン */
.toast.error .icon { color: #ff8c8c; }   /* 明るい赤のアイコン */
.toast.info .icon { color: #a7c7e7; } /* リンクカード境界線に近い青系のアイコン */


.toast.hide { animation: toast-out .3s ease-in forwards; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(20px) scale(0.95); }
}

/* レスポンシブ対応 */
@media (max-width: 600px) {
    #toast-container {
        bottom: 16px;
        max-width: calc(100% - 32px); /* 左右に余白 */
    }
    .toast {
        padding: 12px 18px;
        font-size: 14px;
        min-width: unset;
        width: 100%; /* 小画面では幅いっぱいに */
        box-sizing: border-box;
        border-radius: 10px;
    }
}

/* --- Media Manager Styles (for Edit Modal) --- */
.media-list-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
}

.media-item {
    display: grid;
    grid-template-columns: 80px 1fr auto; /* サムネ | 入力欄 | 操作ボタン */
    gap: 12px;
    background: #f9f9f9;
    border: 1px solid var(--border-color);
    padding: 10px;
    border-radius: 8px;
    align-items: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* 個別プロンプト非表示時のレイアウト調整 */
.media-item.no-prompt {
    grid-template-columns: 80px 1fr auto;
}

/* ★プレビュー画像のサイズ制御（ここが重要） */
.media-item-thumb {
    width: 80px;
    height: 80px;
    min-width: 80px; /* 縮小防止 */
    background: #000;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.media-item-thumb img, 
.media-item-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover; /* 枠いっぱいにトリミング表示 */
    display: block;
}

.media-item-inputs {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.media-item-inputs textarea {
    width: 100%;
    font-size: 14px;
    padding: 8px;
    resize: vertical;
    min-height: 60px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box; /* 枠を含めたサイズ計算 */
}
.media-badge {
    font-size: 13px;
    color: var(--secondary-text-color);
    display: flex;
    align-items: center;
    gap: 8px;
}
.badge-new { 
    color: var(--accent-color); 
    font-weight: bold; 
    font-size: 11px; 
    border: 1px solid var(--accent-color); 
    padding: 1px 4px; 
    border-radius: 4px; 
}

.media-item-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.media-control-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-color);
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--secondary-text-color);
    transition: all 0.1s;
}
.media-control-btn:hover { background: #f0f0f0; color: var(--text-color); }
.media-control-btn[disabled] { opacity: 0.3; cursor: default; }
.media-control-btn.btn-delete { color: #ff4757; border-color: #ffcccc; margin-top: 4px; }
.media-control-btn.btn-delete:hover { background: #fff0f0; }

/* ファイル追加エリア */
.file-add-area {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
}
#add-file-btn {
    background-color: #f0f0f0;
    color: #333;
    border: 1px solid #ddd;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
}
#add-file-btn:hover {
    background-color: #e0e0e0;
}

/* --- JSパーティクル用スタイル --- */
.js-particle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none; /* クリックを邪魔しない */
    z-index: 10;
    /* 初期状態は中心 */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* --- ログインモーダルの遊び心デザイン --- */

/* カードの浮遊感 */
.login-card-floating {
    max-width: 420px !important;
    border: none !important;
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(20px);
    box-shadow: 0 20px 50px rgba(0,0,0,0.1) !important;
}

/* ロケットアイコンのアニメーション */
.login-icon-wrap {
    width: 60px; height: 60px;
    background: var(--accent-color);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 15px;
    color: white; font-size: 24px;
    box-shadow: 0 8px 16px rgba(0,122,255,0.3);
}
.rocket-anim { animation: rocket-float 2s ease-in-out infinite; }
@keyframes rocket-float {
    0%, 100% { transform: translateY(0) rotate(5deg); }
    50% { transform: translateY(-8px) rotate(-5deg); }
}

/* Googleボタンのホバーアクション */
.google-btn-fancy {
    width: 100%; padding: 12px;
    border-radius: 12px; border: 1px solid #eee;
    background: white; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 12px;
    font-weight: 600; transition: all 0.2s;
}
.google-btn-fancy:hover {
    background: #f9f9f9;
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

/* 入力欄のフローティングラベル */
.form-group-fancy { position: relative; margin-bottom: 25px; }
.form-group-fancy input {
    width: 100%; padding: 12px; border: 1px solid #eee; border-radius: 8px;
    outline: none; transition: all 0.2s;
}
.form-group-fancy label {
    position: absolute; left: 12px; top: 12px; color: #aaa;
    transition: all 0.2s; pointer-events: none;
}
/* 入力中にラベルを浮かせる */
.form-group-fancy input:focus + label,
.form-group-fancy input:not(:placeholder-shown) + label {
    top: -20px; left: 5px; font-size: 12px; color: var(--accent-color); font-weight: bold;
}
.form-group-fancy input:focus { border-color: var(--accent-color); box-shadow: 0 0 0 4px rgba(0,122,255,0.1); }

/* 送信ボタンのグラデーション */
.login-submit-btn {
    width: 100%; padding: 14px; border-radius: 12px; border: none;
    background: linear-gradient(135deg, #007aff, #00c6ff);
    color: white; font-weight: bold; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 10px;
    transition: all 0.3s;
}
.login-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,122,255,0.3);
}

.separator-text { margin: 25px 0; border-top: 1px solid #eee; position: relative; }
.separator-text span {
    position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
    background: white; padding: 0 15px; color: #ccc; font-size: 11px; text-transform: uppercase;
}

/* --- ログイン/新規登録の差別化と切り替え演出 --- */

/* アイコン制御：デフォルト（ログインモード）はロケットのみ */
.icon-signup { display: none !important; }
.icon-login { display: block !important; }

/* 新規登録モード (.signup-mode) の時のアイコン切り替え */
.signup-mode .icon-login { display: none !important; }
.signup-mode .icon-signup { display: block !important; }

/* アイコン背景色の変化 */
.login-icon-wrap {
    width: 60px; height: 60px;
    background: var(--accent-color);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 15px;
    color: white; font-size: 24px;
    box-shadow: 0 8px 16px rgba(0,122,255,0.3);
    transition: all 0.4s ease;
}

.signup-mode .login-icon-wrap {
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    box-shadow: 0 8px 16px rgba(108, 92, 231, 0.3);
}

/* タイトル装飾 */
.login-h2 {
    margin: 0 0 8px 0 !important;
    font-size: 28px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--text-color), var(--accent-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: all 0.4s ease;
}

.signup-mode .login-h2 {
    background: linear-gradient(135deg, var(--text-color), #6c5ce7);
    -webkit-background-clip: text;
    background-clip: text;
}

/* ★ セパレーター：両端に細い線がある洗練されたデザイン */
.separator-text {
    display: flex;
    align-items: center;
    margin: 30px 0;
}

.separator-text::before,
.separator-text::after {
    content: "";
    flex: 1;
    height: 1px;
    background-color: #eee; /* 細いグレーの線 */
}

.separator-text span {
    padding: 0 15px;
    color: #aaa;
    font-size: 12px;
    white-space: nowrap;
}

/* 送信ボタン */
.login-submit-btn {
    width: 100%; padding: 14px; border-radius: 12px; border: none;
    background: linear-gradient(135deg, #007aff, #00c6ff);
    color: white; font-weight: bold; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 10px;
    transition: all 0.3s ease;
}

.signup-mode .login-submit-btn {
    background: linear-gradient(135deg, #6c5ce7, #8e44ad);
}

/* アニメーション定義 */
.rocket-anim { animation: rocket-float 2s ease-in-out infinite; }
@keyframes rocket-float {
    0%, 100% { transform: translateY(0) rotate(5deg); }
    50% { transform: translateY(-8px) rotate(-5deg); }
}

.sparkles-anim { animation: magic-sparkle 2s ease-in-out infinite; }
@keyframes magic-sparkle {
    0%, 100% { transform: scale(1) rotate(0deg); filter: drop-shadow(0 0 0px #fff); }
    50% { transform: scale(1.1) rotate(15deg); filter: drop-shadow(0 0 8px #fff); }
}

/* その他テキスト */
.login-subtext { margin: 0 0 30px 0 !important; color: var(--secondary-text-color); font-size: 14px; letter-spacing: 1px; }
.signup-toggle-text { margin-top: 25px !important; font-size: 14px; color: #888; line-height: 1.6; }
.signup-toggle-text a { color: var(--accent-color); font-weight: 700; text-decoration: underline; text-underline-offset: 4px; }
.modern-form { margin-top: 10px; }
