/* ============================================================
   style.css — システムCSS
   LinkCMS レイアウト・構造・機能スタイル
   
   【このファイルについて】
   レイアウト・構造・アニメーション・機能に関わるCSSを記述します。
   デザインの変更（色・フォント・背景・ボーダーなど）は design.css を編集してください。
   このファイルを直接編集すると、レイアウト崩れや機能不全が発生する可能性があります。
   
   【ファイル構成】
   style.css  ← このファイル（触らない）
   design.css ← デザイン変更用（こちらを編集）
============================================================ */

/* ============================================================
   RESET & BASE
============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }
body {
  font-family: var(--font-ja);
  background: transparent;  /* 背景は design.css の :root > html で管理 */
  color: var(--c-text);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--c-link); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: var(--font-ja); }
input, select, textarea { font-family: var(--font-ja); }
::selection { background: var(--c-crimson); color: #fff; }

/* ============================================================
   HEADER — 構造
============================================================ */
#header {
  position: sticky;
  top: 0;
  z-index: 200;
}
.header-top {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 20px 8px;
  max-width: 1400px;
  margin: 0 auto;
  position: relative;  /* タイトルの絶対配置を受ける */
  min-height: 120px;   /* 月画像が映えるよう最低高さを確保 */
}
.header-logo-area {
  display: flex;
  align-items: flex-end;  /* タグラインをアバター下端に揃える */
  gap: 14px;
  flex: 0 0 auto;
  position: relative;
  z-index: 2;
}
.header-avatar {
  width: 100px;    /* 元CGIと同じサイズ */
  height: 100px;
  border-radius: var(--radius);
  overflow: hidden;
  flex-shrink: 0;
}
.header-avatar img { width: 100%; height: 100%; object-fit: cover; }
.header-avatar-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
}
.header-site-title {
  /* font-family は design.css で指定 */
  font-weight: 700;
  letter-spacing: 2px;
  line-height: 1;
  /* 右端に絶対配置して月に重ねる */
  position: absolute;
  right: 20px;
  bottom: 16px;
  z-index: 2;
}
.header-tagline {
  line-height: 1.5;
  margin-top: 4px;
}
.header-spacer { flex: 1; }
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Header nav bar */
.header-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 20px 8px;
  max-width: 1400px;
  margin: 0 auto;
  padding-top: 8px;
}
.nav-link {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: var(--radius);
  transition: all var(--ease);
  border: 1px solid transparent;
}
.nav-sep { margin: 0 2px; }

/* Login button */
.btn-login {
  width: 28px; height: 28px;
  border-radius: var(--radius);
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--ease);
  flex-shrink: 0;
  cursor: pointer;
}

/* Admin nav actions */
.nav-admin-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}
/* 管理ボタンとログインアイコンの間のスペース（アイコン1個分） */
.nav-login-sep {
  width: 28px;
  flex-shrink: 0;
}
.btn-nav-icon {
  padding: 3px 10px;
  border-radius: var(--radius);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all var(--ease);
  white-space: nowrap;
}
.btn-nav-label { font-size: 11px; }

/* ============================================================
   LAYOUT
============================================================ */
.layout {
  display: flex;
  max-width: 1400px;
  margin: 0 auto;
  min-height: calc(100vh - var(--header-h));
}

/* ============================================================
   SIDEBAR — 構造
============================================================ */
#sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h) - 16px);
  margin-top: 8px;
  overflow: hidden;   /* スクロールバーはsidebar-scrollに任せる */
  display: flex;
  flex-direction: column;
  transition: width 0.22s ease, border-color 0.22s ease;
}
#sidebar.hidden {
  width: 0;
  border-color: transparent;
  overflow: hidden;
}
/* 固定ヘッダー部分（検索・すべて・OR/AND） */
#sidebar-fixed {
  flex-shrink: 0;
}
/* スクロール部分（タグ一覧） */
#sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}
#sidebar-scroll::-webkit-scrollbar { width: 4px; }
#sidebar-scroll::-webkit-scrollbar-track { background: transparent; }
#sidebar-scroll::-webkit-scrollbar-thumb { border-radius: 4px; }
#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-track { background: transparent; }
#sidebar::-webkit-scrollbar-thumb { border-radius: 4px; }

.sidebar-section { margin-bottom: 20px; }
.sidebar-heading {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 0 8px 6px 14px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.sidebar-heading-text { flex: 1; }

/* AND/OR toggle */
.filter-mode-btns {
  display: flex;
  gap: 3px;
  align-items: center;
  position: relative;
}
.filter-mode-btn {
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .5px;
  transition: all var(--ease);
  cursor: pointer;
  position: relative;
}
.filter-mode-btn::after {
  content: '絞り込み';
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  font-weight: 400;
  letter-spacing: .5px;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--ease);
  text-transform: none;
}
.filter-mode-btn:hover::after { opacity: 1; }
.filter-mode-wrap { display: none; }

