/* LinkPosty - Modern Dashboard Styles - v20251116003 - Minimal top padding */

/* リセットとベーススタイル */
* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
}

html {
  overflow-x: hidden;
}

/* Posty風カラー変数 - マゼンタ/紫系 */
:root {
  --posty-primary: #D946EF;
  --posty-primary-dark: #C026D3;
  --posty-primary-light: #F3E8FF;
  --posty-secondary: #A855F7;
  --posty-accent: #E879F9;
  --posty-bg: #FFFFFF;
  --posty-bg-alt: #FAFAFA;
  --posty-text: #1F2937;
  --posty-text-light: #6B7280;
  --posty-border: #E5E7EB;
  --posty-gradient-start: #D946EF;
  --posty-gradient-end: #9333EA;
}

/* デスクトップタブを非表示 - ハンバーガーメニューに統一 */
.tabs-container {
  display: none !important;
}

/* ダッシュボードレイアウト */
.dashboard-container {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 2rem;
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem 2rem 2rem 2rem; /* 上部に1remの美しいスペース */
  min-height: calc(100vh - 80px);
}

/* タブパネルの上部マージンをリセット */
.dashboard-container .edit-panel .tab-panel {
  margin-top: 0 !important;
}

@media (max-width: 1024px) {
  .dashboard-container {
    grid-template-columns: 1fr;
    padding: 0.75rem 1rem 1rem 1rem; /* 上部に適度なスペース */
    gap: 1rem;
  }
  
  /* モバイルではプレビューパネルを非表示 */
  .preview-panel {
    display: none !important;
  }
}

@media (max-width: 640px) {
  .dashboard-container {
    padding: 0.5rem 0.75rem 0.75rem 0.75rem; /* 上部に控えめなスペース */
  }
}

/* 左パネル：編集エリア */
.edit-panel {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-top: 0;
  padding-top: 0;
  position: relative;
}

/* 右パネル：プレビューエリア */
.preview-panel {
  position: sticky;
  top: 2rem;
  height: fit-content;
}

