/* Nano Banana Design - Clean & Professional */
:root {
    --bg-dark: #0E1117;
    --bg-card: #1E2329;
    --text-primary: #FAFAFA;
    --text-secondary: #A0A0A0;
    --accent-blue: #4A90E2;
    --accent-hover: #3A7BC8;
    --border-color: #333;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    width: 100%;
    margin: 0 auto;
    padding: 10px;
}

/* Main Layout: History (~180px) | Input (~310px) | Result (flexible) */
.main-content {
    display: grid;
    grid-template-columns: 180px 310px 1fr;
    gap: 15px;
    min-height: 100vh;
}

/* History Sidebar */
.history-sidebar {
    background-color: var(--bg-card);
    padding: 15px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    overflow-y: auto;
    max-height: 100vh;
}

.history-sidebar h3 {
    font-size: 14px;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.no-history {
    text-align: center;
    color: var(--text-secondary);
    font-size: 12px;
    padding: 20px 0;
}

.history-item {
    position: relative !important;
    position: relative !important;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
}

.history-item:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.history-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 8px;
}

.history-item .view-overlay {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    text-decoration: none;
    opacity: 0;
    transition: all 0.3s;
}

.history-item:hover .view-overlay {
    opacity: 1;
}

.history-item .item-info {
    font-size: 9px;
    color: var(--text-secondary);
    margin-top: 5px;
    text-align: center;
}


/* Sidebar Tabs */
.sidebar-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 15px;
    /* Added spacing */
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    position: sticky;
    /* Make tabs sticky */
    top: -15px;
    /* Offset for sidebar padding */
    background-color: var(--bg-card);
    /* Ensure background is solid when scrolled */
    z-index: 10;
    /* Keep above list items */
    margin-top: -5px;
    /* Adjust for padding */
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    padding: 5px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    color: var(--accent-blue);
    background: rgba(74, 144, 226, 0.1);
}

.tab-btn.icon-only {
    margin-left: auto;
}

/* X Media Styles */
.x-header {
    font-size: 11px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    margin-bottom: 5px;
}

.x-header:hover {
    color: var(--text-primary);
}

#xAccountsInput {
    width: 100%;
    background: var(--bg-dark);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    font-size: 11px;
    padding: 5px;
    border-radius: 4px;
    margin-bottom: 5px;
}

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

.x-row {
    display: flex;
    width: 100%;
    gap: 5px;
}

.big-fetch-btn {
    flex: 1;
    padding: 8px 5px;
    font-size: 11px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: all 0.2s;
    height: 30px;
    white-space: nowrap;
    background: var(--accent-blue);
    color: white;
}

.big-fetch-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.4);
}

.big-fetch-btn i {
    font-size: 12px;
}

#xFolderSelect {
    width: 100%;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 4px;
    border-radius: 4px;
    font-size: 11px;
}

.small-btn {
    padding: 4px 8px;
    font-size: 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    color: white;
}

.small-btn.primary {
    background: var(--accent-blue);
}

.small-btn.danger {
    background: var(--danger);
}

/* X Gallery Grid */
.x-gallery-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    /* 2 columns for sidebar */
    gap: 8px;
}

.x-item {
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    aspect-ratio: 1;
    background: #000;
}

.x-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.x-item:hover img {
    opacity: 1;
}

.x-item.new-item::before {
    content: 'N';
    position: absolute;
    top: 2px;
    left: 2px;
    background: #FFD700;
    color: #000;
    font-size: 9px;
    font-weight: bold;
    padding: 1px 3px;
    border-radius: 2px;
    z-index: 2;
}

.x-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: space-between;
    padding: 2px;
    transform: translateY(100%);
    transition: transform 0.2s;
}

.x-item:hover .x-actions {
    transform: translateY(0);
}

.x-action-btn {
    background: none;
    border: none;
    color: #AAA;
    font-size: 10px;
    cursor: pointer;
    padding: 2px 4px;
}

.x-action-btn:hover {
    color: white;
}

.x-action-btn.trash:hover {
    color: #EF4444;
}

/* History Item (Square + Overlay) */
.history-item {
    position: relative !important;
    position: relative !important;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
    aspect-ratio: 1;
    /* Square */
    background: #000;
}

.history-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background: #000;
}

/* 履歴内のボタン配置 */
.history-item .image-overlay-buttons {
    position: absolute !important;
    top: 5px !important;
    right: 5px !important;
    display: flex !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    z-index: 10 !important;
    background: none !important;
    box-shadow: none !important;
}