/* Tag items */

/* サイドバー上部：すべて・厳選を横並び */
.sidebar-top-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
}
.tag-item-top {
  flex: 1 1 auto;  /* 縮小・伸長可能、はみ出す場合は改行 */
  min-width: 0;
  padding: 6px 8px;
  font-size: 12px;
}
.tag-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  cursor: pointer;
  transition: background var(--ease);
  border-left: 3px solid transparent;
  gap: 6px;
}
.tag-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag-count {
  padding: 1px 5px;
  border-radius: 999px;
  flex-shrink: 0;
}

/* Sidebar search */
.sidebar-search-section {
  padding: 10px 10px 8px;
  margin-bottom: 4px;
}
.sidebar-search-wrap {
  position: relative;
  margin-bottom: 6px;
}
.sidebar-search-input {
  width: 100%;
  padding: 7px 32px 7px 10px;
  border-radius: var(--radius);
  font-size: 12px;
  outline: none;
  transition: border-color var(--ease);
}
.sidebar-search-icon {
  position: absolute; right: 8px; top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  background: transparent;
  border: none;
  padding: 0;
  line-height: 1;
  pointer-events: none;
}

/* ============================================================
   MAIN CONTENT — 構造
============================================================ */
#main {
  flex: 1;
  min-width: 0;
  padding: 8px 16px 16px;
  overflow-y: auto;
  height: calc(100vh - var(--header-h));
}

/* Result bar */
.result-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;   /* 左右に余白を追加 */
  margin-bottom: 14px;
  font-size: 12px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.result-bar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.result-count strong { font-size: 14px; }
.active-filters { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; min-width: 0; }
.filter-chip {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  display: flex; align-items: center; gap: 4px;
}
.filter-chip-x { cursor: pointer; opacity: .7; }
.filter-chip-x:hover { opacity: 1; }

/* Sort / View controls */
.result-bar-controls {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.sort-wrap { display: flex; align-items: center; gap: 4px; }
.sort-btn {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  transition: all var(--ease);
}
.view-toggle {
  display: flex;
  border-radius: var(--radius);
  overflow: hidden;
}
.view-toggle button {
  background: transparent;
  border: none;
  padding: 4px 10px;
  font-size: 14px;
  transition: all var(--ease);
}

/* Share / sidebar toggle buttons */
.btn-share-icon {
  width: 28px; height: 28px;
  border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--ease);
  flex-shrink: 0;
  cursor: pointer;
}
#btn-sidebar-toggle {
  background: transparent;
  width: 28px; height: 28px;
  border-radius: var(--radius);
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--ease);
  flex-shrink: 0;
  cursor: pointer;
}

/* ============================================================
   LINK CARDS — 構造
============================================================ */
#links-grid {
  display: none;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}
