/* ─── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
img { display: block; max-width: 100%; }
button { cursor: pointer; border: none; background: none; font: inherit; }
input[type="range"] { cursor: pointer; }

/* ─── Base ───────────────────────────────────────────────── */
html { height: 100%; }
body {
  min-height: 100dvh;
  background-color: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  transition: background-color var(--t-theme), color var(--t-theme);
}

/* ─── Glass mixin (applied via class) ───────────────────── */
.glass {
  background: var(--panel-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.4);
  border: var(--glass-border);
  box-shadow: var(--shadow-panel);
}

/* ─── Header ─────────────────────────────────────────────── */
.site-header {
  background: var(--header-bg);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  border-bottom: 1px solid var(--panel-border);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: background var(--t-theme);
}
.header-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: var(--sp-3) var(--sp-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo { display: flex; align-items: baseline; gap: 6px; }
.logo-brand {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 0.08em;
  color: var(--fuji-orange);
}
.logo-title {
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 0.12em;
  color: var(--text-secondary);
}
.header-nav { display: flex; align-items: center; gap: var(--sp-3); }

/* ─── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-sm);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.03em;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.btn-ghost {
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  background: var(--surface-1);
}
.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text-primary);
  border-color: var(--panel-border);
}
.btn-primary {
  background: var(--fuji-orange);
  color: #fff;
  border: 1px solid transparent;
  font-weight: 600;
}
.btn-primary:hover { background: var(--fuji-orange-lt); }

/* ─── App layout — full-viewport preview ─────────────────── */
.app-layout {
  display: block;
  padding: var(--sp-4) var(--sp-4) 120px;
  min-height: calc(100dvh - 56px);
  background: var(--bg-page);
  background-image: none;
}

/* ─── Panels (glass) ─────────────────────────────────────── */
.panel {
  background: var(--panel-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.4);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow-panel);
  border-radius: var(--r-xl);
  /* No overflow: hidden — it breaks position:sticky on .panel-header */
  transition: background var(--t-theme), border-color var(--t-theme), box-shadow var(--t-theme);
}

/* Clip only the grid/list rows, not the whole panel */
.film-sim-grid,
.parameter-list {
  border-radius: 0 0 var(--r-xl) var(--r-xl);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface-1);
  position: sticky;
  top: 0; /* relative to the panel's own scroll container, not the viewport */
  z-index: 10;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.panel-icon {
  color: var(--fuji-orange);
  flex-shrink: 0;
  opacity: 0.85;
}
.panel-title {
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* Side panels hidden everywhere — content lives in bottom sheets */
.panel-film,
.panel-params { display: none; }

/* Center panel */
.panel-preview {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  background: var(--bg-page);
  background-image: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: none;
  box-shadow: none;
  border-radius: 0;
  overflow: visible;
  max-width: 1200px;
  margin: 0 auto;
}

/* ─── Film sim cards ─────────────────────────────────────── */
.film-sim-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border-subtle);
}
.film-sim-card {
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-3) var(--sp-2);
  transition: background var(--t-fast);
  position: relative;
  text-align: center;
}
.film-sim-card:hover { background: var(--panel-hover); }
.film-sim-card.is-active {
  background: var(--surface-2);
  outline: 2px solid var(--fuji-orange);
  outline-offset: -2px;
  z-index: 1;
}
.film-sim-card.is-gated { opacity: 0.3; pointer-events: none; }

.card-swatch {
  width: 24px;
  height: 6px;
  border-radius: 2px;
  background: var(--swatch, var(--text-muted));
}
.card-short {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  line-height: 1.2;
  font-weight: 600;
}
.film-sim-card.is-active .card-short {
  color: var(--fuji-orange);
}
.card-name {
  font-size: 9px;
  color: var(--text-muted);
  line-height: 1.3;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── Parameter list ─────────────────────────────────────── */
.parameter-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--border-subtle);
}
.param-row {
  background: transparent;
  padding: var(--sp-3) var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  transition: background var(--t-fast);
}
.param-row:hover { background: var(--panel-hover); }
.param-row.is-gated { opacity: 0.3; pointer-events: none; }

.param-header {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.param-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  flex: 1;
}
.param-value {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fuji-orange);
  min-width: 24px;
  text-align: right;
}
.param-info {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  background: var(--surface-1);
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.param-info:hover { color: var(--text-primary); border-color: var(--fuji-orange); }

/* Range sliders */
.param-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 3px;
  background: var(--surface-2);
  border-radius: 2px;
  outline: none;
  accent-color: var(--fuji-orange);
}
.param-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--fuji-orange);
  border: 2px solid var(--panel-bg-solid);
  box-shadow: 0 0 0 1px var(--fuji-orange);
  transition: background var(--t-fast);
}
.param-slider::-webkit-slider-thumb:hover { background: var(--fuji-orange-lt); }
.param-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--fuji-orange);
  border: 2px solid var(--panel-bg-solid);
}

