:root {
    --color-primary: #0d9488;
    --color-primary-light: #ccfbf1;
    --color-primary-hover: #0f766e;
    --color-bg: #f5f5f5;
    --color-surface: #ffffff;
    --color-border: #e5e7eb;
    --color-text: #1f2937;
    --color-text-secondary: #6b7280;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.08);
    --radius: 12px;
    --radius-sm: 8px;
    --header-brand-height: 38px;
    --header-main-height: 72px;
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
    --color-brand-bar-bg: #eef7f6;
    --color-brand-accent: #0d9488;
}

[data-theme="dark"] {
    --color-bg: #111827;
    --color-surface: #1f2937;
    --color-border: #374151;
    --color-text: #f9fafb;
    --color-text-secondary: #9ca3af;
    --color-brand-bar-bg: #0f172a;
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: var(--font-family);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

input, select {
    font-family: inherit;
}

.site-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}

.header-brand {
    height: var(--header-brand-height);
    background: var(--color-brand-bar-bg);
    border-bottom: 1px solid var(--color-border);
}

.header-brand-inner,
.header-main-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
}

.header-brand-inner {
    justify-content: space-between;
    gap: 12px;
}

.header-brand-start {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.header-main-inner {
    justify-content: center;
}

.brand-home {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--color-brand-accent);
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
}

.brand-home:hover {
    opacity: 0.85;
}

.brand-mark {
    display: flex;
}

.brand-tagline {
    font-size: 12px;
    color: var(--color-text-secondary);
    flex-shrink: 0;
}

.brand-tools {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    overflow-x: auto;
}

.brand-tool {
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    color: var(--color-text-secondary);
    white-space: nowrap;
    border: 1px solid transparent;
}

.brand-tool:hover {
    color: var(--color-brand-accent);
}

.brand-tool.is-current {
    color: var(--color-brand-accent);
    background: var(--color-surface);
    border-color: rgba(13, 148, 136, 0.35);
    font-weight: 600;
}

.header-main {
    height: var(--header-main-height);
    background: var(--color-surface);
}

.tool-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.tool-logo-icon {
    color: var(--color-primary);
    display: flex;
}

.tool-logo-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-align: center;
}

.tool-logo-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.2;
}

.tool-logo-desc {
    font-size: 13px;
    color: var(--color-text-secondary);
}

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

.icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-secondary);
}

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

.site-main {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 32px 24px 48px;
}

.editor-section {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.preview-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.preview-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 100%;
}

.preview-card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px 16px;
}

.preview-card-title {
    font-size: 14px;
    font-weight: 600;
}

.preview-card-meta {
    font-size: 12px;
    color: var(--color-text-secondary);
    font-variant-numeric: tabular-nums;
}

.preview-card-hint {
    font-size: 12px;
    color: var(--color-text-secondary);
}

.alert {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    line-height: 1.6;
}

.alert--warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

.alert--warning a {
    color: #b45309;
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.alert--warning a:hover {
    color: #78350f;
}

[data-theme="dark"] .alert--warning {
    background: rgba(251, 191, 36, 0.12);
    color: #fcd34d;
    border-color: rgba(251, 191, 36, 0.35);
}

[data-theme="dark"] .alert--warning a {
    color: #fde68a;
}

[data-theme="dark"] .alert--warning a:hover {
    color: #fff;
}

.crop-toolbar {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.crop-zoom-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.crop-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.size-info-card {
    padding: 10px 12px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--color-text-secondary);
    line-height: 1.7;
}

.size-info-card strong {
    color: var(--color-text);
}

.size-info-mm {
    color: var(--color-primary);
}

.check-block {
    margin-top: 4px;
}

.settings-field--full {
    grid-column: 1 / -1;
}

.color-picker--block {
    width: 100%;
    height: 40px;
}

#bgStatus.is-error {
    color: #dc2626;
}

[data-theme="dark"] #bgStatus.is-error {
    color: #f87171;
}

