/* FujiTone - Clean & Fresh Japanese Aesthetic Film Studio Styles */
:root {
    --bg-main: #f7f8fa;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f4f8;
    --bg-input: #f1f4f8;
    --border: rgba(0, 0, 0, 0.08);
    --border-active: #1e5644;
    --accent-primary: #1e5644;
    --accent-primary-hover: #174335;
    --accent-soft: rgba(30, 86, 68, 0.08);
    --accent-coral: #e75d4f;
    --accent-amber: #c26a1d;
    --accent-sky: #0284c7;
    --text-primary: #12161b;
    --text-secondary: #495360;
    --text-muted: #808b98;
    --canvas-bg: #eceef2;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.03), 0 1px 2px rgba(0, 0, 0, 0.02);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.07);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Accessibility / Native Mobile Upload Helper */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
    opacity: 0 !important;
}

/* Header */
.app-header {
    height: 52px;
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    user-select: none;
    z-index: 100;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 6px;
}

.fuji-badge {
    background: var(--accent-primary);
    color: #ffffff;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1px;
    padding: 3px 7px;
    border-radius: 4px;
}

.brand-title {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: var(--text-primary);
}

.brand-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    border-left: 1px solid var(--border);
    padding-left: 10px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* General Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 14px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.16s ease;
    user-select: none;
    line-height: 1;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent-primary);
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(45, 122, 94, 0.25);
}

.btn-primary:hover {
    background: var(--accent-primary-hover);
    box-shadow: 0 3px 10px rgba(45, 122, 94, 0.35);
    transform: translateY(-1px);
}

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

.btn-secondary {
    background: #ffffff;
    color: var(--text-secondary);
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: #f8fafc;
    color: var(--text-primary);
    border-color: #cbd5e1;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 11px;
}

.btn-large {
    padding: 12px 24px;
    font-size: 14px;
    border-radius: 10px;
}

.btn-text-action {
    background: transparent;
    border: none;
    color: var(--accent-primary);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.btn-text-action:hover {
    background: var(--accent-soft);
    color: var(--accent-primary-hover);
}

/* Form inputs & selects */
.fuji-select, .fuji-input {
    width: 100%;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    outline: none;
    transition: border-color 0.15s ease;
}

.fuji-select:focus, .fuji-input:focus {
    border-color: var(--accent-primary);
    background: #ffffff;
}

/* App Main Layout */
.app-container {
    flex: 1;
    display: flex;
    height: calc(100vh - 52px);
    overflow: hidden;
}

/* Left / Main Workspace */
.viewport-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--canvas-bg);
    position: relative;
    overflow: hidden;
}

.viewport-toolbar {
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    z-index: 10;
    flex-shrink: 0;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toolbar-badge {
    font-size: 11px;
    color: var(--text-secondary);
    background: #ffffff;
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid var(--border);
    font-weight: 500;
}

.viewport-canvas-container {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    user-select: none;
    padding: 14px;
}

/* Empty Hero Upload State */
.empty-upload-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 32px;
    max-width: 460px;
    width: 90%;
    margin: auto;
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius-lg);
    background: #ffffff;
    box-shadow: var(--shadow-md);
    transition: all 0.2s ease;
}

.empty-upload-prompt:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 6px 22px rgba(45, 122, 94, 0.12);
}

.empty-upload-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.empty-upload-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.empty-upload-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 14px;
}

.empty-features-badges {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.feature-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.035);
    padding: 3px 10px;
    border-radius: 999px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.feature-tag svg {
    color: var(--accent-primary);
}

#canvasWrapper {
    position: relative;
    display: inline-block;
    max-width: 98%;
    max-height: 96%;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.06);
    border-radius: 6px;
    overflow: hidden;
    line-height: 0;
}

#renderCanvas {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 120px);
    width: auto;
    height: auto;
    object-fit: contain;
}

/* Split Compare Slider */
.split-divider {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #ffffff;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.4);
    cursor: ew-resize;
    z-index: 20;
    pointer-events: none;
}

.split-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 36px;
    height: 36px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 800;
    pointer-events: auto;
    cursor: ew-resize;
    user-select: none;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.split-label-before, .split-label-after {
    position: absolute;
    bottom: 12px;
    padding: 3px 8px;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    color: #ffffff;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
    border-radius: 4px;
    z-index: 15;
    pointer-events: none;
}

.split-label-before { left: 12px; }
.split-label-after  { right: 12px; }

/* Drag and Drop Overlay */
.drop-overlay {
    position: absolute;
    inset: 0;
    background: rgba(45, 122, 94, 0.85);
    backdrop-filter: blur(8px);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
}

