* { 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;
  position: sticky;
  top: 0;
  z-index: 100;
}

.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: 620px;
  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; }

.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: #115e59;
  border: 1.5px solid #5eead4;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

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

.intro-card p { font-size: .9rem; line-height: 1.9; margin-bottom: .6rem; }
.intro-card p strong { color: #0f766e; font-weight: 700; }
.intro-card p:last-child { margin-bottom: 0; }

.jump-note {
  font-size: .82rem !important;
  line-height: 2 !important;
  background: #f0fdfa;
  border: 1px solid #ccfbf1;
  border-radius: 8px;
  padding: .6rem .9rem;
}

/* ━━━ 解説カード ━━━ */
.guide-card h2 {
  font-size: 1.15rem;
  padding-bottom: .4rem;
  border-bottom: 2px solid #ccfbf1;
  margin-bottom: .6rem;
}
.guide-card p { font-size: .9rem; line-height: 1.9; margin-bottom: .6rem; }
.guide-card p strong { color: #0f766e; font-weight: 700; }
.guide-card b { color: #0d9488; }

.level {
  display: inline-block;
  font-size: .75rem !important;
  font-weight: 700;
  padding: .15rem .7rem;
  border-radius: 20px;
  margin-bottom: .7rem !important;
}
.level-1 { background: #dcfce7; color: #166534; }
.level-2 { background: #fef3c7; color: #92400e; }
.level-3 { background: #fee2e2; color: #991b1b; }

.proof {
  background: #f0fdfa;
  border: 1px solid #ccfbf1;
  border-radius: 10px;
  padding: .85rem 1rem;
  margin-top: .9rem;
}
.proof-head { font-size: .82rem; font-weight: 700; color: #0f766e; margin-bottom: .3rem; }
.proof p {
  font-size: .85rem !important;
  line-height: 1.9 !important;
  color: #44403c;
  margin-bottom: .5rem !important;
}
.proof p:last-child { margin-bottom: 0 !important; }

.step-list { margin: 0 0 .8rem 1.4rem; }
.step-list li { font-size: .88rem; line-height: 1.9; color: #444; margin-bottom: .15rem; }
.step-list li b { color: #0d9488; }

.cta-line {
  background: #f0fdfa;
  border-left: 4px solid #0d9488;
  padding: .7rem 1rem;
  border-radius: 0 8px 8px 0;
  margin-bottom: 0 !important;
}

/* ━━━ デモ盤面 ━━━ */
.demo {
  margin: 1rem 0 .3rem;
  padding: 1rem;
  background: #fafafa;
  border: 1px solid #e7e5e4;
  border-radius: 12px;
}

.demo-label {
  font-size: .82rem;
  color: #57534e;
  line-height: 1.7;
  margin-bottom: .7rem;
}
.demo-label b { color: #0d9488; font-weight: 700; }

.board-wrap { display: flex; justify-content: center; margin-bottom: .9rem; }

/* r1〜r9 / c1〜c9 の見出し付き枠（Excel の行列見出しと同じ考え方） */
.board-frame {
  display: grid;
  grid-template-columns: 1.5rem 1fr;
  grid-template-rows: 1.05rem 1fr;
  width: 100%;
  max-width: 420px;
}
/* padding は盤面の外枠(2.5px)ぶん。見出しとマスの中心を揃える */
.axis-cols { display: grid; grid-template-columns: repeat(9, 1fr); padding: 0 2.5px; }
.axis-rows { display: grid; grid-template-rows: repeat(9, 1fr); padding: 2.5px 0; }
.axis-cols i, .axis-rows i {
  display: flex;
  align-items: center;
  justify-content: center;
  font-style: normal;
  font-size: clamp(0.56rem, 2vw, 0.72rem);
  font-weight: 700;
  color: #0f766e;
  line-height: 1;
}
.axis-rows i { justify-content: flex-end; padding-right: .25rem; }
/* ボックスの区切りが見出しでも分かるように */
.axis-cols i:nth-child(3), .axis-cols i:nth-child(6) { border-right: 2px solid #99f6e4; }
.axis-rows i:nth-child(3), .axis-rows i:nth-child(6) { border-bottom: 2px solid #99f6e4; }

.board {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(9, 1fr);   /* 候補マークの高さで正方形が崩れるのを防ぐ */
  width: 100%;
  max-width: 420px;
  aspect-ratio: 1;
  border: 2.5px solid #134e4a;
  border-radius: 4px;
  overflow: hidden;
  background: #fff;
  user-select: none;
}
.board-frame .board { max-width: none; }

.cell {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border: 0.5px solid #cdd5e0;
  font-size: clamp(0.7rem, 2.4vw, 1.1rem);
  font-weight: 600;
  color: #134e4a;
  background: #fff;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
}

/* ボックス境界 */
.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; }
/* 関係するマス（行・列・ボックスなど） */
.cell.peer  { background: #d9f7f1; }
/* 技のパターンになっているマス */
.cell.hi    { background: #5eead4; box-shadow: inset 0 0 0 2px #0f766e; }
/* 候補を消せるマス */
.cell.elim-cell { background: #fecdd3; box-shadow: inset 0 0 0 2px #e11d48; }

.cell.placed {
  background: #0d9488;
  color: #fff;
  font-weight: 900;
}

/* 候補（ペンシルマーク） */
.marks {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  width: 100%;
  height: 100%;
  padding: 1px;
}
.marks i {
  display: flex;
  align-items: center;
  justify-content: center;
  font-style: normal;
  font-size: clamp(0.52rem, 2.3vw, 0.68rem);
  font-weight: 600;
  color: #6b7280;
  line-height: 1;
}
.marks i.focus { color: #0d9488; font-weight: 900; }
.marks i.gone {
  color: #dc2626;
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}
/* 濃い背景のマスでも候補が読めるように */
.cell.hi .marks i { color: #134e4a; }
.cell.hi .marks i.focus { color: #042f2e; }
.cell.elim-cell .marks i { color: #881337; }
.cell.elim-cell .marks i.gone { color: #be123c; }
.cell.sel .marks i { color: #78350f; }

.reveal-btn {
  display: block;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: .6rem;
  background: linear-gradient(135deg, #0d9488, #0f766e);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: .9rem;
  font-family: inherit;
  font-weight: bold;
  cursor: pointer;
  transition: opacity .15s;
}
.reveal-btn:hover { opacity: .9; }

.demo-answer {
  margin-top: .9rem;
  padding: .85rem 1rem;
  background: #fff;
  border: 1.5px solid #5eead4;
  border-radius: 10px;
}
.demo-answer p {
  font-size: .85rem !important;
  line-height: 1.9 !important;
  margin-bottom: .5rem !important;
  color: #44403c;
}
.demo-answer p:last-child { margin-bottom: 0 !important; }
.demo-answer b { color: #0f766e; font-weight: 700; }

.hidden { display: none; }

/* ━━━ 次の1手クイズ ━━━ */
.quiz-card { border: 2px solid #5eead4; }
.quiz-card h2 {
  font-size: 1.15rem;
  padding-bottom: .4rem;
  border-bottom: 2px solid #ccfbf1;
  margin-bottom: .6rem;
}
.quiz-lead { font-size: .88rem; line-height: 1.9; margin-bottom: .9rem; }
.quiz-lead strong { color: #0f766e; font-weight: 700; }

.q-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: .9rem; }
.q-tab {
  padding: 6px 11px;
  background: #fff;
  border: 1.5px solid #d6d3d1;
  border-radius: 20px;
  font-size: .78rem;
  font-family: inherit;
  font-weight: 600;
  color: #57534e;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.q-tab:hover { border-color: #0d9488; color: #0d9488; }
.q-tab.active { background: #0d9488; border-color: #0d9488; color: #fff; }

.q-score {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: .9rem;
}
.q-score-item {
  background: #f0fdfa;
  border: 1px solid #ccfbf1;
  border-radius: 8px;
  padding: .4rem .2rem;
  text-align: center;
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f766e;
  line-height: 1.3;
}
.q-score-label {
  display: block;
  font-size: .68rem;
  font-weight: 600;
  color: #78716c;
}

.q-tech-line { font-size: .82rem; color: #78716c; margin-bottom: .2rem; }
.q-tech-line b { color: #0d9488; font-size: .9rem; }

.q-prompt {
  font-size: .88rem;
  line-height: 1.8;
  background: #f0fdfa;
  border-left: 4px solid #0d9488;
  border-radius: 0 8px 8px 0;
  padding: .6rem .9rem;
  margin-bottom: .9rem;
}

/* 選択中のマス */
.cell.sel {
  background: #fbbf24;
  box-shadow: inset 0 0 0 3px #b45309;
  color: #451a03;
}
/* 答え合わせ後は「消せるマス」の表示を優先する */
.cell.elim-cell.sel {
  background: #fecdd3;
  box-shadow: inset 0 0 0 2px #e11d48;
}
.cell.elim-cell.sel .marks i { color: #881337; }
.cell.elim-cell.sel .marks i.gone { color: #be123c; }

/* 数字パッドは /sudoku の見た目に合わせる */
.q-pad {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: .35rem;
  max-width: 420px;
  margin: 0 auto .8rem;
}
.q-key {
  aspect-ratio: 0.85;
  background: #fff;
  border: 1.5px solid #d6d3d1;
  border-radius: 8px;
  font-size: clamp(0.85rem, 2.5vw, 1.2rem);
  font-family: inherit;
  font-weight: 700;
  color: #134e4a;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  -webkit-tap-highlight-color: transparent;
}
.q-key:hover { border-color: #0d9488; background: #f0fdfa; }

.q-actions {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  max-width: 420px;
  margin: 0 auto;
}
.q-actions .reveal-btn { max-width: none; }

.sub-btn {
  display: block;
  width: 100%;
  padding: .55rem;
  background: #fff;
  border: 1.5px solid #d6d3d1;
  border-radius: 10px;
  font-size: .85rem;
  font-family: inherit;
  font-weight: 600;
  color: #78716c;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.sub-btn:hover { border-color: #0d9488; color: #0d9488; }

.q-feedback {
  margin-top: .9rem;
  padding: .85rem 1rem;
  border-radius: 10px;
  border: 1.5px solid #e7e5e4;
  background: #fafafa;
}
.q-feedback.ok   { border-color: #5eead4; background: #f0fdfa; }
.q-feedback.ng   { border-color: #fca5a5; background: #fef2f2; }
.q-feedback.shown{ border-color: #fcd34d; background: #fffbeb; }
.q-feedback.hint { border-color: #d6d3d1; background: #fafafa; }
.q-fb-head { font-size: .9rem; font-weight: 700; margin-bottom: .35rem; }
.q-feedback.ok .q-fb-head   { color: #0f766e; }
.q-feedback.ng .q-fb-head   { color: #b91c1c; }
.q-feedback.shown .q-fb-head{ color: #b45309; }
.q-fb-why { font-size: .85rem; line-height: 1.9; color: #44403c; }

/* ━━━ 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; }

/* ━━━ 用語 ━━━ */
.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; }

.link { color: #0d9488; text-decoration: none; font-weight: bold; }
.link:hover { text-decoration: underline; }

/* ━━━ 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; }

/* ━━━ 関連ツール ━━━ */
.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; }

/* ━━━ フッター ━━━ */
footer {
  text-align: center;
  padding: 1.5rem 1rem;
  font-size: .82rem;
  color: #a8a29e;
  border-top: 1px solid #e7e5e4;
  margin-top: auto;
}
footer a { color: #0d9488; text-decoration: none; }
footer a:hover { text-decoration: underline; }
footer p + p { margin-top: .3rem; }

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

/* ━━━ レスポンシブ ━━━ */
@media (max-width: 480px) {
  h1 { font-size: 1.4rem; }
  .card { padding: 1.1rem; }
  .demo { padding: .75rem; }
  .amazon-grid { grid-template-columns: 1fr; }
}
