/* ====================================================
   Photo Filter — style.css
   ==================================================== */

/* ── リセット & ベース ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f0f11;
  --surface: #17171b;
  --surface2: #1e1e24;
  --border: rgba(255,255,255,.08);
  --text: #f0f0f3;
  --text-muted: #8a8a9a;
  --accent: #f2a86d;
  --accent-hover: #f6b985;
  --accent-rgb: 242, 168, 109;
  --radius: 12px;
  --inspector-w: 800px;
  --topbar-h: 56px;
  --transition: .18s cubic-bezier(.4,0,.2,1);
  font-size: 14px;
}

html, body { height: 100%; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

/* ====================================================
   APP レイアウト
   ==================================================== */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ====================================================
   TOPBAR
   ==================================================== */
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 200;
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.topbar-logo {
  font-size: 18px;
  color: var(--accent);
}

.topbar-title {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
}

.topbar-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

/* ====================================================
   FILTER DROPDOWN
   ==================================================== */
.filter-dropdown {
  position: relative;
}

.filter-dropdown-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 14px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  white-space: nowrap;
}

.filter-dropdown-btn:hover {
  background: rgba(var(--accent-rgb), .12);
  border-color: rgba(var(--accent-rgb), .4);
}

.filter-dropdown-btn.is-open {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), .12);
}

.filter-badge {
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  font-weight: 600;
  min-width: 20px;
  text-align: center;
}

.filter-dropdown-arrow {
  font-size: 10px;
  color: var(--text-muted);
  transition: transform var(--transition);
}

.filter-dropdown-btn.is-open .filter-dropdown-arrow {
  transform: rotate(180deg);
}

.filter-dropdown-panel {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  min-width: 240px;
  box-shadow: 0 12px 40px rgba(0,0,0,.55);
  z-index: 300;
}

.filter-dropdown-panel.is-open {
  display: block;
  animation: dropdownIn .15s cubic-bezier(.25,.46,.45,.94) both;
}

@keyframes dropdownIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-6px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.filter-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.filter-dropdown-header > span {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
}

.filter-dropdown-actions {
  display: flex;
  gap: 4px;
}

.filter-dropdown-actions button {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}

.filter-dropdown-actions button:hover {
  color: var(--text);
  border-color: var(--text-muted);
  background: var(--surface2);
}

.filter-cat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  user-select: none;
  transition: background var(--transition);
}

.filter-cat-item:hover {
  background: var(--surface2);
}

.filter-cat-item input[type="checkbox"] {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  cursor: pointer;
  flex-shrink: 0;
}

.filter-cat-item .cat-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface2);
  padding: 1px 7px;
  border-radius: 999px;
  min-width: 24px;
  text-align: center;
}

/* ====================================================
   CONTENT AREA
   ==================================================== */
.content-area {
  display: flex;
  flex: 1;
  position: relative;
  overflow: hidden;
}

/* ====================================================
   MAIN
   ==================================================== */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  min-width: 0;
  transition: padding-right .22s cubic-bezier(.25,.46,.45,.94);
}

.main.inspector-open {
  padding-right: var(--inspector-w);
}

/* ====================================================
   INSPECTOR（右ドロワー）
   ==================================================== */
.inspector {
  position: fixed;
  top: var(--topbar-h);
  right: 0;
  width: var(--inspector-w);
  height: calc(100vh - var(--topbar-h));
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 190;
  transform: translateX(100%);
  transition: transform .22s cubic-bezier(.25,.46,.45,.94);
  overflow-y: auto;
  overflow-x: hidden;
}

.inspector.is-open {
  transform: translateX(0);
}

.inspector-inner {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.inspector-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}

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

.inspector-sample-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background var(--transition), border-color var(--transition), color var(--transition), opacity var(--transition);
}

.inspector-sample-btn:hover {
  background: rgba(var(--accent-rgb), .15);
  border-color: rgba(var(--accent-rgb), .45);
}