.send-ref-btn-history {
    background: rgba(245, 158, 11, 0.95) !important;
    width: 28px !important;
    height: 28px !important;
    font-size: 12px !important;
}

/* 履歴アイテムのコンテナ */
.history-item {
    position: relative !important;
    position: relative !important;
    position: relative !important;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 1 / 1;
    background: var(--bg-dark);
    /* テーマ背景に合わせる */
    border: 1px solid var(--border-color);
}

/* 履歴内の「操作ボタン」群（右上固定） */
.history-item .history-send-ref-btn,
.history-item .history-compare-btn,


/* ボタンの横並び配置（右から順に、履歴は ゴミ箱(71->59) / スライダ(38->32) / DL(new:5) ） */
/* 要望: 左から ゴミ箱 / スライダ / DL。 右端を1番目とすると 1:DL, 2:スライダ, 3:ゴミ箱 */







/* ギャラリー専用：ゴミ箱を右上に */
.history-item .gallery-delete-btn {
    right: 5px !important;
    opacity: 0;
    transition: opacity 0.2s ease !important;
}

.history-item:hover .gallery-delete-btn {
    opacity: 1;
}

/* ホバー時の色彩統一 */
.history-item .history-download-btn:hover,
.history-item .history-compare-btn:hover,
.history-item .history-delete-btn:hover,
.history-item .history-send-ref-btn:hover,
.history-item .gallery-delete-btn:hover {
    background: rgba(50, 50, 50, 0.95) !important;
    transform: scale(1.05);
}

/* Before画像専用の「見る」ボタン */
#beforeViewBtn {
    right: 5px !important;
}

.history-item .history-delete-btn:hover {
    background: rgba(239, 68, 68, 0.9) !important;
    /* 削除は赤 */
}

/* ツールチップ（title属性）が邪魔な場合の対策 */
.history-item img {
    pointer-events: auto;
}

/* Overlay Controls (Standardized) */
.overlay-btn.mini-btn.primary {
    background: var(--accent-blue);
    color: white;
}

.overlay-btn.mini-btn.danger:hover {
    background: var(--danger);
    color: white;
}

/* Ensure X items behave like History items */
.x-gallery-item .image-wrapper {
    height: 100%;
}

.x-gallery-item .item-info {
    position: absolute;
    bottom: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.7);
    color: #4a90e2;
    font-size: 9px;
    padding: 2px;
    text-align: center;
    pointer-events: none;
}

/* History styling update */
.history-item .item-info {
    position: absolute;
    bottom: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.7);
    color: #ccc;
    font-size: 9px;
    padding: 2px;
    text-align: center;
    pointer-events: none;
}

/* Left Panel */
.left-panel {
    background-color: var(--bg-card);
    padding: 15px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    overflow-y: auto;
    max-height: 100vh;
}

.input-group {
    margin-bottom: 8px;
}

.input-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

