*,*::before,*::after{margin:0;padding:0;box-sizing:border-box}

/* ── ページ遷移アニメーション ── */
/* フォールバック: フェードアウト */
.page-fade-out { animation: fadeOut 0.2s ease forwards }
@keyframes fadeOut {
  to { opacity: 0; transform: translateY(6px) }
}

/* フェードイン（ページ表示時） */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px) }
  to   { opacity: 1; transform: translateY(0) }
}
.page { animation: fadeIn 0.25s ease both }

/* View Transitions API（Chrome/Edge対応） */
@keyframes vt-slide-in {
  from { opacity: 0; transform: translateY(8px) }
  to   { opacity: 1; transform: translateY(0) }
}
@keyframes vt-slide-out {
  from { opacity: 1; transform: translateY(0) }
  to   { opacity: 0; transform: translateY(-8px) }
}
::view-transition-old(root) {
  animation: vt-slide-out 0.2s ease forwards;
}
::view-transition-new(root) {
  animation: vt-slide-in 0.25s ease forwards;
}
@media (prefers-reduced-motion: reduce) {
  .page { animation: none }
  ::view-transition-old(root),
  ::view-transition-new(root) { animation: none }
  body { animation: none }
  .avatar-wrap,
  .profile h1,
  .profile .handle,
  .profile .bio,
  .socials,
  .link-item,
  .fa-card,
  .item-card {
    opacity: 1;
    animation: none;
  }
  .avatar-wrap:hover,
  .link-item:hover,
  .fa-card:hover,
  .item-card:hover {
    transform: none;
  }
}

/* ── 追加アニメーション群 ── */

/* 背景グラデーションがゆっくり流れる */
@keyframes gradient-flow {
  0%   { background-position: 0% 50% }
  50%  { background-position: 100% 50% }
  100% { background-position: 0% 50% }
}

/* 要素が下からふわっと現れる */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px) }
  to   { opacity: 1; transform: translateY(0) }
}

/* アバターの初期アクセント（リング状に1回だけ広がる） */
@keyframes avatar-pulse {
  0%   { box-shadow: 0 0 0 0 var(--accent-glow) }
  70%  { box-shadow: 0 0 0 10px transparent }
  100% { box-shadow: 0 0 0 0 transparent }
}