.inspector-sample-btn:disabled {
  opacity: .6;
  cursor: wait;
}

.inspector-sample-btn.is-loading {
  color: var(--text-muted);
}

.inspector-filter-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}

.inspector-filter-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin: 0;
  flex: 1;
}

.half-filter-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.half-filter-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition), transform var(--transition);
}

.half-filter-btn:hover {
  color: var(--text);
  border-color: rgba(var(--accent-rgb), .45);
  background: rgba(var(--accent-rgb), .12);
}

.half-filter-btn.active {
  color: #fff;
  border-color: rgba(var(--accent-rgb), .8);
  background: var(--accent);
}

.half-filter-icon {
  position: relative;
  display: block;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-radius: 3px;
  overflow: hidden;
}

.half-filter-icon::before,
.half-filter-icon::after {
  content: '';
  position: absolute;
}

.half-filter-icon--full {
  background: transparent;
}

.half-filter-icon--horizontal {
  background: linear-gradient(90deg, currentColor 0 50%, transparent 50% 100%);
}

.half-filter-icon--vertical {
  background: linear-gradient(180deg, currentColor 0 50%, transparent 50% 100%);
}

.half-filter-icon--diagonal {
  background: linear-gradient(135deg, currentColor 0 49%, transparent 49% 100%);
}

.half-filter-fa-icon {
  font-size: 16px;
  line-height: 1;
}

.preview-original-overlay {
  position: absolute;
  inset: 0;
  display: none;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  z-index: 6;
}

.inspector-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 16px;
  flex-shrink: 0;
  transition: color var(--transition), background var(--transition);
}

.inspector-close:hover {
  color: var(--text);
  background: var(--surface2);
}

/* インスペクター 2カラム行（左：プレビュー / 右：スライダー） */
.inspector-body-row {
  display: grid;
  grid-template-columns: 1fr 260px;
  align-items: stretch;
}

.inspector-adjust-col {
  overflow-y: auto;
  border-left: 1px solid var(--border);
  padding: 12px;
}

.inspector-preview-wrap {
  overflow: hidden;
  background: #000;
  position: relative;
  min-height: 120px;
}

.inspector-preview-wrap .filter-preview {
  width: 100%;
  height: auto;
  position: relative;
}

.inspector-preview-wrap .css-preview-img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: unset;
}

/* Before/After トグル */
.before-after-toggle {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 10;
  display: flex;
  background: rgba(0,0,0,0.25);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-radius: 6px;
  overflow: hidden;
  opacity: 0.25;
  transition: opacity .2s;
}
.inspector-preview-wrap:hover .before-after-toggle {
  opacity: 1;
}
.ba-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  padding: 5px 0;
  width: 52px;
  text-align: center;
  cursor: pointer;
  transition: background .15s, color .15s;
  font-family: inherit;
}
.ba-btn.active {
  background: rgba(255,255,255,0.22);
  color: #fff;
}
.before-overlay-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: auto;
  object-fit: unset;
  opacity: 0;
  transition: opacity .25s ease;
  pointer-events: none;
  z-index: 5;
}
.before-overlay-img.visible {
  opacity: 1;
}

.inspector-section {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

/* ====================================================
   RIGHT TOOLBAR WIDGETS
   ==================================================== */
.filter-count-label {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.action-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background var(--transition), color var(--transition);
}

.action-btn:hover {
  background: var(--surface2);
  color: var(--text);
}

.cols-switch {
  display: flex;
  gap: 0;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1px;
  overflow: hidden;
  margin-left: auto;
}

.col-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  min-width: 42px;
  height: 30px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 8px;
}

.col-btn.active, .col-btn:hover {
  background: var(--accent);
  color: #fff;
}

.col-btn-label {
  min-width: 10px;
}