/* File Upload Area */
.file-upload-area {
    position: relative;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.file-upload-area:hover {
    border-color: var(--accent-blue);
    background-color: rgba(74, 144, 226, 0.05);
}

.upload-placeholder i {
    font-size: 32px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.upload-placeholder p {
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.upload-placeholder small {
    font-size: 12px;
    color: var(--text-secondary);
}

.preview-image {
    width: 100%;
    border-radius: 8px;
}

.remove-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: var(--danger);
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.remove-btn:hover {
    background-color: #DC2626;
    transform: scale(1.1);
}

/* Checkbox Group (for multi-select presets) */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.checkbox-group.preset-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    position: relative;
}

.checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
}

.checkbox-label span {
    padding: 4px 8px;
    background-color: var(--bg-dark);
    border: 2px solid var(--border-color);
    border-radius: 20px;
    font-size: 9px;
    transition: all 0.3s;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.checkbox-label input[type="checkbox"]:checked+span {
    background-color: var(--accent-blue);
    border-color: var(--accent-blue);
    color: white;
}

.checkbox-label:hover span {
    border-color: var(--accent-blue);
    color: white;
}

/* Radio Buttons (Clean Design) */
.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* Preset Grid: 4 columns, 2 rows */
.radio-group.preset-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

/* Single line radio group */
.radio-group.single-line {
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 4px;
    scrollbar-width: none;
    /* Firefox */
}

.radio-group.single-line::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari */
}

.radio-label {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    position: relative;
}

.radio-label input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.radio-label span {
    padding: 8px 16px;
    background-color: var(--bg-dark);
    border: 2px solid var(--border-color);
    border-radius: 20px;
    font-size: 13px;
    transition: all 0.3s;
    color: var(--text-secondary);
    white-space: nowrap;
}

.radio-label.compact span {
    padding: 5px 8px;
    font-size: 10px;
    border-radius: 12px;
}

.radio-label input[type="radio"]:checked+span {
    background-color: var(--accent-blue);
    border-color: var(--accent-blue);
    color: white;
    font-weight: 600;
    box-shadow: 0 0 10px rgba(74, 144, 226, 0.5);
}

.radio-label:hover span {
    border-color: var(--accent-blue);
}

/* Buttons */
.edit-preset-btn,
.translate-btn {
    margin-top: 10px;
    padding: 8px 16px;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s;
}

.edit-preset-btn:hover,
.translate-btn:hover {
    background-color: var(--accent-blue);
    border-color: var(--accent-blue);
    color: white;
}

/* Input Row (Japanese + Translate Button) */
.input-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.input-row textarea {
    flex: 1;
}

.input-row .translate-btn {
    margin-top: 0;
    height: 60px;
    flex-shrink: 0;
}

/* Textareas */
textarea {
    width: 100%;
    padding: 8px;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.4;
    font-family: inherit;
    resize: vertical;
    transition: all 0.3s;
}

textarea:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

textarea[readonly] {
    background-color: var(--bg-card);
    cursor: not-allowed;
}

.preset-editor {
    margin-top: 5px;
    display: block !important;
    min-height: 40px !important;
    font-size: 11px;
    padding: 6px 10px;
}

/* Compact Upload Button */
.upload-btn {
    padding: 4px 10px;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.3s;
}

.upload-btn:hover {
    background-color: var(--accent-blue);
    border-color: var(--accent-blue);
    color: white;
}

/* Drag & Drop Area */
.drop-area {
    width: 100%;
    padding: 8px 12px;
    background-color: var(--bg-card);
    border: 2px dashed var(--border-color);
    border-radius: 4px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.drop-area:hover {
    border-color: var(--accent-blue);
    background-color: rgba(74, 144, 226, 0.1);
}

.drop-area.drag-over {
    border-color: var(--accent-blue);
    background-color: rgba(74, 144, 226, 0.2);
}

.drop-area p {
    margin: 0;
    color: var(--text-primary);
    font-size: 11px;
}

.drop-area i {
    font-size: 16px;
    color: var(--accent-blue);
}

/* QR Code Sync Buttons */
.qr-sync-btn {
    flex: 1;
    padding: 6px 10px;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.3s;
    white-space: nowrap;
}

.qr-sync-btn:hover {
    background-color: var(--accent-blue);
    border-color: var(--accent-blue);
    color: white;
    transform: translateY(-1px);
}

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

.qr-sync-btn i {
    margin-right: 3px;
}

/* Remove old cloud-sync-btn and reset-password-btn styles */

/* Image Wrapper with Overlay Buttons */
.image-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

.image-overlay-buttons {
    position: absolute;
    top: 0;
    left: 0;
    /* pointer-events: none; handled by z-index usually, but good practice if needed */
    display: flex !important;
    /* Ensure it is flex when opacity > 0 */
    flex-direction: row;
    gap: 8px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s;
    z-index: 9999;
}

.image-wrapper:hover .image-overlay-buttons,
.image-box:hover .image-overlay-buttons,
.image-wrapper .image-overlay-buttons:hover {
    opacity: 1 !important;
    visibility: visible !important;
}

.overlay-btn {
    padding: 8px;
    background-color: rgba(20, 20, 20, 0.85);
    color: white;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    font-size: 16px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    cursor: pointer;
}

.overlay-btn:hover {
    background-color: var(--accent-blue);
    transform: scale(1.1);
    border-color: var(--accent-blue);
}

/* Slider */
.slider {
    width: 100%;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--accent-blue);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 10px var(--accent-blue);
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--accent-blue);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.input-group small {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* Generate Button */
.generate-btn {
    width: 100%;
    padding: 12px;
    background-color: var(--accent-blue);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 15px;
}

.generate-btn:hover {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.4);
}

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

.generate-btn:disabled {
    background-color: var(--border-color);
    cursor: not-allowed;
    transform: none;
}

/* API Settings */
.api-settings {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.api-settings h3 {
    font-size: 16px;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.api-settings input[type="password"] {
    width: 100%;
    padding: 10px;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s;
}

.api-settings input[type="password"]:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.api-settings a {
    color: var(--accent-blue);
    text-decoration: none;
}

.api-settings a:hover {
    text-decoration: underline;
}

.credit-balance {
    margin-top: 4px;
    padding: 4px 8px;
    background-color: var(--bg-dark);
    border-radius: 4px;
    font-size: 11px;
    color: var(--success);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Right Panel */
.right-panel {
    background-color: var(--bg-card);
    padding: 20px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.right-panel h2 {
    font-size: 20px;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.comparison-container {
    min-height: 400px;
    max-height: none;
    /* V29.2: 制限なし — 縦長画像対応 */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
}

/* Empty State */
.empty-state {
    text-align: center;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 16px;
}

/* Loading State */
.loading-state {
    text-align: center;
}

/* Loading State Overlay (for split view) */
/* Old .loading-state-overlay duplicate removed in V26.3 */

/* Modal Close Button */
.slider-close-btn {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 32px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 999999;
    /* Super high */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.slider-close-btn:hover {
    background: var(--danger);
    transform: scale(1.1);
}

.loading-state-overlay p {
    color: var(--text-primary);
    font-size: 16px;
    margin-top: 10px;
}

.loading-state-overlay small {
    color: var(--text-secondary);
    font-size: 13px;
}

/* Old spinner and progress bar styles removed in favor of particle animation */

/* Before/After Display */
.before-after-display {
    width: 100%;
}

/* Ensure image-wrapper is a positioning context for the overlay */
.image-box.image-wrapper {
    position: relative;
}

/* Before/After Split View */
.split-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
}

.split-item {
    width: 100%;
    overflow: visible;
    /* V27.8: Allow glow effect to extend beyond boundaries */
}

.image-box {
    width: 100%;
    /* Fill the split item */
    max-width: 100%;
    /* V26.3 FIX: Ensure substantial height so loader is centered */
    min-height: 60vh;
    /* V29.1: max-height削除 — 縦長画像の下辺切れ防止 */
    margin: 0 auto;
    background-color: transparent;
    /* V29.0: 黒縁防止 - 透明背景 */
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    position: relative !important;
    /* Anchor for overlay */
    overflow: visible;
    /* V29.1: visible — 縦長画像クリップ防止 + border-radius表示 */
}

.image-box img {
    max-width: 100%;
    max-height: 90vh;
    /* V29.1: 90vhに緩和 — 縦長画像の下辺切れ防止 */
    width: auto !important;
    height: auto !important;
    object-fit: contain;
    border-radius: 8px;
    display: block;
}

/* Hide empty images to prevent "ugly square" borders */
.image-box img[src=""],
.image-box img:not([src]) {
    display: none;
    opacity: 0;
}



/* After Only Display */
.after-only-display {
    width: 100%;
    text-align: center;
}

/* Before Only Display (for uploaded reference) */
#beforeOnlyDisplay {
    width: 100%;
    text-align: center;
    margin-bottom: 20px;
}

#beforeOnlyDisplay .image-wrapper {
    width: 100%;
    /* V29.2: max-height削除 — 縦長画像の下辺切れ防止 */
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    /* V29.2: 透明背景 */
    border-radius: 8px;
    overflow: visible;
    /* V29.2: visible — クリップ防止 */
}

#beforeOnlyDisplay img {
    max-width: 100%;
    max-height: 85vh;
    width: auto;
    height: auto;
    object-fit: contain;
}

.after-only-display .image-wrapper {
    /* V29.2: max-height削除 — 縦長画像の下辺切れ防止 */
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
    min-height: 50vh;
    /* Ensure height for loading animation */
    display: flex;
    align-items: center;
    background-color: transparent;
    /* V29.2: 透明背景 */
    border-radius: 8px;
    position: relative !important;
    overflow: visible;
    /* V29.2: visible — クリップ防止 */
}

.after-only-display img {
    max-width: 100%;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
}

.after-only-display .image-box {
    width: 100%;
    min-height: 70vh;
    /* V29.2: height→min-height — 縦長画像拡張可能 */
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    /* V29.2: 透明背景 */
    border-radius: 8px;
    overflow: visible;
    /* V29.2: visible — クリップ防止 */
}

.after-only-display .image-box img {
    max-width: 100%;
    max-height: 90vh;
    /* V29.2: 90vh — 親がmin-heightになったため絶対値に変更 */
    object-fit: contain;
}

/* TwentyTwenty Slider Customization */
.twentytwenty-container {
    width: 100%;
    max-width: 100%;
    margin: 20px auto;
}

.twentytwenty-container img {
    width: 100%;
    max-height: calc(100vh - 200px);
    object-fit: contain;
    display: block;
}

.twentytwenty-overlay {
    background: rgba(0, 0, 0, 0.5) !important;
}

.twentytwenty-before-label,
.twentytwenty-after-label {
    background: var(--accent-blue) !important;
    color: white !important;
    padding: 8px 16px !important;
    border-radius: 4px !important;
}

.twentytwenty-handle {
    border: 3px solid var(--accent-blue) !important;
    background-color: var(--bg-dark) !important;
}

.twentytwenty-left-arrow,
.twentytwenty-right-arrow {
    border-right-color: var(--accent-blue) !important;
    border-left-color: var(--accent-blue) !important;
}

/* Slider Wrapper */
#sliderWrapper {
    width: 100%;
    margin-top: 20px;
}

/* After Only Display */
.after-only-display {
    width: 100%;
    text-align: center;
}

.comparison-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.image-column {
    position: relative;
}

.image-label {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-secondary);
}

.image-column img,
.after-only-display img,
#afterOnlyImage {
    width: 100%;
    max-height: calc(100vh - 200px);
    object-fit: contain;
    border-radius: 8px;
    display: block;
}

