﻿* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
button { touch-action: manipulation; }


body {
  font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', sans-serif;
  background: #f5f5f5;
  color: #333;
  line-height: 1.7;
  overflow-x: hidden;
}

header {
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  padding: 1rem 0;
}

.header-inner {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.logo {
  font-size: 1.2rem;
  font-weight: bold;
  color: #1a73e8;
  text-decoration: none;
}

main {
  max-width: 520px;
  margin: 0 auto;
  padding: 0 1rem 3rem;
}

/* ━━━ ヒーロー ━━━ */
.hero {
  text-align: center;
  padding: 1.75rem 0 1rem;
}

h1 {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  margin-bottom: 0.3rem;
}

h2 {
  font-size: 1.05rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.description {
  font-size: 0.95rem;
  color: #666;
}

/* ━━━ モード切替 ━━━ */
.mode-bar {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1rem;
}

.mode-btn {
  padding: 0.45rem 1.1rem;
  border: 1px solid #e0e0e0;
  border-radius: 999px;
  background: #fff;
  font-size: 0.875rem;
  font-family: inherit;
  color: #666;
  cursor: pointer;
  transition: all 0.15s;
}

.mode-btn.active {
  background: #7c3aed;
  border-color: #7c3aed;
  color: #fff;
  font-weight: bold;
}

.mode-btn:hover:not(.active) {
  border-color: #7c3aed;
  color: #7c3aed;
}

/* ━━━ 推測グリッド ━━━ */
.grid-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 0.75rem;
}

.guess-grid {
  display: grid;
  grid-template-rows: repeat(6, 1fr);
  gap: 6px;
}

.guess-row {
  display: flex;
  gap: 6px;
}

.guess-cell {
  width: 58px;
  height: 58px;
  border: 2px solid #d1d5db;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 900;
  background: #fff;
  color: #333;
  transition: border-color 0.1s;
  user-select: none;
}

.guess-cell.active-row {
  border-color: #9ca3af;
}

/* 文字が入力されている */
.guess-cell.filled {
  border-color: #333;
  animation: cellPop 0.1s ease;
}

@keyframes cellPop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.08); }
  100% { transform: scale(1); }
}

/* 結果表示 */
.guess-cell.correct {
  background: #7c3aed;
  border-color: #7c3aed;
  color: #fff;
}

.guess-cell.present {
  background: #ea580c;
  border-color: #ea580c;
  color: #fff;
}

.guess-cell.absent {
  background: #6b7280;
  border-color: #6b7280;
  color: #fff;
}

/* フリップアニメーション */
@keyframes flipIn {
  0%   { transform: rotateX(0deg); }
  50%  { transform: rotateX(-90deg); opacity: 0.5; }
  100% { transform: rotateX(0deg); }
}

.guess-cell.flip {
  animation: flipIn 0.4s ease forwards;
}

/* シェイクアニメーション（誤り入力） */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}

.guess-row.shake {
  animation: shake 0.4s ease;
}

/* ━━━ メッセージ ━━━ */
.message-area {
  min-height: 1.6rem;
  text-align: center;
  font-size: 0.9rem;
  font-weight: bold;
  color: #555;
  margin-bottom: 0.5rem;
}

/* ━━━ 結果パネル ━━━ */
.result-panel {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 0.75rem;
  text-align: center;
}

.result-panel.hidden { display: none; }

.result-emoji {
  font-size: 2.8rem;
  margin-bottom: 0.3rem;
}

.result-title {
  font-size: 1.3rem;
  font-weight: 900;
  margin-bottom: 0.4rem;
}

.result-answer {
  font-size: 1rem;
  color: #666;
  margin-bottom: 0.75rem;
}

.result-share-text {
  font-family: monospace;
  font-size: 0.85rem;
  background: #f9fafb;
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.9rem;
  line-height: 1.6;
  text-align: left;
  white-space: pre-wrap;
  word-break: break-all;
}

