/* ============================================================
   Font Search — Frontend CSS  v5.0
   Branded topbar · Sidebar search · Gap grid · Rounded cards
============================================================ */

/* ---------- Variables ---------- */
:root {
  --fs-bg:           #F5F5F7;
  --fs-bg-2:         #EBEBED;
  --fs-surface:      #FFFFFF;
  --fs-border:       #E0E0E3;
  --fs-border-light: rgba(0,0,0,0.06);
  --fs-text:         #1C1C1E;
  --fs-text-2:       #48484A;
  --fs-text-muted:   #8E8E93;
  --fs-accent:       #1540ef;
  --fs-accent-2:     #0f32c0;
  --fs-accent-light: rgba(21,64,239,0.10);
  --fs-accent-glow:  rgba(21,64,239,0.25);
  --fs-green:        #34C759;
  --fs-green-light:  rgba(52,199,89,0.12);
  --fs-sidebar-w:    290px;
  --fs-topbar-h:     52px;
  --fs-radius:       12px;
  --fs-radius-sm:    8px;
  --fs-radius-xs:    6px;
  --fs-shadow-sm:    0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --fs-shadow:       0 4px 16px rgba(0,0,0,0.09), 0 2px 6px rgba(0,0,0,0.05);
  --fs-shadow-lg:    0 20px 60px rgba(0,0,0,0.14), 0 8px 24px rgba(0,0,0,0.08);
  --fs-t:            0.18s cubic-bezier(0.4,0,0.2,1);
  --fs-font-ui:      -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Noto Sans JP', 'Hiragino Sans', sans-serif;
}
html[data-theme="dark"] {
  --fs-bg:           #000000;
  --fs-bg-2:         #1C1C1E;
  --fs-surface:      #1C1C1E;
  --fs-border:       #38383A;
  --fs-border-light: rgba(255,255,255,0.06);
  --fs-text:         #F5F5F7;
  --fs-text-2:       rgba(255,255,255,0.72);
  --fs-text-muted:   rgba(255,255,255,0.34);
  --fs-accent:       #1540ef;
  --fs-accent-2:     #0f32c0;
  --fs-accent-light: rgba(21,64,239,0.16);
  --fs-accent-glow:  rgba(21,64,239,0.38);
  --fs-shadow-sm:    0 1px 3px rgba(0,0,0,0.5);
  --fs-shadow:       0 4px 16px rgba(0,0,0,0.5);
  --fs-shadow-lg:    0 24px 64px rgba(0,0,0,0.7);
}

/* ---------- Reset ---------- */
.fs-app *, .fs-app *::before, .fs-app *::after {
  box-sizing: border-box; margin: 0; padding: 0;
}
.fs-app {
  background: var(--fs-bg);
  color: var(--fs-text);
  font-family: var(--fs-font-ui);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}
.fs-app button { cursor: pointer; font-family: var(--fs-font-ui); border: none; background: none; }