.view-btn {
    display: inline-block;
    margin-top: 15px;
    padding: 10px 20px;
    background-color: var(--accent-blue);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s;
}

.view-btn:hover {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
}

.image-info {
    padding: 10px 0;
    background-color: transparent;
    border-radius: 0;
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 10px;
    text-align: left;
}

/* Responsive */
@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 20% 35% 45%;
    }
}

.split-item {
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    /* Ensure top alignment */
}

/* Glowing Border Animation for Generation */
/* V28.1: 安全マージン付き内側アニメーション */
.generating-border-effect {
    position: relative;
    z-index: 10;
    background-color: #1E2329 !important;
    border-radius: 8px;
    overflow: hidden;
}

/* 内側を周回するグローライン */
.generating-border-effect::before {
    content: '';
    position: absolute;
    inset: 12px;
    /* V28.1: 安全マージン付き内側 */
    border-radius: 4px;
    padding: 2px;
    background: linear-gradient(90deg,
            transparent 0%,
            #00ffea 20%,
            #0066ff 40%,
            #00ffea 60%,
            transparent 80%,
            transparent 100%);
    background-size: 300% 100%;
    animation: borderGlow 4.5s linear infinite;
    /* V28.2: 1/3速度に減速 */
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    mask-composite: exclude;
    z-index: 100;
    pointer-events: none;
}

