/* --- 1. 全体初期化・ベース設定 --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

:root {
  overflow-x: hidden;
}

/* 𝕏内蔵ブラウザ対策：横揺れ・強制拡大防止 */
html {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: hidden !important;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

body {
  width: 100% !important;
  max-width: 100% !important;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  padding: 0;
  overflow-x: hidden !important;
  overflow-y: auto;
  position: relative;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: #ffffff;
  background-color: #08090c;
  
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
}

/* スクロール追従背景（軽量化） */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-image: linear-gradient(rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.179)), url('images/bg.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: -1;
  will-change: transform;
}

/* メインコンテナ（中央揃え・幅制限） */
.container {
  width: 90%;
  max-width: 420px;
  margin-left: auto !important;
  margin-right: auto !important;
  margin-top: max(60px, calc(env(safe-area-inset-top) + 30px)) !important;
  margin-bottom: max(60px, calc(env(safe-area-inset-bottom) + 30px)) !important;
  padding: 0 20px;
  text-align: center;
  z-index: 10;
  box-sizing: border-box;

  display: flex;
  flex-direction: column;
  align-items: center;
}


/* --- 2. プロフィール画像（白枠・丸型） --- */
.avatar-wrapper {
  position: relative;
  display: inline-block;
  width: 110px;
  height: 110px;
  min-width: 110px;
  min-height: 110px;
  aspect-ratio: 1 / 1;
  margin: 0 auto 20px auto;
}

.avatar {
  position: relative;
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 50% !important;
  object-fit: cover;
  border: 4px solid #ffffff;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  z-index: 1;
  display: block;
  transition: opacity 0.3s;
}

.avatar.loading {
  opacity: 0;
}


/* --- 3. 名前＆認証バッジ --- */
.name {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #ffffff;
  -webkit-text-fill-color: #ffffff;
  background: none;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.5), 0 0 20px rgba(0, 242, 254, 0.3);
}

.bio {
  font-size: 0.9rem;
  color: #e1e1e1;
  margin-bottom: 35px;
}


/* --- 4. リンクボタン（軽量化レイヤー付与） --- */
.links {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 40px;
}

.link-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #ffffff;
  padding: 16px 24px;
  border-radius: 50px;
  text-decoration: none;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.464);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
  transform: translateZ(0); /* ハードウェアアクセル有効化 */
  will-change: transform;
}

.link-card .icon {
  position: absolute;
  left: 20px;
  font-size: 1.2rem;
  color: #ffffff;
}

.link-card:hover {
  transform: translateY(-3px) scale(1.02) translateZ(0);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(253, 255, 255, 0.2) 100%);
  border-color: rgba(255, 255, 255, 0.6);
  box-shadow: 0 0 25px rgba(254, 255, 255, 0.4);
}

.link-card::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -60%;
  width: 20%;
  height: 200%;
  background: linear-gradient(
    to right,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.4) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: rotate(30deg);
  transition: all 0.5s ease;
}

.link-card:hover::after {
  left: 130%;
}

button.link-card {
  font-family: inherit;
  font-size: 1rem;
  line-height: inherit;
}


/* --- 5. お問い合わせフォーム（モーダル内ガラス調デザイン） --- */
.contact-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: left;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.85rem;
  color: #ffffff;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #ffffff;
  font-size: 0.95rem;
  font-family: inherit;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  outline: none;
  transition: all 0.2s ease;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: rgba(255, 255, 255, 0.65);
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.25);
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
}

.submit-btn {
  width: 100%;
  cursor: pointer;
  margin-top: 10px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
  transition: all 0.2s ease;
}

.submit-btn:hover {
  background: rgba(255, 255, 255, 0.35);
  border-color: rgba(255, 255, 255, 0.8);
  transform: translateY(-2px) translateZ(0);
}

.cf-turnstile {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin: 15px 0;
  padding: 0 !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent !important;
}

.cf-turnstile iframe {
  border: none !important;
  outline: none !important;
  margin: 0 !important;
  padding: 0 !important;
  vertical-align: bottom;
}


/* --- 6. モーダル類（iPad完全対応・軽量リキッドグラス） --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(10, 15, 30, 0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* --- 6. モーダル類（基本設定） --- */
.modal-content {
  position: relative;
  background: rgba(255, 255, 255, 0.13);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 
    0 30px 60px rgba(0, 0, 0, 0.4),
    inset 0 1px 1px rgba(255, 255, 255, 0.4);
  
  border-radius: 32px;
  padding: 38px 26px 30px;
  width: 85%;
  max-width: 400px;
  text-align: center;
  transform: translateY(15px) scale(0.96) translateZ(0);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  color: #ffffff; 
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  will-change: transform;
}