/* ============================================================
   Topbar — Solid accent · site name + total + theme toggle
============================================================ */
.fs-topbar {
  background: #38383a;
  height: var(--fs-topbar-h);
  position: sticky;
  top: 0;
  z-index: 200;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.fs-topbar-inner {
  height: 100%;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ハンバーガー */
.fs-hamburger {
  display: none;
  align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border-radius: 8px;
  color: rgba(255,255,255,0.9);
  flex-shrink: 0;
  transition: background var(--fs-t);
}
.fs-hamburger:hover { background: rgba(255,255,255,0.15); }
.fs-hamburger-icon { display: flex; flex-direction: column; gap: 4.5px; }
.fs-hamburger-icon span {
  display: block; width: 17px; height: 1.5px;
  background: currentColor; border-radius: 2px;
  transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
}
.fs-hamburger.is-open .fs-hamburger-icon span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.fs-hamburger.is-open .fs-hamburger-icon span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.fs-hamburger.is-open .fs-hamburger-icon span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* サイト名 */
.fs-site-name {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
}

/* スペーサー */
.fs-topbar-spacer { flex: 1; }

/* 登録フォント数 */
.fs-total-label {
  font-size: 12px;
  color: rgba(255,255,255,0.75);
  white-space: nowrap;
  flex-shrink: 0;
}
.fs-total-label strong {
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

/* テーマ切替 */
.fs-theme-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  border-radius: 50%;
  color: rgba(255,255,255,0.8);
  font-size: 14px;
  flex-shrink: 0;
  position: relative; overflow: hidden;
  transition: background var(--fs-t), color var(--fs-t);
}
.fs-theme-toggle:hover { background: rgba(255,255,255,0.18); color: #fff; }
.fs-toggle-icon { position: absolute; transition: opacity var(--fs-t), transform var(--fs-t); }
.fs-icon-moon { opacity: 1; }
.fs-icon-sun  { opacity: 0; transform: translateY(8px); }
html[data-theme="dark"] .fs-icon-moon { opacity: 0; transform: translateY(-8px); }
html[data-theme="dark"] .fs-icon-sun  { opacity: 1; transform: translateY(0); }

/* ============================================================
   Layout
============================================================ */
.fs-layout {
  display: grid;
  grid-template-columns: var(--fs-sidebar-w) 1fr;
  min-height: calc(100vh - var(--fs-topbar-h));
  align-items: start;
}

/* サイドバーオーバーレイ（モバイル） */
.fs-sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(2px);
  z-index: 199;
}
.fs-sidebar-overlay.is-visible { display: block; }

/* ============================================================
   Sidebar
============================================================ */
.fs-sidebar {
  width: var(--fs-sidebar-w);
  background: #38383a;
  border-right: 1px solid rgba(255,255,255,0.07);
  position: sticky;
  top: var(--fs-topbar-h);
  height: calc(100vh - var(--fs-topbar-h));
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
  display: flex;
  flex-direction: column;
}

.fs-sidebar-section {
  padding: 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.fs-sidebar-section:last-of-type { border-bottom: none; }

/* 検索セクション */
.fs-sidebar-search-section { padding: 14px 14px 12px; }

/* サイドバー見出し */
.fs-sidebar-heading {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.42);
  margin-bottom: 12px;
}

/* 検索ボックス */
.fs-search-box {
  position: relative;
}
.fs-search-input {
  width: 100%;
  padding: 8px 12px 8px 32px;
  border: 1px solid rgba(255,255,255,0.13);
  border-radius: var(--fs-radius-sm);
  background: rgba(255,255,255,0.09);
  color: #fff;
  font-size: 13px;
  font-family: var(--fs-font-ui);
  outline: none;
  transition: all var(--fs-t);
  -webkit-appearance: none;
}
.fs-search-input::placeholder { color: rgba(255,255,255,0.38); }
.fs-search-input:focus {
  border-color: rgba(255,255,255,0.38);
  background: rgba(255,255,255,0.14);
  box-shadow: 0 0 0 3px rgba(21,64,239,0.35);
}
.fs-search-icon {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255,255,255,0.4);
  pointer-events: none;
}

/* カテゴリーアイコングリッド (3×3) */
.fs-cat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px 6px;
}
.fs-cat-icon-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 6px 4px 8px;
  border-radius: var(--fs-radius-sm);
  background: transparent;
  cursor: pointer;
  transition: background var(--fs-t);
}
.fs-cat-icon-btn:hover { background: rgba(255,255,255,0.07); }
.fs-cat-icon-btn.active .fs-cat-icon {
  border-color: var(--fs-accent);
  background: rgba(21,64,239,0.4);
  color: #fff;
}
.fs-cat-icon-btn.active .fs-cat-name {
  color: rgba(255,255,255,0.95);
  font-weight: 700;
}
.fs-cat-icon {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.13);
  background: rgba(255,255,255,0.07);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-family: 'Noto Serif JP', 'Hiragino Mincho Pro', 'Yu Mincho', serif;
  color: rgba(255,255,255,0.85);
  transition: all var(--fs-t);
  flex-shrink: 0;
}
.fs-cat-name {
  font-size: 10.5px;
  color: rgba(255,255,255,0.55);
  text-align: center;
  line-height: 1.3;
  word-break: break-all;
  max-width: 64px;
}