/* 内側の静的グロー */
.generating-border-effect::after {
    content: '';
    position: absolute;
    inset: 12px;
    border-radius: 4px;
    box-shadow: inset 0 0 25px rgba(0, 255, 255, 0.2);
    pointer-events: none;
    z-index: 50;
}

@keyframes borderGlow {
    0% {
        background-position: 0% 50%;
    }

    100% {
        background-position: 300% 50%;
    }
}

/* V29.0: 生成中のAfter予定地 — 透明背景（アニメのみ浮かぶ） */
.generating-state {
    background: transparent !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

/* V29.0: Holographic Loader - 近未来CSSアニメーション */
/* V29.2: 3D奥行き追加 — リングが太陽の後ろを通過 */
.holographic-loader {
    width: 120px;
    height: 120px;
    position: relative;
    perspective: 800px;
    transform-style: preserve-3d;
}

/* 中央のパルスオーブ（太陽） — V29.2: Z=25pxで手前に配置 */
.holographic-loader::before {
    content: '';
    position: absolute;
    inset: 28%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 255, 234, 0.9) 0%, rgba(0, 102, 255, 0.5) 50%, transparent 70%);
    animation: orbPulse 2.5s ease-in-out infinite;
    box-shadow:
        0 0 30px rgba(0, 255, 234, 0.6),
        0 0 60px rgba(0, 102, 255, 0.3),
        0 0 100px rgba(138, 43, 226, 0.15);
    transform: translateZ(25px);
    will-change: transform, opacity;
}

/* 背景のソフトグロー — V29.2: オーブと同じZ平面 */
.holographic-loader::after {
    content: '';
    position: absolute;
    inset: -40%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 255, 234, 0.08) 0%, rgba(138, 43, 226, 0.05) 40%, transparent 70%);
    animation: glowBreathe 4s ease-in-out infinite;
    pointer-events: none;
    transform: translateZ(25px);
    will-change: transform, opacity;
}

/* 軌道リング（惑星） — V29.2: 3D保持 */
.holographic-loader span {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid transparent;
    transform-style: preserve-3d;
    will-change: transform;
}

.holographic-loader span:nth-child(1) {
    border-top-color: #00ffea;
    border-right-color: rgba(0, 255, 234, 0.3);
    animation: ringOrbit 3s linear infinite;
    box-shadow:
        0 0 8px rgba(0, 255, 234, 0.6),
        0 0 16px rgba(0, 255, 234, 0.3),
        inset 0 0 8px rgba(0, 255, 234, 0.2);
}

