/* index.css - Premium Neon Dark Theme */

:root {
    --bg-color: #060913;
    --card-bg: rgba(13, 20, 38, 0.45);
    --card-border: rgba(255, 255, 255, 0.07);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    
    /* Neon Palette (HSL) */
    --primary-hue: 260; /* Purple/Indigo */
    --accent-hue: 320;  /* Pink/Magenta */
    
    --primary: hsl(var(--primary-hue), 85%, 60%);
    --primary-glow: hsla(var(--primary-hue), 85%, 60%, 0.35);
    --accent: hsl(var(--accent-hue), 90%, 55%);
    --accent-glow: hsla(var(--accent-hue), 90%, 55%, 0.3);
    
    --success: #10b981;
    --error: #ef4444;
}

html {
    scroll-behavior: smooth;
}

main, section {
    scroll-margin-top: 80px;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

/* 背景のグラデーション光球 */
.glass-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.glass-bg::before, .glass-bg::after {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(140px);
    opacity: 0.15;
}

.glass-bg::before {
    background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
    top: -10%;
    right: -10%;
    animation: float-slow 20s infinite alternate;
}

.glass-bg::after {
    background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
    bottom: -10%;
    left: -10%;
    animation: float-slow 25s infinite alternate-reverse;
}

@keyframes float-slow {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, 30px) scale(1.1); }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* メインナビゲーションヘッダー */
.main-header {
    position: sticky;
    top: 0;
    width: 100%;
    background: rgba(6, 9, 19, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    z-index: 1000;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.15);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-logo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'Outfit', sans-serif;
    text-decoration: none;
    transition: transform 0.2s ease;
}

.site-logo:hover {
    transform: scale(1.02);
}

.logo-main {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    color: var(--text-primary);
    text-transform: uppercase;
}

.logo-sub {
    font-size: 0.85rem;
    font-weight: 400;
    letter-spacing: 0.05em;
    color: var(--accent);
    text-shadow: 0 0 8px var(--accent-glow);
}

/* APIステータスバッジ */
.header-actions {
    display: flex;
    align-items: center;
}

.api-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(16, 185, 129, 0.06);
    border: 1px solid rgba(16, 185, 129, 0.15);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #10b981;
}

.status-dot {
    width: 6px;
    height: 6px;
    background-color: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 8px #10b981;
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
/* カプセル型タブ切り替え (Segmented Control) */
.tabs-container {
    display: flex;
    background: rgba(13, 20, 38, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 40px;
    padding: 4px;
    width: 100%;
    max-width: 650px;
    margin: 0 auto 30px auto;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.3), 0 4px 20px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.tab-button {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-family: 'Inter', 'Kosugi Maru', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 10px 16px;
    border-radius: 35px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    user-select: none;
}

.tab-button:hover {
    color: var(--text-primary);
}

.tab-button.active {
    color: #ffffff;
    background: linear-gradient(90deg, #3b82f6 0%, #8b5cf6 50%, #ec4899 100%);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.tab-icon {
    font-size: 1.05rem;
}

/* カード共通スタイル (グラスモーフィズム) */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 30px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    margin-bottom: 30px;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

/* 入力フォーム */
.input-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-group input[type="text"] {
    width: 100%;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(10, 15, 30, 0.5);
    color: #fff;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 12px var(--primary-glow);
}

.url-input-container {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    width: 100%;
}

@media (max-width: 600px) {
    .url-input-container {
        flex-direction: column;
        align-items: stretch;
    }
}

.form-group-row {
    display: flex;
    align-items: flex-end;
    gap: 20px;
    flex-wrap: wrap;
}

/* レンジスライダーのカスタムスタイル */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
    margin: 15px 0;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: 0 0 10px var(--primary-glow);
    transition: transform 0.1s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* ボタン */
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: white;
    border: none;
    padding: 16px 32px;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 54px;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--accent-glow);
}

.btn-primary:active {
    transform: translateY(0);
}

/* ローディング */
.loading-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 15px;
    padding: 50px 30px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.progress-spinner {
    border-top-color: var(--accent);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loader-inline {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* グリッドレイアウト */
.section-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.8rem;
    margin-bottom: 25px;
    background: linear-gradient(135deg, #fff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
}

/* 提案カードのスタイル */
.suggest-card {
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.suggest-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, var(--primary), var(--accent));
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.badge {
    background: rgba(255, 255, 255, 0.1);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.time-range {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    color: var(--accent);
}

.card-title {
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 12px;
    color: #fff;
}

.card-reason {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 20px;
    flex-grow: 1;
}

.subtitles-box {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 15px;
    max-height: 150px;
    overflow-y: auto; /* autoに変更し、必要な時だけスクロール可能にする */
    -webkit-overflow-scrolling: touch; /* iOSでの慣性スクロール対応 */
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.subtitles-box::-webkit-scrollbar {
    width: 6px;
}

.subtitles-box::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.01);
    border-radius: 4px;
}

.subtitles-box::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.4); /* 目立つように不透明度をアップ */
    border-radius: 4px;
}

.subtitles-box::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.6);
}

.subtitle-item {
    font-size: 0.8rem;
    border-left: 2px solid rgba(255, 255, 255, 0.15);
    padding-left: 8px;
}

.sub-time {
    color: var(--text-secondary);
    font-size: 0.75rem;
    margin-bottom: 2px;
}

.sub-text {
    color: var(--text-primary);
}

.sub-translated {
    color: #cbd5e1;
    font-style: italic;
    margin-top: 2px;
}