.link-card-wrap { display: contents; }
.link-card {
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all var(--ease);
  position: relative;
  display: flex;
  flex-direction: column;
  cursor: pointer;
}
.link-card.dead { opacity: .55; }
.card-actions { display: none; }
.card-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}
.card-thumb-ogp {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}
.link-card:hover .card-thumb-ogp { transform: scale(1.03); }
.card-thumb-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 6px;
}
.card-thumb-favicon-lg {
  width: 40px; height: 40px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.card-thumb-favicon-lg img { width: 24px; height: 24px; }
.card-thumb-domain { font-size: 10px; letter-spacing: .3px; }
.title-favicon {
  width: 14px; height: 14px;
  flex-shrink: 0;
  border-radius: 2px;
  vertical-align: middle;
  margin-right: 4px;
  opacity: .85;
}
#links-list .title-favicon { display: none; }

/* Gensen ribbon */
.gensen-ribbon {
  position: absolute;
  top: 6px; left: -1px;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 8px 2px 6px;
  letter-spacing: .5px;
  clip-path: polygon(0 0, 100% 0, calc(100% - 6px) 50%, 100% 100%, 0 100%);
}
.dead-badge {
  position: absolute; top: 6px; right: 6px;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
}
.card-body {
  padding: 10px 12px 8px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.card-title {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-desc {
  font-size: 13px;
  font-style: italic;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
  margin-bottom: 8px;
}
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.card-tags { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; min-width: 0; overflow: hidden; max-height: 22px; }
.card-clicks {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ============================================================
   カードポップアップ — 構造
============================================================ */
#card-popup {
  display: block;
  position: fixed;
  z-index: 500;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.6s ease, visibility 0.6s;  /* フェードアウト0.6s */
}
#card-popup.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.6s ease, visibility 0.6s;  /* フェードイン0.6s */
}
.card-popup-inner {
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  position: relative;
}
.card-popup-link-btn {
  position: absolute;
  top: 7px; right: 7px;
  width: 28px; height: 28px;
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  text-decoration: none;
  z-index: 10;
  pointer-events: none;
}
.card-popup-thumb {
  width: 100%;
  overflow: hidden;
  flex-shrink: 0;
  display: block;
  cursor: pointer;
  position: relative;
  text-decoration: none !important;
}
.card-popup-thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0);  /* 透明（ホバー前の初期状態）*/
  transition: background 0.18s ease;
  pointer-events: none;
  z-index: 5;
}
.card-popup-thumb:hover::after { background: var(--c-popup-thumb-hover, rgba(155,35,53,.18)); }  /* ホバー色はdesign.cssで上書き可 */
.card-popup-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.card-popup-thumb-placeholder {
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
}
.card-popup-body {
  padding: 10px 12px 8px;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.card-popup-title {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 6px;
}
.card-popup-desc {
  font-size: 13px;
  font-style: italic;
  line-height: 1.55;
  overflow-y: auto;
  flex: 1;
  margin-bottom: 8px;
  word-break: break-word;
  scrollbar-width: thin;
}
.card-popup-desc::-webkit-scrollbar { width: 4px; }
.card-popup-desc::-webkit-scrollbar-track { background: transparent; }
.card-popup-desc a { text-decoration: underline; }
.card-popup-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.card-popup-footer-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.card-popup-footer-btns {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  margin-left: auto;
}
.card-popup-share-btn {
  width: 24px; height: 24px;
  border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all var(--ease);
  cursor: pointer;
}
.card-popup-tags {
  display: flex; gap: 4px;
  flex-wrap: nowrap;
  overflow-x: auto;
  flex: 1; min-width: 0;
  scrollbar-width: thin;
}
.card-popup-tags::-webkit-scrollbar { height: 3px; }
.card-popup-tags::-webkit-scrollbar-track { background: transparent; }
.card-popup-clicks {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ============================================================
   LINK LIST (LIST VIEW) — 構造
============================================================ */
#links-list { display: none; }
#links-list.active { display: flex; flex-direction: column; gap: 6px; }
#links-grid.active { display: grid; }
#links-grid:not(.active) { display: none; }

.link-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  transition: background var(--ease);
  cursor: pointer;
  position: relative;
}
.link-row:first-child { border-top: none; }
.link-row.dead { opacity: .5; }
.row-thumb {
  width: 48px; height: 48px;
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.row-thumb-inner {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
}
.row-thumb-inner img {
  width: 100%; height: 100%;
  object-fit: contain;
  image-rendering: -webkit-optimize-contrast;
}
.row-body { flex: 1; min-width: 0; }
.row-title {
  font-size: 15px;
  font-weight: 700;
  display: flex; align-items: center; gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

/* OGP float */
@keyframes ogpGrowUp {
  from {
    opacity: 0;
    transform: scaleY(0.15) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scaleY(1) translateY(0);
  }
}

.row-ogp-float {
  display: none;
  position: fixed;
  width: 390px;  /* 260 × 1.5、JSで行幅に合わせて上書き */
  border-radius: 6px;
  overflow: hidden;
  z-index: 9999;
  pointer-events: none;
  box-shadow: var(--shadow-ogp-float, 0 4px 20px rgba(0,0,0,.35));
  transform-origin: bottom center;  /* 下端を起点に生える */
}
.row-ogp-float.visible {
  animation: ogpGrowUp 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.row-ogp-float img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
  border-radius: 6px;
}

.row-gensen-badge {
  font-size: 9px;
  padding: 2px 10px 2px 6px;
  font-weight: 700;
  letter-spacing: .5px;
  clip-path: polygon(0 0, 100% 0, calc(100% - 6px) 50%, 100% 100%, 0 100%);
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.row-title .tag-chip { font-size: 10px; padding: 1px 6px; font-weight: 400; }
.row-clicks {
  font-size: 12px;
  margin-left: auto;
  white-space: nowrap;
  flex-shrink: 0;
}
.row-desc {
  font-size: 13px;
  font-style: italic;
  margin-top: 2px;
  line-height: 1.55;
  word-break: break-word;
  padding-right: 8px;
  min-height: calc(1.55em * 2);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  transition: min-height 0.2s ease;
}
.row-desc a { text-decoration: underline; }
.link-row:hover .row-desc {
  overflow: visible;
  display: block;
  -webkit-line-clamp: unset;
  -webkit-box-orient: unset;
}
.row-actions {
  display: flex; gap: 4px;
  opacity: 0;
  transition: opacity var(--ease);
  flex-shrink: 0;
}
.link-row:hover .row-actions { opacity: 1; }
body.logged-in-mode .row-actions { opacity: 1; }
body.logged-in-mode .row-actions .row-share-btn { opacity: 0; transition: opacity var(--ease); }
body.logged-in-mode .link-row:hover .row-share-btn { opacity: 1; }
.row-action-btn {
  width: 28px; height: 28px;
  border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  transition: all var(--ease);
}

/* ============================================================
   REGISTER / EDIT PANEL — 構造
============================================================ */
#reg-panel {
  position: fixed;
  top: 0; right: -480px;
  width: 460px;
  height: 100vh;
  z-index: 600;
  display: flex;
  flex-direction: column;
  transition: right 0.3s cubic-bezier(.4,0,.2,1);
}
#reg-panel.open { right: 0; }
.reg-panel-header {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.reg-panel-title { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.reg-panel-close {
  background: transparent; border: none;
  font-size: 20px; line-height: 1; padding: 4px; transition: color var(--ease);
}
.reg-panel-body { flex: 1; overflow-y: auto; padding: 18px; }
.reg-panel-body::-webkit-scrollbar { width: 4px; }
.form-group { margin-bottom: 14px; }
.form-label { font-size: 11px; margin-bottom: 5px; display: block; letter-spacing: .5px; }
.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius);
  font-size: 13px;
  outline: none;
  transition: border-color var(--ease);
}
.form-textarea { resize: vertical; min-height: 140px; }
.title-favicon-row { display: flex; align-items: flex-start; gap: 8px; }
.title-favicon-row .form-input { flex: 1; }
.reg-favicon-wrap {
  width: 37px; height: 37px;  /* form-inputと同じ高さ */
  flex-shrink: 0;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
#reg-favicon-preview { width: 100%; height: 100%; object-fit: contain; }
.reg-favicon-placeholder { display: flex; align-items: center; justify-content: center; }
.url-row { display: flex; gap: 8px; }
.url-row .form-input { flex: 1; }
.btn-fetch {
  padding: 0 12px;
  border-radius: var(--radius);
  font-size: 12px;
  white-space: nowrap;
  transition: all var(--ease);
  display: flex; align-items: center; gap: 4px;
}
.btn-fetch.loading { opacity: .6; pointer-events: none; }
.thumb-preview-img {
  width: 100%; aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: 3px;
  display: none;
}
.thumb-preview-img.visible { display: block; }
/* PC版タグ編集（モバイル版と統一） */
#tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
  min-height: 0;
}
.pc-tag-chip {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  background: var(--c-tag-selected-bg, rgba(155,35,53,.1));
  border: 1px solid var(--c-tag-selected-border, rgba(155,35,53,.35));
  color: var(--c-crimson-dk);
  white-space: nowrap;
}
.pc-tag-chip button {
  color: var(--c-crimson);
  font-size: 13px;
  line-height: 1;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
#tag-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.pc-palette-chip {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  user-select: none;
  transition: all var(--ease);
  /* 色は design.css で定義 */
}
.pc-palette-chip.selected {
  /* 色は design.css で定義 */
}
.gensen-check-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius);
  /* 色は design.css で定義 */
}
.gensen-check-wrap input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--c-gold);
  cursor: pointer;
  flex-shrink: 0;
}
.gensen-check-wrap label {
  font-size: 12px;
  cursor: pointer;
  /* 色は design.css で定義 */
}
.reg-panel-footer {
  padding: 14px 18px;
  display: flex; gap: 10px;
  flex-shrink: 0;
}

