* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    background: #1a1a1a;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: pan-x pan-y;
}

/* ローディングスケルトン */
.loading-skeleton {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    z-index: 5;
    transition: opacity 0.3s ease-out;
}

.loading-skeleton.hidden {
    opacity: 0;
    pointer-events: none;
}

.skeleton-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 20px;
}

.skeleton-cell {
    width: 80px;
    height: 80px;
    background: linear-gradient(90deg, #2a2a4a 25%, #3a3a5a 50%, #2a2a4a 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 8px;
}

@keyframes skeleton-shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.loading-text {
    margin-top: 20px;
    color: #888;
    font-size: 14px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

/* モード切り替え */
.mode-toggle {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
    display: flex;
    gap: 10px;
    background: rgba(0, 0, 0, 0.8);
    padding: 10px;
    border-radius: 8px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.mode-toggle.show {
    opacity: 1;
    pointer-events: auto;
}

.mode-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    background: #444;
    color: white;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.mode-btn:hover {
    background: #555;
}

.mode-btn.active {
    background: #007bff;
}

/* エディターパネル - ダークテーマ */
.editor-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 420px;
    max-width: 90vw;
    max-height: 85vh;
    background: rgba(30, 30, 35, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 9999;
    overflow: hidden;
    transition: opacity 0.3s, box-shadow 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/* ドラッグ可能なパネル */
.editor-panel.draggable {
    transform: none;
    transition: box-shadow 0.2s;
}

.editor-panel.dragging {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
    opacity: 0.95;
    cursor: grabbing;
}

.editor-panel.hidden {
    display: none;
}

.editor-header {
    background: rgba(40, 40, 45, 0.6);
    color: white;
    padding: 14px 16px;
    display: flex;
    cursor: grab;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.editor-header h2 {
    font-size: 15px;
    margin: 0;
    font-weight: 600;
}

.panel-hint {
    font-size: 11px;
    opacity: 0.7;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 10px;
    border-radius: 10px;
    margin-left: auto;
    margin-right: 12px;
}

.close-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    transition: all 0.2s;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.editor-content {
    padding: 16px;
    overflow-y: auto;
    max-height: calc(85vh - 60px);
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
}

.form-group input[type="text"],
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    transition: all 0.2s;
    background: rgba(0, 0, 0, 0.3);
    color: white;
}

.form-group input[type="text"]:focus,
.form-group textarea:focus {
    outline: none;
    border-color: rgba(59, 130, 246, 0.6);
    background: rgba(0, 0, 0, 0.4);
}

.form-group input[type="text"]::placeholder,
.form-group textarea::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.form-group input[type="color"] {
    width: 60px;
    height: 36px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.3);
}

/* エフェクトセレクター */
.effect-selector {
    margin-bottom: 12px;
}

.effect-selector label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
}

.effect-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.effect-btn {
    padding: 6px 12px;
    font-size: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.3);
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.effect-btn:hover {
    background: rgba(102, 126, 234, 0.3);
    border-color: #667eea;
}

.effect-btn.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-color: #667eea;
    color: white;
    font-weight: 500;
}

/* 現在の効果表示 */
.current-effects {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

.effect-tag {
    font-size: 11px;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.7);
}

/* コードエディター（非表示フォールバック用） */
.code-editor-wrapper textarea {
    width: 100%;
    padding: 12px;
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 12px;
    line-height: 1.5;
    background: rgba(0, 0, 0, 0.4);
    color: #a5d6ff;
    resize: vertical;
    min-height: 120px;
}

.code-editor-wrapper textarea::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

.code-editor-wrapper textarea:focus {
    outline: none;
    background: rgba(0, 0, 0, 0.5);
}

.code-hint {
    margin: 0;
    padding: 8px 12px;
    font-size: 11px;
    color: rgba(255, 200, 100, 0.7);
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* 画像解析パネル */
.analyze-image-select {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.analyze-select-btn {
    flex: 1;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #ccc;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.analyze-select-btn:hover {
    background: rgba(102, 126, 234, 0.2);
    border-color: #667eea;
}

.analyze-select-btn.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-color: #667eea;
    color: white;
}

.analyze-image-preview {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 15px;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.analyze-image-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    object-fit: contain;
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
}

.analyze-image-preview img.fade-out {
    opacity: 0;
}

.analyze-image-preview .no-images {
    color: #888;
    text-align: center;
}

.analyze-btn {
    width: 100%;
    background: linear-gradient(135deg, #10b981, #059669) !important;
}

.analyze-btn:hover {
    background: linear-gradient(135deg, #059669, #047857) !important;
}

.analyze-status {
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 10px;
    display: none;
}

.analyze-status.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    text-align: center;
    padding: 15px;
}

.analyze-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(96, 165, 250, 0.3);
    border-top-color: #60a5fa;
    border-radius: 50%;
    animation: analyze-spin 1s linear infinite;
}

@keyframes analyze-spin {
    to { transform: rotate(360deg); }
}

.analyze-timer {
    font-size: 24px;
    font-weight: bold;
    font-variant-numeric: tabular-nums;
}

.analyze-message {
    font-size: 12px;
    opacity: 0.8;
}

.analyze-status.error {
    display: block;
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.analyze-status.success {
    display: block;
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

.analyze-result {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 15px;
    max-height: 400px;
    overflow-y: auto;
}

.analyze-result .no-result {
    color: #888;
    text-align: center;
    margin: 0;
}

.analyze-result-content {
    color: #e5e5e5;
    line-height: 1.7;
    font-size: 13px;
    white-space: pre-wrap;
}

.analyze-result-section {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.analyze-result-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.analyze-result-section h4 {
    color: #667eea;
    margin: 0 0 8px 0;
    font-size: 14px;
}

.analyze-result-section p {
    margin: 0;
    color: #ccc;
}

/* 画像解析アクションボタン */
.analysis-actions {
    margin-top: 16px;
}

.analysis-action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.analysis-action-buttons .action-btn {
    flex: 1;
    min-width: 80px;
    padding: 10px 12px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.analysis-action-buttons .action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.analysis-action-buttons .save-btn {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    width: auto;
}

.analysis-action-buttons .save-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #059669, #047857);
}

.analysis-action-buttons .copy-btn {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

.analysis-action-buttons .copy-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
}

.analysis-action-buttons .download-btn {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: white;
}

.analysis-action-buttons .download-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
}

.analysis-action-buttons .prompt-btn {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.analysis-action-buttons .prompt-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #d97706, #b45309);
}

.analysis-action-buttons .generate-btn {
    background: linear-gradient(135deg, #ec4899, #db2777);
    color: white;
}

.analysis-action-buttons .generate-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #db2777, #be185d);
}

.analysis-action-buttons .regenerate-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    flex: 1 1 100%;
}

.analysis-action-buttons .regenerate-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #5a67d8, #6b46c1);
}

/* ========================================
   プロンプト履歴 & 画像履歴
   ======================================== */

.prompt-history-section,
.image-history-section {
    margin-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 16px;
}

.history-count {
    font-size: 12px;
    color: #888;
    font-weight: normal;
}

/* クイックアクセスボタン */
.history-quick-access {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}

.history-quick-btn {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    color: #ccc;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.history-quick-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.history-quick-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.history-quick-btn.active {
    background: rgba(102, 126, 234, 0.3);
    border-color: #667eea;
    color: white;
}

/* 履歴リスト */
.history-list {
    max-height: 200px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 8px;
}

.history-list .no-history {
    color: #666;
    text-align: center;
    font-size: 12px;
    padding: 20px;
    margin: 0;
}

.history-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.history-item:last-child {
    margin-bottom: 0;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.history-item.selected {
    background: rgba(102, 126, 234, 0.2);
    border-color: #667eea;
}

.history-item-icon {
    font-size: 14px;
    flex-shrink: 0;
}

.history-item-content {
    flex: 1;
    min-width: 0;
}

.history-item-label {
    font-size: 11px;
    color: #888;
    margin-bottom: 2px;
}

.history-item-text {
    font-size: 12px;
    color: #ccc;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.history-item-default {
    font-size: 10px;
    color: #10b981;
    margin-top: 2px;
}

/* 履歴アクションボタン */
.history-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.history-action-btn {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    color: #ccc;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.history-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.history-action-btn.danger {
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.history-action-btn.danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

.history-action-btn.primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-color: transparent;
    color: white;
}

.history-action-btn.primary:hover {
    background: linear-gradient(135deg, #5a67d8, #6b46c1);
}

.history-action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* 画像履歴サムネイル */
.image-history-thumbs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

.image-history-thumbs .no-history {
    color: #666;
    text-align: center;
    font-size: 12px;
    padding: 20px;
    margin: 0;
    width: 100%;
}

.image-thumb {
    flex-shrink: 0;
    width: 60px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    position: relative;
}

.image-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-thumb:hover {
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
}

.image-thumb.selected {
    border-color: #667eea;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
}

.image-thumb-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 9px;
    text-align: center;
    padding: 2px 4px;
}

.image-thumb.current::after {
    content: '現在';
    position: absolute;
    top: 2px;
    right: 2px;
    background: #10b981;
    color: white;
    font-size: 8px;
    padding: 1px 4px;
    border-radius: 3px;
}

.image-history-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

/* チェックボックススタイル */
.form-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #3b82f6;
    cursor: pointer;
    margin-right: 8px;
    vertical-align: middle;
}

.form-group label:has(input[type="checkbox"]) {
    display: flex;
    align-items: center;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
}

.form-group label:has(input[type="checkbox"]):hover {
    color: rgba(255, 255, 255, 0.9);
}

.save-btn {
    width: 100%;
    padding: 10px;
    background: #444;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.save-btn:hover {
    background: #555;
}

/* AI画像生成セクション */
.form-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.section-title {
    font-size: 14px;
    margin-bottom: 12px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

.generation-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.gen-btn {
    padding: 10px 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: #444;
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 13px;
    transition: all 0.2s;
    text-align: center;
}

.gen-btn small {
    display: block;
    font-size: 10px;
    margin-top: 2px;
    opacity: 0.6;
    font-weight: 400;
}

.gen-btn:hover {
    background: #555;
    border-color: rgba(255, 255, 255, 0.25);
}

.gen-btn.primary {
    grid-column: 1 / -1;
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.gen-btn.primary:hover {
    background: #2563eb;
    border-color: #2563eb;
}

.advanced-prompts {
    margin-bottom: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 0;
    background: rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.advanced-prompts summary {
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    outline: none;
    padding: 10px 12px;
    transition: all 0.2s;
}

.advanced-prompts summary:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

.advanced-prompts[open] summary {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.advanced-prompts .form-group {
    padding: 0 12px;
}

.advanced-prompts .form-group:last-child {
    padding-bottom: 12px;
}

/* 参考画像セクション */
.reference-image-section {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin-bottom: 12px;
}

.reference-image-section summary {
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    outline: none;
    padding: 10px 12px;
    transition: all 0.2s;
}

.reference-image-section summary:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

.reference-image-section[open] summary {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.reference-image-content {
    padding: 12px;
}

.reference-image-content .form-group {
    margin-bottom: 12px;
}

.reference-image-content input[type="range"] {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    appearance: none;
    cursor: pointer;
}

.reference-image-content input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    background: #3b82f6;
    border-radius: 50%;
    cursor: pointer;
}

.reference-image-preview {
    margin-top: 10px;
}

.reference-image-preview img {
    max-width: 100%;
    max-height: 120px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.reference-image-preview .preview-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 4px;
}

/* 参考画像タブ切り替え */
.reference-input-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
}

.ref-tab {
    flex: 1;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.ref-tab:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.ref-tab.active {
    background: rgba(59, 130, 246, 0.3);
    border-color: rgba(59, 130, 246, 0.5);
    color: white;
}

.ref-tab-content {
    margin-top: 8px;
}

.ref-tab-content.hidden {
    display: none;
}

/* 参考画像の情報ボックス */
.reference-info-box {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 6px;
    padding: 10px 12px;
    margin-top: 10px;
    font-size: 12px;
}

.reference-info-box p {
    margin: 0;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.5;
}

.reference-info-box p:first-child {
    color: #3b82f6;
    margin-bottom: 4px;
}

.reference-info-box strong {
    color: #60a5fa;
}

.file-upload-btn {
    display: inline-block;
    padding: 8px 16px;
    background: rgba(59, 130, 246, 0.2);
    border: 1px dashed rgba(59, 130, 246, 0.5);
    border-radius: 6px;
    color: #3b82f6;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.file-upload-btn:hover {
    background: rgba(59, 130, 246, 0.3);
    border-color: #3b82f6;
}

.file-name {
    display: inline-block;
    margin-left: 10px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

.clear-btn {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 6px 10px;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 4px;
    color: #ef4444;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.clear-btn:hover {
    background: rgba(239, 68, 68, 0.3);
}

.clear-btn.hidden {
    display: none;
}

.gen-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.generation-status {
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 10px;
    font-size: 12px;
    text-align: center;
}

.generation-status.loading {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.generation-status.success {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.generation-status.error {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.generated-images {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 10px;
    max-height: 200px;
    overflow-y: auto;
}

.generated-image-item {
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(0, 0, 0, 0.3);
}

.generated-image-item:hover {
    border-color: rgba(59, 130, 246, 0.5);
    transform: scale(1.02);
}

.generated-image-item img {
    width: 100%;
    height: auto;
    max-height: 150px;
    object-fit: contain;
    display: block;
}

.image-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.85);
    color: rgba(255, 255, 255, 0.9);
    padding: 5px;
    font-size: 11px;
    text-align: center;
}

.generated-image-item.selected {
    border-color: #22c55e;
    border-width: 2px;
}

.generated-image-item.selected .image-label {
    background: rgba(34, 197, 94, 0.9);
}

/* 保存済み画像プレビュー */
.saved-images-preview {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
}

.saved-images-preview .no-images {
    grid-column: 1 / -1;
    text-align: center;
    color: rgba(255, 255, 255, 0.4);
    font-size: 12px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    border: 1px dashed rgba(255, 255, 255, 0.1);
}

.saved-image-card {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
    transition: all 0.2s;
}

.saved-image-card:hover {
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.saved-image-card .image-wrapper {
    position: relative;
    width: 100%;
    padding-top: 100%;
    background: rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.saved-image-card .image-wrapper.mobile {
    padding-top: 177.78%;
    /* 9:16 */
}

.saved-image-card .image-wrapper.desktop {
    padding-top: 56.25%;
    /* 16:9 */
}

.saved-image-card .image-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
}

.saved-image-card .device-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.5);
    font-size: 11px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
}

.saved-image-card .device-label .device-icon {
    font-size: 14px;
}

.saved-image-card .delete-image-btn {
    background: rgba(239, 68, 68, 0.8);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.saved-image-card .delete-image-btn:hover {
    background: #ef4444;
}

.saved-image-card.no-image {
    border-style: dashed;
    border-color: rgba(255, 255, 255, 0.15);
}

.saved-image-card.no-image .image-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 0;
    height: 60px;
}

.saved-image-card.no-image .no-image-text {
    color: rgba(255, 255, 255, 0.3);
    font-size: 11px;
}

/* ドロップゾーン（クリック＆D&D対応） */
.saved-image-card.dropzone {
    cursor: pointer;
    transition: all 0.2s ease;
}

.saved-image-card.dropzone:hover {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.05);
}

.saved-image-card.dropzone.drag-over {
    border-color: #22c55e;
    border-width: 2px;
    background: rgba(34, 197, 94, 0.1);
    transform: scale(1.02);
}

.saved-image-card.dropzone .dropzone-hint {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 6px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    color: rgba(255, 255, 255, 0.7);
    font-size: 10px;
    text-align: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.saved-image-card.dropzone:hover .dropzone-hint {
    opacity: 1;
}

/* アップロードプレースホルダー */
.saved-image-card .upload-area {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 0 !important;
    min-height: 120px;
    background: rgba(59, 130, 246, 0.05);
    border: 2px dashed rgba(59, 130, 246, 0.3);
    border-radius: 6px;
    transition: all 0.2s;
}

.saved-image-card:hover .upload-area {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.5);
}

.saved-image-card.drag-over .upload-area {
    background: rgba(34, 197, 94, 0.15);
    border-color: #22c55e;
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px;
}

.upload-placeholder .upload-icon {
    font-size: 28px;
    opacity: 0.6;
}

.upload-placeholder .upload-text {
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
}

.upload-placeholder .upload-hint {
    font-size: 11px;
    color: rgba(59, 130, 246, 0.8);
}

/* 画像拡大モーダル */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.image-modal.show {
    opacity: 1;
    pointer-events: auto;
}

.image-modal img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

.image-modal .modal-close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 40px;
    color: white;
    cursor: pointer;
    transition: transform 0.2s;
}

.image-modal .modal-close:hover {
    transform: scale(1.2);
}

.image-modal .modal-info {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
}

/* セクションヘッダー */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.section-header .section-title {
    margin-bottom: 0;
}

/* ギャラリーボタン */
.gallery-btn {
    padding: 5px 10px;
    background: #444;
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 5px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.gallery-btn:hover {
    background: #555;
    color: white;
}

/* 画像カードのオーバーレイ */
.saved-image-card .image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    opacity: 0;
    transition: opacity 0.3s;
}

.saved-image-card:hover .image-overlay {
    opacity: 1;
}

.image-overlay-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.2s;
}

.image-overlay-btn:hover {
    transform: scale(1.1);
}

.image-overlay-btn.expand {
    background: #007bff;
    color: white;
}

.image-overlay-btn.delete {
    background: #dc3545;
    color: white;
}

/* ギャラリーモーダル */
.gallery-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-modal.hidden {
    display: none;
}

.gallery-modal-content {
    background: white;
    width: 90vw;
    max-width: 1000px;
    height: 80vh;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.gallery-modal-header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 15px 20px;
    background: #007bff;
    color: white;
}

.gallery-modal-header h3 {
    margin: 0;
    font-size: 18px;
}

.gallery-filter {
    display: flex;
    gap: 8px;
    flex: 1;
}

.gallery-filter-btn {
    padding: 6px 12px;
    border: 2px solid white;
    background: transparent;
    color: white;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.gallery-filter-btn:hover,
.gallery-filter-btn.active {
    background: white;
    color: #007bff;
}

.gallery-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    padding: 0 5px;
}

.gallery-close-btn:hover {
    transform: scale(1.2);
}

.gallery-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f5f5f5;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.gallery-loading {
    grid-column: 1 / -1;
    text-align: center;
    color: #999;
    padding: 40px;
}

.gallery-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all 0.3s;
    background: white;
}

.gallery-item:hover {
    border-color: #007bff;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.gallery-item.selected {
    border-color: #28a745;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.3);
}

.gallery-item img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}

.gallery-item-info {
    padding: 8px;
    font-size: 11px;
    color: #666;
    background: white;
}

.gallery-item-info .aspect {
    font-weight: 600;
    color: #333;
}

.gallery-item-info .date {
    color: #999;
}

.gallery-item-actions {
    position: absolute;
    top: 5px;
    right: 5px;
    display: flex;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.3s;
}

.gallery-item:hover .gallery-item-actions {
    opacity: 1;
}

.gallery-item-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-item-btn.expand {
    background: rgba(0, 123, 255, 0.9);
    color: white;
}

.gallery-modal-footer {
    padding: 15px 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gallery-hint {
    margin: 0;
    font-size: 13px;
    color: #666;
}

.gallery-use-btn {
    padding: 10px 25px;
    background: #444;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.gallery-use-btn:hover:not(:disabled) {
    background: #555;
}

.gallery-use-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.gallery-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: #999;
    padding: 60px 20px;
}

.gallery-empty p {
    margin: 10px 0;
}

/* API設定パネル */
.api-security-notice {
    background: #f8f9fa;
    border: 2px solid #007bff;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.api-security-notice h3 {
    color: #007bff;
    margin-bottom: 10px;
    font-size: 16px;
}

.security-info {
    font-size: 14px;
    line-height: 1.6;
}

.security-info ul {
    margin: 10px 0;
    padding-left: 20px;
}

.security-info li {
    margin: 5px 0;
}

.api-status {
    padding: 12px;
    border-radius: 5px;
    font-weight: 600;
    text-align: center;
}

.api-status.configured {
    background: #d4edda;
    color: #155724;
    border: 1px solid #28a745;
}

.api-status.not-configured {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #dc3545;
}

.api-status.checking {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffc107;
}

.code-block {
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 15px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

.code-block code {
    display: block;
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 10px;
    border-radius: 3px;
    margin-top: 5px;
    overflow-x: auto;
}

.external-link {
    display: inline-block;
    color: #007bff;
    text-decoration: none;
    font-weight: 600;
    padding: 8px 12px;
    border: 2px solid #007bff;
    border-radius: 5px;
    transition: all 0.3s;
}

.external-link:hover {
    background: #007bff;
    color: white;
}

.api-key-input {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    font-family: monospace;
    transition: border-color 0.3s;
}

.api-key-input:focus {
    outline: none;
    border-color: #007bff;
}

.input-with-button {
    display: flex;
    gap: 5px;
    align-items: stretch;
}

.input-with-button input {
    flex: 1;
}

.toggle-btn {
    padding: 10px 15px;
    border: 2px solid #ddd;
    background: white;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
}

.toggle-btn:hover {
    background: #f0f0f0;
    border-color: #007bff;
}

.help-text {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #666;
}

.divider {
    margin: 20px 0;
    text-align: center;
    position: relative;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #ddd;
}

.divider span {
    position: relative;
    background: white;
    padding: 0 15px;
    color: #999;
    font-size: 14px;
}

.save-btn.secondary {
    background: #6c757d;
}

.save-btn.secondary:hover {
    background: #5a6268;
}

/* コントロールパネル */
.control-panel {
    position: fixed;
    top: 20px;
    right: 20px;
    bottom: 20px;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.8);
    padding: 15px;
    border-radius: 8px;
    color: white;
    min-width: 200px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    /* スクロールバーのスタイル */
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.3) transparent;
}

.control-panel::-webkit-scrollbar {
    width: 6px;
}

.control-panel::-webkit-scrollbar-track {
    background: transparent;
}

.control-panel::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 3px;
}