.col-icon {
  display: grid;
  gap: 2px;
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.col-icon span {
  display: block;
  border-radius: 2px;
  background: currentColor;
  opacity: .9;
}

.col-icon--2 {
  grid-template-columns: repeat(2, 1fr);
}

.col-icon--4 {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
}

.col-icon--6 {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
}

/* ====================================================
   スライダー & フォーム
   ==================================================== */
.adjust-sliders {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.color-row {
  gap: 8px;
}

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

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

.slider-val {
  font-size: 12px;
  font-family: 'DM Mono', monospace;
  color: var(--text);
  min-width: 36px;
  text-align: right;
}

.color-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface2);
  padding: 8px 10px;
}

/* ハーフトーン グレー/カラー モードトグル */
.ht-mode-toggle {
  display: flex;
  gap: 4px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
}

.ht-mode-btn {
  flex: 1;
  padding: 5px 12px;
  border: none;
  border-radius: 5px;
  font-size: 12px;
  font-family: inherit;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.ht-mode-btn.active {
  background: var(--accent);
  color: #fff;
}

.ht-mode-btn:not(.active):hover {
  background: var(--border);
  color: var(--text);
}

input[type="color"] {
  appearance: none;
  -webkit-appearance: none;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

input[type="color"]::-webkit-color-swatch {
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 999px;
}

.color-chip-value {
  font-size: 12px;
  font-family: 'DM Mono', monospace;
  color: var(--text);
}

input[type="range"] {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 20px;
  background: transparent;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: var(--border);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
  cursor: pointer;
  transition: transform var(--transition);
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.reset-btn {
  margin-top: 4px;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
}

.reset-btn:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.code-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0 0 8px 8px;
  padding: 12px;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: #a5d6a7;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.6;
  max-height: 200px;
  overflow-y: auto;
  margin: 0;
}

.code-block-wrap {
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.code-block-wrap:last-child {
  margin-bottom: 0;
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}

.code-block-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
}

.copy-block-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background var(--transition), color var(--transition);
}

.copy-block-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.copy-btn {
  background: var(--accent);
  border: none;
  color: #fff;
  appearance: none;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
}

.copy-btn:hover { background: var(--accent-hover); }
.copy-btn:active { transform: scale(.96); }

.download-row {
  display: flex;
  gap: 8px;
}

.dl-btn {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 0;
  border-radius: 8px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background var(--transition), border-color var(--transition);
}

.dl-btn:hover {
  background: rgba(var(--accent-rgb), .15);
  border-color: rgba(var(--accent-rgb), .4);
}

/* ====================================================
   UPLOAD ZONE
   ==================================================== */
.upload-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: calc(100vh - var(--topbar-h));
  padding: 32px 20px;
}

.upload-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  max-width: 480px;
  width: 100%;
  padding: 56px 40px;
  border: 2px dashed rgba(var(--accent-rgb), .3);
  border-radius: 24px;
  background: var(--surface);
  transition: border-color var(--transition), background var(--transition);
  cursor: pointer;
}

.upload-zone.drag-over .upload-inner {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), .06);
}

.upload-icon {
  font-size: 48px;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 4px;
  transition: transform var(--transition);
}

.upload-zone.drag-over .upload-icon {
  transform: scale(1.12);
}

.upload-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.upload-sub {
  font-size: 13px;
  color: var(--text-muted);
}

.upload-btn {
  margin-top: 8px;
  background: var(--accent);
  border: none;
  color: #fff;
  padding: 10px 24px;
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background var(--transition), transform var(--transition);
}

.upload-btn:hover { background: var(--accent-hover); }
.upload-btn:active { transform: scale(.97); }

/* ====================================================
   WORKSPACE
   ==================================================== */
.workspace {
  flex: 1;
}

/* ====================================================
   FILTER GRID
   ==================================================== */
.filter-grid {
  padding: 20px;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(var(--filter-grid-cols), minmax(0, 1fr));
  --filter-grid-cols: 4;
}

.filter-grid.cols-2 { --filter-grid-cols: 2; }
.filter-grid.cols-4 { --filter-grid-cols: 4; }
.filter-grid.cols-6 { --filter-grid-cols: 6; }

.filter-card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
}