/* スマホプレビューフレーム */
.phone-preview {
  background: linear-gradient(135deg, var(--posty-primary) 0%, var(--posty-primary-dark) 100%);
  border-radius: 2rem;
  padding: 1.5rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.phone-screen {
  background: white;
  border-radius: 1.5rem;
  overflow: hidden;
  box-shadow: 0 0 0 8px #1a1a1a;
}

.phone-notch {
  height: 20px;
  background: #1a1a1a;
  border-radius: 0 0 12px 12px;
  margin: 0 auto;
  width: 120px;
}

.phone-content {
  padding: 0;
  height: 600px;
  overflow-y: auto;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

/* プレビューセクション */
.preview-section {
  padding: 2rem 1.5rem;
  transition: background 0.3s ease;
}

.preview-top-section {
  background: linear-gradient(135deg, #D946EF 0%, #9333EA 100%);
  color: white;
}

.preview-top-section h1,
.preview-top-section p {
  color: white;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.preview-links-section {
  background: #F5F7FA;
  min-height: 300px;
}

/* プロフィールカード */
.profile-card {
  background: white;
  border-radius: 1rem;
  padding: 1.25rem 1.5rem 1.5rem 1.5rem; /* 上部に適度なスペース */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  margin-top: 0 !important;
}

.profile-card > *:first-child {
  margin-top: 0;
}

.profile-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

@media (max-width: 640px) {
  .profile-card {
    padding: 1rem 0.75rem 1rem 0.75rem; /* バランスの良いスペース */
    border-radius: 0.75rem;
  }
  
  .profile-card h2 {
    font-size: 1.125rem;
  }
}

/* リンクカード */
.link-card {
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1rem;
  margin-bottom: 0.75rem;
  cursor: move;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.link-card:hover {
  border-color: var(--posty-primary);
  box-shadow: 0 4px 12px rgba(217, 70, 239, 0.2);
}

.link-card.dragging {
  opacity: 0.5;
  cursor: grabbing;
}

.link-card.drag-over {
  border-color: var(--posty-primary);
  background: #f3f4f6;
}

@media (max-width: 640px) {
  .link-card {
    padding: 0.75rem 0.5rem;
    gap: 0.5rem;
    flex-wrap: nowrap;
    overflow: hidden;
  }
  
  .link-card .drag-handle {
    font-size: 1.125rem;
    flex-shrink: 0;
  }
  
  .link-card .text-2xl {
    font-size: 1.5rem;
    flex-shrink: 0;
  }
  
  .link-card .flex-1 {
    min-width: 0;
    flex: 1;
    overflow: hidden;
  }
  
  .link-card .flex-1 h3 {
    font-size: 0.875rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  
  .link-card .flex-1 a {
    font-size: 0.75rem;
  }
  
  .link-card .flex-1 .text-xs {
    font-size: 0.7rem;
  }
  
  .link-card .flex.gap-2 {
    flex-shrink: 0;
    gap: 0.25rem;
  }
  
  .link-card .flex.gap-2 button {
    padding: 0.5rem;
    min-width: 36px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .link-card .flex.gap-2 button i {
    font-size: 1rem;
  }
}

/* リンクプレビュー（公開ページ風） */
.preview-link {
  background: white;
  border-radius: 0.75rem;
  padding: 1rem;
  margin-bottom: 0.75rem;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
  cursor: pointer;
  text-decoration: none;
  display: block;
  color: inherit;
}

.preview-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* アバター */
.avatar-preview {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--posty-primary) 0%, var(--posty-primary-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 2rem;
  margin: 0 auto 1rem;
}

.avatar-upload {
  position: relative;
  width: 100px;
  height: 100px;
  margin: 0 auto;
}

.avatar-upload img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.avatar-upload-btn {
  position: absolute;
  bottom: 0;
  right: 0;
  background: var(--posty-primary);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  cursor: pointer;
  border: 3px solid white;
  transition: all 0.2s ease;
}

.avatar-upload-btn:hover {
  background: var(--posty-primary-dark);
  transform: scale(1.1);
}

/* モーダル */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal.active {
  opacity: 1;
  pointer-events: all;
}

.modal-content {
  background: white;
  border-radius: 1rem;
  padding: 2rem;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: hidden;
  transform: scale(0.9);
  transition: transform 0.2s ease;
  box-sizing: border-box;
}

.modal.active .modal-content {
  transform: scale(1);
}

@media (max-width: 640px) {
  .modal {
    padding: 0;
    align-items: flex-end;
  }
  
  .modal-content {
    padding: 1.25rem;
    border-radius: 1rem 1rem 0 0;
    max-height: 85vh;
    max-width: 100vw;
    width: 100vw;
  }
  
  .modal-content h3 {
    font-size: 1.125rem;
  }
  
  .modal-content * {
    box-sizing: border-box;
    max-width: 100%;
  }
}

/* SNSグリッド */
.sns-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.sns-card {
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.sns-card:hover {
  border-color: var(--posty-primary);
  background: #f9fafb;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(217, 70, 239, 0.15);
}

.sns-card.selected {
  border-color: var(--posty-primary);
  background: #f3f4f6;
  box-shadow: 0 0 0 3px rgba(217, 70, 239, 0.1);
}

@media (max-width: 640px) {
  .sns-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
  }
  
  .sns-card {
    padding: 0.75rem 0.5rem;
  }
  
  .sns-card-icon {
    width: 40px !important;
    height: 40px !important;
  }
  
  .sns-card-icon i {
    font-size: 1.5rem !important;
  }
  
  .sns-card-name {
    font-size: 0.75rem;
    word-break: break-word;
  }
}

.sns-card-icon {
  font-size: 2rem;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
}

.sns-card-icon i {
  font-size: 1.75rem;
}

.sns-card.selected .sns-card-icon {
  background: linear-gradient(135deg, var(--posty-primary) 0%, var(--posty-primary-dark) 100%);
}

.sns-card.selected .sns-card-icon i {
  color: white !important;
}

.sns-card-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
}

.sns-card.selected .sns-card-name {
  color: var(--posty-primary);
}

/* 絵文字ピッカー */
.emoji-picker {
  background: #f9fafb;
  border: 2px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1rem;
  max-height: 200px;
  overflow-y: auto;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 0.5rem;
}

.emoji-item {
  font-size: 1.5rem;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
  touch-action: manipulation;
}

.emoji-item:hover {
  background: #e5e7eb;
  transform: scale(1.2);
}

.emoji-item.selected {
  background: var(--posty-primary);
  transform: scale(1.1);
}

@media (max-width: 640px) {
  .emoji-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 0.375rem;
  }
  
  .emoji-item {
    width: 44px;
    height: 44px;
    font-size: 1.75rem;
  }
  
  .emoji-picker {
    max-height: 240px;
  }
}

/* タブ切り替え */
.tab-buttons {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid #e5e7eb;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab-button {
  padding: 0.75rem 1.5rem;
  border: none;
  background: none;
  color: #6b7280;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.tab-button:hover {
  color: #374151;
  background: #f9fafb;
  border-radius: 0.5rem 0.5rem 0 0;
}

.tab-button.active {
  color: var(--posty-primary);
  border-bottom-color: var(--posty-primary);
}

.tab-content {
  display: none;
  overflow-x: hidden;
}

.tab-content.active {
  display: block;
}

/* ドラッグハンドル */
.drag-handle {
  cursor: move;
  color: #9ca3af;
  font-size: 1.25rem;
}

.drag-handle:hover {
  color: #6b7280;
}

/* 空状態 */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: #9ca3af;
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 1rem;
  display: block;
}

/* ボタンスタイル */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: 0.5rem;
  font-weight: 600;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
  text-decoration: none;
  min-height: 44px;
  touch-action: manipulation;
}

.btn-primary {
  background: var(--posty-primary);
  color: white;
}

.btn-primary:hover {
  background: var(--posty-primary-dark);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-secondary {
  background: #f3f4f6;
  color: #374151;
}

.btn-secondary:hover {
  background: #e5e7eb;
}

.btn-secondary:active {
  transform: scale(0.98);
}

.btn-danger {
  background: #ef4444;
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-danger:active {
  transform: scale(0.98);
}

.btn-outline {
  background: white;
  border: 2px solid #e5e7eb;
  color: #374151;
}

.btn-outline:hover {
  border-color: #d1d5db;
  background: #f9fafb;
}

@media (max-width: 640px) {
  .btn {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    min-height: 48px;
  }
}

/* フォーム要素 */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

.form-input {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #e5e7eb;
  border-radius: 0.5rem;
  font-size: 1rem;
  transition: all 0.2s ease;
  min-height: 44px;
}

.form-input:focus {
  outline: none;
  border-color: var(--posty-primary);
  box-shadow: 0 0 0 3px rgba(217, 70, 239, 0.1);
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

@media (max-width: 640px) {
  .form-input,
  .form-textarea {
    font-size: 16px;
    padding: 0.875rem;
    min-height: 48px;
  }
  
  .form-label {
    font-size: 0.8125rem;
  }
}

/* ユーティリティ */
.text-center {
  text-align: center;
}

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }

.flex {
  display: flex;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-2 {
  gap: 0.5rem;
}

.gap-3 {
  gap: 0.75rem;
}

/* スクロールバーカスタマイズ */
.phone-content::-webkit-scrollbar {
  width: 6px;
}

.phone-content::-webkit-scrollbar-track {
  background: transparent;
}

.phone-content::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

.phone-content::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

/* レイアウト選択 */
.layout-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 0.5rem;
}

.layout-option {
  border: 2px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  touch-action: manipulation;
}

.layout-option:hover {
  border-color: var(--posty-primary);
  background: #f9fafb;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(217, 70, 239, 0.15);
}

.layout-option.selected {
  border-color: var(--posty-primary);
  background: var(--posty-primary-light);
  box-shadow: 0 0 0 3px rgba(217, 70, 239, 0.1);
}

@media (max-width: 640px) {
  .layout-selector {
    gap: 0.75rem;
  }
  
  .layout-option {
    padding: 0.75rem 0.5rem;
  }
  
  .layout-option-name {
    font-size: 0.8125rem;
  }
  
  .layout-option-desc {
    font-size: 0.6875rem;
  }
  
  .layout-preview {
    min-height: 60px;
  }
}

.layout-preview {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.layout-preview-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}

.layout-preview-list .preview-item {
  height: 16px;
  background: linear-gradient(90deg, #e5e7eb 0%, #f3f4f6 100%);
  border-radius: 0.25rem;
}

.layout-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  width: 100%;
}

.layout-preview-grid .preview-item {
  height: 28px;
  background: linear-gradient(135deg, #e5e7eb 0%, #f3f4f6 100%);
  border-radius: 0.25rem;
}

.layout-preview-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}

.layout-preview-card .card-item {
  height: 32px;
  background: linear-gradient(90deg, #e5e7eb 0%, #d1d5db 50%, #f3f4f6 100%);
  border-radius: 0.25rem;
  position: relative;
}

.layout-preview-card .card-item::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 4px;
  width: 24px;
  height: 24px;
  background: #9ca3af;
  border-radius: 0.125rem;
}

.layout-option-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.25rem;
}

.layout-option.selected .layout-option-name {
  color: var(--posty-primary);
}

.layout-option-desc {
  font-size: 0.75rem;
  color: #6b7280;
}

/* プレビューレイアウト - リスト */
.preview-links.layout-list .preview-link {
  display: flex;
  align-items: center;
  text-align: left;
  padding: 0.75rem 1rem;
}

.preview-links.layout-list .preview-link .link-icon {
  margin-right: 0.75rem;
}

/* プレビューレイアウト - グリッド */
.preview-links.layout-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.preview-links.layout-grid .preview-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem 0.5rem;
  min-height: 100px;
}

.preview-links.layout-grid .link-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.preview-links.layout-grid .link-title {
  font-size: 0.875rem;
  text-align: center;
  word-break: break-word;
}

/* プレビューレイアウト - カード */
.preview-links.layout-card .preview-link {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.preview-links.layout-card .link-card-image {
  width: 100%;
  height: 120px;
  background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%);
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
}

.preview-links.layout-card .link-card-content {
  padding: 1rem;
  text-align: left;
}

.preview-links.layout-card .link-title {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
  color: #1f2937;
}

.preview-links.layout-card .link-description {
  font-size: 0.75rem;
  color: #6b7280;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 公開プロフィールページのレイアウト対応 */
/* リストレイアウト（デフォルト） */
.layout-list {
  display: flex !important;
  flex-direction: column !important;
  gap: 0.75rem !important;
}

.layout-list > a {
  display: block !important;
}

/* グリッドレイアウト */
.layout-grid {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr) !important;
  gap: 0.75rem !important;
}

.layout-grid > a {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  text-align: center !important;
  padding: 1.5rem 1rem !important;
  min-height: 120px !important;
}

.layout-grid .link-icon {
  font-size: 3rem !important;
  margin-bottom: 0.75rem !important;
}

.layout-grid .link-title {
  font-size: 0.875rem !important;
  word-break: break-word !important;
}

/* カードレイアウト */
.layout-card {
  display: flex !important;
  flex-direction: column !important;
  gap: 0.75rem !important;
}

.layout-card > a {
  display: flex !important;
  flex-direction: column !important;
  padding: 0 !important;
  overflow: hidden !important;
}

.layout-card .link-card-image {
  width: 100% !important;
  height: 160px !important;
  background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%) !important;
  object-fit: cover !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 4rem !important;
}

.layout-card .link-card-content {
  padding: 1rem !important;
  text-align: left !important;
}

.layout-card .link-title {
  font-weight: 600 !important;
  font-size: 1rem !important;
  margin-bottom: 0.25rem !important;
}

.layout-card .link-description {
  font-size: 0.875rem !important;
  color: #6b7280 !important;
  line-height: 1.4 !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
}

/* ユーティリティクラス */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ヘッダーのスマホ対応 */
@media (max-width: 640px) {
  header .container {
    padding: 0.75rem 1rem !important;
  }
  
  header h1 {
    font-size: 1.25rem !important;
  }
  
  header .flex.items-center.gap-4 {
    gap: 0.75rem !important;
  }
  
  header a,
  header button {
    font-size: 0.875rem;
  }
}

/* タブボタンのスマホ対応 */
@media (max-width: 640px) {
  .tab-buttons {
    gap: 0.25rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .tab-button {
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    white-space: nowrap;
    flex-shrink: 0;
  }
}

/* アバター関連 */
.avatar-preview-container {
  width: 100px;
  height: 100px;
  position: relative;
}

.avatar-preview {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--posty-primary);
}

.avatar-placeholder {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--posty-bg-alt);
  border: 2px dashed var(--posty-border);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ヒーローセクション背景プレビュー */
.hero-bg-preview-container {
  width: 200px;
  height: 60px;
  position: relative;
  border-radius: 8px;
  overflow: hidden;
}

.hero-bg-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 2px solid var(--posty-primary);
  border-radius: 8px;
}

.hero-bg-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #f3e8ff 0%, #e9d5ff 100%);
  border: 2px dashed var(--posty-border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--posty-primary);
  margin: 0 auto 1rem;
}

