/* ブラウザゲームHub の見た目。ダークだけ。色はすべてここで決める（色を変える時はここだけ直す） */
:root {
  color-scheme: dark;
  --bg: #12161c;
  --surface: #1b2129;
  --surface-2: #262e38;
  --text: #e8ecf1;
  --muted: #9ca7b4;
  --border: #303a46;
  --accent: #2dd4bf;
  --accent-text: #08201d;
  --link: #5eead4;
  --star: #f2c14e;
  --star-off: #48535f;
  --danger: #f97066;
  --danger-text: #2b0905;
  --alert-bg: #3b1d1b;
  --ok-bg: #12332f;
  --ok-text: #7fe7d6;
  --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 4px 14px rgb(0 0 0 / 25%);
  --radius: 12px;
}
* {
  box-sizing: border-box;
}
html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: 'Zen Maru Gothic', system-ui, -apple-system, 'Hiragino Sans', 'Yu Gothic UI', sans-serif;
  line-height: 1.7;
  overflow-wrap: anywhere;
}
/* 下線のリンクは使わない。押す所はボタンや札の形にする */
a {
  color: var(--link);
  text-decoration: none;
}
img,
canvas {
  max-width: 100%;
  height: auto;
  display: block;
}
.skip {
  position: absolute;
  left: -999px;
}
.skip:focus {
  left: 8px;
  top: 8px;
  z-index: 9;
  background: var(--surface);
  padding: 4px 8px;
}

/* 上の帯 */
/* どの幅でも上に固定して常に見せる。高さは --top-h にそろえる */
:root {
  --top-h: 60px;
}
.top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  box-sizing: content-box;
  height: var(--top-h);
  padding: env(safe-area-inset-top) 16px 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 800;
  font-size: 18px;
  text-decoration: none;
}
.brand b {
  color: var(--accent);
}

/* ヘッダーの検索窓。枠の中に虫めがねのボタンを入れる */
.search {
  position: relative;
  flex: 1;
  min-width: 0;
  max-width: 520px;
  margin: 0 auto;
}
.top .search-link,
.page-search {
  display: none;
}
.search input {
  margin-top: 0;
  height: 40px;
  padding: 0 44px 0 14px;
  border-radius: 999px;
  background: var(--bg);
}
.search .btn {
  position: absolute;
  top: 0;
  right: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
}
/* ヘッダーの共有アイコンと、押すと開くメニュー */
.share-wrap {
  position: relative;
  flex: none;
  margin: 0 -10px 0 -14px;
}
.share-btn {
  display: block;
  width: 44px;
  height: 44px;
  padding: 10px;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.account-link {
  flex: none;
  margin: 0 -10px 0 -14px;
}
.share-pop {
  position: absolute;
  top: 48px;
  right: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  min-width: 190px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.share-pop[hidden] {
  display: none;
}
.share-pop a,
.share-pop button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.share-pop a:hover,
.share-pop button:hover {
  background: var(--surface-2);
}
.share-pop button.done {
  color: var(--accent);
}
/* X と LINE は線ではなく塗りのロゴ。LINE は公式の緑 */
.nav-icon.icon-x,
.nav-icon.icon-line {
  fill: currentColor;
  stroke: none;
}
.nav-icon.icon-line {
  color: #06c755;
}
.share-pop .icon-x,
.share-pop .icon-line {
  width: 20px;
  height: 20px;
  margin: 2px;
}


/* 案内のメニュー：PC では左のサイドバー、スマホでは三本線で開く */
.side {
  display: flex;
  flex-direction: column;
  font-size: 14px;
}
.nav-icon {
  flex: none;
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linejoin: round;
  stroke-linecap: round;
}
main {
  flex: 1;
  min-width: 0;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px 40px;
}

/* スマホとタブレットの幅：下に固定のメニュー。サイドバーは出さない */
@media (max-width: 1023px) {
  /* 検索窓を共有アイコンの手前まで広げる */
  .search {
    max-width: none;
    margin: 0;
  }
  .side {
    display: none;
  }
  .tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    display: grid;
    /* 項目の数が変わっても必ず1段で並べる */
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface);
    border-top: 1px solid var(--border);
  }
  .tabbar a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 60px;
    color: var(--muted);
    /* 6つ並んでも、幅の狭いスマホで文字が隣とぶつからない大きさにする */
    font-size: clamp(10px, 2.9vw, 11px);
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
  }
  .tabbar a[aria-current='page'] {
    color: var(--accent);
  }
}