.drop-overlay.hidden {
    display: none;
}

.drop-box {
    border: 2px dashed rgba(255, 255, 255, 0.8);
    border-radius: var(--radius-lg);
    padding: 40px 60px;
    text-align: center;
    color: #ffffff;
}

.drop-icon { font-size: 48px; margin-bottom: 10px; }
.drop-title { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.drop-subtitle { font-size: 12px; opacity: 0.85; }

/* Render Indicator Spinner */
.render-indicator {
    position: absolute;
    top: 50px;
    right: 14px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 5px 12px;
    display: none;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-primary);
    z-index: 30;
}

.render-indicator.active {
    display: flex;
}

.spinner {
    width: 12px;
    height: 12px;
    border: 2px solid rgba(45, 122, 94, 0.2);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* Right / Bottom Control Sidebar */
.control-sidebar {
    width: 370px;
    background: var(--bg-main);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}

.sidebar-tabs {
    display: flex;
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-tab {
    flex: 1;
    padding: 12px 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.15s ease;
    user-select: none;
}

.sidebar-tab .tab-icon {
    opacity: 0.65;
    transition: all 0.15s ease;
}

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

.sidebar-tab:hover .tab-icon {
    opacity: 0.9;
}

.sidebar-tab.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
    font-weight: 700;
}

.sidebar-tab.active .tab-icon {
    opacity: 1;
    stroke: var(--accent-primary);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
}

/* Control Card Container */
.control-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px;
    box-shadow: var(--shadow-sm);
}

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

.control-card-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.control-card-title i {
    font-style: normal;
    color: var(--accent-primary);
}

/* Status Banner / Card */
.status-card {
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.info-banner {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    font-size: 11px;
    line-height: 1.5;
    color: var(--text-secondary);
    box-shadow: var(--shadow-sm);
}

/* Collapsible Photo Notes Card */
.photo-notes-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-top: 4px;
    transition: all 0.2s ease;
}

.photo-notes-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #f8fafc;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s ease;
}

.photo-notes-header:hover {
    background: #f1f5f9;
}

.photo-notes-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.photo-notes-title svg {
    color: var(--accent-primary);
    flex-shrink: 0;
}

.photo-notes-toggle {
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-muted);
    transition: color 0.15s ease;
}

.photo-notes-header:hover .photo-notes-toggle {
    color: var(--accent-primary);
}

.photo-notes-body {
    padding: 10px 12px;
    border-top: 1px solid var(--border);
    font-size: 11px;
    line-height: 1.6;
    color: var(--text-secondary);
    background: #ffffff;
}

.photo-notes-body p {
    margin-bottom: 5px;
}

.photo-notes-body p:last-child {
    margin-bottom: 0;
}

.photo-notes-body b {
    color: var(--text-primary);
    font-weight: 600;
}

/* Category Quick Filter Pills */
.preset-filter-pills {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.preset-filter-pills::-webkit-scrollbar {
    display: none;
}

.preset-pill {
    flex-shrink: 0;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    background: #f1f5f9;
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.preset-pill:hover {
    background: #e2e8f0;
    color: var(--text-primary);
}

.preset-pill.active {
    background: var(--accent-primary);
    color: #ffffff;
    border-color: var(--accent-primary);
    box-shadow: 0 2px 6px rgba(45, 122, 94, 0.25);
}

/* Accordion Preset Sections */
.preset-accordion-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.preset-category-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: border-color 0.18s ease;
}

.preset-category-section.has-active {
    border-color: var(--accent-primary);
}

.preset-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    background: #f8fafc;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s ease;
}

.preset-category-header:hover {
    background: #f1f5f9;
}

.preset-category-info {
    display: flex;
    align-items: center;
    gap: 7px;
}

.preset-category-title {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-primary);
}

.preset-category-count {
    font-size: 9.5px;
    font-weight: 600;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.05);
    padding: 1px 6px;
    border-radius: 10px;
}

.preset-category-toggle {
    display: flex;
    align-items: center;
}

.preset-category-toggle .chevron-icon {
    font-size: 11px;
    color: var(--text-muted);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    transform: rotate(-90deg);
}

.preset-category-section.open .preset-category-toggle .chevron-icon {
    transform: rotate(0deg);
}

.preset-category-body {
    display: none;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid var(--border);
    background: #ffffff;
}

.preset-category-section.open .preset-category-body {
    display: flex;
}

.preset-category-desc {
    font-size: 10.5px;
    color: var(--text-muted);
    line-height: 1.4;
    margin-bottom: 2px;
}