.profile-avatar-placeholder {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--posty-bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  border: 2px solid var(--posty-border);
}

/* アバターアップロードのスマホ対応 */
@media (max-width: 640px) {
  .avatar-upload {
    width: 80px;
    height: 80px;
  }
  
  .avatar-upload-btn {
    width: 28px;
    height: 28px;
    font-size: 0.75rem;
  }
  
  .avatar-preview-container {
    width: 80px;
    height: 80px;
  }
}

/* OGPプレビューのスマホ対応 */
@media (max-width: 640px) {
  #ogpPreview {
    padding: 0.75rem;
  }
  
  #ogpPreview img {
    max-height: 120px;
  }
  
  #ogpPreview .text-sm {
    font-size: 0.8125rem;
  }
  
  #ogpPreview .text-xs {
    font-size: 0.75rem;
  }
}

/* リンク編集ボタンのスマホ対応 */
@media (max-width: 640px) {
  .link-card .flex.gap-2 {
    flex-wrap: wrap;
  }
  
  .link-card button {
    min-width: auto;
    padding: 0.5rem 0.75rem;
  }
  
  .link-card button i {
    margin: 0;
  }
  
  .link-card .btn-secondary,
  .link-card .btn-danger {
    font-size: 0.875rem;
  }
}

/* 空状態のスマホ対応 */
@media (max-width: 640px) {
  .empty-state {
    padding: 2rem 1rem;
  }
  
  .empty-state i {
    font-size: 2.5rem;
  }
  
  .empty-state p {
    font-size: 0.875rem;
  }
}

/* ユーティリティ: タッチデバイスのアクティブ状態 */
@media (hover: none) and (pointer: coarse) {
  .btn:active,
  .link-card:active,
  .sns-card:active,
  .layout-option:active,
  .emoji-item:active {
    opacity: 0.8;
  }
}

/* モバイルタブナビゲーション */
/* ハンバーガーメニュー - レスポンシブ配置 */
.mobile-menu-toggle {
  display: flex !important;
  align-items: center;
  justify-content: center;
  position: fixed !important;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--posty-primary) 0%, var(--posty-primary-dark) 100%);
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(217, 70, 239, 0.4);
  cursor: pointer;
  z-index: 998 !important;
  font-size: 1.5rem;
  transition: all 0.3s ease;
  opacity: 0.5 !important;
  backdrop-filter: blur(8px) !important;
}

/* デスクトップ: 左上に配置（プレビューと被らない） */
@media (min-width: 1025px) {
  .mobile-menu-toggle {
    top: 76px !important;
    left: 20px !important;
  }
}

/* タブレット・モバイル: 右上に配置（ヘッダー直下） */
@media (max-width: 1024px) {
  .mobile-menu-toggle {
    top: 68px !important;
    right: 20px !important;
  }
}

.mobile-menu-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(217, 70, 239, 0.5);
}

.mobile-menu-toggle:active {
  transform: scale(0.95);
}