/* カードボタン */
.btn-card {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #fff;
    padding: 12px 20px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-card:hover {
    background: linear-gradient(135deg, rgba(var(--primary-hue), 0.2), rgba(var(--accent-hue), 0.2));
    border-color: var(--primary);
    transform: scale(1.02);
}

.btn-card:active {
    transform: scale(1.0);
}

/* フッター */
footer {
    text-align: center;
    margin-top: auto;
    padding-top: 40px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* 編集エディタモーダルのスタイル - 画面を贅沢に広く使うフルスクリーン仕様 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(4, 6, 12, 0.85);
    z-index: 1000;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    animation: fade-in 0.25s ease-out;
}

.modal-card {
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    margin: 0;
    border: none;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: scale-up 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    background: #0b0d19;
    padding: 0;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    padding: 15px 25px;
    background: rgba(6, 9, 19, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.modal-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.btn-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.btn-close:hover {
    color: var(--error);
}

.modal-body {
    overflow: hidden; /* 二重スクロールを防ぐため親はスクロール不可にする */
    flex-grow: 1;
    padding: 20px 25px;
    height: calc(100vh - 140px); /* 高さを固定 */
    box-sizing: border-box;
}

.modal-body::-webkit-scrollbar {
    width: 6px;
}
.modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.editor-layout {
    display: grid;
    grid-template-columns: 1.45fr 1fr; /* 左側(プレビューとタイムライン)をさらに広く */
    gap: 25px;
    height: 100%;
    min-height: 0; /* 親コンテナ内での無限の縦伸びを防ぐ */
}

/* 左右エリア */
.editor-section-left, .editor-section-right {
    display: flex;
    flex-direction: column;
    gap: 15px;
    height: 100%;
    min-height: 0; /* これが最重要：中身の高さにかかわらず親に追従させ、スクロールバーを発生させる */
    min-width: 0;
    max-height: 100%;
    overflow-y: auto;
    padding-right: 8px;
    padding-bottom: 50px; /* スクロール底の要素見切れ防止 */
    box-sizing: border-box;
}

.editor-section-left::-webkit-scrollbar,
.editor-section-right::-webkit-scrollbar {
    width: 6px;
}
.editor-section-left::-webkit-scrollbar-thumb,
.editor-section-right::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
}

.editor-section-left h3, .editor-section-right h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    border-left: 3px solid var(--primary);
    padding-left: 8px;
    margin-bottom: 10px;
}

/* クリップタイムラインUI */
#clips-timeline-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: 350px;
    overflow-y: auto;
    padding-right: 8px;
}

#clips-timeline-container::-webkit-scrollbar {
    width: 4px;
}
#clips-timeline-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
}

.clip-row {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 12px;
    display: grid;
    grid-template-columns: 0.8fr 0.8fr 2.5fr auto;
    gap: 12px;
    align-items: center;
    position: relative;
    transition: border-color 0.2s;
}

.clip-row:hover {
    border-color: rgba(var(--primary-hue), 0.3);
}

.clip-input-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.clip-input-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.clip-input-group input[type="text"] {
    width: 100%;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(10, 15, 30, 0.6);
    color: #fff;
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
}

.clip-input-group input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
}

.btn-delete-clip {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    margin-top: 18px;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-delete-clip:hover {
    color: var(--error);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    padding: 12px 24px;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

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

.btn-card-edit {
    border-color: var(--primary);
    background: rgba(var(--primary-hue), 0.05);
}

.btn-card-edit:hover {
    background: linear-gradient(135deg, rgba(var(--primary-hue), 0.2), rgba(var(--primary-hue), 0.4));
}

/* スタイル & BGM */
.form-group-row-equal {
    display: flex;
    gap: 15px;
    min-width: 0;
}

.form-group-row-equal > .form-group {
    min-width: 0;
}

.form-group-row-equal select {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(10, 15, 30, 0.6);
    color: #fff;
    outline: none;
    font-size: 0.9rem;
}

.divider {
    border: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 15px 0;
}

/* ファイルアップロードUI */
.file-upload-label {
    border: 1.5px dashed rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.file-upload-label:hover {
    border-color: var(--primary);
    background-color: rgba(var(--primary-hue), 0.03);
}

.upload-icon {
    font-size: 1.5rem;
}

.file-name-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: center;
    display: block;
    word-break: break-all;
    margin-top: 4px;
}

.modal-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 15px;
    display: flex;
    justify-content: flex-end;
    gap: 15px;
}

/* アニメーション定義 */
@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scale-up {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* レレスポンシブエディタ調整 */
@media (max-width: 900px) {
    .editor-layout {
        grid-template-columns: 1fr;
    }
    .modal-card {
        max-height: 90vh;
    }
    .modal-body {
        max-height: calc(90vh - 150px);
    }
}

.video-preview-container {
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: max-width 0.4s cubic-bezier(0.16, 1, 0.3, 1), aspect-ratio 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    margin: 0 auto;
    max-height: 48vh; /* 高さを48vhに制限して、タイムラインに十分なスペースを確保する！ */
    background: #000;
}

/* アスペクト比プレビュークラス */
.preview-16-9 {
    max-width: 100%;
    aspect-ratio: 16 / 9;
}

.preview-9-16 {
    max-width: 250px;
    aspect-ratio: 9 / 16;
}

.time-setter-row {
    display: flex;
    gap: 4px;
    align-items: center;
    width: 100%;
}

.time-setter-row input {
    flex-grow: 1;
}

.btn-set-time {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: 6px;
    padding: 8px;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s;
    height: 33px;
    width: 33px;
}

.btn-set-time:hover {
    background: rgba(var(--primary-hue), 0.15);
    border-color: var(--primary);
}

.btn-set-time:active {
    transform: scale(0.95);
}

/* テロップ位置プレビューユーティリティ */
#editor-text-overlay {
    position: absolute;
    pointer-events: auto !important; /* ドラッグとクリック操作を有効化 */
    cursor: move;
    user-select: none;
    padding: 6px 14px;
    border-radius: 8px;
    font-weight: bold;
    z-index: 100;
    transition: outline 0.15s, background-color 0.2s;
    box-sizing: border-box;
    max-width: 85%; /* バックエンドのwrap_text_by_widthの85%幅制限と同期 */
    /* 水平方向の中央揃えの基準位置 */
    left: 50%;
    transform: translateX(-50%);
}

#editor-text-overlay:hover {
    outline: 2.5px dashed var(--primary);
    outline-offset: 4px;
}

#editor-text-overlay.dragging {
    outline: 2.5px solid var(--accent);
    outline-offset: 4px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    transition: none; /* ドラッグ中の遅延をなくす */
}

/* 背景スタイルプレビュー */
.bg-none {
    background: transparent !important;
}

.bg-black_semi {
    background: rgba(0, 0, 0, 0.6) !important;
}

