@charset "UTF-8";

/* ==========================================
   1. 基本設定・リセット
   ========================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
  background-color: #f0f2f5;
  color: #333;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 20px 10px;
}

/* ==========================================
   2. メインカードコンテナ
   ========================================== */
.container {
  position: relative;
  background-color: #ffffff;
  width: 100%;
  max-width: 480px;
  padding: 20px;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  margin-bottom: 20px;
}

/* スタート前・クリア後はゲーム画面要素を隠す */
.container.is-before-start .game-title,
.container.is-before-start .description,
.container.is-before-start .status-panel,
.container.is-before-start .grid-container {
  display: none !important;
}

@media (min-width: 600px) {
  .container {
    max-width: 600px;
    padding: 28px;
  }
}

/* ==========================================
   3. ナビゲーションバー
   ========================================== */
.top-nav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.nav-btn {
  display: inline-block;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: bold;
  text-decoration: none;
  color: #4a5568;
  background-color: #edf2f7;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.nav-btn:hover {
  background-color: #e2e8f0;
}

.sound-btn.muted {
  background-color: #fed7d7;
  color: #c53030;
}

/* ==========================================
   4. タイトル・説明テキスト
   ========================================== */
.game-title {
  font-size: 1.5rem;
  text-align: center;
  color: #2b6cb0;
  line-height: 1.3;
  margin-bottom: 8px;
}

.description {
  font-size: 0.85rem;
  color: #4a5568;
  text-align: center;
  margin-bottom: 12px;
  line-height: 1.4;
}

@media (min-width: 600px) {
  .game-title {
    font-size: 1.8rem;
  }
  .description {
    font-size: 0.95rem;
  }
}

/* ==========================================
   5. ステータスパネル
   ========================================== */
.status-panel {
  display: flex;
  justify-content: space-around;
  background-color: #ebf8ff;
  padding: 8px 10px;
  border-radius: 8px;
  margin-bottom: 12px;
  font-weight: bold;
  color: #2b6cb0;
  font-size: 0.95rem;
}

@media (min-width: 600px) {
  .status-panel {
    font-size: 1.1rem;
    padding: 10px;
  }
}

/* ==========================================
   6. 4x4 グリッドエリア
   ========================================== */
.grid-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  width: 100%;
  aspect-ratio: 1 / 1;
}

.grid-item {
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #f7fafc;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: bold;
  color: #2d3748;
  cursor: pointer;
  word-break: break-all;
  padding: 4px;
  text-align: center;
  user-select: none;
  transition: transform 0.1s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.grid-item:active {
  transform: scale(0.95);
}

@media (min-width: 600px) {
  .grid-container {
    gap: 12px;
  }
  .grid-item {
    font-size: 1.05rem;
    border-radius: 10px;
  }
}

@media (max-width: 360px) {
  .grid-item {
    font-size: 0.75rem;
  }
}

/* ==========================================
   7. オーバーレイ（スタート・結果画面）
   ========================================== */
.overlay {
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 16px 8px;
  box-sizing: border-box;
}

#result-screen {
  position: relative;
  top: auto;
  left: auto;
  transform: none;
  width: 100%;
  background-color: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 24px 16px 32px 16px;
  margin-top: 8px;
}

/* 保存用画像にも含まれるサイト名・ゲーム名の表示 */
.result-site-title {
  font-size: 0.95rem;
  font-weight: bold;
  color: #4a5568;
  margin-bottom: 12px;
  line-height: 1.4;
  letter-spacing: 0.05em;
  border-bottom: 1px dashed #cbd5e0;
  padding-bottom: 8px;
  width: 100%;
}

.overlay h1, .overlay h2 {
  font-size: 1.5rem;
  color: #2b6cb0;
  margin-top: 0;
  margin-bottom: 12px;
  line-height: 1.3;
}

.overlay p {
  font-size: 1rem;
  color: #4a5568;
  margin-top: 0;
  margin-bottom: 16px;
  line-height: 1.5;
}

.final-time {
  font-size: 2.4rem;
  font-weight: bold;
  color: #e53e3e;
  margin-top: 8px;
  margin-bottom: 8px;
  line-height: 1;
}

.rank-display {
  font-size: 1.2rem;
  font-weight: bold;
  color: #2b6cb0;
  margin-bottom: 20px;
}

.rank-display span {
  font-size: 1.4rem;
  color: #d69e2e;
}

/* ボタンレイアウト */
.btn {
  background-color: #3182ce;
  color: #ffffff;
  border: none;
  padding: 12px 32px;
  font-size: 1.05rem;
  font-weight: bold;
  border-radius: 25px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(49, 130, 206, 0.3);
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.btn:hover {
  background-color: #2b6cb0;
}

.btn:active {
  transform: scale(0.96);
}

.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 280px;
  margin-top: 10px;
}

.action-buttons .btn {
  width: 100%;
  text-align: center;
}

.btn-secondary {
  background-color: #4a5568;
  box-shadow: 0 4px 10px rgba(74, 85, 104, 0.3);
}

.btn-secondary:hover {
  background-color: #2d3748;
}

.btn-x {
  background-color: #000000;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.btn-x:hover {
  background-color: #1a1a1a;
}

@media (min-width: 600px) {
  #result-screen {
    padding: 32px 24px 40px 24px;
  }
  .result-site-title {
    font-size: 1.1rem;
  }
  .overlay h1, .overlay h2 {
    font-size: 1.8rem;
    margin-bottom: 16px;
  }
  .overlay p {
    font-size: 1.1rem;
    margin-bottom: 20px;
  }
  .final-time {
    font-size: 2.8rem;
  }
  .btn {
    padding: 14px 40px;
    font-size: 1.15rem;
  }
}

.hidden {
  display: none !important;
}

/* ==========================================
   8. 広告領域（囲みなし） & フッター
   ========================================== */
.ad-area {
  width: 100%;
  max-width: 480px;
  margin-bottom: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: transparent;
  border: none;
}

@media (min-width: 600px) {
  .ad-area {
    max-width: 600px;
  }
}

.site-footer {
  width: 100%;
  max-width: 600px;
  text-align: center;
  font-size: 1rem;
  color: #718096;
  line-height: 1.6;
  padding: 10px 0;
}

.site-footer p {
  margin-bottom: 8px;
}

.affiliate-disclosure {
  color: #a0aec0;
}