.filter-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
  border-color: rgba(var(--accent-rgb), .4);
}

.filter-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 8px 32px rgba(var(--accent-rgb), .25);
}

.card-img-wrap {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .3s;
}

.filter-card:hover .card-img {
  transform: scale(1.03);
}

.card-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.card-css-preview {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.filter-preview {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #111;
}

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

.preview-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: none;
}

.preview-frame {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  pointer-events: none;
  display: none;
}

.anime-wrap::before,
.anime-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.anime-wrap::before {
  background:
    linear-gradient(rgba(255,255,255,0.08), rgba(255,255,255,0.02)),
    radial-gradient(rgba(255,220,180,0.08), transparent 60%);
  mix-blend-mode: screen;
}

.anime-wrap::after {
  background: rgba(20, 30, 60, 0.08);
  mix-blend-mode: multiply;
}

.card-label {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 22px 10px 8px;
  background: linear-gradient(to top, rgba(0,0,0,.7) 0%, transparent 100%);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  letter-spacing: .03em;
}

.card-check {
  position: absolute;
  top: 8px; right: 8px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  opacity: 0;
  transform: scale(.7);
  transition: opacity var(--transition), transform var(--transition);
  pointer-events: none;
}

.filter-card.selected .card-check {
  opacity: 1;
  transform: scale(1);
}

.card-badge {
  position: absolute;
  top: 8px; left: 8px;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  background: rgba(0,0,0,.55);
  color: rgba(255,255,255,.85);
  backdrop-filter: blur(4px);
  letter-spacing: .04em;
  pointer-events: none;
}

/* ====================================================
   FOOTER
   ==================================================== */
.preview-footer {
  margin-top: auto;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 40px 0 0;
}

.footer-container {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 24px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 40px;
  padding-bottom: 32px;
}

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

.footer-logo {
  color: var(--accent);
  font-size: 18px;
}

.footer-brand-name {
  font-size: 15px;
  font-weight: 600;
}

.footer-description {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 14px;
}

.social-links {
  display: flex;
  gap: 8px;
}

.social-link {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 13px;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}

.social-link:hover {
  color: var(--text);
  border-color: var(--text-muted);
  background: var(--surface2);
}

.footer-heading {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text-muted);
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  transition: color var(--transition);
}

.footer-links a:hover {
  color: var(--text);
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding: 16px 0;
  font-size: 12px;
  color: var(--text-muted);
}

.footer-bottom a {
  color: var(--text-muted);
  text-decoration: none;
}

.footer-bottom a:hover {
  color: var(--text);
}

/* ====================================================
   トースト通知
   ==================================================== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
  z-index: 9999;
  opacity: 0;
  transition: opacity .22s, transform .22s;
  pointer-events: none;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ====================================================
   レスポンシブ
   ==================================================== */
@media (max-width: 640px) {
  .filter-grid { padding: 12px; gap: 10px; }
  .filter-grid.cols-4 { --filter-grid-cols: 2; }
  .filter-grid.cols-6 { --filter-grid-cols: 2; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .topbar-title { display: none; }
  .filter-count-label { display: none; }
  .main.inspector-open { padding-right: 0; }
  .inspector { width: 100vw; }
  .col-btn { min-width: 40px; height: 28px; padding: 0 7px; }
}

@media (min-width: 1024px) {
  :root { --inspector-w: 860px; }
}

@media (max-width: 900px) {
  .inspector-body-row {
    grid-template-columns: 1fr;
  }
  .inspector-adjust-col {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .inspector-preview-wrap .css-preview-img {
    height: auto;
    object-fit: unset;
  }
}

/* ── アップスケールバナー ── */
.upscale-banner {
  font-size: 11px;
  color: #f6c90e;
  background: rgba(246, 201, 14, 0.1);
  border: 1px solid rgba(246, 201, 14, 0.35);
  border-radius: 6px;
  padding: 6px 10px;
  margin-bottom: 10px;
  line-height: 1.4;
}