/* タグ */
.fs-tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.fs-tag {
  padding: 4px 11px;
  border: 1px solid rgba(255,255,255,0.13);
  border-radius: 20px;
  background: rgba(255,255,255,0.09);
  color: rgba(255,255,255,0.7);
  font-size: 12px;
  font-family: var(--fs-font-ui);
  transition: all var(--fs-t);
  -webkit-appearance: none;
}
.fs-tag:hover { border-color: rgba(255,255,255,0.35); color: #fff; background: rgba(255,255,255,0.14); }
.fs-tag.active {
  background: var(--fs-accent);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 2px 8px var(--fs-accent-glow);
}

/* サイドバー下部 */
.fs-sidebar-info {
  padding: 18px 14px 24px;
  margin-top: auto;
}
.fs-sidebar-desc {
  font-size: 11.5px;
  line-height: 1.7;
  color: rgba(255,255,255,0.4);
  margin-bottom: 12px;
}
.fs-sidebar-desc a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.fs-sidebar-parent-link {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  gap: 2px;
  transition: color var(--fs-t), gap var(--fs-t);
}
.fs-sidebar-parent-link:hover { color: #fff; gap: 5px; }

/* ============================================================
   Main
============================================================ */
.fs-main { min-width: 0; }

/* ============================================================
   Global preview controls (sticky · right side)
============================================================ */
.fs-global-controls {
  background: var(--fs-accent);
  border-bottom: 1px solid rgba(0,0,0,0.15);
  padding: 12px 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  position: sticky;
  top: var(--fs-topbar-h);
  z-index: 90;
}

.fs-controls-hint {
  font-size: 11.5px;
  color: rgba(255,255,255,0.75);
  letter-spacing: -0.01em;
}

/* global-controls 内の入力・ボタンを白系に */
.fs-global-controls .fs-gp-text-input {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.3);
  color: #fff;
}
.fs-global-controls .fs-gp-text-input::placeholder { color: rgba(255,255,255,0.55); }
.fs-global-controls .fs-gp-text-input:focus {
  background: rgba(255,255,255,0.22);
  border-color: rgba(255,255,255,0.65);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.12);
}
.fs-global-controls .fs-view-btn {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.3);
  color: #fff;
}
.fs-global-controls .fs-view-btn:hover {
  background: rgba(255,255,255,0.28);
  border-color: rgba(255,255,255,0.55);
  color: #fff;
}
.fs-global-controls .fs-view-btn.active {
  background: rgba(255,255,255,0.35);
  border-color: transparent;
  color: #fff;
}
.fs-global-controls .fs-gp-size-icon { color: rgba(255,255,255,0.8); }
.fs-global-controls .fs-gp-size-val  { color: rgba(255,255,255,0.8); }
.fs-global-controls .fs-gp-slider    { accent-color: #fff; }

.fs-gp-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}

/* サンプルテキスト入力（大きめフォント） */
.fs-gp-text-input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border: 1.5px solid var(--fs-border);
  border-radius: var(--fs-radius-sm);
  background: var(--fs-bg-2);
  color: var(--fs-text);
  font-size: 20px;
  font-family: var(--fs-font-ui);
  outline: none;
  transition: all var(--fs-t);
  -webkit-appearance: none;
}
.fs-gp-text-input::placeholder { color: var(--fs-text-muted); font-size: 16px; }
.fs-gp-text-input:focus {
  border-color: var(--fs-accent);
  background: var(--fs-surface);
  box-shadow: 0 0 0 3px var(--fs-accent-light);
}

/* グリッド / リスト 切替 */
.fs-view-btns { display: flex; gap: 2px; flex-shrink: 0; }
.fs-view-btn {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border-radius: var(--fs-radius-xs);
  border: 1.5px solid var(--fs-border);
  background: var(--fs-bg-2);
  color: var(--fs-text-muted);
  transition: all var(--fs-t);
}
.fs-view-btn:hover {
  border-color: var(--fs-accent);
  color: var(--fs-accent);
  background: var(--fs-accent-light);
}
.fs-view-btn.active {
  background: var(--fs-accent);
  border-color: transparent;
  color: #fff;
}

