/*
 * HTML版テキストのスタイル（全回共通）
 * すべてのセレクタを .wdp-textbook の中に限定しています（ペイントエディター側の見た目を壊さないため）。
 * クラス名は tb- で始めます。幅で組み方を変えるときは @media ではなく @container textbook を使います。
 * 仕様は TEXT_SPEC.md を参照。
 *
 * 色の目安
 *   オレンジ（見出し）  #e8700a
 *   緑（ふきだし・ヒント） 背景 #5ecfb1 / ふち #3d9a82 / 文字 #0e3b31
 *   青（アイコンのタイル） #4c97ff
 */

/* ---------- 基本 ---------- */
.wdp-textbook {
  font-family: "BIZ UDPGothic", "Hiragino Maru Gothic ProN", "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif;
  font-size: 15px;
  line-height: 2.2;
  color: #222;
  overflow-wrap: anywhere;
}
.wdp-textbook .tb-lesson {
  padding: 4px 4px 32px;
}
.wdp-textbook .tb-lesson * {
  max-width: 100%;
}
.wdp-textbook ruby {
  ruby-position: over;
}
.wdp-textbook rt {
  font-size: 0.5em;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0;
}

/* ---------- 表紙 ---------- */
.wdp-textbook .tb-cover {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  padding: 8px 0 12px;
  border-bottom: 3px solid #e8700a;
}
.wdp-textbook .tb-cover-tiles {
  position: relative;
  flex: 0 0 auto;
  width: 104px;
  height: 104px;
}
.wdp-textbook .tb-tile {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: #4c97ff;
  box-shadow: 0 3px 6px rgba(40, 80, 160, 0.3);
}
.wdp-textbook .tb-tile img {
  width: 28px;
  height: 28px;
  filter: brightness(0) invert(1);
}
.wdp-textbook .tb-tile--1 { left: 2px;  top: 6px;  transform: rotate(-12deg); }
.wdp-textbook .tb-tile--2 { left: 56px; top: 0;    transform: rotate(10deg); }
.wdp-textbook .tb-tile--3 { left: 8px;  top: 54px; transform: rotate(8deg); }
.wdp-textbook .tb-tile--4 { left: 58px; top: 58px; transform: rotate(-8deg); }

.wdp-textbook .tb-cover-body {
  flex: 1 1 220px;
  min-width: 0;
}
.wdp-textbook .tb-title {
  margin: 0;
  font-size: 21px;
  font-weight: 800;
  line-height: 1.9;
  color: #e8700a;
}
.wdp-textbook .tb-aims {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 14px;
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
  font-weight: 700;
}
.wdp-textbook .tb-aims-label {
  display: inline-block;
  padding: 0 10px;
  border-radius: 999px;
  background: #fff1e0;
  border: 1px solid #e8700a;
  color: #b04f00;
  font-size: 13px;
  font-weight: 700;
  line-height: 2.1;
}
.wdp-textbook .tb-aims li::before {
  content: "・";
}

/* ---------- 見出し・本文 ---------- */
.wdp-textbook .tb-section {
  margin-top: 26px;
}
.wdp-textbook .tb-section--cont {
  margin-top: 16px;
}
.wdp-textbook .tb-heading {
  margin: 0 0 8px;
  padding: 2px 14px;
  border-radius: 3px;
  background: #e8700a;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  line-height: 2.2;
}
.wdp-textbook .tb-text {
  margin: 6px 0;
}
.wdp-textbook .tb-subheading {
  margin: 14px 0 2px;
  font-size: 16px;
  font-weight: 800;
  line-height: 2.2;
}
.wdp-textbook .tb-key {
  display: inline-block;
  padding: 0 0.5em;
  border: 1px solid #555;
  border-bottom-width: 3px;
  border-radius: 5px;
  background: #fff;
  font-family: inherit;
  font-size: 0.9em;
  line-height: 1.5;
}
.wdp-textbook .tb-em {
  font-weight: 800;
  color: #b04f00;
}

/* ツールのアイコン（文中） */
.wdp-textbook .tb-icon {
  box-sizing: content-box;
  width: 1.3em;
  height: 1.3em;
  margin: 0 0.1em;
  padding: 2px;
  border: 1px solid #b9c7d9;
  border-radius: 5px;
  background: #fff;
  vertical-align: middle;
}

/* ---------- 画像 ---------- */
.wdp-textbook .tb-figure {
  margin: 10px 0;
}
.wdp-textbook .tb-img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid #8a8f98;
  background: #fff;
}
.wdp-textbook .tb-cap {
  display: block;
  margin: 2px 0 0;
  font-size: 13px;
  line-height: 2.1;
  color: #444;
}
.wdp-textbook .tb-pair {
  display: grid;
  gap: 10px;
  margin: 10px 0;
}
.wdp-textbook .tb-pair > .tb-figure {
  margin: 0;
}
/* テキスト欄が広いときだけ、画像を2つ横に並べる */
@container textbook (min-width: 560px) {
  .wdp-textbook .tb-pair {
    grid-template-columns: 1fr 1fr;
  }
}