.mobile-menu {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  z-index: 999 !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mobile-menu.active {
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

.mobile-menu-overlay {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  background: rgba(0, 0, 0, 0);
  backdrop-filter: blur(0px);
  transition: background 0.3s ease, backdrop-filter 0.3s ease;
}

.mobile-menu.active .mobile-menu-overlay {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.mobile-menu-content {
  position: absolute !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  background: white;
  border-radius: 20px 20px 0 0;
  padding: 1.5rem;
  max-height: 70vh;
  overflow-y: auto;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.mobile-menu.active .mobile-menu-content {
  transform: translateY(0);
}

/* Animations removed - using CSS transitions instead */

.mobile-menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #e5e7eb;
}

.mobile-menu-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #f3f4f6;
  border: none;
  color: #6b7280;
  font-size: 1.25rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-menu-close:hover {
  background: #e5e7eb;
  color: #374151;
}

.mobile-menu-items {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.mobile-menu-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  text-align: left;
}

.mobile-menu-item i {
  font-size: 1.25rem;
  width: 24px;
  text-align: center;
}

.mobile-menu-item.active {
  background: linear-gradient(135deg, var(--posty-primary) 0%, var(--posty-primary-dark) 100%);
  color: white;
  border-color: var(--posty-primary);
}

.mobile-menu-item:hover:not(.active) {
  background: #faf5ff;
  border-color: var(--posty-primary);
  color: var(--posty-primary);
}

/* 旧モバイルタブを非表示 */
.mobile-tabs,
.mobile-tab-btn {
  display: none !important;
}

.tab-panel {
  display: none;
}

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

/* タブパネル内の最初の要素の上部マージンを削除 */
.tab-panel > *:first-child {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

@media (max-width: 1024px) {
  /* プレビューパネルを右下に固定（タブレット・モバイル） */
  .preview-panel {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    width: 180px !important;
    z-index: 997 !important;
    opacity: 0.9 !important;
    transition: opacity 0.3s ease !important;
  }
  
  .preview-panel:hover {
    opacity: 1 !important;
  }
  
  .phone-preview {
    padding: 0.5rem !important;
    border-radius: 1rem !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3) !important;
  }
  
  .phone-screen {
    border-radius: 0.75rem !important;
    font-size: 0.65rem !important;
  }
  
  .dashboard-container {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 768px) {
  
  .dashboard-container {
    padding: 0;
  }
  
  .edit-panel {
    gap: 0;
    padding-bottom: 80px; /* フローティングボタンのスペース確保 */
  }
  
  .profile-card {
    border-radius: 0;
    margin-bottom: 0;
    padding: 0.75rem 0.75rem 1rem 0.75rem; /* 上部パディングを0.75remに減らす */
  }
  
  /* ヘッダーの調整 */
  header {
    position: sticky;
    top: 0;
    z-index: 100;
  }
  
  header .container {
    padding: 0.75rem 1rem;
    max-width: 100%;
  }
  
  header h1 {
    font-size: 1.25rem;
  }
  
  header .flex.items-center {
    gap: 0.75rem;
  }
  
  header a,
  header button {
    padding: 0.5rem;
    font-size: 1.125rem;
  }
  
  header .hidden.sm\\:inline {
    display: none !important;
  }
  
  /* フォーム要素のモバイル最適化 */
  .form-input,
  .form-textarea {
    font-size: 16px !important;
  }
  
  /* ボタングループの調整 */
  .flex.justify-between {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .flex.justify-between .btn {
    width: 100%;
  }
  
  /* フォーム内のflexコンテナ */
  .form-group .flex {
    flex-wrap: wrap;
  }
  
  .modal-content .flex.gap-3 {
    flex-direction: column;
  }
  
  .modal-content .flex.gap-3 .btn {
    width: 100%;
  }
  
  /* コンテナの調整 */
  .container {
    max-width: 100% !important;
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  /* URL入力部分の調整 */
  .form-group .flex span {
    font-size: 0.65rem;
    padding: 0 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
  }
  
  .form-group .flex input {
    min-width: 0;
  }
  
  /* レイアウトセレクターの調整 */
  .layout-selector {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  
  .layout-option {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 1rem;
    align-items: center;
    text-align: left;
    padding: 1rem;
  }
  
  .layout-preview {
    min-height: 80px;
  }
  
  /* アバターアップロード部分の調整 */
  .avatar-preview-container {
    width: 80px;
    height: 80px;
  }
  
  /* SNSグリッドの調整 */
  .sns-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
  }
  
  .sns-card {
    padding: 0.75rem 0.5rem;
  }
  
  .sns-card-name {
    font-size: 0.75rem;
  }
  
  /* リンクカードの調整 */
  .link-card {
    flex-wrap: wrap;
  }
  
  .link-card .flex-1 {
    flex: 1;
    min-width: 0;
  }
  
  .link-card .gap-2 {
    gap: 0.5rem;
  }
  
  /* モーダルの調整 */
  .modal {
    align-items: flex-end;
    padding: 0;
  }
  
  .modal-content {
    border-radius: 1rem 1rem 0 0;
    max-height: 90vh;
    padding: 1.5rem 1rem;
    max-width: 100vw;
    width: 100vw;
  }
  
  .modal-content h3 {
    font-size: 1.125rem;
  }
  
  .modal-content * {
    box-sizing: border-box;
    max-width: 100%;
  }
  
  /* タブボタンの調整 */
  .tab-buttons {
    margin-left: -1rem;
    margin-right: -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  .tab-button {
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
  }
  
  /* 絵文字ピッカーの調整 */
  .emoji-grid {
    grid-template-columns: repeat(6, 1fr);
  }
  
  .emoji-item {
    width: 48px;
    height: 48px;
  }
  
  /* モバイルでのボタン最適化 */
  .btn-mobile-icon .btn-text {
    display: inline;
  }
}

/* タブレット以下でボタンテキストを非表示 */
@media (max-width: 480px) {
  .btn-mobile-icon {
    padding: 0.75rem;
    min-width: 48px;
  }
  
  .btn-mobile-icon .btn-text {
    display: none;
  }
  
  .btn-mobile-icon i {
    margin: 0;
  }
}

/* テーマカスタマイズ */
.template-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 1024px) {
  .template-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.template-card {
  position: relative;
  border: 2px solid #e5e7eb;
  border-radius: 0.75rem;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 180px; /* プレビューボタンのスペースを確保 */
}

.template-card:hover {
  border-color: var(--posty-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(217, 70, 239, 0.15);
}

.template-card.selected {
  border-color: var(--posty-primary);
  box-shadow: 0 0 0 3px rgba(217, 70, 239, 0.1);
}

.template-preview {
  height: 100px;
  width: 100%;
}

.template-name {
  padding: 0.5rem;
  text-align: center;
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
  background: white;
}

.template-card.selected .template-name {
  color: var(--posty-primary);
  background: #faf5ff;
}

.color-settings {
  background: #f9fafb;
  border: 2px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1rem;
}

.color-input-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.color-input {
  width: 80px;
  height: 40px;
  border: 2px solid #e5e7eb;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.color-input:hover {
  border-color: var(--posty-primary);
}

@media (max-width: 640px) {
  .template-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }
  
  .template-preview {
    height: 80px;
  }
  
  .template-name {
    font-size: 0.75rem;
    padding: 0.375rem;
  }
  
  .color-input {
    width: 60px;
    height: 36px;
  }
}

/* プリセット背景画像 */
.preset-backgrounds-section {
  background: #f9fafb;
  border: 2px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1rem;
}

.preset-bg-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
  margin-top: 0.75rem;
}

@media (max-width: 768px) {
  .preset-bg-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 640px) {
  .preset-bg-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.preset-bg-item {
  position: relative;
  width: 100%;
  padding-bottom: 100%; /* 1:1 aspect ratio */
  border-radius: 0.5rem;
  cursor: pointer;
  border: 2px solid #e5e7eb;
  transition: all 0.2s ease;
  overflow: hidden;
}

.preset-bg-item:hover {
  border-color: var(--posty-primary);
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(217, 70, 239, 0.2);
}

.preset-bg-item.selected {
  border-color: var(--posty-primary);
  box-shadow: 0 0 0 3px rgba(217, 70, 239, 0.2);
}

.preset-bg-item.selected::after {
  content: '✓';
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  width: 1.25rem;
  height: 1.25rem;
  background: var(--posty-primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: bold;
}

.preset-bg-thumbnail {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
}

/* テーマカスタマイズ */
.template-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.template-card {
  position: relative;
  border: 2px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 0.75rem;
  padding-bottom: 4rem; /* プレビューボタンのスペースを確保 */
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 180px;
}

.template-card:hover {
  border-color: var(--posty-primary);
  box-shadow: 0 4px 12px rgba(217, 70, 239, 0.15);
}

.template-card.selected {
  border-color: var(--posty-primary);
  background: var(--posty-primary-light);
  box-shadow: 0 0 0 3px rgba(217, 70, 239, 0.1);
}

.template-preview {
  width: 100%;
  height: 100px;
  border-radius: 0.5rem;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.template-name {
  font-size: 0.875rem;
  font-weight: 600;
  text-align: center;
  color: #374151;
}

.template-card.selected .template-name {
  color: var(--posty-primary);
}

.color-input-group {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.color-input {
  width: 80px;
  height: 40px;
  border: 2px solid #e5e7eb;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.color-input:hover {
  border-color: var(--posty-primary);
}

.bg-image-upload-group {
  padding: 0.75rem;
  background: #f9fafb;
  border-radius: 0.5rem;
}

.bg-preview {
  width: 100%;
  height: 80px;
  border-radius: 0.5rem;
  background-size: cover;
  background-position: center;
  border: 2px solid #e5e7eb;
}

@media (max-width: 640px) {
  .template-grid {
    grid-template-columns: 1fr;
  }
}

/* アクセス解析 */
.analytics-container {
  width: 100%;
  margin-top: 0;
}

.analytics-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: linear-gradient(135deg, var(--posty-primary-light) 0%, #fff 100%);
  border: 1px solid var(--posty-border);
  border-radius: 1rem;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(217, 70, 239, 0.2);
}

.stat-icon {
  width: 48px;
  height: 48px;
  background: var(--posty-primary);
  color: white;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stat-content {
  flex: 1;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--posty-text-secondary);
  margin-bottom: 0.25rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: bold;
  color: var(--posty-text);
}

.analytics-chart,
.analytics-details {
  background: white;
  border: 1px solid var(--posty-border);
  border-radius: 1rem;
  padding: 1.5rem;
}

.chart-container {
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.analytics-table {
  overflow-x: auto;
}

@media (max-width: 768px) {
  .analytics-summary {
    grid-template-columns: 1fr;
  }
  
  .stat-card {
    padding: 1rem;
  }
  
  .stat-value {
    font-size: 1.5rem;
  }
}

/* トーストアニメーション */
@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

/* アコーディオンスタイル */
.accordion-section {
  margin-bottom: 1rem;
  border: 2px solid #e5e7eb;
  border-radius: 0.75rem;
  overflow: hidden;
  background: white;
}

.accordion-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: white;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.accordion-header:hover {
  background: #f9fafb;
}

.accordion-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #1f2937;
}

.accordion-title i {
  font-size: 1rem;
}

.accordion-icon {
  font-size: 0.875rem;
  color: #6b7280;
  transition: transform 0.3s ease;
}

.accordion-header.active .accordion-icon {
  transform: rotate(180deg);
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  padding: 0 1rem;
}

.accordion-content.active {
  max-height: 3000px;
  padding: 0 1rem 1rem;
}

/* モバイルでのアコーディオン専用調整 */
@media (max-width: 768px) {
  .accordion-section {
    margin-bottom: 0.75rem;
  }
  
  .accordion-header {
    padding: 0.875rem;
  }
  
  .accordion-content.active {
    padding: 0 0.875rem 0.875rem;
  }
}

/* ユーザー名バリデーション */
.username-validation {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.username-validation.checking {
  background: #f3f4f6;
  color: #6b7280;
  border: 1px solid #e5e7eb;
}

.username-validation.checking::before {
  content: '\f110';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  animation: fa-spin 1s infinite linear;
}

.username-validation.available {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #10b981;
}

.username-validation.available::before {
  content: '\f00c';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
}

.username-validation.unavailable {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #ef4444;
}

.username-validation.unavailable::before {
  content: '\f071';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
}

/* ユーザー名入力のボーダー色 */
#username.valid {
  border-color: #10b981;
}

#username.invalid {
  border-color: #ef4444;
}

@keyframes fa-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* フローティングプレビューボタン（モバイルのみ表示） */
.floating-preview-btn {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 3.5rem;
  height: 3.5rem;
  background: linear-gradient(135deg, var(--posty-primary) 0%, var(--posty-secondary) 100%);
  color: white;
  border: none;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(217, 70, 239, 0.4);
  cursor: pointer;
  display: none; /* デフォルトは非表示 */
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  z-index: 999;
  transition: all 0.3s ease;
  opacity: 0.5 !important;
  backdrop-filter: blur(8px) !important;
}

.floating-preview-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(217, 70, 239, 0.6);
}

.floating-preview-btn:active {
  transform: scale(0.95);
}

.floating-btn-text {
  display: none;
}

/* タブレット以下でフローティングボタンを表示 */
@media (max-width: 1024px) {
  .floating-preview-btn {
    display: flex;
  }
}

/* モバイルプレビューモーダル */
.mobile-preview-modal {
  display: none; /* デフォルトは非表示 */
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
}

.mobile-preview-modal.active {
  display: block;
}

.mobile-preview-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.mobile-preview-content {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 480px;
  background: white;
  display: flex;
  flex-direction: column;
  animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

.mobile-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, var(--posty-primary) 0%, var(--posty-secondary) 100%);
  flex-shrink: 0;
}

.mobile-preview-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  background: #f9fafb;
}

.phone-preview-mobile {
  margin: 0 auto;
}

/* モバイルプレビューモーダル内のphone-previewを調整 */
.mobile-preview-body .phone-preview-mobile {
  width: 100%;
  max-width: 375px;
  margin: 0 auto;
}

/* 小さい画面ではさらにコンパクトに */
@media (max-width: 480px) {
  .mobile-preview-content {
    max-width: 100%;
  }
  
  .mobile-preview-body {
    padding: 1rem;
  }
  
  .mobile-preview-body .phone-preview-mobile {
    max-width: 100%;
  }
}

/* アドレス帳スタイル */
.addressbook-entry {
  padding: 1rem;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  transition: all 0.2s ease;
  cursor: pointer;
}

.addressbook-entry:hover {
  border-color: var(--posty-primary);
  box-shadow: 0 2px 8px rgba(217, 70, 239, 0.1);
}

.addressbook-entry.favorite {
  border-color: #fbbf24;
  background: #fffbeb;
}

.addressbook-user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.addressbook-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
}

.addressbook-avatar-placeholder {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
}

.addressbook-details {
  flex: 1;
  min-width: 0;
}

.addressbook-name {
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 0.125rem;
}

.addressbook-username {
  font-size: 0.875rem;
  color: #6b7280;
}

.addressbook-memo {
  font-size: 0.875rem;
  color: #6b7280;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid #e5e7eb;
}

.addressbook-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.addressbook-category {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  color: white;
}

.addressbook-favorite-icon {
  color: #fbbf24;
}

.addressbook-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.addressbook-actions button {
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  border-radius: 0.375rem;
  border: 1px solid #e5e7eb;
  background: white;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s ease;
}

.addressbook-actions button:hover {
  background: #f9fafb;
  border-color: var(--posty-primary);
  color: var(--posty-primary);
}

.addressbook-actions button.delete-btn:hover {
  background: #fef2f2;
  border-color: #ef4444;
  color: #ef4444;
}

/* カテゴリバッジ */
.category-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
}

.category-badge:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.category-badge.selected {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.5);
}

/* カテゴリアイコン・カラーボタン */
.category-icon-btn,
.category-color-btn {
  width: 3rem;
  height: 3rem;
  border: 2px solid #e5e7eb;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  background: white;
}

.category-icon-btn:hover,
.category-color-btn:hover {
  transform: scale(1.1);
  border-color: var(--posty-primary);
}

.category-icon-btn.selected,
.category-color-btn.selected {
  border-color: var(--posty-primary);
  border-width: 3px;
  box-shadow: 0 0 0 3px rgba(217, 70, 239, 0.1);
}

.category-color-btn {
  border-radius: 50%;
}

/* 検索結果 */
.search-result-item {
  padding: 0.75rem;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.search-result-item:hover {
  border-color: var(--posty-primary);
  background: #faf5ff;
}

.search-result-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.search-result-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.search-result-avatar-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
}

.search-result-info {
  flex: 1;
  min-width: 0;
}

.search-result-name {
  font-weight: 600;
  color: #1f2937;
}

.search-result-username {
  font-size: 0.875rem;
  color: #6b7280;
}

/* 空の状態 */
.addressbook-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: #9ca3af;
}

.addressbook-empty i {
  font-size: 3rem;
  margin-bottom: 1rem;
  display: block;
}

/* 一括操作バー */
.bulk-actions-bar {
  position: fixed;
  bottom: -100px;
  left: 0;
  right: 0;
  background: white;
  border-top: 2px solid var(--posty-primary);
  padding: 1rem;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
  transition: bottom 0.3s ease;
  z-index: 500;
}

.bulk-actions-bar.active {
  bottom: 0;
}

@media (max-width: 640px) {
  .bulk-actions-bar {
    padding: 0.75rem;
  }
  
  .bulk-actions-bar .flex.gap-2 {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  
  .bulk-actions-bar .btn-sm {
    font-size: 0.75rem;
    padding: 0.5rem 0.75rem;
  }
}

/* 名刺アップロード */
.business-card-upload {
  position: relative;
  border: 2px dashed #d1d5db;
  border-radius: 0.75rem;
  overflow: hidden;
  transition: all 0.2s ease;
}

.business-card-upload:hover {
  border-color: var(--posty-primary);
  background: #faf5ff;
}

.business-card-preview {
  position: relative;
  width: 100%;
  padding-bottom: 63%; /* 名刺のアスペクト比 (約85.6mm × 54mm) */
  background: #f9fafb;
  display: none;
}

.business-card-preview.active {
  display: block;
}

.business-card-preview img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: white;
}

.remove-card-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 2rem;
  height: 2rem;
  background: rgba(239, 68, 68, 0.9);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
}

.remove-card-btn:hover {
  background: #dc2626;
  transform: scale(1.1);
}

.business-card-upload-btn {
  width: 100%;
  padding: 3rem 1.5rem;
  background: white;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  color: #6b7280;
  transition: all 0.2s ease;
}

.business-card-upload-btn:hover {
  color: var(--posty-primary);
  background: #faf5ff;
}

.business-card-upload-btn.hidden {
  display: none;
}

.business-card-upload-btn i {
  font-size: 2.5rem;
  color: #d1d5db;
}

.business-card-upload-btn:hover i {
  color: var(--posty-primary);
}

.business-card-upload-btn span {
  font-size: 0.875rem;
  font-weight: 500;
}

/* OCR処理中のローディング */
.ocr-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.6;
}