.crop-stage {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 320px;
    background: #0f172a;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.crop-stage canvas {
    display: block;
    width: 100%;
    height: auto;
    cursor: grab;
    touch-action: none;
}

.crop-stage canvas.is-dragging {
    cursor: grabbing;
}

.paper-stage {
    position: relative;
    width: 100%;
    background: #cbd5e1;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    /* 高度由 JS 按相纸比例设置，铺满内容区宽度 */
}

.paper-stage canvas {
    display: block;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    cursor: default;
    background: #fff;
}

.crop-empty,
.paper-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-secondary);
    font-size: 13px;
    pointer-events: none;
    z-index: 1;
}

.paper-empty {
    background: var(--color-bg);
}

.crop-empty.is-hidden,
.paper-empty.is-hidden {
    display: none;
}

.controls-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.control-panel {
    background: var(--color-surface);
    border-radius: var(--radius);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
}

.panel-heading {
    font-size: 14px;
    font-weight: 600;
}

.field-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-secondary);
    display: block;
    margin-bottom: 6px;
}

.field-hint {
    font-size: 12px;
    color: var(--color-text-secondary);
    line-height: 1.5;
}

.field-row-label {
    font-size: 12px;
    color: var(--color-text-secondary);
    min-width: 36px;
}

.slider-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.range-input {
    flex: 1;
    accent-color: var(--color-primary);
}

.range-value {
    font-size: 13px;
    color: var(--color-text-secondary);
    min-width: 42px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

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

.settings-field--pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.select-input,
.text-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 13px;
    outline: none;
}

.select-input:focus,
.text-input:focus {
    border-color: var(--color-primary);
}

.full-width {
    width: 100%;
}

.color-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.color-picker {
    width: 42px;
    height: 36px;
    padding: 2px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    cursor: pointer;
}

.check-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--color-text);
    cursor: pointer;
    user-select: none;
}

.check-inline input {
    accent-color: var(--color-primary);
}

.upload-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 13px;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}

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

.upload-btn--block {
    width: 100%;
}

.action-bar {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 18px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.action-bar-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.btn {
    padding: 10px 28px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

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

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

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

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

.btn-secondary:hover {
    background: var(--color-bg);
}

.site-footer {
    --footer-bg: #1e293b;
    --footer-text: #f1f5f9;
    --footer-text-muted: #94a3b8;
    --footer-border: #334155;
    --footer-card-bg: #273449;
    background: var(--footer-bg);
    color: var(--footer-text);
    margin-top: auto;
}

.footer-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px 24px;
}

.footer-main {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 40px;
}

.footer-about {
    flex: 1;
    min-width: 0;
}

.footer-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--footer-text);
}

.footer-desc {
    font-size: 14px;
    color: var(--footer-text-muted);
    line-height: 1.8;
    max-width: 560px;
}

.footer-qrcodes {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    flex-shrink: 0;
}

.footer-qrcode-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.footer-qrcode-box {
    width: 108px;
    height: 108px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--footer-card-bg);
    border: 1px solid var(--footer-border);
}

.footer-qrcode-box img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.footer-qrcode-box.is-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    border-style: dashed;
    background: rgba(255, 255, 255, 0.03);
}

.footer-qrcode-placeholder {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--footer-text-muted);
    opacity: 0.7;
}

.footer-qrcode-label {
    font-size: 12px;
    color: var(--footer-text-muted);
    text-align: center;
    white-space: nowrap;
}

.footer-bottom {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--footer-border);
    text-align: center;
}

.footer-copyright {
    font-size: 12px;
    color: var(--footer-text-muted);
}