.holographic-loader span:nth-child(2) {
    inset: 12%;
    border-right-color: #8a2be2;
    border-bottom-color: rgba(138, 43, 226, 0.3);
    animation: ringOrbit 2.2s linear infinite reverse;
    box-shadow:
        0 0 8px rgba(138, 43, 226, 0.6),
        0 0 16px rgba(138, 43, 226, 0.3),
        inset 0 0 8px rgba(138, 43, 226, 0.2);
}

.holographic-loader span:nth-child(3) {
    inset: 24%;
    border-bottom-color: #ff006e;
    border-left-color: rgba(255, 0, 110, 0.3);
    animation: ringOrbit 4s linear infinite;
    box-shadow:
        0 0 8px rgba(255, 0, 110, 0.6),
        0 0 16px rgba(255, 0, 110, 0.3),
        inset 0 0 8px rgba(255, 0, 110, 0.2);
}

@keyframes orbPulse {
    0%, 100% {
        transform: translateZ(25px) scale(1);
        /* V29.2: Z位置維持 */
        opacity: 0.7;
        box-shadow: 0 0 30px rgba(0, 255, 234, 0.6), 0 0 60px rgba(0, 102, 255, 0.3);
    }
    50% {
        transform: translateZ(25px) scale(1.35);
        /* V29.2: Z位置維持 */
        opacity: 1;
        box-shadow: 0 0 50px rgba(0, 255, 234, 0.8), 0 0 100px rgba(0, 102, 255, 0.5), 0 0 150px rgba(138, 43, 226, 0.2);
    }
}

@keyframes ringOrbit {
    0% { transform: rotateX(65deg) rotateZ(0deg); }
    100% { transform: rotateX(65deg) rotateZ(360deg); }
}

@keyframes glowBreathe {
    0%, 100% { transform: translateZ(25px) scale(1); opacity: 0.5; }
    50% { transform: translateZ(25px) scale(1.15); opacity: 1; }
}

/* レガシー .spinner 互換（after-only-display用） */
.spinner {
    width: 60px;
    height: 60px;
    border: none;
    background: transparent;
    border-radius: 50%;
    position: relative;
    box-shadow: none;
}

.spinner::before,
.spinner::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(45deg, transparent, transparent 40%, var(--accent-blue));
    filter: blur(5px);
    animation: spinnerRotate 2s linear infinite;
}

.spinner::after {
    background: linear-gradient(45deg, transparent, transparent 40%, #00ff88);
    animation: spinnerRotate 3s linear infinite reverse;
    opacity: 0.7;
    filter: blur(8px);
    transform: scale(1.2);
}

@keyframes spinnerRotate {
    0% { transform: rotate(0deg) scale(1); filter: hue-rotate(0deg) blur(5px); }
    50% { transform: rotate(180deg) scale(1.2); filter: hue-rotate(90deg) blur(10px); }
    100% { transform: rotate(360deg) scale(1); filter: hue-rotate(0deg) blur(5px); }
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .history-sidebar {
        max-height: 300px;
    }

    .left-panel {
        max-height: none;
    }

    .comparison-wrapper {
        grid-template-columns: 1fr;
    }
}

/* TwentyTwenty Slider Customization */
.twentytwenty-container {
    max-width: 100%;
    max-height: 90vh;
    margin: 0 auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.twentytwenty-container img {
    max-width: 100%;
    max-height: 90vh;
    width: auto;
    height: auto;
}

.twentytwenty-before-label,
.twentytwenty-after-label {
    background-color: var(--accent-blue);
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
}

.twentytwenty-handle {
    border: 3px solid var(--accent-blue);
    background-color: rgba(14, 17, 23, 0.8);
}

.twentytwenty-left-arrow,
.twentytwenty-right-arrow {
    border-color: var(--accent-blue);
}

/* Masking Tools & Canvas Overlay */
/* Masking Tools Bar (Static Position) */
.masking-tools-bar {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 5px 0;
    position: sticky;
    /* V29.2: 縦長画像でもツールバーを画面上部に固定 */
    top: 24px;
    /* ラベルの高さ分下にオフセット */
    z-index: 100;
    background: var(--bg-main, #0F1117);
    /* 背景色でスクロール時に画像が透けないようにする */
}

.mask-controls {
    /* Previously absolute, now static flex container */
    display: flex;
    gap: 15px;
    align-items: center;
    justify-content: center;
    padding: 8px 15px;
    background-color: var(--bg-card);
    /* Match card bg or transparent */
    border-radius: 30px;
    border: 1px solid var(--border-color);
}

.canvas-container {
    position: absolute;
    pointer-events: auto;
    cursor: crosshair;
    z-index: 10;
    /* サイズと位置（top/left）はJS側で画像に合わせて動的に設定される */
}

.mask-canvas {
    display: block;
    width: 100%;
    height: 100%;
    /* Optional: subtle border to see the drawing area */
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2);
    touch-action: none;
}

.mask-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
    transition: all 0.2s;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.mask-btn.active {
    color: var(--accent-blue);
    background-color: rgba(74, 144, 226, 0.2);
}

.mask-controls label {
    display: flex;
    gap: 8px;
    align-items: center;
    color: var(--text-secondary);
    margin: 0;
}

.mask-controls input[type="range"] {
    width: 80px;
    height: 4px;
}

/* Generation Feed Container */
#generationsFeed {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    margin-bottom: 50px;
    /* Space for scrolling */
}

/* Individual Job Card */
.job-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 15px;
    position: relative;
    animation: fadeIn 0.3s ease-out;
}

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

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