.ocr-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2rem;
  height: 2rem;
  margin: -1rem 0 0 -1rem;
  border: 3px solid #e5e7eb;
  border-top-color: var(--posty-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* モバイル対応 */
@media (max-width: 640px) {
  .business-card-preview {
    padding-bottom: 70%; /* モバイルでは少し高めに */
  }
  
  .business-card-upload-btn {
    padding: 2rem 1rem;
  }
  
  .business-card-upload-btn i {
    font-size: 2rem;
  }
  
  .business-card-upload-btn span {
    font-size: 0.8125rem;
  }
  
  .remove-card-btn {
    width: 1.75rem;
    height: 1.75rem;
  }
}

/* ==================== Landing Page Settings ==================== */
.template-selector {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.template-option {
  cursor: pointer;
  padding: 0.75rem;
  border: 2px solid #E5E7EB;
  border-radius: 0.5rem;
  transition: all 0.3s ease;
  flex: 1;
  min-width: 120px;
}

.template-option:hover {
  border-color: #D946EF;
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(217, 70, 239, 0.1);
}

.template-option.selected {
  border-color: #D946EF;
  background: rgba(217, 70, 239, 0.05);
}

.template-preview-small {
  width: 100%;
  height: 80px;
  border-radius: 0.375rem;
  overflow: hidden;
  margin-bottom: 0.5rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.template-name {
  text-align: center;
  font-weight: 600;
  font-size: 0.875rem;
  color: #374151;
}

.form-section {
  padding: 1rem;
  background: #F9FAFB;
  border-radius: 0.5rem;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #CBD5E1;
  transition: 0.3s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: #D946EF;
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(24px);
}

/* ==================== リダイレクト管理スタイル ==================== */

/* リダイレクトカード */
.redirect-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  transition: all 0.3s ease;
}

.redirect-card:hover {
  border-color: #d946ef;
  box-shadow: 0 4px 12px rgba(217, 70, 239, 0.1);
}

.redirect-header {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}

.redirect-stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: #6b7280;
}

.stat-item i {
  font-size: 16px;
}

.stat-item span {
  font-weight: 600;
  color: #1f2937;
}

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

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

/* QRコード表示エリア */
#qrCodeDisplay {
  min-width: 256px;
  min-height: 256px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#qrCodeDisplay canvas {
  max-width: 100%;
  height: auto;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
  .redirect-header {
    flex-direction: column;
  }

  .redirect-stats {
    flex-direction: row;
    align-items: center;
  }

  .redirect-actions {
    justify-content: flex-start;
  }

  .redirect-actions .btn-sm {
    flex: 1;
    min-width: 80px;
  }
}

