/* Variables */
:root {
    --primary-color: #10b981;
    --secondary-color: #6366f1;
    --bg-color: #1a1a2e;
    --bg-secondary: #16213e;
    --surface-color: #0f0f1a;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --radius: 12px;
    --radius-sm: 8px;
}

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

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

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

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

.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: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary-color), #34d399);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

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

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

.section-hint {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

/* API Status */
.api-status {
    padding: 1rem 1.5rem;
}

.status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 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;
}

.status-success { color: var(--success-color); }
.status-warning { color: var(--warning-color); }
.status-error { color: var(--error-color); }

/* Save/Load Presets */
.save-load-section {
    padding: 1rem 1.5rem;
}

.save-load-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.save-group,
.load-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.preset-name-input {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-color);
    color: var(--text-primary);
    font-size: 0.85rem;
    width: 160px;
}

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

.preset-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-color);
    color: var(--text-primary);
    font-size: 0.85rem;
    min-width: 200px;
    cursor: pointer;
}

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

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

.btn-danger:hover {
    background: #dc2626;
}

/* Reference Files */
.reference-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

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

.reference-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.reference-icon {
    font-size: 1.2rem;
}

.reference-header label {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-sm);
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: rgba(16, 185, 129, 0.05);
}

.upload-area.drag-over {
    border-color: var(--primary-color);
    background: rgba(16, 185, 129, 0.1);
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.upload-icon {
    font-size: 2rem;
    color: var(--border-color);
}

.uploaded-files {
    margin-top: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.uploaded-file {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-secondary);
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
}

.uploaded-file img {
    width: 24px;
    height: 24px;
    object-fit: cover;
    border-radius: 3px;
}

.uploaded-file .file-name {
    color: var(--text-primary);
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.uploaded-file .remove-file {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    font-size: 1rem;
    line-height: 1;
}

.uploaded-file .remove-file:hover {
    color: var(--error-color);
}

/* Reference Usage */
.reference-usage {
    background: var(--bg-color);
    border-radius: var(--radius-sm);
    padding: 1rem;
    margin-top: 1rem;
}

.reference-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.reference-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--secondary-color);
    color: white;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    cursor: pointer;
    transition: all 0.2s;
}

.reference-tag:hover {
    background: #4f46e5;
    transform: scale(1.05);
}

.reference-tag.character {
    background: #ec4899;
}

.reference-tag.character:hover {
    background: #db2777;
}

.reference-tag.background {
    background: #3b82f6;
}

.reference-tag.background:hover {
    background: #2563eb;
}

/* Character Reference - Name Based */
.character-reference-section {
    background: var(--bg-color);
    border-radius: var(--radius-sm);
    padding: 1rem;
}

.character-reference-section .reference-header {
    margin-bottom: 0.5rem;
}

.character-reference-section .reference-header .btn {
    margin-left: auto;
}

.character-reference-section .section-hint {
    margin-bottom: 1rem;
    font-size: 0.8rem;
}

.character-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.character-entry {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 1rem;
    position: relative;
}

.character-entry-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.character-name-input {
    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;
    font-weight: 500;
}

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

.character-name-input::placeholder {
    color: var(--text-secondary);
    font-weight: 400;
}

.character-remove-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-secondary);
    padding: 0.4rem 0.6rem;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
}

.character-remove-btn:hover {
    background: var(--error-color);
    border-color: var(--error-color);
    color: white;
}

.character-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-sm);
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.character-upload-area:hover {
    border-color: var(--primary-color);
    background: rgba(16, 185, 129, 0.05);
}

.character-upload-area.drag-over {
    border-color: var(--primary-color);
    background: rgba(16, 185, 129, 0.1);
}

.character-upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.character-upload-placeholder .upload-icon {
    font-size: 1.5rem;
    color: var(--border-color);
}

.character-files-list {
    margin-top: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.character-file-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--surface-color);
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
}

.character-file-item img {
    width: 28px;
    height: 28px;
    object-fit: cover;
    border-radius: 3px;
}

.character-file-item .file-name {
    color: var(--text-primary);
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.character-file-item .remove-file {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    font-size: 0.9rem;
    line-height: 1;
}

.character-file-item .remove-file:hover {
    color: var(--error-color);
}

.no-characters-hint {
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-align: center;
    padding: 1rem;
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-sm);
}

/* AI Scene Auto-Fill */
.ai-scene-section {
    border: 2px solid var(--secondary-color);
    background: linear-gradient(135deg, var(--surface-color) 0%, rgba(99, 102, 241, 0.05) 100%);
}

