/* 5つの点から図形をいくつ作れるか（固定ページ figural-fluency 専用） */

.ff {
  --ff-mono: "SFMono-Regular", Menlo, Consolas, monospace;
  --ff-line: #4b5691;
  --ff-dot: #8a8f99;
  --ff-noise: #e4e0da;
  width: min(100% - 2.5rem, 760px);
  margin-inline: auto;
}

.ff-note {
  margin: 1.6rem 0 0;
  padding: 1rem 1.2rem;
  border-left: 3px solid var(--accent);
  background: var(--bg-tint);
  color: var(--ink-soft);
  font-size: 0.93rem;
  line-height: 1.85;
}

.ff-note strong { color: var(--ink); }
.ff-note p { margin: 0 0 0.6rem; }
.ff-note p:last-child { margin-bottom: 0; }

.ff-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.2rem, 3vw, 1.9rem);
  margin-top: 1.4rem;
}

.ff-panel h2 {
  font-family: var(--mincho);
  font-size: 1.25rem;
  letter-spacing: 0.04em;
  margin: 0 0 0.9rem;
}

.ff-panel h3 {
  font-family: var(--mincho);
  font-size: 1.05rem;
  margin: 2rem 0 0.8rem;
}

.ff-step {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  color: var(--accent);
  margin-bottom: 0.4rem;
  font-weight: 700;
}

.ff-lead { font-size: 0.9rem; color: var(--muted); line-height: 1.85; margin: 1rem 0 0; }

.ff-how { margin: 0; padding-left: 1.3rem; font-size: 0.95rem; line-height: 1.9; }
.ff-how li { margin-bottom: 0.4rem; }

.ff-actions { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 1.5rem; }

.ff-panel button {
  font-family: var(--gothic);
  font-size: 0.95rem;
  padding: 0.7rem 1.6rem;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

.ff-panel button:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.ff-panel button.ghost { background: #fff; color: var(--ink-soft); border-color: var(--line); }
.ff-panel button.ghost:hover { color: var(--accent); border-color: var(--accent); }

/* ---- 課題 ---- */
.ff-stage-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--line);
}

.ff-instruction { margin: 0; font-family: var(--mincho); font-size: 1.1rem; line-height: 1.5; }
.ff-meters { text-align: right; flex: 0 0 auto; }

.ff-timer {
  margin: 0;
  font-family: var(--ff-mono);
  font-size: 1.9rem;
  line-height: 1.1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.ff-timer.is-hurry { color: var(--accent-dark); }
.ff-timer .u { font-size: 0.45em; color: var(--muted); margin-left: 0.15em; }
.ff-count { margin: 0.2rem 0 0; font-size: 0.78rem; color: var(--muted); }
.ff-count span { font-family: var(--ff-mono); color: var(--ink); }

.ff-progress {
  height: 4px;
  margin: 0.9rem 0 1rem;
  background: var(--line-soft);
  border-radius: 2px;
  overflow: hidden;
}
.ff-progress span { display: block; height: 100%; background: var(--accent); width: 0; transition: width 0.3s linear; }

.ff-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

@media (max-width: 560px) { .ff-grid { grid-template-columns: repeat(4, 1fr); } }

.ff-cell {
  position: relative;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  touch-action: manipulation;
}

.ff-cell.is-filled { border-color: var(--ff-line); background: #f7f8fc; }
.ff-cell.is-dupe { border-color: var(--accent); background: #fdf1f4; }
.ff-cell svg { display: block; width: 100%; height: 100%; }
.ff-cell .dot { fill: #fff; stroke: var(--ff-dot); stroke-width: 1.6; }
.ff-cell .dot.is-armed { fill: var(--accent); stroke: var(--accent); }
.ff-cell .noise { stroke: var(--ff-noise); stroke-width: 1.4; fill: none; }
.ff-cell .link { stroke: var(--ff-line); stroke-width: 2; stroke-linecap: round; }

/* ---- 結果 ---- */
.ff-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin: 0.6rem 0 0;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

@media (max-width: 640px) { .ff-facts { grid-template-columns: 1fr; } }

.ff-facts > div { background: #fff; padding: 0.95rem 1.1rem 1.05rem; }
.ff-facts dt { font-size: 0.74rem; letter-spacing: 0.08em; color: var(--muted); }
.ff-facts dd {
  margin: 0.25rem 0 0;
  font-family: var(--ff-mono);
  font-size: 1.85rem;
  line-height: 1.2;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.ff-facts dd .u { font-size: 0.4em; color: var(--muted); margin-left: 0.1em; }
.ff-facts p { margin: 0.35rem 0 0; font-size: 0.76rem; color: var(--muted); line-height: 1.6; }

.ff-bars { display: flex; flex-direction: column; gap: 0.5rem; }
.ff-bar-row { display: grid; grid-template-columns: 4.6rem 1fr 3rem; align-items: center; gap: 0.7rem; }
.ff-bar-row .l { font-size: 0.82rem; color: var(--muted); }
.ff-bar-row .t { display: block; height: 14px; background: var(--line-soft); border-radius: 7px; overflow: hidden; }
.ff-bar-row .t span { display: block; height: 100%; background: var(--ff-line); border-radius: 7px; }
.ff-bar-row .v { font-family: var(--ff-mono); font-size: 0.85rem; text-align: right; color: var(--ink-soft); }

.ff-comment {
  margin: 1.3rem 0 0;
  padding: 0.9rem 1.1rem;
  border-left: 3px solid var(--accent);
  background: var(--bg-tint);
  font-size: 0.9rem;
  line-height: 1.85;
  color: var(--ink-soft);
}

.ff-comment strong { color: var(--ink); }

/* ---- 記録 ---- */
.ff-history { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.ff-history th,
.ff-history td {
  text-align: right;
  padding: 0.55rem 0.4rem;
  border-bottom: 1px solid var(--line-soft);
  font-size: 0.85rem;
}
.ff-history th { color: var(--muted); font-weight: 400; }
.ff-history th:first-child,
.ff-history td:first-child { text-align: left; }
.ff-history td { font-family: var(--ff-mono); color: var(--ink); }

.ff-link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent-dark);
  text-decoration: underline;
  cursor: pointer;
  font-size: inherit;
  font-family: inherit;
}

/* ---- 研究 ---- */
.ff-source { font-size: 0.9rem; line-height: 1.95; color: var(--ink-soft); }
.ff-source p { margin: 0 0 0.9rem; }
.ff-source strong { color: var(--ink); }
.ff-source a { color: var(--accent-dark); }
.ff-list { margin: 0 0 1rem; padding-left: 1.2rem; }
.ff-list li { margin-bottom: 0.5rem; }
.ff-list--fine li { font-size: 0.86rem; color: var(--muted); }
.ff-list--fine strong { color: var(--ink-soft); }
.ff-fine { font-size: 0.86rem; color: var(--muted); }