.job-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 10px;
}

.job-info {
    flex: 1;
}

.job-prompt {
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 5px;
    font-weight: 500;
}

.job-meta {
    font-size: 11px;
    color: var(--text-secondary);
    display: flex;
    gap: 10px;
    align-items: center;
}

.job-status {
    font-size: 11px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
    background: #333;
    color: #ccc;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.job-status.processing {
    background: rgba(74, 144, 226, 0.15);
    color: var(--accent-blue);
    border: 1px solid rgba(74, 144, 226, 0.3);
}

.job-status.success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.job-status.error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Job Action Buttons (Top Right) */
.job-actions {
    display: flex;
    gap: 5px;
}

/* Main Comparison Area within Card */
.job-comparison-area {
    position: relative;
    width: 100%;
    min-height: 200px;
    /* Placeholder height */
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Ensure the slider takes full width inside the card */
.job-comparison-area img-comparison-slider {
    width: 100%;
    outline: none;
    transition: all 0.3s;
}

.job-comparison-area img {
    width: 100%;
    height: auto;
    object-fit: contain;
    max-height: 80vh;
}

/* End of original styles */

/* --- SAFETY NET STYLES FOR SPLIT VIEW --- */
#beforeAfterSplit {
    /* Base state handled by JS, but ensure width */
    width: 100%;
}

/* Force visibility when JS sets block */
#beforeAfterSplit[style*="block"] {
    display: block !important;
}

.split-container {
    display: flex;
    flex-wrap: wrap;
    /* Safety */
    gap: 10px;
    width: 100%;
}

.split-item {
    flex: 1;
    min-width: 300px;
    /* Prevent collapse */
    display: flex;
    flex-direction: column;
}

.image-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 5px;
    font-weight: bold;
    text-align: center;
    position: sticky;
    /* V29.2: 縦長画像でもラベルを画面上部に固定 */
    top: 0;
    z-index: 99;
    background: var(--bg-main, #0F1117);
    padding: 4px 0;
}

.image-box,
.image-wrapper {
    position: relative;
    width: 100%;
    min-height: 100px;
    /* Ensure non-zero height */
    background: transparent;
    /* V29.0: 黒縁防止 */
    border-radius: 8px;
    overflow: visible;
    /* V29.2: visible — 縦長画像の下辺切れ防止 (L1129のfix維持) */
}

.image-box img,
.image-wrapper img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
}

/* Ensure Mask Canvas aligns */
.mask-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: auto;
    /* Enable drawing */
}


/* After予定地の空表示を抑制 */
.image-box img:not([src]),
.image-box img[src=""],
.image-wrapper img:not([src]),
.image-wrapper img[src=""] {
    display: none !important;
}

/* 背景の黒い四角も画像がないときは透明にする */
.image-box:has(img[src=""]),
.image-box:has(img:not([src])),
.image-wrapper:has(img[src=""]),
.image-wrapper:has(img:not([src])) {
    background: transparent !important;
    border: none !important;
}

.history-item .history-delete-btn,
.history-item .history-compare-btn,


.history-item:hover .history-delete-btn,
.history-item:hover .history-compare-btn,
.history-item:hover .history-download-btn {
    opacity: 1 !important;
    /* Show on hover */
}





.history-item .history-delete-btn:hover {
    background: rgba(239, 68, 68, 0.9) !important;
}

.image-box.image-wrapper {
    position: relative !important;
    min-height: 200px;
    background: transparent !important;
    /* Remove background when empty */
}

