* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 22px 24px 40px;
  font-family: "M PLUS Rounded 1c", -apple-system, "Hiragino Sans", "Yu Gothic", sans-serif;
  color: #5b4a4a;
  background: #fffdfb;
  line-height: 1.8;
  font-size: 14px;
}

h1 {
  font-size: 20px;
  font-weight: 800;
  color: #e85d84;
  margin: 0 0 10px;
}

h2 {
  font-size: 15px;
  font-weight: 700;
  color: #e85d84;
  margin: 26px 0 8px;
  border-bottom: 2px solid #ffe3ec;
  padding-bottom: 4px;
}

p {
  margin: 8px 0;
}

ul, ol {
  padding-left: 1.4em;
  margin: 8px 0;
}

li {
  margin: 4px 0;
}

a {
  color: #e85d84;
  font-weight: 600;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 13px;
}

th, td {
  border: 1px solid #ffe3ec;
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #ffe3ec;
  width: 30%;
  white-space: nowrap;
}

hr {
  border: none;
  border-top: 2px solid #ffe3ec;
  margin: 22px 0;
}

.meta {
  color: #9c8d8d;
  font-size: 13px;
}

.disclaimer {
  background: #fff6ea;
  border: 2px solid #ffe9d1;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 12px;
  color: #8a6d4a;
  margin-top: 22px;
}

/* 以下は遊び方ページ(rules.html)専用の図解パーツ。他の規約ページには影響しない。 */

.rules-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 6px;
}

/* 「①漢字が出る→②ボタンを押す→③答え合わせ」の3ステップを縦に並べる図解。
   文章だけでは伝わりにくかった(実機の画面そのものではなく、遊び方ページ用に
   縮小して再現したミニ部品を使う)。 */
.flow-steps {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin: 14px 0;
}

.flow-step {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 340px;
  background: #fff6fa;
  border: 2px solid #ffe3ec;
  border-radius: 14px;
  padding: 10px 14px;
}

.flow-arrow {
  font-size: 18px;
  color: #e85d84;
  line-height: 1;
}

.flow-text {
  font-size: 12px;
  line-height: 1.6;
  text-align: left;
}

/* ゲーム画面の升目(kanji-stage)を縮小再現したもの。 */
.mini-kanji-stage {
  position: relative;
  flex-shrink: 0;
  width: 62px;
  height: 62px;
  border: 2px solid #e6ddc8;
  border-radius: 10px;
  background: #fffdf6;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mini-kanji-stage::before,
.mini-kanji-stage::after {
  content: "";
  position: absolute;
  background: #e6ddc8;
}

.mini-kanji-stage::before { top: 0; bottom: 0; left: 50%; width: 1px; }
.mini-kanji-stage::after { left: 0; right: 0; top: 50%; height: 1px; }

.mini-kanji-stage span {
  position: relative;
  font-size: 30px;
  font-weight: 800;
  color: #3f3535;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "MS Mincho", serif;
}

/* ひらがなボタンの縮小版。実機と同じく、押したボタンは色を反転させる。 */
.mini-letters {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.mini-letter-btn {
  width: 30px;
  height: 26px;
  border: 2px solid #ffe3ec;
  border-radius: 7px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: #5b4a4a;
}

.mini-letter-btn.used {
  background: #e85d84;
  border-color: #e85d84;
  color: #ffffff;
}

/* 答え合わせのあとに出る枠の縮小版。ok/ng/skipの3色は実機の配色と揃えている。 */
.mini-typed {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.mini-typed-cell {
  width: 26px;
  height: 30px;
  border: 2px dashed #ffe3ec;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: #9c8d8d;
  background: #ffffff;
}

.mini-typed-cell.filled { border-style: solid; border-color: #e85d84; background: #fff6fa; color: #5b4a4a; }
.mini-typed-cell.ok { border-style: solid; border-color: #3fa06b; background: #eef8f2; color: #3fa06b; }
.mini-typed-cell.ng { border-style: solid; border-color: #d9534f; background: #ffeaea; color: #d9534f; }
.mini-typed-cell.skip { border-style: solid; border-color: #9c8d8d; background: #f1f0ec; color: #9c8d8d; }

.mini-typed-cell.lg { width: 34px; height: 38px; font-size: 16px; }

/* 正解・不正解・スキップの3色をまとめて見せる凡例。 */
.answer-legend {
  display: flex;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  margin: 14px 0;
}

.answer-legend-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: #9c8d8d;
  text-align: center;
  line-height: 1.5;
}

.rules-hero h1 {
  margin: 0 0 4px;
}

.figure-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin: 16px 0 6px;
  padding: 18px 14px;
  background: #fff6fa;
  border: 2px solid #ffe3ec;
  border-radius: 16px;
}

.figure-caption {
  text-align: center;
  color: #9c8d8d;
  font-size: 12px;
  margin: 0 0 18px;
}

.figure-arrow {
  font-size: 20px;
  color: #e85d84;
  flex-shrink: 0;
}

/* 遊び方ページに埋め込むミニ盤面。--size で 3x3 / 4x4 を切り替える。 */
.mini-board {
  --size: 3;
  display: grid;
  grid-template-columns: repeat(var(--size), 30px);
  grid-auto-rows: 30px;
  gap: 3px;
  padding: 6px;
  background: #ffffff;
  border: 2px solid #ffe3ec;
  border-radius: 10px;
  flex-shrink: 0;
}

.mini-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 800;
  line-height: 1;
  background: #fffdfb;
  border: 1px solid #ffe3ec;
  border-radius: 5px;
}

.mini-cell.maru {
  color: #4a9ad4;
}

.mini-cell.batsu {
  color: #e85d84;
}

.mini-cell.fresh {
  background: #fff6d8;
  border-color: #f2d16b;
}

.mini-cell.winning {
  background: #fff6d8;
  border-color: #f2d16b;
}

.status-chip-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0;
}

/* チップ内に置くクォッカのアイコン（プレイヤー / CPU の区別に使う）。 */
.chip-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  background: #ffffff;
  border: 2px solid #ffe3ec;
  font-weight: 700;
  font-size: 12px;
  color: #e85d84;
}

/* スマホなど幅の狭い画面向け。参加画面から開くポップアップ(iframe)内でも、
   iframeの幅を基準にこの指定が効く。 */
@media (max-width: 480px) {
  body {
    padding: 18px 14px 32px;
  }

  /* 長い見出しがnowrapのままだと横幅が足りずに表が画面からはみ出すので、折り返しを許可する。 */
  th {
    width: 34%;
    white-space: normal;
  }

  .figure-row {
    gap: 10px;
    padding: 16px 10px;
  }

  .mini-board {
    grid-template-columns: repeat(var(--size), 26px);
    grid-auto-rows: 26px;
  }

  .mini-cell {
    font-size: 15px;
  }
}

/* 起死回生の図で「押し出されて消える石」を示す。赤い破線で危険を表す。 */
.mini-cell.losing {
  border: 2px dashed #d9534f;
  background: #ffecec;
  position: relative;
}

/* 消えたあとのマス（比較用）。何も無いことをうっすら示す。 */
.mini-cell.lost {
  border: 2px dashed #e6d7d5;
  background: #fdf7f7;
}

/* 遊び方ページの盤面図用。
   「いま選んでいるマス」と「押してはいけないマス」を示す。 */
.mini-cell.picked {
  background: #fff2f6;
  border-color: #e85d84;
  border-width: 2px;
}

.mini-cell.hazard {
  background: #ffe0e0;
  border: 2px solid #d9534f;
}