.preview-stage {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 320px;
    background: #0f172a;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.preview-stage--checker {
    background-color: #e5e7eb;
    background-image:
        linear-gradient(45deg, #d1d5db 25%, transparent 25%),
        linear-gradient(-45deg, #d1d5db 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #d1d5db 75%),
        linear-gradient(-45deg, transparent 75%, #d1d5db 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}

[data-theme="dark"] .preview-stage--checker {
    background-color: #1f2937;
    background-image:
        linear-gradient(45deg, #374151 25%, transparent 25%),
        linear-gradient(-45deg, #374151 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #374151 75%),
        linear-gradient(-45deg, transparent 75%, #374151 75%);
}

.preview-image {
    display: block;
    max-width: 100%;
    max-height: 520px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.preview-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-secondary);
    font-size: 13px;
    pointer-events: none;
    z-index: 1;
}

.preview-empty.is-hidden {
    display: none;
}

.processing-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(15, 23, 42, 0.72);
    color: #f8fafc;
}

.processing-overlay[hidden] {
    display: none !important;
}

.processing-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 255, 255, 0.25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.processing-text {
    font-size: 13px;
}

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

.alert--info {
    background: #ecfeff;
    color: #155e75;
    border: 1px solid #a5f3fc;
}

.alert--info a {
    color: #0e7490;
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 2px;
}

[data-theme="dark"] .alert--info {
    background: rgba(34, 211, 238, 0.12);
    color: #67e8f9;
    border-color: rgba(34, 211, 238, 0.35);
}

[data-theme="dark"] .alert--info a {
    color: #a5f3fc;
}

#processStatus.is-error {
    color: #dc2626;
}

[data-theme="dark"] #processStatus.is-error {
    color: #f87171;
}

.preview-stage--composite {
    background: var(--color-bg);
}

.composite-canvas {
    display: block;
    max-width: 100%;
    max-height: 520px;
    width: auto;
    height: auto;
}

.composite-canvas[hidden] {
    display: none;
}

.control-panel--bg.is-disabled {
    opacity: 0.72;
}

.control-panel--bg .bg-panel-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.bg-tabs {
    display: flex;
    gap: 8px;
    padding: 4px;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
}

.bg-tab {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--color-text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
    white-space: nowrap;
}

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

.bg-tab.is-active {
    background: var(--color-surface);
    color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

.bg-tab-panels {
    min-height: 120px;
}

.bg-tab-panel {
    display: none;
}

.bg-tab-panel.is-active {
    display: block;
}

.bg-presets {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bg-transparent-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 13px;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    align-self: flex-start;
}

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

.bg-transparent-btn.is-active {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 1px var(--color-primary);
}

.bg-transparent-icon {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    background-color: #e5e7eb;
    background-image:
        linear-gradient(45deg, #d1d5db 25%, transparent 25%),
        linear-gradient(-45deg, #d1d5db 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #d1d5db 75%),
        linear-gradient(-45deg, transparent 75%, #d1d5db 75%);
    background-size: 8px 8px;
    background-position: 0 0, 0 4px, 4px -4px, -4px 0;
}

.presets-label {
    font-size: 12px;
    color: var(--color-text-secondary);
}

.presets-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 8px;
}

.preset-swatch {
    width: 100%;
    aspect-ratio: 1;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 0;
    transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
}

.preset-swatch:hover {
    transform: scale(1.06);
}

.preset-swatch.is-active {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 1px var(--color-primary);
}

.custom-color-row {
    margin-top: 4px;
}

.composite-export-row {
    padding-top: 12px;
    border-top: 1px solid var(--color-border);
}

.unsplash-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.unsplash-search-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.unsplash-search-row .text-input.full-width {
    flex: 1;
}

.unsplash-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    min-height: 0;
}

.unsplash-thumb {
    position: relative;
    padding: 0;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 4 / 3;
    background: var(--color-bg);
    transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
}

.unsplash-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.unsplash-thumb:hover {
    transform: scale(1.03);
}

.unsplash-thumb.is-active {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 1px var(--color-primary);
}

.unsplash-attribution {
    font-size: 12px;
    color: var(--color-text-secondary);
}

.unsplash-attribution a {
    color: var(--color-primary);
    text-decoration: none;
}

.unsplash-attribution a:hover {
    text-decoration: underline;
}

.unsplash-credit {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
}

.unsplash-credit-heading {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
}

.unsplash-credit-block {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.unsplash-credit-label {
    font-size: 12px;
    color: var(--color-text-secondary);
}

.unsplash-credit-row {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.unsplash-credit-input {
    flex: 1;
    min-width: 0;
    padding: 8px 10px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
    line-height: 1.5;
    color: var(--color-text);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    resize: vertical;
}

.unsplash-credit-preview-label {
    margin: 0;
    font-size: 12px;
    color: var(--color-text-secondary);
}

.unsplash-credit-preview {
    margin: 0;
    font-size: 13px;
    color: var(--color-text);
}

.unsplash-credit-preview a {
    color: var(--color-primary);
    text-decoration: none;
}

.unsplash-credit-preview a:hover {
    text-decoration: underline;
}

.preview-layout--3 {
    flex-direction: column;
}

.preview-layout--3 .preview-column {
    width: 100%;
}

.workflow-steps {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.workflow-step[hidden] {
    display: none !important;
}

.step-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-size: 12px;
    font-weight: 700;
    vertical-align: middle;
    margin-right: 6px;
}

.cutout-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 4px;
    border-top: 1px solid var(--color-border);
}

.step-action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 4px;
}

.control-panel--status {
    margin-top: 4px;
}

.control-panel--bg {
    margin-top: 16px;
}

.control-panel--compact {
    margin-top: 12px;
    padding: 14px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}

.panel-subheading {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 10px;
}

.composite-tuning {
    margin-top: 12px;
}

.upload-dropzone.is-dragover {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.compare-wrap {
    margin-bottom: 12px;
}

.compare-stage {
    position: relative;
    width: 100%;
    min-height: 320px;
    overflow: hidden;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    user-select: none;
    touch-action: none;
}

.compare-image {
    display: block;
    width: 100%;
    height: auto;
    max-height: 520px;
    object-fit: contain;
}

.compare-image--after {
    width: 100%;
}

.compare-before {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 50%;
    overflow: hidden;
    border-right: 2px solid #fff;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
    z-index: 2;
}

.compare-image--before {
    display: block;
    height: auto;
    max-height: 520px;
    object-fit: contain;
}

.compare-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 36px;
    margin-left: -18px;
    cursor: ew-resize;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
}

.compare-handle-line {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    margin-left: -1px;
    background: #fff;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.35);
}

.compare-handle-knob {
    position: relative;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--color-primary);
    box-shadow: var(--shadow-md);
    z-index: 1;
}

.composite-canvas.is-dragging {
    cursor: grabbing;
}

.composite-canvas:not([hidden]) {
    cursor: grab;
}

.unsplash-hot-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.unsplash-hot-tag {
    padding: 4px 12px;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-bg);
    color: var(--color-text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}

.unsplash-hot-tag:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.unsplash-load-more-row {
    display: flex;
    justify-content: center;
    padding-top: 4px;
}

#quotaHint:not(:empty) {
    color: var(--color-primary);
    font-weight: 500;
}

@media (max-width: 900px) {
    .settings-grid,
    .settings-grid--3 {
        grid-template-columns: 1fr;
    }

    .presets-grid {
        grid-template-columns: repeat(5, 1fr);
    }

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

    .unsplash-credit-row {
        flex-direction: column;
    }

    .bg-tab {
        font-size: 12px;
        padding: 8px 6px;
    }

    .brand-tagline {
        display: none;
    }

    .action-bar {
        justify-content: stretch;
    }

    .action-bar-buttons {
        width: 100%;
    }

    .action-bar-buttons .btn {
        flex: 1;
    }

    .footer-main {
        flex-direction: column;
        gap: 28px;
    }

    .footer-qrcodes {
        align-self: flex-start;
    }
}