/* ── Light Theme ── */
:root {
  --bg: #f6f1eb;
  --bg-card: #fffcf8;
  --bg-outer: #ede6dc;
  --text: #2c2420;
  --text-sub: #8c7e73;
  --accent: #c85a3a;
  --border: #e5ddd4;
  --border-hover: #d1c4b5;
  --shadow: rgba(44,36,32,0.06);
  --radius: 14px;
  --accent-glow: rgba(200,90,58,0.35);
  --accent-glow-bg: rgba(200,90,58,0.08);
  --font-ja: 'Zen Maru Gothic', system-ui, -apple-system, 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', 'Meiryo', sans-serif;
  --font-en: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

/* ── Dark Theme（OS自動 or 手動切替） ── */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a1816;
    --bg-card: #242120;
    --bg-outer: #121110;
    --text: #e8e2da;
    --text-sub: #9a9088;
    --accent: #e07a5a;
    --border: #332e2b;
    --border-hover: #4a433e;
    --shadow: rgba(0,0,0,0.2);
    --accent-glow: rgba(224,122,90,0.35);
    --accent-glow-bg: rgba(224,122,90,0.06);
  }
  :root:not([data-theme="light"]) .avatar-wrap .fallback { background: #2a2624 }
}
:root[data-theme="dark"] {
  --bg: #1a1816;
  --bg-card: #242120;
  --bg-outer: #121110;
  --text: #e8e2da;
  --text-sub: #9a9088;
  --accent: #e07a5a;
  --border: #332e2b;
  --border-hover: #4a433e;
  --shadow: rgba(0,0,0,0.2);
  --accent-glow: rgba(224,122,90,0.35);
  --accent-glow-bg: rgba(224,122,90,0.06);
}
:root[data-theme="dark"] .avatar-wrap .fallback { background: #2a2624 }

html { scroll-behavior: smooth; font-size: 18px }

body {
  font-family: var(--font-ja);
  background: linear-gradient(135deg, var(--bg), var(--accent-glow-bg), var(--bg), var(--accent-glow-bg));
  background-size: 400% 400%;
  animation: gradient-flow 22s ease infinite;
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s, color 0.3s;
}

/* ── PC: 中央カード + 背景 ── */
.page {
  max-width: 860px;
  margin: 0 auto;
  padding: 56px 24px 72px;
  transition: background 0.3s;
}

@media (min-width: 600px) and (max-width: 899px) {
  .page {
    background: var(--bg);
    min-height: 100vh;
    padding: 64px 48px 80px;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }
}

/* ── PC: 1カラム中央寄せ ── */
@media (min-width: 900px) {
  .page {
    max-width: 860px;
    padding: 72px 56px;
  }
  .page .divider { display: none }
}

/* ── スマホ最適化 ── */
@media (max-width: 599px) {
  body { background: var(--bg) }
  .page { padding: 36px 18px 56px }
  .site-nav { padding-right: 48px }
  .profile { margin-bottom: 36px }
  .profile h1 { font-size: 1.5rem }
  .profile .bio { font-size: 0.95rem; line-height: 1.85 }
  .social-pill { padding: 7px 13px; font-size: 0.78rem }
  .link-item { padding: 14px 15px; gap: 13px }
  .link-body .title { font-size: 0.92rem }
  .link-body .desc { font-size: 0.8rem }
  .section { margin-bottom: 32px }
  .section-label { font-size: 0.7rem }
  .footer { font-size: 0.74rem }
  .fa-card-caption { font-size: 0.74rem; padding: 8px 10px 4px }
}

/* ── Theme Toggle Button ── */
.theme-toggle {
  position: fixed;
  top: 16px; right: 16px;
  z-index: 100;
  width: 46px; height: 46px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg-card);
  color: var(--text-sub);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.2s, background 0.3s, color 0.3s, box-shadow 0.2s;
  box-shadow: 0 1px 8px var(--shadow);
}
.theme-toggle:hover {
  border-color: var(--border-hover);
  color: var(--text);
}
.theme-toggle svg { width: 21px; height: 21px }
.theme-toggle .icon-moon,
.theme-toggle .icon-sun { display: none }
.theme-toggle .icon-moon { display: block }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none }
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block }
}

/* ── Site Navigation ── */
.site-nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}
.site-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 100px;
  font-family: var(--font-ja);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-sub);
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s;
}
.site-nav-link:hover {
  border-color: var(--border-hover);
  color: var(--text);
}
.site-nav-link[aria-current="page"] {
  border-color: var(--accent);
  color: var(--accent);
}
.site-nav-icon { font-size: 0.85em }

/* ── Profile ── */
.profile { margin-bottom: 48px }

.avatar-wrap {
  width: 96px; height: 96px;
  margin-bottom: 24px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--border);
  opacity: 0;
  animation: fadeInUp 0.6s ease 0.05s both, avatar-pulse 1.6s ease-out 0.5s;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.3s;
}
.avatar-wrap:hover {
  transform: scale(1.05);
  border-color: var(--accent);
}
.avatar-wrap img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}
.avatar-wrap .fallback {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 38px;
  background: #efe8df;
}

.profile h1 {
  font-family: var(--font-ja);
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.3;
  margin-bottom: 4px;
  opacity: 0;
  animation: fadeInUp 0.6s ease 0.1s both;
}
.profile .handle {
  font-family: var(--font-en);
  font-size: 0.9rem;
  color: var(--text-sub);
  margin-bottom: 16px;
  opacity: 0;
  animation: fadeInUp 0.6s ease 0.2s both;
}
.profile .bio {
  font-size: 1rem;
  line-height: 1.9;
  color: var(--text-sub);
  opacity: 0;
  animation: fadeInUp 0.6s ease 0.3s both;
}