/* フォントサイズコントロール */
.fs-gp-size-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.fs-gp-size-icon {
  font-size: 18px;
  font-family: 'Noto Serif JP', serif;
  color: var(--fs-text-muted);
  line-height: 1;
  flex-shrink: 0;
}
.fs-gp-slider {
  width: 100px;
  accent-color: var(--fs-accent);
  cursor: pointer;
}
.fs-gp-size-val {
  font-size: 12px;
  color: var(--fs-text-muted);
  white-space: nowrap;
  min-width: 40px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   Results header
============================================================ */
.fs-main-content { padding: 0; }

.fs-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: #F5F5F7;
  border-bottom: 1px solid #e0e0e3;
}
html[data-theme="dark"] .fs-results-header {
  background: #000;
  border-bottom: 1px solid #38383a;
}
.fs-results-count {
  font-size: 13px;
  color: var(--fs-text-muted);
  letter-spacing: -0.01em;
}
.fs-results-count #fs-count-num {
  font-size: 17px;
  font-weight: 700;
  color: var(--fs-text);
  letter-spacing: -0.04em;
  margin: 0 2px;
}
.fs-sort-select {
  padding: 5px 26px 5px 10px;
  border: 1px solid var(--fs-border);
  border-radius: var(--fs-radius-xs);
  background: var(--fs-surface);
  color: var(--fs-text);
  font-size: 12.5px;
  font-family: var(--fs-font-ui);
  cursor: pointer;
  appearance: none;
  outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238A8A8A' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  box-shadow: var(--fs-shadow-sm);
  transition: border-color var(--fs-t);
}
.fs-sort-select:hover { border-color: var(--fs-accent); }

/* ============================================================
   Font List — Gap grid (カードに余白・角丸)
============================================================ */
.fs-font-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: 20px;
}
.fs-font-list.is-loading { opacity: 0.45; pointer-events: none; transition: opacity 0.15s; }

/* ============================================================
   Skeleton screen — shimmer placeholders during AJAX load
============================================================ */
.fs-skeleton-item {
  position: relative;
  padding: 28px 22px 18px;
  background: var(--fs-surface);
  border: 1px solid var(--fs-border-light);
  border-radius: 10px;
  min-height: 175px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.fs-skeleton-preview {
  flex: 1;
  height: 70px;
  background: var(--fs-bg-2);
  border-radius: 6px;
  margin-bottom: 18px;
}
.fs-skeleton-footer {
  flex-shrink: 0;
  padding-top: 11px;
  border-top: 1px solid var(--fs-border-light);
}
.fs-skeleton-line {
  height: 11px;
  background: var(--fs-bg-2);
  border-radius: 4px;
  margin-bottom: 8px;
}
.fs-skeleton-line.short { width: 55%; margin-bottom: 0; }

/* shimmer sweep */
.fs-skeleton-item::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    transparent 30%,
    rgba(255,255,255,0.18) 50%,
    transparent 70%
  );
  background-size: 200% 100%;
  animation: fs-shimmer 1.5s ease-in-out infinite;
  pointer-events: none;
}
html[data-theme="dark"] .fs-skeleton-item::after {
  background: linear-gradient(
    100deg,
    transparent 30%,
    rgba(255,255,255,0.07) 50%,
    transparent 70%
  );
  background-size: 200% 100%;
}
@keyframes fs-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

/* List mode skeleton */
.fs-font-list.is-list .fs-skeleton-item {
  flex-direction: row;
  align-items: center;
  min-height: auto;
  padding: 16px 22px;
}
.fs-font-list.is-list .fs-skeleton-preview {
  flex: 1;
  height: 38px;
  margin-bottom: 0;
}
.fs-font-list.is-list .fs-skeleton-footer {
  flex-shrink: 0;
  width: 140px;
  padding-top: 0;
  border-top: none;
  border-left: 1px solid var(--fs-border-light);
  padding-left: 18px;
  margin-left: 18px;
}
.fs-no-results {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--fs-text-muted);
  padding: 80px 0;
  font-size: 15px;
}

