/* ===========================
   カスタムフォント定義
   =========================== */
@font-face {
  font-family: "DenkiChip";
  src: url("/assets/font/x8y12pxDenkiChip.ttf") format("truetype");
}

@font-face {
  font-family: "SolidLinker";
  src: url("/assets/font/x12y16pxSolidLinker.ttf") format("truetype");
}

@font-face {
  font-family: "GridGazer";
  src: url("/assets/font/x16y32pxGridGazer.ttf") format("truetype");
}

/* ===========================
   共通テーマ変数
   =========================== */
:root {
  --bg-color: #0f172a;
  /* iOS ホームバー・ノッチ用セーフエリア変数（viewport-fit=cover 有効時に値が入る） */
  --sab: env(safe-area-inset-bottom, 0px);
  --container-bg: #1e293b;
  --text-color: #f8fafc;
  --text-muted: #94a3b8;
  --accent-color: #38bdf8;
  --font-family:
    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ===========================
   ベーススタイル（全ページ共通）
   =========================== */
body {
  margin: 0;
  background: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-family);
}

a {
  color: var(--accent-color);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code {
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
}

pre {
  background: rgba(0, 0, 0, 0.3);
  padding: 20px;
  border-radius: 8px;
  overflow-x: auto;
}

pre code {
  background: transparent;
  padding: 0;
}

ul {
  padding-left: 20px;
}

li {
  margin-bottom: 8px;
}

hr {
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin: 30px 0;
}

h1,
h2,
h3 {
  color: var(--accent-color);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 10px;
  margin-top: 1.5em;
}

h1 {
  font-size: 2.5em;
}

/* ===========================
   ゲームページ（index.html）
   =========================== */
body.game-page {
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
}

#game-wrapper {
  width: 100%;
  flex-grow: 1;
}

#game-container {
  position: relative;
  overflow: hidden;
  background: #000;
  line-height: 0;
  width: 100%;
  height: 100vh; /* 旧Safariフォールバック */
  height: 100dvh; /* 動的ビューポート高さ（ブラウザUIの伸縮に追従） */
}

/* ピクセルアートアセットは PreloadScene.js 側で個別に
   NEAREST フィルタが適用されるため、キャンバス全体での pixelated 指定は行わない。
   指定するとスケーリング時に文字等のアンチエイリアス部分が強制的にガタガタになってしまい、
   モバイル等でのフォント荒れの原因となるため。 */

/* モバイル縦画面: ノッチ・ホームバーのセーフエリア対応 */
@media (pointer: coarse) and (orientation: portrait) {
  #game-container {
    border-radius: 0;
  }
}

/* ===========================
   ドキュメントページ（release_notes.html, licenses.html）
   =========================== */
body.doc-page {
  padding: 40px 20px;
  line-height: 1.6;
  display: flex;
  justify-content: center;
}

.page-container {
  max-width: 800px;
  width: 100%;
  background: var(--container-bg);
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
  box-sizing: border-box;
}

.back-link {
  display: inline-block;
  margin-bottom: 20px;
  color: var(--text-muted);
  font-size: 0.9em;
}

/* ===========================
   ライセンスコンポーネント
   =========================== */
.license-header {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 15px;
  color: var(--text-color);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-left: 3px solid var(--accent-color);
  padding-left: 10px;
  text-align: left;
}

.license-section {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-muted);
  margin-bottom: 40px;
}

.license-text {
  text-align: left;
  padding: 15px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
  height: 100%;
  box-sizing: border-box;
}

.acknowledgment {
  margin-top: 40px;
  padding: 30px;
  background: rgba(56, 189, 248, 0.05);
  border-radius: 12px;
  border: 1px solid rgba(56, 189, 248, 0.1);
  font-size: 14px;
  color: var(--text-color);
  line-height: 1.8;
}

.acknowledgment p {
  margin: 0;
}

.license-link {
  color: var(--accent-color);
  text-decoration: none;
  transition: color 0.2s ease;
  font-weight: 500;
}

.license-link:hover {
  color: #7dd3fc;
  text-decoration: underline;
}

@media (min-width: 768px) {
  .license-section {
    grid-template-columns: 1fr 1fr;
  }
}

/* ===========================
   ランディングページ（landing.html）
   =========================== */
body.landing-page {
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
}

.landing-content {
  width: 100%;
  max-width: 960px;
  padding: 0 20px;
  box-sizing: border-box;
}

.landing-hero {
  text-align: center;
  padding: 80px 20px 60px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.landing-hero h1 {
  font-size: 3em;
  margin: 0 0 16px 0;
  border: none;
  padding: 0;
  color: var(--accent-color);
}

.landing-hero p {
  color: var(--text-muted);
  font-size: 16px;
  margin: 0 0 32px 0;
  line-height: 1.6;
}

.play-button {
  display: inline-block;
  padding: 16px 56px;
  background: var(--accent-color);
  color: #0f172a;
  border-radius: 8px;
  font-weight: 700;
  font-size: 18px;
  text-decoration: none;
  transition: background 0.2s ease;
}

.play-button:hover {
  background: #7dd3fc;
  text-decoration: none;
}

.landing-footer {
  width: 100%;
  max-width: 960px;
  padding: 40px 20px;
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  gap: 20px;
  box-sizing: border-box;
}

/* ===========================
   取扱説明書（landing.html）
   =========================== */
.manual-container {
  width: 100%;
  padding: 40px 0;
  text-align: left;
}

.manual-title {
  margin-top: 0;
  color: var(--accent-color);
  border-bottom: 2px solid rgba(56, 189, 248, 0.2);
  padding-bottom: 10px;
  font-size: 20px;
}

.manual-section h3 {
  margin-top: 25px;
  margin-bottom: 15px;
  color: #e2e8f0;
  font-size: 16px;
}

.manual-list {
  line-height: 1.8;
  padding-left: 20px;
  color: var(--text-color);
  font-size: 14px;
}

.manual-section p {
  line-height: 1.6;
  color: var(--text-muted);
  margin: 0;
  font-size: 14px;
}