.control-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.5);
}

.control-panel.show {
    opacity: 1;
    pointer-events: auto;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.ctrl-btn {
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    background: #444;
    color: white;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.ctrl-btn:hover {
    background: #555;
}

.ctrl-btn.primary {
    background: #444;
}

.ctrl-btn.primary:hover {
    background: #555;
}

.ctrl-btn.accent {
    background: #444;
}

.ctrl-btn.accent:hover {
    background: #555;
}

.position-indicator {
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    text-align: center;
    margin-bottom: 10px;
    font-size: 14px;
}

/* ミニマップ */
.minimap {
    display: grid;
    /* JSで動的に設定: grid-template-columns */
    grid-auto-rows: minmax(8px, 12px);
    gap: 2px;
    background: rgba(255, 255, 255, 0.1);
    padding: 5px;
    border-radius: 5px;
    max-height: 300px;
    overflow-y: auto;
}

.minimap-cell {
    background: #444;
    border-radius: 2px;
    transition: all 0.2s;
    cursor: pointer;
}

.minimap-cell:hover {
    background: #666;
    transform: scale(1.15);
    z-index: 1;
}

.minimap-cell.has-content {
    background: #28a745;
}

.minimap-cell.has-content:hover {
    background: #3cb371;
    transform: scale(1.15);
    z-index: 1;
}

.minimap-cell.active {
    background: #007bff;
    box-shadow: 0 0 5px #007bff;
}

.minimap-cell.active:hover {
    background: #0056b3;
}

.minimap-cell.has-content.active {
    background: #007bff;
}

/* フローティングミニマップ（右下固定）- 8x20対応 */
.floating-minimap {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 160px;  /* 8x20対応: 20行分 */
    background: rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    padding: 6px;
    z-index: 100;
    opacity: 0.6;
    transition: all 0.3s ease;
    cursor: pointer;
    overflow: hidden;
}

.floating-minimap:hover {
    opacity: 0.95;
    width: 70px;
    height: 220px;
    background: rgba(0, 0, 0, 0.8);
}

.floating-minimap .minimap {
    width: 100%;
    height: 100%;
    display: grid;
    gap: 1px;
    padding: 0;
    max-height: 100%;
    overflow: hidden;
    grid-auto-rows: 1fr;
}

.floating-minimap .minimap-cell {
    border-radius: 1px;
    min-height: 0;
    min-width: 0;
}

/* 管理画面モード時のフローティングミニマップ（大きく表示） */
.floating-minimap.expanded {
    width: 80px;
    height: 260px;
    opacity: 0.95;
    background: rgba(0, 0, 0, 0.85);
}

.floating-minimap.expanded:hover {
    width: 100px;
    height: 320px;
}

.floating-minimap.expanded .minimap {
    gap: 2px;
}

.floating-minimap.expanded .minimap-cell {
    border-radius: 2px;
}

/* ミニマップ非表示 */
.floating-minimap.hidden {
    display: none !important;
}

/* 編集モード時はコントロールパネルと重ならないようにフローティングミニマップを確実に隠す */
body.edit-mode .floating-minimap {
    display: none !important;
}

/* グリッドコンテナ (Swiper.js) */
.grid-container {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    position: relative;
    /* テキスト選択防止 */
    user-select: none;
    -webkit-user-select: none;
}

/* 縦スワイパー */
.swiper-vertical {
    width: 100%;
    height: 100%;
}

/* 横スワイパー（各行内） */
.swiper-horizontal {
    width: 100%;
    height: 100%;
}

/* 行スライド */
.swiper-row {
    width: 100%;
    height: 100%;
}

/* 編集モード */
.grid-container.edit-mode .cell {
    cursor: pointer;
}

/* Swiper ラッパー - Swiperが自動管理 */

.cell {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
    position: relative;
    overflow: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
    /* iOS風の滑らかな3D効果 */
    transform-style: preserve-3d;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    /* アンチエイリアス */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* レスポンシブ背景画像 */
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;

    /* PC版画像のデフォルト適用 */
    background-image: var(--bg-desktop) !important;
}

/* Swiperスライドとしてのセル */
.swiper-slide.cell {
    width: 100vw !important;
    height: 100vh !important;
}

/* モバイル用 (768px以下) */
@media (max-width: 768px) {
    .cell {
        padding: 20px;
        /* スマホ版画像の適用（PC版があればフォールバック） */
        background-image: var(--bg-mobile, var(--bg-desktop)) !important;
    }
}

.cell.edit-mode {
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.cell.edit-mode::before {
    content: '✏️ クリックして編集';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 123, 255, 0.9);
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 1.2em;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 10;
}

.cell.edit-mode:hover::before {
    opacity: 1;
}

.cell.edit-mode:hover {
    box-shadow: inset 0 0 0 5px #007bff;
}

.cell-title {
    font-size: 3em;
    font-weight: 700;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.cell-content {
    font-size: 1.5em;
    line-height: 1.6;
    max-width: 800px;
}

.cell-index {
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 0.9em;
    opacity: 0;
    font-weight: 600;
    transition: opacity 0.3s;
}

.edit-mode .cell-index {
    opacity: 0.5;
}


/* スワイプインジケーター */
.swipe-indicator {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.swipe-indicator.show {
    opacity: 1;
}

.swipe-indicator.hide-on-edit {
    display: none;
}

.swipe-icon {
    font-size: 18px;
    animation: swipeHint 2s infinite;
}

@keyframes swipeHint {

    0%,
    100% {
        transform: translateX(0);
    }

    50% {
        transform: translateX(5px);
    }
}

/* レスポンシブ */
@media (max-width: 768px) {
    .mode-toggle {
        top: 10px;
        left: 10px;
        padding: 5px;
    }

    .mode-btn {
        padding: 8px 12px;
        font-size: 12px;
    }

    .control-panel {
        top: 10px;
        right: 10px;
        bottom: 10px;
        padding: 10px;
        min-width: 150px;
        max-height: calc(100vh - 20px);
    }

    .ctrl-btn {
        padding: 8px 10px;
        font-size: 12px;
    }

    .cell-title {
        font-size: 2em;
    }

    .cell-content {
        font-size: 1.2em;
    }

    .cell {
        padding: 20px;
    }

    .editor-panel {
        width: 95vw;
        max-height: 90vh;
    }

    .swipe-indicator {
        bottom: 20px;
        padding: 10px 20px;
        font-size: 12px;
    }
}

/* API設定モード通知 */
.info-notice {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    padding: 15px;
    margin: 15px 0;
    border-radius: 5px;
}

.info-notice p {
    margin: 5px 0;
    color: #1565c0;
}

.info-notice strong {
    color: #0d47a1;
}

.warning-notice {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 15px;
    margin: 15px 0;
    border-radius: 5px;
}

.warning-notice p {
    margin: 5px 0;
    color: #856404;
}

.warning-notice strong {
    color: #663c00;
}

/* プロンプト履歴 */
.prompt-history {
    margin-bottom: 12px;
}

.prompt-history h4 {
    font-size: 12px;
    margin-bottom: 6px;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 500;
}

.prompt-history-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 150px;
    overflow-y: auto;
}

.prompt-history-item {
    background: rgba(0, 0, 0, 0.3);
    padding: 6px 10px;
    border-radius: 5px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.7);
}

.prompt-history-item:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
    transform: translateX(3px);
    color: white;
}

.no-history {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    font-style: italic;
    padding: 8px;
    text-align: center;
}

/* Favicon設定パネル */
.favicon-presets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 15px;
    margin-top: 10px;
}

