/* 司令室の共通デザイン（修正版）なのですよ！にぱー☆ */
:root {
    --unsafe-bg: #faf0f9;
    --primary-color: #6C5CE7;
}
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background-color: #f4f4f9; padding: 15px; margin: 0; }
.container { max-width: 800px; margin: 0 auto; }

/* 共通パーツ：カードとナビゲーション */
.card, .history-card { background: white; padding: 10px; border-radius: 12px; box-shadow: 0 4px 10px rgba(0,0,0,0.05); margin-bottom: 15px; }
.history-card.not-safe-card { background: var(--unsafe-bg); }
.inactive-card { opacity: 0.5; filter: grayscale(50%); background: #f0f0f0 !important; border: 1px dashed #ccc !important; }
.nav { display: flex; gap: 10px; margin-bottom: 20px; }
.nav a { flex: 1; text-align: center; padding: 12px; background: #ddd; color: #333; text-decoration: none; border-radius: 8px; font-weight: bold; }
.nav a.active { background: #6C5CE7; color: white; }

/* フォーム要素 */
label { display: block; margin-top: 15px; font-weight: bold; font-size: 14px; color: #555; }
input[type="text"], input[type="number"], input[type="password"], select, textarea { width: 100%; padding: 12px; margin-top: 5px; border: 1px solid #ddd; border-radius: 8px; box-sizing: border-box; font-size: 16px; }
textarea { height: auto; min-height: 100px; resize: none; overflow: hidden; }

/* ネガティブプロンプトは最初は 1 行分にするのですよ！にぱー☆ */
#neg_area { 
    min-height: 38px !important; 
    padding-top: 8px !important; 
    padding-bottom: 8px !important; 
}

/* ラベル行を横並びにするための魔法なのですよ！にぱー☆ */
.label-row { 
    display: flex; 
    justify-content: space-between; 
    align-items: flex-end; 
    margin-top: 15px; 
    margin-bottom: 5px;
}
.label-row label { margin-top: 0 !important; margin-bottom: 0 !important; }
.label-text { font-weight: bold; }

/* スリムなリセットボタンの魔法なのですよ！にぱー☆ */
.btn-reset { 
    display: inline-block !important;
    width: auto !important;
    padding: 4px 15px !important; 
    margin-top: 0 !important; 
    font-size: 12px !important; 
    background: #6c757d !important; /* お掃除カラーのグレーなのですよ */
    color: white !important;
    border: none !important;
    border-radius: 4px !important;
    line-height: 1.2 !important;
    cursor: pointer;
}
.btn-reset:hover { background: #5a6268 !important; }

/* スリムな生成ボタンの魔法なのですよ！にぱー☆ */
.btn-generate { 
    display: inline-block !important;
    width: auto !important;
    padding: 4px 15px !important; 
    margin-top: 0 !important; 
    font-size: 12px !important; 
    background: #6C5CE7 !important;
    color: white !important; /* 文字色を白に固定するのですよ！にぱー☆ */
    border: none !important; /* 枠線も消してスッキリさせるのです */
    border-radius: 4px !important;
    line-height: 1.2 !important;
    cursor: pointer;
}
.btn-generate:hover { background: #5a4bcf !important; }

/* アイコンボタン（基本スタイルを打ち消すのですよ！） */
.btn-icon { 
    display: inline-block !important; 
    width: auto !important; 
    background: none !important; 
    padding: 0 !important; 
    margin: 0 !important; 
    border: none !important; 
    cursor: pointer !important; 
    font-size: 14px !important; 
    line-height: 1 !important; 
    box-shadow: none !important;
}

/* メッセージ表示 */
.success { background: #d4edda; color: #3c763d; padding: 15px; margin-bottom: 20px; border-radius: 8px; font-weight: bold; line-height: 1.5; }
.error { background: #f8d7da; color: #721c24; padding: 15px; margin-bottom: 20px; border-radius: 8px; font-weight: bold; }

/* バッジとお宝 ID のデザイン */
.badge { display: inline-block; font-family: monospace; font-size: 11px; padding: 2px 6px; border-radius: 4px; color: white; line-height: 1.2; word-break: break-all; text-decoration: none; }
.badge-success { background-color: #28a745; }
.badge-primary { background-color: #007bff; }
.badge-warning { background-color: #ffc107; color: #333; }
.badge-danger { background-color: #dc3545; }
.badge-secondary { background-color: #6c757d; }

/* プロンプトボックスたちのデザイン（絶対配置を禁止するのですよ！） */
.prompt-container { display: flex; flex-direction: column; gap: 5px; margin-top: 10px; }
.prompt-link { text-decoration: none !important; color: inherit !important; display: block; }
.prompt-box { 
    padding: 10px; 
    border-radius: 8px; 
    font-size: 10px; 
    margin-bottom: 5px; 
    cursor: default; 
    border-left: 4px solid #eee; 
    background: #f8f9fa; 
    color: #333; 
    word-break: break-all; 
    position: relative; /* 子要素の基準にはするのですよ */
    transition: background 0.2s, border-color 0.2s;
}
.prompt-link:hover .prompt-box { 
    filter: brightness(0.95); 
    border-left-color: #6C5CE7; 
    cursor: pointer; 
}
.prompt-label { 
    display: block; 
    font-size: 10px; 
    font-weight: bold; 
    margin-bottom: 2px; 
    position: static !important; /* 右側に飛ばないように固定するのですよ！ */
    text-align: left !important;
}
.prompt-content { display: block; line-height: 1.4; }

.box-raw { background: #fff3cd; border-left-color: #ffc107; color: #856404; }
.box-raw .prompt-label { color: #856404; }
.box-raw .prompt-content { font-family: monospace; font-size: 10px; }

.box-prompt { border-left-color: #6C5CE7; }
.box-prompt .prompt-label { color: #6C5CE7; }

.box-pixai { background: #f0f0ff; border-left-color: #6C5CE7; }
.box-pixai .prompt-label { color: #6C5CE7; }
.box-pixai .prompt-content { font-family: monospace; font-size: 10px; }

.box-memo { background: #e3f2fd; border-left-color: #2196f3; color: #0d47a1; }
.box-memo .prompt-label { color: #0d47a1; }
.box-memo .prompt-content { font-size: 13px; }

/* その他のお宝情報 */
.meta-info { font-size: 13px; color: #555; display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-top: 5px; }
.meta-info span { background: #e9ecef; padding: 4px 8px; border-radius: 4px; }

/* 辞書パレットの魔法 */
.palette-container { 
    margin-top: 0 !important; 
    margin-bottom: 5px !important; 
    background: #fafafa; 
    padding: 10px; 
    border-radius: 8px; 
    border: 1px solid #ddd; 
    display: flex !important; 
    flex-direction: column !important; 
    gap: 5px !important; /* 隙間を 10px から 5px に詰めたのですよ！ */
}
.category-list { 
    display: flex !important; 
    gap: 5px; 
    overflow-x: auto; 
    padding-bottom: 5px; 
    border-bottom: 1px solid #ccc; 
    margin-bottom: 0 !important; /* 隙間をなくしたのですよ */
    width: 100% !important; 
    flex-shrink: 0;
}
.category-btn { padding: 6px 12px; background: #fff; border: 1px solid #ccc; border-radius: 20px; font-size: 12px; cursor: pointer; white-space: nowrap; transition: 0.2s; color: #333; margin-top: 0 !important; }
.category-btn.active { background: #6C5CE7; color: white; border-color: #6C5CE7; }

.item-list { 
    display: none; 
    gap: 5px; 
    flex-wrap: wrap; 
    width: 100% !important; 
}
.item-list.active { display: flex; }

/* 頻出パレットの階層化魔法なのですよ！にぱー☆ */
.freq-container.active { 
    display: flex !important; 
    flex-direction: column !important; 
    width: 100% !important; 
    margin-top: 0 !important; /* 隙間をなくしたのですよ！ */
}

.freq-group { 
    width: 100%; 
    margin-bottom: 5px; 
    display: flex !important; /* 横並びにするのですよ！ */
    align-items: center; 
    gap: 8px;
}
.freq-cat-label { 
    display: inline-block;
    font-size: 10px; 
    font-weight: bold; 
    color: #777; 
    white-space: nowrap;
    min-width: 45px; /* ラベルの幅を固定して綺麗に並べるのですよ */
    text-align: right;
    border-bottom: none !important; /* 下線はもういらないのですよ */
    margin-bottom: 0 !important;
}

/* 頻出キーワード用の横スクロール魔法なのですよ！にぱー☆ */
.scrollable-list.active {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0 !important; /* 慶の指示通り 0 にするのですよ！ */
    flex-grow: 1; /* 残りの幅を全部使うのですよ */
    -webkit-overflow-scrolling: touch;
}

.scrollable-list .item-btn, .scrollable-list .item-btn-edit {
    white-space: nowrap;
    flex-shrink: 0;
}

.item-btn, .item-btn-edit { 
    padding: 5px 10px; 
    background: #f8f9fa; 
    border: 1px solid #ddd; 
    border-radius: 4px; 
    font-size: 12px; 
    cursor: grab; 
    transition: 0.2s; 
    user-select: none;
    text-decoration: none;
    color: inherit;
}
.item-btn:hover, .item-btn-edit:hover { background: #eef2ff; border-color: #6C5CE7; }
.item-btn.item-unsafe, .item-btn-edit.item-unsafe { background: var(--unsafe-bg); border-color: #ffc7f9; }
.item-btn.item-unsafe:hover, .item-btn-edit.item-unsafe:hover { background: #fce4ec; border-color: #ff6b6b; }
.item-btn:active, .item-btn-edit:active { cursor: grabbing; }
.item-btn-edit { cursor: pointer; }

/* テキストエリアのドラッグ中スタイル */
.drag-over { border: 2px dashed #6C5CE7 !important; background: #f0f0ff !important; }

/* サムネイル画像の魔法なのですよ！にぱー☆ */
.thumbnails { display: flex; gap: 10px; overflow-x: auto; padding-top: 8px; margin-top: 10px; }
.thumbnails img { height: 100px !important; width: auto !important; border-radius: 6px; object-fit: cover; border: 1px solid #ddd; }

/* 星評価システムの魔法なのですよ！にぱー☆ */
.rating-stars { 
    display: flex; 
    flex-direction: row-reverse; /* 右から左へ並べることで、ホバー魔法を左からにするのですよ！ */
    gap: 1px; /* 慶の指示通り、隙間をギュッと詰めたのですよ！ */
    cursor: pointer;
    user-select: none;
}
.star { 
    font-size: 18px; 
    color: #ccc; 
    transition: color 0.2s, transform 0.1s; 
    line-height: 1 !important; /* 縦の隙間をなくすのですよ！ */
    display: inline-block;
    padding: 0 1px !important; /* 慶の指示通り、左右だけ 1px にしたのですよ！ */
}
.star.active { color: #ffc107; }
.star:hover { transform: scale(1.1); } /* 拡大を少し控えめにしたのですよ */
/* ホバーした星と、その「前（row-reverse なので DOM 上は後ろ）」の星を光らせるのですよ！ */
.star:hover,
.star:hover ~ .star { color: #ffc107 !important; }
.rating-stars:hover .star:not(:hover):not(:hover ~ .star) { color: #ccc !important; }

/* ⚙️ 設定画面のトグルスイッチ魔法なのですよ！にぱー☆ */
.switch {
    position: relative;
    display: inline-block;
    width: 64px;
    height: 30px;
    vertical-align: middle;
}
.switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    z-index: 2;
}
input:checked + .slider {
    background-color: #6C5CE7;
}
input:checked + .slider:before {
    transform: translateX(34px);
}
/* ON/OFF の文字を入れるための魔法なのですよ */
.slider:after {
    content: 'OFF';
    color: white;
    display: block;
    position: absolute;
    transform: translate(-50%,-50%);
    top: 50%;
    left: 65%;
    font-size: 10px;
    font-family: Verdana, sans-serif;
    font-weight: bold;
}
input:checked + .slider:after {
    content: 'ON';
    left: 35%;
}

/* 🪄 秘密のドロップダウンメニュー魔法なのですよ！にぱー☆ */
.dropdown-menu {
    display: none;
    position: absolute;
    top: 35px;
    right: 0;
    background: white;
    min-width: 180px;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    z-index: 1000;
    overflow: hidden;
    padding: 8px 0;
    border: 1px solid #eee;
}
.dropdown-menu.show {
    display: block;
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    text-decoration: none;
    color: #333;
    font-size: 14px;
    font-weight: bold;
    transition: background 0.2s;
}
.menu-item:hover {
    background: #f8f9fa;
}
.menu-item.active {
    color: #6C5CE7;
    background: #f0f0ff;
}
.menu-icon {
    width: 28px;
    height: 28px;
    background: #eee;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-size: 14px;
}
.menu-item.active .menu-icon {
    background: #6C5CE7;
}
.menu-text {
    flex-grow: 1;
}

/* 🍔 ハンバーガーメニューの魔法なのですよ！にぱー☆ */
.hamburger-menu {
    width: 24px;
    height: 18px;
    position: relative;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.hamburger-menu span {
    display: block;
    width: 100%;
    height: 2px;
    background-color: white;
    border-radius: 2px;
    transition: all 0.3s ease;
}
.hamburger-menu:hover span {
    background-color: #eee;
}

/* 🚀 瞬間移動（ジャンプ）ボタンの魔法なのですよ！にぱー☆ */
.jump-buttons {
    position: fixed;
    right: 20px;
    bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 2000;
}
.btn-jump {
    width: 44px;
    height: 44px;
    background: rgba(108, 92, 231, 0.3); /* 薄い司令室カラーなのですよ */
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    backdrop-filter: blur(4px); /* ちょっと背景をぼかしてオシャレにするのですよ */
    transition: background 0.3s, transform 0.2s;
    user-select: none;
}
.btn-jump:hover {
    background: rgba(108, 92, 231, 0.6);
    transform: scale(1.1);
}
.btn-jump:active {
    transform: scale(0.9);
}

/* 🖼️ お宝鑑賞モーダル（Lightbox）の魔法なのですよ！にぱー☆ */
.lightbox-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 3000;
    justify-content: center;
    align-items: center;
    touch-action: none; /* スワイプのために勝手なスクロールを止めるのですよ */
}
.lightbox-container {
    width: 95%;
    height: 90%;
    display: flex;
    justify-content: center;
    align-items: center;
}
.lightbox-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}
.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 40px;
    cursor: pointer;
    z-index: 3100;
    text-shadow: 0 0 10px rgba(0,0,0,0.5);
}
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 60px;
    cursor: pointer;
    padding: 20px;
    user-select: none;
    z-index: 3100;
    opacity: 0.5;
    transition: opacity 0.3s;
}
.lightbox-nav:hover { opacity: 1; }
.lightbox-prev { left: 10px; }
.lightbox-next { right: 10px; }
.lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 14px;
    background: rgba(0,0,0,0.5);
    padding: 5px 15px;
    border-radius: 20px;
}
@media (max-width: 600px) {
    .lightbox-nav { display: none; } /* スマホはスワイプがあるから矢印は隠しちゃうのですよ */
}