.bg-white_semi {
    background: rgba(255, 255, 255, 0.7) !important;
    color: #000 !important;
    text-shadow: none !important;
}

.bg-primary_semi {
    background: rgba(139, 92, 246, 0.6) !important;
}

.overlay-top {
    bottom: auto;
    top: 10%;
    transform: translateX(-50%);
}

.overlay-center {
    bottom: auto;
    top: 50%;
    transform: translate(-50%, -50%);
}

.overlay-bottom {
    bottom: 15%;
    top: auto;
    transform: translateX(-50%);
}

/* ==========================================================================
   ビジュアルタイムライン (マルチトラックエディタ)
   ========================================================================== */
.timeline-visual-editor {
    width: 100%;
}

.timeline-tracks-outer {
    position: relative;
    user-select: none;
}

/* タイムライン自体の横スクロール用のインナースペース拡張 */
.timeline-scroll-inner {
    width: 250% !important; /* 画面外の右側にもスクロールできるよう横幅を拡張 */
    min-width: 1000px;
    position: relative;
}

.timeline-ruler, .timeline-tracks-container {
    width: 100% !important; /* スクロールインナーに100%幅でフィットさせる */
    position: relative;
}

/* タイムラインルーラーの目盛りスタイル */
.timeline-tick {
    position: absolute;
    bottom: 0;
    width: 1px;
    height: 6px;
    background: rgba(255, 255, 255, 0.15);
}

.timeline-tick.major {
    height: 12px;
    background: rgba(255, 255, 255, 0.35);
}

.timeline-tick-label {
    position: absolute;
    top: 2px;
    font-size: 0.65rem;
    font-family: monospace;
    color: rgba(255, 255, 255, 0.4);
    transform: translateX(-50%);
}

/* クリップブロックと字幕ブロックのスタイル */
.timeline-block {
    position: absolute;
    top: 4px;
    height: calc(100% - 8px);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    box-sizing: border-box;
    font-weight: 500;
    transition: border-color 0.2s, box-shadow 0.2s;
}

/* 🎬 映像ブロック */
.timeline-block.video-block {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.35) 0%, rgba(139, 92, 246, 0.25) 100%);
    border: 1px solid rgba(139, 92, 246, 0.5);
    color: #c084fc;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.timeline-block.video-block:hover {
    border-color: #c084fc;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.5) 0%, rgba(139, 92, 246, 0.35) 100%);
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.4);
    filter: brightness(1.15);
}

.timeline-block.video-block.selected {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.6) 0%, rgba(139, 92, 246, 0.45) 100%);
    border: 2px solid #e9d5ff;
    box-shadow: 0 0 18px rgba(168, 85, 247, 0.7);
    color: #fff;
}

/* 📝 字幕ブロック */
.timeline-block.subtitle-block {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.3) 0%, rgba(16, 185, 129, 0.2) 100%);
    border: 1px solid rgba(16, 185, 129, 0.5);
    color: #34d399;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.timeline-block.subtitle-block:hover {
    border-color: #34d399;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.45) 0%, rgba(16, 185, 129, 0.3) 100%);
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.4);
    filter: brightness(1.15);
}

.timeline-block.subtitle-block.selected {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.55) 0%, rgba(16, 185, 129, 0.4) 100%);
    border: 2px solid #a7f3d0;
    box-shadow: 0 0 18px rgba(16, 185, 129, 0.7);
    color: #fff;
}

/* 🎵 音声(BGM)ブロック */
.audio-block {
    position: absolute;
    top: 2px;
    height: calc(100% - 4px);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.25) 0%, rgba(59, 130, 246, 0.15) 100%);
    border: 1px solid rgba(59, 130, 246, 0.4);
    border-radius: 4px;
    color: #60a5fa;
    display: flex;
    align-items: center;
    padding-left: 8px;
    font-size: 0.65rem;
    width: calc(100% - 10px);
    left: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* レスポンシブ調整 */
@media (max-width: 768px) {
    #main-title {
        font-size: 2.2rem;
    }
    
    .form-group-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .btn-primary {
        width: 100%;
    }
    
    .config-grid {
        grid-template-columns: 1fr !important;
    }
}

.config-params-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .config-params-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

/* --- 分析前設定パネル (AlphaCut風) --- */
.config-section {
    margin-top: 25px;
    border-color: rgba(var(--primary-hue), 0.15);
}

.config-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
    gap: 25px;
    width: 100%;
}

.config-video-card, .config-settings-card {
    min-width: 0;
    overflow: hidden; /* 子要素はみ出しによる列拡張を完全封鎖 */
    max-width: 100%;
}

.config-subtitle {
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 12px;
    border-left: 3px solid var(--primary);
    padding-left: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 動画情報カード */
.video-info-box {
    display: flex;
    gap: 15px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 12px;
    align-items: center;
    min-width: 0; /* 子要素のnowrapテキストによる引き伸ばしを防止 */
}

.video-thumb-img {
    width: 110px;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.video-info-text {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow: hidden;
    width: 0; /* flex子要素がnowrapテキストで親を膨張させるのを防ぐ */
}

.video-title-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.video-duration-badge {
    align-self: flex-start;
    font-size: 0.75rem;
    background: rgba(var(--primary-hue), 0.15);
    border: 1px solid rgba(var(--primary-hue), 0.3);
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: monospace;
    font-weight: bold;
}

/* テンプレートカルーセル */
.template-selector-carousel {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: auto;
}

.template-selector-carousel::-webkit-scrollbar {
    height: 4px;
}

.template-selector-carousel::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.template-card-preview {
    transition: transform 0.2s, border-color 0.2s, background-color 0.2s;
}

.template-card:hover .template-card-preview {
    transform: translateY(-2px);
    border-color: rgba(var(--primary-hue), 0.5);
    background-color: rgba(var(--primary-hue), 0.1) !important;
}

.template-card.selected .template-card-preview {
    border-color: var(--primary) !important;
    background-color: rgba(var(--primary-hue), 0.15) !important;
    box-shadow: 0 0 10px rgba(var(--primary-hue), 0.3);
}

.dual-range {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 5px;           /* トラックの線と高さを一致させる */
    position: absolute;
    top: 8px;              /* トラックの線と上端位置を一致させる */
    background: transparent;
    pointer-events: none;
    outline: none;
    margin: 0;
}

/* Safari / Chrome 用のトラック定義を明示化し垂直位置を固定 */
.dual-range::-webkit-slider-runnable-track {
    -webkit-appearance: none;
    height: 5px;
    background: transparent;
    border: none;
}

.dual-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--primary);
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 1px 4px rgba(0,0,0,0.5);
    margin-top: -5.5px;    /* (5px - 16px) / 2 = -5.5px で完璧に中央揃え */
    transition: transform 0.1s;
}