/* PC と横向きのタブレットの幅：左にサイドバーを固定して、下のメニューは出さない */
@media (min-width: 1024px) {
  .tabbar {
    display: none;
  }
  .shell {
    padding-left: 248px;
  }
  /* サイドバーは画面に固定する。ページの一番下まで動かしても残るよう、フッターもよける */
  .side {
    position: fixed;
    top: calc(var(--top-h) + 1px);
    bottom: 0;
    left: 0;
    width: 248px;
    overflow-y: auto;
    padding: 16px 16px 16px 20px;
  }
  .foot {
    margin-left: 248px;
  }
  .side .side-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 14px;
  }
  .side-main {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--text);
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
  }
  .side-main:hover {
    background: var(--surface-2);
  }
  .side-main[aria-current='page'] {
    background: var(--ok-bg);
    color: var(--ok-text);
  }
}

/* トップ */
.hero {
  padding: 32px 0 20px;
}
.hero h1 {
  margin: 0 0 6px;
  font-size: clamp(21px, 6.4vw, 40px);
  line-height: 1.3;
  font-weight: 800;
}
.hero p {
  margin: 0 0 14px;
  /* スマホでも説明の1文が1行に収まるよう、画面の幅に合わせて小さくする */
  font-size: clamp(11px, 3.3vw, 16px);
  /* 端末の文字設定で折り返しても、最後の1文字だけが次の行へ落ちないようにする */
  text-wrap: balance;
  color: var(--muted);
}
/* 上の帯に隠れないよう、飛んだ時に少し手前で止める */
#rank {
  scroll-margin-top: calc(var(--top-h) + 8px);
}
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
}
.section-head h2 {
  margin: 0;
  font-size: 20px;
}
.section-head a {
  flex: none;
  font-size: 14px;
  font-weight: 700;
}
.tag-chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
  padding: 0;
}
.tag-chips a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}
.tag-chips a:hover {
  border-color: var(--accent);
}
.tag-chips small {
  color: var(--muted);
  font-size: 12px;
}
/* 新着は横に流して見る */
.grid.scroller {
  grid-template-columns: none;
  grid-auto-flow: column;
  grid-auto-columns: minmax(250px, 280px);
  overflow-x: auto;
  scroll-snap-type: x proximity;
  margin: 12px 0 8px;
  padding-bottom: 10px;
}
.grid.scroller > li {
  scroll-snap-align: start;
}
/* スクロールバーは出さない。指はスワイプ、マウスはつかんで動かす */
.grid.scroller {
  scrollbar-width: none;
  cursor: grab;
}
.grid.scroller::-webkit-scrollbar {
  display: none;
}
.grid.scroller.dragging {
  scroll-snap-type: none;
  cursor: grabbing;
  user-select: none;
}
.grid.scroller.dragging a {
  pointer-events: none;
}
.new-card strong {
  display: block;
  overflow: hidden;
  padding: 8px 12px 10px;
  font-size: 14px;
  line-height: 1.4;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}
