/* ゲームのギャラリーのページ (/games と /indiegame) の共通の見た目。
   カード・タブ・モーダルを描く JS は front_end/components/game_gallery。
   ページだけのもの (/games の ARKADIA の案内・並び順、 /indiegame の製作者リンクなど) は各ページの <style> に置く。 */
:root {
  --bg: #ffffff;
  --bg-warm: #f8f8f8;
  --bg-card: #ffffff;
  --paper: #ffffff;
  --ink: #0a0a0a;
  --ink-soft: #333333;
  --ink-mute: #8f8f8f;
  --line: #d9d9d9;
  --line-soft: #efefef;
  --accent: #0a0a0a;
  --accent-deep: #333333;
  --accent-soft: #efefef;
  --highlight: #ffe066;
  --highlight-soft: #fff4b8;
  --red: #d60000;
  --shadow-sm: 0 1px 2px rgba(26, 26, 26, 0.04), 0 2px 6px rgba(26, 26, 26, 0.04);
  --shadow-md: 0 4px 12px rgba(26, 26, 26, 0.06), 0 8px 24px rgba(26, 26, 26, 0.04);
  --shadow-lg: 0 12px 32px rgba(26, 26, 26, 0.08), 0 24px 64px rgba(26, 26, 26, 0.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
  font-feature-settings: "palt";
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
.serif { font-family: 'Noto Sans JP', sans-serif; font-weight: 400; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ヘッダー / フッター / .btn は共通コンポーネント (site_header / footer) が持つため、
   ここには専用スタイルを持たない。 */

/* ============ SECTION COMMON (features ページと同じ) ============ */
.container { max-width: 1240px; margin: 0 auto; padding: 0 32px; }
.section-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; color: var(--accent);
  letter-spacing: 0.08em; text-transform: uppercase;
  margin-bottom: 20px;
}
.section-eyebrow::before { content: ""; width: 24px; height: 1.5px; background: var(--accent); }
.section-title {
  font-size: clamp(32px, 4.5vw, 56px);
  font-weight: 900; letter-spacing: -0.03em; line-height: 1.15;
  margin-bottom: 24px;
}
.section-title .serif { font-style: italic; font-weight: 400; }
/* 狭い画面で「好き / だった」 のように語の途中で折り返さないよう、 ひとかたまりで送る。 */
.section-title .keep { display: inline-block; }
.section-title .accent {
  background: linear-gradient(180deg, transparent 65%, var(--highlight) 65%);
  padding: 0 4px;
}
.section-lead { font-size: 18px; color: var(--ink-soft); max-width: 620px; line-height: 1.75; }
.section-head.center { text-align: center; }
.section-head.center .section-lead { margin: 0 auto; }
.section-head.center .section-eyebrow { justify-content: center; }

/* ============ HERO ============ */
.hero { padding: 120px 0 64px; }
.hero-stat {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px; color: var(--ink-mute);
  letter-spacing: 0.08em;
  margin-top: 28px;
}
.hero-stat b { color: var(--ink); font-size: 20px; font-weight: 700; }
.hero-sign {
  font-size: clamp(18px, 2vw, 24px);
  color: var(--ink-soft);
  margin: -8px 0 0;
}
.hero-sign .serif { font-style: italic; font-weight: 600; color: var(--ink); }

/* ============ GENRE TABS ============ */
.tabs-wrap {
  position: sticky; top: 56px; z-index: 50;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
}
.tabs {
  display: flex; gap: 8px;
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--paper);
  font-size: 13.5px; font-weight: 600;
  color: var(--ink-soft);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}
.tab .count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; font-weight: 700;
  background: var(--bg-warm); color: var(--ink-mute);
  padding: 1px 8px; border-radius: 2px;
}
.tab .gdot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.tab:hover { border-color: var(--ink); color: var(--ink); background: var(--highlight); }
.tab.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.tab.active .count { background: rgba(255, 255, 255, 0.18); color: #fff; }

/* ============ GALLERY ============ */
.gallery { padding: 52px 0 56px; }
.gallery-head {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 26px;
}
.gallery-count {
  flex: 1; min-width: 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px; color: var(--ink-mute);
  letter-spacing: 0.08em;
  display: flex; align-items: center; gap: 10px;
}
.gallery-count::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 28px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .3s cubic-bezier(.2,.8,.2,1), box-shadow .3s, border-color .3s, opacity .4s;
  opacity: 0;
  transform: translateY(28px);
}
.card.in { opacity: 1; transform: translateY(0); }
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--ink); }