.dual-range::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Firefox 用のトラック定義と中央揃え */
.dual-range::-moz-range-track {
    height: 5px;
    background: transparent;
    border: none;
}

.dual-range::-moz-range-thumb {
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--primary);
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 1px 4px rgba(0,0,0,0.5);
    transition: transform 0.1s;
}

.dual-range::-moz-range-thumb:hover {
    transform: scale(1.2);
}

/* --- Canva風タイムライン・伸縮＆ドラッグ操作UI --- */

.playhead-handle {
    cursor: ew-resize !important;
    pointer-events: auto !important; /* 親が pointer-events: none でもツマミ部分だけはマウスを拾う */
}

.timeline-block {
    position: absolute;
    overflow: visible !important; /* 左右のトリミングハンドルがはみ出しても表示されるようにする */
    cursor: grab;
    user-select: none;
}

.timeline-block:active {
    cursor: grabbing;
}

/* 左右トリミング用ハンドル */
.resize-handle-left,
.resize-handle-right {
    position: absolute;
    top: 0;
    width: 6px;
    height: 100%;
    cursor: ew-resize;
    z-index: 20;
    transition: background-color 0.15s;
    background-color: rgba(255, 255, 255, 0.0);
}

.resize-handle-left {
    left: 0;
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
}

.resize-handle-right {
    right: 0;
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
}

/* ホバー時に白く光らせて掴み位置をアピール */
.resize-handle-left:hover,
.resize-handle-right:hover {
    background-color: rgba(255, 255, 255, 0.4) !important;
}

/* ドラッグ中・リサイズ中・ホバー中のビジュアルフィードバック */
.timeline-block:hover {
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.15);
}

.timeline-block.dragging {
    opacity: 0.8;
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.6) !important; /* ネオン紫 */
}

.timeline-block.resizing {
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.6) !important; /* オレンジに光る */
}

/* --- AI特選・盛り上がりリコメンドUIデザイン --- */

/* 👑本命一押しプレミアムカード */
.best-recommend-card {
    border: 1px solid rgba(255, 215, 0, 0.2) !important;
    background: rgba(255, 255, 255, 0.03) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25), inset 0 0 10px rgba(255, 215, 0, 0.01) !important;
    transition: border-color 0.25s ease, box-shadow 0.25s ease !important;
}

.best-recommend-card:hover {
    border-color: rgba(255, 215, 0, 0.5) !important;
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.08), 0 4px 15px rgba(0, 0, 0, 0.25) !important;
}

/* 🔥準一押しカード */
.runner-recommend-card {
    border: 1px solid rgba(249, 115, 22, 0.2) !important;
    background: rgba(255, 255, 255, 0.03) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2) !important;
    transition: border-color 0.25s ease, box-shadow 0.25s ease !important;
}

.runner-recommend-card:hover {
    border-color: rgba(249, 115, 22, 0.5) !important;
    box-shadow: 0 6px 20px rgba(249, 115, 22, 0.08), 0 4px 15px rgba(0, 0, 0, 0.2) !important;
}

/* 🎬まとめ動画プレミアムカード */
.premium-digest-card {
    transition: border-color 0.25s ease, box-shadow 0.25s ease !important;
}

.premium-digest-card:hover {
    border-color: rgba(139, 92, 246, 0.6) !important;
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.1), 0 4px 15px rgba(0, 0, 0, 0.25) !important;
}

/* 推薦ゴールドバッジ (本命一押し) */
.badge-viral-best {
    background: linear-gradient(135deg, #ffd700 0%, #ff8c00 100%) !important;
    color: #0c0a09 !important;
    font-weight: 800 !important;
    padding: 4px 10px !important;
    border-radius: 6px !important;
    font-size: 0.75rem !important;
    box-shadow: 0 2px 6px rgba(255, 215, 0, 0.4) !important;
    display: inline-flex !important;
    align-items: center;
    gap: 4px;
    text-shadow: none !important;
    letter-spacing: 0.5px;
}

/* 推薦シルバー/オレンジバッジ (準一押し) */
.badge-viral-runner {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%) !important;
    color: #fff !important;
    font-weight: 700 !important;
    padding: 4px 8px !important;
    border-radius: 6px !important;
    font-size: 0.72rem !important;
    box-shadow: 0 2px 5px rgba(249, 115, 22, 0.3) !important;
    display: inline-flex !important;
    align-items: center;
    gap: 3px;
}

/* 見どころタグ（バッジ）共通 */
.tag-badge {
    padding: 3px 8px !important;
    border-radius: 4px !important;
    font-size: 0.7rem !important;
    font-weight: 700 !important;
    color: #fff !important;
    display: inline-flex !important;
    align-items: center;
    gap: 3px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2) !important;
}

/* 🤣 爆笑 */
.tag-badge-laugh {
    background-color: #ec4899 !important;
}

/* 🗣️ 核心 */
.tag-badge-core {
    background-color: #3b82f6 !important;
}

/* 😲 衝撃 */
.tag-badge-shock {
    background-color: #f97316 !important;
}

/* ⚡ 感情 */
.tag-badge-emotion {
    background-color: #8b5cf6 !important;
}

/* 💡 豆知識 */
.tag-badge-info {
    background-color: #10b981 !important;
}

/* 📊 盛り上がり度ゲージ */
.viral-score-container {
    width: 100%;
    height: 4px;
    background-color: rgba(255, 255, 255, 0.08) !important;
    border-radius: 2px !important;
    overflow: hidden;
    margin-top: 10px;
}