/* カード出現アニメーション */
@keyframes fs-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Font Card — 角丸・余白あり（ライトモードはシャドウなし・ボーダーのみ） */
.fs-font-item {
  animation: fs-fade-in 0.22s ease both;
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 28px 22px 18px;
  background: var(--fs-surface);
  border: 1px solid #e0e0e3;
  border-radius: 10px;
  box-shadow: none;
  cursor: pointer;
  min-height: 175px;
  transition: box-shadow var(--fs-t), transform var(--fs-t), border-color var(--fs-t), background var(--fs-t);
}
.fs-font-item:hover {
  box-shadow: 0 4px 14px rgba(0,0,0,0.08);
  transform: translateY(-2px);
  border-color: rgba(21,64,239,0.3);
}
.fs-font-item:active { transform: translateY(0); box-shadow: none; }
html[data-theme="dark"] .fs-font-item { border-color: var(--fs-border); box-shadow: var(--fs-shadow-sm); }
html[data-theme="dark"] .fs-font-item:hover { border-color: rgba(21,64,239,0.4); box-shadow: 0 6px 20px rgba(0,0,0,0.4); }

/* フォントプレビュー（大） */
.fs-item-preview {
  flex: 1;
  font-size: 42px;
  line-height: 1.3;
  color: var(--fs-text);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
  margin-bottom: 4px;
}

/* フッター（フォント名・カテゴリー） */
.fs-item-footer {
  margin-top: 14px;
  padding-top: 11px;
  border-top: 1px solid var(--fs-border-light);
  flex-shrink: 0;
}
.fs-item-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--fs-text-2);
  margin-bottom: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fs-item-badges { display: flex; flex-wrap: wrap; gap: 3px; }
.fs-item-badge {
  font-size: 10px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 20px;
}
.fs-item-badge-cat { background: #1540ef; color: #fff; }

/* ============================================================
   Font List — List mode
============================================================ */
.fs-font-list.is-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 20px;
}
.fs-font-list.is-list .fs-font-item {
  flex-direction: row;
  align-items: center;
  gap: 0;
  min-height: auto;
  padding: 16px 22px;
  border-radius: 10px;
}
.fs-font-list.is-list .fs-item-preview {
  flex: 1;
  font-size: 32px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  -webkit-line-clamp: unset;
  -webkit-box-orient: unset;
  margin-bottom: 0;
}
.fs-font-list.is-list .fs-item-footer {
  flex-shrink: 0;
  width: 160px;
  margin-top: 0;
  padding-top: 0;
  border-top: none;
  border-left: 1px solid var(--fs-border-light);
  padding-left: 18px;
  margin-left: 18px;
}

/* ============================================================
   Pagination
============================================================ */
.fs-pager { padding: 24px 20px 48px; }
.fs-pager-inner { display: flex; align-items: center; justify-content: center; gap: 4px; flex-wrap: wrap; }
.fs-page-btn {
  min-width: 36px; height: 36px; padding: 0 12px;
  border: 1px solid var(--fs-border); border-radius: var(--fs-radius-xs);
  background: var(--fs-surface); color: var(--fs-text-2);
  font-size: 13px; font-weight: 500; font-family: var(--fs-font-ui);
  transition: all var(--fs-t); box-shadow: var(--fs-shadow-sm);
}
.fs-page-btn:hover { border-color: var(--fs-accent); color: var(--fs-accent); background: var(--fs-accent-light); }
.fs-page-btn.active {
  background: var(--fs-accent); border-color: transparent; color: #fff;
  font-weight: 700; box-shadow: 0 2px 10px var(--fs-accent-glow);
}
.fs-page-ellipsis { color: var(--fs-text-muted); padding: 0 4px; font-size: 14px; }