.param-ticks {
  position: relative;
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
  padding: 0 2px;
}
.param-ticks .tick-zero {
  position: absolute;
  transform: translateX(-50%);
  --thumb-half: 8px;
  left: calc(var(--zero-pct) * (100% - 2 * var(--thumb-half)) + var(--thumb-half));
}

/* Select-style option buttons */
.param-options { display: flex; gap: var(--sp-2); }
.param-option {
  flex: 1;
  padding: var(--sp-1) var(--sp-2);
  border-radius: var(--r-sm);
  border: 1px solid var(--border-subtle);
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--surface-1);
  transition: all var(--t-fast);
  text-align: center;
}
.param-option:hover { border-color: var(--fuji-silver); color: var(--text-primary); }
.param-option.is-active {
  background: var(--fuji-orange);
  border-color: var(--fuji-orange);
  color: #fff;
  font-weight: 600;
}

/* ─── Preview panel contents ─────────────────────────────── */
.photo-picker {
  display: flex;
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--panel-border);
  background: var(--panel-bg-solid);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.photo-type-btn {
  flex: 1;
  padding: var(--sp-2) var(--sp-3);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-right: 1px solid var(--border-subtle);
  transition: all var(--t-fast);
  text-align: center;
}
.photo-type-btn:last-child { border-right: none; }
.photo-type-btn:hover { color: var(--text-primary); background: var(--panel-hover); }
.photo-type-btn.is-active {
  color: var(--fuji-orange);
  background: var(--surface-2);
  font-weight: 600;
}
.photo-type-btn--upload::after {
  content: ' ↑';
  font-size: 10px;
  opacity: 0.6;
}

/* ─── Filmstrip frame ────────────────────────────────────── */
.filmstrip-frame {
  display: flex;
  border-radius: var(--r-xl);
  overflow: hidden;
  background: var(--filmstrip-bg);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow-panel), 0 0 0 1px rgba(255,255,255,0.03) inset;
  transition: background var(--t-theme);
}
.strip-rail {
  width: 18px;
  flex-shrink: 0;
  background: var(--filmstrip-bg);
  background-image:
    repeating-linear-gradient(
      to bottom,
      transparent 0px, transparent 6px,
      var(--filmstrip-rail) 6px, var(--filmstrip-rail) 7px,
      transparent 7px, transparent 12px,
      color-mix(in srgb, var(--filmstrip-rail) 50%, transparent) 12px,
      color-mix(in srgb, var(--filmstrip-rail) 50%, transparent) 18px,
      transparent 18px, transparent 22px
    );
  transition: background var(--t-theme);
}

.photo-figure {
  flex: 1;
  position: relative;
  overflow: hidden;
  aspect-ratio: 3/2;
  max-height: calc(100dvh - 56px - 160px);
  background: var(--preview-bg);
  transition: background var(--t-theme);
}
.photo-img {
  position: absolute;
  object-fit: contain;
  display: block;
}
/* photo-after sits inside .photo-figure and needs the mat padding */
.photo-after {
  inset: var(--preview-pad);
  width: calc(100% - var(--preview-pad) * 2);
  height: calc(100% - var(--preview-pad) * 2);
  z-index: 0;
}
/* photo-before sits inside .comparison-overlay which is already inset */
.photo-before {
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* ─── Hover magnifier ────────────────────────────────────── */
.mag-lens {
  position: absolute;
  border-radius: 50%;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5), 0 1px 0 rgba(255,255,255,0.08) inset;
  z-index: 10;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.mag-lens.is-visible { opacity: 1; }
.mag-active { cursor: none; }

/* ─── Comparison overlay ─────────────────────────────────── */
.comparison-overlay {
  position: absolute;
  inset: var(--preview-pad);
  z-index: 2;
}
.comparison-overlay[hidden] { display: none; }

.divider-handle {
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: ew-resize;
  z-index: 3;
}
.divider-line {
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  width: 2px;
  background: rgba(255,255,255,0.9);
  transform: translateX(-50%);
  box-shadow: 0 0 8px rgba(0,0,0,0.5);
}
.divider-grip {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.95);
  box-shadow: 0 2px 10px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
}
.divider-grip::before,
.divider-grip::after {
  content: '';
  display: block;
  width: 0; height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  position: absolute;
}
.divider-grip::before { border-right: 6px solid #333; left: 7px; }
.divider-grip::after  { border-left: 6px solid #333;  right: 7px; }

/* ─── Custom upload empty state ──────────────────────────── */
.custom-upload-prompt {
  position: absolute;
  inset: var(--preview-pad);
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
}
.custom-upload-prompt[hidden] { display: none; }
.custom-upload-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-6);
  border: 1.5px dashed var(--border-subtle);
  border-radius: var(--r-lg);
  color: var(--text-muted);
  background: transparent;
  transition: border-color var(--t-fast), color var(--t-fast), background var(--t-fast);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
}
.custom-upload-btn:hover {
  border-color: var(--fuji-orange);
  color: var(--text-primary);
  background: var(--panel-hover);
}
.custom-upload-btn svg { width: 32px; height: 32px; opacity: 0.7; }