.viral-score-bar {
    height: 100% !important;
    background: linear-gradient(90deg, #ec4899 0%, #8b5cf6 100%) !important;
    border-radius: 2px !important;
    transition: width 0.5s ease-out;
}

/* 一押し用のゲージ色 */
.best-recommend-card .viral-score-bar {
    background: linear-gradient(90deg, #ffd700 0%, #ff8c00 100%) !important;
}

/* --- 📐 アスペクト比レイアウト設定UIデザイン --- */

.layout-grid-container {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 10px;
    width: 100%;
    box-sizing: border-box;
    max-width: 100%;
}

.layout-card {
    border: 1.5px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 12px 8px;
    text-align: center;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.02);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.layout-card:hover {
    border-color: rgba(139, 92, 246, 0.4);
    background: rgba(255, 255, 255, 0.04);
}

.layout-card.active {
    border-color: var(--primary) !important;
    background: rgba(139, 92, 246, 0.08) !important;
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.25);
}

.layout-preview-box {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 8px;
}

/* スマホ外枠フレーム */
.phone-frame {
    width: 34px;
    height: 58px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 6px;
    position: relative;
    background: #09090b;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s;
}

.layout-card.active .phone-frame {
    border-color: var(--primary);
}

/* 各アスペクト比ビデオ部分 */
.video-placeholder {
    background: #ffffff;
    color: #0c0a09;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 7px;
    font-weight: bold;
    border-radius: 1px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.ratio-16-9 {
    width: 100%;
    height: 17px;
}

.ratio-4-3 {
    width: 100%;
    height: 22.5px;
}

.ratio-1-1 {
    width: 100%;
    height: 30px;
}

.ratio-4-5 {
    width: 100%;
    height: 37.5px;
}

.ratio-3-4 {
    width: 100%;
    height: 40px;
}

.ratio-9-16 {
    width: 100%;
    height: 100%;
    border-radius: 0;
}

.layout-label {
    font-size: 0.75rem;
    font-weight: bold;
    color: var(--text-secondary);
}

.layout-card.active .layout-label {
    color: #fff;
}

/* --- ビデオプレイヤーのリアルタイム変形プレビュー用アスペクト比 --- */

/* プレイヤーのアスペクト比を親コンテナ側で制御 */
/* プレイヤーのアスペクト比を親コンテナ側で制御 */
/* --- デバイスモックアップの外枠ラッパー --- */
.device-mockup-wrapper {
    position: relative;
    margin: 0 auto 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    background: #111115;
    border: 3px solid #2d2d30;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8),
                inset 0 0 15px rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
}

/* ハードウェア装飾パーツのデフォルト表示制御（通常非表示） */
.mockup-speaker,
.mockup-camera,
.mockup-home-button,
.mockup-dynamic-island,
.mockup-button-silent,
.mockup-button-volup,
.mockup-button-voldown,
.mockup-button-power,
.mockup-button-camera {
    display: none;
    position: absolute;
    box-sizing: border-box;
    z-index: 22;
}

/* --- iPhone SE スタイル --- */
.device-mockup-wrapper[data-device="iphone-se"] {
    width: 296px; /* 270 + 左右ベゼル20 + 左右境界線6 */
    height: 596px; /* 480 + 上下ベゼル110 + 上下境界線6 */
    padding: 50px 10px 60px 10px;
    border-radius: 36px;
    background: #1c1c22;
    border: 3px solid #3a3a42;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8), 
                inset 0 0 12px rgba(255, 255, 255, 0.06);
}

.device-mockup-wrapper[data-device="iphone-se"] .mockup-speaker {
    display: block;
    top: 22px;
    left: 50%;
    transform: translateX(-50%);
    width: 45px;
    height: 4px;
    background: #2a2a2e;
    border-radius: 2px;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.6);
}

.device-mockup-wrapper[data-device="iphone-se"] .mockup-camera {
    display: block;
    top: 20px;
    left: 36%;
    width: 8px;
    height: 8px;
    background: #0f1224;
    border: 1px solid #2d2d30;
    border-radius: 50%;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.8);
}

.device-mockup-wrapper[data-device="iphone-se"] .mockup-home-button {
    display: block;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    background: #0c0c0e;
    border: 1.5px solid rgba(255, 255, 255, 0.12);
    border-radius: 50%;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.8);
}

.device-mockup-wrapper[data-device="iphone-se"] .mockup-button-silent {
    display: block;
    left: -5px;
    top: 75px;
    width: 3px;
    height: 16px;
    background: #4b5563;
    border-radius: 2px 0 0 2px;
    box-shadow: -1px 1px 2px rgba(0,0,0,0.5);
}

.device-mockup-wrapper[data-device="iphone-se"] .mockup-button-volup {
    display: block;
    left: -5px;
    top: 110px;
    width: 3px;
    height: 10px;
    background: #4b5563;
    border-radius: 2px 0 0 2px;
    box-shadow: -1px 1px 2px rgba(0,0,0,0.5);
}

.device-mockup-wrapper[data-device="iphone-se"] .mockup-button-voldown {
    display: block;
    left: -5px;
    top: 135px;
    width: 3px;
    height: 10px;
    background: #4b5563;
    border-radius: 2px 0 0 2px;
    box-shadow: -1px 1px 2px rgba(0,0,0,0.5);
}

