/* ============================================================
   サイト共通ヘッダー
   色は style/tokens.css のトークン（--c-* / --icon-*）を参照する。
   構成: 変数 / レイアウト基礎 / ヘッダー / 検索 / 増減表示 /
         リンクアイコン / チェックボックス / バッジ / 広告枠 / 罫線
   ============================================================ */

:root {
  --width: 812px;
  --max-width: 812px;
  --font-family:
    -apple-system, system-ui, blinkmacsystemfont, Helvetica Neue, helvetica, Hiragino Sans, arial,
    sans-serif;
}

/* ---------- レイアウト基礎 ---------- */

* {
  box-sizing: border-box;
}

body {
  max-width: var(--max-width);
  margin: 0 auto;
  transition: transform 1s;
  padding: 0;
  width: 100%;
  font-family: var(--font-family);
  text-rendering: optimizeSpeed;
}

body::before {
  width: 100%;
  max-width: var(--width);
  /* 固定ヘッダー高 + iOS セーフエリア（ダイナミックアイランド/ステータスバー） */
  height: calc(48px + env(safe-area-inset-top, 0px));
  display: block;
  content: '';
}

.pad-side {
  margin-left: 1rem;
  margin-right: 1rem;
}

.pad-side-top-ranking .top-ranking {
  margin-left: 1rem;
  margin-right: 1rem;
}

.pad-side-top-ranking .recent-comment-list {
  margin-left: 1rem;
  margin-right: 1rem;
}

.modify-top-padding .topic-tag {
  padding-top: 4px;
}

/* ---------- ヘッダー ---------- */

.body {
  max-width: var(--width);
  margin: 0 auto;
}

.site_header_outer {
  all: unset;
  position: fixed;
  display: block;
  z-index: 30;
  top: 0;
  left: 0;
  right: 0;
  margin: 0 auto;
  /* Safari 26 (Liquid Glass) は固定要素自身の background / backdrop-filter を
     サンプリングしてステータスバーをベタ塗りにする（opacity:0でも読まれる）。
     fixed 親は透明にし、描画は絶対配置の ::before（サンプリング対象外）へ移譲
     → スクロール時にダイナミックアイランド周囲へ実ピクセルが合成され透ける */
  background-color: transparent;
  width: 100%;
  max-width: var(--max-width);
  transition:
    transform 0.3s ease,
    opacity 0.22s ease;
  transform: translate(0px, 0px);
  /* viewport-fit=cover でステータスバー裏まで伸ばし、
     半透明+blur がダイナミックアイランド周囲に透ける（ネイティブ風） */
  padding-top: env(safe-area-inset-top, 0px);
}

.site_header_outer::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background-color: var(--c-header-backdrop);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* 下スクロール時の非表示。既定はこれまで通りの上スライドのみ */
.site_header_outer.header-hidden {
  transform: translateY(-100%);
}

/* iPhone 限定（html.is-ios は theme.js が付与）:
   自身の高さ（セーフエリア込み）+ 余裕分まで突き抜けつつフェードアウトし、
   ステータスバー/ダイナミックアイランドを「上へ吹っ飛ばす」ように見せる。
   消えた後は Safari の半透明バーにコンテンツが透け、
   上スクロールではすっと落ちて戻る */
html.is-ios .site_header_outer.header-hidden {
  transform: translateY(calc(-100% - 32px));
  opacity: 0;
}

.site_header {
  display: flex;
  padding: 0 1rem;
  width: 100%;
  justify-content: space-between;
}