/* 手順の流れ（画像と画像のあいだに矢印） */
.wdp-textbook .tb-flow {
  display: flex;
  flex-direction: column;
  margin: 10px 0;
}
.wdp-textbook .tb-flow > .tb-figure {
  margin: 0;
}
.wdp-textbook .tb-flow > .tb-figure + .tb-figure::before {
  content: "";
  display: block;
  width: 0;
  height: 0;
  margin: 6px auto 8px;
  border-left: 15px solid transparent;
  border-right: 15px solid transparent;
  border-top: 19px solid #ff4b0f;
}

/* ---------- ふきだし・ヒント ---------- */
.wdp-textbook .tb-balloon {
  position: relative;
  margin: 14px 0 10px;
  padding: 4px 14px;
  border-radius: 14px;
  background: #5ecfb1;
  color: #0e3b31;
  line-height: 2.1;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.18);
}
.wdp-textbook .tb-balloon::before {
  content: "";
  position: absolute;
  top: -11px;
  left: 28px;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-bottom: 12px solid #5ecfb1;
}
.wdp-textbook .tb-balloon p {
  margin: 2px 0;
}
.wdp-textbook .tb-hint {
  margin: 14px 0;
  padding: 6px 16px;
  border: 3px solid #3d9a82;
  border-radius: 16px;
  background: #5ecfb1;
  color: #0e3b31;
}
.wdp-textbook .tb-hint p {
  margin: 4px 0;
}
.wdp-textbook .tb-hint .tb-icon {
  border-color: #3d9a82;
}

/* ---------- 色の表 ---------- */
.wdp-textbook .tb-table {
  border-collapse: collapse;
  margin: 6px auto;
  background: #fff;
  color: #222;
  font-size: 14px;
  line-height: 2;
}
.wdp-textbook .tb-table th,
.wdp-textbook .tb-table td {
  padding: 0 12px;
  border: 1px solid #3d9a82;
  text-align: center;
  white-space: nowrap;
}
.wdp-textbook .tb-table th {
  background: #e6f7f2;
  font-weight: 700;
}
.wdp-textbook .tb-swatch {
  display: inline-block;
  width: 1.1em;
  height: 1.1em;
  margin-right: 0.3em;
  border: 1px solid #333;
  border-radius: 50%;
  vertical-align: -0.2em;
}
.wdp-textbook .tb-swatch--black  { background: #000; }
.wdp-textbook .tb-swatch--red    { background: #f00; }
.wdp-textbook .tb-swatch--yellow { background: #f4ff00; }
.wdp-textbook .tb-swatch--blue   { background: #0029ff; }

/* ---------- れんしゅう ---------- */
.wdp-textbook .tb-cards {
  display: grid;
  gap: 4px 14px;
}
.wdp-textbook .tb-card {
  min-width: 0;
}
@container textbook (min-width: 560px) {
  .wdp-textbook .tb-cards {
    grid-template-columns: 1fr 1fr;
  }
}

/* ---------- 道具の説明（アイコン・名前・説明） ---------- */
.wdp-textbook .tb-defs {
  display: grid;
  gap: 6px 14px;
  margin: 8px 0 4px;
  padding: 0;
  list-style: none;
}
.wdp-textbook .tb-def {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 2px 10px;
  border-radius: 10px;
  background: #e6f7f2;
  color: #0e3b31;
}
.wdp-textbook .tb-def-icon {
  flex: 0 0 auto;
  box-sizing: content-box;
  width: 30px;
  height: 30px;
  margin-top: 8px;
  padding: 3px;
  border: 1px solid #b9c7d9;
  border-radius: 6px;
  background: #fff;
}
.wdp-textbook .tb-def-body {
  min-width: 0;
}
.wdp-textbook .tb-def-name {
  display: block;
  font-weight: 800;
  line-height: 2.1;
}
.wdp-textbook .tb-def-text {
  display: block;
  line-height: 2.1;
}
@container textbook (min-width: 560px) {
  .wdp-textbook .tb-defs {
    grid-template-columns: 1fr 1fr;
  }
}

/* ---------- 文中の点（形を変えるツールの「●」「○」） ---------- */
.wdp-textbook .tb-dot {
  display: inline-block;
  width: 0.8em;
  height: 0.8em;
  margin: 0 0.1em;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #0f9bf0;
  box-shadow: 0 0 0 1px #0f9bf0;
  vertical-align: -0.05em;
}
.wdp-textbook .tb-dot--ring {
  background: #b8c0cc;
  box-shadow: 0 0 0 1px #0f9bf0;
}

/* カードの中の表は左にそろえる */
.wdp-textbook .tb-card > .tb-table {
  margin-left: 0;
}