.tabs.small a {
  padding: 6px 14px;
  font-size: 14px;
}
.tabs a {
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}
.tabs a[aria-selected='true'] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}
.grid {
  list-style: none;
  margin: 16px 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 18px;
}
.card {
  display: block;
  height: 100%;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--text);
  text-decoration: none;
  transition: transform 0.12s;
}
.card:hover {
  transform: translateY(-2px);
}
/* ランキングの順位。カードの左上にしおりの形で下げる。1〜3位は金・銀・銅 */
.card {
  position: relative;
}
.rank-mark {
  position: absolute;
  top: 0;
  left: 12px;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  width: 42px;
  height: 52px;
  padding-top: 8px;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 84%, 0 100%);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 1px rgb(0 0 0 / 25%);
}
.rank-1 {
  background: linear-gradient(160deg, #ffe680, #f2b705 55%, #b97a00);
  color: #3a2600;
  text-shadow: 0 1px 0 rgb(255 255 255 / 45%);
}
.rank-2 {
  background: linear-gradient(160deg, #f4f6f9, #b9c2cd 55%, #7f8a97);
  color: #20262e;
  text-shadow: 0 1px 0 rgb(255 255 255 / 50%);
}
.rank-3 {
  background: linear-gradient(160deg, #f3c29a, #c9763a 55%, #8a4a1c);
  color: #2e1605;
  text-shadow: 0 1px 0 rgb(255 255 255 / 30%);
}
/* 殿堂入りは順位の札と見分けがつくよう、深い紫に金の王冠 */
.rank-hall {
  padding-top: 7px;
  background: linear-gradient(160deg, #5b35a8, #2a1656);
  color: #ffd75e;
}
.nav-icon.icon-crown {
  fill: currentColor;
  stroke: none;
}
.badge.hall {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: linear-gradient(160deg, #5b35a8, #2a1656);
  color: #ffd75e;
}
.badge.hall .nav-icon {
  width: 14px;
  height: 14px;
}
.rank-other {
  background: linear-gradient(160deg, #2b3440, #161b22);
  color: var(--accent);
  font-size: 18px;
}
.shot {
  width: 100%;
  aspect-ratio: 600 / 315;
  object-fit: cover;
  background: var(--surface-2);
}
.info {
  display: flex;
  gap: 10px;
  padding: 10px 12px 12px;
}
.info > span {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
}
.info strong {
  line-height: 1.4;
}
.info > span {
  flex: 1;
}
/* PC ではカードの題名を1行にそろえ、はみ出した分は … にする（スマホは折り返して全部見せる） */
@media (min-width: 768px) {
  .info strong {
    align-self: stretch;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
}
.icon {
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: 10px;
  background: var(--surface-2);
}
/* カードのアイコンは、題名と下の行の2行分の高さにそろえる */
.info .icon {
  width: 46px;
  height: 46px;
  border-radius: 8px;
}
.stars {
  color: var(--star);
  font-weight: 700;
  font-size: 14px;
}
.stars.none {
  color: var(--muted);
  font-weight: 400;
}
.stars small {
  color: var(--muted);
}
.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.badge,
.mt {
  display: inline-block;
  padding: 0 7px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
/* スマホの幅のヘッダーは、サイト名を残して検索窓を虫めがねにする */
@media (max-width: 599px) {
  .top .brand {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
  }
  .top .search {
    display: none;
  }
  .top .search-link {
    display: block;
    flex: none;
    margin: 0 -10px 0 0;
  }
  .page-search {
    display: block;
    max-width: none;
    margin: 12px 0 0;
  }
}
@media (max-width: 359px) {
  .top .brand {
    font-size: 15px;
  }
}

/* カードの右下の、押された回数と遊ばれた回数 */
.info .badges {
  align-self: stretch;
  align-items: center;
}
.counts {
  display: inline-flex;
  gap: 8px;
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.counts span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.counts .card-star {
  color: var(--star);
}
.counts .nav-icon {
  width: 14px;
  height: 14px;
}
.badge.good {
  background: var(--ok-bg);
  color: var(--ok-text);
}
.mt {
  border: 1px dashed var(--muted);
  background: transparent;
}
p.badges {
  margin: 4px 0 0;
}
.pager {
  display: flex;
  justify-content: center;
  gap: 16px;
  font-weight: 700;
}

/* 紹介ページ */
.detail {
  max-width: 680px;
  margin: 20px auto 0;
}
.hero-shot {
  width: 100%;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--surface-2);
}
.head {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 18px 0 12px;
}
.head .icon {
  width: 72px;
  height: 72px;
}
.head h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.35;
}
.by {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.tag {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
.tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 12px;
  margin: 10px 0 0;
  font-size: 14px;
  font-weight: 700;
}
.tags a {
  text-decoration: none;
}
.detail h2,
/* 作者の自己紹介。改行はそのまま見せ、長い英数字ははみ出さず折り返す */
.bio {
  margin-bottom: 12px;
}
.bio p {
  margin: 0 0 6px;
  overflow-wrap: anywhere;
  white-space: pre-line;
}
.author-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
}
.author-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 14px;
  text-decoration: none;
}
.author-links .nav-icon {
  width: 16px;
  height: 16px;
}
/* 紹介の管理 */
.promo-page {
  max-width: 860px;
  margin: 0 auto;
}
.promo-page h1 {
  margin-bottom: 4px;
}
.promo-page h2 {
  margin: 28px 0 10px;
  font-size: 17px;
}
.promo-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 16px 0 0;
}
.promo-stats div {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.promo-stats .todo {
  border-color: var(--accent);
}
.promo-stats dt {
  color: var(--muted);
  font-size: 12px;
}
.promo-stats dd {
  margin: 2px 0 0;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.promo-stats .todo dd {
  color: var(--accent);
}
.promo-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.promo-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.promo-card .icon {
  width: 46px;
  height: 46px;
  border-radius: 10px;
}
.promo-main {
  min-width: 0;
}
.promo-title {
  display: block;
  overflow: hidden;
  color: inherit;
  font-weight: 700;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.promo-title:hover {
  color: var(--accent);
}
.promo-main .note {
  margin: 2px 0 6px;
  font-size: 12px;
}
.promo-states {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
}
.promo-state {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}
.promo-state.done {
  background: var(--ok-bg);
  color: var(--ok-text);
}
.promo-state .nav-icon {
  width: 13px;
  height: 13px;
}
.promo-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 150px;
}
.promo-actions .btn {
  padding: 6px 12px;
  font-size: 13px;
  text-align: center;
}
/* 管理ページ */
.admin-tools {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 16px;
}
.admin-tools a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: inherit;
  text-decoration: none;
}
.admin-tools a:hover {
  border-color: var(--accent);
}
.admin-tools .nav-icon {
  color: var(--accent);
}
.admin-tools span {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.admin-tools small {
  color: var(--muted);
  font-size: 12px;
}
.admin-stats {
  grid-template-columns: repeat(4, 1fr);
}
.admin-stats dt a {
  color: inherit;
  text-decoration: none;
}
.admin-section {
  scroll-margin-top: calc(var(--top-h) + 12px);
}
.admin-section h2 {
  display: flex;
  align-items: center;
  gap: 8px;
}
.admin-count {
  min-width: 24px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13px;
  line-height: 22px;
  text-align: center;
}
.admin-count.on {
  background: var(--accent);
  color: var(--bg);
}
.admin-clear {
  margin: 0;
  padding: 12px 14px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  color: var(--muted);
  font-size: 14px;
}
.admin-card {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.admin-card p {
  margin-top: 0;
}
.admin-card-head {
  display: flex;
  gap: 12px;
}
.admin-card .icon {
  width: 46px;
  height: 46px;
  border-radius: 10px;
}
.admin-reason {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
.admin-target {
  margin: 6px 0;
  overflow-wrap: anywhere;
}
.admin-card .text {
  margin: 6px 0;
  overflow-wrap: anywhere;
  white-space: pre-line;
}
.admin-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.admin-form input {
  flex: 1 1 220px;
  min-width: 0;
  margin-top: 0;
}
.admin-form .btn {
  padding: 6px 14px;
  font-size: 13px;
}
/* スマホの幅ではボタンを下へ回して横に並べる */
@media (max-width: 640px) {
  .admin-tools {
    grid-template-columns: 1fr;
  }
  .admin-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .admin-form input {
    flex-basis: 100%;
  }
  .admin-form .btn {
    flex: 1;
  }
  .promo-card {
    grid-template-columns: auto 1fr;
  }
  .promo-actions {
    grid-column: 1 / -1;
    flex-direction: row;
  }
  .promo-actions .btn {
    flex: 1;
  }
}

/* プレイ日記 */
.diary-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}
.diary-list a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: inherit;
  text-decoration: none;
}
.diary-list a:hover {
  border-color: var(--accent);
}
.diary-list img {
  flex: none;
  width: 120px;
  height: 63px;
  border-radius: 6px;
  object-fit: cover;
}
.diary-list span {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.diary-list strong {
  overflow-wrap: anywhere;
}
.diary-list time {
  color: var(--muted);
  font-size: 13px;
}
.diary-kind {
  margin-right: 8px;
  color: var(--accent);
  font-weight: 700;
}
.diary-shot {
  display: block;
  width: 100%;
  height: auto;
  margin: 12px 0;
  border-radius: 10px;
}
.diary-text {
  overflow-wrap: anywhere;
  white-space: pre-line;
}

/* ヘルプ。分野の入口と、開閉式の質問 */
.help-search {
  display: block;
  margin-bottom: 16px;
}
.help-search[hidden],
.help-cats[hidden],
.help-topic[hidden],
.help-q[hidden] {
  display: none;
}
.help-search input {
  margin-top: 0;
}
.skip-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.help-cats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 8px;
}
.help-cats a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  text-decoration: none;
}
.help-cats a:hover {
  border-color: var(--accent);
}
.help-cats .nav-icon {
  color: var(--accent);
}
.help-topic {
  scroll-margin-top: calc(var(--top-h) + 12px);
}
.help-q {
  scroll-margin-top: calc(var(--top-h) + 12px);
  border-bottom: 1px solid var(--border);
}
.help-q summary {
  padding: 12px 4px;
  font-weight: 700;
  cursor: pointer;
}
.help-q p {
  margin: 0 4px 14px;
}
.form-page h2 {
  margin: 28px 0 8px;
  padding-bottom: 4px;
  font-size: 18px;
  border-bottom: 1px solid var(--border);
}
.text {
  margin: 0;
  white-space: pre-wrap;
}

/* 機械翻訳の印と原文 */
.mt-note {
  margin: 14px 0 0;
  padding: 8px 12px;
  border: 1px dashed var(--muted);
  border-radius: 8px;
  font-size: 13px;
  color: var(--muted);
}
details.original {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}
details.original summary {
  cursor: pointer;
}
details.original p {
  margin: 4px 0;
  white-space: pre-wrap;
}

/* ボタン */
.btn {
  display: inline-block;
  padding: 10px 18px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover {
  filter: brightness(1.08);
}
.btn:disabled {
  opacity: 0.5;
  cursor: default;
}
.btn.ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--danger-text);
}
.btn.play {
  display: block;
  padding: 14px;
  font-size: 18px;
}
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* 星を選ぶ：同じ並びの後ろの星まで塗るので、5から逆順に並べて右から左に見せる */
.rate {
  border: 0;
  margin: 0;
  padding: 0;
}
.rate legend {
  padding: 0;
  font-weight: 700;
}
.pick {
  display: inline-flex;
  flex-direction: row-reverse;
}
.pick input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.pick label {
  padding: 0 4px;
  color: var(--star-off);
  font-size: 36px;
  line-height: 1.2;
  cursor: pointer;
}
.pick input:checked ~ label,
.pick label:hover,
.pick label:hover ~ label {
  color: var(--star);
}
.pick input:focus-visible + label {
  outline: 2px solid var(--accent);
}

.unrate {
  margin-top: 8px;
}
.reviews,
.list {
  list-style: none;
  margin: 12px 0;
  padding: 0;
}
.reviews li,
.list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.who {
  margin: 0;
  font-weight: 700;
  font-size: 14px;
}
time {
  color: var(--muted);
  font-weight: 400;
}
.mini {
  margin: 4px 0 0;
  font-size: 12px;
}
.note {
  margin: 6px 0;
  color: var(--muted);
  font-size: 14px;
}
.alert,
.ok {
  margin: 12px 0;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--alert-bg);
  font-weight: 600;
}
.ok {
  background: var(--ok-bg);
  color: var(--ok-text);
}
.alert[hidden] {
  display: none;
}
.empty {
  padding: 40px 0;
  text-align: center;
  color: var(--muted);
}
.status {
  font-size: 13px;
  color: var(--muted);
}


/* フォーム */
.form-page,
.prose {
  max-width: 680px;
  margin: 24px auto 0;
}
.form-page.wide {
  max-width: 860px;
}
.form-page h1,
.prose h1 {
  font-size: 26px;
  margin: 0 0 12px;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: stretch;
}
.stack > label {
  font-weight: 600;
}
input:not([type='radio'], [type='checkbox'], [type='file']),
textarea,
select {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 16px; /* これより小さいと iPhone で画面が勝手に拡大される */
}
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.inline {
  display: flex;
  gap: 8px;
  align-items: stretch;
  flex-wrap: wrap;
}
.inline input {
  flex: 1 1 220px;
  width: auto;
}
.check {
  font-weight: 400 !important;
}
.images {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin: 0;
  min-width: 0;
}
.images legend,
.choices legend {
  font-weight: 700;
  padding: 0 6px;
}
.choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin: 0;
  min-width: 0;
}
.images label {
  display: block;
  margin-top: 8px;
  font-size: 14px;
}
.previews {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-start;
}
.previews figure {
  margin: 0;
  flex: 0 1 auto;
  max-width: 100%;
}
.previews .crop-card {
  flex: 1 1 320px;
  max-width: 400px;
}
.previews .crop-icon {
  flex: 1 1 180px;
  max-width: 240px;
}
.previews .crop-card canvas {
  width: 100%;
}
/* アイコンは指で動かせる大きさにする */
.previews .crop-icon canvas {
  width: 128px;
}
/* 画像が入ったら、なぞってもページが動かないようにして位置を動かせるようにする */
.previews canvas.ready {
  cursor: grab;
  touch-action: none;
}
.crop-zoom {
  margin: 6px 0 0;
}
.crop-zoom[hidden] {
  display: none;
}
.crop-zoom label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 0;
}
.crop-zoom input {
  flex: 1;
  min-width: 0;
  margin-top: 0;
}
.previews input[type='file'] {
  max-width: 100%;
}
.previews canvas {
  border: 1px dashed var(--muted);
  border-radius: 8px;
  background: var(--surface-2);
}
figcaption {
  font-size: 12px;
  color: var(--muted);
}
.trap {
  position: absolute;
  left: -9999px;
}

/* 規約などの文章 */
.prose h2 {
  margin: 28px 0 6px;
  font-size: 18px;
}
.prose h3 {
  margin: 16px 0 4px;
  font-size: 16px;
}
.prose table {
  width: 100%;
  border-collapse: collapse;
}
.prose th,
.prose td {
  padding: 8px;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.prose code {
  font-family: ui-monospace, Consolas, Menlo, monospace;
}
.prose pre {
  overflow-x: auto;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 13px;
}
.prose th {
  width: 30%;
  background: var(--surface-2);
}

/* ページの一番下の案内 */
.foot {
  padding-top: 20px;
  padding-left: 16px;
  padding-right: 16px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--surface);
  text-align: center;
  font-size: 13px;
}
.foot nav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 16px;
}
.foot p {
  margin: 8px 0 0;
  color: var(--muted);
}
@media (max-width: 1023px) {
  /* 下の固定メニューにフッターが隠れないようにする */
  .foot {
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
  }
}

/* 押す所の共通の形。指で押しやすい高さの札にする */
.section-head a,
.mini a,
.by a,
.note a,
.tags a,
.pager a,
.foot nav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 4px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}
.section-head a {
  color: var(--accent);
}
.by a {
  margin-top: 4px;
}
.tags a {
  color: var(--accent);
}
.prose .note a {
  display: inline;
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--link);
}
.mini {
  margin-top: 10px;
}
/* 文章の中のリンクは太字で見分ける */
.prose a,
.help-q a {
  font-weight: 700;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
}
.btn .nav-icon {
  width: 18px;
  height: 18px;
}
.btn.play {
  display: flex;
}
.tabs a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
}
.check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}
.check input,
.choices input[type='radio'] {
  flex: none;
  width: 22px;
  height: 22px;
}
.help-q summary {
  min-height: 44px;
}
.admin-form .btn,
.promo-actions .btn {
  min-height: 40px;
}