/* ─── Options sheet ──────────────────────────────────────── */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--border-subtle);
}
.option-row {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  background: var(--panel-bg-solid);
  cursor: pointer;
  transition: background var(--t-fast);
}
.option-row:hover { background: var(--panel-hover); }
.option-info { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.option-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}
.option-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}
.option-checkbox { position: absolute; opacity: 0; width: 0; height: 0; }

/* ─── Preview footer (reupload only) ────────────────────── */
.preview-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  width: fit-content;
}

/* Toggle */
.comparison-toggle {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  cursor: pointer;
  user-select: none;
}
.comparison-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-track {
  width: 32px; height: 18px;
  border-radius: 9px;
  background: var(--surface-2);
  position: relative;
  transition: background var(--t-base);
  flex-shrink: 0;
}
.toggle-track::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform var(--t-base), background var(--t-base);
}
.comparison-toggle input:checked + .toggle-track,
.option-checkbox:checked + .toggle-track { background: var(--fuji-orange); }
.comparison-toggle input:checked + .toggle-track::after,
.option-checkbox:checked + .toggle-track::after {
  transform: translateX(14px);
  background: #fff;
}
.toggle-text { font-size: 12px; color: var(--text-secondary); }

.disclaimer {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  margin-left: auto;
}
.btn-reupload { font-size: 12px; padding: var(--sp-1) var(--sp-3); }
.btn-reupload[hidden] { display: none; }

/* ─── Recipe save ────────────────────────────────────────── */
.recipe-save {
  background: var(--panel-bg-solid);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: 1px solid var(--panel-border);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.recipe-name-input {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--r-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: var(--sp-2) var(--sp-3);
  width: 100%;
  outline: none;
  transition: border-color var(--t-fast), background var(--t-theme);
}
.recipe-name-input::placeholder { color: var(--text-muted); }
.recipe-name-input:focus { border-color: var(--fuji-orange); }
.recipe-actions { display: flex; gap: var(--sp-3); }
.recipe-actions .btn-primary { flex: 1; justify-content: center; }

.btn-export {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-sm);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.btn-export:hover {
  background: var(--surface-2);
  color: var(--text-primary);
  border-color: var(--fuji-orange);
}

/* ─── Theme FAB ──────────────────────────────────────────── */
.theme-fab {
  position: fixed;
  bottom: var(--sp-6);
  right: var(--sp-6);
  z-index: 150;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--fab-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--fab-border);
  box-shadow: 0 4px 16px var(--shadow-color);
  color: var(--fab-color);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
}
.theme-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px var(--shadow-color);
}
.theme-fab:active { transform: scale(0.95); }

/* Show sun in dark mode, moon in light mode */
[data-theme="dark"]  .icon-moon { display: none; }
[data-theme="dark"]  .icon-sun  { display: block; }
[data-theme="light"] .icon-sun  { display: none; }
[data-theme="light"] .icon-moon { display: block; }

/* ─── Mobile nav bar (pill) — shown at all sizes ─────────── */
.mobile-nav {
  display: flex;
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + var(--sp-4));
  left: 50%;
  transform: translateX(-50%);
  z-index: 290;
  background: var(--panel-bg-solid);
  border: 1px solid var(--panel-border);
  box-shadow: 0 4px 24px var(--shadow-color);
  border-radius: 999px;
  padding: var(--sp-2) var(--sp-3);
  justify-content: center;
  align-items: center;
  gap: var(--sp-1);
  width: max-content;
}

.mobile-nav-divider {
  width: 1px;
  height: 24px;
  background: var(--border-subtle);
  flex-shrink: 0;
  margin: 0 var(--sp-1);
}