/* タイトルテキストエリア */
.header_title {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

/* オプチャタイトルコンテナ */
.title_container {
  display: flex;
  flex-direction: row;
  font-weight: 700;
  font-size: 14px;
}

.title {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.member {
  margin-right: 10px;
}

/* サイト名 */
.site_title {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 11px;
}

/* トップページタイトル */
.header_site_title {
  margin: auto -0.5rem;
  cursor: pointer;
  display: flex;
  height: 48px;
  gap: 4px;
  padding: 0 0.5rem;
  align-items: center;
  font-family: var(--font-family);
}

.header_site_title:focus-visible {
  outline: -webkit-focus-ring-color auto 1px;
  height: 46px;
}

.header_site_title img {
  margin: auto;
  width: 18px;
  height: 18px;
  user-select: none;
  -webkit-user-select: none;
}

.header_site_title h1,
.header_site_title p {
  all: unset;
  margin: auto 0;
  white-space: nowrap;
  font-weight: bold;
  font-size: 15px;
  color: var(--c-text-1);
  line-height: 1.75;
  font-family: var(--font-family);
}

.header_site_title.thi h1,
.header_site_title.thi p {
  all: unset;
  margin: auto 0;
  white-space: pre;
  font-weight: bold;
  font-size: 13px;
  color: var(--c-text-1);
  line-height: 1.3;
  font-family: var(--font-family);
}

.header-nav {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  width: 100%;
  margin-right: -8px;
  height: 48px;
  position: absolute;
  right: 1rem;
  width: fit-content;
}

/* 右側アクション群（ブログ／カテゴリ）。検索ボタン(右端absolute)分の50pxを確保 */
.header-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: auto 42px auto auto;
}

/* カテゴリーボタン（文字小さめ・左右パディング詰め・幅縮小） */
.category-button {
  height: 36px;
  border: 1px solid var(--c-border);
  border-radius: 7px;
  display: flex;
  text-decoration: unset;
}

.category-button span {
  font-size: 11px;
  display: block;
  width: fit-content;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: auto;
  line-height: 24px;
  color: var(--c-text-1);
  font-weight: bold;
  padding: 0 0.65rem;
  font-family: var(--font-family);
  text-wrap: nowrap;
}

/* 狭幅でもヘッダー右端（検索）に潜り込まない */
.header-actions {
  min-width: 0;
}

.category-button {
  min-width: 0;
  max-width: 100%;
}

/* 幅に余裕がある端末（iPhone Air 級以上）では一段大きく */
@media screen and (min-width: 415px) {
  .blog-text-link,
  .category-button span {
    font-size: 12.5px;
  }
}

/* ブログリンク（小さな文字のみ・日本語のみ） */
.blog-text-link {
  font-size: 11px;
  color: var(--c-text-3);
  text-decoration: none;
  padding: 8px 2px;
  white-space: nowrap;
  font-family: var(--font-family);
  /* サイト名の続きに見えないよう、タイトル側に最低限の間合いを取りつつ
     カテゴリボタンとは寄せすぎない距離感（gap 7px + 6px） */
  margin-left: 12px;
  margin-right: 6px;
}

.blog-text-link:hover {
  text-decoration: underline;
  color: var(--c-text-1);
}

/* ---------- ダークモード切替ボタン ---------- */

.theme-toggle-btn {
  color: var(--c-text-1);
}

.theme-toggle-btn svg {
  margin: auto;
}

/* アイコンの出し分けは「ユーザーの選択」（html[data-theme-pref]）で行う。
   light=月(次はダーク) / dark=太陽(次は自動) / auto=半月(次はライト)。
   theme.js が常に data-theme-pref を設定する（no-JS時はボタン自体が機能しないため考慮不要） */
.theme-icon-sun,
.theme-icon-auto {
  display: none;
}

:root[data-theme-pref="dark"] .theme-icon-sun {
  display: block;
}

:root[data-theme-pref="dark"] .theme-icon-moon,
:root[data-theme-pref="auto"] .theme-icon-moon {
  display: none;
}

:root[data-theme-pref="auto"] .theme-icon-auto {
  display: block;
}

/* ---------- 検索フォーム ---------- */

.header-button {
  all: unset;
  display: flex;
  height: 48px;
  width: 44px; /* 視覚の左余白を詰める（タップ領域は高さ48で確保） */
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
}

.header-button:focus-visible {
  outline: -webkit-focus-ring-color auto 1px;
  z-index: 10;
}

.search-button-icon {
  margin: auto;
  width: 24px;
  height: 24px;
  background-image: var(--icon-search);
}

.search-form {
  display: none;
  height: 48px;
  padding-top: 2px;
}

.is-search-form-open .search-form {
  display: flex;
  position: absolute;
  top: 0;
  max-width: var(--width);
  left: 0;
  right: 0;
}

.search-form form {
  all: unset;
  z-index: 12;
  display: block;
  margin: auto;
  height: fit-content;
  border-radius: 7px;
  background: var(--c-surface);
  position: relative;
  padding: 0.3em 0.7em 0.3em 2.3em;
  width: 100%;
  border-radius: 99rem;
}

.search-form form:has(:focus) {
  outline: none;
}

.search-form input:focus {
  box-shadow: 0 0 0 0px;
}

.search-form label {
  position: absolute;
  left: 0.7rem;
  top: 6px;
  width: 19px;
  height: 19px;
  margin: 0;
  background-image: var(--icon-search);
}

.search-form input {
  all: unset;
  width: 100%;
  line-height: 1.4;
  font-size: 1rem;
  outline: 0;
  resize: none;
  display: block;
  -webkit-appearance: none;
  appearance: none;
  font-family: var(--font-family);
}

.backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 100vh;
  width: 100vw;
  z-index: 2;
}