/* マイページ */
.me {
  max-width: 680px;
  margin: 24px auto 0;
}
.me-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.me-head h1 {
  margin: 0;
  font-size: 26px;
}
.me-head .note {
  margin: 2px 0 0;
}
.me-jump {
  display: flex;
  gap: 8px;
  margin: 14px -16px 0;
  padding: 0 16px 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.me-jump::-webkit-scrollbar {
  display: none;
}
.me-jump a {
  display: inline-flex;
  flex: none;
  align-items: center;
  min-height: 40px;
  padding: 4px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}
.me-box {
  scroll-margin-top: calc(var(--top-h) + 12px);
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}
.me-box h2 {
  margin: 0 0 10px;
  padding: 0;
  border: 0;
  font-size: 17px;
}
.me-box input:not([type='checkbox']),
.me-box textarea {
  background: var(--bg);
}
.me-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.me-game {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.me-game:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}
.me-game .note {
  margin: 0;
}
.me-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  color: var(--text);
}
.me-row .icon {
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 10px;
}
.me-row > span {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.status.on {
  color: var(--accent);
  font-weight: 700;
}
.me-wide {
  display: flex;
  width: 100%;
  margin-top: 10px;
}
.me-empty {
  margin: 0;
  color: var(--muted);
}
.me-leave {
  margin-top: 12px;
}
.me-leave summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

/* 画像を選ぶボタンも指で押しやすくする */
input[type='file'] {
  width: 100%;
  font-size: 14px;
}
input[type='file']::file-selector-button {
  min-height: 40px;
  margin-right: 10px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-weight: 700;
}

/* ホーム画面に追加の箱。下のメニューの上に出す */
.install-box {
  position: fixed;
  right: 10px;
  bottom: calc(70px + env(safe-area-inset-bottom));
  left: 10px;
  z-index: 20;
  display: flex;
  gap: 12px;
  max-width: 480px;
  margin: 0 auto;
  padding: 14px;
  border: 1px solid var(--accent);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgb(0 0 0 / 45%);
  animation: install-up 0.25s ease-out;
}
@keyframes install-up {
  from {
    transform: translateY(120%);
  }
}
@media (prefers-reduced-motion: reduce) {
  .install-box {
    animation: none;
  }
}
.install-box img {
  flex: none;
  width: 48px;
  height: 48px;
}
.install-box strong {
  display: block;
  line-height: 1.4;
}
.install-box p {
  margin: 4px 0 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}
.install-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.install-actions .btn {
  min-height: 40px;
  padding: 6px 16px;
}

/* 作者の引き取りの合言葉 */
.claim-code {
  overflow-x: auto;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
}

/* 不具合の時のページ */
.error-page {
  max-width: 480px;
  margin: 0 auto;
  padding: 64px 16px;
  text-align: center;
}

/* 管理ページの、ふだん使わない操作 */
.admin-more {
  margin-top: 24px;
  padding: 0 14px;
  border: 1px dashed var(--border);
  border-radius: 12px;
}
.admin-more summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.admin-more form {
  margin-bottom: 14px;
}

/* 運営者情報などはメインページの続きとして見せる。枠も背景も付けない。固定のメニューはスマホとタブレットの .tabbar */
.foot {
  border-top: 0;
  background: transparent;
}