/* Recipes Grid */
.recipes-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.recipe-chip {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    padding: 9px 11px;
    cursor: pointer;
    transition: all 0.16s ease;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.recipe-chip:hover {
    background: #ffffff;
    border-color: var(--accent-primary);
    box-shadow: 0 3px 12px rgba(45, 122, 94, 0.1);
    transform: translateY(-1px);
}

.recipe-chip.active {
    background: #f0fdf4;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 1px var(--accent-primary), 0 3px 12px rgba(45, 122, 94, 0.1);
}

.recipe-chip-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.recipe-chip-badge {
    align-self: flex-start;
    font-size: 10px;
    font-weight: 700;
    color: var(--accent-primary);
    background: rgba(45, 122, 94, 0.1);
    padding: 1px 6px;
    border-radius: 4px;
}

.recipe-chip-code {
    font-size: 9px;
    font-weight: 700;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.05);
    padding: 1px 5px;
    border-radius: 3px;
    font-family: monospace;
}

.recipe-chip-title {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-primary);
}

.recipe-chip-desc {
    font-size: 10.5px;
    color: var(--text-secondary);
    line-height: 1.35;
}

/* Base Film Simulations Picker */
.sim-picker {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.sim-option {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    padding: 7px 9px;
    cursor: pointer;
    transition: all 0.14s ease;
}

.sim-option:hover {
    background: #ffffff;
    border-color: var(--accent-primary);
}

.sim-option.active {
    background: #f0fdf4;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 1px var(--accent-primary);
}

.sim-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sim-name {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-primary);
}

.sim-badge {
    font-size: 9px;
    color: var(--text-muted);
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Tone Curve Visualizer */
.tone-curve-container {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px;
    margin-bottom: 12px;
}

#toneCurveCanvas {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 4px;
}

.tone-curve-meta {
    display: flex;
    flex-direction: column;
    font-size: 10px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Sliders */
.slider-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.slider-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.slider-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.slider-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
}

.slider-val {
    font-size: 11px;
    font-weight: 700;
    color: var(--accent-primary);
    font-variant-numeric: tabular-nums;
}

/* Modified Parameter Indicator (Amber Dot) */
.slider-label-row.is-modified .slider-name {
    color: var(--text-primary);
    font-weight: 700;
}

.slider-label-row.is-modified .slider-name::after {
    content: "";
    display: inline-block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background-color: var(--accent-amber);
    margin-left: 5px;
    box-shadow: 0 0 3px rgba(194, 106, 29, 0.4);
}

.slider-label-row.is-modified .slider-val {
    color: var(--accent-amber);
}

.fuji-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 5px;
    border-radius: 999px;
    background: #e2e8f0;
    outline: none;
    transition: background 0.15s ease;
}

.fuji-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-primary);
    border: 2px solid #ffffff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: transform 0.1s ease;
}

.fuji-slider::-webkit-slider-thumb:active {
    transform: scale(1.15);
}

.fuji-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-primary);
    border: 2px solid #ffffff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

/* White Balance 2D Visualizer */
.wb-visualizer {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wb-grid-box {
    position: relative;
    width: 90px;
    height: 90px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

#wbIndicatorCanvas {
    width: 100%;
    height: 100%;
}

.wb-axis-label {
    position: absolute;
    font-size: 8px;
    font-weight: 700;
    color: var(--text-muted);
}

.wb-axis-label.top { top: 2px; left: 50%; transform: translateX(-50%); color: var(--accent-sky); }
.wb-axis-label.bottom { bottom: 2px; left: 50%; transform: translateX(-50%); color: var(--accent-amber); }
.wb-axis-label.left { left: 2px; top: 50%; transform: translateY(-50%); color: var(--accent-primary); }
.wb-axis-label.right { right: 2px; top: 50%; transform: translateY(-50%); color: var(--accent-coral); }

.wb-shifts-controls {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Segmented Control */
.segmented-control {
    display: flex;
    background: #eef2f6;
    border-radius: var(--radius-sm);
    padding: 2px;
    gap: 2px;
    border: 1px solid #e2e8f0;
}

.segmented-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    padding: 6px 0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.12s ease;
}

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

.segmented-btn.active {
    background: #ffffff;
    color: var(--accent-primary);
    font-weight: 700;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Sidebar Bottom Footer */
.sidebar-footer {
    padding: 12px 14px;
    background: #ffffff;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.02);
}

.sidebar-footer .btn {
    flex: 1;
    padding: 10px;
}

/* HSL Channel Selector & Controls */
.hsl-channel-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-bottom: 8px;
}

.hsl-color-pill {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 6px 4px;
    font-size: 11px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    position: relative;
}

.hsl-color-pill:hover {
    border-color: var(--accent-primary);
    background: var(--bg-card-hover);
}

.hsl-color-pill.active {
    border-color: var(--accent-primary);
    background: var(--accent-soft);
    color: var(--accent-primary);
    box-shadow: 0 0 0 1px var(--accent-primary);
}

.hsl-color-pill.has-mod::after {
    content: '';
    position: absolute;
    top: 3px;
    right: 3px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #d97706;
}

.hsl-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.hsl-name {
    line-height: 1;
}

.btn-text-action {
    background: none;
    border: none;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    padding: 3px 6px;
    border-radius: 4px;
    transition: all 0.15s ease;
    line-height: 1;
}

.btn-text-action:hover {
    color: var(--accent-primary);
    background: var(--accent-soft);
}

/* Frame Style Selector & Viewport Toggle */
#btnToggleViewportFrame.active {
    background: var(--accent-primary) !important;
    color: #ffffff !important;
    border-color: var(--accent-primary) !important;
    box-shadow: 0 0 0 2px rgba(45, 122, 94, 0.25);
}