.result-btns {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-share {
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  background: #fff;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-share:hover {
  border-color: #7c3aed;
  color: #7c3aed;
}

.btn-share.copied {
  background: #7c3aed;
  border-color: #7c3aed;
  color: #fff;
}

.btn-next {
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  border: none;
  background: #7c3aed;
  color: #fff;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-next:hover { background: #6d28d9; }

/* ━━━ キーボード ━━━ */
.keyboard {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  margin-bottom: 1.25rem;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}

.key {
  height: 44px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  font-family: inherit;
  font-size: clamp(0.8rem, 2.2vw, 1rem);
  font-weight: bold;
  color: #333;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
  -webkit-tap-highlight-color: transparent;
  padding: 0;
  user-select: none;
}

.key:hover { background: #f3f4f6; }

/* 濁点・小文字モディファイアキー（゛ 小） */
.key-mod {
  background: #f3f4f6;
  border-color: #9ca3af;
  color: #555;
  font-size: 1.1rem;
}

.key-mod:hover { background: #e5e7eb; }

/* ← 決定 アクションキー */
.key-action {
  background: #f9fafb;
  font-size: clamp(0.65rem, 1.8vw, 0.82rem);
}

/* キーの結果色 */
.key.correct {
  background: #7c3aed;
  border-color: #7c3aed;
  color: #fff;
}

.key.present {
  background: #ea580c;
  border-color: #ea580c;
  color: #fff;
}

.key.absent {
  background: #9ca3af;
  border-color: #9ca3af;
  color: #fff;
}

/* ━━━ カード共通 ━━━ */
.card {
  background: #fff;
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  border: 1px solid #e0e0e0;
}

/* ━━━ Amazon ━━━ */
.amazon-card h2 { margin-bottom: 0.25rem; }

.amazon-note {
  font-size: 0.82rem;
  color: #999;
  margin-bottom: 1rem;
}

.amazon-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.amazon-item {
  display: block;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 1rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.1s;
}

.amazon-item:hover {
  border-color: #FF9900;
  box-shadow: 0 2px 8px rgba(255,153,0,0.15);
  transform: translateY(-1px);
}

.amazon-item-icon { font-size: 1.8rem; margin-bottom: 0.4rem; }
.amazon-item-name { font-size: 0.9rem; font-weight: bold; margin-bottom: 0.25rem; }
.amazon-item-desc { font-size: 0.78rem; color: #888; line-height: 1.5; margin-bottom: 0.5rem; }
.amazon-item-link { font-size: 0.8rem; color: #FF9900; font-weight: bold; }

/* ━━━ 遊び方 ━━━ */
.how-item {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #f0f0f0;
}

.how-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.how-item h3 {
  font-size: 0.9rem;
  font-weight: bold;
  margin-bottom: 0.4rem;
  color: #7c3aed;
}

.how-item p {
  font-size: 0.875rem;
  color: #666;
  line-height: 1.7;
}

.hint-chips {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
}

.hint-chip {
  display: inline-block;
  padding: 0.25rem 0.7rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: bold;
  color: #fff;
  white-space: nowrap;
}

.hint-chip.correct { background: #7c3aed; }
.hint-chip.present { background: #ea580c; }
.hint-chip.absent  { background: #6b7280; }

.hint-note {
  font-size: 0.82rem;
  color: #666;
}

footer {
  text-align: center;
  padding: 2rem;
  color: #999;
  font-size: 0.875rem;
}

footer a { color: #999; text-decoration: none; margin: 0 0.5rem; }
footer a:hover { color: #1a73e8; }
footer p { margin-bottom: 0.3rem; }

/* ─── Tips grid (rank-tracker 統一パターン) ──────── */
.tips-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.tip-item { display: flex; gap: .65rem; }
.tip-icon { font-size: 1.4rem; flex-shrink: 0; }
.tip-text strong { display: block; font-weight: 700; margin-bottom: .15rem; font-size: .88rem; }
.tip-text p { font-size: .8rem; color: #78716c; line-height: 1.55; }

/* ━━━ レスポンシブ（スマホ：ビューポート固定レイアウト） ━━━ */
@media (max-width: 600px) {
  /* ビューポート全体をゲーム画面として使う */
  html, body {
    height: 100%;
    overflow: hidden;
  }

  body {
    display: flex;
    flex-direction: column;
  }

  header {
    flex-shrink: 0;
  }

  /* main を縦フレックスにしてキーボードを下端に固定 */
  main {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    max-width: 100%;
  }

  /* グリッド・結果パネル・Amazon など：上部スクロール領域 */
  .top-area {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 0.6rem 0.5rem;
  }

  /* ヒーローをコンパクトに */
  .hero {
    padding: 0.5rem 0 0.25rem;
  }

  h1 { font-size: 1.5rem; }
  .description { display: none; }

  /* モード切替 */
  .mode-bar { margin-bottom: 0.45rem; }
  .mode-btn { padding: 0.3rem 0.75rem; font-size: 0.8rem; }

  /* グリッド */
  .grid-wrap { margin-bottom: 0.35rem; }
  .guess-grid { gap: 4px; }
  .guess-row  { gap: 4px; }
  .guess-cell {
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
    border-radius: 6px;
  }

  .message-area {
    min-height: 1.2rem;
    font-size: 0.82rem;
    margin-bottom: 0.3rem;
  }

  /* 結果パネル */
  .result-panel { padding: 0.75rem 1rem; margin-bottom: 0.5rem; }
  .result-emoji { font-size: 2rem; }
  .result-title { font-size: 1.05rem; }
  .result-answer { font-size: 0.9rem; margin-bottom: 0.5rem; }
  .result-share-text { font-size: 0.78rem; padding: 0.5rem; margin-bottom: 0.6rem; }

  /* キーボード：グリッドのすぐ下に配置 */
  .keyboard {
    gap: 2px;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
    margin-bottom: 0.75rem;
    padding: 5px 4px;
  }

  /* キーを固定高さで扁平に */
  .key {
    height: 26px;
    width: 100%;
    font-size: 0.75rem;
    border-radius: 4px;
  }

  .key-mod {
    font-size: 0.85rem;
  }

  .key-action {
    font-size: 0.62rem;
  }

  /* Amazon/遊び方 */
  .amazon-card {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
  }
  .tips-grid { grid-template-columns: 1fr; }

  /* footer はゲーム中は非表示 */
  footer { display: none; }
}

.amazon-notice {
  font-size: 0.72rem;
  color: #bbb;
  margin-top: 0.2rem;
}

/* ━━━ ヒーローアイコン・バッジ ━━━ */
.hero-icon { font-size: 2.5rem; margin-bottom: 0.4rem; }

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}
.badge {
  display: inline-block;
  padding: 5px 13px;
  background: #ede9fe;
  color: #7c3aed;
  border: 1.5px solid #c4b5fd;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ━━━ 活用シーン ━━━ */
.scene-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .75rem;
}
.scene-item {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .85rem 1rem;
  background: #f5f3ff;
  border: 1.5px solid #c4b5fd;
  border-radius: 12px;
}
.scene-icon { font-size: 1.7rem; flex-shrink: 0; }
.scene-body strong { display: block; font-size: .88rem; font-weight: 700; color: #4c1d95; margin-bottom: .2rem; }
.scene-body p { font-size: .78rem; color: #4b5563; line-height: 1.55; margin: 0; }

/* ━━━ 関連ツール ━━━ */
.related-tools {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .75rem;
}
.related-tool-item {
  display: flex; align-items: flex-start; gap: .75rem;
  padding: .85rem 1rem;
  border: 1.5px solid #e8edf5;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.related-tool-item:hover { border-color: #7c3aed; box-shadow: 0 2px 8px rgba(124,58,237,.1); }
.related-tool-icon { font-size: 1.6rem; flex-shrink: 0; }
.related-tool-item strong { display: block; font-size: .88rem; font-weight: 700; color: #7c3aed; margin-bottom: .2rem; }
.related-tool-item p { font-size: .76rem; color: #888; line-height: 1.5; margin: 0; }

/* ━━━ FAQ ━━━ */
.faq-list { display: flex; flex-direction: column; }
.faq-item { padding: .9rem 0; border-bottom: 1px solid #f0f0f0; }
.faq-item:last-child { border-bottom: none; padding-bottom: 0; }
.faq-q { font-size: .9rem; font-weight: 700; color: #7c3aed; margin-bottom: .35rem; }
.faq-a { font-size: .85rem; color: #555; line-height: 1.75; }

@media (max-width: 600px) {
  .scene-grid { grid-template-columns: 1fr; }
}