.favicon-preset-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
}

.favicon-preset-btn:hover {
    border-color: #4a90e2;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.favicon-preset-btn.active {
    border-color: #4a90e2;
    background: #f0f7ff;
}

.favicon-preview {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.favicon-preset-btn span {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

.current-favicon {
    padding: 15px;
    background: #f5f5f5;
    border-radius: 8px;
    text-align: center;
}

.current-favicon strong {
    color: #4a90e2;
}

/* 基本管理パネル */
.management-section {
    margin-bottom: 15px;
}

.management-section h3 {
    font-size: 14px;
    margin-bottom: 10px;
    color: #333;
}

.favicon-presets.compact {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.favicon-preset-btn-mini {
    width: 40px;
    height: 40px;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    padding: 2px;
    background: white;
    transition: all 0.2s;
}

.favicon-preset-btn-mini:hover {
    border-color: #4a90e2;
    transform: scale(1.1);
}

.favicon-preview-mini {
    width: 100%;
    height: 100%;
    border-radius: 6px;
}

.current-project-info.compact {
    padding: 8px 12px;
    background: #f5f5f5;
    border-radius: 6px;
    margin-bottom: 10px;
    font-size: 13px;
}

.project-actions.compact {
    display: flex;
    gap: 8px;
}

.action-btn.small {
    padding: 6px 12px;
    font-size: 12px;
}

.save-btn.small {
    padding: 6px 12px;
    font-size: 12px;
}

.external-link.small {
    font-size: 12px;
    display: inline-block;
    margin-left: 10px;
}

/* LPフレームワークパネル */
.framework-panel {
    max-width: 600px;
}

.framework-content {
    padding: 15px;
}

.framework-section {
    margin-bottom: 20px;
}

.framework-section h3 {
    font-size: 16px;
    margin-bottom: 15px;
    color: #333;
}

/* フレームワークカード */
.framework-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.framework-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.framework-card:hover {
    border-color: #4a90e2;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.2);
}

.framework-card.selected {
    border-color: #4a90e2;
    background: linear-gradient(135deg, #f0f7ff 0%, #e8f4fd 100%);
}

.framework-card .card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.framework-card .card-icon {
    font-size: 24px;
}

.framework-card h4 {
    margin: 0;
    font-size: 16px;
    color: #333;
}

.framework-card .card-desc {
    font-size: 12px;
    color: #666;
    margin: 0 0 8px 0;
    line-height: 1.4;
}

.framework-card .card-tag {
    display: inline-block;
    background: #444;
    color: white;
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 10px;
}

/* 戻るボタン */
.back-btn {
    background: none;
    border: none;
    color: #4a90e2;
    cursor: pointer;
    font-size: 14px;
    padding: 5px 0;
    margin-bottom: 15px;
}

.back-btn:hover {
    text-decoration: underline;
}

/* チャットUI */
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.chat-header h3 {
    margin: 0;
}

.chat-messages {
    height: 250px;
    overflow-y: auto;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 8px;
    margin-bottom: 10px;
}

.chat-message {
    margin-bottom: 12px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.ai {
    background: white;
    padding: 12px;
    border-radius: 12px 12px 12px 0;
    border: 1px solid #e0e0e0;
}

.chat-message.user {
    background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
    color: white;
    padding: 12px;
    border-radius: 12px 12px 0 12px;
    margin-left: 20%;
}

.chat-message .message-text {
    font-size: 14px;
    line-height: 1.5;
}

.chat-input-area {
    display: flex;
    gap: 8px;
}

.chat-input-area input {
    flex: 1;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
}

.chat-input-area input:focus {
    border-color: #4a90e2;
    outline: none;
}

.send-btn {
    background: #444;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s;
}

.send-btn:hover {
    background: #555;
}

/* 提案ボタン */
.chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.suggestion-btn {
    background: #f0f0f0;
    border: 1px solid #ddd;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.suggestion-btn:hover {
    background: #e0e0e0;
    border-color: #4a90e2;
}

/* 結果プレビュー */
.result-preview {
    background: #f9f9f9;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    max-height: 300px;
    overflow-y: auto;
}

.result-row {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
}

.result-row .row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.result-row .row-number {
    background: #444;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.result-row .row-stage {
    font-size: 12px;
    color: #666;
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 10px;
}

.result-row .row-title {
    font-weight: bold;
    margin-bottom: 5px;
}

.result-row .row-content {
    font-size: 13px;
    color: #666;
}

.result-row .row-prompt {
    font-size: 11px;
    color: #888;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #ddd;
}

.result-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* フレームワーク詳細 */
.detail-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.detail-header .detail-icon {
    font-size: 32px;
}

.detail-header h3 {
    margin: 0;
    font-size: 24px;
}

.detail-desc {
    color: #666;
    margin-bottom: 20px;
    line-height: 1.6;
}

.stages-list {
    margin-bottom: 20px;
}

.stage-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 8px;
    margin-bottom: 8px;
}

.stage-item .stage-key {
    background: #444;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 12px;
    flex-shrink: 0;
}

.stage-item .stage-info strong {
    display: block;
    margin-bottom: 4px;
}

.stage-item .stage-info p {
    margin: 0;
    font-size: 13px;
    color: #666;
}

.best-for-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.best-for-tags .tag {
    background: #e8f4fd;
    color: #4a90e2;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 12px;
}

#start-chat-btn {
    width: 100%;
    padding: 15px;
    font-size: 16px;
}

/* セル入れ替えボタン */
.cell-move-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.move-btn {
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: #444;
    color: rgba(255, 255, 255, 0.8);
    border-radius: 5px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.move-btn:hover {
    background: #555;
    color: white;
    border-color: rgba(255, 255, 255, 0.25);
}

.move-btn:active {
    transform: scale(0.97);
}

/* 総合編集モードパネル */
.master-editor-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 1100px;
    max-width: 95vw;
    max-height: 90vh;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    z-index: 10000;
    overflow: hidden;
}

.master-editor-panel.hidden {
    display: none;
}

.master-editor-header {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.master-editor-header h2 {
    font-size: 20px;
    margin: 0;
}

.master-editor-hint {
    font-size: 12px;
    opacity: 0.8;
}

.master-editor-content {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(90vh - 80px);
}

.master-section {
    margin-bottom: 25px;
}

.master-section h3 {
    font-size: 16px;
    color: #333;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e0e0e0;
}

.master-divider {
    height: 2px;
    background: #444;
    margin: 25px 0;
    border-radius: 1px;
}

/* URL入力グループ */
.url-input-group {
    display: flex;
    gap: 10px;
}

.url-input-group input {
    flex: 1;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.url-input-group input:focus {
    outline: none;
    border-color: #667eea;
}

/* アクションボタン */
.action-btn {
    padding: 12px 20px;
    background: #444;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.action-btn:hover {
    background: #555;
}

/* セクショングリッド */
.industries-grid,
.sections-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.industries-grid input,
.sections-grid input {
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 13px;
}

.industries-grid input:focus,
.sections-grid input:focus {
    outline: none;
    border-color: #667eea;
}

/* 画風グリッド（列ごと） */
.art-styles-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
}

.art-style-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.art-style-label {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    min-width: 45px;
}

.art-style-select {
    flex: 1;
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 12px;
    background: white;
    cursor: pointer;
}

.art-style-select:focus {
    outline: none;
    border-color: #667eea;
}

.all-same-style {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-top: 10px;
}

.all-same-style select {
    flex: 1;
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 12px;
    background: white;
}

.action-btn.small {
    padding: 8px 12px;
    font-size: 12px;
    white-space: nowrap;
}

/* 画風・トーンオプション */
.art-style-options,
.tone-options {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.art-style-options label,
.tone-options label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    cursor: pointer;
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    transition: all 0.3s;
}

.art-style-options label:hover,
.tone-options label:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.art-style-options input:checked+label,
.tone-options input:checked+label,
.art-style-options label:has(input:checked),
.tone-options label:has(input:checked) {
    border-color: #667eea;
    background: #eef0ff;
}

/* キャラシート選択 */
.character-sheet-select {
    margin-top: 15px;
}

.character-sheet-select label {
    display: block;
    font-size: 14px;
    margin-bottom: 8px;
    color: #555;
}

.character-sheet-select select {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    background: white;
}

.character-sheet-select select:focus {
    outline: none;
    border-color: #667eea;
}

/* 参考画像アップロード */
.reference-upload {
    display: flex;
    gap: 10px;
    align-items: center;
}

.reference-upload input[type="file"] {
    flex: 1;
}

.analyzed-result {
    margin-top: 15px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 5px;
    border: 1px solid #e0e0e0;
}

.analyzed-result.hidden {
    display: none;
}

/* マスターアクションボタン */
.master-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}

.primary-action-btn {
    padding: 15px 25px;
    background: #444;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
}

.primary-action-btn:hover {
    background: #555;
    transform: translateY(-2px);
}

.primary-action-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.secondary-action-btn {
    padding: 12px 20px;
    background: #444;
    color: white;
    border: 1px solid #555;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.secondary-action-btn:hover {
    background: #555;
}

/* ヒントテキスト */
.hint {
    font-size: 12px;
    color: #888;
    margin-top: 5px;
}

/* テキストエリア共通 */
.master-section textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
}

.master-section textarea:focus {
    outline: none;
    border-color: #667eea;
}

/* 業種別カードスタイル */
.industry-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.industry-card {
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.3s;
}

.industry-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.industry-card-header {
    background: #444;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.column-badge {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    white-space: nowrap;
}

.industry-name-input {
    flex: 1;
    padding: 6px 10px;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.9);
}

.industry-name-input:focus {
    outline: none;
    background: white;
}

.industry-card-body {
    padding: 12px;
}

.card-field {
    margin-bottom: 10px;
}

.card-field:last-child {
    margin-bottom: 0;
}

.card-field label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #666;
    margin-bottom: 4px;
}