.mobile-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: var(--sp-2) var(--sp-4);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  transition: background var(--t-fast), color var(--t-fast);
  white-space: nowrap;
}
.mobile-nav-btn:hover,
.mobile-nav-btn.is-active {
  background: var(--surface-2);
  color: var(--fuji-orange);
}
.mobile-nav-btn svg { flex-shrink: 0; }

/* Theme FAB — right side, same baseline as the pill */
.theme-fab {
  bottom: calc(env(safe-area-inset-bottom, 0px) + var(--sp-4) + 10px);
  right: var(--sp-4);
}

/* ─── Bottom sheets ──────────────────────────────────────── */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 300;
  opacity: 0;
  transition: opacity var(--t-base);
}
.sheet-backdrop.is-visible { opacity: 1; }
.sheet-backdrop[hidden] { display: none; }

.bottom-sheet {
  position: fixed;
  bottom: var(--sp-3);
  left: 50%;
  transform: translateX(-50%) translateY(calc(100% + var(--sp-3)));
  width: min(480px, calc(100% - var(--sp-6) * 2));
  z-index: 310;
  max-height: 78dvh;
  border-radius: var(--r-xl);
  background: var(--panel-bg-solid);
  border: 1px solid var(--panel-border);
  box-shadow: 0 -4px 40px var(--shadow-color);
  display: flex;
  flex-direction: column;
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  will-change: transform;
}
.bottom-sheet[hidden] { display: none; }
.bottom-sheet.is-open { transform: translateX(-50%) translateY(0); }

.sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--border-subtle);
  margin: 10px auto 0;
  flex-shrink: 0;
}

.sheet-header {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.sheet-title {
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  text-transform: uppercase;
  flex: 1;
}
.sheet-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--t-fast), color var(--t-fast);
}
.sheet-close:hover { background: var(--surface-2); color: var(--text-primary); }

.sheet-body {
  overflow-y: auto;
  flex: 1;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* ─── Tooltip ────────────────────────────────────────────── */
.tooltip {
  position: fixed;
  z-index: 1000;
  max-width: 240px;
  background: var(--panel-bg-solid);
  border: 1px solid var(--panel-border);
  border-radius: var(--r-md);
  padding: var(--sp-2) var(--sp-3);
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-primary);
  box-shadow: 0 4px 20px var(--shadow-color);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--t-fast);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.tooltip.is-visible { opacity: 1; }

/* ─── Modal ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-6);
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: var(--panel-bg);
  backdrop-filter: blur(24px) saturate(1.5);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow-panel);
  border-radius: var(--r-xl);
  padding: var(--sp-8);
  max-width: 480px;
  width: 100%;
  transition: background var(--t-theme);
}
.modal-title {
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: 0.08em;
  color: var(--text-primary);
  margin-bottom: var(--sp-2);
}
.modal-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: var(--sp-6);
  line-height: 1.6;
}

.sensor-list { display: flex; flex-direction: column; gap: var(--sp-2); }
.sensor-btn {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  transition: all var(--t-fast);
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}
.sensor-btn:hover { border-color: var(--fuji-orange); background: var(--surface-2); }
.sensor-btn.is-active { border-color: var(--fuji-orange); }
.sensor-gen {
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 0.06em;
  color: var(--text-primary);
}
.sensor-models {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ─── Responsive ─────────────────────────────────────────── */

/* Recipe save lives in the sheet everywhere */
.panel-preview .recipe-save { display: none; }

/* Sheet internals */
.bottom-sheet .film-sim-grid { grid-template-columns: repeat(4, 1fr); border-radius: 0; }
.bottom-sheet .parameter-list { border-radius: 0; }
.recipe-save--mobile {
  border: none;
  border-radius: 0;
  background: transparent;
  padding: var(--sp-4);
}

/* ── Phone ≤ 540px ─────────────────────────────────────────── */
@media (max-width: 540px) {
  .app-layout { padding: var(--sp-3) var(--sp-3) 120px; }
  .header-inner { padding: var(--sp-2) var(--sp-3); }
  .modal-overlay { padding: var(--sp-3); }
  .modal { padding: var(--sp-5); }
  .modal-title { font-size: 22px; }
  .bottom-sheet .film-sim-grid { grid-template-columns: repeat(3, 1fr); }
  .mobile-nav-btn { padding: var(--sp-2) var(--sp-3); }
}

/* ── Small phone ≤ 390px ─────────────────────────────────── */
@media (max-width: 390px) {
  .logo-brand { font-size: 19px; }
  .logo-title { font-size: 14px; }
  .header-nav .btn { font-size: 11px; padding: var(--sp-1) var(--sp-2); }
  .mobile-nav-btn { padding: var(--sp-2) var(--sp-2); font-size: 9px; }
}