.device-mockup-wrapper[data-device="iphone-se"] .mockup-button-power {
    display: block;
    right: -5px;
    top: 105px;
    width: 3px;
    height: 26px;
    background: #4b5563;
    border-radius: 0 2px 2px 0;
    box-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.device-mockup-wrapper[data-device="iphone-se"] .editor-video-wrapper {
    border-radius: 4px; /* iPhone SE らしいほぼ直角な画面 */
    border: 1px solid rgba(255,255,255,0.03);
}

/* --- iPhone 16 スタイル --- */
.device-mockup-wrapper[data-device="iphone-16"] {
    width: 248px; /* 222 + 左右ベゼル20 + 左右境界線6 */
    height: 506px; /* 480 + 上下ベゼル20 + 上下境界線6 */
    padding: 10px;
    background: linear-gradient(135deg, #1f1f23 0%, #0d0d11 100%);
    border: 3px solid #52525b;
    border-radius: 46px;
    box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.9), 
                inset 0 0 12px rgba(255, 255, 255, 0.1),
                0 0 0 1px rgba(255,255,255,0.03);
}

.device-mockup-wrapper[data-device="iphone-16"] .mockup-dynamic-island {
    display: block;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    width: 58px;
    height: 16px;
    background: #000;
    border-radius: 8px;
    z-index: 23; /* スクリーンの上に重ねる */
    box-shadow: 0 1px 2px rgba(0,0,0,0.5);
    border: 0.5px solid rgba(255, 255, 255, 0.05);
}

/* Dynamic Island の内部レンズ・センサーの表現 */
.device-mockup-wrapper[data-device="iphone-16"] .mockup-dynamic-island::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: radial-gradient(circle, #0e2a2a 0%, #03101b 100%);
    opacity: 0.8;
}

.device-mockup-wrapper[data-device="iphone-16"] .mockup-dynamic-island::before {
    content: '';
    position: absolute;
    left: 14px;
    top: 6px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #111;
}

.device-mockup-wrapper[data-device="iphone-16"] .mockup-button-silent {
    display: block;
    left: -5px;
    top: 75px;
    width: 3px;
    height: 14px;
    background: #52525b;
    border-radius: 2px 0 0 2px;
    box-shadow: -1px 1px 2px rgba(0,0,0,0.5);
}

.device-mockup-wrapper[data-device="iphone-16"] .mockup-button-volup {
    display: block;
    left: -5px;
    top: 105px;
    width: 3px;
    height: 26px;
    background: #52525b;
    border-radius: 2px 0 0 2px;
    box-shadow: -1px 1px 2px rgba(0,0,0,0.5);
}

.device-mockup-wrapper[data-device="iphone-16"] .mockup-button-voldown {
    display: block;
    left: -5px;
    top: 140px;
    width: 3px;
    height: 26px;
    background: #52525b;
    border-radius: 2px 0 0 2px;
    box-shadow: -1px 1px 2px rgba(0,0,0,0.5);
}

.device-mockup-wrapper[data-device="iphone-16"] .mockup-button-power {
    display: block;
    right: -5px;
    top: 110px;
    width: 3px;
    height: 38px;
    background: #52525b;
    border-radius: 0 2px 2px 0;
    box-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

/* カメラコントロールボタン（うっすら凹んだ表現） */
.device-mockup-wrapper[data-device="iphone-16"] .mockup-button-camera {
    display: block;
    right: -4px;
    top: 220px;
    width: 2.5px;
    height: 30px;
    background: #27272a;
    border-radius: 1px 0px 0px 1px;
    border: 0.5px solid #52525b;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.8);
}

.device-mockup-wrapper[data-device="iphone-16"] .editor-video-wrapper {
    border-radius: 34px; /* 非常に丸い角 */
    border: 1px solid rgba(255,255,255,0.03);
}

/* --- iPad / Tablet スタイル --- */
.device-mockup-wrapper[data-device="ipad"] {
    width: 406px; /* 360 + 左右ベゼル40 + 左右境界線6 */
    height: 526px; /* 480 + 上下ベゼル40 + 上下境界線6 */
    padding: 20px;
    border-radius: 28px;
    background: #18181c;
    border: 3px solid #3a3a42;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
}

.device-mockup-wrapper[data-device="ipad"] .mockup-camera {
    display: block;
    top: 7px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    background: #0f1224;
    border-radius: 50%;
}

.device-mockup-wrapper[data-device="ipad"] .mockup-button-volup {
    display: block;
    right: -5px;
    top: 60px;
    width: 3px;
    height: 18px;
    background: #4b5563;
    border-radius: 0 2px 2px 0;
}

.device-mockup-wrapper[data-device="ipad"] .mockup-button-voldown {
    display: block;
    right: -5px;
    top: 85px;
    width: 3px;
    height: 18px;
    background: #4b5563;
    border-radius: 0 2px 2px 0;
}

.device-mockup-wrapper[data-device="ipad"] .mockup-button-power {
    display: block;
    top: -5px;
    right: 40px;
    width: 22px;
    height: 3px;
    background: #4b5563;
    border-radius: 2px 2px 0 0;
}

.device-mockup-wrapper[data-device="ipad"] .editor-video-wrapper {
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.03);
}

.editor-video-wrapper {
    position: relative;
    width: 270px; /* 幅を 270px で絶対固定 */
    height: 480px; /* 高さを 480px で絶対固定 (9:16 比率) */
    background: #000;
    overflow: hidden;
    flex-shrink: 0; /* フレックスコンテナによる圧縮を完全に防ぐ */
    transition: border-radius 0.3s ease;
}

/* 各比率でラッパー自体のサイズは変えません（常に 9:16 固定） */
.editor-video-wrapper.ratio-16-9 { width: 270px; height: 480px; }
.editor-video-wrapper.ratio-4-3  { width: 270px; height: 480px; }
.editor-video-wrapper.ratio-1-1  { width: 270px; height: 480px; }
.editor-video-wrapper.ratio-4-5  { width: 270px; height: 480px; }
.editor-video-wrapper.ratio-3-4  { width: 270px; height: 480px; }
.editor-video-wrapper.ratio-9-16 { width: 270px; height: 480px; }

#editor-video-player {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #000;
    opacity: 0;
    transition: opacity 0.3s, height 0.3s;
    display: block;
    object-fit: cover; /* 常にアスペクト比枠内で綺麗にトリミング */
}

/* 各アスペクト比におけるプレイヤー（内側の動画）の高さ変更プレビュー。キャンバス全体(9:16)は崩しません */
.editor-video-wrapper.ratio-16-9 #editor-video-player { width: 270px; height: 152px; } 
.editor-video-wrapper.ratio-4-3  #editor-video-player { width: 270px; height: 202.5px; }    
.editor-video-wrapper.ratio-1-1  #editor-video-player { width: 270px; height: 270px; }   
.editor-video-wrapper.ratio-4-5  #editor-video-player { width: 270px; height: 337.5px; }   
.editor-video-wrapper.ratio-3-4  #editor-video-player { width: 270px; height: 360px; }
.editor-video-wrapper.ratio-9-16 #editor-video-player { width: 270px; height: 480px; }

