/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Hidden attribute support */
[hidden] {
    display: none !important;
}

:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #64748b;
    --success-color: #22c55e;
    --error-color: #ef4444;
    --bg-color: #0f172a;
    --surface-color: #1e293b;
    --surface-hover: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --radius: 12px;
    --radius-sm: 8px;
}

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 3rem;
}

.back-link {
    display: inline-block;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--primary-color);
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary-color), #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Sections */
.section {
    background: var(--surface-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}

.section h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* API Status Section */
.api-status {
    background: var(--surface-color);
}

.status-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.status-value {
    font-weight: 600;
    color: var(--text-primary);
}

.status-success {
    color: #22c55e;
}

.status-warning {
    color: #f59e0b;
}

.status-error {
    color: #ef4444;
}

/* Image Model Selector */
.image-model-selector {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1rem 0;
    padding: 0.75rem;
    background: var(--bg-color);
    border-radius: var(--radius-sm);
}

.image-model-selector label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    white-space: nowrap;
}

.image-model-selector select {
    flex: 1;
    padding: 0.5rem 0.75rem;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
}

.image-model-selector select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.image-model-selector select optgroup {
    background: var(--surface-color);
    color: var(--text-secondary);
    font-weight: 600;
}

.image-model-selector select option {
    background: var(--surface-color);
    color: var(--text-primary);
    padding: 0.5rem;
}

/* Process Options */
.process-options {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 1rem 0;
    padding: 0.75rem;
    background: var(--bg-color);
    border-radius: var(--radius-sm);
}

.option-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.option-group label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    white-space: nowrap;
}

.option-group select {
    padding: 0.4rem 0.6rem;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
}

.option-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* History Section */
.history-section {
    background: linear-gradient(135deg, var(--surface-color), rgba(99, 102, 241, 0.1));
}

.history-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.no-history {
    color: var(--text-secondary);
    font-style: italic;
    grid-column: 1 / -1;
}

.history-item {
    background: var(--bg-color);
    border-radius: var(--radius-sm);
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.history-item:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.history-item.selected {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.history-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
}

.history-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.history-thumbnails {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.history-thumbnail {
    width: 48px;
    height: 48px;
    border-radius: 4px;
    object-fit: cover;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: transform 0.2s;
}

.history-thumbnail:hover {
    transform: scale(1.1);
}

.history-mood {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.history-mood::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-color);
}

.history-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.history-btn {
    flex: 1;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.history-btn-use {
    background: var(--primary-color);
    color: white;
}

.history-btn-use:hover {
    background: var(--primary-hover);
}

.history-btn-delete {
    background: transparent;
    color: var(--error-color);
    border: 1px solid var(--error-color);
}

.history-btn-delete:hover {
    background: var(--error-color);
    color: white;
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 1rem;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
}

.upload-placeholder svg {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.upload-placeholder p {
    color: var(--text-secondary);
}

.upload-placeholder .hint {
    font-size: 0.8rem;
    margin-top: 0.5rem;
    opacity: 0.7;
}

/* Image Preview */
.image-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-color);
    cursor: pointer;
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s;
}

.preview-item:hover img {
    transform: scale(1.05);
}

.preview-item .remove-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: background 0.2s;
    z-index: 2;
}

.preview-item .remove-btn:hover {
    background: var(--error-color);
}

.preview-item .zoom-icon {
    position: absolute;
    bottom: 0.5rem;
    left: 0.5rem;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

.preview-item:hover .zoom-icon {
    opacity: 1;
}

.zoom-icon svg {
    width: 14px;
    height: 14px;
    fill: white;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--border-color);
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.btn-loading {
    display: none;
}

.btn.loading .btn-text {
    display: none;
}

.btn.loading .btn-loading {
    display: inline;
}

/* Analysis Actions */
.analysis-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

/* Analysis Result */
.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.result-grid-new {
    grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 900px) {
    .result-grid-new {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .result-grid-new {
        grid-template-columns: 1fr;
    }
}

.result-card {
    background: var(--bg-color);
    border-radius: var(--radius-sm);
    padding: 1rem;
}

.result-card h3 {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.result-card .result-value {
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.result-detail {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.color-preview {
    display: flex;
    gap: 0.5rem;
}

.color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    border: 2px solid var(--border-color);
    display: none;
}

/* Generated Prompt Preview */
.generated-prompt {
    margin-top: 1rem;
    background: var(--bg-color);
    border-radius: var(--radius-sm);
    padding: 1rem;
}

.generated-prompt h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.prompt-preview {
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 0.8rem;
    color: var(--text-primary);
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: var(--radius-sm);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 200px;
    overflow-y: auto;
    line-height: 1.5;
}

/* Legacy styles for backward compatibility */
.result-card-wide {
    grid-column: span 2;
}

@media (max-width: 600px) {
    .result-card-wide {
        grid-column: span 1;
    }
}

/* Split Toning Display (legacy) */
.split-toning-display {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toning-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toning-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    min-width: 80px;
}

.toning-color {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 2px solid var(--border-color);
    flex-shrink: 0;
}

.toning-value {
    font-size: 0.9rem;
    color: var(--text-primary);
}

/* Color Palette */
.palette-colors {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    border: 2px solid var(--border-color);
    cursor: pointer;
    position: relative;
}

.color-swatch:hover::after {
    content: attr(data-color);
    position: absolute;
    bottom: -24px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    background: var(--bg-color);
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    z-index: 10;
}

/* Combined Prompt */
.combined-prompt {
    background: var(--bg-color);
    border-radius: var(--radius-sm);
    padding: 1rem;
}

.combined-prompt h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.prompt-text {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-primary);
}

/* Processed Images */
.processed-images {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1rem;
}

/* 1枚だけの場合、全幅を使用 */
.processed-images:has(.processed-item:only-child) {
    grid-template-columns: 1fr;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.processed-item {
    background: var(--bg-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
    max-width: 100%;
}

.processed-item .comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
}

.processed-item .comparison-img {
    position: relative;
    background: var(--bg-secondary);
}

.processed-item .comparison-img img {
    width: 100%;
    height: auto;
    display: block;
}

.processed-item .comparison-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.7);
    font-size: 0.8rem;
    text-align: center;
}

.processed-item .actions {
    padding: 0.75rem;
    display: flex;
    justify-content: center;
}

.download-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}

.download-btn:hover {
    background: rgba(99, 102, 241, 0.1);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    margin-top: 1rem;
    color: var(--text-secondary);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 1001;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-error {
    background: var(--error-color);
    color: white;
}

.toast-success {
    background: var(--success-color);
    color: white;
}

.toast-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

/* Image Modal */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    cursor: pointer;
}

.modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    z-index: 1;
}

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

.modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    width: 36px;
    height: 36px;
    background: var(--surface-color);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

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

/* Comparison Modal */
.comparison-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.comparison-modal-content {
    position: relative;
    width: 90vw;
    max-width: 1200px;
    max-height: 85vh;
    z-index: 1;
}

.comparison-container {
    background: var(--surface-color);
    border-radius: var(--radius);
    padding: 1rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}

.comparison-image-wrapper {
    position: relative;
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    border-radius: var(--radius-sm);
    cursor: ew-resize;
    user-select: none;
    background: #000;
}

.comparison-before {
    display: block;
    max-width: 100%;
    max-height: 75vh;
}

.comparison-after-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 50%;
    overflow: hidden;
}

.comparison-after {
    display: block;
    max-width: none;
    max-height: 75vh;
}

.comparison-slider {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 4px;
    transform: translateX(-50%);
    cursor: ew-resize;
    z-index: 10;
}

.comparison-slider-line {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    background: white;
    transform: translateX(-50%);
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
}

.comparison-slider-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    transition: transform 0.15s;
}

.comparison-slider-handle:hover {
    transform: translate(-50%, -50%) scale(1.1);
}

.slider-arrow {
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
}

.slider-arrow.left {
    border-right: 8px solid var(--primary-color);
}

.slider-arrow.right {
    border-left: 8px solid var(--primary-color);
}

.comparison-labels {
    position: absolute;
    bottom: 1rem;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 0 1rem;
    pointer-events: none;
}

.comparison-labels span {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
}

.label-before {
    margin-right: auto;
}

.label-after {
    margin-left: auto;
}

/* Comparison クリック可能な画像 */
.comparison-img {
    cursor: pointer;
}

/* Canvas Adjust Button */
.canvas-adjust-btn,
.canvas-process-btn {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.875rem;
    transition: background 0.2s;
}

.canvas-adjust-btn:hover {
    background: #4b5563;
}

.canvas-process-btn {
    background: var(--primary-color);
}

.canvas-process-btn:hover {
    background: var(--primary-hover);
}

/* Canvas Adjuster Modal */
.canvas-adjuster-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.canvas-adjuster-content {
    position: relative;
    background: var(--surface-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 1;
}

.canvas-adjuster-content h3 {
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.adjuster-preview {
    background: #000;
    border-radius: var(--radius-sm);
    padding: 0.5rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: center;
}

.adjuster-preview canvas {
    max-width: 100%;
    max-height: 50vh;
    border-radius: var(--radius-sm);
}

.adjuster-controls {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-group label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.control-group input[type="range"] {
    width: 100%;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.adjuster-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

@media (max-width: 600px) {
    .adjuster-controls {
        grid-template-columns: 1fr;
    }
}

/* Save Dialog */
.save-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dialog-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    cursor: pointer;
}

.dialog-content {
    position: relative;
    background: var(--surface-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    width: 90%;
    max-width: 450px;
    z-index: 1;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.dialog-content h3 {
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
}

.dialog-field {
    margin-bottom: 1rem;
}

.dialog-field label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.dialog-field input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1rem;
}

.dialog-field input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.dialog-preview {
    margin-bottom: 1.5rem;
}

.dialog-preview p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.dialog-thumbnails {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.dialog-thumbnails img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    header h1 {
        font-size: 1.75rem;
    }

    .result-grid {
        grid-template-columns: 1fr 1fr;
    }

    .processed-images {
        grid-template-columns: 1fr;
    }

    .history-list {
        grid-template-columns: 1fr;
    }
}

/* Prompt Display Section */
.prompt-section {
    margin-top: 1rem;
    border-top: 1px solid var(--border-color);
    padding-top: 0.75rem;
}

.prompt-toggle {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    width: 100%;
    text-align: left;
}

.prompt-toggle:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.prompt-content {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 1rem;
    margin-top: 0.75rem;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.8rem;
    line-height: 1.6;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 300px;
    overflow-y: auto;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 0.5rem;
}

.status-badge.fallback {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-badge.success {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

/* Status Section */
.status-section {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-sm);
}

.status-badge.error {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.error-message {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    word-break: break-word;
}