.is-search-form-open .backdrop {
  display: flex;
}

/* ---------- メンバー数の増減表示 ---------- */

.positive .openchat-item-stats {
  color: var(--c-accent-blue);
}

.negative .openchat-item-stats {
  color: var(--c-down);
}

/* ---------- 外部リンクアイコン ---------- */

.line-link-icon {
  background-image: var(--icon-external-teal);
  background-repeat: no-repeat;
  width: 16px;
  height: 16px;
  display: inline-block;
  user-select: none;
  -webkit-user-select: none;
  line-height: 130%;
  margin: 0 1px;
}

.line-link-icon777 {
  background-image: var(--icon-external-gray);
  background-repeat: no-repeat;
  width: 16px;
  height: 16px;
  display: inline-block;
  user-select: none;
  -webkit-user-select: none;
  line-height: 130%;
  margin: 0 1px;
}

.copyright .line-link-icon777,
.app_link .line-link-icon777 {
  width: 12px;
  height: 12px;
}

/* ---------- チェックボックス ---------- */

.checkbox-label {
  all: unset;
  display: flex;
  align-items: center;
  gap: 1px;
  cursor: pointer;
  user-select: none;
  box-sizing: border-box;
  color: var(--c-text-dim);
  font-size: 11px;
}

.checkbox-label input {
  all: unset;
  box-sizing: border-box;
}

.checkbox-label:has(:focus-visible) {
  outline: -webkit-focus-ring-color auto 1px;
}

.checkbox-label input[type='checkbox'] {
  transform: scale(0.75);
  margin: 0;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  position: relative;
  right: 0;
  bottom: 0;
  left: 0;
  min-height: 20px;
  /* 生成ボタンサイズ */
  min-width: 20px;
  /* 生成ボタンサイズ */
  vertical-align: -0.8rem;
  color: var(--c-text-inverse);
  cursor: pointer;
  display: inline-block;
  outline: none;
  border-radius: 10%;
}

/* チェックマーク（before/after の白い線） */
.checkbox-label input[type='checkbox']:before,
.checkbox-label input[type='checkbox']:after {
  position: absolute;
  content: '';
  background: var(--c-text-inverse);
}

.checkbox-label input[type='checkbox']:before {
  left: 2px;
  top: 6px;
  width: 0;
  height: 2px;
  transform: rotate(45deg);
  -webkit-transform: rotate(45deg);
}

.checkbox-label input[type='checkbox']:after {
  right: 9px;
  bottom: 3px;
  width: 2px;
  height: 0;
  transform: rotate(40deg);
  -webkit-transform: rotate(40deg);
}

.checkbox-label input[type='checkbox']:checked:before {
  left: 1px;
  top: 10px;
  width: 6px;
  height: 2px;
}

.checkbox-label input[type='checkbox']:checked:after {
  right: 5px;
  bottom: 1px;
  width: 2px;
  height: 14px;
}

.checkbox-label input[type='checkbox']:indeterminate:before,
.checkbox-label input[type='checkbox']:indeterminate:after {
  width: 7px;
  height: 2px;
  transform: rotate(0);
  -webkit-transform: rotate(0);
}

.checkbox-label input[type='checkbox']:indeterminate:before {
  left: 1px;
  top: 7px;
}

.checkbox-label input[type='checkbox']:indeterminate:after {
  right: 1px;
  bottom: 7px;
}

/* ブランド緑グラデーションの枠・塗り */
.checkbox-label input[type='checkbox'] {
  border: 2px solid;
  border-image: var(--c-brand-gradient);
  border-image-slice: 1;
  mask: linear-gradient(black, black);
}