/* 各アスペクト比におけるYouTubeプレイヤーの高さ変更プレビュー */
#youtube-player-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) !important;
    transition: height 0.3s;
}
.editor-video-wrapper.ratio-16-9 #youtube-player-container { width: 270px !important; height: 152px !important; }
.editor-video-wrapper.ratio-4-3  #youtube-player-container { width: 360px !important; height: 203px !important; }
.editor-video-wrapper.ratio-1-1  #youtube-player-container { width: 480px !important; height: 270px !important; }
.editor-video-wrapper.ratio-4-5  #youtube-player-container { width: 600px !important; height: 338px !important; }
.editor-video-wrapper.ratio-3-4  #youtube-player-container { width: 640px !important; height: 360px !important; }
.editor-video-wrapper.ratio-9-16 #youtube-player-container { width: 854px !important; height: 480px !important; }

/* --- プレミアム上部タイトルヘッダー (MoviePyの白枠黒半透明ボックスと同期) --- */
#editor-title-overlay {
    position: absolute;
    top: 30px; /* 9:16縦長キャンバスの最上部付近に配置 */
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    display: none;
    background: rgba(0, 0, 0, 0.4); /* 薄い黒半透明の座布団 */
    border: none; /* 枠線を完全に消去 */
    border-radius: 6px;
    padding: 6px 14px;
    box-sizing: border-box;
    max-width: 85%; /* バックエンドの85%幅制限と同期 */
    width: max-content;
    pointer-events: none;
}

#editor-title-overlay div {
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
    font-family: inherit;
    text-align: center;
    line-height: 1.35;
    white-space: nowrap;
    letter-spacing: 0.05em;
    text-shadow: inherit;
}

/* AIテロップ編集用カスタムスタイル */
.clip-tab-btn {
    background: none;
    border: 1px solid transparent;
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    cursor: pointer;
    font-weight: 500;
    outline: none;
    transition: all 0.2s;
}

.clip-tab-btn:hover {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.05);
}

.clip-tab-btn.active {
    background: rgba(139, 92, 246, 0.15) !important;
    border-color: rgba(139, 92, 246, 0.35) !important;
    color: #c084fc !important;
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.15);
}

#clip-subtitles-table th, 
#clip-subtitles-table td {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: middle;
}

#clip-subtitles-table tr:hover {
    background: rgba(255, 255, 255, 0.01);
}

/* リアルタイム入力エリア */
.sub-edit-input {
    width: 100%;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.25);
    color: #fff;
    font-size: 0.75rem;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
}

.sub-edit-input:focus {
    border-color: rgba(139, 92, 246, 0.5);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.2);
}

/* AI修正ボタン & ドロップダウン */
.ai-refine-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

.btn-ai-refine {
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.25);
    color: #c084fc;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin: 0 auto;
    width: fit-content;
}

.btn-ai-refine:hover {
    background: rgba(139, 92, 246, 0.25);
    border-color: rgba(139, 92, 246, 0.5);
    color: #fff;
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.3);
}

.ai-refine-dropdown {
    display: none;
    position: absolute;
    bottom: 100%;
    right: 50%;
    transform: translateX(50%);
    margin-bottom: 6px;
    background: #0f0c22;
    border: 1px solid rgba(139, 92, 246, 0.35);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
    z-index: 1000;
    min-width: 140px;
    overflow: hidden;
}

.ai-refine-dropdown.show {
    display: block;
    animation: fadeInDropdown 0.15s ease-out;
}

.ai-refine-dropdown button {
    width: 100%;
    background: none;
    border: none;
    color: #e2e8f0;
    padding: 7px 12px;
    text-align: left;
    font-size: 0.7rem;
    cursor: pointer;
    transition: background 0.15s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    box-sizing: border-box;
}

.ai-refine-dropdown button:hover {
    background: rgba(139, 92, 246, 0.2);
    color: #fff;
}

@keyframes fadeInDropdown {
    from { opacity: 0; transform: translate(50%, 4px); }
    to { opacity: 1; transform: translate(50%, 0); }
}

/* 右カラム操作パネル内のすべての入力ラベルのフォントサイズと色を完全に統一 */
.editor-section-right .form-group label,
.editor-section-right label {
    font-size: 0.75rem !important;
    font-weight: 500 !important;
    color: var(--text-secondary) !important;
}

/* SVGアイコン共通スタイル */
.svg-icon {
    display: inline-block;
    vertical-align: middle;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    width: 1.15em;
    height: 1.15em;
    flex-shrink: 0;
    position: relative;
    top: -1px;
}

/* ==========================================================================
   モバイル専用コンパクト化スタイル（PC表示には一切影響を与えません）
   ========================================================================== */
