/* Tapiava Games - 共通スタイル
 * 配色: Tapiava ブランドのカラーパレットに整合。
 *   - アクセント = #D67B7A (サーモンピンク・theme-color)
 *   - 背景       = #FAF7F4 (温かいオフホワイト)
 *   - カード     = #F1ECE6 (淡ベージュ)
 *   - テキスト   = #4C463F / 見出し = #3D2E24
 *   - ボーダー   = #E0D5CA
 * フォント: Zen Maru Gothic (Google Fonts・Tapiava 本体と統一・partials/fonts.html で読込)
 * Phaser ゲーム背景の薄ピンク #FFE4EC は Hero グラデと .game-container に温存し、
 * ゲームブランドとしての可愛さを残す。
 */

/* ---------- Skip link (a11y / WCAG 2.4.1) ---------- */
.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  background: #3D2E24;
  color: #FFFFFF;
  padding: 0.6rem 1rem;
  border-radius: 0 0 8px 0;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  z-index: 9999;
  transition: top 0.15s ease;
}

.skip-link:focus,
.skip-link:focus-visible {
  top: 0;
  outline: 3px solid #D67B7A;
  outline-offset: 2px;
  color: #FFFFFF;
  text-decoration: none;
}

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  font-family: "Zen Maru Gothic", -apple-system, BlinkMacSystemFont, "Hiragino Maru Gothic ProN", "Yu Gothic", "Hiragino Sans", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.75;
  color: #4C463F;
  background: #FAF7F4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: #D67B7A;
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover,
a:focus-visible {
  color: #B85F5E;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* 外部リンク (target="_blank" + rel="noopener") には自動で ↗ アイコンを付与。
   ・ロゴ / ナビゲーション内のリンクや、画像のみのリンクは除外 (.site-logo / .site-nav / .no-external-cue)。
   ・aria-hidden の span を挿入できないので、CSS擬似要素で装飾のみ追加 (a11y は visible テキスト維持)。 */
a[target="_blank"][rel~="noopener"]:not(.site-logo):not(.no-external-cue)::after {
  content: " \2197"; /* ↗ */
  display: inline-block;
  font-size: 0.85em;
  margin-left: 0.15em;
  color: currentColor;
  opacity: 0.7;
  transform: translateY(-0.05em);
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid #B85F5E;
  outline-offset: 2px;
  border-radius: 4px;
}

h1, h2, h3 {
  margin: 0 0 0.6em;
  line-height: 1.4;
  color: #3D2E24;
  font-weight: 700;
}

h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.35rem, 2.8vw, 1.75rem); }
h3 { font-size: 1.15rem; }

p {
  margin: 0 0 1em;
}

ul {
  padding-inline-start: 1.4em;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem clamp(1rem, 4vw, 2rem);
  background: rgba(250, 247, 244, 0.95);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid #E0D5CA;
}

.site-logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  line-height: 0;
}

.site-logo-img {
  height: 28px;
  width: auto;
  display: block;
  transition: opacity 0.15s ease;
}

.site-logo:hover .site-logo-img,
.site-logo:focus-visible .site-logo-img {
  opacity: 0.8;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(0.5rem, 2vw, 1.25rem);
  flex-wrap: wrap;
}

.site-nav a {
  color: #4C463F;
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: #B85F5E;
  background: #F1ECE6;
  text-decoration: none;
}

.site-nav .nav-play {
  background: #D67B7A;
  color: #FFFFFF;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-weight: 700;
  box-shadow: 0 3px 10px rgba(214, 123, 122, 0.35);
}

.site-nav .nav-play:hover,
.site-nav .nav-play:focus-visible {
  background: #B85F5E;
  color: #FFFFFF;
}

.site-nav .nav-lang {
  font-size: 0.85rem;
  color: #8A796F;
  border: 1px solid #E0D5CA;
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
}

.site-nav .nav-lang:hover {
  background: #F1ECE6;
  color: #4C463F;
}

/* モバイル用ナビトグル (デスクトップでは非表示) */
.nav-toggle {
  display: none;
  background: transparent;
  border: 0;
  width: 44px;
  height: 44px;
  padding: 10px;
  cursor: pointer;
}