.card-field input[type="url"],
.card-field input[type="text"],
.card-field textarea {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
}

.card-field input:focus,
.card-field textarea:focus {
    outline: none;
    border-color: #667eea;
}

.card-field .art-style-select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    background: white;
}

.sections-field input {
    margin-bottom: 4px;
}

.sections-field input:last-child {
    margin-bottom: 0;
}

/* 一括操作エリア */
.bulk-operations {
    background: #f0f0f0;
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
}

.bulk-op-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.bulk-op-row:last-child {
    margin-bottom: 0;
}

.bulk-op-row select {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    background: white;
}

/* URL履歴タグ */
.url-history-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.url-history-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #e8f0fe;
    border: 1px solid #c4d7f2;
    border-radius: 20px;
    padding: 4px 10px 4px 12px;
    font-size: 11px;
    color: #1a73e8;
    cursor: pointer;
    transition: all 0.2s;
    max-width: 250px;
}

.url-history-tag:hover {
    background: #d2e3fc;
    border-color: #a8c7fa;
}

.url-history-tag span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.url-history-tag .remove-url {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.1);
    color: #666;
    font-size: 12px;
    line-height: 1;
    transition: all 0.2s;
}

.url-history-tag .remove-url:hover {
    background: #ff4444;
    color: white;
}

