/* ヘッダー右側: [？][🔔][🪙コイン][ユーザーウィジェット]。
   全サービス共通の構造 = KANADE の .topbar-right(丸ボタン 38px・小さなコインのピル・1 行のユーザーのピル)と同じ形・寸法。
   KANAME のヘッダーは濃紺なので、地の色・線・文字(中立色)だけ暗い背景用に置き換える。コイン・Lv・EXP・在席の色はそのまま。
   help_page.css より後に読まれても負けないよう .site-header から指定する */
.site-header .user-menu { flex: none; margin-left: auto; gap: 12px; }
.site-header .header-help-link,
.site-header .user-menu .header-icon-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 38px; height: 38px; box-sizing: border-box; padding: 0; margin: 0; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .25); background: rgba(255, 255, 255, .08);
  color: #cbd5e1; font-size: 1.05rem; font-weight: 800; line-height: 1; text-decoration: none;
}
.site-header .header-help-link:hover,
.site-header .user-menu .header-icon-btn:hover { border-color: rgba(255, 255, 255, .7); color: #fff; background: rgba(255, 255, 255, .14); text-decoration: none; }
.site-header .user-menu .nav-bell .nav-bell-count {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; box-sizing: border-box;
  display: grid; place-content: center; padding: 0 4px; margin: 0; border-radius: 999px;
  background: #ff4d67; color: #fff; font-size: .68rem; font-weight: 900; line-height: 1; border: 2px solid #101828;
}

.kh-coins {
  display: inline-flex; align-items: center; box-sizing: border-box; flex: none;
  padding: 1px 8px; border-radius: 999px; white-space: nowrap; text-decoration: none; line-height: 1.4;
  font-size: .74rem; font-weight: 800; color: #8a5a00; background: #fff7e0; border: 1px solid #f0d488;
}
a.kh-coins:hover { text-decoration: none; border-color: #eec54a; background: #fff1c7; }

/* ユーザーウィジェット(details/summary なので JS なしで開閉できる)。1 行: アイコン 28px・名前・Lv・EXP 74x8・在席 */
.kh-user { position: relative; flex: 0 1 auto; min-width: 0; }
.kh-user-trigger {
  display: flex; align-items: center; gap: 8px; min-width: 0; height: 38px; box-sizing: border-box;
  padding: 4px 14px 4px 6px; border-radius: 999px; cursor: pointer; list-style: none; user-select: none;
  color: #e2e8f0; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .25);
}
.kh-user-trigger::-webkit-details-marker { display: none; }
.kh-user-trigger::marker { content: ""; }
.kh-user-trigger:hover, .kh-user[open] .kh-user-trigger { border-color: rgba(255, 255, 255, .7); }
.kh-user-avatar { position: relative; display: inline-flex; flex: none; width: 28px; height: 28px; }
.kh-user-avatar-img, .kh-user-initial {
  display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; box-sizing: border-box;
  border-radius: 50%; object-fit: cover; background: #334155; color: #fff; font-weight: 800; font-size: 12px;
  border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(255, 255, 255, .25);
}
.kh-user-name { font-size: .8rem; font-weight: 800; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kh-user-level {
  flex: none; font-size: .78rem; font-weight: 900; color: #6b5410; line-height: 1.3;
  background: linear-gradient(135deg, #fff3c2, #ffd95c); border: 1px solid #eec54a; border-radius: 999px; padding: 1px 10px;
}
.kh-exp-track {
  flex: none; display: inline-block; width: 74px; height: 8px; box-sizing: border-box; border-radius: 999px; overflow: hidden;
  background: rgba(255, 255, 255, .22); border: 1px solid rgba(255, 255, 255, .25);
}
.kh-exp-fill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #a3e635, #7ed957); }
.kh-presence { flex: none; display: inline-flex; align-items: center; gap: 4px; font-size: .72rem; font-weight: 800; color: #cbd5e1; white-space: nowrap; }
.kh-presence-dot { flex: none; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #22c55e; }
/* アイコン右下の点はスマホ(在席名を隠したとき)だけ出す */
.kh-avatar-dot { display: none; position: absolute; right: -2px; bottom: -2px; width: 10px; height: 10px; box-sizing: border-box; border: 2px solid #101828; }

.kh-user-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 100; width: 220px; max-width: calc(100vw - 16px); box-sizing: border-box;
  display: grid; gap: 2px; padding: 6px; border-radius: 14px; background: #fff; color: #101828;
  border: 1px solid #e4e7ec; box-shadow: 0 14px 32px rgba(45, 52, 54, .16);
}
.kh-user-menu form { display: block; margin: 0; }
.site-header .kh-user-menu .kh-user-menu-item {
  display: flex; align-items: center; gap: 8px; width: 100%; box-sizing: border-box; min-height: 0;
  padding: 9px 12px; border: 0; border-radius: 10px; background: transparent; color: #101828;
  font: inherit; font-size: .86rem; font-weight: 700; text-align: left; text-decoration: none; cursor: pointer;
}
.site-header .kh-user-menu .kh-user-menu-item:hover { background: #f2f4f7; text-decoration: none; }
.kh-user-menu-section { display: grid; gap: 2px; padding: 4px 0; margin: 2px 0; border-top: 1px solid #e4e7ec; border-bottom: 1px solid #e4e7ec; }
.kh-user-menu-heading { padding: 4px 12px 2px; font-size: .7rem; font-weight: 800; color: #667085; }
.site-header .kh-user-menu .kh-presence-option { font-weight: 600; }
.site-header .kh-user-menu .kh-presence-option.is-current { font-weight: 800; }
.kh-presence-option-label { flex: 1; }
.kh-check { margin-left: auto; color: #16a34a; font-weight: 900; }

/* ヘッダーナビ(PC): 1 行。入りきらない分は横スクロール(ホイール可・スクロールバーは隠す)、はみ出している側を薄くする */
@media (min-width: 769px) {
  .site-header .site-header-inner { gap: 20px; }
  .site-header .main-nav {
    flex: 1; min-width: 0; flex-wrap: nowrap; align-items: center; gap: 4px 14px;
    overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
  }
  .site-header .main-nav::-webkit-scrollbar { display: none; }
  .site-header .main-nav a { flex: none; font-size: 13px; white-space: nowrap; line-height: 32px; }
  .site-header .main-nav.is-scroll-end { -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent); }
  .site-header .main-nav.is-scroll-start { -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%); mask-image: linear-gradient(90deg, transparent, #000 12%); }
  .site-header .main-nav.is-scroll-start.is-scroll-end { -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); }
}

/* スマホ: 名前は出したまま(短く)、在席名だけ隠してアイコン右下の点で在席を出す。ゲージは 44px */
@media (max-width: 720px) {
  .site-header .user-menu { gap: 8px; }
  .kh-presence { display: none; }
  .kh-user-name { display: inline-block; max-width: 72px; font-size: .74rem; }
  .kh-avatar-dot { display: inline-block; }
  .kh-user-trigger { padding: 3px 8px 3px 4px; gap: 6px; }
  .kh-user-level { font-size: .72rem; padding: 1px 8px; }
  .kh-coins { font-size: .7rem; padding: 1px 7px; }
  .kh-exp-track { width: 44px; }
}

/* 幅の狭いスマホ(480px 以下): ヘッダー右側に お知らせ・コイン・名前 を収めるため、EXP ゲージを隠し名前は短く(Lv は残す) */
@media (max-width: 480px) {
  .kh-exp-track { display: none; }
  .kh-user-name { min-width: 3.2em; max-width: 64px; }
}