/* ── Social ── */
.socials {
  display: flex;
  gap: 6px;
  margin-top: 20px;
  flex-wrap: wrap;
  opacity: 0;
  animation: fadeInUp 0.6s ease 0.4s both;
}
.social-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 100px;
  font-family: var(--font-en);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-sub);
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s;
}
.social-pill svg { width: 15px; height: 15px; fill: currentColor; flex-shrink: 0 }
.social-pill:hover { border-color: var(--text); color: var(--text) }

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0 0 36px;
}

/* ── Freeform Content ── */
.freeform {
  margin-bottom: 36px;
  font-size: 0.95rem;
  line-height: 1.9;
  color: var(--text);
}
.freeform p { margin-bottom: 12px }
.freeform p:last-child { margin-bottom: 0 }
.freeform a { color: var(--accent); text-decoration: none }
.freeform a:hover { text-decoration: underline }

/* ── Section ── */
.section { margin-bottom: 40px }
.section-label {
  font-family: var(--font-en);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-sub);
  margin-bottom: 14px;
}

/* ── Links ── */
.links { display: flex; flex-direction: column; gap: 8px }

.link-item {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  opacity: 0;
  animation: fadeInUp 0.5s ease both;
  transition: border-color 0.3s, box-shadow 0.3s, background 0.3s, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.link-item:hover {
  border-color: var(--border-hover);
  box-shadow: 0 8px 20px var(--shadow);
  transform: translateY(-4px);
}
.links .link-item:nth-child(1) { animation-delay: 0.45s }
.links .link-item:nth-child(2) { animation-delay: 0.52s }
.links .link-item:nth-child(3) { animation-delay: 0.59s }
.links .link-item:nth-child(4) { animation-delay: 0.66s }
.links .link-item:nth-child(5) { animation-delay: 0.73s }
.links .link-item:nth-child(6) { animation-delay: 0.8s }
.links .link-item:nth-child(7) { animation-delay: 0.87s }
.links .link-item:nth-child(8) { animation-delay: 0.94s }
.links .link-item:nth-child(n+9) { animation-delay: 1s }
.link-item:active { box-shadow: none }
div.link-item { cursor: default }
div.link-item:hover { border-color: var(--border); box-shadow: none }

.link-emoji {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 21px;
  flex-shrink: 0;
  background: var(--bg);
  transition: background 0.3s;
}
.link-body { flex: 1; min-width: 0 }
.link-body .title {
  font-family: var(--font-ja);
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.4;
}
.link-body .desc {
  font-size: 0.82rem;
  color: var(--text-sub);
  margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.link-arrow {
  color: var(--border-hover);
  flex-shrink: 0;
  transition: transform 0.2s;
}
.link-item:hover .link-arrow { transform: translateX(2px); color: var(--text-sub) }

/* ── Fan Art Column（メインページ右サイドは非表示） ── */
.fa-column {
  display: none;
}

.fa-card {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-card);
  position: relative;
  display: block;
  text-decoration: none;
  color: var(--text);
  opacity: 0;
  animation: fadeInUp 0.5s ease both;
  transition: border-color 0.3s, box-shadow 0.3s, background 0.3s, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.fa-card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 8px 20px var(--shadow);
  transform: translateY(-4px);
}
.fanart-gallery .fa-card:nth-child(1) { animation-delay: 0.1s }
.fanart-gallery .fa-card:nth-child(2) { animation-delay: 0.17s }
.fanart-gallery .fa-card:nth-child(3) { animation-delay: 0.24s }
.fanart-gallery .fa-card:nth-child(4) { animation-delay: 0.31s }
.fanart-gallery .fa-card:nth-child(5) { animation-delay: 0.38s }
.fanart-gallery .fa-card:nth-child(6) { animation-delay: 0.45s }
.fanart-gallery .fa-card:nth-child(n+7) { animation-delay: 0.5s }
div.fa-card { cursor: default }
div.fa-card:hover { border-color: var(--border); box-shadow: none }

.fa-card-img {
  width: 100%;
}
.fa-card-img img {
  width: 100%; height: auto;
  display: block;
}

.fa-card-caption {
  padding: 10px 12px 6px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-sub);
  font-family: var(--font-ja);
  line-height: 1.5;
}