/* ============================================================
   BUTTONS — 構造
============================================================ */
.btn-primary {
  flex: 1;
  border: none;
  padding: 10px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .5px;
  transition: background var(--ease);
}
.btn-secondary {
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  transition: all var(--ease);
}
.btn-danger {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  transition: all var(--ease);
}
.btn-icon {
  width: 34px; height: 34px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  transition: all var(--ease);
}

/* ============================================================
   MODAL — 構造
============================================================ */
.modal-overlay {
  position: fixed; inset: 0;
  z-index: 700;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(3px);
}
.modal-overlay.open { display: flex; }

/* 共有モーダルのみフェードイン・フェードアウト */
#share-modal {
  opacity: 0;
  visibility: hidden;
  display: flex;  /* display:noneではなくopacity/visibilityで制御 */
  transition: opacity 0.5s ease, visibility 0.5s;
}
#share-modal.open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.5s ease, visibility 0.5s;
}
.modal-box {
  border-radius: var(--radius-md);
  width: 360px;
  max-width: calc(100vw - 32px);
}
.modal-header {
  padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.modal-title { font-size: 13px; font-weight: 700; }
.modal-close {
  background: transparent; border: none;
  font-size: 18px; line-height: 1; transition: color var(--ease);
}
.modal-body { padding: 20px; }
.modal-footer { padding: 0 20px 16px; }
.login-hint { font-size: 11px; margin-bottom: 14px; }
.share-url-row { display: flex; gap: 8px; margin-bottom: 16px; align-items: center; }
.share-url-input {
  flex: 1;
  padding: 7px 10px;
  border-radius: var(--radius);
  font-size: 11px;
  outline: none;
  overflow: hidden; text-overflow: ellipsis;
}
.btn-copy {
  width: 34px; height: 34px;
  flex-shrink: 0;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--ease);
  cursor: pointer;
}
.qr-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; }
#qr-canvas { padding: 10px; border-radius: var(--radius); }
/* QR保存ボタン: URLテキストボックス左のアイコンボタン */
.btn-qr-dl {
  width: 34px; height: 34px;
  flex-shrink: 0;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--ease);
  cursor: pointer;
}