/* レスポンシブ対応 */
@media (max-width: 1200px) {
    .industry-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .master-editor-panel {
        width: 100%;
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .industry-cards {
        grid-template-columns: 1fr;
    }

    .industries-grid,
    .sections-grid {
        grid-template-columns: 1fr;
    }

    .art-style-options,
    .tone-options {
        flex-direction: column;
        gap: 8px;
    }

    .url-input-group {
        flex-direction: column;
    }

    .bulk-op-row {
        flex-direction: column;
    }

    .bulk-op-row select {
        width: 100%;
    }
}

/* ============================================
   プロジェクト管理パネル
   ============================================ */

.ctrl-btn.highlight {
    background: #444;
    color: white;
    font-weight: bold;
}

.ctrl-btn.highlight:hover {
    background: #555;
    transform: translateY(-2px);
}

.current-project-info {
    background: #f8f9fa;
    padding: 12px 16px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    font-weight: bold;
    color: #333;
}

.project-actions {
    display: flex;
    gap: 10px;
    margin: 15px 0;
}

.project-actions .action-btn {
    flex: 1;
    padding: 10px 15px;
    border: none;
    border-radius: 6px;
    background: #444;
    color: white;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.project-actions .action-btn:hover {
    background: #555;
    transform: translateY(-1px);
}

.project-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: #f8f9fa;
}

.project-list .loading,
.project-list .empty,
.project-list .error {
    padding: 20px;
    text-align: center;
    color: #666;
}

.project-list .error {
    color: #dc3545;
}

.project-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #dee2e6;
    cursor: pointer;
    transition: background 0.2s;
}