.history-item .history-delete-btn,
.history-item .history-compare-btn,
.history-item .history-download-btn,


/* ギャラリーと同様のホバー表示 */
.history-item:hover .history-delete-btn,
.history-item:hover .history-compare-btn,
.history-item:hover .history-download-btn,
.history-item:hover .history-send-ref-btn {
    opacity: 1 !important;
}





.history-item .history-delete-btn:hover {
    background: rgba(239, 68, 68, 0.9) !important;
}

.history-item .history-compare-btn:hover,
.history-item .history-download-btn:hover {
    background: rgba(40, 40, 40, 0.95) !important;
}

/* Generating Overlay Centering - FIXED V26.2, V29.1: 透明背景 */
.loading-state-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 500;
    transform-style: preserve-3d;
    /* V29.2: 3Dコンテキスト保持 */
}

/* After予定地の空ボックスを消去 */
.image-box.image-wrapper:not(:has(img[src*="/"])):not(:has(.loading-state-overlay[style*="flex"])) {
    background: transparent !important;
    border: none !important;
    min-height: 0 !important;
}

.history-item .history-delete-btn,
.history-item .history-compare-btn,


.history-item:hover .history-delete-btn,
.history-item:hover .history-compare-btn,
.history-item:hover .history-download-btn {
    opacity: 1 !important;
}

/* 希望の順序：Trash(右端), Slider(中), DL(左) --> 1.Trash, 2.Slider, 3.DL */




.history-item .history-delete-btn:hover {
    background: rgba(239, 68, 68, 0.9) !important;
}

.image-box.image-wrapper:not(:has(img[src*="/"])):not(:has(.loading-state-overlay)) {
    background: transparent !important;
    border: none !important;
    min-height: 0 !important;
}

.history-item .history-delete-btn,
.history-item .history-compare-btn,
.history-item .history-download-btn {
    position: absolute !important;
    top: 5px !important;
    width: 24px !important;
    height: 24px !important;
    background: rgba(15, 15, 15, 0.85) !important;
    color: rgba(255, 255, 255, 0.9) !important;
    border: none !important;
    border-radius: 4px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 100 !important;
    cursor: pointer !important;
    opacity: 0 !important;
    transition: opacity 0.2s ease, background 0.2s ease !important;
    font-size: 10px !important;
}

.history-item:hover .history-delete-btn,
.history-item:hover .history-compare-btn,
.history-item:hover .history-download-btn {
    opacity: 1 !important;
}

.history-item .history-delete-btn {
    right: 5px !important;
}

.history-item .history-compare-btn {
    right: 32px !important;
}

.history-item .history-download-btn {
    right: 59px !important;
}

.history-item .history-delete-btn:hover {
    background: rgba(239, 68, 68, 0.9) !important;
}

.image-box.image-wrapper:not(:has(img[src*='/'])):not(:has(.loading-state-overlay)) {
    background: transparent !important;
    border: none !important;
    min-height: 0 !important;
}

/* === V29.2: Preset Edit Button === */
.preset-edit-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 8px;
    padding: 2px 4px;
    opacity: 0;
    transition: opacity 0.2s;
    position: absolute;
    right: 2px;
    top: 50%;
    transform: translateY(-50%);
}

.checkbox-label:hover .preset-edit-btn {
    opacity: 0.7;
}

.preset-edit-btn:hover {
    opacity: 1 !important;
    color: var(--accent-blue);
}

/* === V29.2: Preset Edit Modal === */
.preset-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.preset-modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 90%;
    max-width: 480px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.preset-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.preset-modal-header h3 {
    font-size: 16px;
    color: var(--text-primary);
    margin: 0;
}

.preset-modal-close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}

.preset-modal-close-btn:hover {
    color: var(--text-primary);
}

.preset-modal-body {
    padding: 20px;
}

.preset-modal-label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    margin-top: 12px;
}

.preset-modal-label:first-child {
    margin-top: 0;
}

.preset-modal-input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    box-sizing: border-box;
}

.preset-modal-textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 12px;
    font-family: inherit;
    resize: vertical;
    min-height: 120px;
    box-sizing: border-box;
}

.preset-modal-input:focus,
.preset-modal-textarea:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.preset-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
}

.preset-modal-btn {
    padding: 8px 20px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.preset-modal-btn.cancel {
    background: var(--bg-dark);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.preset-modal-btn.cancel:hover {
    color: var(--text-primary);
}

.preset-modal-btn.save {
    background: var(--accent-blue);
    color: white;
}

.preset-modal-btn.save:hover {
    filter: brightness(1.15);
}