﻿* {
  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: 540px;
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
}

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

.hero-icon {
  font-size: 2.5rem;
  margin-bottom: 0.35rem;
}

h1 {
  font-size: 2.4rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #1a73e8, #6d28d9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.4rem;
}

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

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

/* ━━━ ヒーローバッジ ━━━ */
.hero-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}

.badge {
  display: inline-block;
  padding: 5px 13px;
  background: #dbeafe;
  color: #1e3a8a;
  border: 1.5px solid #93c5fd;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ━━━ スコアバー ━━━ */
.score-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  gap: 0.5rem;
}

.score-chips {
  display: flex;
  gap: 0.5rem;
}

.score-chip {
  background: #1e293b;
  border-radius: 10px;
  padding: 0.4rem 1rem;
  text-align: center;
  min-width: 80px;
}

.score-chip-best {
  background: #1a2744;
}

.score-label {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.55);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: bold;
}

.score-val {
  font-size: 1.35rem;
  font-weight: bold;
  color: #fbbf24;
  line-height: 1.2;
}

.game-btns {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  background: #fff;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  color: #555;
}

.btn-icon:hover {
  border-color: #1a73e8;
  color: #1a73e8;
  background: #f0f6ff;
}

.btn-new {
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
  border: none;
  background: #1a73e8;
  color: #fff;
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.btn-new:hover {
  background: #1558c0;
}

/* ━━━ ゲームボード ━━━ */
.game-wrap {
  position: relative;
  margin-bottom: 0.75rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  background: #1e293b;
  border-radius: 14px;
  padding: 10px;
  width: 100%;
  user-select: none;
  touch-action: none;
}

/* ━━━ セル ━━━ */
.cell {
  aspect-ratio: 1;
  background: #334155;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 2rem;
  transition: background-color 0.06s, color 0.06s;
  min-width: 0;
}

/* ━━━ タイルカラー ━━━ */
.cell[data-v="2"]    { background: #dbeafe; color: #1e3a8a; }
.cell[data-v="4"]    { background: #bfdbfe; color: #1e3a8a; }
.cell[data-v="8"]    { background: #60a5fa; color: #fff; }
.cell[data-v="16"]   { background: #3b82f6; color: #fff; }
.cell[data-v="32"]   { background: #2563eb; color: #fff; }
.cell[data-v="64"]   { background: #1d4ed8; color: #fff; }
.cell[data-v="128"]  { background: #7c3aed; color: #fff; }
.cell[data-v="256"]  { background: #6d28d9; color: #fff; }
.cell[data-v="512"]  { background: #f59e0b; color: #fff; }
.cell[data-v="1024"] { background: #d97706; color: #fff; }
.cell[data-v="2048"] { background: #dc2626; color: #fff; box-shadow: 0 0 20px rgba(220,38,38,0.5); }
.cell[data-v="4096"] { background: #991b1b; color: #fca5a5; }
.cell[data-v="8192"] { background: #7f1d1d; color: #fca5a5; }

/* ━━━ アニメーション ━━━ */
@keyframes tileAppear {
  from { transform: scale(0.3); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

@keyframes tilePop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.tile-new {
  animation: tileAppear 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tile-merged {
  animation: tilePop 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ━━━ オーバーレイ ━━━ */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(4px);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.overlay.hidden { display: none; }

.overlay-box {
  text-align: center;
  padding: 1.5rem;
}

.overlay-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.overlay-title {
  font-size: 1.6rem;
  font-weight: 900;
  color: #fff;
  margin-bottom: 0.3rem;
}

.overlay-score {
  font-size: 1rem;
  color: #fbbf24;
  margin-bottom: 1.25rem;
}

.overlay-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
}

.overlay-btn-primary {
  padding: 0.65rem 1.5rem;
  border-radius: 8px;
  border: none;
  background: #1a73e8;
  color: #fff;
  font-size: 1rem;
  font-family: inherit;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.15s;
}

.overlay-btn-primary:hover { background: #1558c0; }

.overlay-btn-secondary {
  padding: 0.65rem 1.5rem;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.3);
  background: transparent;
  color: #fff;
  font-size: 1rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}

.overlay-btn-secondary:hover { background: rgba(255,255,255,0.1); }
.overlay-btn-secondary.hidden { display: none; }

/* ━━━ 操作ヒント ━━━ */
.controls-hint {
  text-align: center;
  font-size: 0.8rem;
  color: #aaa;
  margin-bottom: 1.25rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.hint-sep { color: #ddd; }

/* ━━━ カード共通 ━━━ */
.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.3rem;
  color: #1a73e8;
}

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

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: 540px) {
  main { padding: 0 0.75rem 3rem; }

  h1 { font-size: 2rem; }

  .score-chip { min-width: 68px; padding: 0.35rem 0.6rem; }
  .score-val  { font-size: 1.15rem; }

  .grid { gap: 7px; padding: 7px; border-radius: 12px; }
  .cell { border-radius: 6px; }

  .controls-hint { font-size: 0.75rem; gap: 0.35rem; }
  .hint-sep { display: none; }
  .controls-hint span { display: block; }

  .tips-grid { grid-template-columns: 1fr; }
  .scene-grid { grid-template-columns: 1fr; }
}

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

/* ━━━ 活用シーン ━━━ */
.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: #eff6ff;
  border: 1.5px solid #bfdbfe;
  border-radius: 12px;
}
.scene-icon { font-size: 1.7rem; flex-shrink: 0; }
.scene-body strong { display: block; font-size: .88rem; font-weight: 700; color: #1e3a8a; 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: #1a73e8; box-shadow: 0 2px 8px rgba(26,115,232,.1); }
.related-tool-icon { font-size: 1.6rem; flex-shrink: 0; }
.related-tool-item strong { display: block; font-size: .88rem; font-weight: 700; color: #1a73e8; 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: #1a73e8; margin-bottom: .35rem; }
.faq-a { font-size: .85rem; color: #555; line-height: 1.75; }