.nav-toggle-bar {
  display: block;
  width: 100%;
  height: 2px;
  background: #4C463F;
  margin: 5px 0;
  border-radius: 2px;
}

/* ---------- Main / Layout ---------- */
.site-main {
  max-width: 960px;
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3rem) clamp(1rem, 4vw, 2rem) clamp(2rem, 5vw, 4rem);
}

/* ---------- Hero (Top) ---------- */
.hero {
  text-align: center;
  /* 縦余白を圧縮し、ファーストビューの情報密度を上げる (旧: 2-3.5rem 上 / 2.5-4rem 下) */
  padding: clamp(1.5rem, 3.5vw, 2.5rem) 1rem clamp(1.75rem, 4vw, 3rem);
  background: linear-gradient(180deg, #FFE4EC 0%, #F8E5DC 60%, #FAF7F4 100%);
  border-radius: 24px;
  margin-bottom: 2.5rem;
  box-shadow: 0 6px 24px rgba(214, 123, 122, 0.2);
}

.hero-visual {
  max-width: min(560px, 80%);
  width: 100%;
  height: auto;
  margin: 0 auto 1.25rem;
  border-radius: 16px;
  box-shadow: 0 8px 20px rgba(214, 123, 122, 0.18);
  aspect-ratio: 1200 / 630;
  object-fit: cover;
  background: #F1ECE6; /* placeholder before image loads */
}

.hero-title {
  font-size: clamp(2rem, 5.5vw, 3.25rem);
  margin: 0 0 0.5em;
  letter-spacing: -0.01em;
  font-weight: 700;
}

.hero-tagline {
  font-size: clamp(1.1rem, 2.6vw, 1.5rem);
  color: #B85F5E;
  font-weight: 700;
  margin: 0 0 0.4em;
}

.hero-subtagline {
  font-size: 1rem;
  color: #8A796F;
  margin: 0 0 2rem;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 0.75rem 1.6rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  border: 0;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease, box-shadow 0.15s ease;
  line-height: 1.2;
  font-family: inherit;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: #D67B7A;
  color: #FFFFFF;
  box-shadow: 0 6px 16px rgba(214, 123, 122, 0.35);
}

.btn-primary:hover,
.btn-primary:focus-visible {
  background: #B85F5E;
  color: #FFFFFF;
  box-shadow: 0 8px 20px rgba(214, 123, 122, 0.45);
}

.btn-secondary {
  background: #F1ECE6;
  color: #B85F5E;
  border: 1px solid #E0D5CA;
}

.btn-secondary:hover,
.btn-secondary:focus-visible {
  background: #E0D5CA;
  color: #8A4544;
}

.btn-large {
  padding: 1rem 2.4rem;
  font-size: 1.1rem;
}

/* ---------- Features (Top) ---------- */
.features {
  margin-bottom: 3rem;
}

.features > h2 {
  text-align: center;
}

.features > p {
  max-width: 720px;
  margin-inline: auto;
  margin-bottom: 1.2em;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-top: 2rem;
}

.feature {
  background: #F1ECE6;
  border-radius: 16px;
  padding: 1.5rem 1.25rem;
  border: 1px solid #E0D5CA;
  text-align: center;
}

.feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin: 0 auto 0.6rem;
  border-radius: 14px;
  background: #FFFFFF;
  box-shadow: 0 2px 6px rgba(214, 123, 122, 0.15);
}

.feature-icon svg {
  width: 28px;
  height: 28px;
  stroke: #D67B7A;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.feature h3 {
  margin: 0.2em 0 0.5em;
  color: #B85F5E;
}

.feature p {
  margin: 0;
  font-size: 0.95rem;
  color: #4C463F;
  text-align: left;
}

/* ---------- Series Info ---------- */
.series-info {
  background: #F1ECE6;
  border-radius: 16px;
  padding: clamp(1.5rem, 4vw, 2.25rem);
  border: 1px dashed #D0C5BA;
}

.series-info h2 {
  margin-top: 0;
}

.cta-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.25rem;
}

/* ---------- Play page ---------- */
.play-main {
  max-width: 1280px;
  padding-top: 1.5rem;
}

.game-container {
  position: relative;
  width: 100%;
  max-width: 1280px;
  aspect-ratio: 16 / 9;
  margin: 0 auto;
  background: #FFE4EC;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 6px 24px rgba(214, 123, 122, 0.25);
}