/* ==================== ダッシュボード概要スタイル ==================== */

/* クイックアクセスカード */
.dashboard-quick-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.dashboard-quick-card:hover {
  border-color: #d946ef;
  box-shadow: 0 4px 12px rgba(217, 70, 239, 0.15);
  transform: translateY(-2px);
}

.dashboard-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, #d946ef 0%, #a855f7 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 20px;
  flex-shrink: 0;
}

.dashboard-card-content {
  flex: 1;
}

.dashboard-card-title {
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 4px;
}

.dashboard-card-desc {
  font-size: 13px;
  color: #6b7280;
  line-height: 1.4;
}

.dashboard-card-arrow {
  color: #9ca3af;
  font-size: 16px;
  transition: all 0.3s ease;
}

.dashboard-quick-card:hover .dashboard-card-arrow {
  color: #d946ef;
  transform: translateX(4px);
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
  .dashboard-quick-card {
    padding: 16px;
  }

  .dashboard-card-icon {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }

  .dashboard-card-title {
    font-size: 14px;
  }

  .dashboard-card-desc {
    font-size: 12px;
  }
}

/* ============================================
   レイアウトエディタースタイル
   ============================================ */

/* レイアウトモード選択ボタン */
.layout-mode-btn {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #E5E7EB;
  border-radius: 8px;
  background: white;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  color: #6B7280;
}

.layout-mode-btn i {
  font-size: 20px;
}

.layout-mode-btn:hover {
  border-color: #D946EF;
  background: #FDF4FF;
}

.layout-mode-btn.active {
  border-color: #D946EF;
  background: linear-gradient(135deg, #FDF4FF 0%, #F3E8FF 100%);
  color: #D946EF;
  font-weight: 600;
}

/* 表示レイアウト選択ラジオボタン */
.active-layout-radio {
  flex: 1;
  cursor: pointer;
  display: block;
}

.active-layout-radio input[type="radio"] {
  display: none;
}

.active-layout-radio .radio-content {
  padding: 12px 16px;
  border: 2px solid #E5E7EB;
  border-radius: 8px;
  background: white;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #6B7280;
  font-weight: 500;
}

.active-layout-radio:hover .radio-content {
  border-color: #D946EF;
  background: #FDF4FF;
}

.active-layout-radio input[type="radio"]:checked + .radio-content {
  border-color: #D946EF;
  background: linear-gradient(135deg, #FDF4FF 0%, #F3E8FF 100%);
  color: #D946EF;
  font-weight: 600;
}

.active-layout-radio .radio-content i {
  font-size: 16px;
}

/* 背景タイプ選択ボタン */
.bg-type-btn {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #E5E7EB;
  border-radius: 6px;
  background: white;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 13px;
  color: #6B7280;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.bg-type-btn:hover {
  border-color: #D946EF;
  background: #FDF4FF;
}

.bg-type-btn.active {
  border-color: #D946EF;
  background: #D946EF;
  color: white;
  font-weight: 500;
}

/* ブロックカード */
.layout-block-card {
  background: white;
  border: 2px solid #E5E7EB;
  border-radius: 12px;
  padding: 16px;
  transition: all 0.3s ease;
  cursor: default;
  position: relative;
}

/* ブロックカードリストコンテナ */
#lpBlocksList,
#profileBlocksList {
  /* touch-actionは削除 - SortableJSが自動で管理 */
}

.layout-block-card:hover {
  border-color: #D946EF;
  box-shadow: 0 4px 12px rgba(217, 70, 239, 0.15);
}

.layout-block-card.dragging {
  opacity: 0.4;
  transform: scale(0.95);
}

.layout-block-card.drag-chosen {
  border-color: #A855F7;
  background: #FDF4FF;
  box-shadow: 0 8px 24px rgba(217, 70, 239, 0.25);
}

.layout-block-card.drag-over {
  border-color: #A855F7;
  background: #F3E8FF;
  border-style: dashed;
  transform: translateY(-4px);
}

/* SortableJS用のスタイル */
.sortable-ghost {
  opacity: 0.3;
  background: #F3E8FF;
  border: 2px dashed #A855F7;
  transform: scale(0.98);
}

.sortable-drag,
.layout-block-card.is-dragging {
  opacity: 1 !important;
  background: white !important;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3) !important;
  cursor: grabbing !important;
  transform: scale(1.05) rotate(3deg) !important;
  z-index: 9999 !important;
  border: 2px solid #A855F7 !important;
  transition: none !important;
}