.card-media {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--bg-warm);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.card-media img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .5s cubic-bezier(.2,.8,.2,1);
}
.card:hover .card-media img { transform: scale(1.05); }
.thumb-ph {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 54px;
  position: relative;
}
.thumb-ph::after {
  content: "";
  position: absolute; inset: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,0.35) 1.2px, transparent 1.2px);
  background-size: 18px 18px;
  opacity: 0.5;
}
.ph-shoot { background: linear-gradient(135deg, #3a5fff, #7c4dff); }
.ph-drive { background: linear-gradient(135deg, #ff5a3c, #ffb03c); }
.ph-action { background: linear-gradient(135deg, #2ea84a, #7cd44f); }
.ph-cooking { background: linear-gradient(135deg, #ff7eb3, #ff5a3c); }
.ph-puzzle { background: linear-gradient(135deg, #ffb03c, #ffe066); }
.ph-rhythm { background: linear-gradient(135deg, #9b4dff, #ff7eb3); }
.ph-etc { background: linear-gradient(135deg, #555, #999); }

.media-badges {
  position: absolute; top: 12px; left: 12px;
  /* 右上の投稿日 (.card-date) と重ならないよう、 その幅を空けて折り返す。 */
  max-width: calc(100% - 120px);
  display: flex; gap: 6px; flex-wrap: wrap;
  z-index: 2;
}
/* 投稿日 (画像の右上)。 左上のジャンルの札と同じ白地。 */
.card-date {
  position: absolute; top: 12px; right: 12px;
  z-index: 2;
  padding: 3px 10px;
  border-radius: 2px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  background: rgba(255,255,255,0.95);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.genre-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  border-radius: 2px;
  font-size: 11px; font-weight: 700;
  background: rgba(255,255,255,0.95);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.genre-pill .gdot { width: 7px; height: 7px; border-radius: 50%; }
.new-pill {
  padding: 3px 10px;
  border-radius: 2px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.08em;
  background: var(--highlight); color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.play-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10,10,10,0);
  transition: background .3s;
  z-index: 2;
  cursor: pointer;
}
.card:hover .play-overlay { background: rgba(10,10,10,0.18); }
.play-btn {
  width: 58px; height: 58px;
  border-radius: 50%;
  background: rgba(255,255,255,0.95);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-md);
  transform: scale(0.9);
  transition: transform .3s cubic-bezier(.2,.8,.2,1);
}
.card:hover .play-btn { transform: scale(1); }
.play-btn::before {
  content: "";
  width: 0; height: 0;
  border-style: solid;
  border-width: 10px 0 10px 17px;
  border-color: transparent transparent transparent var(--ink);
  margin-left: 4px;
}
.short-tag {
  position: absolute; bottom: 12px; right: 12px;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px;
  background: rgba(10,10,10,0.82);
  color: #fff;
  border-radius: 2px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.04em;
  z-index: 2;
}
.short-tag .yt {
  width: 15px; height: 11px;
  background: #ff0000;
  border-radius: 3px;
  display: inline-flex; align-items: center; justify-content: center;
}
.short-tag .yt::before {
  content: ""; width: 0; height: 0;
  border-style: solid; border-width: 3px 0 3px 5px;
  border-color: transparent transparent transparent white;
  margin-left: 1px;
}

.card-body {
  padding: 20px 22px 22px;
  display: flex; flex-direction: column;
  flex: 1;
}
.card-title {
  font-size: 19px; font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.35;
  margin-bottom: 8px;
}
.card-desc {
  /* 管理画面の概要は複数行で入力できる。 改行は残し、 連続する空白は詰める。 */
  white-space: pre-line;
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.75;
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* ---- 製作者コメント ---- */
.card-comment {
  position: relative;
  margin-bottom: 20px;
  padding: 12px 14px 12px 16px;
  background: var(--bg-warm);
  border-left: 3px solid var(--highlight);
  border-radius: 0 3px 3px 0;
}
.card-comment-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
  margin-bottom: 4px;
  flex-wrap: wrap; row-gap: 2px;
  white-space: nowrap;
}
.card-comment-label .en {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 0.08em;
}
.card-comment-label .by { margin-left: auto; font-weight: 600; color: var(--ink-soft); }
.card-comment-text {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.75;
}
@media (max-width: 480px) { .card-comment-label .en { display: none; } }
.card-comment.is-empty .card-comment-text { color: var(--ink-mute); font-style: italic; }
.card-actions {
  margin-top: auto;
  display: grid;
  grid-template-columns: 1fr;
}
/* ヘッダーの .btn と衝突しないよう、 カード用ボタンは card-btn に分ける。 */
.card-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 44px;
  border-radius: 2px;
  font-size: 14px; font-weight: 600;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.card-btn-play { background: var(--ink); color: #fff; border-color: var(--ink); }
.card-btn-play:hover { background: var(--ink-soft); border-color: var(--ink-soft); }
.card-btn-play::before {
  content: "";
  width: 0; height: 0;
  border-style: solid; border-width: 5px 0 5px 8px;
  border-color: transparent transparent transparent currentColor;
}
/* 遊ばれた回数 (/games だけ。 全期間。 lib/game_play_counts.ts)。 少ないうちはサーバが付けないので出ない。 */
.card-plays {
  margin-bottom: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px; font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  text-align: right;
}

/* ============ MODAL (short video) ============ */
/* 名前は game- 付き。 .modal / #modal は共通のモーダル (components/modal。 ヘッダーの 「新規作成」 が開く) が使うので、
   同じ名前にするとこの規則が向こうに当たり、 向こうがこの要素を消す (front_end/components/game_gallery/index.ts)。 */
.game-modal {
  position: fixed; inset: 0;
  z-index: 2000;
  display: none;
  align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(10,10,10,0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.game-modal.open { display: flex; }
/* 縦長 (9:16) の動画 + 下のタイトル・ボタンが、 縦の短いスマホ (iPhone SE: 667px 等) でも
   画面に収まる幅にする。 170px はモーダルの上下余白 + キャプション分。 */
.game-modal-inner { position: relative; width: min(100%, 380px, calc((100dvh - 170px) * 9 / 16)); }
.game-modal-video {
  aspect-ratio: 9 / 16;
  background: #000;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.game-modal-video iframe { width: 100%; height: 100%; border: none; }
.game-modal-caption { margin-top: 16px; text-align: center; color: #fff; }
.game-modal-caption .t { font-size: 16px; font-weight: 800; margin-bottom: 10px; }
.game-modal-caption .card-btn-play {
  display: inline-flex; width: auto; padding: 0 24px;
  background: #fff; color: var(--ink); border-color: #fff;
}
.game-modal-caption .card-btn-play:hover { background: var(--highlight); border-color: var(--highlight); }
.game-modal-close {
  position: absolute;
  top: -14px; right: -14px;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: #fff;
  border: none;
  font-size: 18px; color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-md);
}
@media (max-width: 440px) {
  .game-modal-close { top: 8px; right: 8px; }
}

/* ============ ADD-GAME HINT (end card) ============ */
.end-card {
  margin-top: 28px;
  border: 1.5px dashed var(--line);
  border-radius: 4px;
  padding: 20px 24px;
  text-align: center;
  color: var(--ink-mute);
}
.end-card .ico { font-size: 20px; line-height: 1; margin-bottom: 8px; color: var(--ink); }
.end-card .t { font-size: 15px; font-weight: 700; color: var(--ink-soft); }
.end-card .d { font-size: 13px; margin-top: 2px; }

.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
  color: var(--ink-mute);
}
.empty .ico { font-size: 44px; margin-bottom: 12px; }

/* ============ CLOSING ============ */
.closing { padding: 0 0 120px; }
.closing-box {
  background: var(--bg-warm);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 80px 48px;
  text-align: center;
}
.closing h2 {
  font-size: clamp(28px, 3.5vw, 44px);
  font-weight: 900; letter-spacing: -0.03em; line-height: 1.3;
  margin-bottom: 20px;
}
.closing h2 .accent {
  background: linear-gradient(180deg, transparent 65%, var(--highlight) 65%);
  padding: 0 4px;
}
.closing p { font-size: 17px; color: var(--ink-soft); line-height: 1.8; margin-bottom: 36px; }
/* ページ全体の a はリンク装飾を消している (上の a 指定) ので、 本文中のリンクだけ下線で示す。 */
.closing p a { color: var(--ink); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.closing .btn { padding: 16px 36px; font-size: 15px; }
/* ============ RESPONSIVE ============ */
@media (max-width: 720px) {
  .container { padding: 0 16px; }
  .hero { padding: 96px 0 44px; }
  .section-lead { font-size: 16px; }
  .section-lead br { display: none; }
  .tabs-wrap { padding: 12px 0; }
  .gallery { padding: 36px 0 40px; }
  .grid { grid-template-columns: 1fr; gap: 22px; }
  .closing { padding-bottom: 80px; }
  .closing-box { padding: 56px 24px; }
}