.project-item:last-child {
    border-bottom: none;
}

.project-item:hover {
    background: #e9ecef;
}

.project-item.active {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-left: 3px solid #667eea;
}

.project-info {
    flex: 1;
    min-width: 0;
}

.project-name {
    display: block;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.project-date {
    display: block;
    font-size: 12px;
    color: #888;
    margin-top: 2px;
}

.project-actions-inline {
    display: flex;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.2s;
}

.project-item:hover .project-actions-inline {
    opacity: 1;
}

.project-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: #444;
    color: white;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.project-btn:hover {
    background: #555;
    transform: scale(1.1);
}

.project-btn.switch-btn:hover {
    background: #28a745;
    color: white;
}

.project-btn.copy-btn:hover {
    background: #17a2b8;
    color: white;
}

.project-btn.delete-btn:hover {
    background: #dc3545;
    color: white;
}

.input-with-button {
    display: flex;
    gap: 10px;
}

.input-with-button input {
    flex: 1;
}

.save-btn.small {
    padding: 8px 16px;
    font-size: 14px;
}

/* 画像アップロードセクション */
.upload-description {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 10px;
}

.upload-buttons {
    display: flex;
    gap: 10px;
}

.upload-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.upload-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    background: #444;
    color: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s;
    text-align: center;
}