.sortable-chosen {
  border-color: #A855F7;
  background: #FDF4FF;
  box-shadow: 0 8px 16px rgba(217, 70, 239, 0.3);
  transform: scale(1.02);
  transition: all 0.2s ease;
}

.sortable-fallback {
  opacity: 1 !important;
  background: white !important;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35) !important;
  transform: scale(1.08) rotate(3deg) !important;
  z-index: 9999 !important;
  border: 3px solid #A855F7 !important;
  pointer-events: none !important;
  position: fixed !important;
  will-change: transform !important;
  transition: none !important;
  /* Android Chrome用の最適化 */
  -webkit-transform: scale(1.08) rotate(3deg) !important;
  -webkit-backface-visibility: hidden !important;
  backface-visibility: hidden !important;
  transform-style: preserve-3d !important;
}

.block-header {
  display: flex;
  align-items: center;
  justify-between;
  margin-bottom: 12px;
}

.block-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Android用の矢印ボタン */
.block-arrow-controls {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 44px;
}

.block-arrow-btn {
  width: 36px;
  height: 20px;
  border: 1px solid #E5E7EB;
  border-radius: 4px;
  background: white;
  color: #6B7280;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  padding: 0;
}

.block-arrow-btn:hover:not(:disabled) {
  background: #F3F4F6;
  border-color: #D946EF;
  color: #D946EF;
}

.block-arrow-btn:active:not(:disabled) {
  background: #FDF4FF;
}

.block-arrow-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* PC/iPhone用のドラッグハンドル */
.block-drag-handle {
  cursor: grab;
  color: #9CA3AF;
  font-size: 20px;
  padding: 12px;
  min-width: 44px; /* タッチターゲット最小サイズ（iOS推奨） */
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -webkit-touch-callout: none; /* iOS長押しメニューを無効化 */
  border-radius: 6px;
}

.block-drag-handle:hover {
  color: #6B7280;
  background: #F3F4F6;
}

.block-drag-handle:active {
  cursor: grabbing;
  color: #A855F7;
  background: #FDF4FF;
  transform: scale(1.1);
}

/* 長押し中のビジュアルフィードバック */
.sortable-chosen .block-drag-handle {
  color: #A855F7;
  background: #FDF4FF;
  animation: pulse 0.6s ease-in-out;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.block-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: linear-gradient(135deg, #D946EF 0%, #A855F7 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
}

.block-details {
  flex: 1;
}

.block-type {
  font-weight: 600;
  color: #1F2937;
  font-size: 14px;
}

.block-content-type {
  font-size: 12px;
  color: #6B7280;
  margin-top: 2px;
}

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

.block-action-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  background: #F3F4F6;
  color: #6B7280;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.block-action-btn:hover {
  background: #E5E7EB;
  color: #1F2937;
}

.block-action-btn.delete:hover {
  background: #FEE2E2;
  color: #DC2626;
}

.block-action-btn.edit:hover {
  background: #DBEAFE;
  color: #2563EB;
}

.block-action-btn.move:hover {
  background: #E0E7FF;
  color: #4F46E5;
}

/* ブロック設定詳細 */
.block-settings {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #E5E7EB;
}

.block-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 13px;
}

.block-settings-label {
  color: #6B7280;
}

.block-settings-value {
  color: #1F2937;
  font-weight: 500;
}

/* ブロック追加モーダル */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 16px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
  padding: 24px;
  border-bottom: 1px solid #E5E7EB;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  color: #1F2937;
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-close {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: #F3F4F6;
  color: #6B7280;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.modal-close:hover {
  background: #E5E7EB;
  color: #1F2937;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 20px 24px;
  border-top: 1px solid #E5E7EB;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* ブロックタイプ選択グリッド */
.block-type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.block-type-option {
  padding: 16px;
  border: 2px solid #E5E7EB;
  border-radius: 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: white;
}

.block-type-option:hover {
  border-color: #D946EF;
  background: #FDF4FF;
}

.block-type-option.selected {
  border-color: #D946EF;
  background: linear-gradient(135deg, #FDF4FF 0%, #F3E8FF 100%);
}

.block-type-option i {
  font-size: 32px;
  color: #D946EF;
  margin-bottom: 8px;
}

.block-type-option .block-type-name {
  font-weight: 600;
  color: #1F2937;
  font-size: 14px;
}

.block-type-option .block-type-desc {
  font-size: 11px;
  color: #6B7280;
  margin-top: 4px;
}

/* コンテンツタイプ選択 */
.content-type-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.content-type-option {
  padding: 12px 16px;
  border: 2px solid #E5E7EB;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 12px;
  background: white;
}

.content-type-option:hover {
  border-color: #D946EF;
  background: #FDF4FF;
}

.content-type-option.selected {
  border-color: #D946EF;
  background: linear-gradient(135deg, #FDF4FF 0%, #F3E8FF 100%);
}

.content-type-option input[type="radio"] {
  margin: 0;
  cursor: pointer;
}

.content-type-label {
  flex: 1;
}

.content-type-name {
  font-weight: 500;
  color: #1F2937;
  font-size: 14px;
}

.content-type-desc {
  font-size: 12px;
  color: #6B7280;
  margin-top: 2px;
}

/* リンク選択チェックボックス */
.link-selection-list {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  padding: 12px;
}

.link-selection-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 6px;
  transition: background 0.2s ease;
}

.link-selection-item:hover {
  background: #F9FAFB;
}

.link-selection-item input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
}

.link-selection-info {
  flex: 1;
}

.link-selection-title {
  font-weight: 500;
  color: #1F2937;
  font-size: 14px;
}

.link-selection-url {
  font-size: 12px;
  color: #6B7280;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
  .block-type-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .layout-mode-btn {
    font-size: 13px;
  }
  
  .layout-mode-btn i {
    font-size: 18px;
  }
}

/* ========================================
   デザイン設定タブ（共通・LP・リンク集）
   ブラウザタブスタイル
   ======================================== */

div.design-setting-tabs {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  gap: 0 !important;
  border-bottom: 2px solid #D1D5DB !important;
  margin-bottom: 2rem !important;
  padding: 0 !important;
  background: transparent !important;
  width: 100% !important;
}

button.design-tab {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.5rem !important;
  padding: 0.875rem 2rem !important;
  margin: 0 !important;
  background: #F9FAFB !important;
  border: 2px solid #D1D5DB !important;
  border-bottom: 2px solid #D1D5DB !important;
  border-radius: 8px 8px 0 0 !important;
  color: #6B7280 !important;
  font-weight: 600 !important;
  font-size: 0.9375rem !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
  position: relative !important;
  bottom: -2px !important;
  white-space: nowrap !important;
  min-width: auto !important;
  height: auto !important;
}

button.design-tab:hover {
  color: #D946EF !important;
  background: #FDF2F8 !important;
  border-color: #F0ABFC !important;
  border-bottom-color: #D1D5DB !important;
}

button.design-tab.active {
  color: #D946EF !important;
  background: #FFFFFF !important;
  border-color: #D946EF !important;
  border-bottom-color: #FFFFFF !important;
  font-weight: 700 !important;
  z-index: 10 !important;
  box-shadow: 0 -2px 4px rgba(217, 70, 239, 0.1) !important;
}

button.design-tab i {
  font-size: 1.125rem !important;
  margin: 0 !important;
}

button.design-tab span {
  display: inline !important;
  font-size: 0.9375rem !important;
  margin: 0 !important;
}

div.design-tab-content {
  display: none !important;
  width: 100% !important;
}

div.design-tab-content.active {
  display: block !important;
  animation: fadeIn 0.2s ease-in !important;
}

/* ========================================
   デザイン設定タブ - レスポンシブ対応
   ======================================== */

@media (max-width: 768px) {
  /* モバイルでタブを縦積みまたは小さく */
  div.design-setting-tabs {
    gap: 0.25rem !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
  
  button.design-tab {
    padding: 0.75rem 1rem !important;
    font-size: 0.875rem !important;
    min-width: 100px !important;
    flex-shrink: 0 !important;
  }
  
  button.design-tab span {
    font-size: 0.875rem !important;
  }
  
  button.design-tab i {
    font-size: 1rem !important;
  }
}

@media (max-width: 480px) {
  /* 小さいスマホではアイコンとテキストを縦に */
  button.design-tab {
    flex-direction: column !important;
    gap: 0.25rem !important;
    padding: 0.625rem 0.75rem !important;
    font-size: 0.75rem !important;
    min-width: 80px !important;
  }
  
  button.design-tab span {
    font-size: 0.75rem !important;
  }
  
  button.design-tab i {
    font-size: 1.125rem !important;
  }
}

/* ========================================
   テンプレートプレビューモーダル
   ======================================== */

/* プレビューボタン */
.template-preview-btn {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.5rem 1rem;
  background: #D946EF;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  z-index: 5;
  opacity: 1; /* モバイル対応：常時表示 */
}

.template-card:hover .template-preview-btn {
  opacity: 1;
  transform: translateX(-50%) scale(1.05); /* ホバー時に少し拡大 */
}

.template-preview-btn:hover {
  background: #C026D3;
  transform: translateX(-50%) scale(1.05);
}

/* モーダル */
.template-preview-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 10000;
  overflow-y: auto;
  padding: 2rem;
}

.template-preview-modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.template-preview-modal-content {
  background: white;
  border-radius: 12px;
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.template-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 2px solid #E5E7EB;
  background: #F9FAFB;
}

.template-preview-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #111827;
  margin: 0;
}