/* ============================================================
   LINK CHECK — 構造
============================================================ */
.linkcheck-panel {
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  overflow: hidden;
  display: none;
}
.linkcheck-panel.visible { display: block; }
.linkcheck-header {
  padding: 10px 14px;
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; font-weight: 700;
}
.linkcheck-progress {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  overflow: hidden;
}
.linkcheck-progress-bar {
  height: 100%;
  width: 0%;
  transition: width 0.3s ease;
}
.linkcheck-results { padding: 10px 14px; font-size: 12px; }

/* ============================================================
   DROP ZONE — 構造
============================================================ */
#drop-overlay {
  position: fixed; inset: 0;
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  backdrop-filter: blur(4px);
}
#drop-overlay.active { display: flex; }
.drop-zone-box {
  border-radius: 12px;
  padding: 60px 80px;
  text-align: center;
}
.drop-zone-box .drop-icon { font-size: 64px; margin-bottom: 16px; }
.drop-zone-box h2 { font-family: var(--font-disp); font-size: 32px; letter-spacing: 2px; }
.drop-zone-box p { font-size: 13px; margin-top: 8px; }

/* ============================================================
   MOBILE BANNER — 構造
============================================================ */
#mobile-banner {
  padding: 10px 20px;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
}
#mobile-banner.visible { display: flex; }
.mobile-banner-text { flex: 1; }
.mobile-banner-actions { display: flex; gap: 8px; }
.btn-banner-yes, .btn-banner-no {
  padding: 5px 12px;
  border-radius: var(--radius);
  font-size: 11px;
  transition: all var(--ease);
}

/* ============================================================
   TOAST — 構造
============================================================ */
#toast-container {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%);
  z-index: 900;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.toast {
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 13px;
  animation: toastIn 0.2s ease, toastOut 0.3s ease 2s forwards;
  white-space: nowrap;
}
@keyframes toastIn  { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; } }

/* ============================================================
   EMPTY STATE / SPINNER — 構造
============================================================ */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; opacity: .4; }
.empty-state p { font-size: 13px; }
.spinner {
  width: 20px; height: 20px;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   HIGHLIGHT ANIMATION
============================================================ */
.link-card.highlight { animation: highlightPulse 2s ease; }
.link-row.highlight  { animation: highlightPulse 2s ease; }
@keyframes highlightPulse {
  0%  { box-shadow: 0 0 0 3px var(--c-gold); }
  100%{ box-shadow: none; }
}

/* ============================================================
   SCROLLBAR GLOBAL — 構造
============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--c-bg); }
::-webkit-scrollbar-thumb { border-radius: 3px; }

/* ============================================================
   Wiki記法入力補助ボタン
============================================================ */
.form-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.form-label-row .form-label { margin-bottom: 0; display: inline; }
.btn-wiki-insert {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  font-size: 11px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
  /* 色は design.css で定義 */
}

/* ビューボタン内SVGのクリック干渉防止 */
#btn-view-card svg, #btn-view-list svg { pointer-events: none; }

/* 特別タグ（すべて・厳選）と通常タグの区切り線 */
.tag-divider {
  height: 1px;
  margin: 4px 8px;
  /* 色は design.css で定義 */
}