.upload-btn:hover {
    background: #555;
    color: white;
    border-color: rgba(255, 255, 255, 0.25);
}

.upload-btn:active {
    transform: scale(0.98);
}

.upload-status {
    font-size: 10px;
    text-align: center;
    min-height: 14px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 4px;
}

.upload-status.loading {
    color: #60a5fa;
}

.upload-status.success {
    color: #4ade80;
}

.upload-status.error {
    color: #f87171;
}

/* 画像URLリンク */
.image-url-link {
    display: block;
    font-size: 10px;
    color: #666;
    text-decoration: none;
    padding: 4px 8px;
    margin-top: 4px;
    background: #f5f5f5;
    border-radius: 4px;
    word-break: break-all;
    transition: all 0.2s;
}

.image-url-link:hover {
    color: #007bff;
    background: #e8f4ff;
}

/* ギャラリーアイテムのURLリンク */
.gallery-item-url {
    display: block;
    font-size: 9px;
    color: #888;
    text-decoration: none;
    padding: 2px 4px;
    margin-top: 2px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 2px;
    word-break: break-all;
    transition: all 0.2s;
}

.gallery-item-url:hover {
    color: #007bff;
    background: #fff;
}

/* URL解析結果スタイル */
.url-analysis-result {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 12px;
    padding: 16px;
    margin-top: 8px;
}

.url-analysis-result h4 {
    color: #4ade80;
    margin-bottom: 12px;
    font-size: 14px;
}

.url-analysis-result .analysis-item {
    margin-bottom: 10px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
}

.url-analysis-result .analysis-item strong {
    color: #a78bfa;
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
}

.url-analysis-result .analysis-item ul {
    margin: 4px 0 0 16px;
    color: #ccc;
    font-size: 11px;
}

.url-analysis-result .analysis-item ul li {
    margin-bottom: 2px;
}

.url-analysis-result .analysis-item small {
    color: #888;
    font-size: 10px;
}

.url-analysis-result .testimonial-preview {
    font-style: italic;
    color: #999;
    font-size: 11px;
    padding: 6px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    margin-top: 4px;
}

.url-analysis-result .analysis-note {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: #fbbf24;
    font-size: 12px;
    text-align: center;
}

/* ========================================
   Toast Notifications
   ======================================== */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background: rgba(30, 30, 40, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    color: #fff;
    font-size: 14px;
    pointer-events: auto;
    transform: translateX(120%);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    max-width: 350px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.toast-show {
    transform: translateX(0);
    opacity: 1;
}

.toast-hide {
    transform: translateX(120%);
    opacity: 0;
}

.toast-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    line-height: 1.4;
}

.toast-success {
    border-left: 4px solid #22c55e;
}

.toast-error {
    border-left: 4px solid #ef4444;
}

.toast-warning {
    border-left: 4px solid #f59e0b;
}

.toast-info {
    border-left: 4px solid #3b82f6;
}

/* ========================================
   LP Effects - Text Mode Toggle
   ======================================== */
/* テキストモードトグル */
.text-mode-toggle {
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.text-mode-toggle .toggle-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
}

.toggle-buttons {
    display: flex;
    gap: 6px;
}

.toggle-btn {
    flex: 1;
    padding: 10px 8px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    font-size: 12px;
}

.toggle-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.7);
}

.toggle-btn.active {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.5);
    color: #93c5fd;
}

.toggle-btn small {
    display: block;
    font-size: 9px;
    margin-top: 3px;
    opacity: 0.6;
}

/* LP効果オプション */
.lp-effects-options {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    margin-bottom: 12px;
    overflow: hidden;
}

.lp-effects-options summary {
    padding: 10px 12px;
    cursor: pointer;
    color: #fbbf24;
    font-weight: 500;
    font-size: 13px;
    transition: all 0.2s;
}

.lp-effects-options summary:hover {
    background: rgba(255, 255, 255, 0.03);
}

.lp-effects-options[open] summary {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.lp-effects-content {
    padding: 12px;
}

.lp-effects-content .form-group {
    margin-bottom: 10px;
}

.lp-effects-content label {
    display: block;
    margin-bottom: 4px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 500;
}

.lp-effects-content input[type="text"],
.lp-effects-content select {
    width: 100%;
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    color: #fff;
    font-size: 12px;
}

.lp-effects-content input[type="text"]:focus,
.lp-effects-content select:focus {
    outline: none;
    border-color: rgba(59, 130, 246, 0.5);
}

.lp-effects-content input[type="text"]::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.form-row {
    display: flex;
    gap: 10px;
}

.form-row .form-group.half {
    flex: 1;
}

.lp-effects-content .apply-btn {
    width: 100%;
    padding: 9px;
    background: #444;
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: 5px;
    color: #fbbf24;
    font-weight: 500;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 6px;
}

.lp-effects-content .apply-btn:hover {
    background: #4a4a4a;
    border-color: rgba(251, 191, 36, 0.5);
}

/* Text overlay mode indicator on cells */
.cell-text-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    color: #fff;
    pointer-events: none;
}

.cell-text-embedded .cell-text-overlay {
    display: none;
}

/* ========================================
   使い方ヘルプパネル
======================================== */

.help-panel {
    width: 500px;
    max-width: 95vw;
}

.help-content {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(85vh - 60px);
}

.help-section {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.help-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.help-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    color: #fff;
    margin-bottom: 8px;
}

.help-icon {
    font-size: 20px;
}

.help-description {
    color: #aaa;
    font-size: 13px;
    margin-bottom: 16px;
}

.help-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.help-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    overflow: hidden;
}