.checkbox-label input[type='checkbox']:checked,
.checkbox-label input[type='checkbox']:indeterminate {
  background: var(--c-brand-gradient);
}

.admin-check-label {
  margin: auto 0 auto 0.85rem;
  font-size: 12px;
  font-weight: 700;
}

/* ---------- 公式・スペシャル・鍵バッジ ---------- */

.super-icon {
  width: 21px;
  height: 20px;
  background-size: 144px 101px;
  background-repeat: no-repeat;
  display: inline-block;
  vertical-align: top;
  margin-right: 2px;
  scale: 0.9;
}

.super-icon.official {
  width: 20px;
  background-image: url(/../assets/line_svg_sprite.svg);
  background-position: -62px -76px;
}

.super-icon.sp {
  background-image: url(/../assets/line_svg_sprite.svg);
  background-position: -33px -76px;
}

.lock-icon {
  width: 13px;
  height: 13px;
  margin-top: 2px;
  margin-right: 2px;
  background-repeat: no-repeat;
  display: inline-block;
  vertical-align: top;
  background-image: url(/../assets/lock.svg);
}

@media screen and (min-width: 512px) {
  .site_header {
    justify-content: flex-start;
    padding-left: 35.17px;
  }

  .header-nav {
    position: relative;
    padding-top: 1px;
    padding-right: 0.5px;
  }

  .super-icon {
    scale: 1;
    margin-top: 0px;
  }

  .header-button {
    border-radius: 99rem;
  }

  .header-button:hover {
    background-color: var(--c-bg-sub);
  }

  .header_site_title:focus-visible {
    height: 42px;
  }

  .is-search-form-open .site_header {
    display: flex;
  }

  .is-search-form-open .search-form {
    display: flex;
    position: absolute;
    left: auto;
    right: 1rem;
    width: 60%;
    padding: 0;
  }
}

/* ---------- 更新時刻表示 ---------- */

.site_header .refresh-time {
  margin-left: 9px;
  display: flex;
  white-space: nowrap;
}

.site_header .refresh-icon {
  height: 11px;
  aspect-ratio: 1/1;
  background-image: var(--icon-refresh);
  margin: auto 0;
}

.site_header .refresh-time time {
  margin: auto 0;
  margin-left: 2px;
  color: var(--c-text-5);
  font-size: 12px;
  font-family:
    'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
  display: inline-block;
}

/* ---------- 広告枠（全ページ共通のためこのファイルに置く。
              ads_element.css は広告説明ページ専用） ---------- */

.rectangle-ads {
  width: auto;
  aspect-ratio: 16/9;
}

.rectangle3-ads {
  width: auto;
  aspect-ratio: 1.2;
}

.rectangle4-ads {
  width: auto;
  aspect-ratio: 1;
}

.horizontal-ads {
  width: auto;
  height: 100px;
  max-height: 100px;
}

.rectangle-ads-parent,
.rectangle3-ads-parent,
.rectangle4-ads-parent,
.horizontal-ads-parent {
  box-sizing: border-box;
}

.responsive-google-parent {
  padding: 0;
  box-sizing: border-box;
}

.openchat-item-list .google-auto-placed {
  margin: 0 -1rem;
  width: 100vw !important;
  max-width: 812px;
}

@media screen and (min-width: 512px) {
  .rectangle3-ads,
  .rectangle4-ads,
  .rectangle-ads {
    height: 280px;
    width: auto;
    margin: auto;
    aspect-ratio: unset;
  }
}

.adsbygoogle {
  display: block;
  background: var(--c-bg-sub);
}

.rectangle2-ads {
  width: auto;
  aspect-ratio: 16/9;
}

@media screen and (min-width: 512px) {
  .rectangle2-ads {
    height: 280px;
    width: 100%;
  }
}

/* ---------- 罫線 ---------- */

.hr-top {
  all: unset;
  display: block;
  border-bottom: 1px solid var(--c-border);
  margin: 0 auto;
  margin-bottom: -4px;
  padding: 4.5px 0;
  width: calc(100% - 2rem);
}

.hr-bottom {
  all: unset;
  display: block;
  border-top: 1px solid var(--c-border);
  margin: 0 auto;
  margin-top: -4px;
  padding: 4.5px 0;
  width: calc(100% - 2rem);
}

.hr-bottom.tags-top {
  width: 100%;
  padding: 8px 0;
}
