/*
 * 嘘八百万 シリーズトップページ スタイル
 *
 * 承認済みデザイン案（doc/design_reference.html）をベースに、
 * 機械的にまとめられていた k0〜k21 クラスを意味のある名前に作り直したもの。
 * レイアウトの骨格・配色・アニメーションはデザイン案と同一。
 */

:root {
  --bg: #0E0D0C;
  --fg: #EDE6D8;
  --border: #2A2622;
  --border-hover: #4A433B;
  --muted: #A79E8E;
  --muted2: #C9C0B0;
  --panel: #171513;
  --gold: #D4A84A;
  --gold-hover: #EBC772;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
}

body {
  color: var(--fg);
  font-family: 'Zen Kaku Gothic New', sans-serif;
}

a { color: var(--gold); }
a:hover { color: var(--gold-hover); }

/* ============ ルート（1画面に収める箱） ============ */
.root {
  box-sizing: border-box;
  min-height: 100vh;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  overflow: hidden;
}

/* ============ ヘッダー ============ */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding: 20px 48px;
  border-bottom: 1px solid var(--border);
}

.logo-link {
  text-decoration: none;
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.logo-jp {
  font-family: 'Shippori Mincho B1', serif;
  font-weight: 800;
  font-size: 32px;
  color: var(--gold);
  display: inline-block;
  transform: skewX(-10deg);
  letter-spacing: 0.04em;
}

.logo-en {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--muted);
}

.header-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ============ 共通ボタン類 ============ */
.btn {
  transition: background .15s, color .15s, border-color .15s;
}
.btn-main:hover { filter: brightness(1.12); }
.btn-ghost:hover { border-color: var(--fg); color: var(--fg); }

.nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid #3A352F;
  border-radius: 999px;
  color: var(--muted2);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

/* ============ ヒーローセクション ============ */
.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  padding: 36px 48px 28px;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hero-kicker {
  margin: 0;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.24em;
  color: var(--muted);
}

.hero-title {
  margin: 0;
  font-family: 'Shippori Mincho B1', serif;
  font-weight: 800;
  font-size: 56px;
  line-height: 1.15;
  letter-spacing: 0.02em;
}

.hero-title .accent { color: var(--gold); }

.hero-lead {
  margin: 0;
  font-size: 16px;
  color: var(--muted2);
  line-height: 1.7;
}

.hero-cast {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}

.hero-cast-label {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.1em;
}

.hero-chip-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

/* 吹き出しキャラの縦位置をジグザグに揃える（デザイン案の k5/k6 相当） */
.hero-chip-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.hero-chip-item--offset { margin-top: 18px; }

@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(var(--r, 0deg)); }
  50% { transform: translateY(-8px) rotate(var(--r, 0deg)); }
}

.chip {
  animation: bob 3.2s ease-in-out infinite;
  transition: scale .2s;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  object-fit: cover;
  background: #FAFAFA;
  border: 4px solid var(--chip-border, var(--gold));
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
}
.chip:hover { scale: 1.12; }

.chip-name {
  font-size: 12px;
  color: var(--muted2);
}

@media (prefers-reduced-motion: reduce) {
  .chip { animation: none; }
}

/* ============ ゲーム一覧セクション ============ */
.game-section {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0 48px 24px;
}

.game-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.game-section-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.game-section-count {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

/* ============ 棚（4件までは横幅いっぱい、5件以上で横スクロール） ============ */
.shelf {
  --tiles: 4;
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(300px, 1fr);
  grid-template-columns: repeat(var(--tiles), minmax(300px, 1fr));
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
}

/* ============ ゲームタイル ============ */
.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  min-height: 0;
  transition: transform .2s, border-color .2s;
}
.tile:hover {
  transform: translateY(-3px);
  border-color: var(--border-hover);
}

.tile-kanji {
  position: absolute;
  right: -18px;
  bottom: -46px;
  font-family: 'Shippori Mincho B1', serif;
  font-weight: 800;
  font-size: 220px;
  line-height: 1;
  color: var(--tile-accent, var(--gold));
  opacity: 0.1;
}

.tile-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tile-no {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  color: var(--tile-label, var(--gold));
}