.help-item-header {
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.help-btn-preview {
    display: inline-block;
    padding: 6px 12px;
    background: #444;
    color: #fff;
    border-radius: 5px;
    font-size: 13px;
}

.help-btn-preview.small {
    padding: 4px 8px;
    font-size: 12px;
}

.help-item-content {
    padding: 14px;
}

.help-item-content p {
    color: #ccc;
    font-size: 13px;
    margin-bottom: 12px;
    line-height: 1.5;
}

/* ステップ表示 */
.help-steps {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.help-step {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #bbb;
    font-size: 12px;
}

.step-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-radius: 50%;
    font-size: 11px;
    font-weight: bold;
}

/* 機能グリッド */
.help-feature-grid {
    display: flex;
    gap: 10px;
}

.help-feature {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    color: #bbb;
    font-size: 12px;
}

.feature-icon {
    font-size: 16px;
}

/* ヒント表示 */
.help-tip {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(251, 191, 36, 0.1);
    border-radius: 6px;
    border-left: 3px solid #fbbf24;
}

.tip-icon {
    font-size: 14px;
}

.help-tip span:last-child {
    color: #ddd;
    font-size: 12px;
    line-height: 1.4;
}

/* アクションタグ */
.help-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.action-tag {
    padding: 4px 10px;
    background: rgba(102, 126, 234, 0.2);
    color: #a0b0f0;
    border-radius: 4px;
    font-size: 11px;
}

/* フレームワークタグ */
.help-frameworks {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.framework-tag {
    padding: 4px 10px;
    background: rgba(40, 167, 69, 0.2);
    color: #7cd992;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

/* コンパクト表示 */
.help-items.compact {
    gap: 8px;
}

.help-item-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
}

.help-item-desc {
    color: #aaa;
    font-size: 12px;
}

/* ミニマップ凡例 */
.minimap-legend {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #bbb;
    font-size: 13px;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

.legend-color.blue {
    background: #007bff;
    box-shadow: 0 0 8px rgba(0, 123, 255, 0.5);
}

.legend-color.green {
    background: #28a745;
}

.legend-color.gray {
    background: #444;
}

/* ショートカットグリッド */
.shortcut-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.shortcut-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
}

.shortcut-item kbd {
    display: inline-block;
    padding: 4px 8px;
    background: #333;
    border: 1px solid #555;
    border-radius: 4px;
    color: #fff;
    font-family: monospace;
    font-size: 12px;
    box-shadow: 0 2px 0 #222;
}

.shortcut-item span {
    color: #aaa;
    font-size: 12px;
}

/* ヘルプボタンのハイライト */
.ctrl-btn.help-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.ctrl-btn.help-btn:hover {
    background: linear-gradient(135deg, #5a72d0 0%, #6a4294 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* クイックスタートフロー */
.help-quickstart {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-radius: 12px;
    padding: 16px !important;
    margin-bottom: 20px !important;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.quickstart-flow {
    display: flex;
    align-items: stretch;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.flow-step {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: rgba(0, 0, 0, 0.2);
    padding: 12px;
    border-radius: 8px;
    flex: 1;
    min-width: 100px;
}

.flow-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
    flex-shrink: 0;
}

.flow-content strong {
    display: block;
    color: #fff;
    font-size: 12px;
    margin-bottom: 4px;
}

.flow-content p {
    color: #aaa;
    font-size: 11px;
    margin: 0;
    line-height: 1.3;
}

.flow-arrow {
    display: flex;
    align-items: center;
    color: #667eea;
    font-size: 18px;
    font-weight: bold;
}

/* LP設計セクションのハイライト */
.help-highlight {
    background: rgba(40, 167, 69, 0.05);
    border: 1px solid rgba(40, 167, 69, 0.2);
    border-radius: 12px;
    padding: 16px !important;
}

.help-highlight .help-section-title {
    color: #7cd992;
}

/* ワークフローセクション */
.help-workflow {
    margin-top: 16px;
}

.workflow-title {
    color: #fff;
    font-size: 14px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.workflow-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.workflow-step {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 14px;
    border-left: 3px solid #667eea;
}

.workflow-step-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.workflow-num {
    padding: 3px 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
}

.workflow-label {
    color: #fff;
    font-size: 14px;
    font-weight: 500;
}

.workflow-step p {
    color: #bbb;
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 10px;
}

.workflow-step p:last-child {
    margin-bottom: 0;
}

/* フレームワーク選択タグ */
.workflow-frameworks {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.fw-tag {
    padding: 5px 10px;
    background: rgba(255, 255, 255, 0.08);
    color: #bbb;
    border-radius: 5px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.fw-tag.pasona {
    background: rgba(40, 167, 69, 0.2);
    color: #7cd992;
    border: 1px solid rgba(40, 167, 69, 0.3);
}

.fw-tag small {
    font-size: 10px;
    opacity: 0.7;
}

/* チャットプレビュー */
.chat-preview {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 10px;
    margin: 10px 0;
}

.chat-example {
    padding: 6px 10px;
    margin-bottom: 6px;
    border-radius: 6px;
    font-size: 12px;
}

.chat-example:last-child {
    margin-bottom: 0;
}

.chat-example.ai {
    background: rgba(102, 126, 234, 0.2);
    color: #a0b0f0;
}

.chat-example.user {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    margin-left: 20px;
}

/* コンパクトなヒント */
.help-tip.compact {
    padding: 8px 10px;
}

.help-tip.compact span:last-child {
    font-size: 11px;
}

/* ハイライトヒント */
.help-tip.highlight {
    background: rgba(40, 167, 69, 0.15);
    border-left-color: #28a745;
}

/* 結果プレビュー */
.result-example {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 10px;
    margin-top: 10px;
}

.result-row-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    color: #bbb;
    font-size: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.result-row-preview:last-child {
    border-bottom: none;
}

.row-badge {
    padding: 2px 6px;
    background: #444;
    color: #fff;
    border-radius: 3px;
    font-size: 10px;
    font-weight: bold;
}

/* FAQ */
.faq-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.faq-item {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    overflow: hidden;
}

.faq-item summary {
    padding: 12px 14px;
    cursor: pointer;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: '+';
    color: #667eea;
    font-size: 18px;
    font-weight: bold;
}

.faq-item[open] summary::after {
    content: '−';
}

.faq-item[open] summary {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.faq-answer {
    padding: 14px;
    background: rgba(0, 0, 0, 0.2);
}

.faq-answer p {
    color: #ccc;
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 10px;
}

.faq-answer p:last-child {
    margin-bottom: 0;
}

.faq-answer ul {
    margin: 8px 0;
    padding-left: 20px;
}

.faq-answer li {
    color: #bbb;
    font-size: 12px;
    line-height: 1.6;
    margin-bottom: 4px;
}

.faq-answer strong {
    color: #fff;
}

/* レスポンシブ対応 */
@media (max-width: 600px) {
    .help-panel {
        width: 100%;
    }

    .help-feature-grid {
        flex-direction: column;
    }

    .shortcut-grid {
        flex-direction: column;
    }

    .quickstart-flow {
        flex-direction: column;
    }

    .flow-arrow {
        transform: rotate(90deg);
        align-self: center;
    }

    .flow-step {
        min-width: auto;
    }
}

/* Screen-reader only (SEO accessible headings) */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}