/* 🔻 iPad / Safari（WebKit）向けの黒化回避対策 🔻 */
@supports (-webkit-touch-callout: none) {
  .modal-content {
    /* Safariがぼかし描画を諦めても黒くならないよう、最初から綺麗なダークブルー半透明を指定 */
    background: rgba(30, 48, 80, 0.65) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
  }

  /* お問い合わせフォームの入力欄なども黒化を防ぐ */
  .contact-form input,
  .contact-form textarea {
    background: rgba(255, 255, 255, 0.15) !important;
  }
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 20px;
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  font-size: 1rem;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
  padding: 0;
  line-height: 1;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.4);
  transform: scale(1.05);
}

.modal-overlay.active .modal-content {
  transform: translateY(0) scale(1) translateZ(0);
}

.modal-icon { 
  font-size: 2.8rem; 
  margin-bottom: 12px; 
}
.success-color { color: #38bdf8; } 
.error-color { color: #fb7185; }   

.modal-title { 
  font-size: 1.35rem; 
  font-weight: 700; 
  color: #ffffff; 
  margin-bottom: 10px; 
  letter-spacing: -0.01em;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.modal-message { 
  font-size: 0.9rem; 
  color: rgba(255, 255, 255, 0.95); 
  line-height: 1.65; 
  margin-bottom: 24px; 
  letter-spacing: -0.01em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.modal-btn { 
  width: 100%; 
  padding: 12px; 
  font-size: 0.95rem; 
  cursor: pointer; 
}


/* --- 7. スクロールバー・アニメーション --- */
.footer { font-size: 0.8rem; color: #ffffffa7; }

.fade-in-up {
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.6s forwards ease-out; /* 0.8sから短縮してキビキビ動かす */
  animation-delay: var(--delay, 0s);
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.skeleton {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.05) 25%, rgba(255, 255, 255, 0.15) 37%, rgba(255, 255, 255, 0.05) 63%);
  background-size: 400% 100%;
  animation: skeleton-loading 1.4s ease infinite;
}

@keyframes skeleton-loading {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

@media (pointer: coarse) {
  .custom-cursor { display: none !important; }
}

@keyframes punyu {
  0% { transform: scale(1, 1); }
  25% { transform: scale(0.85, 1.15); }
  50% { transform: scale(1.15, 0.85); }
  75% { transform: scale(0.95, 1.05); }
  100% { transform: scale(1, 1); }
}

.punyu-anim {
  animation: punyu 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.copy-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  padding: 3px 9px;
  border-radius: 16px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.copy-btn i {
  font-size: 0.72rem;
}

.copy-btn:hover {
  background: #00cbfe;
  border-color: #00cbfe;
  color: #000;
}

/* 相互リンクリスト（下の文章と被らないようにフレックスで制御） */
.friends-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  
  /* 🔻 固定の高さではなく、親の枠内に綺麗に収まるように自動調整させる */
  flex: 1;
  min-height: 0;
  max-height: 220px; /* 大きくなりすぎないように上限を設定 */
  
  padding: 4px 6px;
  margin-top: 12px;
  -webkit-overflow-scrolling: touch;
  
  /* スクロールバーを完全に非表示にする */
  scrollbar-width: none; 
}

.friends-list::-webkit-scrollbar {
  display: none; 
}

/* 相互リンク用カード */
.friend-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  text-decoration: none;
  color: #ffffff;
  transition: transform 0.2s, background 0.2s;
  flex-shrink: 0; /* カードが押しつぶされるのを防ぐ */
}

.friend-card:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-2px);
}

.friend-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #ffffff;
}

.friend-info {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.friend-name {
  font-size: 0.95rem;
  font-weight: 700;
}

.friend-bio {
  font-size: 0.75rem;
  color: #a0a5b5;
}

.modal-content button[type="submit"],
.modal-content .submit-btn {
  margin-top: 8px !important;
  margin-bottom: 12px !important;
}

.modal-content form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* 自己紹介モーダル専用インナー */
.bio-inner-card {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 20px;
  text-align: left;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.2);
}

.bio-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.bio-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.3px;
}

.bio-subname {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.65);
  font-weight: 400;
}

.bio-divider {
  width: 100%;
  height: 1px;
  background: rgba(255, 255, 255, 0.15);
  margin: 12px 0;
}

.bio-text {
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.88);
  line-height: 1.65;
  letter-spacing: 0.2px;
}