.tile-badge {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--tile-badge-bg, #2A2416);
  color: var(--tile-badge-text, #E6C46E);
}

.tile-body {
  display: flex;
  flex-direction: column-reverse;
  gap: 14px;
}

.tile-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tile-title {
  margin: 0;
  font-family: 'Shippori Mincho B1', serif;
  font-weight: 800;
  font-size: 34px;
  line-height: 1.2;
}

.tile-origin {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.tile-pair {
  position: relative;
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}
.tile:hover .tile-pair img { scale: 1.08; }
.tile-pair img { transition: scale .2s; }

.speech-bubble {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 10px 10px 10px 2px;
  background: var(--fg);
  color: #17130A;
  white-space: nowrap;
}

.avatar-row { display: flex; }

.avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  background: #FAFAFA;
  border: 3px solid var(--tile-accent, var(--gold));
}
.avatar + .avatar {
  margin-left: -14px;
}
.avatar--front {
  position: relative;
  z-index: 2;
}

.tile-desc {
  margin: 0;
  font-size: 15px;
  line-height: 1.75;
  color: var(--muted2);
}

.tile-stats {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: auto;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat-label {
  font-size: 11px;
  color: var(--muted);
}
.stat-value {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.tile-actions {
  display: flex;
  gap: 8px;
  position: relative;
}

.btn-watch {
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 8px;
  background: var(--tile-accent, var(--gold));
  color: var(--tile-on-accent, #17130A);
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
}

.btn-rule-video {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid #3A352F;
  color: var(--muted2);
  text-decoration: none;
  font-size: 14px;
}

.rule-video-pending {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px dashed #3A352F;
  color: #8F877A;
  font-size: 13px;
}

/* ============ 「次のゲーム」準備中タイル ============ */
.tile-next {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 24px;
  border: 1px dashed #3A352F;
  border-radius: 14px;
  text-align: center;
  min-height: 0;
}

.tile-next-no {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  color: var(--muted);
}

.tile-next-mark {
  font-family: 'Shippori Mincho B1', serif;
  font-weight: 800;
  font-size: 96px;
  line-height: 1;
  color: #3A352F;
}

.tile-next-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--muted2);
}

.tile-next-desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted);
}

/* ============ フッター（LATEST） ============ */
.site-footer {
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
  padding: 14px 48px;
  border-top: 1px solid var(--border);
  font-size: 13px;
}

.footer-kicker {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--muted);
}

.footer-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted2);
  text-decoration: none;
  min-height: 44px;
}

.footer-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--border);
  color: var(--muted2);
}

.footer-copyright {
  margin-left: auto;
  font-size: 12px;
  color: #7F776B;
}

/* ============ スマホ幅（900px以下）：縦積み・縦スクロール許可 ============ */
@media (max-width: 900px) {
  .hero { flex-direction: column; align-items: flex-start; }
  .shelf {
    grid-auto-flow: row;
    grid-auto-columns: auto;
    grid-template-columns: minmax(0, 1fr);
    overflow-x: visible;
  }
  .root { height: auto; min-height: 100vh; }
  .site-footer { flex-direction: column; align-items: flex-start; }
}

/* ============ 高さが足りないビューポート向けのコンパクト化 ============ */
/* PC幅のまま 720p など低めの高さでも、縦スクロール無しで収まるようにする */
@media (max-height: 820px) and (min-width: 901px) {
  .site-header { padding: 14px 48px; }
  .hero { padding: 22px 48px 18px; gap: 24px; }
  .hero-title { font-size: 42px; }
  .hero-lead { font-size: 14px; }
  .chip { width: 68px; height: 68px; border-width: 3px; }
  .game-section { padding: 0 48px 16px; gap: 10px; }
  .tile { padding: 16px; gap: 10px; }
  .tile-title { font-size: 26px; }
  .tile-kanji { font-size: 160px; right: -14px; bottom: -34px; }
  .tile-desc {
    font-size: 13px;
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .avatar { width: 48px; height: 48px; }
  .site-footer { padding: 10px 48px; }
}

@media (max-height: 740px) and (min-width: 901px) {
  .hero-title { font-size: 36px; }
  .hero-chip-item--offset { margin-top: 10px; }
  .chip { width: 56px; height: 56px; }
  .tile-stats { gap: 4px; }
  .stat-value { font-size: 13px; }
  .tile-desc { -webkit-line-clamp: 2; }
}
