* {
  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: #3aa0ff;
  margin: 0 0 10px;
}

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

p {
  margin: 8px 0;
}

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

li {
  margin: 4px 0;
}

a {
  color: #3aa0ff;
  font-weight: 600;
}

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

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

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

hr {
  border: none;
  border-top: 2px solid #dceeff;
  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;
}

.rules-hero img {
  width: 60px;
  height: 60px;
  flex-shrink: 0;
}

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

.figure-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 16px 0 10px;
  padding: 18px 14px 26px;
  background: #f0f8ff;
  border: 2px solid #dceeff;
  border-radius: 16px;
}

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

.tile {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: #cdeed8;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
}

.tile.blank {
  background: #f2f7f0;
  border: 2px dashed #c9e4d3;
}

.tile-label {
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: #9c8d8d;
  white-space: nowrap;
}

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

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

.key-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  background: #ffffff;
  border: 2px solid #dceeff;
  font-weight: 700;
  font-size: 12px;
  color: #3aa0ff;
}

.color-swatch-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 14px 0;
}

.color-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 5px rgba(91, 74, 74, 0.18);
}

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

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

/* マカロンバトル等と同じ、具体例を見せるミニマス目。クレーの命中判定の説明などに使う。 */
.demo-cell {
  width: 40px;
  height: 40px;
  border: 2px solid #dceeff;
  border-radius: 10px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  line-height: 1.1;
  color: #5b4a4a;
  flex-shrink: 0;
}

.demo-cell .who {
  font-size: 9px;
  font-weight: 700;
  color: #9c8d8d;
}

.demo-cell.empty {
  background: #fffdfb;
  border-style: dashed;
  color: #9c8d8d;
}

.demo-cell.mine {
  border-color: #3aa0ff;
  background: #eaf7ff;
}

.demo-cell.miss {
  border-color: #ff8a8a;
  background: #fff0f0;
}

/* 数値の内訳などに使う囲み。 */
.payout-example {
  background: #f0f8ff;
  border: 2px solid #dceeff;
  border-radius: 16px;
  padding: 16px;
  margin: 14px 0;
}

.payout-example .row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 13px;
}

.payout-example .row.total {
  border-top: 1px dashed #dceeff;
  margin-top: 6px;
  padding-top: 8px;
  font-weight: 800;
}

/* 遊び方ページの「キーボード」図解。実物と同じANSI配列の段違い(スタッガー)を再現する。 */
.keyboard-figure {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
  margin: 4px auto;
  width: fit-content;
}

.keyboard-figure .krow {
  display: flex;
  gap: 6px;
}

.keyboard-figure .kkey {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: #ffffff;
  border: 2px solid #dceeff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #7a6a6a;
  position: relative;
}

.keyboard-figure .kkey.lit {
  background: #3aa0ff;
  border-color: #3aa0ff;
  color: #ffffff;
}

.keyboard-figure .kkey.home {
  border-width: 3px;
}

.keyboard-figure .kkey.bump::after {
  content: "";
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  opacity: 0.6;
}

.keyboard-figure .krow.indent1 { margin-left: 8px; }
.keyboard-figure .krow.indent2 { margin-left: 14px; }
.keyboard-figure .krow.indent3 { margin-left: 24px; }

/* 指ごとの色分け(shared/keyboard.js の FINGER_COLOR と揃える)。 */
.kkey.f-pinky { border-color: #ff5fa8; background: #ffeef6; color: #d84a8f; }
.kkey.f-ring  { border-color: #ff9f43; background: #fff3e4; color: #d9822b; }
.kkey.f-mid   { border-color: #2ecc71; background: #e9faf0; color: #1f9e56; }
.kkey.f-index { border-color: #3aa0ff; background: #eaf5ff; color: #2a7fd4; }

/* 文字が入る幅広のデモマス(demo-cellの正方形だと日本語ラベルがはみ出す)。 */
.demo-cell.wide {
  width: auto;
  min-width: 88px;
  height: auto;
  min-height: 48px;
  padding: 8px 12px;
  font-size: 13px;
  text-align: center;
}

.demo-cell.wide .who {
  font-size: 10px;
  white-space: nowrap;
}

/* ゲーム画面のイメージ図。 */
.screen-mock {
  border: 2px solid #dceeff;
  border-radius: 16px;
  overflow: hidden;
  margin: 14px 0 6px;
  background: linear-gradient(#dff1ff, #f4faff);
}

.mock-sky {
  position: relative;
  height: 84px;
}

.mock-sky svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.mock-clay {
  position: absolute;
  right: 14%;
  top: 8px;
  font-size: 24px;
  transform: rotate(-15deg);
}

.mock-tag {
  position: absolute;
  left: 12px;
  top: 10px;
  font-size: 11px;
  font-weight: 700;
  color: #3aa0ff;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 999px;
  padding: 2px 10px;
}

.screen-mock .mock-keys {
  margin: 0 auto 4px;
}

.mock-hands {
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: #7a6a6a;
  background: #fff6ea;
  padding: 6px 8px;
}

/* 早撃ちボーナスの帯グラフ。左(出現直後)ほど高倍率。 */
.timing-bar {
  display: flex;
  border-radius: 999px;
  overflow: hidden;
  border: 2px solid #dceeff;
  margin: 12px 0;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  line-height: 1.3;
}

.timing-bar .tzone {
  padding: 7px 4px;
}

.timing-bar .gold {
  flex: 3;
  background: linear-gradient(90deg, #ffd873, #ffe9ad);
  color: #8a6414;
}

.timing-bar .blue {
  flex: 5;
  background: linear-gradient(90deg, #cfeaff, #eaf5ff);
  color: #2a7fd4;
}

.timing-bar .red {
  flex: 1.2;
  background: #ffdede;
  color: #d05555;
}

.status-chip .num {
  color: #5b4a4a;
}

.status-chip.gold {
  border-color: #ffd873;
  background: #fff9e8;
  color: #b8860b;
}

.status-chip.bad {
  border-color: #ff8a8a;
  background: #fff0f0;
  color: #d05555;
}

.status-chip.bad .num {
  color: #d05555;
}

/* 練習/チャレンジのモード紹介カード。 */
.mode-cards {
  display: flex;
  gap: 12px;
  margin: 12px 0;
  flex-wrap: wrap;
}

.mode-card {
  flex: 1 1 220px;
  border: 2px solid #dceeff;
  border-radius: 16px;
  background: #f7fbff;
  padding: 12px 14px;
  font-size: 13px;
}

.mode-card .mode-name {
  font-weight: 800;
  color: #3aa0ff;
  margin-bottom: 4px;
}

.mode-card p {
  margin: 0;
}

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

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

  .rules-hero {
    gap: 10px;
  }

  .rules-hero img {
    width: 46px;
    height: 46px;
  }

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

  .keyboard-figure .kkey {
    width: 22px;
    height: 22px;
    font-size: 9px;
  }
}