.template-preview-close {
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  background: #E5E7EB;
  color: #6B7280;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  transition: all 0.2s;
}

.template-preview-close:hover {
  background: #D1D5DB;
  color: #111827;
}

/* プレビュータブ */
.template-preview-tabs {
  display: flex;
  gap: 0.5rem;
  padding: 1rem 1.5rem 0;
  background: white;
  border-bottom: 2px solid #E5E7EB;
}

.template-preview-tab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: #6B7280;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  bottom: -2px;
}

.template-preview-tab:hover {
  color: #D946EF;
  background: #FDF2F8;
}

.template-preview-tab.active {
  color: #D946EF;
  border-bottom-color: #D946EF;
  background: #FDF2F8;
}

/* プレビュー本体 */
.template-preview-body {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
  background: #F3F4F6;
}

#templatePreviewContent {
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  min-height: 400px;
}

/* フッター */
.template-preview-footer {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  padding: 1.5rem;
  border-top: 2px solid #E5E7EB;
  background: #F9FAFB;
}

/* レスポンシブ */
@media (max-width: 768px) {
  .template-preview-modal {
    padding: 1rem;
  }
  
  .template-preview-modal-content {
    max-width: 100%;
    max-height: 95vh;
  }
  
  .template-preview-header {
    padding: 1rem;
  }
  
  .template-preview-tabs {
    padding: 0.75rem 1rem 0;
    gap: 0.25rem;
  }
  
  .template-preview-tab {
    padding: 0.625rem 1rem;
    font-size: 0.8125rem;
  }
  
  .template-preview-body {
    padding: 1rem;
  }
  
  .template-preview-footer {
    padding: 1rem;
    flex-direction: column;
  }
  
  .template-preview-footer button {
    width: 100%;
  }
}

/* ========================================
   テンプレートプレビューモーダル
   ======================================== */

.template-preview-container {
  max-width: 900px !important;
  width: 90% !important;
  max-height: 90vh !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
}

.preview-header {
  padding: 1.5rem;
  border-bottom: 2px solid #E5E7EB;
}

.preview-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1F2937;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.preview-page-tabs {
  display: flex;
  gap: 0.5rem;
}

.preview-page-tab {
  padding: 0.625rem 1.25rem;
  background: #F3F4F6;
  border: 2px solid #E5E7EB;
  border-radius: 8px;
  color: #6B7280;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.preview-page-tab:hover {
  background: #FDF2F8;
  border-color: #F0ABFC;
  color: #D946EF;
}

.preview-page-tab.active {
  background: #D946EF;
  border-color: #D946EF;
  color: white;
}

.preview-body {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
  background: #F9FAFB;
}

.preview-page-content {
  display: none;
}

.preview-page-content.active {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.preview-phone-frame {
  width: 375px;
  max-width: 100%;
  background: white;
  border-radius: 2rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  padding: 1rem;
  position: relative;
}

.preview-phone-frame::before {
  content: '';
  position: absolute;
  top: 0.5rem;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 20px;
  background: #1F2937;
  border-radius: 0 0 20px 20px;
  z-index: 10;
}

.preview-screen {
  background: white;
  border-radius: 1.5rem;
  overflow-y: auto;
  max-height: 700px;
  padding: 2rem 1rem;
}

/* プレビュー内コンテンツ */
.preview-profile {
  text-align: center;
  margin-bottom: 2rem;
}

.preview-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  margin: 0 auto 1rem;
  background: linear-gradient(135deg, #D946EF 0%, #9333EA 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
}

.preview-name {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.preview-bio {
  color: #6B7280;
  font-size: 0.875rem;
  line-height: 1.6;
}

.preview-links {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.preview-link-item {
  padding: 1rem;
  background: white;
  border: 2px solid #E5E7EB;
  border-radius: 12px;
  text-align: center;
  font-weight: 600;
  color: #1F2937;
  transition: all 0.2s;
  cursor: pointer;
}

.preview-link-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(217, 70, 239, 0.2);
  border-color: #D946EF;
}

/* レスポンシブ */
@media (max-width: 768px) {
  .template-preview-container {
    width: 95% !important;
    max-height: 95vh !important;
  }
  
  .preview-header {
    padding: 1rem;
  }
  
  .preview-title {
    font-size: 1.25rem;
  }
  
  .preview-body {
    padding: 1rem;
  }
  
  .preview-phone-frame {
    width: 100%;
    max-width: 375px;
  }
  
  .preview-screen {
    max-height: 500px;
  }
}

@media (max-width: 480px) {
  .preview-page-tab {
    padding: 0.5rem 0.875rem;
    font-size: 0.75rem;
  }
  
  .preview-page-tab i {
    font-size: 0.875rem;
  }
}

/* Coming Soon スタイル */
.mobile-menu-item.disabled,
.dashboard-quick-card.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  position: relative;
}

.coming-soon-badge {
  display: inline-block;
  background: linear-gradient(135deg, #D946EF 0%, #9333EA 100%);
  color: white;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.625rem;
  font-weight: 600;
  margin-left: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.coming-soon-badge-small {
  display: inline-block;
  background: linear-gradient(135deg, #D946EF 0%, #9333EA 100%);
  color: white;
  padding: 0.125rem 0.375rem;
  border-radius: 9999px;
  font-size: 0.5rem;
  font-weight: 600;
  margin-left: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}