/* ============================================================
   Modal
============================================================ */
.fs-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(8px) saturate(150%);
  -webkit-backdrop-filter: blur(8px) saturate(150%);
  z-index: 9999;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.22s ease;
}
.fs-modal-overlay.is-open { opacity: 1; pointer-events: auto; }
.fs-modal {
  background: var(--fs-surface);
  border-radius: 20px;
  width: 100%; max-width: 780px; max-height: 88vh; overflow: hidden;
  box-shadow: var(--fs-shadow-lg);
  border: 1px solid var(--fs-border-light);
  transform: translateY(20px) scale(.97);
  transition: transform 0.26s cubic-bezier(0.34,1.56,0.64,1);
  display: flex; flex-direction: column;
}
.fs-modal-overlay.is-open .fs-modal { transform: translateY(0) scale(1); }
.fs-modal-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 24px 28px 16px; border-bottom: 1px solid var(--fs-border-light); flex-shrink: 0;
}
.fs-modal-title-wrap { flex: 1; min-width: 0; }
.fs-modal-title { font-size: 22px; font-weight: 700; color: var(--fs-text); margin: 0 0 8px; letter-spacing: -0.03em; }
.fs-modal-badges { display: flex; flex-wrap: wrap; gap: 5px; }
.fs-modal-close {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--fs-bg-2); color: var(--fs-text-muted); font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-left: 12px;
  transition: all var(--fs-t);
}
.fs-modal-close:hover { background: var(--fs-text-muted); color: var(--fs-surface); transform: scale(1.1); }
.fs-modal-body { padding: 22px 28px; flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--fs-border) transparent; }
.fs-preview-controls { display: flex; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.fs-preview-text-wrap { flex: 1; min-width: 200px; }
.fs-preview-size-wrap { min-width: 160px; }
.fs-ctrl-label {
  display: block; font-size: 10.5px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--fs-text-muted); margin-bottom: 7px;
}
.fs-preview-input {
  width: 100%; padding: 9px 13px;
  border: 1px solid var(--fs-border); border-radius: var(--fs-radius-xs);
  background: var(--fs-bg-2); color: var(--fs-text);
  font-size: 14px; font-family: var(--fs-font-ui); outline: none;
  transition: all var(--fs-t); -webkit-appearance: none;
}
.fs-preview-input:focus { border-color: var(--fs-accent); box-shadow: 0 0 0 3px var(--fs-accent-light); }
.fs-size-slider { width: 100%; accent-color: var(--fs-accent); cursor: pointer; margin-top: 6px; }
.fs-preview-display {
  background: var(--fs-bg); border: 1px solid var(--fs-border); border-radius: var(--fs-radius);
  padding: 40px 28px; margin-bottom: 20px; min-height: 120px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.fs-preview-sample { font-size: 32px; line-height: 1.5; color: var(--fs-text); word-break: break-all; text-align: center; }
.fs-sample-sets { display: flex; flex-direction: column; gap: 8px; }
.fs-sample-item {
  padding: 14px 18px; background: var(--fs-bg);
  border-radius: var(--fs-radius-sm); border: 1px solid var(--fs-border-light);
}
.fs-sample-label { display: block; font-size: 10.5px; color: var(--fs-text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .06em; }
.fs-sample-text { font-size: 18px; line-height: 1.5; color: var(--fs-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fs-modal-footer {
  padding: 14px 28px 22px; border-top: 1px solid var(--fs-border-light);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  flex-wrap: wrap; flex-shrink: 0;
}
.fs-modal-meta { font-size: 11.5px; color: var(--fs-text-muted); font-family: 'SF Mono','Fira Code','Consolas',monospace; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fs-modal-footer-btns { display: flex; gap: 8px; flex-shrink: 0; }
.fs-btn-detail {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; background: var(--fs-accent); color: #fff;
  border: 1px solid transparent; border-radius: 20px;
  text-decoration: none; font-size: 13px; font-weight: 600;
  transition: all var(--fs-t); box-shadow: 0 2px 8px var(--fs-accent-glow);
}
.fs-btn-detail:hover { background: var(--fs-accent-2); transform: translateY(-1px); box-shadow: 0 6px 16px var(--fs-accent-glow); }

/* X (Twitter) シェアボタン */
.fs-btn-share-x {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 9px 16px; background: #000; color: #fff;
  border: 1px solid transparent; border-radius: 20px;
  text-decoration: none; font-size: 13px; font-weight: 600;
  transition: all var(--fs-t); box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  white-space: nowrap;
}
.fs-btn-share-x:hover { background: #222; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0,0,0,0.35); color: #fff; }
html[data-theme="dark"] .fs-btn-share-x { background: #fff; color: #000; }
html[data-theme="dark"] .fs-btn-share-x:hover { background: #e0e0e0; color: #000; }

.fs-hidden { display: none !important; }

/* ============================================================
   Responsive — Mobile
============================================================ */
@media (max-width: 768px) {
  .fs-hamburger { display: flex; }
  .fs-layout { grid-template-columns: 1fr; }

  .fs-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 200;
    width: min(var(--fs-sidebar-w), 86vw);
    transform: translateX(-110%);
    height: 100vh;
    box-shadow: var(--fs-shadow-lg);
  }
  .fs-sidebar.is-open { transform: translateX(0); }

  .fs-gp-row { flex-wrap: wrap; }
  .fs-gp-text-input { min-width: calc(100% - 10px); }

  .fs-font-list { grid-template-columns: repeat(2, 1fr); gap: 12px; padding: 14px; }
  .fs-item-preview { font-size: 30px; }

  .fs-modal-overlay { align-items: flex-end; padding: 0; padding-top: max(80px, env(safe-area-inset-top)); }
  .fs-modal { max-width: 100%; border-radius: 20px 20px 0 0; max-height: 80dvh; max-height: 80svh; max-height: 80vh; }
  .fs-modal-header { padding: 20px 20px 14px; flex-shrink: 0; }
  .fs-modal-body { padding: 16px 20px; }
  .fs-modal-footer { padding: 12px 20px calc(20px + env(safe-area-inset-bottom)); flex-direction: column; align-items: stretch; flex-shrink: 0; }
  .fs-modal-footer-btns { display: grid; grid-template-columns: auto 1fr 1fr; gap: 8px; }
  .fs-btn-fav { justify-content: center; padding: 13px 16px; }
  .fs-fav-modal-text { display: none; }
  .fs-btn-detail { justify-content: center; padding: 13px; }
  .fs-btn-share-x { justify-content: center; padding: 13px; }
}

@media (max-width: 500px) {
  .fs-font-list { grid-template-columns: 1fr; }
  .fs-font-list.is-list { padding: 10px 12px; }
  .fs-item-preview { font-size: 28px; }
}

/* ============================================================
   お気に入り
============================================================ */

/* サイドバー — お気に入りフィルターボタン */
.fs-fav-filter-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--fs-radius-sm);
  color: rgba(255,255,255,0.65);
  font-size: 13px;
  font-family: var(--fs-font-ui);
  font-weight: 500;
  transition: all var(--fs-t);
}
.fs-fav-filter-btn:hover { background: rgba(255,255,255,0.07); color: #fff; }
.fs-fav-filter-btn.active { background: rgba(255,41,112,0.15); color: #ff2970; }
.fs-fav-star-icon { font-size: 16px; line-height: 1; }
.fs-fav-count {
  margin-left: auto;
  background: rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  text-align: center;
}
.fs-fav-filter-btn.active .fs-fav-count { background: rgba(255,41,112,0.2); }

/* モーダル — お気に入りボタン */
.fs-btn-fav {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 9px 16px;
  background: var(--fs-bg-2);
  color: var(--fs-text-muted);
  border: 1px solid var(--fs-border);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--fs-font-ui);
  transition: all var(--fs-t);
  white-space: nowrap;
  cursor: pointer;
}
.fs-btn-fav:hover { border-color: #ff2970; color: #ff2970; background: rgba(255,41,112,0.08); }
.fs-btn-fav.is-fav { background: rgba(255,41,112,0.12); border-color: #ff2970; color: #ff2970; }
.fs-btn-fav.is-fav:hover { background: rgba(255,41,112,0.2); }
.fs-fav-modal-icon { font-size: 16px; line-height: 1; }
.fs-fav-modal-icon::before { content: '♡'; }
.fs-btn-fav.is-fav .fs-fav-modal-icon::before { content: '♥'; }

/* ============================================================
   広告エリア
============================================================ */
.fs-ad-area {
  padding: 12px 14px;
  text-align: center;
  min-height: 90px;
}
.fs-modal-ad {
  margin: 0 0 20px;
  text-align: center;
  min-height: 90px;
}

/* ============================================================
   WordPress 管理バー対応
============================================================ */
.admin-bar .fs-topbar { top: 32px; }
.admin-bar .fs-global-controls { top: calc(var(--fs-topbar-h) + 32px); }
.admin-bar .fs-sidebar { top: calc(var(--fs-topbar-h) + 32px); height: calc(100vh - var(--fs-topbar-h) - 32px); }
@media screen and (max-width: 782px) {
  .admin-bar .fs-topbar { top: 46px; }
  .admin-bar .fs-global-controls { top: calc(var(--fs-topbar-h) + 46px); }
  .admin-bar .fs-sidebar { top: calc(var(--fs-topbar-h) + 46px); height: calc(100vh - var(--fs-topbar-h) - 46px); }
}