@media (max-width: 768px) {
    /* 1. 全体コンテナとヘッダー */
    .container {
        padding: 12px 10px !important;
    }
    
    .main-header {
        position: sticky;
    }
    
    .header-inner {
        padding: 8px 12px !important;
    }
    
    .site-logo img#logo-icon-img {
        height: 18px !important;
    }
    
    .site-logo img#logo-img {
        height: 14px !important;
    }
    
    .api-status-badge {
        padding: 3px 8px !important;
        font-size: 0.7rem !important;
    }

    /* 2. カード共通スタイルのコンパクト化 */
    .card {
        padding: 16px 12px !important;
        margin-bottom: 12px !important;
        border-radius: 12px !important;
    }
    
    .card-header {
        padding-bottom: 10px !important;
        margin-bottom: 12px !important;
    }
    
    .card-title {
        font-size: 1.05rem !important;
    }

    /* 3. 入力セクション・タブの調整 */
    .tabs-container {
        margin-bottom: 12px !important;
        gap: 6px !important;
    }
    
    .tab-button {
        padding: 8px 12px !important;
        font-size: 0.85rem !important;
        border-radius: 8px !important;
    }
    
    .url-input-container {
        flex-direction: column !important;
        gap: 12px !important;
    }
    
    .url-input-container .form-group {
        width: 100% !important;
    }
    
    .url-input-container button#btn-generate {
        width: 100% !important;
        height: 44px !important;
        border-radius: 8px !important;
        font-size: 0.9rem !important;
    }
    
    /* アップロード緊急回避用アップローダー */
    .upload-cache-section {
        margin-top: 12px !important;
    }
    
    .upload-cache-section h3 {
        font-size: 0.9rem !important;
    }
    
    .upload-cache-section p {
        font-size: 0.75rem !important;
        margin-bottom: 10px !important;
    }

    /* 4. 分析前設定パネル */
    .config-section {
        margin-top: 15px !important;
        padding: 16px 12px !important;
    }
    
    .config-grid {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }
    
    .config-subtitle {
        font-size: 0.85rem !important;
        margin-bottom: 8px !important;
    }
    
    .video-info-box {
        padding: 8px !important;
        gap: 10px !important;
    }
    
    .video-thumb-img {
        width: 80px !important;
    }
    
    .video-title-label {
        font-size: 0.8rem !important;
    }
    
    .layout-grid-container {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 8px !important;
    }
    
    .layout-card {
        padding: 8px 4px !important;
    }
    
    .layout-label {
        font-size: 0.7rem !important;
    }

    /* 5. まとめ動画・リコメンドカードの調整 */
    .cards-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    
    .digest-card, .recommend-card {
        padding: 14px 10px !important;
        border-radius: 10px !important;
    }
    
    .recommend-header {
        margin-bottom: 8px !important;
    }
    
    .recommend-title {
        font-size: 0.9rem !important;
    }

    /* 6. エディタモーダル & プレイヤー・タイムライン */
    .modal-card {
        width: 100vw !important;
        height: 100vh !important;
        max-width: 100vw !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
    }
    
    .modal-header {
        padding: 10px 15px !important;
    }
    
    .modal-header h2 {
        font-size: 0.95rem !important;
    }
    
    .btn-close {
        font-size: 1.5rem !important;
    }
    
    .modal-body {
        padding: 8px !important;
        height: calc(100vh - 50px) !important; /* ヘッダー高さを引いた残り全体 */
    }
    
    .editor-layout {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
        height: 100% !important;
    }
    
    .editor-section-left, .editor-section-right {
        padding-right: 0 !important;
        padding-bottom: 15px !important;
        gap: 10px !important;
    }
    
    /* スマホで縦スクロールしやすくするため、左セクション（プレビュー・タイムライン）のサイズ感調整 */
    .video-preview-container {
        max-height: 30vh !important; /* 縦幅を30vhに抑え、タイムラインのスペースを確保 */
    }
    
    /* デバイスモックアップ */
    .device-mockup-wrapper {
        margin-bottom: 10px !important;
        transform: scale(0.9) !important; /* ちょっと縮小して収まりを良くする */
        transform-origin: center top !important;
    }
    
    /* モバイルでのプレビュー枠サイズ制限 */
    .device-mockup-wrapper[data-device="iphone-16"] {
        width: 200px !important;
        height: 410px !important;
    }
    
    .device-mockup-wrapper[data-device="iphone-se"] {
        width: 240px !important;
        height: 480px !important;
    }
    
    .device-mockup-wrapper[data-device="ipad"] {
        width: 290px !important;
        height: 380px !important;
        padding: 10px !important;
    }
    
    /* タイムライン */
    .timeline-visual-editor {
        margin-top: 8px !important;
        padding: 10px 8px !important;
    }
    
    /* 見出しなど */
    .editor-section-left h3, .editor-section-right h3 {
        font-size: 0.85rem !important;
        margin-bottom: 6px !important;
    }
    
    /* 操作ボタン系 */
    .editor-actions-bar {
        gap: 8px !important;
        margin-top: 10px !important;
    }
    
    .btn-secondary, .btn-primary {
        padding: 8px 12px !important;
        font-size: 0.8rem !important;
    }
    
    /* モーダルフッターのボタン崩れ防止（スマホ対応） */
    .modal-footer {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
        padding-top: 10px !important;
    }
    
    #btn-cancel-edit {
        grid-column: 1 !important;
        width: 100% !important;
        margin: 0 !important;
    }
    
    #btn-save-draft {
        grid-column: 2 !important;
        width: 100% !important;
        margin: 0 !important;
    }
    
    #btn-export-video {
        grid-column: 1 / span 2 !important;
        width: 100% !important;
        margin: 0 !important;
    }
    
    #export-status-message {
        grid-column: 1 / span 2 !important;
        margin-right: 0 !important;
        margin-bottom: 6px !important;
        text-align: center !important;
        width: 100% !important;
    }
    
    .modal-footer button {
        height: 44px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        white-space: nowrap !important;
        font-size: 0.85rem !important;
        border-radius: 8px !important;
        padding: 0 8px !important;
    }
}

/* プレミアムフッター */
.main-footer {
    background: rgba(10, 10, 18, 0.45);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    padding: 50px 20px 40px;
    margin-top: 70px;
    width: 100%;
    box-sizing: border-box;
}

.footer-inner {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 22px;
}

/* ロゴのスタイル */
.footer-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.footer-logo-icon {
    height: 18px;
    width: auto;
    object-fit: contain;
}

.footer-logo-text {
    height: 14px;
    width: auto;
    object-fit: contain;
    filter: brightness(0.9);
}

.footer-logo-sub {
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-left: 2px;
}

/* 紹介文 */
.footer-description {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.82rem;
    margin: 0;
    font-weight: 400;
    letter-spacing: 0.03em;
}

/* 関連サービスとリーガルの行 */
.footer-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    font-size: 0.82rem;
}

.services-row {
    color: rgba(255, 255, 255, 0.55);
}

.row-label {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.4);
}

.row-links {
    display: flex;
    gap: 16px;
}

.footer-row a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: color 0.2s, transform 0.15s;
    font-weight: 400;
}

.footer-row a:hover {
    color: var(--primary);
}

.legal-row {
    margin-top: 5px;
    gap: 24px;
}

.legal-row a {
    color: rgba(255, 255, 255, 0.45);
}

/* コピーライト */
.footer-copyright {
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.75rem;
    margin-top: 10px;
    letter-spacing: 0.02em;
}

@media (max-width: 600px) {
    .main-footer {
        padding: 40px 15px 30px;
        margin-top: 50px;
    }
    
    .footer-inner {
        gap: 18px;
    }
    
    .footer-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .row-links {
        flex-direction: column;
        gap: 10px;
    }
    
    .legal-row {
        gap: 12px;
    }
}