.frame-style-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 8px;
}

.frame-option-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    padding: 10px;
    cursor: pointer;
    transition: all 0.16s ease;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    user-select: none;
}

.frame-option-card:hover {
    background: #ffffff;
    border-color: var(--accent-primary);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.04);
}

.frame-option-card.active {
    background: #f0fdf4;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 1.5px var(--accent-primary);
}

.frame-option-card[data-style="none"] {
    grid-column: span 2;
}

.frame-option-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.frame-option-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.frame-option-desc {
    font-size: 9.5px;
    color: var(--text-muted);
    line-height: 1.35;
}

.frame-option-badge {
    font-size: 8.5px;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-secondary);
}

.frame-option-card.active .frame-option-badge {
    background: var(--accent-primary);
    color: #ffffff;
}

/* Responsive & Mobile Optimizations */
@media (max-width: 768px) {
    .hide-on-mobile {
        display: none !important;
    }

    body {
        overflow: auto;
        height: auto;
    }

    .app-header {
        height: 48px;
        padding: 0 10px;
    }

    .brand-title {
        font-size: 14px;
    }

    .btn {
        padding: 6px 10px;
        font-size: 11px;
    }

    .app-container {
        flex-direction: column;
        height: auto;
        overflow: visible;
    }

    /* Sticky Canvas Viewport on Mobile */
    .viewport-area {
        height: 42vh;
        min-height: 240px;
        max-height: 360px;
        position: sticky;
        top: 0;
        z-index: 30;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    }

    .viewport-toolbar {
        height: 34px;
        padding: 0 10px;
    }

    .viewport-canvas-container {
        padding: 6px;
        height: calc(42vh - 34px);
    }

    #canvasWrapper {
        max-width: 100%;
        max-height: 100%;
    }

    #renderCanvas {
        max-width: 100%;
        max-height: calc(42vh - 46px);
        width: auto;
        height: auto;
    }

    .empty-upload-prompt {
        padding: 16px 14px;
        max-width: 92%;
        margin: auto;
    }

    .empty-upload-icon {
        font-size: 32px;
        margin-bottom: 4px;
    }

    .empty-upload-title {
        font-size: 15px;
        margin-bottom: 4px;
    }

    .empty-upload-desc {
        font-size: 11px;
        line-height: 1.4;
        margin-bottom: 12px;
    }

    .btn-large {
        padding: 8px 18px;
        font-size: 13px;
    }

    .split-handle {
        width: 40px;
        height: 40px;
        font-size: 12px;
    }

    /* Mobile Controls Sidebar */
    .control-sidebar {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--border);
        height: auto;
        flex: 1;
        overflow: visible;
    }

    .sidebar-tabs {
        position: sticky;
        top: 42vh;
        z-index: 25;
    }

    .sidebar-tab {
        padding: 10px 4px;
        font-size: 11px;
    }

    .sidebar-content {
        padding: 12px;
        overflow-y: visible;
    }

    .recipes-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .recipe-chip {
        padding: 8px;
    }

    .recipe-chip-title {
        font-size: 11px;
    }

    .fuji-slider {
        height: 6px;
    }

    .fuji-slider::-webkit-slider-thumb {
        width: 22px;
        height: 22px;
    }

    .segmented-btn {
        padding: 8px 0;
    }

    /* Sticky Mobile Footer */
    .sidebar-footer {
        position: sticky;
        bottom: 0;
        z-index: 40;
        background: rgba(255, 255, 255, 0.96);
        backdrop-filter: blur(10px);
        padding: 10px 12px;
        box-shadow: 0 -3px 12px rgba(0, 0, 0, 0.05);
    }
}
