:root {
  --border: #d8e2d5;
  --text: #1e2b1e;
  --muted: #7a8a76;
  --bg: #f7faf5;
  --green-dark: #063314;
  --green: #1f7a33;
  --green-mid: #3d9b4f;
  --green-bright: #7cb518;
  /* ロゴの緑グラデーション（濃緑→黄緑）に合わせたアクセント */
  --accent-grad: linear-gradient(45deg, #063314, #1f7a33, #57a639, #93c73d);
  --accent-grad-h: linear-gradient(90deg, #063314, #1f7a33, #57a639, #93c73d);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN",
    "Hiragino Sans", "Noto Sans JP", Meiryo, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ---------- レイアウト ---------- */
.container { max-width: 935px; margin: 0 auto; padding: 0 16px; }

/* ---------- プロフィール ---------- */
.profile {
  display: flex;
  gap: 30px;
  padding: 30px 0 24px;
  align-items: flex-start;
}
.avatar {
  flex: 0 0 auto;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: var(--accent-grad);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 40px;
}
.avatar img {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  display: block;
  object-fit: cover;
  background: #fff;
}
.profile-info { flex: 1; min-width: 0; }
.username { font-size: 20px; font-weight: 400; }
.stats {
  list-style: none;
  display: flex;
  gap: 40px;
  margin: 18px 0;
  font-size: 16px;
}
.stats strong { font-weight: 600; }
.bio { font-size: 14px; line-height: 1.5; }
.bio-name { font-weight: 600; }

/* ---------- タブ ---------- */
.tabs {
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
  gap: 48px;
}
.tab {
  appearance: none;
  background: none;
  border: none;
  border-top: 1px solid transparent;
  margin-top: -1px;
  padding: 14px 2px;
  font: inherit;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tab.active { color: var(--green-dark); border-top-color: var(--green); box-shadow: inset 0 1px 0 var(--green); font-weight: 600; }
.tab:hover { color: var(--green); }
.tab-count { font-size: 12px; color: var(--muted); letter-spacing: 0; }
.tab.active .tab-count { color: var(--green); }
.tab:focus-visible, .cell:focus-visible { outline: 2px solid var(--green-mid); outline-offset: 2px; }
::selection { background: #cde7bd; }

/* ---------- グリッド ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  padding-bottom: 40px;
}
.cell {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #efefef;
  cursor: pointer;
  border: none;
  padding: 0;
  display: block;
  width: 100%;
}
.cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: filter 0.15s ease;
}
.cell:hover img, .cell:focus-visible img { filter: brightness(0.85); }
.cell .video-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  color: #fff;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.6));
  pointer-events: none;
}
.loading, .empty { text-align: center; color: var(--muted); padding: 40px 0; font-size: 14px; }

/* ---------- フッター ---------- */
.footer {
  max-width: 935px;
  margin: 0 auto;
  padding: 24px 16px 40px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

/* ---------- 詳細ビュー ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal[hidden] { display: none; }
.modal-body {
  max-width: 90vw;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.modal-media { display: flex; align-items: center; justify-content: center; }
.modal-media img, .modal-media video {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  background: #000;
}
.modal-caption {
  color: #fff;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.caption-badge {
  background: var(--accent-grad);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
}
.caption-pos { color: #bbb; font-size: 13px; }
.modal-close {
  position: absolute;
  top: 10px;
  right: 16px;
  background: none;
  border: none;
  color: #fff;
  font-size: 36px;
  line-height: 1;
  cursor: pointer;
  padding: 8px;
}
.modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.12);
  border: none;
  color: #fff;
  font-size: 30px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-nav:hover { background: rgba(255,255,255,0.25); }
.modal-prev { left: 14px; }
.modal-next { right: 14px; }
.modal-nav:disabled { opacity: 0.3; cursor: default; }

/* ---------- スマホ ---------- */
@media (max-width: 735px) {
  .container { padding: 0; }
  .profile { gap: 18px; padding: 18px 16px 16px; }
  .avatar { width: 77px; height: 77px; margin: 0; }
  .avatar img { width: 71px; height: 71px; }
  .stats { gap: 20px; font-size: 14px; margin: 12px 0; }
  .bio { font-size: 13px; }
  .tabs { gap: 28px; }
  .grid { gap: 3px; padding-bottom: 24px; }
  .footer { padding-bottom: 28px; }
  .modal-nav { width: 38px; height: 38px; font-size: 24px; }
  .modal-prev { left: 6px; }
  .modal-next { right: 6px; }
}