.ai-scene-section h2 {
    background: linear-gradient(135deg, var(--secondary-color), #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.ai-scene-input-group {
    margin-bottom: 1rem;
}

.scene-description-input {
    width: 100%;
    min-height: 100px;
    padding: 1rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    resize: vertical;
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

.scene-description-input:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.scene-description-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.8;
}

.ai-scene-buttons {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.ai-scene-buttons .btn-primary {
    background: var(--secondary-color);
}

.ai-scene-buttons .btn-primary:hover:not(:disabled) {
    background: #4f46e5;
}

.ai-fill-result {
    background: var(--bg-color);
    border-radius: var(--radius-sm);
    padding: 1rem;
    border-left: 3px solid var(--success-color);
}

.ai-fill-summary {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.ai-fill-summary strong {
    color: var(--text-primary);
}

.ai-fill-summary .setting-changed {
    display: inline-block;
    background: var(--bg-secondary);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    margin: 0.2rem;
    font-size: 0.8rem;
}

/* Control Grid */
.control-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

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

.control-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.control-icon {
    font-size: 1.2rem;
}

.control-header label {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.control-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

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

.control-row > label {
    color: var(--text-secondary);
    font-size: 0.8rem;
    min-width: 80px;
    flex-shrink: 0;
}

.control-select {
    flex: 1;
    min-width: 0;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

/* L7 Section - 3 columns for better fit */
.section:has(#focal-length) .control-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.section:has(#focal-length) .control-group {
    min-width: 0;
    overflow: hidden;
}

.section:has(#focal-length) .control-row > label {
    min-width: 60px;
    font-size: 0.75rem;
}

.section:has(#focal-length) .control-select {
    font-size: 0.8rem;
    padding: 0.4rem;
}

/* Layer Groups */
.layer-group {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.layer-group:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.layer-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

/* Lock Button for Layer */
.layer-lock-btn {
    margin-left: auto;
    padding: 0.25rem 0.5rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.layer-lock-btn:hover {
    border-color: var(--primary-color);
    color: var(--text-primary);
}

.layer-lock-btn.locked {
    background: var(--warning-color);
    border-color: var(--warning-color);
    color: white;
}

.layer-lock-btn.locked:hover {
    background: #d97706;
    border-color: #d97706;
}

.layer-select.locked {
    opacity: 0.6;
    pointer-events: none;
    background: var(--bg-secondary);
}

.layer-badge {
    background: var(--primary-color);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.layer-header label {
    font-weight: 500;
    color: var(--text-primary);
}

.layer-select {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    cursor: pointer;
}

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

.layer-preview {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: none;
    white-space: pre-wrap;
}

.layer-preview.active {
    display: block;
}

.notes-input {
    width: 100%;
    min-height: 80px;
    padding: 0.75rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    resize: vertical;
}

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

.hint {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Prompt Output */
.prompt-output {
    background: var(--bg-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.prompt-layers {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.prompt-layers .placeholder {
    color: var(--text-secondary);
    font-style: italic;
}

.layer-item {
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px dashed var(--border-color);
}

.layer-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.layer-item-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.layer-item-badge {
    background: var(--secondary-color);
    color: white;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 600;
}

.layer-item-name {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.layer-item-text {
    font-size: 0.85rem;
    color: var(--text-primary);
    line-height: 1.5;
}

.prompt-final {
    padding: 1rem;
}

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

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

.validation-log {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    background: rgba(239, 68, 68, 0.1);
}

.validation-log h3 {
    font-size: 0.9rem;
    color: var(--warning-color);
    margin-bottom: 0.5rem;
}

.validation-log ul {
    list-style: none;
    font-size: 0.85rem;
}

.validation-log li {
    padding: 0.25rem 0;
    color: var(--text-secondary);
}

.validation-log li::before {
    content: "⚠️ ";
}

/* Consistency Check */
.consistency-check {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.consistency-check .btn {
    width: 100%;
    margin-bottom: 1rem;
}

.consistency-result {
    background: var(--bg-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.consistency-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.consistency-header h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--text-primary);
}

.consistency-content {
    padding: 1rem;
}

.consistency-section {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px dashed var(--border-color);
}

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

.consistency-section h4 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.consistency-section ul {
    list-style: none;
    font-size: 0.85rem;
}

.consistency-section li {
    padding: 0.4rem 0;
    color: var(--text-primary);
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.consistency-section li::before {
    content: "•";
    color: var(--primary-color);
    font-weight: bold;
}

#consistency-issues li::before {
    content: "⚠️";
}

#consistency-suggestions li::before {
    content: "💡";
}

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

.enhanced-prompt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.enhanced-prompt-header h4 {
    margin: 0;
}

.language-toggle {
    display: flex;
    gap: 0.25rem;
    background: var(--bg-secondary);
    padding: 0.2rem;
    border-radius: var(--radius-sm);
}

.lang-btn {
    padding: 0.3rem 0.75rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: calc(var(--radius-sm) - 2px);
    cursor: pointer;
    transition: all 0.2s ease;
}

.lang-btn:hover {
    color: var(--text-primary);
}

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

/* Generation Options */
.generation-options {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
    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;
}

/* 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: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

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

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

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

.btn-secondary {
    background: var(--bg-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--primary-color);
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

.btn-large {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
}

/* Result */
.result-container {
    text-align: center;
}

.generated-image {
    max-width: 100%;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
}

.result-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

/* Loading */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    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;
    left: 50%;
    transform: translateX(-50%);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 1001;
}

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

.toast-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    opacity: 0.8;
}

.toast-close:hover {
    opacity: 1;
}

/* Responsive */
@media (max-width: 900px) {
    /* L7 section - 2 columns on medium screens */
    .section:has(#focal-length) .control-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .container {
        padding: 1rem;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .reference-grid,
    .control-grid {
        grid-template-columns: 1fr;
    }

    /* L7 section - 1 column on mobile */
    .section:has(#focal-length) .control-grid {
        grid-template-columns: 1fr;
    }

    .generation-options {
        flex-direction: column;
    }

    .option-group {
        width: 100%;
        justify-content: space-between;
    }

    .control-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .control-row > label {
        min-width: auto;
    }

    .control-select {
        width: 100%;
    }

    .layer-lock-btn span:last-child {
        display: none;
    }
}