/* ── Fanart ページ：ギャラリーグリッド ── */
.fanart-gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 40px;
}
@media (min-width: 700px) {
  .fanart-gallery {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 599px) {
  .fanart-gallery {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

/* ── Page Hero（サブページ見出し） ── */
.page-hero {
  margin-bottom: 32px;
}
.page-hero h1 {
  font-family: var(--font-ja);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 6px;
}
.page-hero p {
  font-size: 1rem;
  color: var(--text-sub);
  line-height: 1.8;
}

/* ── Game / Device リスト ── */
.item-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.item-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border);
  opacity: 0;
  animation: fadeInUp 0.5s ease both;
  transition: background 0.3s, box-shadow 0.3s, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.item-card:hover {
  box-shadow: 0 8px 20px var(--shadow);
  transform: translateY(-4px);
}
.item-list .item-card:nth-child(1) { animation-delay: 0.1s }
.item-list .item-card:nth-child(2) { animation-delay: 0.17s }
.item-list .item-card:nth-child(3) { animation-delay: 0.24s }
.item-list .item-card:nth-child(4) { animation-delay: 0.31s }
.item-list .item-card:nth-child(5) { animation-delay: 0.38s }
.item-list .item-card:nth-child(6) { animation-delay: 0.45s }
.item-list .item-card:nth-child(n+7) { animation-delay: 0.5s }
.item-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 21px;
  flex-shrink: 0;
  background: var(--bg);
  transition: background 0.3s;
}
.item-body { flex: 1; min-width: 0 }
.item-body .name {
  font-family: var(--font-ja);
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.4;
}
.item-body .note {
  font-size: 0.82rem;
  color: var(--text-sub);
  margin-top: 2px;
}

/* ── サブページ: 1カラムレイアウト ── */
.single-column .page {
  max-width: 860px;
}
@media (min-width: 900px) {
  .single-column .page {
    display: block;
  }
  .single-column .footer {
    grid-column: unset;
    margin-top: 48px;
  }
}

/* ── Administrator: ダッシュボードカード ── */
.admin-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.admin-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.admin-card-header h2 {
  font-family: var(--font-ja);
  font-size: 1.3rem;
  font-weight: 700;
}
.admin-csv-btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: transparent;
  font-family: var(--font-en);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-sub);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.admin-csv-btn:hover {
  border-color: var(--border-hover);
  color: var(--text);
}
.admin-note {
  font-size: 0.85rem;
  line-height: 1.8;
  color: var(--text-sub);
  background: var(--accent-glow-bg);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 20px;
}
.admin-note a {
  color: var(--accent);
  text-decoration: none;
}
.admin-note a:hover { text-decoration: underline }

.admin-table {
  width: 100%;
  border-collapse: collapse;
}
.admin-table th,
.admin-table td {
  padding: 14px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.admin-table th {
  font-family: var(--font-ja);
  font-size: 0.95rem;
  font-weight: 700;
  background: var(--bg);
}
.admin-table td {
  font-family: var(--font-ja);
  font-size: 1.1rem;
  font-weight: 500;
}
.admin-table .num {
  text-align: right;
  font-family: var(--font-en);
  font-weight: 700;
}
.admin-table tbody tr:last-child td {
  border-bottom: none;
}
@media (max-width: 599px) {
  .admin-card { padding: 18px }
  .admin-table th, .admin-table td { padding: 10px 8px; font-size: 0.9rem }
  .admin-table td { font-size: 1rem }
}

/* ── Footer ── */
.footer {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-family: var(--font-en);
  font-size: 0.78rem;
  color: var(--text-sub);
}