/* Phaser.Scale.FIT が canvas に直接 width/height を style 指定するので
   CSS 側からは display と中央寄せだけ。サイズは上書きしない。
   absolute で親 (aspect-ratio) のボックスに重ね、Phaser が autoCenter する。 */
.game-container canvas {
  display: block;
  position: absolute;
  inset: 0;
  margin: auto;
  max-width: 100%;
  max-height: 100%;
}

.play-info {
  max-width: 720px;
  margin: 1.75rem auto 0;
  padding: 1.25rem 1rem 0;
  text-align: center;
}

.play-info h1 {
  margin-bottom: 0.5em;
}

.play-info p {
  font-size: 0.95rem;
  color: #4C463F;
  text-align: left;
}

/* ---------- 長文ページ (about / faq / privacy / terms 等) ---------- */
.page-content {
  max-width: 760px;
  margin-inline: auto;
}

.page-content h1 {
  margin-bottom: 1em;
}

.page-content h2 {
  margin-top: 2em;
  padding-bottom: 0.3em;
  border-bottom: 1px solid #E0D5CA;
}

.page-content h3 {
  margin-top: 1.6em;
  color: #B85F5E;
}

.page-content ul,
.page-content ol {
  padding-inline-start: 1.5em;
  margin: 0 0 1em;
}

.page-content li {
  margin-bottom: 0.4em;
}

.page-content li > ul,
.page-content li > ol {
  margin-top: 0.4em;
  margin-bottom: 0.4em;
}

.page-content hr {
  border: 0;
  border-top: 1px solid #E0D5CA;
  margin: 2.5em 0;
}

.page-content .note {
  font-size: 0.9rem;
  color: #8A796F;
}

/* テーブル (How to Play / Roadmap 等) */
.table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.5em;
  font-size: 0.95rem;
  background: #FFFFFF;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.table thead {
  background: #F1ECE6;
}

.table th,
.table td {
  padding: 0.65em 0.85em;
  text-align: left;
  border-bottom: 1px solid #E0D5CA;
  vertical-align: top;
}

.table th {
  font-weight: 700;
  color: #3D2E24;
}

.table tbody tr:last-child th,
.table tbody tr:last-child td {
  border-bottom: 0;
}

/* 法務文書 (privacy / terms) */
.legal-doc h2 {
  font-size: 1.15rem;
  margin-top: 2.4em;
}

.legal-doc h3 {
  font-size: 1rem;
  color: #4C463F;
  margin-top: 1.4em;
}

.legal-doc .legal-meta {
  font-size: 0.9rem;
  color: #8A796F;
  background: #F1ECE6;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5em;
  line-height: 1.9;
}

.legal-doc .legal-footnote {
  font-size: 0.85rem;
  color: #8A796F;
  font-style: italic;
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 4rem;
  padding: 2rem clamp(1rem, 4vw, 2rem) 2.5rem;
  background: #F1ECE6;
  border-top: 1px solid #E0D5CA;
  text-align: center;
}

.footer-copyright {
  margin: 0 0 0.6em;
  color: #8A796F;
  font-size: 0.9rem;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.4rem 0.6rem;
  margin-bottom: 0.6em;
  font-size: 0.9rem;
}

.footer-nav a {
  color: #4C463F;
}

.footer-meta {
  margin: 0;
  font-size: 0.85rem;
  color: #8A796F;
}

.footer-meta a {
  color: #4C463F;
}

.footer-sep {
  color: #A39A90;
  margin: 0 0.2em;
}

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .nav-toggle {
    display: inline-block;
  }

  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: #FAF7F4;
    padding: 0.5rem 0;
    border-bottom: 1px solid #E0D5CA;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.05);
  }

  .site-nav.is-open {
    display: flex;
  }

  .site-nav a {
    width: 100%;
    padding: 0.75rem 1.25rem;
    border-radius: 0;
    text-align: center;
  }

  .site-nav .nav-play {
    margin: 0.5rem 1.25rem;
    width: auto;
  }

  .site-nav .nav-lang {
    margin: 0.25rem auto 0.75rem;
    width: max-content;
    padding: 0.3rem 0.9rem;
  }

  .features-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }
}
