﻿* {
  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: #0d9488;
  text-decoration: none;
}

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

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

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

h1 {
  font-size: 1.75rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
}

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

.description {
  color: #666;
  font-size: 0.9rem;
  line-height: 1.8;
}

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

/* ━━━ ゲームラッパー ━━━ */
.game-wrap {
  background: #fff;
  border-radius: 16px;
  border: 1px solid #e0e0e0;
  padding: 1rem 1rem 1.25rem;
  margin-bottom: 1rem;
  position: relative;
}

/* ━━━ ゲームヘッダー ━━━ */
.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.9rem;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* 難易度タブ */
.diff-tabs {
  display: flex;
  gap: 0.35rem;
}

.diff-tab {
  padding: 0.35rem 0.75rem;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  background: #fafafa;
  font-size: 0.8rem;
  font-family: inherit;
  color: #777;
  cursor: pointer;
  transition: all 0.15s;
}

.diff-tab:hover {
  border-color: #0d9488;
  color: #0d9488;
}

.diff-tab.active {
  background: #0d9488;
  border-color: #0d9488;
  color: #fff;
  font-weight: bold;
}

/* タイマー */
.timer-wrap {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 1rem;
  font-weight: bold;
  color: #555;
  font-variant-numeric: tabular-nums;
}

.timer-icon { font-size: 0.9rem; }

/* ━━━ 盤面 ━━━ */
.board-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 0.9rem;
}

.board {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  width: 100%;
  max-width: 450px;
  aspect-ratio: 1;
  border: 2.5px solid #134e4a;
  border-radius: 4px;
  overflow: hidden;
  touch-action: manipulation;
  user-select: none;
}

/* セル */
.cell {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border: 0.5px solid #cdd5e0;
  cursor: pointer;
  transition: background 0.1s;
  font-size: clamp(0.75rem, 2.5vw, 1.2rem);
  font-weight: 600;
  color: #134e4a;
  background: #fff;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ボックス境界（右） */
.cell[data-c="2"],
.cell[data-c="5"] {
  border-right: 2px solid #134e4a;
}

/* ボックス境界（下） */
.cell[data-r="2"] ,
.cell[data-r="5"] {
  border-bottom: 2px solid #134e4a;
}

/* 所与数字（黒） */
.cell.given {
  color: #111;
  font-weight: 700;
  cursor: default;
}

/* 選択 */
.cell.selected {
  background: #99f6e4 !important;
}

/* 同じ行/列/ブロック */
.cell.peer {
  background: #f0fdfa;
}

/* 同じ数字 */
.cell.same-num {
  background: #ccfbf1;
}

/* エラー */
.cell.error {
  color: #dc2626 !important;
  background: #fee2e2 !important;
}

/* ヒントで埋まった */
.cell.hinted {
  color: #059669;
}

/* ━━━ メモ表示 ━━━ */
.notes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  padding: 1px;
}

.note-num {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(0.42rem, 1.3vw, 0.6rem);
  font-weight: 500;
  color: #555;
  line-height: 1;
}

/* ━━━ アクションバー ━━━ */
.action-bar {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  background: #fafafa;
  color: #555;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  min-width: 60px;
}

.action-btn:hover {
  border-color: #0d9488;
  color: #0d9488;
  background: #f0fdfa;
}

.action-btn.active {
  background: #0d9488;
  border-color: #0d9488;
  color: #fff;
}

.action-icon {
  font-size: 1.2rem;
  line-height: 1;
}

.action-label {
  font-size: 0.7rem;
  white-space: nowrap;
}

.hint-btn { }
.new-btn { }

/* ━━━ 数字パッド ━━━ */
.numpad {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 0.35rem;
  max-width: 450px;
  margin: 0 auto;
}

.num-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  aspect-ratio: 0.85;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: #fff;
  font-family: inherit;
  font-size: clamp(0.85rem, 2.5vw, 1.2rem);
  font-weight: 700;
  color: #134e4a;
  cursor: pointer;
  transition: all 0.12s;
  -webkit-tap-highlight-color: transparent;
}

.num-btn:hover {
  border-color: #0d9488;
  background: #f0fdfa;
}

.num-btn.depleted {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}


/* ━━━ 完了オーバーレイ ━━━ */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.overlay[hidden] { display: none; }

.overlay-card {
  background: #fff;
  border-radius: 20px;
  padding: 2.5rem 2rem;
  max-width: 320px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.overlay-emoji {
  font-size: 3.5rem;
  margin-bottom: 0.5rem;
}

.overlay-title {
  font-size: 1.7rem;
  font-weight: bold;
  color: #134e4a;
  margin-bottom: 0.6rem;
}

.overlay-msg {
  font-size: 0.95rem;
  color: #555;
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

.overlay-btn {
  padding: 0.85rem 2.5rem;
  background: linear-gradient(135deg, #0d9488, #0f766e);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-family: inherit;
  font-weight: bold;
  cursor: pointer;
  transition: opacity 0.15s;
}

.overlay-btn:hover { opacity: 0.9; }

/* ━━━ 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: 0.9rem;
  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.7rem; margin-bottom: 0.35rem; }
.amazon-item-name { font-size: 0.88rem; font-weight: bold; margin-bottom: 0.2rem; }
.amazon-item-desc { font-size: 0.76rem; color: #888; line-height: 1.5; margin-bottom: 0.45rem; }
.amazon-item-link { font-size: 0.78rem; color: #FF9900; font-weight: bold; }

/* ━━━ 説明カード ━━━ */
.explanation-item {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #f0f0f0;
}

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

.explanation-item h3 {
  font-size: 0.9rem;
  font-weight: bold;
  margin-bottom: 0.3rem;
  color: #0d9488;
}

.explanation-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: #0d9488; }
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: 480px) {
  h1 { font-size: 1.4rem; }

  .game-header { gap: 0.4rem; }
  .diff-tab { padding: 0.3rem 0.55rem; font-size: 0.75rem; }

  .action-btn { min-width: 50px; padding: 0.45rem 0.5rem; }
  .action-label { font-size: 0.65rem; }

  .amazon-grid { grid-template-columns: repeat(2, 1fr); }
  .tips-grid { grid-template-columns: 1fr; }
}

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

/* ━━━ ヒーローバッジ ━━━ */
.hero-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}
.badge {
  display: inline-block;
  padding: 5px 13px;
  background: #ccfbf1;
  color: #0d9488;
  border: 1.5px solid #99f6e4;
  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: #f0fdfa;
  border: 1.5px solid #99f6e4;
  border-radius: 12px;
}
.scene-icon { font-size: 1.7rem; flex-shrink: 0; }
.scene-body strong { display: block; font-size: .88rem; font-weight: 700; color: #134e4a; 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: #0d9488; box-shadow: 0 2px 8px rgba(13,148,136,.1); }
.related-tool-icon { font-size: 1.6rem; flex-shrink: 0; }
.related-tool-item strong { display: block; font-size: .88rem; font-weight: 700; color: #0d9488; 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: #0d9488; margin-bottom: .35rem; }
.faq-a { font-size: .85rem; color: #555; line-height: 1.75; }

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